/* ============================================================
   NEXERA HIS — Main Stylesheet
   Modern UI with Inter font, dark nav, light content
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Brand ────────────────────────────────────── */
  --primary:        #1a5f8a;
  --primary-light:  #dbeafe;
  --primary-dark:   #0d1b2a;
  --primary-hover:  #1a75a8;

  /* ── Status ───────────────────────────────────── */
  --success:        #0f7a3c;
  --success-light:  #dcfce7;
  --warning:        #b05e00;
  --warning-light:  #fef3c7;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --info:           #0369a1;
  --info-light:     #e0f2fe;
  --purple:         #7c3aed;

  /* ── Surfaces ─────────────────────────────────── */
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface2:       #f8fafc;
  --surface3:       #f0f4f8;

  /* ── Borders ──────────────────────────────────── */
  --border:         #e2e8f0;
  --border2:        #cbd5e1;

  /* ── Text ─────────────────────────────────────── */
  --text:           #0f172a;
  --text2:          #334155;
  --text3:          #64748b;
  --text4:          #94a3b8;

  /* ── Layout ───────────────────────────────────── */
  --sidebar-w:      224px;
  --header-h:       56px;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  /* ── Shadows ──────────────────────────────────── */
  --shadow:         0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 16px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.07);

  --transition:     .15s ease;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================================================
   LOGIN
================================================================ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #071628 0%, #0d2b45 45%, #14476e 100%);
  position: relative;
  overflow: hidden;
}
#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(26,95,138,.3) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(13,59,92,.2) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.32), 0 8px 24px rgba(0,0,0,.2);
  position: relative;
  z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo i {
  font-size: 44px;
  color: var(--primary);
  display: block;
  margin-bottom: 10px;
}
.login-logo h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.login-logo p {
  font-size: 13px;
  color: var(--text3);
  margin-top: 4px;
}

/* ================================================================
   LAYOUT
================================================================ */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Hide old sidebar/header — layout is now top-nav only */
#sidebar { display: none !important; }
#main    { display: contents; }
#header  { display: none !important; }

/* ================================================================
   TOP NAVBAR
================================================================ */
#app {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh;
  overflow: hidden;
}

#topnav {
  height: 50px;
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

