@charset "UTF-8";
/* ============================================================================
   MainteliSense — Design System
   Ministry of Health & Human Services · Republic of the Marshall Islands

   A port of the MoHHS Health Informatics Helpdesk design language.
   No CDN, no Tailwind, no icon font. One stylesheet linked from every
   page, alongside fonts.css.

     <link rel="stylesheet" href="/assets/css/fonts.css">
     <link rel="stylesheet" href="/assets/css/maintelisense.css">

   Contents:
     01  Tokens
     02  Reset and base
     03  App shell (sidebar + sticky header)
     04  Centre shell (login / public request form)
     05  Cards
     06  Buttons
     07  Forms  (.fld, .field-ic, .fsec, .pick-card)
     08  Badges and priority
     09  Tables
     10  Stat tiles
     11  Charts  (.chart-grid)
     12  Modals and toasts
     13  Icons
     14  Utilities
     15  Responsive and motion
   ========================================================================= */


/* ==========================================================================
   01  TOKENS
   ========================================================================== */
:root {
  /* Text ------------------------------------------------------------------ */
  --ink:      #0F1D2E;
  --ink-2:    #55657A;
  --ink-3:    #8695A6;
  --ink-4:    #C2CAD3;

  /* Surfaces -------------------------------------------------------------- */
  --surface:  #F3F5F8;
  --card:     #FFFFFF;
  --sunken:   #F7F9FB;
  --rule:     #E4E8EE;

  /* Brand ----------------------------------------------------------------- */
  --deep:     #003893;
  --deep-2:   #002B72;
  --deep-3:   #EBF1FA;

  /* Priority / acuity — the ONLY tokens allowed to carry colour ----------- */
  --critical:    #C0182B;
  --high:        #C56A00;
  --normal:      #0E7C86;
  --done:        #1B7F4D;
  --critical-bg: #FBEAEC;
  --high-bg:     #FDF1E3;
  --normal-bg:   #E6F3F4;
  --done-bg:     #E6F2EB;

  /* Type ------------------------------------------------------------------ */
  --sans: 'IBM Plex Sans', 'Marshallese Supplement', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', 'Marshallese Supplement', ui-monospace, Menlo, Consolas, monospace;

  /* The only shadow in the system. If you need a second one, the problem
     is structure, not elevation. */
  --shadow: 0 1px 2px rgba(15, 29, 46, .04), 0 4px 12px rgba(15, 29, 46, .05);

  /* Geometry -------------------------------------------------------------- */
  --r-card:  12px;
  --r-ctl:   8px;
  --r-pill:  999px;

  --side-w:  246px;
  --head-h:  60px;
  --gutter:  28px;

  /* Spacing scale --------------------------------------------------------- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 44px;
}


/* ==========================================================================
   02  RESET AT BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }

p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }

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

hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s6) 0; }

code, kbd, pre, .mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

img, svg { vertical-align: middle; }

:focus-visible {
  outline: 2px solid var(--deep);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: var(--deep-3); color: var(--ink); }

.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;
}

.skip-link {
  position: absolute; left: var(--s4); top: -60px; z-index: 200;
  background: var(--card); color: var(--deep);
  padding: var(--s2) var(--s4); border-radius: var(--r-ctl);
  border: 1px solid var(--rule); font-weight: 600;
  transition: top .15s ease;
}
.skip-link:focus { top: var(--s4); }


/* ==========================================================================
   03  APP SHELL
   Sidebar + measured page margin ARE the structure. There is no second,
   narrower column centred inside main.
   ========================================================================== */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* --- Sidebar -------------------------------------------------------------- */
.side {
  grid-column: 1;
  background: var(--card);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--rule);
  min-height: var(--head-h);
}
.side-brand img { height: 30px; width: auto; flex: none; }
.side-brand b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.side-brand span { display: block; font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; }

.side-nav { padding: var(--s4) var(--s3) var(--s6); flex: 1; }

