/* Karnataka Govt CMS · Sober palette
   Indigo/slate base · Karnataka red used sparingly as accent · light + dark mode */

:root {
  /* Brand */
  --kr-red: #C4392F;          /* used sparingly — branding badge, critical alerts */
  --kr-yellow: #FFCC00;       /* tertiary accent only */

  /* Primary (officer console feel — calm, daily-use) */
  --indigo-900: #1E3A8A;
  --indigo-700: #3730A3;
  --indigo-600: #4F46E5;
  --indigo-500: #6366F1;
  --indigo-100: #E0E7FF;

  /* Surface (slate) */
  --bg: #F1F5F9;
  --bg-soft: #F8FAFC;
  --paper: #FFFFFF;
  --line: #E2E8F0;
  --line-soft: #F1F5F9;

  /* Ink */
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;
  --ink-muted: #94A3B8;

  /* Status */
  --ok: #16A34A;
  --warn: #D97706;
  --risk: #DC2626;
  --info: #2563EB;
  --neutral: #6B7280;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.04);
  --shadow:    0 6px 20px rgba(15,23,42,.08);
  --shadow-lg: 0 14px 40px rgba(30,58,138,.12);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', 'Noto Sans Kannada', sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --bg-soft: #1E293B;
  --paper: #1E293B;
  --line: #334155;
  --line-soft: #1E293B;
  --ink: #F1F5F9;
  --ink-2: #CBD5E1;
  --ink-3: #94A3B8;
  --ink-muted: #64748B;
  --indigo-100: rgba(99,102,241,0.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.30);
  --shadow:    0 6px 20px rgba(0,0,0,.40);
  --shadow-lg: 0 14px 40px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--indigo-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Login screen ===== */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: linear-gradient(135deg, var(--indigo-900) 0%, var(--indigo-700) 100%);
  color: #fff;
}
.login-left {
  padding: 60px 80px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand-mark {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--kr-red) 0%, #E11D48 100%);
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
  color: #fff; box-shadow: 0 8px 24px rgba(196,57,47,.40);
}
.login-brand-text { display: flex; flex-direction: column; }
.login-brand-name { font-weight: 800; font-size: 18px; letter-spacing: .04em; }
.login-brand-sub { font-size: 12px; opacity: .8; }
.login-hero h1 { font-size: 38px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 16px; line-height: 1.1; }
.login-hero p { font-size: 16px; opacity: .88; max-width: 460px; line-height: 1.6; }
.login-foot { font-size: 12px; opacity: .65; }
.login-right {
  padding: 60px;
  background: var(--paper);
  color: var(--ink);
  display: flex; flex-direction: column; justify-content: center;
  border-radius: 24px 0 0 24px;
}
.login-right h2 { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.login-right .sub { color: var(--ink-3); margin-bottom: 24px; }
.officer-picker {
  display: grid; gap: 8px; max-height: 70vh; overflow-y: auto;
  padding-right: 8px;
}
.officer-card {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px;
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: all .15s ease;
  background: var(--paper);
}
.officer-card:hover { border-color: var(--indigo-500); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.officer-card .ava {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
}
.officer-card .nm { font-weight: 700; font-size: 14px; color: var(--ink); }
.officer-card .ds { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.officer-card .rg {
  align-self: center;
  background: var(--indigo-100); color: var(--indigo-700);
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}

@media (max-width: 880px) {
  .login { grid-template-columns: 1fr; }
  .login-left { padding: 32px; }
  .login-right { padding: 32px; border-radius: 24px 24px 0 0; }
  .login-hero h1 { font-size: 28px; }
}

/* ===== App shell ===== */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 18px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 12px;
}
.sidebar-brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--kr-red), #E11D48);
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.sidebar-brand-name { font-size: 13px; font-weight: 800; letter-spacing: .04em; }
.sidebar-brand-sub  { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }

.nav-section { padding: 16px 6px 6px; font-size: 10px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .12em; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--ink-2); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s ease, color .15s ease;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--indigo-100); color: var(--indigo-700); }
.nav-item .ic { width: 18px; height: 18px; display: grid; place-items: center; }
.nav-item .badge {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: 999px; background: var(--kr-red); color: #fff;
  font-size: 10px; font-weight: 800; display: grid; place-items: center;
}

.sidebar-officer {
  margin-top: auto; padding: 12px; border-top: 1px solid var(--line-soft);
  display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: center;
  cursor: pointer; border-radius: 8px; transition: background .15s ease;
}
.sidebar-officer:hover { background: var(--bg-soft); }
.sidebar-officer .ava { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; }
.sidebar-officer .nm { font-size: 12px; font-weight: 700; }
.sidebar-officer .rg { font-size: 10px; color: var(--ink-3); }

