/* =============================================================================
   conversations2.css — Zdravko.ai · "Moji razgovori" v2 (razgovori2.php)
   -----------------------------------------------------------------------------
   Sve je skopirano pod body.rg2-page kako NE bi utjecalo na postojeću
   /razgovori/ stranicu (razgovori.php + conversations.css ostaju netaknuti).
   Vizualni jezik prati chat2.php/chat2.css: zeleni topbar, meki radiusi,
   suptilne sjene, mirnija tipografija (Inter/system-ui).
   ============================================================================= */

body.rg2-page{
  --rg-green:        #128C7E;
  --rg-green-dark:   #075E54;
  --rg-ink:          #0f172a;
  --rg-muted:        #5b6b7b;
  --rg-muted-soft:   #7b8794;
  --rg-line:         rgba(15,23,42,.08);
  --rg-line-soft:    rgba(15,23,42,.055);
  --rg-surface:      #ffffff;
  --rg-surface-2:    #f7faf9;
  --rg-tint:         rgba(18,140,126,.055);
  --rg-tint-strong:  rgba(18,140,126,.11);
  --rg-tint-border:  rgba(18,140,126,.18);
  --rg-danger:       #b3261e;
  --rg-danger-tint:  rgba(179,38,30,.08);
  --rg-shadow-sm:    0 1px 2px rgba(15,23,42,.04), 0 4px 14px rgba(15,23,42,.045);
  --rg-shadow-md:    0 14px 36px rgba(15,23,42,.09);
  --rg-radius-lg:    24px;
  --rg-radius:       16px;
  --rg-radius-sm:    12px;
  --rg-side-w:       296px;
  --rg-content-max:  1240px;
  --rg-font:         Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-family: var(--rg-font);
  background: #f4f8f7;
  color: var(--rg-ink);
}

body.rg2-page *, body.rg2-page *::before, body.rg2-page *::after{ box-sizing: border-box; }
body.rg2-page [hidden]{ display: none !important; }
body.rg2-page{ min-height: 100dvh; }
body.rg2-page .rg2-app{ min-height: 100dvh; display: flex; flex-direction: column; padding-top: 0; }

/* =============================================================================
   1) TOPBAR — isti smjer kao chat2.php (zeleni gradient, logo, pill akcije)
   ============================================================================= */