/* Secondary bar — page navigation groups, own row below the utility bar */
#topnav-secondary {
  height: 42px;
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 99;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-nav-toggle:hover { background: rgba(255,255,255,.18); }

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.topnav-logo i { color: #5bc8f5; font-size: 19px; }

/* Active facility indicator, next to the logo (multi-facility) */
.topnav-facility {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 14px;
  padding: 5px 12px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  flex-shrink: 1;
  min-width: 0;
  transition: background .15s;
}
.topnav-facility span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topnav-facility i { font-size: 14px; opacity: .85; flex-shrink: 0; }
.topnav-facility.clickable { cursor: pointer; }
.topnav-facility.clickable:hover { background: rgba(255,255,255,.2); }
.topnav-facility.satellite { background: rgba(255,150,50,.22); border-color: rgba(255,150,50,.4); }

/* Nav groups */
.topnav-groups {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 1px;
}

/* Direct nav link (e.g. Dashboard) — no dropdown */
.nav-direct {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s ease;
  white-space: nowrap;
  margin-right: 2px;
}
.nav-direct:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-direct.active {
  color: #fff;
  box-shadow: inset 0 -2px 0 #5bc8f5;
}

/* Hitna pomoć — red standalone nav button */
.nav-hitna {
  color: #fff !important;
  background: rgba(220,38,38,.75);
  border-radius: 6px;
  padding: 6px 13px;
  margin-left: 6px;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid rgba(220,38,38,.9);
  animation: hitna-pulse 2.5s ease-in-out infinite;
}
.nav-hitna:hover { background: rgba(220,38,38,1) !important; }
.nav-hitna.active { background: rgba(220,38,38,1) !important; box-shadow: 0 0 0 3px rgba(220,38,38,.35); }
@keyframes hitna-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  50%      { box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

.nav-group {
  position: relative;
}

.nav-group-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s ease;
  white-space: nowrap;
}
.nav-group-btn:hover,
.nav-group.open .nav-group-btn {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.nav-group-btn.has-active {
  color: #fff;
  box-shadow: inset 0 -2px 0 #5bc8f5;
}
.nav-group.open .nav-group-btn .nav-chevron {
  transform: rotate(180deg);
}
.nav-chevron {
  font-size: 11px;
  opacity: .7;
  transition: transform .2s ease;
}

/* Dropdown */
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: dropDown .15s ease;
}
@keyframes dropDown {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.nav-group.open .nav-dropdown {
  display: block;
}

/* Nav items inside dropdown */
.nav-dropdown .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: background .1s ease;
  border-radius: 0;
  margin: 0;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.nav-dropdown .nav-item:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.nav-dropdown .nav-item:last-child  { border-bottom: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.nav-dropdown .nav-item:hover       { background: var(--primary-light); color: var(--primary); }
.nav-dropdown .nav-item.active      { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-dropdown .nav-item i           { font-size: 15px; color: var(--text4); flex-shrink: 0; }
.nav-dropdown .nav-item:hover i,
.nav-dropdown .nav-item.active i    { color: var(--primary); }

/* Right side */
.topnav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.topnav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border-radius: var(--radius);
  border-left: 1px solid rgba(255,255,255,.12);
}

/* Search in topnav */
.header-search {
  position: relative;
  flex: 1;
  max-width: 380px;
}
.header-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 15px;
  pointer-events: none;
}
.header-search input {
  width: 100%;
  padding: 6px 10px 6px 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface2);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.header-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(26,95,138,.1);
}
.header-search input::placeholder { color: var(--text4); }

/* Override for dark topnav */
#topnav .header-search input {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.15);
  color: #fff;
}
#topnav .header-search input::placeholder { color: rgba(255,255,255,.45); }
#topnav .header-search input:focus {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.35);
  box-shadow: none;
}
#topnav .header-search i { color: rgba(255,255,255,.45); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  max-height: 320px;
  overflow-y: auto;
}
.search-dropdown.open { display: block; }
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.search-item:hover { background: var(--primary-light); }
.search-item:last-child { border-bottom: none; }

/* User avatar */
.user-avatar-sm {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
#topnav .user-avatar-sm {
  background: rgba(255,255,255,.18);
  color: #fff;
}
#topnav #sb-name  { color: #fff !important; font-size: 12px; font-weight: 600; }
#topnav #sb-role  { color: rgba(255,255,255,.55); font-size: 10px; }

/* ================================================================
   PAGE TITLE BAR
================================================================ */
#pagetitlebar {
  height: 42px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  gap: 8px;
}
#pagetitlebar #page-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: -.1px;
}

/* ================================================================
   CONTENT AREA
================================================================ */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  background: var(--bg);
}
#flash-area { position: relative; z-index: 100; }

/* Notification badge */
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--primary-dark);
  pointer-events: none;
}

/* ================================================================
   COMPONENTS — Cards
================================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card[style*="cursor:pointer"]:hover,
.card[onclick]:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  transition: all var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.card-header h3 {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
  letter-spacing: -.1px;
}
.card-header > i:first-child {
  font-size: 16px;
  flex-shrink: 0;
}

.card-body     { padding: 16px; }
.card-body.p0  { padding: 0; }

.mb12 { margin-bottom: 12px; }
.mt8  { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.m12  { margin: 12px; }

/* ================================================================
   COMPONENTS — Section header (page-level)
================================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.section-header h2 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  letter-spacing: -.2px;
}

/* ================================================================
   COMPONENTS — Buttons
================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover:not(:disabled) {
  background: var(--surface3);
  border-color: var(--border2);
  color: var(--text);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-xs  { padding: 3px 8px;  font-size: 11px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}
.btn-warning:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }

.btn-neutral {
  background: var(--surface2);
  color: var(--text2);
  border-color: var(--border2);
}
.btn-neutral:hover:not(:disabled) { background: var(--surface3); color: var(--text); }

.btn-icon-only {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  color: var(--text3);
  display: flex;
  align-items: center;
  font-size: 18px;
  transition: background var(--transition);
}
.btn-icon-only:hover { background: var(--surface2); }

/* ================================================================
   COMPONENTS — Badges
================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1px;
  white-space: nowrap;
}
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-primary   { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--surface2); color: var(--text3); border: 1px solid var(--border); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-neutral   { background: var(--surface2);      color: var(--text3); border: 1px solid var(--border); }
.badge-purple    { background: #f3e8ff; color: var(--purple); }
.badge-odmor-ceka    { background: #fef3c7; color: #92400e; }
.badge-odmor-ok      { background: #dcfce7; color: #166534; }
.badge-odmor-odbijen { background: #fee2e2; color: #991b1b; }

/* ================================================================
   COMPONENTS — Flash messages
================================================================ */
.flash {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 8px;
  animation: slideIn .2s ease;
  box-shadow: var(--shadow-md);
  font-weight: 500;
}
.flash-success { background: var(--success-light); color: var(--success); border: 1px solid #a7d9b5; }
.flash-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #f5aba3; }
.flash-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #9dc8f0; }
.flash-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #f5ca8a; }
@keyframes slideIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }

