/* ==========================================================================
   Àtúnṣe — visual system (2026 glass)
   Ground:   an aurora of teal and amber light, the colours of restored power.
   Surfaces: frosted panes lifted off that ground, hairline-lit at the top edge.
   Accent:   restoration teal; amber belongs to the physical asset tag alone.
   Type:     Archivo (display), IBM Plex Sans (body), IBM Plex Mono (tags, serials, figures).
   Legibility first: glass carries structure, never the data. Text, tables and
   check-lists sit on near-opaque fills so they hold on a bright ward corridor.
   ========================================================================== */
:root {
  /* ground and light */
  --ground: #E2ECE8;
  --ground-2: #C8DED8;
  --aurora-1: rgba(8, 104, 89, .42);
  --aurora-2: rgba(38, 190, 160, .38);
  --aurora-3: rgba(242, 176, 52, .30);
  --aurora-4: rgba(40, 106, 176, .26);

  /* glass */
  --glass: rgba(255, 255, 255, .50);
  --glass-strong: rgba(255, 255, 255, .74);
  --glass-quiet: rgba(255, 255, 255, .30);
  --glass-brd: rgba(255, 255, 255, .70);
  --glass-edge: rgba(15, 42, 38, .10);
  --hi: rgba(255, 255, 255, .92);
  --blur: 22px;
  --blur-sm: 12px;

  /* opaque surfaces for dense data */
  --surface: rgba(255, 255, 255, .86);
  --surface-2: rgba(240, 246, 243, .72);
  --solid: #FBFDFC;

  --ink: #0C1D1A;
  --ink-2: #3D4F4B;
  --muted: #687874;
  --line: rgba(15, 42, 38, .14);
  --line-2: rgba(15, 42, 38, .08);

  --accent: #0A6B5C;
  --accent-2: #0FA189;
  --accent-soft: rgba(15, 161, 137, .14);
  --accent-ink: #FFFFFF;
  --accent-grad: linear-gradient(135deg, #0A6B5C 0%, #12A48B 55%, #2AC0A1 100%);
  --accent-glow: 0 6px 20px rgba(10, 107, 92, .30);

  --tag: #F0B23A;
  --tag-ink: #2A1E05;
  --ok: #10794A;  --ok-soft: rgba(16, 121, 74, .13);
  --warn: #9A620A; --warn-soft: rgba(224, 163, 62, .18);
  --crit: #BA2C22; --crit-soft: rgba(186, 44, 34, .12);
  --info: #245FA0; --info-soft: rgba(36, 95, 160, .12);

  --shadow: 0 1px 1px rgba(8, 28, 25, .04), 0 6px 18px rgba(8, 28, 25, .07);
  --shadow-lift: 0 2px 4px rgba(8, 28, 25, .06), 0 14px 34px rgba(8, 28, 25, .12);
  --shadow-lg: 0 24px 70px rgba(6, 24, 21, .28);

  --chart-grid: rgba(15, 42, 38, .10);
  --series-2: #6E58C8;

  --radius: 16px;
  --radius-sm: 10px;
  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --nav-w: 244px;
  color-scheme: light;
}

/* Dark: the same room at night — deeper ground, brighter glass, the accent does the lighting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #070F0E; --ground-2: #0B1817;
    --aurora-1: rgba(18, 190, 158, .34); --aurora-2: rgba(10, 128, 110, .40); --aurora-3: rgba(240, 178, 58, .16); --aurora-4: rgba(60, 130, 210, .22);
    --glass: rgba(20, 38, 35, .56); --glass-strong: rgba(24, 44, 40, .78); --glass-quiet: rgba(20, 38, 35, .34);
    --glass-brd: rgba(255, 255, 255, .12); --glass-edge: rgba(0, 0, 0, .5); --hi: rgba(255, 255, 255, .16);
    --surface: rgba(19, 36, 33, .82); --surface-2: rgba(26, 46, 42, .62); --solid: #0F1F1D;
    --ink: #E6EFEC; --ink-2: #AFC0BB; --muted: #7E8F8A;
    --line: rgba(255, 255, 255, .13); --line-2: rgba(255, 255, 255, .07);
    --accent: #3ECBAC; --accent-2: #6FE3C8; --accent-soft: rgba(62, 203, 172, .16); --accent-ink: #032019;
    --accent-grad: linear-gradient(135deg, #17a98d 0%, #3ECBAC 60%, #6FE3C8 100%);
    --accent-glow: 0 6px 24px rgba(62, 203, 172, .28);
    --tag: #F2B84A; --ok: #4ECB88; --ok-soft: rgba(78, 203, 136, .16); --warn: #E7AB4B; --warn-soft: rgba(231, 171, 75, .16);
    --crit: #FF7264; --crit-soft: rgba(255, 114, 100, .16); --info: #79AFEE; --info-soft: rgba(121, 175, 238, .16);
    --chart-grid: rgba(255, 255, 255, .10); --series-2: #A98BE0;
    --shadow: 0 1px 1px rgba(0, 0, 0, .5), 0 8px 22px rgba(0, 0, 0, .40);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 18px 40px rgba(0, 0, 0, .5);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #070F0E; --ground-2: #0B1817;
  --aurora-1: rgba(18, 190, 158, .34); --aurora-2: rgba(10, 128, 110, .40); --aurora-3: rgba(240, 178, 58, .16); --aurora-4: rgba(60, 130, 210, .22);
  --glass: rgba(20, 38, 35, .56); --glass-strong: rgba(24, 44, 40, .78); --glass-quiet: rgba(20, 38, 35, .34);
  --glass-brd: rgba(255, 255, 255, .12); --glass-edge: rgba(0, 0, 0, .5); --hi: rgba(255, 255, 255, .16);
  --surface: rgba(19, 36, 33, .82); --surface-2: rgba(26, 46, 42, .62); --solid: #0F1F1D;
  --ink: #E6EFEC; --ink-2: #AFC0BB; --muted: #7E8F8A;
  --line: rgba(255, 255, 255, .13); --line-2: rgba(255, 255, 255, .07);
  --accent: #3ECBAC; --accent-2: #6FE3C8; --accent-soft: rgba(62, 203, 172, .16); --accent-ink: #032019;
  --accent-grad: linear-gradient(135deg, #17a98d 0%, #3ECBAC 60%, #6FE3C8 100%);
  --accent-glow: 0 6px 24px rgba(62, 203, 172, .28);
  --tag: #F2B84A; --ok: #4ECB88; --ok-soft: rgba(78, 203, 136, .16); --warn: #E7AB4B; --warn-soft: rgba(231, 171, 75, .16);
  --crit: #FF7264; --crit-soft: rgba(255, 114, 100, .16); --info: #79AFEE; --info-soft: rgba(121, 175, 238, .16);
  --chart-grid: rgba(255, 255, 255, .10); --series-2: #A98BE0;
  --shadow: 0 1px 1px rgba(0, 0, 0, .5), 0 8px 22px rgba(0, 0, 0, .40);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 18px 40px rgba(0, 0, 0, .5);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--ground);
  font: 400 14px/1.55 var(--f-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* The aurora ground: fixed, painted once, drifting slowly behind every pane. */
body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -2; pointer-events: none;
  background:
    radial-gradient(42vmax 38vmax at 12% 8%, var(--aurora-1), transparent 62%),
    radial-gradient(48vmax 40vmax at 88% 0%, var(--aurora-2), transparent 60%),
    radial-gradient(38vmax 34vmax at 78% 82%, var(--aurora-3), transparent 64%),
    radial-gradient(44vmax 40vmax at 8% 92%, var(--aurora-4), transparent 62%),
    linear-gradient(160deg, var(--ground) 0%, var(--ground-2) 100%);
  animation: drift 46s ease-in-out infinite alternate;
}
/* A whisper of grain so large glass areas do not band. */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(15, 42, 38, .05) 1px, transparent 1px);
  background-size: 3px 3px;
}
@keyframes drift {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  to   { transform: translate3d(1.5%, 1.5%, 0) scale(1.06); }
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; text-wrap: balance; letter-spacing: -.015em; }
h1 { font-size: 30px; font-weight: 750; font-stretch: 90%; line-height: 1.12; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12.5px; }
.eyebrow { font: 600 10.5px/1.2 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

/* One glass recipe, used by every pane. */
.glass, .card, .kpis, .nav, .topbar, .modal, .col, .jc, .btn, .select, .input, textarea.input, .seg, .chip, .steps-bar span, .bottom-nav, .sample-note, .dropzone, .quiz-opt {
  backdrop-filter: blur(var(--blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(165%);
}

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

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100%; }
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; overflow-y: auto;
  background: var(--glass); border-right: 1px solid var(--glass-brd);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; z-index: 10;
  box-shadow: inset -1px 0 0 var(--line-2), 6px 0 26px rgba(8, 28, 25, .05);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 0; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--accent-grad); display: grid; place-items: center; flex: none;
  box-shadow: var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .45); position: relative; overflow: hidden;
}
.brand-mark::after { content: ""; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255,255,255,.28), transparent); }
.brand-name { font: 800 20px/1 var(--f-display); font-stretch: 86%; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group .eyebrow { padding: 8px 10px 4px; }
.nav a.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 11px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav a.nav-item:hover { background: var(--glass-quiet); color: var(--ink); transform: translateX(2px); }
.nav a.nav-item[aria-current="page"] {
  background: linear-gradient(90deg, var(--accent-soft), transparent 90%); color: var(--accent); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--glass-brd);
}
.nav a.nav-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent-grad); box-shadow: var(--accent-glow);
}
.nav a.nav-item svg { flex: none; }
.nav a.nav-item .count { margin-left: auto; font: 600 11px var(--f-mono); background: var(--crit-soft); color: var(--crit); border-radius: 20px; padding: 1px 8px; }
.nav-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 10px; display: flex; flex-direction: column; gap: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--glass-quiet); border-bottom: 1px solid var(--glass-brd);
  padding: 12px 26px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.topbar .spacer { flex: 1; }