.nav-group + .nav-group { margin-top: var(--s5); }

.nav-group > h4 {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 var(--s3);
  margin-bottom: var(--s2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 7px var(--s3);
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
}
.nav-link:hover { background: var(--sunken); color: var(--ink); text-decoration: none; }
.nav-link .ic { color: var(--ink-3); flex: none; }

.nav-link[aria-current="page"] {
  background: var(--deep-3);
  color: var(--deep);
  font-weight: 600;
}
.nav-link[aria-current="page"] .ic { color: var(--deep); }

/* Counts, not colour, carry urgency in the nav. */
.nav-link .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.nav-link .count[data-critical] { color: var(--critical); font-weight: 600; }

.side-foot {
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--rule);
  font-size: 11px;
  color: var(--ink-3);
}

/* --- Main column ---------------------------------------------------------- */
.main { grid-column: 2; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--head-h);
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--gutter);
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--shadow);
}

.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 1px; }
.crumb a { color: var(--ink-3); }
.crumb a:hover { color: var(--deep); }
.topbar h1 { font-size: 17px; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }

.who {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 13px; color: var(--ink-2);
  padding-left: var(--s3); margin-left: var(--s1);
  border-left: 1px solid var(--rule);
}
.who .ic { color: var(--ink-3); }

.page { padding: var(--s6) var(--gutter) var(--s8); flex: 1; }

.page-intro { margin-bottom: var(--s5); max-width: 68ch; color: var(--ink-2); }

.section-head {
  display: flex; align-items: baseline; gap: var(--s3);
  margin: var(--s7) 0 var(--s4);
}
.section-head:first-child { margin-top: 0; }
.section-head h2 { margin-right: auto; }

/* Sidebar toggle — hidden on desktop, appears only on mobile. */
.side-toggle { display: none; }


/* ==========================================================================
   04  CENTRE SHELL — login, register, public request form
   A single card, centred, with the letterhead above it.
   ========================================================================== */
.centre {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s7) var(--s4);
  gap: var(--s6);
}

.letterhead { text-align: center; max-width: 46ch; }
.letterhead img { height: 62px; width: auto; margin-bottom: var(--s3); }
.letterhead .eyebrow {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 2px;
}
.letterhead h1 { font-size: 18px; margin-bottom: 2px; }
.letterhead .sub { font-size: 13px; color: var(--ink-2); }

.centre-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--s6);
}
.centre-card.wide { max-width: 760px; }

.centre-foot {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  max-width: 52ch;
}


/* ==========================================================================
   05  CARDS
   ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
/* There is deliberately no `.card + .card { margin-top }` here. Inside
   .chart-grid or .stat-grid that adjacent-sibling rule pushes the second
   card down and breaks the alignment grid was chosen for. For stacked
   cards, put .stack on the parent. */

.card-hd {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--rule);
}
.card-hd h2, .card-hd h3 { margin-right: auto; }
.card-hd .hint { font-size: 12px; color: var(--ink-3); }

.card-bd { padding: var(--s5); }
.card-bd.flush { padding: 0; }

.card-ft {
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--rule);
  background: var(--sunken);
  border-radius: 0 0 var(--r-card) var(--r-card);
  display: flex; align-items: center; gap: var(--s2);
}


/* ==========================================================================
   06  BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2);
  padding: 8px var(--s4);
  min-height: 36px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  border-radius: var(--r-ctl);
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

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

.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--sunken); color: var(--ink); }

/* Red on a button means destructive — not "important", but
   "cannot be undone". */
.btn-danger { border-color: var(--critical); color: var(--critical); background: var(--card); }
.btn-danger:hover { background: var(--critical-bg); }

.btn-sm { min-height: 30px; padding: 4px var(--s3); font-size: 12.5px; }
.btn-block { width: 100%; }

.btn .ic { flex: none; }
.btn-primary .ic { color: currentColor; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); }


/* ==========================================================================
   07  FORMS
   ========================================================================== */