/* ================================================================
   COMPONENTS — Alerts
================================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #f5aba3; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #9dc8f0; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #f5ca8a; }

/* ================================================================
   COMPONENTS — Forms
================================================================ */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11.5px; font-weight: 600; color: var(--text3); letter-spacing: .1px; }

.form-control {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,95,138,.1);
}
.form-control::placeholder { color: var(--text4); }
.form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control  { cursor: pointer; }

.form-hint {
  font-size: 11px;
  color: var(--text4);
  margin-top: 2px;
}
.form-section {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 5px;
  margin-bottom: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* ================================================================
   COMPONENTS — Tables
================================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface2); position: sticky; top: 0; z-index: 1; }
th {
  padding: 9px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(26,95,138,.03); transition: background .1s; }
td.actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ================================================================
   COMPONENTS — Stats grid
================================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card[style*="cursor:pointer"]:hover,
.stat-card[onclick]:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--info), #38bdf8); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card:nth-child(5)::before { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.stat-card:nth-child(6)::before { background: linear-gradient(90deg, var(--primary), #38bdf8); }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  margin-bottom: 12px;
}
.stat-icon.blue   { background: var(--info-light);    color: var(--info); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: var(--purple); }

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 2px;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -.5px;
}
.stat-sub { font-size: 11px; color: var(--text4); margin-top: 4px; }

/* ================================================================
   COMPONENTS — Modal
================================================================ */
#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  width: 640px;
  max-width: 100%;
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity:0; transform:translateY(16px) scale(.97); }
  to   { opacity:1; transform:none; }
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -.2px;
}
.modal-body { padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  position: sticky;
  bottom: 0;
}

/* ================================================================
   COMPONENTS — Tabs
================================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover  { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel         { display: none; }
.tab-panel.active  { display: block; }

/* ================================================================
   COMPONENTS — Loading & Empty states
================================================================ */
.loading, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 16px;
  color: var(--text3);
  gap: 10px;
}
.loading i, .empty-state i { font-size: 32px; opacity: .35; }
.loading i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state p { font-size: 13px; text-align: center; color: var(--text3); }

/* ================================================================
   COMPONENTS — Pagination
================================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ================================================================
   GRID LAYOUTS
================================================================ */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
@media (max-width: 900px) { .two-col   { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .three-col { grid-template-columns: repeat(2,1fr); } }

/* ================================================================
   COMPONENTS — Info rows (detail view)
================================================================ */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  min-width: 120px;
  padding-top: 2px;
  letter-spacing: .1px;
}
.info-value { flex: 1; color: var(--text); }

/* ================================================================
   COMPONENTS — Patient avatar
================================================================ */
.patient-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

/* ================================================================
   COMPONENTS — Vital cards
================================================================ */
.vital-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
}
.vital-name    { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.vital-val     { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 3px 0; }
.vital-unit    { font-size: 10px; color: var(--text4); }
.vital-normal  { color: var(--success); }
.vital-warning { color: var(--warning); }
.vital-danger  { color: var(--danger); }

/* ================================================================
   COMPONENTS — Progress bar
================================================================ */
.progress-bar  { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s ease; }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger); }