.page { padding: 26px 26px 100px; display: flex; flex-direction: column; gap: 22px; max-width: 1400px; width: 100%; }
.page-head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 22px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); max-width: 70ch; margin-top: 6px; }
.page-head h1 { position: relative; padding-bottom: 10px; }
.page-head h1::after { content: ""; position: absolute; left: 0; bottom: 0; width: 64px; height: 3px; border-radius: 999px; background: var(--accent-grad); box-shadow: var(--accent-glow); }
.sample-note {
  font-size: 12px; color: var(--ink-2); background: var(--glass-quiet); border: 1px dashed var(--line);
  padding: 7px 12px; border-radius: 999px;
}

/* ---------- Controls ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--glass-brd); background: var(--glass-strong); padding: 9px 15px; border-radius: 11px;
  font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); line-height: 1.2; white-space: nowrap;
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift), inset 0 1px 0 var(--hi); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--accent-grad); color: var(--accent-ink); border-color: transparent;
  box-shadow: var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.primary:hover { box-shadow: 0 10px 28px rgba(10, 107, 92, .38), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn.danger { background: var(--crit); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--glass-quiet); box-shadow: none; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.lg { padding: 13px 20px; font-size: 15px; white-space: normal; text-align: left; border-radius: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.fac-t td:first-child { min-width: 230px; }

.select, .input, textarea.input {
  border: 1px solid var(--line); background: var(--glass-strong); border-radius: 11px; padding: 9px 12px; min-height: 38px; max-width: 100%;
  box-shadow: inset 0 1px 2px rgba(8, 28, 25, .04); transition: border-color .16s ease, box-shadow .16s ease;
}
.select:focus, .input:focus, textarea.input:focus { border-color: var(--accent-2); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.input { width: 100%; resize: vertical; line-height: 1.55; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.seg { display: inline-flex; border: 1px solid var(--glass-brd); border-radius: 12px; overflow: hidden; background: var(--glass-strong); box-shadow: var(--shadow), inset 0 1px 0 var(--hi); }
.seg button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-weight: 500; color: var(--ink-2); transition: background .16s ease, color .16s ease; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent-grad); color: var(--accent-ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px;
  font-size: 12px; background: var(--glass-strong); color: var(--ink-2); white-space: nowrap; cursor: default;
}
button.chip { cursor: pointer; }
.chip.badge { border-color: transparent; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* status pills — state is shape + label, never colour alone */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; backdrop-filter: blur(var(--blur-sm)); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.warn::before { border-radius: 1px; transform: rotate(45deg); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.crit::before { border-radius: 1px; }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--glass-quiet); color: var(--ink-2); border: 1px solid var(--line); }
.pill.neutral::before { background: var(--muted); }