/* ===== Main content ===== */
.main { padding: 24px 32px; overflow-x: auto; }
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.appbar h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.appbar .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.appbar-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all .15s ease;
  font-family: var(--font);
}
.btn:hover { border-color: var(--indigo-500); }
.btn-primary { background: var(--indigo-600); color: #fff; border-color: var(--indigo-600); }
.btn-primary:hover { background: var(--indigo-700); border-color: var(--indigo-700); color: #fff; }
.btn-danger { background: var(--kr-red); color: #fff; border-color: var(--kr-red); }
.btn-danger:hover { background: #A82A1F; border-color: #A82A1F; color: #fff; }
.btn-ghost { background: transparent; }

/* ===== KPI / stat grid ===== */
.stat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 24px;
}
.stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat .lbl { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.stat .val { font-size: 28px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat .trend { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.stat.alert { border-left: 3px solid var(--kr-red); }
.stat.warn  { border-left: 3px solid var(--warn); }
.stat.ok    { border-left: 3px solid var(--ok); }

/* ===== Card ===== */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.card-h .see-all { font-size: 12px; color: var(--indigo-600); font-weight: 600; }

/* ===== Case list ===== */
.case-list { display: grid; gap: 8px; }
.case-row {
  display: grid;
  grid-template-columns: 90px 1fr 130px 90px 90px;
  gap: 16px; align-items: center;
  padding: 14px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--paper);
  cursor: pointer; transition: all .15s ease;
  text-decoration: none; color: inherit;
}
.case-row:hover { border-color: var(--indigo-500); box-shadow: var(--shadow-sm); transform: translateY(-1px); text-decoration: none; }
.case-row .cid { font-family: var(--mono); font-size: 11px; color: var(--ink-3); font-weight: 700; }
.case-row .title { font-weight: 700; color: var(--ink); }
.case-row .meta  { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.case-row .pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
}
.case-row .sla {
  font-size: 11px; font-weight: 700; text-align: center;
  padding: 6px 8px; border-radius: 6px;
}
.case-row .sla.ok       { background: rgba(22,163,74,.10); color: #15803D; }
.case-row .sla.risk     { background: rgba(217,119,6,.12); color: #B45309; }
.case-row .sla.breached { background: rgba(220,38,38,.12); color: #B91C1C; }
.case-row .sla.done     { background: rgba(100,116,139,.10); color: #475569; }
.case-row .sev {
  width: 8px; height: 36px; border-radius: 4px;
}
.case-row .sev.critical { background: var(--kr-red); }
.case-row .sev.high     { background: #EA580C; }
.case-row .sev.medium   { background: var(--warn); }
.case-row .sev.low      { background: #16A34A; }

/* ===== Case detail ===== */
.case-detail { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.case-detail-main { display: flex; flex-direction: column; gap: 16px; }
.case-detail-side { display: flex; flex-direction: column; gap: 16px; }

.case-hero {
  background: linear-gradient(135deg, var(--indigo-900), var(--indigo-700));
  color: #fff; border-radius: var(--radius-lg);
  padding: 24px;
}
.case-hero .cid { font-family: var(--mono); font-size: 11px; opacity: .75; letter-spacing: .05em; }
.case-hero h2 { margin: 6px 0 8px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.case-hero .meta { font-size: 13px; opacity: .85; }
.case-hero .hero-pills { display: flex; gap: 8px; margin-top: 14px; }
.case-hero .hero-pill {
  background: rgba(255,255,255,.16); padding: 4px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
}

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 9px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line);
}
.timeline-event { position: relative; padding-bottom: 16px; }
.timeline-event::before {
  content: ''; position: absolute; left: -20px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--indigo-600); border: 2px solid var(--paper);
}
.timeline-event .when { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.timeline-event .who  { font-size: 12px; color: var(--indigo-700); font-weight: 700; margin-top: 2px; }
.timeline-event .what { font-size: 13px; color: var(--ink); margin-top: 2px; line-height: 1.4; }
.timeline-event .kssl { font-size: 10px; color: var(--ink-muted); font-family: var(--mono); margin-top: 4px; }

/* Action buttons row */
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* SLA gauge */
.sla-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.sla-bar { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.sla-bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.sla-bar-fill.ok       { background: var(--ok); }
.sla-bar-fill.risk     { background: var(--warn); }
.sla-bar-fill.breached { background: var(--kr-red); }

/* Evidence */
.evidence-list { display: grid; gap: 8px; }
.evidence-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg-soft); border-radius: 8px;
  font-size: 12px;
}
.evidence-item .ic {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--indigo-100); color: var(--indigo-600);
  display: grid; place-items: center;
  font-size: 14px;
}

/* ===== Filters ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink-2); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s ease;
}
.filter-chip:hover { border-color: var(--indigo-500); }
.filter-chip.active { background: var(--indigo-600); color: #fff; border-color: var(--indigo-600); }

/* ===== Mission Control · state KPI grid ===== */
.mc-kpi-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.mc-kpi {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.mc-kpi .l { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.mc-kpi .v { font-size: 26px; font-weight: 800; margin: 4px 0; }
.mc-kpi .gap { height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.mc-kpi .gap-fill { height: 100%; background: var(--indigo-600); border-radius: 999px; }
.mc-kpi .t { font-size: 11px; color: var(--ink-3); }

/* ===== Helpers ===== */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
}
.muted { color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.kv-row {
  display: grid; grid-template-columns: 110px 1fr; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--ink-3); font-weight: 600; }
.kv-row .v { color: var(--ink); font-weight: 600; }

/* ===== Mobile responsive ===== */
@media (max-width: 1024px) {
  .case-detail { grid-template-columns: 1fr; }
  .case-row { grid-template-columns: 1fr; gap: 6px; }
  .case-row .cid, .case-row .sla, .case-row .pill, .case-row .sev { width: fit-content; }
}
/* Mobile menu button + backdrop are hidden on desktop */
.mobile-menu-btn { display: none; }
.sidebar-backdrop { display: none; }



@media (max-width: 480px) {
  .main { padding: 60px 12px 20px; }
  .card { padding: 12px; }
  .appbar h1 { font-size: 18px !important; }
}


/* ===================================================================
   CMS POLISH · added v1.4
   Responsive · Print · Skeleton · Empty states · Pagination · A11y
   =================================================================== */

/* ===== Skeleton loading ===== */
@keyframes skeletonShimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 0%, var(--line-soft) 50%, var(--bg-soft) 100%);
  background-size: 200px 100%;
  background-repeat: no-repeat;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
}
.skeleton-row { height: 14px; margin-bottom: 8px; }
.skeleton-row.lg { height: 22px; }
.skeleton-row.sm { width: 60%; }

/* ===== Empty states (standardized) ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-3);
}
.empty-state .ic {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-state .lbl { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.empty-state .sub { font-size: 13px; max-width: 360px; margin: 0 auto; line-height: 1.5; }

/* ===== Pagination ===== */
.pagination {
  display: flex; gap: 4px; justify-content: center; align-items: center;
  margin: 20px 0;
}
.pagination button {
  padding: 6px 12px; border: 1px solid var(--line); background: var(--paper);
  border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer;
  color: var(--ink-2); min-width: 32px; font-family: var(--font);
}
.pagination button.active { background: var(--indigo-600); color: #fff; border-color: var(--indigo-600); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button:hover:not(:disabled):not(.active) { border-color: var(--indigo-500); }

/* ===== Bulk-select checkboxes on case rows ===== */
.case-row.selectable {
  grid-template-columns: 24px 90px 1fr 130px 90px 90px;
}
.case-row .row-check { cursor: pointer; }
.bulk-bar {
  position: sticky; top: 0; z-index: 50;
  background: var(--indigo-600); color: #fff;
  padding: 12px 16px; border-radius: 10px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.bulk-bar button {
  padding: 6px 14px; border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.12); color: #fff;
  border-radius: 6px; font-weight: 700; font-size: 12px;
  cursor: pointer; font-family: var(--font);
}
.bulk-bar button:hover { background: rgba(255,255,255,0.24); }

/* ===== Sparkline container ===== */
.sparkline {
  height: 44px; width: 100%; margin-top: 6px;
}

/* ===== Responsive · tablet (≤1024px) ===== */
@media (max-width: 1024px) {
  .shell { grid-template-columns: 200px 1fr; }
  .sidebar { padding: 14px 10px; }
  .sidebar-brand { padding: 6px 4px 14px; }
  .sidebar-brand-name { font-size: 12px; }
  .nav-item { padding: 8px 8px; font-size: 12px; }
  .main { padding: 18px 22px; }
  .case-row { grid-template-columns: 80px 1fr 110px 40px; gap: 12px; }
  .case-row > div:nth-child(5) { display: none; }
  .case-detail { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .appbar h1 { font-size: 20px; }
  .login { grid-template-columns: 1fr; }
  .login-left { padding: 32px 28px; }
  .login-right { padding: 32px 24px; border-radius: 0; }
}

/* ===== Responsive · mobile (≤640px) ===== */


/* ===== Print stylesheet (case files / reports) ===== */
@media print {
  .sidebar, .appbar-actions, .filters, .search-bar, .bulk-bar,
  .pagination, button, .privacy-banner button, #cms-toast-stack,
  .overlay { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .case-hero { background: #1E3A8A !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; color: #000; }
  .timeline-event { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 9px; color: #666; }
  h1, h2, h3 { page-break-after: avoid; }
  @page { margin: 1.5cm; }
}

/* ===== Accessibility ===== */
:focus-visible {
  outline: 2px solid var(--indigo-500);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible, .case-row:focus-visible, .nav-item:focus-visible {
  outline-offset: 1px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Collapsible sidebar groups (v1.5) ===== */
.nav-section {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 14px 6px 6px;
  user-select: none;
}
.nav-section:hover { color: var(--ink-2); }
.nav-section .chev {
  font-size: 10px; transition: transform .2s ease;
  display: inline-block;
}
.nav-section.collapsed .chev { transform: rotate(-90deg); }
.nav-group { display: flex; flex-direction: column; gap: 2px; max-height: 1200px; overflow: hidden; transition: max-height .25s ease; }
.nav-group.collapsed { max-height: 0; }

/* ===== Pinned / Recent / Search button (v1.5) ===== */
.sidebar-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer;
  font-size: 12px; color: var(--ink-3);
  transition: all .15s ease;
}
.sidebar-search:hover { border-color: var(--indigo-500); color: var(--indigo-700); }
.sidebar-search .kbd {
  margin-left: auto; padding: 1px 6px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 4px; font-family: var(--mono); font-size: 10px;
}

.nav-item .star {
  margin-left: auto; opacity: 0; cursor: pointer;
  padding: 2px 4px; border-radius: 4px;
  font-size: 12px; transition: opacity .15s ease;
}
.nav-item:hover .star { opacity: 0.4; }
.nav-item .star:hover { opacity: 1; background: rgba(0,0,0,0.05); }
.nav-item .star.pinned { opacity: 1; color: var(--warn); }
.nav-item .star.pinned:hover { color: var(--kr-red); }

/* ===== Sidebar toggle row (Expand all / Collapse all) ===== */
.sidebar-toggle-row {
  display: flex; gap: 6px; margin-bottom: 12px;
}
.sidebar-toggle {
  flex: 1; padding: 6px 8px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 6px; font-size: 10.5px; font-weight: 700;
  color: var(--ink-3); cursor: pointer;
  font-family: var(--font); transition: all .15s ease;
}
.sidebar-toggle:hover {
  border-color: var(--indigo-500); color: var(--indigo-700);
  background: var(--indigo-100);
}

/* ===== Colorful sidebar accents (v1.5) ===== */
/* Color-coded section headers + left accent bar per group */
.sidebar .nav-section {
  display: flex; align-items: center; justify-content: space-between;
  border-left: 3px solid transparent;
  padding-left: 8px !important;
  margin-top: 8px;
  transition: all .15s ease;
}
.sidebar .nav-section:hover { background: var(--bg-soft); }

/* Per-section color theming via :nth-child trick won't work reliably with our markup —
   so we attribute-tag groups by their header text via CSS attribute selectors */
.sidebar .nav-section[data-grp="My work"]            { border-left-color: var(--indigo-600); color: var(--indigo-700); }
.sidebar .nav-section[data-grp="Citizen"]            { border-left-color: #14B8A6; color: #0E7490; } /* teal */
.sidebar .nav-section[data-grp="Operations"]         { border-left-color: var(--info); color: var(--info); }
.sidebar .nav-section[data-grp="Finance & delivery"] { border-left-color: var(--ok); color: #15803D; }
.sidebar .nav-section[data-grp="AI governance"]      { border-left-color: #7C3AED; color: #6D28D9; } /* violet */
.sidebar .nav-section[data-grp="Audit & oversight"]  { border-left-color: var(--warn); color: #B45309; }
.sidebar .nav-section[data-grp="Officer & HR"]       { border-left-color: var(--kr-red); color: var(--kr-red); }
.sidebar .nav-section[data-grp="Reference"]          { border-left-color: var(--ink-3); color: var(--ink-2); }
.sidebar .nav-section[data-grp="Preferences"]        { border-left-color: var(--neutral); color: var(--ink-2); }
.sidebar .nav-section[data-grp="Pinned"]             { border-left-color: var(--warn); color: #B45309; }
.sidebar .nav-section[data-grp="Recent"]             { border-left-color: var(--info); color: var(--info); }

/* Pinned star — golden */
.nav-item .star.pinned { color: #F59E0B; }
.nav-item .star.pinned:hover { color: var(--warn); }

/* Subtle group container left accent (when expanded) */
.nav-group { padding-left: 4px; }

/* Brand bar at top with rainbow accent */
.sidebar-brand-mark {
  background: linear-gradient(135deg, var(--kr-red) 0%, #E11D48 40%, #C4392F 100%);
}

/* Search box — give it color depth */
.sidebar-search {
  background: linear-gradient(135deg, var(--indigo-100) 0%, var(--bg-soft) 100%);
  border-color: var(--indigo-500);
  color: var(--indigo-700);
  font-weight: 600;
}
.sidebar-search:hover {
  background: linear-gradient(135deg, var(--indigo-100) 0%, var(--indigo-100) 100%);
  box-shadow: 0 2px 8px rgba(99,102,241,.18);
}
.sidebar-search .kbd { background: #fff; color: var(--indigo-700); }

/* Officer card at bottom — accent */
.sidebar-officer {
  background: var(--bg-soft);
  border-top: 2px solid var(--indigo-500);
}

/* Active nav item — beefier */
.nav-item.active {
  background: linear-gradient(90deg, var(--indigo-100) 0%, rgba(99,102,241,.05) 100%);
  border-left: 3px solid var(--indigo-600);
  padding-left: 7px;
}
.nav-item.active .ic { color: var(--indigo-700); }

/* Per-icon color tint (so icons stand out a bit) */
.nav-item .ic { color: var(--ink-3); }
.nav-item:hover .ic { color: var(--indigo-600); }

/* ===== Glossy sidebar (v1.5) ===== */
.sidebar {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.96) 50%, rgba(241,245,249,0.96) 100%),
    linear-gradient(135deg, rgba(224,231,255,0.6) 0%, rgba(255,255,255,0) 60%);
  background-blend-mode: normal, overlay;
  border-right: 1px solid transparent;
  box-shadow:
    inset -1px 0 0 rgba(255,255,255,0.6),
    inset 1px 1px 0 rgba(255,255,255,0.9),
    4px 0 16px -8px rgba(15,23,42,0.15);
  position: relative;
}
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 120px;
  background: linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  z-index: 0;
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent 0%, rgba(99,102,241,0.18) 30%, rgba(99,102,241,0.18) 70%, transparent 100%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }

/* Dark mode glossy */
[data-theme="dark"] .sidebar {
  background:
    linear-gradient(180deg, rgba(30,41,59,0.96) 0%, rgba(15,23,42,0.98) 100%),
    linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(0,0,0,0) 70%);
  box-shadow:
    inset -1px 0 0 rgba(255,255,255,0.05),
    inset 1px 1px 0 rgba(255,255,255,0.06),
    4px 0 20px -8px rgba(0,0,0,0.5);
}
[data-theme="dark"] .sidebar::before {
  background: linear-gradient(180deg, rgba(99,102,241,0.10) 0%, rgba(0,0,0,0) 100%);
}

/* Brand mark — make glossier */
.sidebar-brand-mark {
  background:
    linear-gradient(135deg, var(--kr-red) 0%, #E11D48 50%, #C4392F 100%),
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.5), transparent 50%);
  background-blend-mode: normal, overlay;
  box-shadow:
    0 4px 12px rgba(196,57,47,0.35),
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,0,0,0.15);
}

/* Search box — glossy variant */
.sidebar-search {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.85) 0%, rgba(224,231,255,0.55) 100%);
  border: 1px solid rgba(99,102,241,0.35);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.7),
    0 1px 2px rgba(15,23,42,0.05);
}
.sidebar-search:hover {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(224,231,255,0.85) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 4px 14px -4px rgba(99,102,241,0.30);
}

/* Active item — glossy highlight */
.nav-item.active {
  background:
    linear-gradient(90deg, var(--indigo-100) 0%, rgba(99,102,241,0.05) 100%),
    linear-gradient(180deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 50%);
  background-blend-mode: normal, overlay;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 1px 3px rgba(99,102,241,0.10);
}

/* Officer card at bottom — soft gloss */
.sidebar-officer {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(248,250,252,0.7) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 -2px 8px -4px rgba(99,102,241,0.18);
  border-top: 1px solid rgba(99,102,241,0.20);
}

/* Toggle row buttons — small gloss */
.sidebar-toggle {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.8) 0%, var(--bg-soft) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

/* Scrollbar — slim + tinted (Chrome/Edge/Safari) */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.25); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.40); }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(99,102,241,0.25) transparent; }

/* ===== Section header icons (v1.5) ===== */
.nav-section .grp-ic {
  display: inline-block;
  margin-right: 6px;
  font-size: 14px;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.10));
}
.nav-section.collapsed .grp-ic { opacity: 0.8; }

/* ===========================================================
   v1.6 · HIGH-END GLOSSY SIDEBAR
   Glassmorphism · card-style nav items · refined spacing
   =========================================================== */

/* === Sidebar shell — premium glass === */
.sidebar {
  background:
    radial-gradient(ellipse 800px 400px at top, rgba(99,102,241,0.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 50%, rgba(241,245,249,0.94) 100%);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: none;
  padding: 24px 12px;
  box-shadow:
    inset -1px 0 0 rgba(255,255,255,0.85),
    inset 0 1px 0 rgba(255,255,255,1),
    4px 0 24px -8px rgba(15,23,42,0.10),
    1px 0 0 rgba(99,102,241,0.10);
}
.sidebar::after { display: none; }

/* === Each nav item — premium card === */
.nav-item {
  position: relative;
  margin: 3px 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: -0.005em;
  background: transparent;
  transition:
    transform .18s cubic-bezier(.4,.0,.2,1),
    background .18s ease,
    box-shadow .18s ease,
    color .15s ease;
  border: 1px solid transparent;
}
.nav-item:hover {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.85) 100%);
  color: var(--ink);
  transform: translateX(2px);
  box-shadow:
    0 1px 0 rgba(255,255,255,1) inset,
    0 1px 3px rgba(15,23,42,0.06),
    0 4px 12px -4px rgba(99,102,241,0.18);
  border-color: rgba(226,232,240,0.8);
}
.nav-item.active {
  background:
    linear-gradient(135deg, rgba(99,102,241,0.18) 0%, rgba(224,231,255,0.55) 100%),
    linear-gradient(180deg, rgba(255,255,255,0.55) 0%, transparent 50%);
  background-blend-mode: normal, overlay;
  color: var(--indigo-700);
  border-color: rgba(99,102,241,0.30);
  padding-left: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 3px 0 0 var(--indigo-600),
    0 2px 8px -2px rgba(99,102,241,0.30),
    0 8px 24px -8px rgba(99,102,241,0.25);
  transform: translateX(0);
  font-weight: 700;
}

/* Active glow accent */
.nav-item.active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, transparent 0%, rgba(99,102,241,0.06) 100%);
  pointer-events: none;
}

/* Icon styling — rounded chip with subtle bg */
.nav-item .ic {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: rgba(99,102,241,0.06);
  color: var(--ink-3);
  transition: all .18s ease;
  flex-shrink: 0;
}
.nav-item .ic svg { width: 14px; height: 14px; }
.nav-item:hover .ic {
  background: rgba(99,102,241,0.14);
  color: var(--indigo-700);
}
.nav-item.active .ic {
  background: linear-gradient(135deg, var(--indigo-600) 0%, var(--indigo-500) 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.5),
    0 2px 6px -1px rgba(99,102,241,0.45);
}

/* Badges */
.nav-item .badge {
  background: linear-gradient(135deg, var(--kr-red), #E11D48);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 2px 6px -1px rgba(196,57,47,0.40);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

/* === Star pin — refined === */
.nav-item .star {
  margin-left: auto;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 13px;
  line-height: 1;
}
.nav-item:hover .star { opacity: 0.55; }
.nav-item .star:hover {
  background: rgba(245,158,11,0.15);
  opacity: 1;
}
.nav-item .star.pinned {
  background: linear-gradient(135deg, rgba(245,158,11,0.20), rgba(217,119,6,0.10));
  color: #F59E0B;
  opacity: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

/* === Section headers — refined === */
.nav-section {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 4px;
  padding: 8px 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 8px;
  border-left: none !important;
  background: linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.04) 50%, transparent 100%);
  transition: background .15s ease;
}
.nav-section:hover {
  background: linear-gradient(90deg, rgba(99,102,241,0.04) 0%, rgba(99,102,241,0.10) 50%, transparent 100%);
}
.nav-section::before {
  content: '';
  position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px;
  border-radius: 2px;
  background: var(--indigo-500);
}
.nav-section .grp-ic {
  font-size: 13px;
  margin-right: 8px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.10));
}
.nav-section .chev {
  font-size: 10px;
  color: var(--ink-3);
  transition: transform .25s ease;
}
.nav-section.collapsed .chev { transform: rotate(-90deg); }

/* Per-group accent color on the left bar */
.nav-section[data-grp="My work"]::before            { background: var(--indigo-600); }
.nav-section[data-grp="Citizen"]::before            { background: #14B8A6; }
.nav-section[data-grp="Operations"]::before         { background: var(--info); }
.nav-section[data-grp="Finance & delivery"]::before { background: var(--ok); }
.nav-section[data-grp="AI governance"]::before      { background: #7C3AED; }
.nav-section[data-grp="Audit & oversight"]::before  { background: var(--warn); }
.nav-section[data-grp="Officer & HR"]::before       { background: var(--kr-red); }
.nav-section[data-grp="Reference"]::before          { background: var(--ink-3); }
.nav-section[data-grp="Preferences"]::before        { background: var(--neutral); }
.nav-section[data-grp="Pinned"]::before             { background: #F59E0B; }
.nav-section[data-grp="Recent"]::before             { background: var(--info); }

.nav-section[data-grp="My work"]            { color: var(--indigo-700); }
.nav-section[data-grp="Citizen"]            { color: #0E7490; }
.nav-section[data-grp="Operations"]         { color: var(--info); }
.nav-section[data-grp="Finance & delivery"] { color: #15803D; }
.nav-section[data-grp="AI governance"]      { color: #6D28D9; }
.nav-section[data-grp="Audit & oversight"]  { color: #B45309; }
.nav-section[data-grp="Officer & HR"]       { color: var(--kr-red); }
.nav-section[data-grp="Reference"]          { color: var(--ink-2); }
.nav-section[data-grp="Preferences"]        { color: var(--ink-2); }
.nav-section[data-grp="Pinned"]             { color: #B45309; }
.nav-section[data-grp="Recent"]             { color: var(--info); }

/* === Nav-group spacing === */
.nav-group {
  padding: 4px 2px 8px 4px;
  display: flex; flex-direction: column;
  gap: 0;
}

/* === Search box — premium glass === */
.sidebar-search {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid rgba(99,102,241,0.25);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(241,245,249,0.85) 100%),
    linear-gradient(180deg, rgba(224,231,255,0.30) 0%, transparent 100%);
  background-blend-mode: normal, overlay;
  color: var(--ink-2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    0 1px 2px rgba(15,23,42,0.04),
    0 4px 12px -4px rgba(99,102,241,0.18);
  margin-bottom: 14px;
}
.sidebar-search:hover {
  color: var(--indigo-700);
  border-color: rgba(99,102,241,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    0 4px 16px -4px rgba(99,102,241,0.28);
  transform: translateY(-1px);
}
.sidebar-search .kbd {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(99,102,241,0.20);
  color: var(--indigo-700);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(99,102,241,0.15);
}

/* === Toggle row === */
.sidebar-toggle-row { gap: 5px; margin-bottom: 16px; }
.sidebar-toggle {
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.85) 100%);
  border: 1px solid rgba(226,232,240,0.85);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    0 1px 2px rgba(15,23,42,0.04);
  transition: all .15s ease;
}
.sidebar-toggle:hover {
  background:
    linear-gradient(180deg, var(--indigo-100) 0%, rgba(224,231,255,0.7) 100%);
  border-color: rgba(99,102,241,0.35);
  color: var(--indigo-700);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 3px 8px -2px rgba(99,102,241,0.25);
}

/* === Brand mark — premium glass === */
.sidebar-brand {
  padding: 4px 8px 22px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(99,102,241,0.10);
  position: relative;
}
.sidebar-brand::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 0; transform: translateX(-50%);
  width: 60%; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.50) 50%, transparent 100%);
}
.sidebar-brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background:
    linear-gradient(135deg, var(--kr-red) 0%, #E11D48 60%, #C4392F 100%),
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.55), transparent 55%);
  background-blend-mode: normal, overlay;
  box-shadow:
    0 4px 14px rgba(196,57,47,0.40),
    inset 0 1px 0 rgba(255,255,255,0.55),
    inset 0 -1px 0 rgba(0,0,0,0.18);
  font-size: 22px;
}
.sidebar-brand-name { font-size: 13.5px; letter-spacing: 0.06em; }
.sidebar-brand-sub { font-size: 10px; letter-spacing: 0.14em; }

/* === Officer card === */
.sidebar-officer {
  margin: 18px -2px -8px;
  padding: 13px 12px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.85) 100%);
  border: 1px solid rgba(99,102,241,0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    0 1px 3px rgba(15,23,42,0.06),
    0 8px 20px -8px rgba(99,102,241,0.25);
  border-top: 1px solid rgba(99,102,241,0.22);
  position: relative;
}
.sidebar-officer:hover {
  background:
    linear-gradient(135deg, var(--indigo-100) 0%, rgba(255,255,255,0.95) 100%);
  border-color: rgba(99,102,241,0.40);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    0 6px 16px -4px rgba(99,102,241,0.30);
}
.sidebar-officer .ava {
  width: 36px; height: 36px; border-radius: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 2px 6px rgba(15,23,42,0.15);
}

/* === Dark mode polish === */
[data-theme="dark"] .sidebar {
  background:
    radial-gradient(ellipse 800px 400px at top, rgba(99,102,241,0.18) 0%, transparent 60%),
    linear-gradient(180deg, rgba(30,41,59,0.98) 0%, rgba(15,23,42,1) 100%);
}
[data-theme="dark"] .nav-item:hover {
  background: linear-gradient(180deg, rgba(51,65,85,0.9) 0%, rgba(30,41,59,0.85) 100%);
  border-color: rgba(51,65,85,0.85);
}
[data-theme="dark"] .nav-item.active {
  background:
    linear-gradient(135deg, rgba(99,102,241,0.35) 0%, rgba(99,102,241,0.18) 100%);
  border-color: rgba(99,102,241,0.55);
  color: #E0E7FF;
}
[data-theme="dark"] .sidebar-search,
[data-theme="dark"] .sidebar-toggle,
[data-theme="dark"] .sidebar-officer {
  background: linear-gradient(180deg, rgba(51,65,85,0.9) 0%, rgba(30,41,59,0.85) 100%);
  border-color: rgba(99,102,241,0.30);
}

/* === Subtle dividers between items in dense groups === */
.nav-group .nav-item + .nav-item {
  margin-top: 2px;
}

/* === v1.6.1 · Stronger group + item separation === */

/* Each group container — softly defined card */
.nav-group {
  position: relative;
  margin: 0 0 6px;
  padding: 6px 4px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 1px 0 rgba(15,23,42,0.04);
}
.nav-group.collapsed { padding-bottom: 4px; background: transparent; box-shadow: none; }

/* Horizontal divider between consecutive groups when expanded */
.nav-group + .nav-section {
  position: relative;
}
.nav-group + .nav-section::after {
  content: '';
  position: absolute;
  top: -3px; left: 8px; right: 8px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(15,23,42,0.10) 20%,
    rgba(15,23,42,0.10) 80%,
    transparent 100%);
}

/* Stronger item separation — soft hairline divider */
.nav-group .nav-item + .nav-item::before {
  content: '';
  position: absolute;
  top: -2px; left: 14px; right: 14px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(15,23,42,0.06) 30%,
    rgba(15,23,42,0.06) 70%,
    transparent 100%);
  pointer-events: none;
}
.nav-group .nav-item.active + .nav-item::before,
.nav-group .nav-item + .nav-item.active::before { display: none; }

/* Make chevron more visible & premium */
.nav-section .chev {
  font-size: 14px;
  color: currentColor;
  opacity: 0.55;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 5px;
  transition: all .2s ease;
}
.nav-section:hover .chev {
  opacity: 1;
  background: rgba(255,255,255,0.65);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 1px 2px rgba(15,23,42,0.08);
}

/* Stronger group header — taller, more breathable */
.nav-section {
  padding: 10px 12px 10px 14px;
  margin: 12px 0 4px;
  min-height: 36px;
}
.nav-section::before {
  width: 4px; height: 18px;
  border-radius: 3px;
  left: 4px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.65),
    0 2px 4px rgba(15,23,42,0.10);
}

/* Sticky group header polish — frosted feel */
.nav-section {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* === v1.6.2 · Long-text header alignment fix === */

/* Section header is a 3-col flex: [accent gap] [text] [chev]
   The text span MUST stay on one line — the count was wrapping. */
.nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px 9px 14px;
  min-height: 34px;
  flex-wrap: nowrap;
}
.nav-section > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.2;
}
.nav-section .grp-ic {
  font-size: 13px;
  margin-right: 0;
  flex-shrink: 0;
}
.nav-section .chev {
  flex-shrink: 0;
}

/* ============================================================
   v1.7 · INTERESTING HOVER EFFECTS
   Shimmer sweep · icon micro-anim · slide-in fills · ripples
   ============================================================ */

/* --- Nav-item: shimmer sweep + slide-in fill --- */
.nav-item {
  overflow: hidden;
  z-index: 0;
}
.nav-item::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 80%; height: 100%;
  background: linear-gradient(110deg,
    transparent 0%,
    rgba(255,255,255,0.0) 30%,
    rgba(255,255,255,0.55) 50%,
    rgba(255,255,255,0.0) 70%,
    transparent 100%);
  transform: skewX(-18deg);
  transition: left .65s cubic-bezier(.4,.0,.2,1);
  pointer-events: none;
  z-index: 2;
}
.nav-item:hover::after { left: 130%; }