/* ================================================================
   COMPONENTS — Bed cards
================================================================ */
.bed-card {
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 76px;
}
.bed-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.bed-free     { background: var(--success-light); border-color: #a7d9b5; }
.bed-occupied { background: var(--info-light);    border-color: #9dc8f0; }
.bed-cleaning { background: var(--warning-light); border-color: #f5ca8a; }
.bed-service  { background: var(--surface2);      border-color: var(--border2); }

/* ================================================================
   RADIOLOGIJA — Worklist
================================================================ */
.rad-worklist-row.priority-hitan td      { border-left: 3px solid var(--warning); }
.rad-worklist-row.priority-hitan        { background: rgba(176,94,0,.03); }
.rad-worklist-row.priority-vrlo_hitan td { border-left: 3px solid var(--danger); }
.rad-worklist-row.priority-vrlo_hitan   { background: rgba(220,38,38,.05); animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { background: rgba(220,38,38,.05); }
  50%       { background: rgba(220,38,38,.10); }
}

/* DICOM viewer placeholder */
.dicom-viewer {
  background: #0a0a0a;
  color: #8af;
  border-radius: var(--radius);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-family: monospace;
  text-align: center;
  padding: 20px;
  border: 1px solid #222;
}

/* Image thumbnails */
.rad-image-thumb {
  width: 72px;
  height: 72px;
  background: #111;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
  color: #8af;
  font-size: 24px;
}
.rad-image-thumb:hover { border-color: var(--primary); }

.rad-nalaz-form { font-size: 13px; }

/* ================================================================
   MKB-11 autocomplete
================================================================ */
.mkb-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
}
.mkb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  font-size: 13px;
}
.mkb-item:last-child { border-bottom: none; }
.mkb-item:hover { background: var(--primary-light); }
.mkb-kod {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 55px;
  text-align: center;
  flex-shrink: 0;
}
.mkb-naziv { color: var(--text2); flex: 1; }
/* Engleski original ispod prijevoda — WHO nema bs paket, pa naziv prevodimo
   mi (MkbPrijevod); original ostaje vidljiv radi provjere. */
.mkb-naziv-wrap { flex: 1; min-width: 0; }
.mkb-naziv-en { display: block; font-size: 11px; color: var(--text3); margin-top: 1px; }

/* ================================================================
   NOTIFICATION BELL
================================================================ */
.notif-bell-wrap { position: relative; }
.notif-bell-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 17px;
  position: relative;
  transition: background .15s;
}
.notif-bell-btn:hover { background: rgba(255,255,255,.18); }

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  overflow: hidden;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface2);
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { background: rgba(26,95,138,.04); }
.notif-item .notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.notif-icon-odmor    { background: #dbeafe; color: #2563eb; }
.notif-icon-uspjeh   { background: #dcfce7; color: #16a34a; }
.notif-icon-opasnost { background: #fee2e2; color: #dc2626; }
.notif-icon-info     { background: var(--surface3); color: var(--text3); }
.notif-item .notif-body { flex: 1; min-width: 0; }
.notif-item .notif-naslov { font-size: 12px; font-weight: 600; color: var(--text); }
.notif-item .notif-poruka { font-size: 11px; color: var(--text3); margin-top: 2px; line-height: 1.4; }
.notif-item .notif-time   { font-size: 10px; color: var(--text4); margin-top: 4px; }
.notif-empty { padding: 32px; text-align: center; color: var(--text3); font-size: 13px; }

/* ================================================================
   LOGIN — lang buttons (also used in topnav)
================================================================ */
.lang-selector { display:flex; gap:5px; justify-content:center; margin-bottom:16px; }
.lang-btn {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text3);
  transition: all .15s;
}
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.lang-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* Dark nav overrides for lang buttons */
#topnav .lang-btn {
  border-color: rgba(255,255,255,.2);
  color: rgba(255,255,255,.65);
}
#topnav .lang-btn:hover  { border-color: rgba(255,255,255,.5); color: #fff; }
#topnav .lang-btn.active { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.3); color: #fff; }

/* ================================================================
   DROPDOWN SUB-SECTION HEADERS
================================================================ */
.nav-dropdown-section {
  padding: 5px 14px 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text4);
  background: var(--surface2);
  border-top: 1px solid var(--border);
  pointer-events: none;
  user-select: none;
}
.nav-dropdown .nav-item + .nav-dropdown-section,
.nav-dropdown-section:first-child {
  border-top-color: var(--border);
}