.safety {
  display: inline-flex; align-items: center; gap: 4px; font: 700 10.5px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 7px; border-radius: 6px; border: 1.5px solid var(--crit); color: var(--crit); background: var(--crit-soft);
}

/* ---------- Surfaces ---------- */
.card {
  position: relative; background: var(--glass); border: 1px solid var(--glass-brd); border-radius: var(--radius);
  padding: 18px; min-width: 0; box-shadow: var(--shadow), inset 0 1px 0 var(--hi); overflow: hidden;
}
/* specular edge: the one flourish every pane shares */
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--hi) 22%, var(--hi) 78%, transparent);
}
.card.flush { padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.divider { height: 1px; background: var(--line-2); margin: 4px 0; }

/* KPI strip: one pane, five readings */
.kpis {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--glass);
  border: 1px solid var(--glass-brd); border-radius: var(--radius); box-shadow: var(--shadow), inset 0 1px 0 var(--hi); overflow: hidden;
}
.kpi { position: relative; padding: 16px 18px; border-left: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .v { font: 700 30px/1.04 var(--f-display); font-stretch: 88%; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.kpi:first-child .v { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi .d { font-size: 12px; color: var(--ink-2); }
.kpi .d b { font-weight: 600; }
.kpi .target { font-size: 11.5px; color: var(--muted); }
.delta-up { color: var(--ok); }
.delta-down { color: var(--crit); }

/* Tables — data sits on a near-solid fill so it never fights the glass */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th {
  text-align: left; font: 600 10.5px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--glass-strong);
  position: sticky; top: 0; backdrop-filter: blur(var(--blur-sm));
}
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr.click { cursor: pointer; transition: background .14s ease; }
table.t tr.click:hover td { background: var(--glass-quiet); }
table.t td.r, table.t th.r { text-align: right; }

/* Inline bars */
.bar { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; min-width: 60px; box-shadow: inset 0 1px 2px rgba(8, 28, 25, .08); }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent-grad); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 40%, transparent); }
.bar.ok > i { background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 60%, white)); box-shadow: none; }
.bar.warn > i { background: linear-gradient(90deg, var(--warn), color-mix(in srgb, var(--warn) 60%, white)); box-shadow: none; }
.bar.crit > i { background: linear-gradient(90deg, var(--crit), color-mix(in srgb, var(--crit) 60%, white)); box-shadow: none; }
.hbar { display: grid; grid-template-columns: minmax(90px, 150px) 1fr 52px; align-items: center; gap: 12px; font-size: 13px; }
.hbar + .hbar { margin-top: 9px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar .val { text-align: right; font-family: var(--f-mono); font-size: 12.5px; }

/* ---------- Asset tag: deliberately physical, the one non-glass object ---------- */
.tag {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; background: #FFFDF6; color: #1D1A12;
  border-radius: 12px; padding: 12px 14px 12px 12px; border: 1px solid #E6DAB8; position: relative; box-shadow: var(--shadow-lift); max-width: 380px;
}
.tag::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: linear-gradient(180deg, #F7C963, var(--tag)); border-radius: 12px 0 0 12px; }
.tag .qr { width: 88px; height: 88px; background: #fff; padding: 5px; border-radius: 6px; margin-left: 7px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.tag .qr img, .tag .qr canvas, .tag .qr svg { width: 100% !important; height: 100% !important; image-rendering: pixelated; }
.tag .t-id { font: 600 13px var(--f-mono); letter-spacing: .02em; }
.tag .t-brand { font: 800 11px var(--f-display); letter-spacing: .14em; text-transform: uppercase; color: #6B5A2A; }
.tag .t-line { font-size: 11.5px; color: #4B4533; }
.tag.oos { border-color: var(--crit); }
.tag.oos::after {
  content: "OUT OF SERVICE"; position: absolute; right: -6px; top: 10px; transform: rotate(8deg); background: #C8372D; color: #fff;
  font: 800 10px var(--f-display); letter-spacing: .12em; padding: 4px 9px; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,.3);
}
.tag-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

/* ---------- Device list ---------- */
.dev-row {
  display: grid; grid-template-columns: 16px minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1fr) 118px 92px; gap: 12px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background .14s ease;
}
.dev-row:hover { background: var(--glass-quiet); }
.dev-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-row .sm { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-head { font: 600 10.5px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); cursor: default; }
.dev-head:hover { background: transparent; }
.stripe { width: 4px; height: 32px; border-radius: 999px; background: var(--ok); box-shadow: 0 0 10px color-mix(in srgb, var(--ok) 45%, transparent); }
.stripe.down, .stripe.awaiting_part { background: var(--crit); box-shadow: 0 0 10px color-mix(in srgb, var(--crit) 45%, transparent); }
.stripe.degraded { background: var(--warn); box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 45%, transparent); }
.stripe.condemned { background: var(--muted); box-shadow: none; }
.risk { font: 600 12px var(--f-mono); display: inline-flex; align-items: center; gap: 7px; }
.risk i { display: inline-block; width: 38px; height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; position: relative; }
.risk i b { position: absolute; inset: 0 auto 0 0; background: var(--ok); border-radius: 999px; }
.risk.elevated i b { background: var(--warn); } .risk.high i b { background: var(--crit); }

/* ---------- Drawer / modal ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(6, 20, 18, .34); backdrop-filter: blur(3px); z-index: 50;
  display: flex; justify-content: flex-end; animation: fade .18s ease;
}
.drawer {
  width: min(660px, 100%); height: 100%; overflow-y: auto; display: flex; flex-direction: column; animation: slide .24s cubic-bezier(.22,.8,.3,1);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ground) 82%, transparent), color-mix(in srgb, var(--ground-2) 92%, transparent));
  backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-left: 1px solid var(--glass-brd); box-shadow: var(--shadow-lg);
}
.drawer-head {
  position: sticky; top: 0; z-index: 2; background: var(--glass-strong); border-bottom: 1px solid var(--glass-brd);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 22px 16px; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  backdrop-filter: blur(var(--blur));
}
.drawer-body { padding: 20px 22px 44px; display: flex; flex-direction: column; gap: 18px; }
.modal-scrim { justify-content: center; align-items: center; padding: 16px; }
.modal {
  width: min(580px, 100%); max-height: 90vh; overflow-y: auto; background: var(--glass-strong); border: 1px solid var(--glass-brd);
  border-radius: 20px; box-shadow: var(--shadow-lg), inset 0 1px 0 var(--hi); padding: 22px; display: flex; flex-direction: column; gap: 16px;
  animation: pop .22s cubic-bezier(.22,.8,.3,1);
}
@keyframes fade { from { opacity: 0 } }
@keyframes slide { from { transform: translateX(30px); opacity: .4 } }
@keyframes pop { from { transform: scale(.97) translateY(8px); opacity: 0 } }

.toast-wrap { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--solid); padding: 11px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .22s ease; max-width: 90vw; backdrop-filter: blur(var(--blur-sm));
}

/* ---------- Triage ---------- */
.steps-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.steps-bar span { font-size: 12px; padding: 5px 13px; border-radius: 999px; background: var(--glass-quiet); border: 1px solid var(--line); color: var(--muted); }
.steps-bar span.on { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; box-shadow: var(--accent-glow); font-weight: 600; }
.steps-bar span.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.gate {
  border-radius: var(--radius); padding: 16px 18px; display: grid; grid-template-columns: 30px 1fr; gap: 12px;
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow), inset 0 1px 0 var(--hi); backdrop-filter: blur(var(--blur-sm));
}
.gate.self_help { background: linear-gradient(135deg, var(--ok-soft), var(--glass-quiet)); }
.gate.protect_and_escalate { background: linear-gradient(135deg, var(--warn-soft), var(--glass-quiet)); }
.gate.stop_and_escalate { background: linear-gradient(135deg, var(--crit-soft), var(--glass-quiet)); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.gate .gi { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 16px var(--f-display); color: #fff; }
.gate.self_help .gi { background: var(--ok); box-shadow: 0 4px 14px color-mix(in srgb, var(--ok) 40%, transparent); }
.gate.protect_and_escalate .gi { background: var(--warn); box-shadow: 0 4px 14px color-mix(in srgb, var(--warn) 40%, transparent); }
.gate.stop_and_escalate .gi { background: var(--crit); box-shadow: 0 4px 14px color-mix(in srgb, var(--crit) 45%, transparent); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 4px 22px color-mix(in srgb, var(--crit) 75%, transparent); } }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.check:first-child { border-top: 0; }
.check input { width: 21px; height: 21px; accent-color: var(--accent); margin-top: 2px; }
.check .why { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.check .ty { font: 600 10.5px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.check .ty.patient, .check .ty.isolate { color: var(--crit); }
.check.done .st { text-decoration: line-through; color: var(--muted); }
.ai-src { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.ai-src i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ai-src.live i { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); animation: pulse-dot 2.4s ease-in-out infinite; }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 10%, transparent); } }
.thinking { display: inline-flex; gap: 4px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s } .thinking i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 50% { opacity: .2 } }
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 14px;
  background: var(--glass-quiet); cursor: pointer; transition: border-color .16s ease, background .16s ease;
}
.dropzone:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.dropzone img { width: 66px; height: 66px; object-fit: cover; border-radius: 10px; box-shadow: var(--shadow); }