/* Slide-in colored wash from left */
.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(99,102,241,0.14) 0%,
    rgba(99,102,241,0.06) 60%,
    transparent 100%);
  transform: translateX(-100%);
  transition: transform .35s cubic-bezier(.4,.0,.2,1);
  pointer-events: none;
  border-radius: inherit;
  z-index: 0;
}
.nav-item:hover::before { transform: translateX(0); }
.nav-item.active::before { transform: translateX(0); opacity: 0.6; }

/* Push text + icon above the effect layers */
.nav-item > * { position: relative; z-index: 1; }

/* --- Icon micro-animation: pop + tilt --- */
.nav-item .ic {
  transition:
    transform .35s cubic-bezier(.34,1.56,.64,1),
    background .25s ease,
    color .25s ease,
    box-shadow .25s ease;
}
.nav-item:hover .ic {
  transform: scale(1.18) rotate(-6deg);
}
.nav-item.active .ic {
  animation: cms-icon-pulse 2.4s ease-in-out infinite;
}
@keyframes cms-icon-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 2px 6px -1px rgba(99,102,241,0.45); }
  50%      { box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 4px 14px -1px rgba(99,102,241,0.65); }
}

/* --- Text letter-spacing expand on hover --- */
.nav-item {
  letter-spacing: -0.005em;
  transition:
    transform .18s cubic-bezier(.4,.0,.2,1),
    background .18s ease,
    box-shadow .18s ease,
    color .15s ease,
    letter-spacing .25s ease,
    padding .25s ease;
}
.nav-item:hover { letter-spacing: 0.005em; }

/* --- Badge: gentle bounce on hover --- */
.nav-item .badge {
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
}
.nav-item:hover .badge {
  transform: scale(1.12) translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 4px 12px -2px rgba(196,57,47,0.55);
}

/* --- Star pin: spin + glow on hover --- */
.nav-item .star {
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), background .2s ease, opacity .2s ease;
}
.nav-item .star:hover {
  transform: rotate(72deg) scale(1.25);
}
.nav-item .star.pinned {
  animation: cms-pin-twinkle 3s ease-in-out infinite;
}
@keyframes cms-pin-twinkle {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(245,158,11,0)); }
  50%      { filter: drop-shadow(0 0 4px rgba(245,158,11,0.65)); }
}

/* --- Section header: chevron bounce + accent bar glow --- */
.nav-section {
  cursor: pointer;
  transition: background .2s ease, padding .25s ease;
}
.nav-section:hover { padding-left: 18px; }
.nav-section::before {
  transition: height .3s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease, width .3s ease;
}
.nav-section:hover::before {
  height: 24px;
  width: 5px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.7),
    0 0 12px 2px currentColor,
    0 2px 4px rgba(15,23,42,0.10);
}
.nav-section .chev {
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), background .2s ease, opacity .2s ease;
}
.nav-section:hover .chev {
  transform: scale(1.25);
}
.nav-section.collapsed:hover .chev {
  transform: rotate(-90deg) scale(1.25);
}

/* --- Group icon: wiggle on group header hover --- */
.nav-section:hover .grp-ic {
  animation: cms-icon-wiggle .6s ease-in-out;
}
@keyframes cms-icon-wiggle {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(-12deg) scale(1.18); }
  40%  { transform: rotate(10deg) scale(1.18); }
  60%  { transform: rotate(-6deg) scale(1.12); }
  80%  { transform: rotate(4deg) scale(1.08); }
  100% { transform: rotate(0deg) scale(1); }
}

/* --- Search box: glow ring + caret jiggle --- */
.sidebar-search {
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
}
.sidebar-search::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 30%, rgba(99,102,241,0.18) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .8s cubic-bezier(.4,.0,.2,1);
  pointer-events: none;
}
.sidebar-search:hover::before { transform: translateX(120%); }
.sidebar-search:hover { transform: translateY(-2px); }
.sidebar-search:hover .kbd { transform: scale(1.08); }
.sidebar-search .kbd { transition: transform .2s ease; }

/* --- Toggle buttons: press-down effect --- */
.sidebar-toggle { transition: all .15s ease; position: relative; overflow: hidden; }
.sidebar-toggle::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(99,102,241,0.30) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.sidebar-toggle:hover::after { opacity: 1; }
.sidebar-toggle:active { transform: translateY(1px) scale(0.97); }

/* --- Brand mark: subtle rotation + sheen on hover --- */
.sidebar-brand {
  cursor: pointer;
  transition: transform .3s ease;
}
.sidebar-brand:hover .sidebar-brand-mark {
  transform: rotate(-8deg) scale(1.08);
  box-shadow:
    0 8px 24px rgba(196,57,47,0.55),
    inset 0 1px 0 rgba(255,255,255,0.7),
    inset 0 -1px 0 rgba(0,0,0,0.2);
}
.sidebar-brand-mark {
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease;
}

/* --- Officer card: avatar pulse on hover --- */
.sidebar-officer {
  cursor: pointer;
  transition: all .25s ease;
  overflow: hidden;
  position: relative;
}
.sidebar-officer::before {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(110deg, transparent, rgba(99,102,241,0.18), transparent);
  transform: skewX(-20deg);
  transition: left .7s cubic-bezier(.4,.0,.2,1);
  pointer-events: none;
}
.sidebar-officer:hover::before { left: 140%; }
.sidebar-officer:hover .ava {
  transform: scale(1.10) rotate(-4deg);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    0 4px 12px rgba(99,102,241,0.40);
}
.sidebar-officer .ava {
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease;
}