body.rg2-page .rg2-topbar{
  position: fixed; top: 0; left: 0; right: 0; width: 100%; z-index: 50;
  box-sizing: border-box;
  min-height: 64px;
  background: linear-gradient(180deg, #023f3b 0%, var(--rg-green-dark) 100%);
  box-shadow: 0 2px 14px rgba(7,94,84,.22);
  border-bottom: 1px solid rgba(255,255,255,.10);
}
body.rg2-page .rg2-topbar-inner{
  box-sizing: border-box;
  min-height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 0 clamp(16px, 2.4vw, 32px);
  width: 100%;
}
body.rg2-page .rg2-brand{
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: #fff; min-width: 0;
}
body.rg2-page .rg2-brand:hover{ text-decoration: none; filter: brightness(.98); }
body.rg2-page .rg2-brand-logo{ width: 34px; height: 34px; flex: 0 0 auto; object-fit: contain; }
body.rg2-page .rg2-brand-name{ font-weight: 700; font-size: 1.1rem; letter-spacing: -.3px; white-space: nowrap; }
body.rg2-page .rg2-brand-dot{ color: rgba(255,255,255,.72); }

body.rg2-page .rg2-topbar-right{ display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
body.rg2-page .rg2-pill{
  display: inline-flex; align-items: center; gap: 7px;
  padding: .5rem .9rem; min-height: 38px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.32);
  background: rgba(255,255,255,.12); color: #fff;
  font-size: .82rem; font-weight: 700; white-space: nowrap;
  text-decoration: none; cursor: pointer;
}
body.rg2-page .rg2-pill:hover{ background: rgba(255,255,255,.2); color: #fff; text-decoration: none; }
body.rg2-page .rg2-icon-btn-top{
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.1);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
body.rg2-page .rg2-icon-btn-top:hover{ background: rgba(255,255,255,.2); }
body.rg2-page .rg2-icon-btn-top svg{ width: 20px; height: 20px; }
body.rg2-page .rg2-sidebar-toggle{ display: none; }

/* =============================================================================
   2) SHELL LAYOUT — sidebar (lijevo, trajan na desktopu) | glavni sadržaj
   ============================================================================= */
body.rg2-page .rg2-shell{
  flex: 1 1 auto;
  display: block;
  min-height: 0;
}
body.rg2-page .rg2-side-backdrop{
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  z-index: 205; opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
body.rg2-page .rg2-side-backdrop.is-visible{
  opacity: 1; pointer-events: auto; visibility: visible;
  transition: opacity .2s ease, visibility 0s linear 0s;
}

body.rg2-page .rg2-sidebar{
  flex: 0 0 auto;
  width: var(--rg-side-w);
  background: var(--rg-surface);
  border-right: 1px solid var(--rg-line-soft);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Novi razgovor split button (chat2-stil: glavni gumb + spojeni ▾ chevron) --- */
body.rg2-page .rg2-newchat-row{ display: flex; align-items: center; gap: 8px; padding: 2px 2px 16px; }
body.rg2-page .rg2-newchat-split{ flex: 1 1 auto; display: flex; min-width: 0; }
body.rg2-page .rg2-newchat-main{ flex: 1 1 auto; min-width: 0; }
body.rg2-page .rg2-newchat{
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 48px; padding: 0 16px;
  border-radius: 14px; border: 1.5px solid var(--rg-tint-border);
  background: var(--rg-surface); box-shadow: var(--rg-shadow-sm);
  color: var(--rg-green-dark); font-weight: 700; font-size: .96rem; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-decoration: none;
}
body.rg2-page .rg2-newchat:hover{ border-color: var(--rg-green); background: var(--rg-tint); box-shadow: var(--rg-shadow-md); color: var(--rg-green-dark); text-decoration: none; }
body.rg2-page .rg2-newchat svg{ flex: 0 0 auto; display: block; }
body.rg2-page .rg2-newchat-main{
  border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-width: 0;
}
body.rg2-page .rg2-newchat-role-toggle{
  flex: 0 0 auto; height: 48px; width: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--rg-tint-border); border-left: 1px solid var(--rg-line);
  border-top-right-radius: 14px; border-bottom-right-radius: 14px;
  background: var(--rg-surface); box-shadow: var(--rg-shadow-sm);
  color: var(--rg-green-dark); cursor: pointer;
}
body.rg2-page .rg2-newchat-split:hover .rg2-newchat-main,
body.rg2-page .rg2-newchat-split:focus-within .rg2-newchat-main,
body.rg2-page .rg2-newchat-split:hover .rg2-newchat-role-toggle,
body.rg2-page .rg2-newchat-split:focus-within .rg2-newchat-role-toggle{
  border-color: var(--rg-green); background: var(--rg-tint); box-shadow: var(--rg-shadow-md);
}
body.rg2-page .rg2-caret{ font-size: .72rem; opacity: .8; }
body.rg2-page .rg2-side-mobile-close{ display: none; }

/* --- Razdjelnik između sekcija sidebara --- */
body.rg2-page .rg2-side-divider{ height: 1px; margin: 8px 6px 10px; background: var(--rg-line-soft); }

/* --- Primarna navigacija --- */
body.rg2-page .rg2-nav{ display: grid; gap: 2px; padding: 0 2px; }
body.rg2-page .rg2-nav-item{
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border-radius: 12px; border: none; background: transparent;
  color: var(--rg-ink); text-decoration: none; font-size: .92rem; font-weight: 600;
  cursor: pointer;
}
body.rg2-page .rg2-nav-item:hover{ background: var(--rg-tint); text-decoration: none; color: var(--rg-ink); }
body.rg2-page .rg2-nav-item svg{ flex: 0 0 auto; width: 18px; height: 18px; display: block; }
body.rg2-page .rg2-nav-item.is-active{
  background: var(--rg-tint-strong); color: var(--rg-green-dark); font-weight: 700;
}
body.rg2-page .rg2-nav-item.is-active svg{ color: var(--rg-green-dark); }

body.rg2-page .rg2-side-spacer{ flex: 1 1 auto; }

/* --- Footer linkovi sidebara --- */
body.rg2-page .rg2-side-footer{
  display: grid; gap: 2px; padding: 14px 2px 2px;
  border-top: 1px solid var(--rg-line-soft); margin-top: 12px;
}
body.rg2-page .rg2-side-foot-item{
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 10px; border: none; background: transparent; border-radius: 11px;
  text-align: left; cursor: pointer; color: var(--rg-ink); text-decoration: none;
  font-size: .87rem; font-weight: 600; white-space: nowrap; overflow: hidden;
  font-family: inherit;
}
body.rg2-page .rg2-side-foot-item:hover{ background: var(--rg-tint); text-decoration: none; color: var(--rg-ink); }
body.rg2-page .rg2-side-foot-item svg{ flex: 0 0 auto; color: var(--rg-muted-soft); width: 17px; height: 17px; display: block; }
body.rg2-page .rg2-side-foot-danger{ color: var(--rg-danger); }
body.rg2-page .rg2-side-foot-danger svg{ color: var(--rg-danger); }
body.rg2-page .rg2-side-foot-danger:hover{ background: var(--rg-danger-tint); color: var(--rg-danger); }

/* =============================================================================
   3) GLAVNI SADRŽAJ
   ============================================================================= */
body.rg2-page .rg2-main{
  margin-left: 0;
  min-width: 0;
  padding: clamp(20px, 3vw, 40px) clamp(18px, 3vw, 40px) 60px;
  display: flex; justify-content: center;
}
body.rg2-page .rg2-main-inner{ width: 100%; max-width: var(--rg-content-max); }

body.rg2-page .rg2-page-head{ margin-bottom: 20px; }
body.rg2-page .rg2-page-head h1{
  margin: 0 0 6px; font-size: clamp(1.5rem, 2.4vw, 1.85rem); font-weight: 700;
  color: var(--rg-ink); letter-spacing: -.4px; line-height: 1.2;
}
body.rg2-page .rg2-page-head p{
  margin: 0; color: var(--rg-muted-soft); font-size: .96rem; font-weight: 500;
}

body.rg2-page .rg2-card{
  background: var(--rg-surface); border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius-lg); box-shadow: var(--rg-shadow-sm);
  padding: 18px clamp(16px, 2vw, 26px) 10px;
}

/* --- Toolbar: search | date filter | segmented --- */
body.rg2-page .rg2-toolbar{
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 6px; border-bottom: 1px solid var(--rg-line-soft);
}
body.rg2-page .rg2-search{
  flex: 1 1 260px; min-width: 200px;
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 14px;
  border-radius: 13px; border: 1px solid var(--rg-line); background: var(--rg-surface-2);
}
body.rg2-page .rg2-search:focus-within{ border-color: var(--rg-tint-border); background: var(--rg-surface); box-shadow: 0 0 0 3px var(--rg-tint); }
body.rg2-page .rg2-search svg{ flex: 0 0 auto; color: var(--rg-muted-soft); width: 18px; height: 18px; }
body.rg2-page .rg2-search input{
  flex: 1 1 auto; min-width: 0; border: none; background: transparent; outline: none;
  font-size: .92rem; color: var(--rg-ink); font-family: inherit;
}
body.rg2-page .rg2-search input::placeholder{ color: var(--rg-muted-soft); }

body.rg2-page .rg2-date-filter{ position: relative; flex: 0 0 auto; }
body.rg2-page .rg2-date-toggle{
  display: flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 14px; min-width: 220px;
  border-radius: 13px; border: 1px solid var(--rg-line); background: var(--rg-surface-2);
  cursor: pointer; text-align: left; font-family: inherit;
}
body.rg2-page .rg2-date-toggle:hover{ border-color: var(--rg-tint-border); }
body.rg2-page .rg2-date-toggle.is-open{ border-color: var(--rg-tint-border); background: var(--rg-surface); box-shadow: 0 0 0 3px var(--rg-tint); }
body.rg2-page .rg2-date-toggle svg{ flex: 0 0 auto; color: var(--rg-muted-soft); width: 17px; height: 17px; }
body.rg2-page .rg2-date-copy{ flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
body.rg2-page .rg2-date-copy strong{ font-size: .82rem; font-weight: 700; color: var(--rg-ink); }
body.rg2-page .rg2-date-copy em{ font-style: normal; font-size: .74rem; color: var(--rg-muted-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.rg2-page .rg2-date-chevron{ flex: 0 0 auto; color: var(--rg-muted-soft); transition: transform .15s ease; }
body.rg2-page .rg2-date-toggle.is-open .rg2-date-chevron{ transform: rotate(180deg); }
body.rg2-page .rg2-date-panel{
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: min(320px, 90vw); background: #fff; border: 1px solid var(--rg-line);
  border-radius: 16px; box-shadow: var(--rg-shadow-md); padding: 14px;
  display: grid; gap: 10px;
}
body.rg2-page .rg2-date-field{ display: grid; gap: 6px; font-size: .8rem; color: var(--rg-muted); font-weight: 600; }
body.rg2-page .rg2-date-field input{
  height: 40px; border-radius: 10px; border: 1px solid var(--rg-line);
  padding: 0 10px; font-size: .87rem; font-family: inherit; color: var(--rg-ink);
}
body.rg2-page .rg2-date-clear{
  justify-self: start; border: none; background: transparent; color: var(--rg-green-dark);
  font-weight: 700; font-size: .84rem; cursor: pointer; padding: 4px 2px;
}
body.rg2-page .rg2-date-clear:hover{ text-decoration: underline; }

body.rg2-page .rg2-segmented{
  flex: 0 0 auto; display: inline-flex; gap: 2px;
  background: var(--rg-surface-2); border: 1px solid var(--rg-line);
  border-radius: 999px; padding: 4px;
  max-width: 100%; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none;
}
body.rg2-page .rg2-segmented::-webkit-scrollbar{ display: none; }
body.rg2-page .rg2-seg-btn{
  border: none; background: transparent; color: var(--rg-muted);
  padding: 9px 16px; border-radius: 999px; font-size: .84rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
body.rg2-page .rg2-seg-btn:hover{ color: var(--rg-ink); }
body.rg2-page .rg2-seg-btn.is-active{ background: var(--rg-green-dark); color: #fff; box-shadow: var(--rg-shadow-sm); }

/* --- Status / empty state --- */
body.rg2-page .rg2-status{ padding: 22px 4px; color: var(--rg-muted-soft); font-size: .9rem; text-align: center; }
body.rg2-page .rg2-status.is-error{ color: var(--rg-danger); }
body.rg2-page .rg2-empty{
  padding: 48px 20px 40px; text-align: center; display: grid; justify-items: center; gap: 10px;
}
body.rg2-page .rg2-empty-icon{
  width: 56px; height: 56px; border-radius: 16px; background: var(--rg-tint-strong);
  color: var(--rg-green-dark); display: inline-flex; align-items: center; justify-content: center;
}
body.rg2-page .rg2-empty-icon svg{ width: 26px; height: 26px; }
body.rg2-page .rg2-empty h2{ margin: 6px 0 0; font-size: 1.1rem; font-weight: 700; color: var(--rg-ink); }
body.rg2-page .rg2-empty p{ margin: 0; color: var(--rg-muted-soft); font-size: .9rem; max-width: 360px; }
body.rg2-page .rg2-empty-actions{ display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
body.rg2-page .rg2-btn-primary,
body.rg2-page .rg2-btn-secondary{
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 18px; border-radius: 12px; font-size: .88rem; font-weight: 700;
  cursor: pointer; text-decoration: none; font-family: inherit;
}
body.rg2-page .rg2-btn-primary{ background: var(--rg-green-dark); color: #fff; border: 1px solid var(--rg-green-dark); }
body.rg2-page .rg2-btn-primary:hover{ background: var(--rg-green); color: #fff; text-decoration: none; }
body.rg2-page .rg2-btn-secondary{ background: var(--rg-surface); color: var(--rg-green-dark); border: 1px solid var(--rg-tint-border); }
body.rg2-page .rg2-btn-secondary:hover{ background: var(--rg-tint); text-decoration: none; color: var(--rg-green-dark); }

/* --- Lista razgovora --- */
body.rg2-page .rg2-list{ padding: 14px 0 4px; }
body.rg2-page .rg2-row{
  display: flex; align-items: center; gap: 10px;
  background: var(--rg-surface); border: 1px solid var(--rg-line);
  border-radius: var(--rg-radius); margin-bottom: 10px;
  transition: border-color .14s ease, box-shadow .14s ease;
}
body.rg2-page .rg2-row:hover{ border-color: var(--rg-tint-border); box-shadow: var(--rg-shadow-sm); }
body.rg2-page .rg2-row-open{
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 14px;
  padding: 14px 6px 14px 14px; border: none; background: transparent; cursor: pointer;
  text-align: left; font-family: inherit;
}
body.rg2-page .rg2-row-icon{
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px;
  background: var(--rg-tint-strong); color: var(--rg-green-dark);
  display: inline-flex; align-items: center; justify-content: center;
}
body.rg2-page .rg2-row-icon svg{ width: 19px; height: 19px; }
body.rg2-page .rg2-row-main{ flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
body.rg2-page .rg2-row-title{
  font-size: .96rem; font-weight: 700; color: var(--rg-ink); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.rg2-page .rg2-row-preview{
  font-size: .85rem; font-weight: 500; color: var(--rg-muted); line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.rg2-page .rg2-row-meta{
  flex: 0 0 auto; display: flex; align-items: center; gap: 16px; white-space: nowrap;
}
body.rg2-page .rg2-row-badge{
  flex: 0 0 auto;
  padding: 4px 11px; border-radius: 999px; background: var(--rg-tint-strong);
  color: var(--rg-green-dark); font-weight: 600; font-size: .78rem;
}
body.rg2-page .rg2-row-count{ color: var(--rg-muted-soft); font-size: .82rem; font-weight: 500; }
body.rg2-page .rg2-row-date{ color: var(--rg-muted-soft); font-size: .82rem; font-weight: 500; min-width: 96px; text-align: right; }
body.rg2-page .rg2-row-actions{ flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding-right: 12px; }
body.rg2-page .rg2-icon-btn{
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--rg-line);
  background: var(--rg-surface-2); color: var(--rg-muted); display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer;
}
body.rg2-page .rg2-icon-btn svg{ width: 17px; height: 17px; display: block; }
body.rg2-page .rg2-icon-edit:hover{ background: var(--rg-tint); color: var(--rg-green-dark); border-color: var(--rg-tint-border); }
body.rg2-page .rg2-icon-delete{ color: var(--rg-danger); }
body.rg2-page .rg2-icon-delete:hover{ background: var(--rg-danger-tint); border-color: rgba(179,38,30,.25); }

/* --- Footer / paginacija --- */
body.rg2-page .rg2-list-footer{
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; padding: 16px 4px 18px; border-top: 1px solid var(--rg-line-soft); margin-top: 4px;
}
body.rg2-page .rg2-footer-count{ color: var(--rg-muted-soft); font-size: .85rem; font-weight: 500; }
body.rg2-page .rg2-pagination{ display: flex; align-items: center; gap: 5px; }
body.rg2-page .rg2-page-btn{
  min-width: 34px; height: 34px; padding: 0 4px; border-radius: 10px; border: 1px solid var(--rg-line);
  background: #fff; color: var(--rg-ink); cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: .85rem; font-family: inherit;
}
body.rg2-page .rg2-page-btn:hover{ border-color: var(--rg-tint-border); background: var(--rg-tint); }
body.rg2-page .rg2-page-btn.is-active{ background: var(--rg-green-dark); color: #fff; border-color: var(--rg-green-dark); }
body.rg2-page .rg2-page-btn.is-active:hover{ background: var(--rg-green-dark); }
body.rg2-page .rg2-page-btn:disabled{ opacity: .4; cursor: not-allowed; background: #fff; border-color: var(--rg-line); color: var(--rg-ink); }
body.rg2-page .rg2-page-btn svg{ width: 15px; height: 15px; }
body.rg2-page .rg2-per-page{ display: flex; align-items: center; gap: 8px; color: var(--rg-muted-soft); font-size: .85rem; font-weight: 500; }
body.rg2-page .rg2-per-page select{
  border-radius: 10px; border: 1px solid var(--rg-line); padding: 6px 10px; font-size: .85rem;
  background: #fff; color: var(--rg-ink); font-family: inherit; cursor: pointer;
}

/* --- Skeleton loading --- */
body.rg2-page .rg2-skel{
  height: 74px; border-radius: var(--rg-radius); margin-bottom: 10px;
  background: linear-gradient(90deg, rgba(15,23,42,.05) 25%, rgba(15,23,42,.09) 37%, rgba(15,23,42,.05) 63%);
  background-size: 400% 100%; animation: rg2Shimmer 1.4s ease infinite;
}
@keyframes rg2Shimmer{ 0%{ background-position: 100% 0; } 100%{ background-position: 0 0; } }

/* =============================================================================
   4) POPOVERI I MODALI
   ============================================================================= */
body.rg2-page .rg2-pop{
  position: fixed; z-index: 260; min-width: 190px; max-width: 300px;
  background: #fff; color: var(--rg-ink); border: 1px solid var(--rg-line);
  border-radius: 14px; box-shadow: var(--rg-shadow-md); padding: 6px;
}
body.rg2-page .rg2-pop-item{
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: none; background: transparent; border-radius: 9px;
  text-align: left; cursor: pointer; color: var(--rg-ink); font-size: .87rem; font-weight: 600;
  text-decoration: none; font-family: inherit;
}
body.rg2-page .rg2-pop-item:hover{ background: var(--rg-tint); text-decoration: none; color: var(--rg-ink); }
body.rg2-page .rg2-pop-item svg{ flex: 0 0 auto; width: 16px; height: 16px; display: block; color: var(--rg-muted-soft); }
body.rg2-page .rg2-pop-item.is-danger{ color: var(--rg-danger); }
body.rg2-page .rg2-pop-item.is-danger svg{ color: var(--rg-danger); }
body.rg2-page .rg2-pop-item.is-danger:hover{ background: var(--rg-danger-tint); }

body.rg2-page .rg2-modal-backdrop{
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  padding: 18px; background: rgba(4,21,18,.42);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
body.rg2-page .rg2-modal{
  width: min(460px, 100%); border-radius: 22px; background: #fff;
  box-shadow: 0 30px 80px rgba(4,21,18,.28); padding: 22px;
}
body.rg2-page .rg2-modal h2{ margin: 0 0 8px; font-size: 1.25rem; font-weight: 700; color: var(--rg-ink); letter-spacing: -.3px; }
body.rg2-page .rg2-modal p{ margin: 0 0 16px; color: var(--rg-muted); font-size: .92rem; line-height: 1.5; font-weight: 500; }
body.rg2-page .rg2-modal-field{ display: block; margin: 0 0 16px; }
body.rg2-page .rg2-modal-field span{ display: block; margin: 0 0 6px; color: var(--rg-muted); font-size: .82rem; font-weight: 700; }
body.rg2-page .rg2-modal-field input{
  width: 100%; height: 46px; border-radius: 13px; border: 1px solid var(--rg-line);
  padding: 0 12px; font-size: .92rem; font-family: inherit; color: var(--rg-ink); outline: none;
}
body.rg2-page .rg2-modal-field input:focus{ border-color: var(--rg-tint-border); box-shadow: 0 0 0 3px var(--rg-tint); }
body.rg2-page .rg2-modal-actions{ display: grid; gap: 8px; }
body.rg2-page .rg2-modal-actions button{
  appearance: none; border: 1px solid var(--rg-line); min-height: 46px; border-radius: 13px;
  background: #fff; color: var(--rg-green-dark); font-weight: 700; font-size: .9rem;
  cursor: pointer; font-family: inherit;
}
body.rg2-page .rg2-modal-actions .is-primary{ background: var(--rg-green-dark); color: #fff; border-color: var(--rg-green-dark); }
body.rg2-page .rg2-modal-actions .is-danger{ background: var(--rg-danger); color: #fff; border-color: var(--rg-danger); }
body.rg2-page.rg2-modal-open{ overflow: hidden; }

.sr-only{
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important;
}

/* =============================================================================
   5) RESPONSIVE — tablet / mobitel
   ============================================================================= */

/* Sidebar postaje off-canvas ispod 992px */
@media (max-width: 991px){
  body.rg2-page .rg2-sidebar-toggle{ display: inline-flex; }
  body.rg2-page .rg2-main{ margin-left: 0; }
  body.rg2-page .rg2-sidebar{
    position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh;
    width: min(86vw, 320px); max-width: 320px; z-index: 210;
    box-shadow: 0 20px 60px rgba(15,23,42,.28);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  body.rg2-page .rg2-sidebar.rg2-mobile-open{ transform: translateX(0); }
  body.rg2-page .rg2-side-mobile-close{
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--rg-line);
    background: var(--rg-surface); color: var(--rg-muted); font-size: 1.05rem; cursor: pointer;
  }
  body.rg2-page .rg2-side-mobile-close:hover{ background: var(--rg-tint); color: var(--rg-green-dark); }
  body.rg2-page .rg2-newchat-row{ padding-right: 4px; }
}

@media (max-width: 767px){
  body.rg2-page .rg2-topbar-inner{ padding: 0 14px; }
  body.rg2-page .rg2-brand-name{ font-size: 1rem; }
  body.rg2-page .rg2-pill span{ display: none; }
  body.rg2-page .rg2-pill{ padding: .5rem .65rem; }
  body.rg2-page .rg2-main{ padding: 16px 12px 44px; }
  body.rg2-page .rg2-page-head h1{ font-size: 1.35rem; }
  body.rg2-page .rg2-card{ padding: 14px 12px 6px; border-radius: 20px; }

  body.rg2-page .rg2-toolbar{ flex-direction: column; align-items: stretch; gap: 10px; }
  body.rg2-page .rg2-search{ flex-basis: auto; width: 100%; }
  body.rg2-page .rg2-date-filter{ width: 100%; }
  body.rg2-page .rg2-date-toggle{ width: 100%; min-width: 0; }
  body.rg2-page .rg2-segmented{ width: 100%; }

  /* Redovi razgovora -> mobilne kartice: ikona+naslov u istom redu, značka
     uloge (Pacijent/Liječnik) u gornjem desnom kutu kartice, preview poravnat
     ispod naslova, meta (broj poruka/datum) dijeli redak s akcijama umjesto
     velikog razmaka između njih. */
  body.rg2-page .rg2-row{ position: relative; }
  body.rg2-page .rg2-row-open{
    display: grid;
    grid-template-columns: 34px 1fr;
    grid-template-areas:
      "icon  title"
      ".     preview"
      "meta  meta";
    row-gap: 5px;
    column-gap: 10px;
    align-items: start;
    padding: 14px 104px 14px 14px;
    width: 100%;
  }
  body.rg2-page .rg2-row-icon{ grid-area: icon; width: 34px; height: 34px; align-self: center; }
  body.rg2-page .rg2-row-main{ display: contents; }
  body.rg2-page .rg2-row-title{ grid-area: title; align-self: center; min-width: 0; }
  body.rg2-page .rg2-row-preview{ grid-area: preview; min-width: 0; }
  body.rg2-page .rg2-row-badge{
    position: absolute; top: 14px; right: 12px;
    font-size: .72rem; padding: 3px 9px; white-space: nowrap;
  }
  body.rg2-page .rg2-row-meta{
    grid-area: meta; display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 10px; margin-top: 2px;
  }
  body.rg2-page .rg2-row-date{ text-align: left; min-width: 0; }
  body.rg2-page .rg2-row-actions{
    position: absolute; right: 12px; bottom: 14px;
    padding: 0; margin: 0; gap: 8px;
  }

  body.rg2-page .rg2-list-footer{ flex-direction: column; align-items: center; text-align: center; }
  body.rg2-page .rg2-pagination{ order: -1; }
}