/* Phone simulators */
.phone {
  width: 100%; max-width: 288px; border-radius: 32px; border: 8px solid #131D1B; background: #0B1412; color: #D9F2E6;
  padding: 18px 15px; font: 13px/1.45 var(--f-mono); min-height: 320px; display: flex; flex-direction: column; gap: 11px; margin-inline: auto;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.08);
}
.phone .scr { background: #16221F; border-radius: 12px; padding: 12px; white-space: pre-wrap; flex: 1; box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.phone input { background: #0B1412; border: 1px solid #35473F; color: #D9F2E6; border-radius: 8px; padding: 7px 9px; width: 100%; font-family: var(--f-mono); }
.phone .ph-row { display: flex; gap: 6px; }
.phone button { background: #2E6B5B; color: #fff; border: 0; border-radius: 8px; padding: 7px 11px; cursor: pointer; font-family: var(--f-mono); }
.wa { background: #E7E1D6; border-color: #131D1B; color: #111; font-family: var(--f-body); }
.wa .bub { background: #fff; border-radius: 10px; padding: 8px 10px; max-width: 88%; font-size: 12.5px; box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.wa .bub.me { background: #D8F7C6; align-self: flex-end; }

/* ---------- Jobs ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(212px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--glass-quiet); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.col-h { display: flex; justify-content: space-between; align-items: center; font: 600 12px var(--f-body); color: var(--ink-2); padding: 2px 4px; }
.jc {
  background: var(--glass-strong); border: 1px solid var(--glass-brd); border-radius: 13px; padding: 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 7px; box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.jc:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--shadow-lift), inset 0 1px 0 var(--hi); }
.jc .id { font: 600 11.5px var(--f-mono); color: var(--muted); }
.jc .ttl { font-weight: 600; font-size: 13px; line-height: 1.3; }
.sla { font: 600 11.5px var(--f-mono); }
.sla.breach { color: var(--crit); } .sla.risk { color: var(--warn); } .sla.fine { color: var(--ok); }
.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 18px 1fr; gap: 12px; position: relative; padding-bottom: 14px; }
.tl::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--glass-strong); margin-top: 3px; position: relative; z-index: 1; }
.tl.done .dot { background: var(--accent-grad); border-color: transparent; box-shadow: var(--accent-glow); }
.tl.now .dot { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl .when { font-size: 12px; color: var(--muted); }
.escrow { display: grid; grid-template-columns: 1fr auto; gap: 7px 18px; font-size: 13px; }
.escrow .tot { font-weight: 700; border-top: 1px solid var(--line); padding-top: 8px; }
.tech-card { display: grid; grid-template-columns: 46px 1fr auto; gap: 13px; align-items: start; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
  font: 700 15px var(--f-display); border: 1px solid var(--glass-brd); box-shadow: inset 0 1px 0 var(--hi);
}
.stars { color: var(--tag); letter-spacing: 1px; font-size: 13px; }
.rank { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.rank:first-child { border-top: 0; }
.rank .pos { font: 700 17px var(--f-display); color: var(--muted); text-align: center; }
.rank.inel { opacity: .5; }

/* Map */
.map svg { width: 100%; height: auto; display: block; border-radius: 12px; }
.map-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Donation gate */
.score-ring { width: 96px; height: 96px; flex: none; filter: drop-shadow(0 4px 12px rgba(8, 28, 25, .12)); }
.verdict { font: 800 12.5px var(--f-display); letter-spacing: .1em; text-transform: uppercase; padding: 5px 12px; border-radius: 8px; color: #fff; }
.verdict.ship { background: linear-gradient(135deg, var(--ok), color-mix(in srgb, var(--ok) 65%, white)); }
.verdict.conditional { background: linear-gradient(135deg, var(--warn), color-mix(in srgb, var(--warn) 65%, white)); }
.verdict.redirect { background: linear-gradient(135deg, var(--crit), color-mix(in srgb, var(--crit) 65%, white)); }
.factor { display: grid; grid-template-columns: 150px 1fr 40px; gap: 12px; align-items: center; font-size: 13px; }
.factor + .factor { margin-top: 12px; }
.factor .why { grid-column: 2 / 4; font-size: 12px; color: var(--muted); margin-top: -7px; }

/* Academy */
.course { display: flex; flex-direction: column; gap: 11px; }
.course .langs { display: flex; gap: 4px; flex-wrap: wrap; }
.course .langs span { font: 600 10.5px var(--f-mono); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--ink-2); }
.lesson-body { background: var(--glass-quiet); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; line-height: 1.65; }
.quiz-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--glass-strong); transition: border-color .16s ease, transform .16s ease; }
.quiz-opt:hover { transform: translateX(2px); border-color: var(--accent-2); }
.quiz-opt + .quiz-opt { margin-top: 9px; }
.quiz-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.quiz-opt.wrong { border-color: var(--crit); background: var(--crit-soft); }
.cert {
  border: 1px solid var(--glass-brd); border-radius: 18px; padding: 24px; text-align: center; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), var(--glass-strong)); box-shadow: var(--shadow-lift), inset 0 1px 0 var(--hi);
}
.cert::after { content: ""; position: absolute; inset: -40% -60% auto auto; width: 70%; height: 180%; transform: rotate(18deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent); }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font: 11px var(--f-body); }
.chart .tip {
  position: absolute; pointer-events: none; background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--solid);
  padding: 7px 11px; border-radius: 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -115%);
  box-shadow: var(--shadow-lg); z-index: 3; backdrop-filter: blur(var(--blur-sm));
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.empty { padding: 30px; text-align: center; color: var(--muted); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.banner {
  display: flex; gap: 13px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); font-size: 13px; color: var(--ink);
  background: linear-gradient(135deg, var(--info-soft), var(--glass-quiet)); border: 1px solid var(--glass-brd); backdrop-filter: blur(var(--blur-sm));
}
.banner.warn { background: linear-gradient(135deg, var(--warn-soft), var(--glass-quiet)); }
.banner.crit { background: linear-gradient(135deg, var(--crit-soft), var(--glass-quiet)); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }

