/* ==========================================================================
   Civesto Authority — panel design system (5 Sep 2026)
   One stylesheet for every authority surface: sign-in, work queue, case
   sheet, statistics, governance, control-room board and the printable
   documents. Tokens first, components second, print last.
   ========================================================================== */

:root {
  /* surfaces */
  --bg0: #070A12;
  --bg1: #0B101C;
  --bg2: #111827;
  --bg3: #172033;
  --bg4: #1E2A40;
  --line: rgba(148, 163, 184, .12);
  --line-strong: rgba(148, 163, 184, .24);
  /* text */
  --t1: #EEF2F8;
  --t2: #A9B4C6;
  --t3: #6F7D93;
  --t4: #4B5567;
  /* brand + semantics */
  --accent: #4DA3FF;
  --accent-2: #2B7FFF;
  --accent-soft: rgba(77, 163, 255, .14);
  --accent-line: rgba(77, 163, 255, .38);
  --new: #FF6B6B;
  --review: #C084FC;
  --validated: #4DA3FF;
  --forwarded: #F5B23D;
  --acted: #34D399;
  --closed: #8A96A8;
  --danger: #FF5252;
  --warn: #F5B23D;
  --ok: #34D399;
  --info: #38BDF8;
  /* shape + depth */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, .45);
  --shadow-3: 0 28px 70px rgba(0, 0, 0, .62);
  /* type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* layout */
  --sidebar: 252px;
  --header: 62px;
  --gutter: 28px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: .16s;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg0);
  color: var(--t1);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(77, 163, 255, .35); }
.num, .kpi-value, td.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* icons ------------------------------------------------------------------ */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 14px; height: 14px; }
.ic.lg { width: 22px; height: 22px; }
.ic.xl { width: 30px; height: 30px; stroke-width: 1.5; }

/* focus ------------------------------------------------------------------ */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   SIGN-IN
   ========================================================================== */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(77, 163, 255, .12), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(255, 107, 107, .08), transparent 60%),
    var(--bg0);
}
.gate-card {
  width: 100%;
  max-width: 520px;
  background: rgba(17, 24, 39, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  padding: 34px 36px 28px;
}
.gate-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.mark {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: #102E36;
  border: 1px solid rgba(245, 243, 236, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 18px rgba(43, 127, 255, .18);
  font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--t1);
}
.mark.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
.mark svg { width: 28px; height: 28px; display: block; color: #F5F3EC; }
.mark.sm svg { width: 22px; height: 22px; }
.gate-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.gate-sub { color: var(--t2); font-size: 13px; margin-top: 2px; }
.gate-lede { color: var(--t2); font-size: 13.5px; line-height: 1.6; margin: 0 0 22px; }
.gate-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--t3); font-weight: 600; margin: 0 0 10px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.demo-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 14px; border-radius: var(--r-md); cursor: pointer;
  background: var(--bg3); border: 1px solid var(--line-strong);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.demo-btn:hover { border-color: var(--accent-line); background: var(--bg4); transform: translateY(-1px); }
.demo-btn .ic { color: var(--accent); width: 22px; height: 22px; }
.demo-btn b { display: block; font-size: 14px; font-weight: 650; }
.demo-btn small { display: block; color: var(--t3); font-size: 11.5px; margin-top: 1px; }
.gate-note { color: var(--t3); font-size: 11.5px; line-height: 1.55; margin-top: 10px; }
.gate-or { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--t3); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.gate-or::before, .gate-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gate-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--t3); font-size: 11.5px; line-height: 1.6; }
.gate-foot b { color: var(--t2); font-weight: 600; }
.gate-error { display: none; margin-top: 10px; color: var(--new); font-size: 13px; }
.gate-error.on { display: block; }