/* --- Active nav-item: continuous subtle shimmer --- */
.nav-item.active {
  background-size: 200% 100%;
  animation: cms-active-shimmer 4.5s ease-in-out infinite;
}
@keyframes cms-active-shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Reduce-motion respect --- */
@media (prefers-reduced-motion: reduce) {
  .nav-item::after, .nav-item::before,
  .sidebar-search::before, .sidebar-officer::before,
  .nav-item.active, .nav-item.active .ic,
  .nav-item .star.pinned, .sidebar-toggle::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   v1.8 · Evidence thumbnails + Location mini-map
   ============================================================ */

/* --- Location card --- */
.loc-map {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.06);
  margin-bottom: 12px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.loc-map:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.30), 0 8px 20px -8px rgba(99,102,241,0.30);
}
.mini-map-svg { display: block; width: 100%; height: auto; }
.loc-map-pin {
  position: absolute;
  top: 8px; right: 10px;
  background: rgba(255,255,255,0.90);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--kr-red);
  box-shadow: 0 2px 6px rgba(15,23,42,0.15);
}
.loc-meta { display: flex; flex-direction: column; gap: 6px; padding: 2px 4px 4px; }
.loc-addr { font-weight: 700; font-size: 13px; color: var(--ink); }
.loc-ward { font-size: 11px; color: var(--ink-3); letter-spacing: 0.04em; }
.loc-gps {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  background: var(--bg-soft);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.gps-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px rgba(22,163,74,0.25);
  animation: cms-gps-pulse 2s ease-in-out infinite;
}
@keyframes cms-gps-pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(22,163,74,0.25); }
  50%     { box-shadow: 0 0 0 5px rgba(22,163,74,0.10); }
}
.gps-copy {
  margin-left: auto;
  background: transparent; border: 1px solid var(--line); border-radius: 5px;
  padding: 2px 7px; cursor: pointer; font-size: 12px; color: var(--ink-3);
  transition: all .15s ease;
}
.gps-copy:hover { background: var(--indigo-100); color: var(--indigo-700); border-color: var(--indigo-500); }

/* --- Evidence grid --- */
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.evidence-thumb {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  transition: all .25s cubic-bezier(.4,.0,.2,1);
  display: flex; flex-direction: column;
}
.evidence-thumb:hover {
  transform: translateY(-2px) scale(1.015);
  border-color: var(--indigo-500);
  box-shadow: 0 8px 20px -6px rgba(99,102,241,0.30);
}
.evidence-image { position: relative; aspect-ratio: 200/140; overflow: hidden; }
.evidence-image .evidence-svg { width: 100%; height: 100%; }
.evidence-image svg { display: block; width: 100%; height: 100%; }
.evidence-badge {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(15,23,42,0.78);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 5px;
  backdrop-filter: blur(4px);
}
.evidence-cap { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.evidence-label { font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.evidence-meta { font-size: 10px; color: var(--ink-3); letter-spacing: 0.02em; }

/* --- Lightbox --- */
.cms-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,0.72);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 24px;
  animation: cms-lb-in .2s ease-out;
}
@keyframes cms-lb-in { from { opacity: 0; } to { opacity: 1; } }
.cms-lightbox-card {
  background: var(--paper);
  border-radius: 16px;
  max-width: 640px; width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  animation: cms-lb-card-in .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cms-lb-card-in { from { transform: translateY(20px) scale(.96); } to { transform: translateY(0) scale(1); } }
.cms-lightbox-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.cms-lightbox-title { font-weight: 800; font-size: 14px; }
.cms-lightbox-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 18px;
  color: var(--ink-2);
  transition: all .15s ease;
}
.cms-lightbox-close:hover { background: var(--kr-red); color: #fff; border-color: var(--kr-red); }
.cms-lightbox-body { padding: 16px 20px 20px; }
.lightbox-meta {
  margin-top: 14px;
  display: grid; grid-template-columns: 1fr; gap: 8px;
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 12px 14px;
}
.lightbox-meta > div { display: flex; gap: 10px; align-items: baseline; font-size: 12px; }
.lm-k {
  flex-shrink: 0; width: 80px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3);
}
.lm-v { color: var(--ink); font-weight: 600; word-break: break-word; }
.lightbox-extlink {
  display: inline-block; margin-top: 12px;
  font-size: 12px; font-weight: 700;
  color: var(--indigo-600); text-decoration: none;
}
.lightbox-extlink:hover { text-decoration: underline; }

/* Dark mode adjustments */
[data-theme="dark"] .cms-lightbox-card { background: var(--bg-soft); }
[data-theme="dark"] .lightbox-meta { background: var(--paper); }
[data-theme="dark"] .evidence-thumb { background: var(--bg-soft); border-color: var(--line); }

/* === v1.9 · Case-detail prev/next nav === */
.case-nav {
  display: inline-flex;
  align-items: stretch;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.case-nav-btn {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 8px 14px !important;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: none !important;
}
.case-nav-btn:hover:not(.is-disabled) {
  background: var(--indigo-100) !important;
  color: var(--indigo-700);
}
.case-nav-btn.is-disabled,
.case-nav-btn[disabled] {
  color: var(--ink-muted);
  cursor: not-allowed;
  opacity: 0.45;
}
.case-nav-pos {
  display: grid; place-items: center;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  background: var(--bg-soft);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
[data-theme="dark"] .case-nav { background: var(--bg-soft); }
[data-theme="dark"] .case-nav-pos { background: var(--bg); }

/* Keyboard hint */
.case-nav-btn::after {
  content: attr(data-kbd);
  margin-left: 6px;
  font-size: 9px;
  opacity: 0.55;
  font-family: var(--mono);
}

/* === v2.0 · Reveal identity modal === */
.reveal-modal { max-width: 480px; }
.reveal-warn {
  display: flex; gap: 12px;
  background: linear-gradient(135deg, rgba(196,57,47,0.10), rgba(220,38,38,0.06));
  border: 1px solid rgba(196,57,47,0.35);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}
.reveal-warn-ic {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  animation: cms-warn-pulse 2.4s ease-in-out infinite;
}
@keyframes cms-warn-pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.12); }
}
.reveal-warn-title {
  font-weight: 800;
  font-size: 13px;
  color: var(--kr-red);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}
.reveal-warn-body {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.45;
}
.reveal-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.reveal-pin {
  width: 100%;
  padding: 12px 16px;
  font-size: 22px;
  font-family: var(--mono);
  letter-spacing: 0.4em;
  text-align: center;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  transition: all .15s ease;
  font-weight: 700;
}
.reveal-pin:focus {
  outline: none;
  border-color: var(--indigo-500);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.reveal-reason {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font);
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
  transition: all .15s ease;
  box-sizing: border-box;
}
.reveal-reason:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.reveal-hint {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 5px;
  line-height: 1.4;
}
.reveal-err {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(220,38,38,0.10);
  border: 1px solid rgba(220,38,38,0.30);
  border-radius: 8px;
  color: var(--risk);
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   v2.1 · MISSING BASE STYLES — modal overlay, privacy banner, row-actions
   These were referenced in JS but never defined in CSS.
   ============================================================ */

/* Modal overlay backdrop */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: cms-overlay-in 0.18s ease-out;
}
@keyframes cms-overlay-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--paper);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 26px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  animation: cms-modal-in 0.22s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes cms-modal-in {
  from { transform: translateY(14px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.modal .sub {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
}
.modal label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  margin: 14px 0 6px;
}
.modal input[type="text"],
.modal input[type="password"],
.modal textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font);
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-sizing: border-box;
  transition: all 0.15s ease;
}
.modal input:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

/* Privacy banner — was rendered as plain divs */
.privacy-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.10), rgba(245, 158, 11, 0.06));
  border: 1px solid rgba(217, 119, 6, 0.30);
  font-size: 13px;
  color: var(--ink-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.50);
}
.privacy-banner .ic {
  font-size: 18px;
  flex-shrink: 0;
}
.privacy-banner .grow {
  flex: 1 1 auto;
  line-height: 1.45;
}
.privacy-banner button {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--kr-red);
  background: linear-gradient(180deg, #fff 0%, #FEE2E2 100%);
  color: var(--kr-red);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(196, 57, 47, 0.10);
}
.privacy-banner button:hover {
  background: var(--kr-red);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(196, 57, 47, 0.35);
}
.privacy-banner.revealed {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.10), rgba(34, 197, 94, 0.06));
  border-color: rgba(22, 163, 74, 0.30);
  color: #14532D;
}

/* Dark mode */
[data-theme="dark"] .modal { background: var(--bg-soft); }
[data-theme="dark"] .privacy-banner button {
  background: linear-gradient(180deg, var(--bg-soft) 0%, rgba(196,57,47,0.18) 100%);
}

/* ============================================================
   v2.2 · Inbox header polish — search box + filter rows
   ============================================================ */

/* Search bar — modern input with magnifier icon */
.search-bar {
  position: relative;
  margin: 0 0 18px;
}
.search-bar input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--bg-soft) 100%),
    var(--paper);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 1px 2px rgba(15,23,42,0.04);
  transition: all .18s ease;
  box-sizing: border-box;
}
.search-bar input::placeholder { color: var(--ink-muted); font-weight: 500; }
.search-bar input:hover { border-color: rgba(99,102,241,0.40); }
.search-bar input:focus {
  outline: none;
  border-color: var(--indigo-500);
  background: var(--paper);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,1),
    0 0 0 4px rgba(99,102,241,0.15),
    0 4px 12px -4px rgba(99,102,241,0.25);
}
.search-bar::before {
  content: '';
  position: absolute;
  left: 16px; top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='M21 21l-4.35-4.35'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity .18s ease;
}
.search-bar:focus-within::before { opacity: 1; }

/* Filter container — rows separated cleanly */
.filters {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-bottom: 18px !important;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--paper) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 1px 2px rgba(15,23,42,0.03);
}

.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--ink-3);
  min-width: 70px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
  margin-right: 4px;
}

/* Filter chip — refined pill */
.filter-chip {
  padding: 7px 13px !important;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.005em;
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--bg-soft) 100%) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink-2) !important;
  cursor: pointer;
  user-select: none;
  transition:
    transform .15s cubic-bezier(.4,.0,.2,1),
    background .15s ease,
    color .15s ease,
    box-shadow .15s ease,
    border-color .15s ease !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
  line-height: 1;
  white-space: nowrap;
}
.filter-chip:hover {
  border-color: rgba(99,102,241,0.45) !important;
  color: var(--indigo-700) !important;
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--indigo-100) 100%) !important;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 3px 8px -2px rgba(99,102,241,0.22);
}
.filter-chip.active {
  background:
    linear-gradient(180deg, var(--indigo-600) 0%, var(--indigo-700) 100%) !important;
  color: #fff !important;
  border-color: var(--indigo-700) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 2px 6px -1px rgba(99,102,241,0.45),
    0 8px 20px -8px rgba(99,102,241,0.45);
  transform: translateY(0);
}
.filter-chip.active:hover {
  transform: translateY(-1px);
}

/* Severity row gets color-coded chips on hover/active */
.filter-group:nth-child(2) .filter-chip[data-sev="critical"].active,
.filter-group:nth-child
/* ============================================================
   v2.6 · MOBILE OVERRIDES — must come AFTER all polish CSS
   so off-canvas drawer rules win the cascade.
   ============================================================ */

@media (max-width: 720px) {
  /* Restore single-column shell */
  .shell { grid-template-columns: 1fr !important; }

  /* Sidebar: off-canvas drawer */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 86vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    z-index: 1100 !important;
    transform: translateX(-105%) !important;
    transition: transform .25s cubic-bezier(.4,.0,.2,1) !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 20px 14px !important;
    gap: 4px !important;
    box-shadow: 6px 0 24px rgba(15,23,42,0.20) !important;
    border-right: none !important;
  }
  body.sidebar-open .sidebar { transform: translateX(0) !important; }

  /* Force every direct child to behave as a vertical block */
  .sidebar > * {
    width: 100% !important;
    flex-shrink: 0;
  }

  /* Brand visible on mobile */
  .sidebar-brand { display: flex !important; }

  /* Nav sections visible (they were hidden in the old rule) */
  .nav-section { display: flex !important; }

  /* Toggle row keeps its 2 buttons side-by-side */
  .sidebar-toggle-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
  }
  .sidebar-toggle { flex: 1 1 50% !important; }

  /* Hamburger + backdrop */
  .mobile-menu-btn {
    display: grid !important;
    place-items: center;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1200;
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(15,23,42,0.12);
    font-size: 22px;
    color: var(--ink);
    cursor: pointer;
  }
  .sidebar-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  body.sidebar-open .sidebar-backdrop {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* Main content full width */
  .main { padding: 66px 16px 24px !important; max-width: 100vw !important; }
}

/* Hide drawer-only chrome on desktop */
@media (min-width: 721px) {
  .mobile-menu-btn,
  .sidebar-backdrop { display: none !important; }
}

/* === v2.7 · Mobile sidebar — slimmer + denser === */
@media (max-width: 720px) {
  .sidebar {
    width: 240px !important;
    max-width: 78vw !important;
    padding: 16px 10px !important;
    gap: 2px !important;
  }
  /* Tighter brand */
  .sidebar-brand {
    padding: 2px 6px 12px !important;
    margin-bottom: 10px !important;
    gap: 8px !important;
  }
  .sidebar-brand-mark { width: 32px !important; height: 32px !important; font-size: 18px !important; border-radius: 9px !important; }
  .sidebar-brand-name { font-size: 12px !important; }
  .sidebar-brand-sub { font-size: 9px !important; }

  /* Tighter language pill */
  .sidebar-lang { padding: 6px 8px !important; margin-bottom: 8px !important; }
  .sidebar-lang-label { font-size: 9px !important; }
  .sidebar-lang-btn { padding: 4px 8px !important; font-size: 10px !important; }

  /* Tighter search row */
  .sidebar-search { padding: 9px 11px !important; margin-bottom: 10px !important; font-size: 11.5px !important; }

  /* Expand/Collapse buttons compact */
  .sidebar-toggle-row { margin-bottom: 10px !important; gap: 4px !important; }
  .sidebar-toggle { padding: 5px 6px !important; font-size: 9px !important; }

  /* Section headers tighter */
  .nav-section {
    padding: 7px 8px 7px 11px !important;
    min-height: 28px !important;
    margin: 8px 0 2px !important;
    font-size: 9.5px !important;
    letter-spacing: 0.07em !important;
  }
  .nav-section .grp-ic { font-size: 11px !important; margin-right: 4px !important; }
  .nav-section::before { width: 3px !important; height: 14px !important; left: 3px !important; }
  .nav-section .chev { width: 14px !important; height: 14px !important; font-size: 11px !important; }

  /* Nav items denser */
  .nav-item {
    padding: 7px 10px !important;
    font-size: 12px !important;
    margin: 1px 0 !important;
    border-radius: 8px !important;
    gap: 8px !important;
  }
  .nav-item .ic { width: 18px !important; height: 18px !important; border-radius: 5px !important; }
  .nav-item .ic svg { width: 12px !important; height: 12px !important; }
  .nav-item .badge { min-width: 16px !important; height: 15px !important; font-size: 9px !important; padding: 0 5px !important; }
  .nav-item .star { padding: 2px 4px !important; font-size: 11px !important; }

  /* Group container — minimal padding */
  .nav-group { padding: 2px 1px 4px !important; margin: 0 0 3px !important; background: transparent !important; box-shadow: none !important; }

  /* Officer card */
  .sidebar-officer {
    margin: 12px -1px -4px !important;
    padding: 9px 10px !important;
    border-radius: 10px !important;
  }
  .sidebar-officer .ava { width: 30px !important; height: 30px !important; font-size: 12px !important; }
  .sidebar-officer .nm { font-size: 11.5px !important; }
  .sidebar-officer .rg { font-size: 9.5px !important; }

  /* Smaller hamburger so it doesn't dominate */
  .mobile-menu-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    top: 10px !important;
    left: 10px !important;
  }
  .main { padding-top: 58px !important; }
}