/* ================================================================
   PAGE TRANSITION ANIMATION
================================================================ */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.page-enter { animation: pageFadeIn .18s ease; }

/* ================================================================
   CUSTOM SCROLLBARS
================================================================ */
#content::-webkit-scrollbar { width: 5px; }
#content::-webkit-scrollbar-track { background: transparent; }
#content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
#content::-webkit-scrollbar-thumb:hover { background: var(--text4); }

/* Modal scroll */
#modal-box::-webkit-scrollbar { width: 4px; }
#modal-box::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ================================================================
   ENHANCED TABLE ROWS
================================================================ */
tr[style*="cursor:pointer"]:hover td { background: rgba(26,95,138,.05) !important; cursor: pointer; }

/* ================================================================
   UTILITIES
================================================================ */
.fw600 { font-weight: 600; }
.gap8  { display: flex; align-items: center; gap: 8px; }
.text-danger  { color: var(--danger)  !important; }
.text-success { color: var(--success) !important; }
.text-muted   { color: var(--text3)   !important; }

code {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--primary);
}

/* Info blocks used in detail modals (nabavka, trebovanje, etc.) */
.info-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ================================================================
   DARK MODE
================================================================ */
[data-theme="dark"] {
  --bg:            #0f172a;
  --surface:       #1e293b;
  --surface2:      #243347;
  --surface3:      #334155;
  --border:        #334155;
  --border2:       #475569;
  --text:          #f1f5f9;
  --text2:         #cbd5e1;
  --text3:         #94a3b8;
  --text4:         #64748b;
  --primary-light: #1e3a5f;
  --success-light: #0d2b1a;
  --warning-light: #2b1a06;
  --danger-light:  #2b0d0d;
  --info-light:    #0d1e2b;
  --shadow:        0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:     0 4px 16px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.25);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.3);
}
[data-theme="dark"] #topnav {
  background: #0d1b2a;
}
[data-theme="dark"] #topnav-secondary {
  border-bottom: 1px solid #1e293b;
}
[data-theme="dark"] #pagetitlebar { background: var(--surface); }
[data-theme="dark"] thead { background: var(--surface2); }
[data-theme="dark"] tr:hover td { background: rgba(255,255,255,.03) !important; }
[data-theme="dark"] .form-control,
[data-theme="dark"] select.form-control,
[data-theme="dark"] textarea.form-control {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="dark"] .form-control:focus {
  background: var(--surface3);
  border-color: var(--primary);
}
[data-theme="dark"] code { background: var(--surface3); }
[data-theme="dark"] .nav-dropdown { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .nav-dropdown .nav-item { color: var(--text2); border-color: var(--border); }
[data-theme="dark"] .modal-footer { background: var(--surface2); }
[data-theme="dark"] .mkb-dropdown { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .notif-panel { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .search-dropdown { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .stat-card::before { opacity: .85; }

/* Dark mode toggle button */
.dark-toggle {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
  transition: background .15s;
  flex-shrink: 0;
}
.dark-toggle:hover { background: rgba(255,255,255,.2); }

/* ================================================================
   SKELETON LOADING
================================================================ */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}
.skeleton-line {
  display: block;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface3) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  height: 12px;
}
.skeleton-row td { padding: 13px 14px; }
.skeleton-card {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface3) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-lg);
  min-height: 80px;
}

/* ================================================================
   SORTABLE TABLES
================================================================ */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: color .12s;
}
th.sortable:hover { color: var(--primary); }
th.sortable::after {
  content: ' ⇅';
  opacity: .3;
  font-size: 10px;
}
th.sort-asc::after  { content: ' ↑'; opacity: 1; color: var(--primary); }
th.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--primary); }

/* Export button next to section headers */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text3);
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
}
.btn-export:hover { background: var(--surface3); color: var(--text2); border-color: var(--border2); }

/* ================================================================
   RESPONSIVE / MOBILE
================================================================ */