/* mobile bottom nav */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line-2); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  /* phones do less glass work: shallower blur, no drifting ground */
  :root { --blur: 14px; --blur-sm: 8px; }
  body::before { animation: none; }
  body::after { display: none; }
  .shell { grid-template-columns: 1fr; }
  .nav { display: none; }
  .topbar { padding: 10px 16px; flex-wrap: nowrap; }
  .topbar .select { flex: 1; min-width: 0; font-size: 13px; }
  .page { padding: 18px 16px 112px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .dev-row { grid-template-columns: 6px minmax(0, 1fr) auto; }
  .dev-row > :nth-child(3), .dev-row > :nth-child(4), .dev-row > :nth-child(6) { display: none; }
  .dev-head { display: none; }
  .map-wrap { grid-template-columns: 1fr; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--glass-strong); border-top: 1px solid var(--glass-brd); box-shadow: 0 -8px 30px rgba(8, 28, 25, .10);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--ink-2); text-decoration: none; padding: 4px 0; }
  .bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .bottom-nav a.report { color: var(--accent-ink); }
  .bottom-nav a.report span.ic { background: var(--accent-grad); border-radius: 14px; padding: 5px 14px; box-shadow: var(--accent-glow); }
  .factor { grid-template-columns: 110px 1fr 36px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 1px solid var(--line-2) !important; border-top: 1px solid var(--line-2); }
  .kpi:nth-child(odd) { border-left: 0 !important; }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi .v { font-size: 24px; }
  .g4 { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  .kv { grid-template-columns: 110px 1fr; }
  .hbar { grid-template-columns: 90px 1fr 46px; }
}