/* ==========================================================================
   SHELL
   ========================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg1); border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); }
.side-brand b { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.side-brand small { display: block; color: var(--t3); font-size: 11px; margin-top: 1px; }
.nav { flex: 1; overflow-y: auto; padding: 12px 12px 8px; }
.nav-group { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--t4); font-weight: 700; padding: 14px 10px 6px; }
.nav-group:first-child { padding-top: 4px; }
.nav-item {
  position: relative; width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; cursor: pointer;
  color: var(--t2); font-size: 13.5px; font-weight: 500; text-align: left; min-height: 40px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .045); color: var(--t1); }
.nav-item.on { background: var(--accent-soft); color: var(--t1); font-weight: 600; }
.nav-item.on::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .ic { color: var(--t3); }
.nav-item.on .ic, .nav-item:hover .ic { color: var(--accent); }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--new); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.nav-count:empty { display: none; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 14px 14px; }
.who { display: flex; flex-direction: column; gap: 4px; }
.who-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-meta { color: var(--t3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.side-foot .btn { width: 100%; margin-top: 10px; justify-content: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--header);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gutter);
  background: rgba(7, 10, 18, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.topbar .sub { color: var(--t3); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.top-right { display: flex; align-items: center; gap: 10px; flex: none; }
.conn { display: inline-flex; align-items: center; gap: 7px; color: var(--t3); font-size: 12px; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 211, 153, .5); animation: pulse 2.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .45); } 100% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); } }
.conn.off i { background: var(--danger); animation: none; }
.view { padding: 22px var(--gutter) 40px; width: 100%; max-width: 1480px; }
.view > * + * { margin-top: 18px; }

/* ==========================================================================
   PRIMITIVES
   ========================================================================== */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 13px; font-weight: 650; }
.card-h .hint { color: var(--t3); font-size: 12px; }
.card-b { padding: 18px; }
.sec-title { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--t3); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  background: var(--bg3); border: 1px solid var(--line-strong); color: var(--t1);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur);
}
.btn:hover { background: var(--bg4); border-color: rgba(148, 163, 184, .36); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent-2); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(43, 127, 255, .28); }
.btn.primary:hover { background: #3A8BFF; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--t2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .06); color: var(--t1); }
.btn.subtle { background: rgba(255, 255, 255, .05); border-color: transparent; }
.btn.danger { color: var(--new); }
.btn.danger:hover { background: rgba(255, 107, 107, .12); border-color: rgba(255, 107, 107, .35); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { min-height: 28px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.icon { padding: 0; width: 38px; }
.btn.icon.sm { width: 32px; }
.btn .ic { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--t2); }
.input, .select, textarea.input {
  min-height: 38px; padding: 0 12px; border-radius: 10px;
  background: var(--bg1); border: 1px solid var(--line-strong); color: var(--t1); font-size: 13.5px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
textarea.input { padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--t4); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 163, 255, .18); }
.select {
  -webkit-appearance: none; appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236F7D93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select option { background: var(--bg2); }
.search { position: relative; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--t3); width: 15px; height: 15px; pointer-events: none; }
.search .input { padding-left: 34px; width: 100%; }
.kbd { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--bg3); border: 1px solid var(--line-strong); color: var(--t2); font: 600 10.5px/1.5 var(--mono); }

/* pills / chips ----------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px;
  font-size: 12px; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
  background: rgba(148, 163, 184, .13); color: var(--t2);
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.new { background: rgba(255, 107, 107, .14); color: var(--new); }
.pill.under_review { background: rgba(192, 132, 252, .14); color: var(--review); }
.pill.validated { background: rgba(77, 163, 255, .14); color: var(--validated); }
.pill.forwarded { background: rgba(245, 178, 61, .14); color: var(--forwarded); }
.pill.acted { background: rgba(52, 211, 153, .14); color: var(--acted); }
.pill.closed { background: rgba(138, 150, 168, .14); color: var(--closed); }
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
  background: rgba(148, 163, 184, .12); color: var(--t2);
}
.tag.ok { background: rgba(52, 211, 153, .12); color: var(--ok); }
.tag.info { background: rgba(56, 189, 248, .12); color: var(--info); }
.tag.warn { background: rgba(245, 178, 61, .12); color: var(--warn); }
.tag.danger { background: rgba(255, 107, 107, .14); color: var(--new); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.line { background: transparent; border-color: var(--line-strong); color: var(--t2); }
.tag.hi { background: rgba(255, 82, 82, .16); color: var(--danger); font-weight: 750; letter-spacing: .06em; font-size: 10.5px; }
.tag .ic { width: 12px; height: 12px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  background: var(--bg2); border: 1px solid var(--line-strong); color: var(--t2); font-size: 12.5px; font-weight: 600;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover { color: var(--t1); border-color: rgba(148, 163, 184, .4); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--t1); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--t3)); }
.chip b { font-weight: 700; color: var(--t1); font-variant-numeric: tabular-nums; }
.chip.on b { color: var(--accent); }

.seg { display: inline-flex; background: var(--bg1); border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--t2); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background var(--dur), color var(--dur); }
.seg button:hover { color: var(--t1); }
.seg button.on { background: var(--bg3); color: var(--t1); box-shadow: var(--shadow-1); }

/* toolbar ----------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1 1 220px; }
.toolbar .end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.count { color: var(--t3); font-size: 12px; white-space: nowrap; }

/* dropdown menu ----------------------------------------------------------- */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; padding: 6px; background: var(--bg3); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-2); display: none; }
.menu.open { display: block; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--t1); text-align: left; font-size: 13px; cursor: pointer; }
.menu button:hover { background: rgba(255, 255, 255, .06); }
.menu button small { margin-left: auto; color: var(--t3); font-size: 11px; }
.menu .menu-h { padding: 6px 10px 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--t4); font-weight: 700; }