/* iOS Safari auto-zooms the whole page when a focused text input/select/
   textarea computes under 16px — the involuntary zoom-in a phone user then
   has to pinch back out from ("need to zoom in/out to see the menu"). Gated
   on pointer:coarse (device capability) rather than viewport width, since a
   touch device is still a touch device at any window size. !important +
   a broad element selector so it also overrides the handful of pages that
   set their own inline font-size on a field (izvjestaji.js, kuhinja.js,
   administracija.js, etc.) without having to patch each one individually. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

@media (max-width: 900px) {
  .mobile-nav-toggle { display: flex; }

  /* #topnav-secondary (the page-nav bar: Dashboard/Pacijenti/Klinika/...)
     is a non-wrapping row of ~8 items — on a phone it just runs off the
     right edge inside its overflow:hidden ancestors, silently swallowing
     items like "Hitna pomoć". Turn it into a slide-in drawer instead. */
  #topnav-secondary {
    position: fixed;
    top: 50px;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(84vw, 300px);
    background: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 150;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    border-bottom: none;
  }
  #topnav-secondary.mobile-open { transform: translateX(0); }

  .topnav-groups { flex-direction: column; align-items: stretch; width: 100%; gap: 0; }

  .nav-direct, .nav-group-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 13px 16px;
    font-size: 15px;
    border-radius: 0;
    margin-right: 0;
  }
  .nav-hitna { margin-left: 0; margin-top: 6px; justify-content: center; }

  /* Dropdowns become inline accordions instead of floating panels — there's
     no room to float a 220px menu over a 300px-wide drawer. */
  .nav-dropdown {
    position: static;
    display: none;
    width: 100%;
    min-width: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: rgba(0,0,0,.12);
    animation: none;
  }
  .nav-group.open .nav-dropdown { display: block; }
  .nav-dropdown .nav-item {
    padding: 13px 20px 13px 40px;
    font-size: 14px;
    white-space: normal;
    color: rgba(255,255,255,.9);
    border-bottom-color: rgba(255,255,255,.1);
  }
  .nav-dropdown .nav-item:hover,
  .nav-dropdown .nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
  .nav-dropdown .nav-item i { color: rgba(255,255,255,.6); }
  .nav-dropdown .nav-item:hover i,
  .nav-dropdown .nav-item.active i { color: #fff; }
  .nav-dropdown-section { color: rgba(255,255,255,.5); }

  #nav-backdrop { z-index: 140 !important; }

  /* #topnav's utility cluster (search/dark-mode/notifications/user+lang+
     logout) doesn't fit a phone width either — scroll it instead of
     hiding any of it, so every feature stays reachable. */
  .topnav-right {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topnav-right::-webkit-scrollbar { display: none; }
  .header-search { max-width: 150px; flex: 0 0 auto; }
  .topnav-facility { max-width: 110px; margin-left: 8px; }

  /* Readability + touch targets for the desktop-density text/controls
     used throughout every module's tables and forms. */
  #pagetitlebar { padding: 0 14px; }
  #content { padding: 14px; }
  .form-group label { font-size: 13px; }
  .form-hint { font-size: 12px; }
  .form-section { font-size: 12px; }
  th { font-size: 11.5px; padding: 8px 10px; }
  td { font-size: 13.5px; padding: 10px; }
  .stat-label { font-size: 11.5px; }
  .stat-value { font-size: 24px; }
  .btn { min-height: 38px; }
  .btn-sm { min-height: 34px; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
}

/* Chart containers */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-wrap {
  position: relative;
  height: 240px;
}

/* ============================================================
   Nexera Asistent — help chatbot (footer dugme + panel)
   ============================================================ */
.assistant-fab-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #00B2FF 0%, #006AFF 55%, #A100FF 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 6px 20px rgba(0,106,255,.4), 0 2px 8px rgba(0,0,0,.15);
  z-index: 501;
  transition: transform .15s ease, box-shadow .15s ease;
}
.assistant-fab-btn:hover { transform: scale(1.08); box-shadow: 0 8px 24px rgba(0,106,255,.5), 0 3px 10px rgba(0,0,0,.2); }
.assistant-fab-btn:active { transform: scale(.97); }

.assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 94px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 130px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  flex-direction: column;
  overflow: hidden;
  transition: width .2s ease, height .2s ease;
}
/* Prošireno dok je aktivan vizuelni vodič — šematski ekran treba više prostora. */
.assistant-panel--wide {
  width: 460px;
  height: 560px;
}
.assistant-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #00B2FF 0%, #006AFF 55%, #A100FF 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.assistant-panel-header i.ti-brand-messenger { font-size: 16px; }
.assistant-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  opacity: .85;
  cursor: pointer;
  font-size: 15px;
  padding: 2px;
}
.assistant-close-btn:hover { opacity: 1; }

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface2);
}
.assistant-msg {
  max-width: 85%;
  padding: 8px 11px;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.assistant-msg-bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
}
.assistant-msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
}
.assistant-typing i { animation: spin 1.2s linear infinite; }