/* Fallbacks: no backdrop-filter, or the viewer asked for less transparency.
   Glass becomes flat paint; nothing moves, nothing is lost. */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  :root { --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-quiet: #F2F6F4; --surface: #FFFFFF; }
  :root[data-theme="dark"] { --glass: #142623; --glass-strong: #172C28; --glass-quiet: #11201E; --surface: #162A26; }
  body::before { opacity: .55; }
}
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --glass: #142623; --glass-strong: #172C28; --glass-quiet: #11201E; --surface: #162A26; }
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: #FFFFFF; --glass-strong: #FFFFFF; --glass-quiet: #F2F6F4; --surface: #FFFFFF; --blur: 0px; --blur-sm: 0px; }
  :root[data-theme="dark"] { --glass: #142623; --glass-strong: #172C28; --glass-quiet: #11201E; --surface: #162A26; }
  body::before { display: none; }
  body { background: var(--ground); }
}
@media (prefers-reduced-transparency: reduce) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --glass: #142623; --glass-strong: #172C28; --glass-quiet: #11201E; --surface: #162A26; }
}

@media print {
  .nav, .topbar, .bottom-nav, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  body::before, body::after { display: none; }
  .card, .kpis { backdrop-filter: none; background: #fff; box-shadow: none; }
  .tag { box-shadow: none; break-inside: avoid; }
}