.fld { margin-bottom: var(--s4); }
.fld:last-child { margin-bottom: 0; }

.fld > label,
.lbl {
  display: block;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 5px;
}
.lbl .req { color: var(--critical); font-weight: 400; }

.inp, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
input[type="tel"], input[type="search"], input[type="url"],
select, textarea {
  width: 100%;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  padding: 8px var(--s3);
  min-height: 38px;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  transition: border-color .12s ease, background-color .12s ease;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

.inp:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  background: var(--card);
  border-color: var(--deep);
  box-shadow: 0 0 0 3px var(--deep-3);
}
.inp::placeholder, input::placeholder, textarea::placeholder { color: var(--ink-4); }

.inp:disabled, input:disabled, select:disabled, textarea:disabled {
  color: var(--ink-3); cursor: not-allowed;
}

select {
  appearance: none;
  padding-right: var(--s7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238695A6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s3) center;
}

.hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.err-msg { font-size: 12px; color: var(--critical); margin-top: 4px; font-weight: 500; }
.fld[data-invalid] .inp,
.fld[data-invalid] input,
.fld[data-invalid] select,
.fld[data-invalid] textarea { border-color: var(--critical); }

/* --- .field-ic — icon inside the field ----------------------------------- */
.field-ic { position: relative; }
.field-ic > .ic {
  position: absolute;
  left: var(--s3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.field-ic > .inp,
.field-ic > input,
.field-ic > select { padding-left: var(--s8); }
.field-ic:focus-within > .ic { color: var(--deep); }

/* --- .fsec — section header for multi-step forms ------------------------- */
.fsec {
  display: flex; align-items: center; gap: var(--s3);
  margin: var(--s6) 0 var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
}
.fsec:first-child { margin-top: 0; }

.fsec-badge {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r-ctl);
  background: linear-gradient(160deg, var(--deep) 0%, var(--deep-2) 100%);
  color: #fff;
}
.fsec-badge.round { border-radius: 50%; }
.fsec-badge .ic { color: #fff; }

.fsec h3 { font-size: 14px; }
.fsec .hint { margin-top: 1px; }
.fsec-step {
  margin-left: auto;
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
}

/* --- .pick-card — a radio/checkbox that looks like a card ---------------- */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s3);
}

.pick-card {
  position: relative;
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-ctl);
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}
.pick-card:hover { border-color: var(--ink-4); }

.pick-card input[type="radio"],
.pick-card input[type="checkbox"] {
  position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; padding: 0;
}

.pick-card .dot {
  flex: none; margin-top: 2px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--ink-4);
  border-radius: 50%;
  background: var(--card);
  transition: border-color .12s ease, border-width .12s ease;
}
.pick-card input[type="checkbox"] ~ .dot { border-radius: 4px; }

.pick-card b { display: block; font-size: 13.5px; font-weight: 600; }
.pick-card small { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }

.pick-card:has(input:checked) { border-color: var(--deep); background: var(--deep-3); }
.pick-card:has(input:checked) .dot { border-color: var(--deep); border-width: 5px; }
.pick-card:has(input:focus-visible) { outline: 2px solid var(--deep); outline-offset: 2px; }

/* Priority picker — the only place colour is legal inside a form. */
.pick-card[data-level="critical"]:has(input:checked) { border-color: var(--critical); background: var(--critical-bg); }
.pick-card[data-level="critical"]:has(input:checked) .dot { border-color: var(--critical); }
.pick-card[data-level="high"]:has(input:checked) { border-color: var(--high); background: var(--high-bg); }
.pick-card[data-level="high"]:has(input:checked) .dot { border-color: var(--high); }
.pick-card[data-level="normal"]:has(input:checked) { border-color: var(--normal); background: var(--normal-bg); }
.pick-card[data-level="normal"]:has(input:checked) .dot { border-color: var(--normal); }