.assistant-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.assistant-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  max-height: 80px;
}
.assistant-input:focus { outline: none; border-color: var(--primary); }
.assistant-send-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.assistant-send-btn:hover { background: var(--primary-hover); }
.assistant-send-btn:disabled { opacity: .6; cursor: default; }

@media (max-width: 480px) {
  .assistant-panel, .assistant-panel--wide {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 86px;
  }
  .assistant-panel--wide { height: min(72vh, 620px); }
  .assistant-fab-btn {
    right: 14px;
    bottom: 14px;
    width: 54px;
    height: 54px;
    font-size: 24px;
  }
}

/* ============================================================
   Nexera Asistent — vizuelni vodič (StoryboardPlayer)
   ============================================================ */
.sb-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sb-cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.sb-cta:hover { background: var(--primary); color: #fff; }

.sb-player {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  font-size: 11px;
}
.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.sb-title { font-weight: 700; color: var(--text); font-size: 11.5px; }
.sb-speed {
  color: var(--text3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 600;
}

.sb-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  overflow: hidden;
}
.sb-frame {
  position: absolute;
  inset: 0;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: sb-fade .22s ease;
}
@keyframes sb-fade { from { opacity: 0; } to { opacity: 1; } }

.sb-menu {
  display: flex;
  gap: 3px;
  flex-wrap: nowrap;
  overflow: hidden;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--primary);
  flex-shrink: 0;
}
.sb-menu-item {
  font-size: 8.5px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 3px;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text3);
  white-space: nowrap;
}
.sb-menu-item.is-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.sb-context {
  font-size: 9.5px;
  color: var(--text3);
  padding: 1px 0 4px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sb-dropdown {
  align-self: flex-start;
  margin-top: 1px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 5px;
  box-shadow: var(--shadow-md);
  padding: 3px;
  min-width: 96px;
  position: relative;
  z-index: 2;
}
.sb-dropdown-item {
  font-size: 9.5px;
  padding: 4px 6px;
  border-radius: 3px;
  color: var(--text2);
}
.sb-dropdown-item.is-active { background: var(--primary-light); color: var(--primary); font-weight: 700; }

.sb-pagetitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  padding: 2px 0;
}
.sb-tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); }
.sb-tab {
  font-size: 8.5px;
  padding: 3px 5px;
  border-radius: 3px 3px 0 0;
  color: var(--text3);
  background: var(--surface2);
  white-space: nowrap;
}
.sb-tab.is-active { background: var(--surface); color: var(--primary); font-weight: 700; box-shadow: inset 0 -2px 0 var(--primary); }

.sb-body { flex: 1; display: flex; flex-direction: column; gap: 5px; min-height: 0; }
.sb-actionrow { display: flex; justify-content: flex-end; }
.sb-btn-primary {
  font-size: 9px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}
.sb-btn-ghost {
  font-size: 9px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  color: var(--text3);
}

.sb-form { display: flex; flex-direction: column; gap: 4px; }
.sb-field { display: flex; flex-direction: column; gap: 2px; }
.sb-field-lbl { font-size: 8.5px; color: var(--text3); }
.sb-field-box {
  height: 12px;
  border: 1px solid var(--border2);
  border-radius: 3px;
  background: var(--surface);
}

.sb-table { display: flex; flex-direction: column; gap: 3px; }
.sb-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
}
.sb-row.is-target { border-color: var(--primary); background: var(--primary-light); }
.sb-cell { flex: 1; height: 6px; border-radius: 2px; background: var(--border); }