/* Even tighter at very small viewports */
@media (max-width: 380px) {
  .sidebar { width: 220px !important; max-width: 80vw !important; }
}

/* ============================================================
   v2.8 · FULLY FLUID LAYOUT
   No abrupt breakpoints. Every dimension uses clamp() / minmax()
   so the UI scales smoothly from 320px to 4K.
   ============================================================ */

/* === Shell / sidebar widths === */
.shell {
  grid-template-columns: clamp(200px, 18vw, 260px) 1fr;
}

/* === Main content === */
.main {
  padding: clamp(12px, 2.5vw, 32px) clamp(14px, 3vw, 36px);
  max-width: 100%;
  min-width: 0;
}

/* === Appbar / page heading === */
.appbar { gap: clamp(8px, 1.5vw, 16px); flex-wrap: wrap; }
.appbar h1 {
  font-size: clamp(18px, 1.2vw + 14px, 26px) !important;
  line-height: 1.2;
}
.appbar .sub { font-size: clamp(12px, 0.4vw + 11px, 14px); }
.appbar-actions { gap: clamp(6px, 1vw, 10px); flex-wrap: wrap; }
.appbar-actions .btn { font-size: clamp(11px, 0.3vw + 10.5px, 13px); padding: clamp(6px, 1vw, 10px) clamp(10px, 1.4vw, 16px); }

/* === Cards === */
.card { padding: clamp(12px, 1.8vw, 22px); }
.card-h h3 { font-size: clamp(13px, 0.4vw + 11.5px, 16px); }

/* === Stat / KPI grid — auto-fits across all viewports === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) !important;
  gap: clamp(8px, 1.5vw, 16px);
}
.stat .val { font-size: clamp(22px, 1.5vw + 16px, 32px); }
.stat .lbl { font-size: clamp(10px, 0.3vw + 9.5px, 12px); }
.stat .trend { font-size: clamp(10px, 0.3vw + 9.5px, 12px); }

.mc-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)) !important;
  gap: clamp(8px, 1.5vw, 16px);
}

/* === Case lists === */
.case-list { gap: clamp(6px, 1vw, 10px); }
.case-row { padding: clamp(10px, 1.5vw, 16px); }
.case-row .title { font-size: clamp(13px, 0.4vw + 11.5px, 15px); }

/* === Filters === */
.filters { padding: clamp(10px, 1.5vw, 16px); gap: clamp(8px, 1.2vw, 12px) !important; }
.filter-chip { font-size: clamp(11px, 0.3vw + 10.5px, 13px) !important; padding: clamp(6px, 0.8vw, 8px) clamp(10px, 1.2vw, 14px) !important; }
.filter-label { font-size: clamp(9.5px, 0.3vw + 9px, 11px); }

/* === Search bar (page-level, not sidebar) === */
.search-bar input { font-size: clamp(12px, 0.4vw + 11px, 14px); padding: clamp(10px, 1.2vw, 14px) clamp(14px, 1.6vw, 18px) clamp(10px, 1.2vw, 14px) clamp(38px, 4vw, 48px); }

/* === Case detail two-column → fluid === */
.case-detail {
  grid-template-columns: minmax(0, 1fr) clamp(280px, 24vw, 360px);
  gap: clamp(14px, 2vw, 24px);
}

/* === Sidebar internals scale === */
.sidebar { padding: clamp(14px, 1.5vw, 22px) clamp(8px, 1vw, 14px); gap: 2px; }
.nav-item { font-size: clamp(11.5px, 0.25vw + 11px, 13.5px); padding: clamp(7px, 0.8vw, 11px) clamp(9px, 1vw, 13px); }
.nav-item .ic { width: clamp(18px, 1.3vw, 24px); height: clamp(18px, 1.3vw, 24px); }
.nav-section { font-size: clamp(9.5px, 0.25vw + 9px, 11px); padding: clamp(7px, 0.8vw, 11px) clamp(8px, 1vw, 13px) clamp(7px, 0.8vw, 11px) clamp(11px, 1.2vw, 15px); }
.sidebar-brand-mark { width: clamp(30px, 2.5vw, 42px); height: clamp(30px, 2.5vw, 42px); font-size: clamp(16px, 1.2vw, 22px); }
.sidebar-brand-name { font-size: clamp(11px, 0.3vw + 10px, 14px); }
.sidebar-brand-sub { font-size: clamp(9px, 0.2vw + 8.5px, 11px); }

/* === Case-detail side cards stack below at narrow widths === */
@media (max-width: 920px) {
  .case-detail { grid-template-columns: 1fr; }
  .case-detail-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
  .case-detail-side > * { width: auto; }
}

/* === Sidebar becomes drawer below 720px (existing v2.6 rules continue) === */
/* Drawer width scales with viewport */
@media (max-width: 720px) {
  .sidebar {
    width: clamp(220px, 72vw, 300px) !important;
    max-width: 78vw !important;
  }
}

/* === Modal — fluid sizing === */
.modal { max-width: min(96vw, 520px); padding: clamp(16px, 2vw, 26px); }
.modal h3 { font-size: clamp(15px, 0.4vw + 14px, 18px); }

/* === Print fallback — explicit columns kept === */
@media print { .shell { grid-template-columns: 1fr !important; } }

/* ============================================================
   v2.9 · Sidebar collapse / minimize (desktop only)
   ============================================================ */

/* The little chevron button at top-right of sidebar */
.sidebar-collapse-btn {
  position: absolute;
  top: 14px;
  right: 8px;
  z-index: 5;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: all .15s ease;
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}
.sidebar-collapse-btn:hover {
  background: var(--indigo-100);
  color: var(--indigo-700);
  border-color: var(--indigo-500);
  transform: scale(1.08);
}

/* Hide collapse button on mobile (hamburger replaces it) */
@media (max-width: 720px) {
  .sidebar-collapse-btn { display: none !important; }
}

/* ===== Collapsed state ===== */
body.sidebar-collapsed .shell {
  grid-template-columns: 64px 1fr !important;
}
body.sidebar-collapsed .sidebar {
  padding: 14px 8px !important;
  overflow-x: hidden;
}

/* Collapse button shifts to centered when collapsed */
body.sidebar-collapsed .sidebar-collapse-btn {
  position: relative;
  top: auto;
  right: auto;
  margin: 0 auto 12px;
  width: 36px;
  height: 32px;
}

/* Hide labels and text — keep only icons */
body.sidebar-collapsed .sidebar-brand > div:not(.sidebar-brand-mark),
body.sidebar-collapsed .sidebar-brand-name,
body.sidebar-collapsed .sidebar-brand-sub,
body.sidebar-collapsed .sidebar-lang,
body.sidebar-collapsed .sidebar-search > span:first-child,
body.sidebar-collapsed .sidebar-toggle-row,
body.sidebar-collapsed .nav-section > span:first-child,
body.sidebar-collapsed .nav-section .chev,
body.sidebar-collapsed .nav-item > span:not(.ic):not(.badge),
body.sidebar-collapsed .nav-item .star,
body.sidebar-collapsed .sidebar-officer > div:not(.ava) {
  display: none !important;
}

/* Brand centered */
body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 4px 0 16px !important;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 10px;
}

/* Search becomes a single icon button */
body.sidebar-collapsed .sidebar-search {
  display: grid !important;
  place-items: center;
  padding: 9px 0 !important;
  width: 100%;
  margin-bottom: 10px;
}

/* Nav sections become tiny accent rules */
body.sidebar-collapsed .nav-section {
  padding: 4px 0 !important;
  margin: 8px auto 4px !important;
  min-height: 6px !important;
  width: 24px;
  background: transparent !important;
  border: none !important;
}
body.sidebar-collapsed .nav-section::before {
  position: static;
  width: 24px !important;
  height: 2px !important;
  border-radius: 1px !important;
  transform: none !important;
  margin: 0 auto !important;
}

/* Nav items become icon tiles */
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 9px 0 !important;
  width: 100%;
  border-radius: 9px !important;
}
body.sidebar-collapsed .nav-item .ic {
  margin: 0 !important;
}
body.sidebar-collapsed .nav-item .badge {
  position: absolute;
  top: 3px;
  right: 6px;
  min-width: 14px !important;
  height: 14px !important;
  padding: 0 4px !important;
  font-size: 8px !important;
}

/* Tooltip on hover — uses native title attribute via label */
body.sidebar-collapsed .nav-item {
  position: relative;
}
body.sidebar-collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--ink);
  color: var(--paper);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: all .18s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.20);
  z-index: 100;
}
body.sidebar-collapsed .nav-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Officer card avatar-only */
body.sidebar-collapsed .sidebar-officer {
  padding: 8px 0 !important;
  justify-content: center;
  grid-template-columns: auto !important;
}
body.sidebar-collapsed .sidebar-officer .ava {
  margin: 0 auto;
}

/* Nav-group container loses card styling */
body.sidebar-collapsed .nav-group {
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.sidebar-collapsed .nav-group.collapsed { display: none; }

/* Smooth transition */
.shell, .sidebar, .nav-item, .sidebar-brand, .nav-section {
  transition:
    grid-template-columns .25s cubic-bezier(.4,.0,.2,1),
    padding .2s ease,
    width .25s ease;
}

/* === v2.10 · Mobile drawer close button + hamburger always-visible === */

/* Hamburger button — bump z-index above the drawer so it stays tappable */
.mobile-menu-btn {
  z-index: 1300 !important;
  transition: transform .2s ease;
}
body.sidebar-open .mobile-menu-btn {
  /* Sit on top of drawer when it's open so the X is reachable */
  background: var(--paper) !important;
  color: var(--kr-red) !important;
  border-color: var(--kr-red) !important;
}

/* X close button inside drawer — visible only on mobile */
.sidebar-drawer-close {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15,23,42,0.10);
  transition: all .15s ease;
}
.sidebar-drawer-close:hover {
  background: var(--kr-red);
  color: #fff;
  border-color: var(--kr-red);
  transform: scale(1.08);
}

@media (max-width: 720px) {
  .sidebar-drawer-close { display: flex !important; }
  /* Make backdrop more visible */
  .sidebar-backdrop {
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(4px) !important;
  }
  /* Add a hint border to the drawer */
  body.sidebar-open .sidebar {
    box-shadow: 6px 0 32px rgba(15,23,42,0.45) !important;
  }
  /* Push brand below the close button */
  .sidebar-brand { margin-top: 32px !important; }
}

/* Hide drawer close on desktop */
@media (min-width: 721px) {
  .sidebar-drawer-close { display: none !important; }
}

/* === v2.11 · Drawer takes full screen at very small widths === */
@media (max-width: 480px) {
  .sidebar {
    width: 92vw !important;
    max-width: 92vw !important;
  }
  .sidebar-drawer-close { top: 14px; right: 14px; width: 36px; height: 36px; font-size: 18px; }
}
@media (max-width: 380px) {
  .sidebar {
    width: 100vw !important;
    max-width: 100vw !important;
  }
}
/* Lock background scrolling while drawer is open */
body.sidebar-open {
  overflow: hidden;
}

/* === v2.12 · Mobile drawer minimize → icon strip === */
@media (max-width: 720px) {
  /* When sidebar is collapsed AND drawer is open, shrink drawer to icon strip */
  body.sidebar-collapsed.sidebar-open .sidebar,
  body.sidebar-collapsed .sidebar {
    width: 68px !important;
    max-width: 68px !important;
    padding: 14px 6px !important;
  }
  body.sidebar-collapsed .sidebar-drawer-close {
    width: 30px !important;
    height: 30px !important;
    top: 8px;
    right: 8px;
    font-size: 14px;
  }
  /* Adjust backdrop when minimized — make it lighter since drawer is small */
  body.sidebar-collapsed.sidebar-open .sidebar-backdrop {
    background: rgba(15, 23, 42, 0.40) !important;
  }
}

/* On any width, the drawer-close button shows the right chevron based on state */
.sidebar-drawer-close { font-family: var(--font); }

/* === v2.13 · Sticky sidebar footer (Preferences + Officer card) === */

/* Push footer to the bottom of the sidebar via margin-top: auto.
   Sidebar is already a flex column with overflow-y: auto, so this works. */
.sidebar-footer {
  margin-top: auto;
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background:
    linear-gradient(180deg, transparent 0%, var(--paper) 18%, var(--paper) 100%);
  /* Hairline divider that appears when content scrolls underneath */
  border-top: 1px solid transparent;
  transition: border-color .2s ease;
  z-index: 2;
  flex-shrink: 0;
}

/* Add a soft drop shadow above the footer to indicate scrollable content above */
.sidebar-footer::before {
  content: '';
  position: absolute;
  top: -16px; left: 0; right: 0;
  height: 16px;
  background: linear-gradient(to top, var(--paper) 0%, transparent 100%);
  pointer-events: none;
}