/* KPIs ------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { position: relative; overflow: hidden; padding: 14px 16px 13px 18px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone, var(--t4)); }
.kpi.accent { --tone: var(--accent); } .kpi.new { --tone: var(--new); } .kpi.ok { --tone: var(--ok); } .kpi.warn { --tone: var(--warn); } .kpi.info { --tone: var(--info); }
.kpi-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--t3); font-weight: 700; }
.kpi-value { font-size: 28px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; margin-top: 8px; color: var(--t1); }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--t3); letter-spacing: 0; margin-left: 2px; }
.kpi-sub { color: var(--t3); font-size: 12px; margin-top: 6px; }
.kpi-sub b { color: var(--t2); font-weight: 600; }
.kpi.warn .kpi-value, .kpi.new .kpi-value { color: var(--tone); }

/* table ------------------------------------------------------------------ */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; z-index: 1; padding: 10px 14px; text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--t3); font-weight: 700; background: var(--bg2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background var(--dur) var(--ease); }
.tbl tbody tr.row { cursor: pointer; }
.tbl tbody tr.row:hover { background: rgba(255, 255, 255, .035); }
.tbl tbody tr.row.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.tbl td.pri { position: relative; padding-left: 18px; }
.tbl td.pri::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line-strong); }
.tbl tr.high td.pri::before { background: var(--danger); }
.tbl .muted { color: var(--t3); font-size: 12px; }
.tbl .cell-title { font-weight: 600; color: var(--t1); }
.tbl .cell-sub { color: var(--t3); font-size: 11.5px; margin-top: 2px; }
.tbl td.arrow { color: var(--t4); width: 28px; text-align: right; }
.age { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--t2); font-variant-numeric: tabular-nums; }
.age.warn { color: var(--warn); } .age.late { color: var(--new); font-weight: 650; }
.age .ic { width: 13px; height: 13px; }
.plate { font-family: var(--mono); font-weight: 600; font-size: 13px; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.rec { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: rgba(77, 163, 255, .14); color: var(--accent); font-size: 10.5px; font-weight: 750; }
.rec .ic { width: 11px; height: 11px; }

/* skeleton / empty / error ---------------------------------------------- */
.skel { position: relative; overflow: hidden; background: rgba(255, 255, 255, .05); border-radius: 6px; min-height: 12px; }
.skel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent); transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-rows { padding: 6px 14px; }
.skel-rows .skel { height: 14px; margin: 14px 0; }
.empty { padding: 44px 24px; text-align: center; color: var(--t3); }
.empty .ic { width: 34px; height: 34px; stroke-width: 1.4; color: var(--t4); margin: 0 auto 10px; }
.empty b { display: block; color: var(--t2); font-size: 14px; font-weight: 650; margin-bottom: 4px; }
.empty p { font-size: 12.5px; line-height: 1.55; max-width: 460px; margin: 0 auto; }
.empty .btn { margin-top: 14px; }
.error-box { padding: 16px 18px; border-radius: var(--r-md); background: rgba(255, 107, 107, .08); border: 1px solid rgba(255, 107, 107, .3); color: var(--t1); font-size: 13px; }
.error-box b { color: var(--new); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 13px; line-height: 1.55; }
.notice .ic { color: var(--accent); margin-top: 1px; }
.notice.warn { background: rgba(245, 178, 61, .1); border-color: rgba(245, 178, 61, .35); } .notice.warn .ic { color: var(--warn); }
.notice.ok { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .35); } .notice.ok .ic { color: var(--ok); }
.notice.muted { background: rgba(148, 163, 184, .08); border-color: var(--line-strong); } .notice.muted .ic { color: var(--t3); }