.sb-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .32);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 8px 8px;
}
.sb-modal {
  width: 100%;
  max-width: 260px;
  max-height: 100%;
  background: var(--surface);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sb-modal-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.sb-modal-body { padding: 7px 8px; overflow: hidden; }
.sb-modal-lines { height: 34px; border: 1px dashed var(--border2); border-radius: 4px; }
.sb-modal-foot {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
}

.sb-cursor {
  position: absolute;
  z-index: 6;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  color: var(--primary);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  transition: left .5s cubic-bezier(.4,0,.2,1), top .5s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.sb-cursor i { display: block; }
.is-cursor-target { outline: 2px solid var(--primary); outline-offset: 1px; border-radius: 3px; animation: sb-pulse 1.1s ease-in-out infinite; }
@keyframes sb-pulse { 0%,100% { outline-color: var(--primary); } 50% { outline-color: transparent; } }

.sb-caption {
  padding: 7px 9px;
  color: var(--text2);
  line-height: 1.4;
  border-top: 1px solid var(--border);
  background: var(--surface);
  min-height: 32px;
}

.sb-ctrls {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.sb-btn {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 1px solid var(--border2);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.sb-btn:hover { border-color: var(--primary); color: var(--primary); }
.sb-btn:disabled { opacity: .4; cursor: default; }
.sb-btn-play { background: var(--primary); color: #fff; border-color: var(--primary); }
.sb-btn-play.is-ended { background: var(--warning, #d97706); border-color: transparent; }
.sb-dots { display: flex; gap: 4px; margin: 0 2px; flex: 1; flex-wrap: wrap; }
.sb-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border2);
  cursor: pointer;
}
.sb-dot.is-on { background: var(--primary); }
.sb-counter { font-size: 9.5px; color: var(--text3); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .sb-cursor { transition: none; }
  .is-cursor-target { animation: none; }
  .sb-frame { animation: none; }
}

/* ================================================================
   ModuleGuide — "Objasni modul" (per-page visual walkthrough)
   Button lives in #pagetitlebar; content renders in a UI.modal.
   Theme-aware through the shared --tokens (no standalone colours).
   ================================================================ */
.mg-btn {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.mg-btn i { font-size: 14px; }
.mg-btn:hover { background: var(--primary); color: #fff; }
@media (max-width: 640px) {
  .mg-btn span { display: none; }
  .mg-btn { padding: 5px 7px; }
}
/* inline variant — sits next to a modal title (e.g. "Karton pacijenta") */
.mg-btn--inline {
  margin-left: 8px;
  vertical-align: middle;
  padding: 3px 9px;
  font-size: 10.5px;
}

.mg-root { display: flex; flex-direction: column; gap: 14px; }
.mg-loading { text-align: center; padding: 32px; color: var(--text3); }
.mg-loading i { font-size: 22px; animation: spin 1.1s linear infinite; }

.mg-uvod {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text2);
}
.mg-sekcije { display: flex; flex-direction: column; gap: 10px; }

.mg-sek {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.mg-sek-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 0;
  border-bottom: 1px solid transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.mg-sek-head:hover { background: var(--border); }
.mg-sek--open > .mg-sek-head { border-bottom-color: var(--border); }
.mg-sek-ico {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--primary-light);
  color: var(--primary);
}
.mg-ico-info { background: var(--surface); color: var(--text3); border: 1px solid var(--border); }
.mg-ico-tab  { background: var(--primary-light); color: var(--primary); }
.mg-sek-num {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  min-width: 14px;
  text-align: center;
}
.mg-sek-naziv { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--text); }
.mg-sek-el {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-sek-chev {
  flex-shrink: 0;
  display: flex;
  color: var(--text3);
  transition: transform .15s;
}
.mg-sek--open > .mg-sek-head .mg-sek-chev { transform: rotate(180deg); }
.mg-sek-body[hidden] { display: none; }
.mg-sek-opis {
  margin: 0;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text2);
}

.mg-form {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 11px 11px;
}
.mg-fld { display: flex; flex-direction: column; gap: 2px; }
.mg-fld-lbl { font-size: 9.5px; color: var(--text3); font-weight: 600; }
.mg-fld-box {
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
}

.mg-steps { padding: 0 11px 11px; }
.mg-steps-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.mg-steps-cta:hover { background: var(--primary); color: #fff; }
.mg-steps-stage { max-width: 430px; }
.mg-steps-stage .sb-player { font-size: 11px; }