/* When collapsed sidebar (icon-only), keep footer compact */
body.sidebar-collapsed .sidebar-footer { padding-top: 4px; }
body.sidebar-collapsed .sidebar-footer::before { display: none; }

/* Dark mode background */
[data-theme="dark"] .sidebar-footer {
  background: linear-gradient(180deg, transparent 0%, var(--bg-soft) 18%, var(--bg-soft) 100%);
}
[data-theme="dark"] .sidebar-footer::before {
  background: linear-gradient(to top, var(--bg-soft) 0%, transparent 100%);
}

/* ============================================================
   v2.14 · Global search palette · keyboard-driven
   ============================================================ */
.cms-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: start center;
  padding: clamp(40px, 12vh, 120px) 16px 0;
  animation: cms-sp-in .18s ease-out;
}
@keyframes cms-sp-in { from { opacity: 0; } to { opacity: 1; } }
.cms-search-box {
  width: 100%;
  max-width: 560px;
  background: var(--paper);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.40);
  animation: cms-sp-card .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cms-sp-card { from { transform: translateY(-12px) scale(.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.cms-search-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.cms-search-ic { font-size: 18px; }
.cms-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-family: var(--font);
  font-weight: 600;
  color: var(--ink);
}
.cms-search-input::placeholder { color: var(--ink-muted); font-weight: 500; }
.cms-search-kbd {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-3);
}
.cms-search-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 6px;
}
.cms-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease;
}
.cms-search-row:hover,
.cms-search-row.is-selected {
  background: var(--indigo-100);
}
.cms-search-row-kind {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--ink-3);
  flex-shrink: 0;
}
.cms-search-row.is-selected .cms-search-row-kind { background: var(--indigo-600); color: #fff; }
.cms-search-row-label { font-size: 13px; font-weight: 700; color: var(--ink); flex: 1; }
.cms-search-row-sub { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.cms-search-empty { text-align: center; padding: 32px 16px; color: var(--ink-3); font-size: 13px; }
.cms-search-foot {
  border-top: 1px solid var(--line);
  padding: 10px 18px;
  font-size: 11px;
  color: var(--ink-3);
  background: var(--bg-soft);
  text-align: center;
}
[data-theme="dark"] .cms-search-box { background: var(--bg-soft); }
[data-theme="dark"] .cms-search-head,
[data-theme="dark"] .cms-search-foot { background: var(--bg); }

@media (max-width: 480px) {
  .cms-search-overlay { padding-top: 24px; padding-left: 12px; padding-right: 12px; }
  .cms-search-row-sub { display: none; }
}

/* === v2.15 · Dark-mode contrast fixes for rung pills + officer cards === */
[data-theme="dark"] .officer-card {
  background: var(--paper);
  border-color: rgba(99,102,241,0.25);
}
[data-theme="dark"] .officer-card:hover {
  border-color: var(--indigo-500);
  box-shadow: 0 4px 16px rgba(99,102,241,0.30);
}
[data-theme="dark"] .officer-card .nm { color: var(--ink); }
[data-theme="dark"] .officer-card .ds { color: var(--ink-3); }

/* The rung pill: was indigo-100 bg + indigo-700 text — invisible in dark mode.
   Use brighter indigo background + white text instead. */
[data-theme="dark"] .officer-card .rg {
  background: linear-gradient(135deg, var(--indigo-600), var(--indigo-700));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 1px 3px rgba(0,0,0,0.30);
}

/* Sidebar officer card rung text too */
[data-theme="dark"] .sidebar-officer .rg { color: var(--ink-2); }

/* Other indigo-100 pills around the app */
[data-theme="dark"] .nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.40) 0%, rgba(99,102,241,0.22) 100%);
  color: #E0E7FF;
  border-color: rgba(99,102,241,0.60);
}

/* Hero pills on case detail */
[data-theme="dark"] .hero-pill {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}

/* Sidebar lang toggle inactive button visibility */
[data-theme="dark"] .sidebar-lang-btn {
  color: var(--ink-2);
}
[data-theme="dark"] .sidebar-lang-btn.active {
  color: #fff;
}

/* === v2.16 · Dark-mode opaque sidebar (no bleed-through) === */
/* The sidebar drawer was using translucent gradients in dark mode, so main-content
   text was visible through it. Lock it to a fully opaque solid background. */
[data-theme="dark"] .sidebar {
  background-color: #0F172A !important;
  background-image:
    radial-gradient(ellipse 800px 400px at top, rgba(99,102,241,0.18) 0%, transparent 60%),
    linear-gradient(180deg, #1E293B 0%, #0F172A 100%) !important;
}

/* When drawer is open on mobile, lock it to absolutely opaque background */
@media (max-width: 720px) {
  [data-theme="dark"] .sidebar {
    background-color: #0F172A !important;
    background-image:
      linear-gradient(180deg, #1E293B 0%, #0F172A 100%) !important;
  }
  /* And boost the backdrop so any unintended overlap is fully masked */
  [data-theme="dark"] .sidebar-backdrop {
    background: rgba(0,0,0,0.78) !important;
  }
}

/* Lighten the sidebar-footer's gradient blend so it doesn't reveal main content underneath */
[data-theme="dark"] .sidebar-footer {
  background:
    linear-gradient(180deg, transparent 0%, #1E293B 18%, #1E293B 100%) !important;
}
[data-theme="dark"] .sidebar-footer::before {
  background: linear-gradient(to top, #1E293B 0%, transparent 100%) !important;
}

/* Light mode also needs an opaque base — keep the polish but add solid fallback */
.sidebar {
  background-color: var(--paper);
}

/* === v2.17 · Appbar stable layout regardless of title length === */

/* Force the appbar to stay as a 2-column row.
   Title block flexes/shrinks, actions stay glued to the right. */
.appbar {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  gap: clamp(8px, 1.5vw, 16px);
  margin-bottom: clamp(14px, 2vw, 24px);
}
.appbar > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.appbar h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.appbar-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap !important;
  align-items: center;
}

/* On narrow viewports — DO wrap to a new line, but stack the title block first */
@media (max-width: 720px) {
  .appbar {
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
  }
  .appbar h1 { white-space: normal; overflow: visible; text-overflow: clip; }
  .appbar-actions { width: 100%; flex-wrap: wrap !important; }
}

/* === v2.18 · Force opaque sidebar background (light + dark, all states) === */
/* My v1.6 polish layer set .sidebar { background: linear-gradient(rgba 0.94...) }
   That shorthand resets background-color, leaving the sidebar 6% transparent.
   Any text behind it leaks through. Lock to an opaque solid + gradient overlay. */

.sidebar,
.shell .sidebar,
body .sidebar {
  background-color: #FFFFFF !important;
}
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 800px 400px at top, rgba(99,102,241,0.08) 0%, transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(248,250,252,1) 50%, rgba(241,245,249,1) 100%);
  pointer-events: none;
}

[data-theme="dark"] .sidebar,
[data-theme="dark"] .shell .sidebar,
[data-theme="dark"] body .sidebar {
  background-color: #0F172A !important;
}
[data-theme="dark"] .sidebar::before {
  background:
    radial-gradient(ellipse 800px 400px at top, rgba(99,102,241,0.18) 0%, transparent 60%),
    linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
}

/* Sidebar must establish a stacking context so its children don't escape */
.sidebar { position: relative; isolation: isolate; }

/* When drawer is open on mobile, sidebar position changes to fixed — keep opaque */
@media (max-width: 720px) {
  body.sidebar-open .sidebar { background-color: #FFFFFF !important; }
  [data-theme="dark"] body.sidebar-open .sidebar { background-color: #0F172A !important; }
}

/* Main content should sit BEHIND the sidebar — no z-index escalations */
.main { position: relative; z-index: 0; }
.shell .sidebar { z-index: 1; }

/* === v2.19 · Officer account popover menu === */
.officer-menu {
  position: fixed;
  z-index: 9000;
  min-width: 240px;
  max-width: 320px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow:
    0 12px 32px rgba(15,23,42,0.18),
    0 2px 6px rgba(15,23,42,0.06);
  animation: cms-om-in .14s ease-out;
  font-family: var(--font);
}
@keyframes cms-om-in {
  from { transform: translateY(4px) scale(.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.officer-menu .om-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 8px;
}
.officer-menu .om-ava {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 2px 6px rgba(15,23,42,0.15);
}
.officer-menu .om-nm { font-weight: 700; font-size: 13px; color: var(--ink); }
.officer-menu .om-rg { font-size: 11px; color: var(--indigo-700); font-weight: 700; margin-top: 1px; }
.officer-menu .om-dept { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; line-height: 1.3; }

.officer-menu .om-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}

.officer-menu .om-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: left;
  font-family: inherit;
  transition: background .12s ease, color .12s ease;
}
.officer-menu .om-item:hover {
  background: var(--indigo-100);
  color: var(--indigo-700);
}
.officer-menu .om-item-danger:hover {
  background: rgba(196,57,47,0.10);
  color: var(--kr-red);
}
.officer-menu .om-ic {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  font-size: 13px;
}

/* Chevron indicator on the officer card so it looks tappable */
.sidebar-officer .om-chev {
  margin-left: auto;
  font-size: 16px;
  color: var(--ink-3);
  line-height: 1;
  letter-spacing: 0.05em;
}
.sidebar-officer:hover .om-chev { color: var(--indigo-700); }

/* Dark mode */
[data-theme="dark"] .officer-menu {
  background: var(--bg-soft);
  border-color: rgba(99,102,241,0.30);
}
[data-theme="dark"] .officer-menu .om-divider { background: rgba(99,102,241,0.20); }
[data-theme="dark"] .officer-menu .om-item:hover {
  background: rgba(99,102,241,0.25);
  color: #E0E7FF;
}
[data-theme="dark"] .officer-menu .om-rg { color: var(--indigo-100); }

/* Collapsed sidebar — hide the chev (icon-only) */
body.sidebar-collapsed .sidebar-officer .om-chev { display: none; }

/* ============================================================
   v2.20 · Premium Call / Reply CTAs on citizen card
   ============================================================ */

.contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform .18s cubic-bezier(.4,.0,.2,1),
    box-shadow .2s ease,
    filter .2s ease;
}

.cta .cta-ic {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.18));
}
.cta .cta-lbl { white-space: nowrap; }
.cta .cta-sub {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.30);
  margin-left: 2px;
}

/* Shimmer sweep on hover */
.cta::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(110deg,
    transparent 0%,
    rgba(255,255,255,0.30) 50%,
    transparent 100%);
  transform: skewX(-18deg);
  transition: left .55s cubic-bezier(.4,.0,.2,1);
  pointer-events: none;
}
.cta:hover::after { left: 130%; }

.cta:hover { transform: translateY(-1px); }
.cta:active { transform: translateY(0) scale(0.98); }