/* charts ----------------------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 18px; }
.bar { flex: 1 1 0; min-width: 6px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar i { width: 100%; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--accent), rgba(77, 163, 255, .45)); min-height: 3px; transition: opacity var(--dur); }
.bar:hover i { opacity: .8; }
.bar b { font-size: 10.5px; color: var(--t2); font-weight: 600; }
.bar small { font-size: 9.5px; color: var(--t4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hbar { display: grid; grid-template-columns: minmax(120px, 1.2fr) 3fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 12.5px; }
.hbar .lbl { color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .trk { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.hbar .trk i { display: block; height: 100%; border-radius: 999px; background: var(--c, var(--accent)); }
.hbar .val { color: var(--t3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar .val b { color: var(--t1); font-weight: 650; }
.matrix { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.matrix .rl { font-size: 10.5px; color: var(--t3); font-weight: 600; }
.matrix .cl { font-size: 9.5px; color: var(--t4); text-align: center; }
.matrix .cell { aspect-ratio: 1.6; border-radius: 3px; background: rgba(77, 163, 255, calc(.06 + var(--v, 0) * .9)); }
.matrix .cell[title]:hover { outline: 1px solid var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--t3); font-size: 11.5px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 14px; }

/* map -------------------------------------------------------------------- */
.map { height: calc(100vh - var(--header) - 120px); min-height: 420px; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; }
.leaflet-container { background: #0b1020; font-family: var(--font); }
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.72) contrast(.88) saturate(.22) grayscale(.35); }
.leaflet-control-attribution { background: rgba(11, 16, 32, .72) !important; color: #94a3b8 !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: #cbd5e1 !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg3); color: var(--t1); box-shadow: var(--shadow-2); }
.leaflet-popup-content { font-size: 12.5px; line-height: 1.45; }
.leaflet-bar a { background: var(--bg3) !important; color: var(--t1) !important; border-color: var(--line-strong) !important; }
.mini-map { height: 220px; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.mini-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.66) contrast(.9) saturate(.25) grayscale(.3); }
.pin { width: 16px; height: 16px; border-radius: 50%; background: var(--new); border: 2px solid #fff; box-shadow: 0 0 0 4px rgba(255, 107, 107, .3); }

/* list rows (recurring, hotspots, keys) --------------------------------- */
.list { display: flex; flex-direction: column; }
.li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; transition: background var(--dur); } .li.click:hover { background: rgba(255, 255, 255, .035); }
.li .n { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: 16px; font-variant-numeric: tabular-nums; }
.li .n.warn { background: rgba(245, 178, 61, .14); color: var(--warn); }
.li .n.danger { background: rgba(255, 107, 107, .14); color: var(--new); }
.li .t { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { color: var(--t3); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .r { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ==========================================================================
   CASE SHEET (detail)
   ========================================================================== */
.overlay { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(3, 6, 12, .66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.overlay.open { display: flex; animation: fade .18s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet { width: 100%; max-width: 1320px; max-height: 92vh; display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-3); overflow: hidden; animation: rise .22s var(--ease); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
.sheet-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; color: var(--t2); font-size: 12.5px; }
.sheet-meta .dot { color: var(--t4); }
.sheet-nav { display: flex; align-items: center; gap: 4px; flex: none; }
.sheet-nav .pos { min-width: 44px; text-align: center; color: var(--t3); font-size: 12px; font-variant-numeric: tabular-nums; }
.sheet-b { overflow-y: auto; padding: 20px 24px 24px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(400px, 1fr); gap: 22px; align-items: start; }
.sheet-b > * { min-width: 0; }
.evidence { position: relative; border-radius: 14px; overflow: hidden; background: #05070c; border: 1px solid var(--line); }
.evidence img, .evidence video { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #05070c; }
.evidence .cap { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--t3); font-size: 11.5px; }
.evidence-empty { display: grid; place-items: center; aspect-ratio: 16 / 10; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--t3); text-align: center; padding: 20px; }
.evidence-empty .ic { width: 30px; height: 30px; color: var(--t4); margin-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.block { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); }
.block.tone { border-left: 3px solid var(--tone, var(--t3)); }
.block .sec-title { color: var(--tone, var(--t3)); }
.block .lede { font-size: 13.5px; line-height: 1.5; color: var(--t1); margin-top: 6px; }
.block .body { font-size: 12.5px; line-height: 1.55; color: var(--t2); margin-top: 6px; }
.block .hash { font-family: var(--mono); font-size: 11px; word-break: break-all; color: var(--t2); line-height: 1.55; margin-top: 6px; }
.verdict { display: flex; align-items: center; gap: 10px; }
.verdict i { width: 10px; height: 10px; border-radius: 50%; background: var(--tone); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 22%, transparent); }
.verdict b { font-size: 17px; font-weight: 700; color: var(--tone); letter-spacing: -.01em; }
.findings { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.finding { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 7px; font-size: 12px; color: var(--t1); background: color-mix(in srgb, var(--fc) 10%, transparent); border: 1px solid color-mix(in srgb, var(--fc) 30%, transparent); }
.finding i { width: 5px; height: 5px; border-radius: 50%; background: var(--fc); }
details.why { margin-top: 9px; }
details.why summary { cursor: pointer; font-size: 12.5px; color: var(--accent); list-style: none; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary::after { content: ' ↓'; }
details.why[open] summary::after { content: ' ↑'; }
details.why .body { margin-top: 8px; }
.roles { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.decision { padding: 16px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .04); }
.decision-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.decision-h b { font-size: 15px; font-weight: 700; }
.decision-h small { color: var(--t3); font-size: 11.5px; }
.status-seg { display: flex; margin-top: 12px; border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; background: var(--bg1); }
.status-seg button { flex: 1; min-height: 42px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--t2); font-size: 13px; font-weight: 600; text-transform: capitalize; cursor: pointer; transition: background var(--dur), color var(--dur); }
.status-seg button:first-child { border-left: 0; }
.status-seg button:hover:not(:disabled) { background: rgba(255, 255, 255, .07); color: var(--t1); }
.status-seg button.on { background: var(--accent-2); color: #fff; }
.status-seg button:disabled { opacity: .45; cursor: not-allowed; }
.decision-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hist { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.hist-i { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 6px 0; font-size: 12.5px; color: var(--t2); }
.hist-i i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--t4); }
.hist-i b { color: var(--t1); font-weight: 600; }
.hint-row { color: var(--t3); font-size: 11.5px; line-height: 1.6; }
.coords { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12px; color: var(--t2); }

/* toast ------------------------------------------------------------------ */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 280px; max-width: 400px; padding: 12px 14px 12px 16px; border-radius: 12px; background: var(--bg3); border: 1px solid var(--line-strong); border-left: 3px solid var(--tone, var(--accent)); box-shadow: var(--shadow-2); animation: rise .2s var(--ease); font-size: 13px; }
.toast b { display: block; color: var(--tone, var(--accent)); font-weight: 650; margin-bottom: 2px; }
.toast span { color: var(--t2); font-size: 12.5px; line-height: 1.45; }
.toast.ok { --tone: var(--ok); } .toast.warn { --tone: var(--warn); } .toast.danger { --tone: var(--new); }

/* modal (small, e.g. new key) ------------------------------------------- */
.modal { width: 100%; max-width: 560px; background: var(--bg2); border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-3); padding: 24px; animation: rise .22s var(--ease); }
.modal h3 { font-size: 17px; font-weight: 700; }
.modal .form { display: grid; gap: 12px; margin-top: 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.secret { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--bg1); border: 1px solid var(--line-strong); font-family: var(--mono); font-size: 12.5px; word-break: break-all; color: var(--t1); }

/* ==========================================================================
   CONTROL-ROOM BOARD
   ========================================================================== */
body.board-mode .side, body.board-mode .topbar { display: none; }
body.board-mode .shell { grid-template-columns: 1fr; }
body.board-mode .view { max-width: none; padding: 20px 24px; min-height: 100vh; }
.board-h { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.board-h h2 { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.board-h .clock { font-size: 30px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.board-h .sub { color: var(--t3); font-size: 13px; }
.board-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); gap: 16px; margin-top: 16px; }
.board-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.board-kpis .kpi-value { font-size: 44px; }
.board-map { height: calc(100vh - 320px); min-height: 380px; }
.board-list .li { padding: 11px 16px; }
.board-foot { margin-top: 12px; color: var(--t4); font-size: 11.5px; display: flex; justify-content: space-between; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-b { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .three { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar: 72px; --gutter: 16px; }
  .side-brand b, .side-brand small, .nav-group, .nav-item span, .who, .side-foot .btn span { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item.on::before { display: none; }
  .nav-count { position: absolute; top: 4px; right: 6px; }
  .topbar .sub { display: none; }
  .two { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: 1fr; }
  .board-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .demo-grid { grid-template-columns: 1fr; }
  .decision-fields { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr; }
  .overlay { padding: 0; }
  .sheet { max-height: 100vh; border-radius: 0; }
}

/* ==========================================================================
   PRINT DOCUMENTS (case file · work order · monthly report)
   ========================================================================== */
#print-root { display: none; }
.doc { font: 11.5pt/1.45 'Inter', 'Helvetica Neue', Arial, sans-serif; color: #111; background: #fff; }
.doc h1 { font-size: 19pt; font-weight: 700; letter-spacing: -.01em; margin: 0 0 2pt; }
.doc h2 { font-size: 12pt; font-weight: 700; margin: 16pt 0 6pt; padding-bottom: 3pt; border-bottom: 1px solid #ccc; text-transform: uppercase; letter-spacing: .06em; color: #333; }
.doc .doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20pt; padding-bottom: 10pt; border-bottom: 2px solid #111; }
.doc .doc-head .org { text-align: right; font-size: 10pt; color: #333; }
.doc .doc-head .org b { display: block; font-size: 11pt; color: #111; }
.doc .ref { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 10pt; color: #333; }
.doc .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6pt 18pt; }
.doc .kv { display: grid; grid-template-columns: 120pt 1fr; gap: 4pt 10pt; font-size: 10.5pt; }
.doc .kv dt { color: #555; }
.doc .kv dd { margin: 0; color: #111; font-weight: 500; }
.doc .mono { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 9.5pt; word-break: break-all; }
.doc .photo { max-width: 100%; max-height: 300pt; border: 1px solid #ccc; margin-top: 6pt; }
.doc table { width: 100%; border-collapse: collapse; font-size: 10pt; }
.doc th, .doc td { text-align: left; padding: 5pt 6pt; border-bottom: 1px solid #ddd; vertical-align: top; }
.doc th { font-size: 9pt; text-transform: uppercase; letter-spacing: .06em; color: #555; border-bottom: 1px solid #999; }
.doc .badge { display: inline-block; padding: 1pt 6pt; border: 1px solid #999; border-radius: 4pt; font-size: 9pt; }
.doc .note { font-size: 9.5pt; color: #555; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14pt; margin-top: 18pt; }
.doc .sign div { border-top: 1px solid #111; padding-top: 4pt; font-size: 9.5pt; color: #333; }
.doc .lines div { border-bottom: 1px solid #999; height: 20pt; }
.doc .kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10pt; }
.doc .kpi-row div { border: 1px solid #ccc; border-radius: 6pt; padding: 8pt 10pt; }
.doc .kpi-row b { display: block; font-size: 18pt; font-weight: 700; }
.doc .kpi-row small { color: #555; font-size: 9pt; text-transform: uppercase; letter-spacing: .06em; }
.doc .doc-foot { margin-top: 18pt; padding-top: 8pt; border-top: 1px solid #ccc; font-size: 9pt; color: #555; display: flex; justify-content: space-between; }
.doc .bar { display: inline-block; height: 8pt; background: #2B7FFF; border-radius: 2pt; vertical-align: middle; }
.doc .pb { page-break-before: always; }
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff !important; color: #111; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
}