/* Fallback for browsers without :has() */
@supports not selector(:has(*)) {
  .pick-card input[type="radio"],
  .pick-card input[type="checkbox"] {
    position: static; opacity: 1; width: 16px; height: 16px; margin-top: 3px;
  }
  .pick-card .dot { display: none; }
}

/* --- Field grid ---------------------------------------------------------- */
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--s4); }
.fgrid .span-2 { grid-column: 1 / -1; }

/* --- Filter bar ----------------------------------------------------------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--rule);
}
.filters .fld { margin-bottom: 0; min-width: 170px; }
.filters .grow { flex: 1; min-width: 220px; }
.filters .btn-row { margin-left: auto; }


/* ==========================================================================
   08  BADGES AT PRIORITY
   ========================================================================== */
.badge-soft {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px var(--s2);
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
  background: var(--sunken);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}
.badge-soft.warn { background: var(--high-bg);     color: var(--high);     border-color: transparent; }
.badge-soft.good { background: var(--done-bg);     color: var(--done);     border-color: transparent; }
.badge-soft.info { background: var(--deep-3);      color: var(--deep);     border-color: transparent; }

/* Priority pills — four only, and the only colour on a page. */
.pri {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px var(--s2);
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
.pri::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pri-critical { background: var(--critical-bg); color: var(--critical); }
.pri-high     { background: var(--high-bg);     color: var(--high); }
.pri-normal   { background: var(--normal-bg);   color: var(--normal); }
.pri-done     { background: var(--done-bg);     color: var(--done); }

/* Neutral status — for non-urgency states like Draft or Closed. */
.pri-idle { background: var(--sunken); color: var(--ink-2); }


/* ==========================================================================
   09  TABLES
   ========================================================================== */
.tbl-wrap { overflow-x: auto; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }

.tbl th {
  text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3);
  padding: var(--s3) var(--s4);
  background: var(--sunken);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}

.tbl td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--sunken); }

.tbl .num, .tbl .id { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.tbl .id { color: var(--ink-2); }
.tbl .nowrap { white-space: nowrap; }
.tbl .right { text-align: right; }
.tbl .actions { white-space: nowrap; text-align: right; }

.tbl caption { text-align: left; padding: 0 var(--s4) var(--s3); color: var(--ink-3); font-size: 12px; }

.empty {
  padding: var(--s8) var(--s5);
  text-align: center;
  color: var(--ink-3);
}
.empty .ic { color: var(--ink-4); margin-bottom: var(--s3); }
.empty h3 { color: var(--ink-2); margin-bottom: var(--s1); }
.empty p { font-size: 13px; margin-bottom: var(--s4); }


/* ==========================================================================
   10  STAT TILES
   Numbers do the work, not colour. One accent per row at most.
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s5);
}

.stat {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: var(--s4) var(--s5);
}
.stat .k {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s2);
}
.stat .k .ic { color: var(--ink-4); }
.stat .v { font-family: var(--mono); font-size: 26px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .m { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

.stat[data-level="critical"] .v { color: var(--critical); }
.stat[data-level="high"]     .v { color: var(--high); }
.stat[data-level="done"]     .v { color: var(--done); }


/* ==========================================================================
   11  CHARTS
   CSS Grid, not flexbox — so heights are guaranteed to match.
   ========================================================================== */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--s4);
}
.chart-grid .span-2 { grid-column: span 2; }

.chart-card { display: flex; flex-direction: column; }
.chart-card .card-bd { flex: 1; padding: var(--s4); }

/* Fixed pixel height — never derived from how much data there is. */
.chart-box { height: 300px; }
.chart-box.tall { height: 380px; }
.chart-box.short { height: 220px; }