/* ── Call: green/teal (phone-action color) ── */
.cta-call {
  background:
    linear-gradient(180deg, #10B981 0%, #059669 100%);
  color: #fff;
  border-color: #047857;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 1px 2px rgba(5,150,105,0.30),
    0 6px 14px -4px rgba(16,185,129,0.40);
}
.cta-call:hover {
  background:
    linear-gradient(180deg, #14C28F 0%, #069B70 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 2px 4px rgba(5,150,105,0.35),
    0 10px 22px -6px rgba(16,185,129,0.55);
}

/* Tiny ringing animation on the call icon */
.cta-call .cta-ic {
  display: inline-block;
  transform-origin: 50% 30%;
}
.cta-call:hover .cta-ic {
  animation: cms-cta-ring 0.7s ease-in-out;
}
@keyframes cms-cta-ring {
  0%, 100% { transform: rotate(0); }
  20%      { transform: rotate(-14deg); }
  40%      { transform: rotate(12deg); }
  60%      { transform: rotate(-8deg); }
  80%      { transform: rotate(4deg); }
}

/* ── Reply: indigo (message-action color) ── */
.cta-reply {
  background:
    linear-gradient(180deg, var(--indigo-600) 0%, var(--indigo-700) 100%);
  color: #fff;
  border-color: #312E81;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    0 1px 2px rgba(67,56,202,0.28),
    0 6px 14px -4px rgba(79,70,229,0.40);
}
.cta-reply:hover {
  background:
    linear-gradient(180deg, #5953F0 0%, #4338CA 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.33),
    0 2px 4px rgba(67,56,202,0.32),
    0 10px 22px -6px rgba(79,70,229,0.55);
}
.cta-reply:hover .cta-ic {
  animation: cms-cta-fly 0.6s ease-out;
}
@keyframes cms-cta-fly {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(2px, -3px) rotate(-8deg); }
  100% { transform: translate(0, 0); }
}

/* Dark-mode polish — colors are already vivid; just bump the glow */
[data-theme="dark"] .cta-call {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 2px 6px rgba(0,0,0,0.30),
    0 8px 20px -6px rgba(16,185,129,0.50);
}
[data-theme="dark"] .cta-reply {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 2px 6px rgba(0,0,0,0.30),
    0 8px 20px -6px rgba(99,102,241,0.55);
}

/* Reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  .cta-call:hover .cta-ic,
  .cta-reply:hover .cta-ic { animation: none !important; }
  .cta::after { display: none; }
}

/* Tiny stack on extra-narrow widths */
@media (max-width: 360px) {
  .contact-row { grid-template-columns: 1fr; }
}

/* === v2.21 · CTA size/overflow tuning === */
.cta {
  padding: 10px 12px !important;
  font-size: 12.5px;
  min-width: 0;
}
.cta .cta-lbl {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: 700;
}
.cta .cta-ic {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.cta .cta-sub {
  flex-shrink: 0;
  font-size: 9px;
  padding: 2px 5px;
}

/* On narrow citizen card, stack labels under icons if needed */
@media (max-width: 420px) {
  .cta { padding: 9px 10px !important; font-size: 11.5px; gap: 6px; }
  .cta .cta-sub { display: none; }
}

/* === v2.22 · Language toggle — proper styling for both themes === */
.sidebar-lang {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}
.sidebar-lang-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
}
.sidebar-lang-toggle {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 1px rgba(15,23,42,0.04);
}
.sidebar-lang-btn {
  padding: 5px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1;
}
.sidebar-lang-btn:hover:not(.active) {
  color: var(--indigo-700);
  background: var(--indigo-100);
}
.sidebar-lang-btn.active {
  background: linear-gradient(180deg, var(--indigo-600) 0%, var(--indigo-700) 100%);
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 1px 3px rgba(67,56,202,0.40);
}

/* DARK MODE — strong contrast everywhere */
[data-theme="dark"] .sidebar-lang {
  background: rgba(99,102,241,0.10);
  border-color: rgba(99,102,241,0.30);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
[data-theme="dark"] .sidebar-lang-label {
  color: #94A3B8;
}
[data-theme="dark"] .sidebar-lang-toggle {
  background: #0F172A;
  border-color: rgba(99,102,241,0.35);
}
[data-theme="dark"] .sidebar-lang-btn {
  color: #CBD5E1;
}
[data-theme="dark"] .sidebar-lang-btn:hover:not(.active) {
  color: #fff;
  background: rgba(99,102,241,0.25);
}
[data-theme="dark"] .sidebar-lang-btn.active {
  background: linear-gradient(180deg, #6366F1 0%, #4F46E5 100%);
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 2px 6px rgba(99,102,241,0.45);
}

/* ============================================================
   v2.23 · Dark-mode fix for inline pastel-gradient cards
   28 cards across views_extra*.js use inline pastel gradients
   (peach, mint, sky, lilac…). In dark mode they remain light
   but inherit dark-mode --ink (light text) → unreadable.
   Force dark ink on those cards so text stays visible.
   ============================================================ */

[data-theme="dark"] .card[style*="linear-gradient"],
[data-theme="dark"] [class*="card"][style*="linear-gradient"] {
  color: #0F172A !important;
}

/* Cascade dark ink to all descendants of pastel cards (override --ink, .muted, etc.) */
[data-theme="dark"] .card[style*="linear-gradient"] *,
[data-theme="dark"] [class*="card"][style*="linear-gradient"] * {
  color: inherit !important;
}

/* Keep STRONG / heading text a touch darker for hierarchy */
[data-theme="dark"] .card[style*="linear-gradient"] strong,
[data-theme="dark"] .card[style*="linear-gradient"] h1,
[data-theme="dark"] .card[style*="linear-gradient"] h2,
[data-theme="dark"] .card[style*="linear-gradient"] h3 {
  color: #000 !important;
}

/* The .muted class is normally var(--ink-3); on a pastel card in dark mode
   inherit makes it match the body color, but the original muted look is lost.
   Restore a slightly faded slate that still reads on pastel. */
[data-theme="dark"] .card[style*="linear-gradient"] .muted {
  color: #475569 !important;
}

/* Subtle border so the pastel card has an edge against the dark background */
[data-theme="dark"] .card[style*="linear-gradient"] {
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.40),
    0 4px 14px rgba(0,0,0,0.25);
}

/* Same treatment for cards using fixed light bg colors via inline style */
[data-theme="dark"] .card[style*="background: #FEF3C7"],
[data-theme="dark"] .card[style*="background:#FEF3C7"],
[data-theme="dark"] .card[style*="background: #DBEAFE"],
[data-theme="dark"] .card[style*="background:#DBEAFE"],
[data-theme="dark"] .card[style*="background: #DCFCE7"],
[data-theme="dark"] .card[style*="background:#DCFCE7"],
[data-theme="dark"] .card[style*="background: #FECACA"],
[data-theme="dark"] .card[style*="background:#FECACA"],
[data-theme="dark"] .card[style*="background: #E0E7FF"],
[data-theme="dark"] .card[style*="background:#E0E7FF"] {
  color: #0F172A !important;
}
[data-theme="dark"] .card[style*="background: #FEF3C7"] *,
[data-theme="dark"] .card[style*="background: #DBEAFE"] *,
[data-theme="dark"] .card[style*="background: #DCFCE7"] *,
[data-theme="dark"] .card[style*="background: #FECACA"] *,
[data-theme="dark"] .card[style*="background: #E0E7FF"] * {
  color: inherit !important;
}

/* ============================================================
   v2.24 · Daily Standup — clearer item separation + per-row CTAs
   ============================================================ */
.standup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.standup-row {
  display: grid;
  grid-template-columns: 110px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  transition: all .15s ease;
}
.standup-row:hover {
  border-color: var(--indigo-500);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.6),
    0 4px 14px -4px rgba(99,102,241,0.20);
}
.standup-row.is-reviewed {
  opacity: 0.55;
  text-decoration: line-through;
}

.standup-cid {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  background: var(--paper);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  text-align: center;
  word-break: break-all;
  line-height: 1.3;
}
.standup-body { min-width: 0; }
.standup-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.standup-meta { font-size: 11.5px; color: var(--ink-3); }

.standup-when {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(196,57,47,0.08);
}

.standup-ctas { display: flex; gap: 6px; flex-shrink: 0; }
.standup-cta,
.standup-cta-ghost {
  padding: 6px 11px !important;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 7px;
  white-space: nowrap;
}
.standup-cta-ghost {
  background: var(--paper) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink-2);
}
.standup-cta-ghost:hover {
  background: var(--ok) !important;
  color: #fff !important;
  border-color: var(--ok) !important;
}

/* Dark mode */
[data-theme="dark"] .standup-row {
  background: rgba(99,102,241,0.06);
  border-color: rgba(99,102,241,0.20);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
[data-theme="dark"] .standup-row:hover {
  background: rgba(99,102,241,0.12);
  border-color: var(--indigo-500);
}
[data-theme="dark"] .standup-cid {
  background: var(--bg);
  border-color: rgba(99,102,241,0.25);
  color: #94A3B8;
}
[data-theme="dark"] .standup-when { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .standup-cta-ghost {
  background: var(--bg-soft) !important;
  border-color: rgba(99,102,241,0.25) !important;
  color: #CBD5E1;
}

/* Narrow viewports — stack */
@media (max-width: 720px) {
  .standup-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .standup-cid {
    justify-self: start;
    padding: 3px 7px;
    font-size: 10px;
  }
  .standup-when { justify-self: start; }
  .standup-ctas { width: 100%; }
  .standup-cta, .standup-cta-ghost { flex: 1; text-align: center; justify-content: center; }
}

/* === v2.25 · Clean up collapsed nav-groups + remove leaky dividers === */

/* Make collapsed groups fully invisible — no leftover padding, background, divider */
.nav-group.collapsed {
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  overflow: hidden !important;
  opacity: 0;
  visibility: hidden;
}

/* Disable the gradient hairline divider that sat between groups —
   in dark mode it shows as a faint smudge and looks like a stray line. */
.nav-group + .nav-section::after {
  display: none !important;
}

/* Tighten spacing between consecutive group headers when both adjacent groups are collapsed */
.nav-group.collapsed + .nav-section { margin-top: 6px !important; }

/* ============================================================
   v2.26 · Kannada coming-soon marquee banner
   ============================================================ */
.cms-kn-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9700;
  display: flex;
  align-items: center;
  height: 38px;
  background: linear-gradient(90deg, #C4392F 0%, #E11D48 50%, #C4392F 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(196,57,47,0.40);
  animation: cms-kn-drop .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cms-kn-drop {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

.cms-kn-track {
  display: flex;
  gap: 80px;
  white-space: nowrap;
  padding-left: 100%;
  animation: cms-kn-scroll 26s linear infinite;
}
@keyframes cms-kn-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.cms-kn-banner:hover .cms-kn-track { animation-play-state: paused; }

.cms-kn-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.cms-kn-item strong { font-weight: 800; }
.cms-kn-ic {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.30);
  font-weight: 800;
  font-size: 14px;
}
.cms-kn-link {
  color: #FFEB99;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 800;
}
.cms-kn-link:hover { color: #fff; }

.cms-kn-close {
  flex-shrink: 0;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: all .15s ease;
}
.cms-kn-close:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-50%) scale(1.08);
}

/* Push the rest of the app down while the banner is showing */
body:has(.cms-kn-banner) .shell { padding-top: 38px; }
body:has(.cms-kn-banner) .mobile-menu-btn { top: 48px; }
body:has(.cms-kn-banner) .sidebar { top: 38px !important; }

/* Reduce-motion respect — stop scroll */
@media (prefers-reduced-motion: reduce) {
  .cms-kn-track { animation: none !important; padding-left: 20px; }
}

/* Phones — slightly smaller */
@media (max-width: 480px) {
  .cms-kn-banner { font-size: 12px; height: 36px; }
}

/* === v2.27 · KN marquee — slow down scroll === */
.cms-kn-track {
  animation-duration: 60s !important;
  gap: 120px !important;
}

/* ============================================================
   v2.28 · Reply modal template pills — proper styling for light + dark
   ============================================================ */
.templates {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.templates > div:first-child {
  font-size: 10.5px !important;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3) !important;
  margin: 6px 0 4px !important;
}

.template-pill {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid rgba(99,102,241,0.20);
  background:
    linear-gradient(180deg, rgba(99,102,241,0.04) 0%, rgba(99,102,241,0.08) 100%);
  color: var(--ink);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
  padding-left: 36px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}
.template-pill::before {
  content: '💬';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.65;
}
.template-pill:hover {
  border-color: var(--indigo-500);
  background:
    linear-gradient(180deg, var(--indigo-100) 0%, rgba(99,102,241,0.18) 100%);
  color: var(--indigo-700);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 4px 12px -4px rgba(99,102,241,0.30);
}
.template-pill:active {
  transform: translateY(0);
  background: var(--indigo-100);
}

/* Dark mode */
[data-theme="dark"] .template-pill {
  background:
    linear-gradient(180deg, rgba(99,102,241,0.08) 0%, rgba(99,102,241,0.14) 100%);
  border-color: rgba(99,102,241,0.30);
  color: #E0E7FF;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
[data-theme="dark"] .template-pill:hover {
  background:
    linear-gradient(180deg, rgba(99,102,241,0.22) 0%, rgba(99,102,241,0.32) 100%);
  border-color: var(--indigo-500);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 4px 14px -4px rgba(99,102,241,0.55);
}
[data-theme="dark"] .template-pill::before { opacity: 0.85; }
[data-theme="dark"] .templates > div:first-child { color: #94A3B8 !important; }

/* === v2.29 · Remove sidebar-footer fade gradients (unwanted band above officer card) === */
.sidebar-footer,
[data-theme="dark"] .sidebar-footer {
  background: transparent !important;
  border-top: none !important;
}
.sidebar-footer::before,
[data-theme="dark"] .sidebar-footer::before {
  display: none !important;
  content: none !important;
}

/* === v2.30 · Dashboard greeting — emoji + full name on 2nd line === */
.dash-greeting h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: clamp(20px, 1.4vw + 14px, 28px) !important;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.dash-greet-emoji {
  display: inline-block;
  font-size: 1.1em;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
  animation: cms-greet-wave 1.4s ease-in-out 0.2s 1 both;
}
@keyframes cms-greet-wave {
  0%   { transform: rotate(0) scale(0.6); opacity: 0; }
  30%  { transform: rotate(-14deg) scale(1.15); opacity: 1; }
  55%  { transform: rotate(10deg) scale(1.05); }
  100% { transform: rotate(0) scale(1); }
}
.dash-greet-name {
  font-size: clamp(15px, 0.8vw + 12px, 20px);
  font-weight: 700;
  color: var(--ink-2);
  margin-top: 6px;
  line-height: 1.3;
}
.dash-greeting .sub {
  margin-top: 8px;
  font-size: clamp(12px, 0.4vw + 11px, 14px);
  color: var(--ink-3);
}
[data-theme="dark"] .dash-greet-name { color: #CBD5E1; }

@media prefers-reduced-motion {
  .dash-greet-emoji { animation: none !important; }
}

/* === v2.31 · Collapsed sidebar — show group icon + color dot === */

/* Un-hide the group icon emoji + show it nicely centered */
body.sidebar-collapsed .nav-section > span:first-child {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 0;          /* hide the inner text — keep only .grp-ic */
  width: 100%;
  letter-spacing: 0;
}
body.sidebar-collapsed .nav-section .grp-ic {
  font-size: 17px !important;
  display: inline-grid !important;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(99,102,241,0.06);
  margin: 0 auto !important;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}
[data-theme="dark"] body.sidebar-collapsed .nav-section .grp-ic {
  background: rgba(255,255,255,0.06);
}

/* Replace the original ::before bar with a small color DOT positioned at the
   top-right of the icon. The dot color comes from each per-group rule below. */
body.sidebar-collapsed .nav-section {
  position: relative !important;
  width: 40px !important;
  padding: 6px 0 !important;
  margin: 10px auto 6px !important;
  min-height: 36px !important;
  background: transparent !important;
  border: none !important;
}
body.sidebar-collapsed .nav-section::before {
  /* override the long bar — turn it into a tiny dot */
  position: absolute !important;
  top: 4px !important;
  right: 4px !important;
  left: auto !important;
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  margin: 0 !important;
  transform: none !important;
  box-shadow: 0 0 0 2px var(--paper);
}
[data-theme="dark"] body.sidebar-collapsed .nav-section::before {
  box-shadow: 0 0 0 2px var(--bg);
}

/* Tooltip on hover with group name */
body.sidebar-collapsed .nav-section[data-grp]:hover::after {
  content: attr(data-grp);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--paper);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 1500;
}

/* === v2.32 · Collapsed sidebar — hide search box, keep clock icon only on Recent === */

/* Hide the entire search box when collapsed (was showing as a ⌘K chip) */
body.sidebar-collapsed .sidebar-search {
  display: none !important;
}

/* The "Recent" nav-section: hide the text inside its first span,
   keep only the clock icon (handled by .grp-ic from the previous rule). */
body.sidebar-collapsed .nav-section[data-grp="Recent"] .grp-ic,
body.sidebar-collapsed .nav-section[data-grp="Pinned"] .grp-ic {
  font-size: 17px !important;
}

/* The previous v2.31 rule already font-size:0 on the inner span, so the text
   "Recent"/"Pinned" is hidden. Just make sure no leftover label shows. */
body.sidebar-collapsed .nav-section[data-grp="Recent"] > span:first-child,
body.sidebar-collapsed .nav-section[data-grp="Pinned"] > span:first-child {
  font-size: 0 !important;
}

/* === v2.33 · Collapsed sidebar refinement ===
   - Keep Recent + Pinned icons WITH the color dot (current style)
   - For all other category groups: remove the dot, replace with a colored
     rounded-square stroke on the icon chip itself */

/* Hide the color dot for normal category groups */
body.sidebar-collapsed .nav-section:not([data-grp="Recent"]):not([data-grp="Pinned"])::before {
  display: none !important;
}

/* Give the icon chip a colored 2px stroke matching the group's accent.
   The chip stays rounded, the background becomes transparent / slightly tinted. */
body.sidebar-collapsed .nav-section:not([data-grp="Recent"]):not([data-grp="Pinned"]) .grp-ic {
  background: transparent !important;
  border: 2px solid currentColor;
  border-radius: 8px !important;
  width: 32px;
  height: 32px;
}

/* The .nav-section already gets its color via the per-data-grp rules.
   Make sure each group passes its color down to the icon chip's border. */
body.sidebar-collapsed .nav-section[data-grp="My work"]            .grp-ic { border-color: var(--indigo-600); }
body.sidebar-collapsed .nav-section[data-grp="Citizen"]            .grp-ic { border-color: #14B8A6; }
body.sidebar-collapsed .nav-section[data-grp="Operations"]         .grp-ic { border-color: var(--info); }
body.sidebar-collapsed .nav-section[data-grp="Finance & delivery"] .grp-ic { border-color: var(--ok); }
body.sidebar-collapsed .nav-section[data-grp="AI governance"]      .grp-ic { border-color: #7C3AED; }
body.sidebar-collapsed .nav-section[data-grp="Audit & oversight"]  .grp-ic { border-color: var(--warn); }
body.sidebar-collapsed .nav-section[data-grp="Officer & HR"]       .grp-ic { border-color: var(--kr-red); }
body.sidebar-collapsed .nav-section[data-grp="Reference"]          .grp-ic { border-color: var(--ink-3); }
body.sidebar-collapsed .nav-section[data-grp="Preferences"]        .grp-ic { border-color: var(--neutral); }

/* Hover — fill the chip with a faint tint of the same color */
body.sidebar-collapsed .nav-section[data-grp="My work"]:hover .grp-ic            { background: rgba(79,70,229,0.12) !important; }
body.sidebar-collapsed .nav-section[data-grp="Citizen"]:hover .grp-ic            { background: rgba(20,184,166,0.14) !important; }
body.sidebar-collapsed .nav-section[data-grp="Operations"]:hover .grp-ic         { background: rgba(37,99,235,0.14) !important; }
body.sidebar-collapsed .nav-section[data-grp="Finance & delivery"]:hover .grp-ic { background: rgba(22,163,74,0.14) !important; }
body.sidebar-collapsed .nav-section[data-grp="AI governance"]:hover .grp-ic      { background: rgba(124,58,237,0.14) !important; }
body.sidebar-collapsed .nav-section[data-grp="Audit & oversight"]:hover .grp-ic  { background: rgba(217,119,6,0.14) !important; }
body.sidebar-collapsed .nav-section[data-grp="Officer & HR"]:hover .grp-ic       { background: rgba(196,57,47,0.14) !important; }
body.sidebar-collapsed .nav-section[data-grp="Reference"]:hover .grp-ic          { background: rgba(100,116,139,0.14) !important; }
body.sidebar-collapsed .nav-section[data-grp="Preferences"]:hover .grp-ic        { background: rgba(107,114,128,0.14) !important; }

/* === v2.34 · Tasks page — proper Mark done CTA (replaces checkbox) === */
.task-row .task-cta-open,
.task-row .task-cta-done,
.task-row .task-cta-remove {
  padding: 7px 13px !important;
  font-size: 12px;
  font-weight: 700;
  border-radius: 7px;
  white-space: nowrap;
}

/* Mark done — green call-to-action */
.task-row .task-cta-done {
  background: linear-gradient(180deg, #10B981 0%, #059669 100%) !important;
  color: #fff !important;
  border: 1px solid #047857 !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 1px 3px rgba(5,150,105,0.30);
  transition: all .15s ease;
}
.task-row .task-cta-done:hover {
  background: linear-gradient(180deg, #14C28F 0%, #069B70 100%) !important;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 4px 12px -2px rgba(16,185,129,0.45);
}
.task-row .task-cta-done:active { transform: translateY(0) scale(0.97); }

/* When task is already done, the same button becomes "Reopen" (slate ghost) */
.task-row .task-cta-done.is-undo {
  background: var(--paper) !important;
  color: var(--ink-2) !important;
  border-color: var(--line) !important;
  box-shadow: none;
}
.task-row .task-cta-done.is-undo:hover {
  background: var(--indigo-100) !important;
  color: var(--indigo-700) !important;
  border-color: var(--indigo-500) !important;
}

/* Remove button — muted ghost so it doesn't compete with Mark done */
.task-row .task-cta-remove {
  background: var(--paper) !important;
  color: var(--ink-3) !important;
  border: 1px solid var(--line) !important;
}
.task-row .task-cta-remove:hover {
  background: rgba(196,57,47,0.10) !important;
  color: var(--kr-red) !important;
  border-color: var(--kr-red) !important;
}

.task-row .task-cta-open {
  padding: 7px 14px !important;
}

.task-row .task-cta-spacer { display: inline-block; width: 76px; }

/* Done row — strike-through softer */
.task-row.is-done { background: var(--bg-soft); }

/* Dark mode polish */
[data-theme="dark"] .task-row .task-cta-done.is-undo,
[data-theme="dark"] .task-row .task-cta-remove {
  background: var(--bg-soft) !important;
  border-color: rgba(99,102,241,0.25) !important;
  color: #CBD5E1 !important;
}
[data-theme="dark"] .task-row .task-cta-done.is-undo:hover {
  background: rgba(99,102,241,0.20) !important;
  color: #fff !important;
}
[data-theme="dark"] .task-row .task-cta-remove:hover {
  background: rgba(196,57,47,0.20) !important;
  color: #FCA5A5 !important;
}

/* Narrow viewports — stack CTAs */
@media (max-width: 720px) {
  .task-row {
    grid-template-columns: 8px 1fr auto !important;
    grid-template-rows: auto auto !important;
    row-gap: 8px !important;
  }
  .task-row > .pill { grid-row: 1; grid-column: 3; justify-self: end; }
  .task-row .task-cta-open,
  .task-row .task-cta-done,
  .task-row .task-cta-remove { grid-row: 2; }
  .task-row .task-cta-spacer { display: none; }
}

/* === v2.35 · Tasks · Raise issue CTA (replaces Remove) === */
.task-row .task-cta-raise {
  padding: 7px 13px !important;
  font-size: 12px;
  font-weight: 700;
  border-radius: 7px;
  white-space: nowrap;
  background: var(--paper) !important;
  color: var(--warn) !important;
  border: 1px solid var(--warn) !important;
  transition: all .15s ease;
}
.task-row .task-cta-raise:hover {
  background: var(--warn) !important;
  color: #fff !important;
  border-color: var(--warn) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -2px rgba(217,119,6,0.40);
}
.task-row .task-cta-raise:active { transform: translateY(0) scale(0.97); }

[data-theme="dark"] .task-row .task-cta-raise {
  background: var(--bg-soft) !important;
  color: #FCD34D !important;
  border-color: rgba(217,119,6,0.50) !important;
}
[data-theme="dark"] .task-row .task-cta-raise:hover {
  background: rgba(217,119,6,0.20) !important;
  color: #FDE68A !important;
  border-color: var(--warn) !important;
}

/* === v2.36 · Raise-issue modal === */
.cms-raise-overlay {
  position: fixed; inset: 0;
  z-index: 9400;
  background: rgba(15,23,42,0.62);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 24px;
  animation: cms-r-in .18s ease-out;
}
@keyframes cms-r-in { from { opacity: 0; } to { opacity: 1; } }

.cms-raise-card {
  background: var(--paper);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.40);
  animation: cms-r-card .22s cubic-bezier(.34,1.56,.64,1);
  padding: 22px 24px 18px;
}
@keyframes cms-r-card { from { transform: translateY(14px) scale(.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.cms-raise-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.cms-raise-title { font-size: 17px; font-weight: 800; color: var(--ink); }
.cms-raise-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.cms-raise-sub strong { color: var(--ink); }

.cms-raise-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  cursor: pointer;
  font-size: 18px;
  color: var(--ink-2);
  line-height: 1;
  flex-shrink: 0;
  transition: all .15s ease;
}
.cms-raise-close:hover { background: var(--kr-red); color: #fff; border-color: var(--kr-red); }

.cms-raise-warn {
  display: flex;
  gap: 10px;
  background: linear-gradient(135deg, rgba(217,119,6,0.10), rgba(245,158,11,0.06));
  border: 1px solid rgba(217,119,6,0.30);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}
.cms-raise-warn strong { color: var(--ink); }
.cms-raise-warn-ic { font-size: 17px; line-height: 1; flex-shrink: 0; animation: cms-warn-pulse 2.4s ease-in-out infinite; }

.cms-raise-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin: 16px 0 8px;
}

.cms-raise-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.cms-raise-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: left;
  transition: all .15s ease;
}
.cms-raise-chip:hover {
  border-color: var(--warn);
  background: linear-gradient(180deg, var(--paper), rgba(217,119,6,0.06));
  color: var(--ink);
}
.cms-raise-chip.is-selected {
  border-color: var(--warn);
  background: linear-gradient(180deg, rgba(217,119,6,0.15), rgba(217,119,6,0.08));
  color: var(--warn);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 2px 6px rgba(217,119,6,0.20);
}
.cms-raise-chip-ic { font-size: 16px; flex-shrink: 0; }

.cms-raise-textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-size: 13px;
  font-family: var(--font);
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
  transition: all .15s ease;
}
.cms-raise-textarea:focus {
  outline: none;
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(217,119,6,0.18);
}

.cms-raise-err {
  margin-top: 10px;
  padding: 9px 12px;
  background: rgba(220,38,38,0.10);
  border: 1px solid rgba(220,38,38,0.30);
  border-radius: 8px;
  color: var(--risk);
  font-size: 12px;
  font-weight: 600;
}

.cms-raise-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Dark mode */
[data-theme="dark"] .cms-raise-card { background: var(--bg-soft); }
[data-theme="dark"] .cms-raise-warn { background: linear-gradient(135deg, rgba(217,119,6,0.20), rgba(245,158,11,0.10)); }
[data-theme="dark"] .cms-raise-chip { background: var(--bg); border-color: rgba(99,102,241,0.25); color: #CBD5E1; }
[data-theme="dark"] .cms-raise-chip:hover { background: rgba(217,119,6,0.15); color: #FDE68A; }
[data-theme="dark"] .cms-raise-chip.is-selected { background: rgba(217,119,6,0.25); color: #FDE68A; }
[data-theme="dark"] .cms-raise-textarea { background: var(--bg); border-color: rgba(99,102,241,0.25); color: #E0E7FF; }

/* === v2.37 · Dark-mode contrast fix for timeline actor names + KSSL anchors === */
[data-theme="dark"] .timeline-event .who {
  color: #A5B4FC !important;   /* light indigo, readable on dark slate */
}
[data-theme="dark"] .timeline-event .when {
  color: #94A3B8 !important;
}
[data-theme="dark"] .timeline-event .kssl {
  color: #64748B !important;
}
[data-theme="dark"] .timeline-event .what {
  color: #F1F5F9 !important;
}
/* Timeline bullet dot — slightly brighter so it pops on dark */
[data-theme="dark"] .timeline-event::before {
  background: var(--indigo-500) !important;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.25);
}

/* === v2.38 · Sticky sidebar on desktop (page can scroll, sidebar stays put) === */
@media (min-width: 721px) {
  .shell { align-items: start; }
  .sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-self: start;
  }
}

/* === v2.39 · Settings page polish === */
.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(12px, 2vw, 24px);
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.setting-row:last-child { border-bottom: none; }

.setting-row .lbl {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.setting-row .desc {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.5;
  max-width: 56ch;
}

/* Segmented pill toggle (Language + Theme) */
.lang-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(15,23,42,0.04);
}
.lang-toggle button {
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--font);
  transition: all .18s ease;
  white-space: nowrap;
  min-width: 70px;
}
.lang-toggle button:hover:not(.active) {
  color: var(--indigo-700);
  background: var(--indigo-100);
}
.lang-toggle button.active {
  background: linear-gradient(180deg, var(--indigo-600) 0%, var(--indigo-700) 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 2px 6px -1px rgba(99,102,241,0.40);
}

/* Reset demo button — proper danger CTA */
.setting-row .btn-danger,
.setting-row > button.btn-danger {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--kr-red) 0%, #E11D48 100%) !important;
  color: #fff !important;
  border: 1px solid #B91C1C !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 2px 6px rgba(196,57,47,0.30);
  cursor: pointer;
  transition: all .15s ease;
}
.setting-row .btn-danger:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 6px 16px -4px rgba(196,57,47,0.50);
}

/* Dark mode polish */
[data-theme="dark"] .lang-toggle {
  background: var(--bg);
  border-color: rgba(99,102,241,0.30);
}
[data-theme="dark"] .lang-toggle button { color: #CBD5E1; }
[data-theme="dark"] .lang-toggle button:hover:not(.active) {
  color: #fff;
  background: rgba(99,102,241,0.20);
}
[data-theme="dark"] .setting-row .desc { color: #94A3B8; }

/* Stack on narrow viewports */
@media (max-width: 600px) {
  .setting-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .setting-row .lang-toggle { justify-self: start; }
}

/* === v2.40 · KN marquee — slightly faster scroll === */
.cms-kn-track {
  animation-duration: 35s !important;
}