/* ==========================================================================
   12  MODALS AT TOASTS
   Our own confirm dialog — never window.confirm().
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 29, 46, .42);
  display: none;
  align-items: center; justify-content: center;
  padding: var(--s5);
}
.modal-backdrop[data-show] { display: flex; }

.modal {
  width: 100%; max-width: 460px;
  max-height: calc(100vh - 2 * var(--s5));
  display: flex; flex-direction: column;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.modal.wide { max-width: 720px; }

.modal-hd {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--rule);
}
.modal-hd h2 { margin-right: auto; font-size: 16px; }

.modal-bd { padding: var(--s5); overflow-y: auto; }

.modal-ft {
  display: flex; justify-content: flex-end; gap: var(--s2);
  padding: var(--s4) var(--s5);
  border-top: 1px solid var(--rule);
  background: var(--sunken);
  border-radius: 0 0 var(--r-card) var(--r-card);
}

.x-btn {
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--ink-3);
  cursor: pointer;
}
.x-btn:hover { background: var(--sunken); color: var(--ink); }

/* --- Toast ---------------------------------------------------------------- */
.toast-stack {
  position: fixed; top: var(--s4); right: var(--s4); z-index: 120;
  display: flex; flex-direction: column; gap: var(--s2);
  pointer-events: none;
}

.toast {
  display: flex; align-items: flex-start; gap: var(--s3);
  min-width: 260px; max-width: 380px;
  padding: var(--s3) var(--s4);
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r-ctl);
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast .ic { flex: none; margin-top: 1px; color: var(--ink-3); }
.toast[data-kind="good"] { border-left-color: var(--done); }
.toast[data-kind="good"] .ic { color: var(--done); }
.toast[data-kind="bad"] { border-left-color: var(--critical); }
.toast[data-kind="bad"] .ic { color: var(--critical); }
.toast[data-closing] { animation: toast-out .18s ease-in forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(-6px); } }


/* ==========================================================================
   13  ICONS
   One sprite sheet, referenced with <use>. No icon font, no external
   library, no network call per icon.

     <svg class="ic" aria-hidden="true"><use href="/assets/icons.svg#wrench"></use></svg>
   ========================================================================== */
.ic {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ic-sm { width: 14px; height: 14px; }
.ic-lg { width: 20px; height: 20px; }
.ic-xl { width: 28px; height: 28px; stroke-width: 1.5; }


/* ==========================================================================
   14  UTILITIES — short, and bounded in purpose
   ========================================================================== */
.stack   { display: flex; flex-direction: column; gap: var(--s4); }
.row     { display: flex; align-items: center; gap: var(--s3); }
.row-tight { display: flex; align-items: center; gap: var(--s2); }
.wrap    { flex-wrap: wrap; }
.push    { margin-left: auto; }
.grow    { flex: 1; min-width: 0; }

.t-2     { color: var(--ink-2); }
.t-3     { color: var(--ink-3); }
.t-sm    { font-size: 12.5px; }
.t-xs    { font-size: 11.5px; }
.t-mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.t-right { text-align: right; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

[hidden] { display: none !important; }


/* ==========================================================================
   15  RESPONSIVE AT MOTION
   ========================================================================== */
@media (max-width: 1080px) {
  :root { --gutter: 20px; --side-w: 220px; }
  .chart-grid .span-2 { grid-column: auto; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .side[data-open] { transform: none; }

  .main { grid-column: 1; }

  .side-toggle {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border: 1px solid var(--rule); border-radius: var(--r-ctl);
    background: var(--card); color: var(--ink-2);
    cursor: pointer;
  }

  .side-scrim {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(15, 29, 46, .35);
    display: none;
  }
  .side-scrim[data-show] { display: block; }

  .topbar h1 { font-size: 15.5px; }
  .who span { display: none; }
  .toast-stack { left: var(--s4); right: var(--s4); }
  .toast { max-width: none; }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .page { padding-top: var(--s5); }
  .filters .btn-row { margin-left: 0; width: 100%; }
  .card-ft, .modal-ft { flex-wrap: wrap; }
}

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

@media print {
  .side, .topbar-actions, .side-toggle, .filters, .toast-stack, .btn { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .page { padding: 0; }
}
