/* Patrol Ready — Agency Readiness OS
   Design system: Patrol Brief light register (leadership-facing B2B).
   Tokens aligned to the Patrol Brief website handoff; dashboard patterns
   follow F-pattern hierarchy, KPI-first summary, scannable tables,
   skeleton loading, honest contextual indicators, and WCAG AA contrast. */

:root {
  /* Brand — Patrol Brief */
  --navy: #122345;
  --navy-deep: #0d1a31;
  --navy-2: #16294f;
  --navy-3: #1c355f;
  --gold: #fee780;
  --gold-deep: #c9a227;
  --sky: #17ade8;
  --link: #0f7fae;
  --link-body: #0f6f98;

  /* Surfaces */
  --bg: #f4f7fc;
  --panel: #ffffff;
  --surface: #f6f9fd;
  --surface-2: #eef3fa;
  --ink: #1b2430;
  --ink-2: #2c3949;
  --muted: #5d6878;
  --faint: #8b95a4;
  --line: #e2e8f1;
  --line-strong: #d3dced;

  /* Semantic */
  --good: #1f9d55;
  --good-ink: #146c3b;
  --good-fill: rgba(31, 157, 85, .12);
  --warn: #b7791f;
  --warn-ink: #8a5a12;
  --warn-fill: rgba(183, 121, 31, .13);
  --bad: #c0392b;
  --bad-ink: #99271b;
  --bad-fill: rgba(192, 57, 43, .1);
  --info-fill: rgba(15, 127, 174, .1);

  /* Module signature accents */
  --m-dashboard: #0f7fae;
  --m-field: #3b7af5;
  --m-reviews: #b02a37;
  --m-policies: #22a855;
  --m-policymod: #099268;
  --m-documents: #0e9aa7;
  --m-standards: #c9a227;
  --m-training: #7c3aed;
  --m-readiness: #e8590c;
  --m-identity: #4f5bd5;
  --m-cmdintel: #b8860b;
  --m-copilot: #6741d9;
  --m-invest: #364fc7;
  --m-clery: #2b8a3e;
  --m-assistant: #0ca678;

  /* Scale */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --shadow-sm: 0 1px 2px rgba(18, 35, 69, .06);
  --shadow-md: 0 4px 16px rgba(18, 35, 69, .07), 0 1px 2px rgba(18, 35, 69, .05);
  --shadow-lg: 0 18px 48px rgba(18, 35, 69, .14);
  --ring: 0 0 0 3px rgba(15, 127, 174, .28);
  --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link-body); }
svg { flex: none; }
.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; }
.icon-sm { width: 15px; height: 15px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.boot { padding: 40px; color: var(--muted); }

/* ---------- Boot loading screen ---------- */
#bootScreen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1100px 640px at 50% 40%, var(--navy-2), var(--navy-deep));
  perspective: 900px;
  transition: opacity .55s ease;
}
#bootScreen.done { opacity: 0; pointer-events: none; }
.boot-stage { display: flex; flex-direction: column; align-items: center; gap: 30px; }
.boot-flipper {
  position: relative; width: 220px; height: 220px;
  transform-style: preserve-3d;
  animation: bootSway 3.4s ease-in-out infinite;
  transition: transform .9s cubic-bezier(.45, -.05, .3, 1.15);
}
@keyframes bootSway {
  0%, 100% { transform: rotateY(-16deg) rotateX(5deg); }
  50%      { transform: rotateY(16deg) rotateX(-4deg); }
}
.boot-flipper.flipped { animation: none; transform: rotateY(180deg); }
.boot-flipper.expanded { transform: rotateY(180deg) scale(2.4); transition: transform .65s ease-in; }
.boot-face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.boot-front .boot-shield {
  width: 118px;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, .5));
}
.boot-ring { position: absolute; inset: 0; animation: bootSpin 1.15s linear infinite; }
@keyframes bootSpin { to { transform: rotate(360deg); } }
.boot-back { transform: rotateY(180deg); }
/* Same lockup as pb-logo.jpg (1028x586 @ .307): jpg's shield, wordmark re-set as READY */
.boot-logo-card {
  position: relative; height: 180px; flex: none;
  display: flex; align-items: center;
  background: #132345; border-radius: 14px; overflow: hidden;
  box-shadow: 0 22px 54px rgba(0, 0, 0, .55);
}
.boot-logo-shield { position: absolute; left: 0; top: 0; height: 100%; }
.boot-logo-word {
  position: relative; margin: 0 24px 0 101px;
  color: #fff; font-weight: 800; font-size: 34px; line-height: 1.18;
  letter-spacing: .04em;
}
.boot-caption {
  color: var(--gold); font-size: 12px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; opacity: .85;
  transition: opacity .3s ease;
}
#bootScreen.flipping .boot-caption { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .boot-flipper, .boot-ring { animation: none; }
  .boot-flipper.flipped, .boot-flipper.expanded { transition: none; }
}
.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; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

/* ---------- Sidebar ---------- */
.side {
  background: linear-gradient(185deg, var(--navy-2) 0%, var(--navy) 46%, var(--navy-deep) 100%);
  color: #fff;
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  border-right: 1px solid rgba(0, 0, 0, .2);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 2px; }
.brand-logo { height: 40px; width: auto; max-width: 118px; display: block; border-radius: 7px; }
.brand strong { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.brand span { display: block; color: #a9bdd8; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; margin-top: 3px; }
.mark { display: grid; place-items: center; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 999px; }
.nav-group { color: #7f93b3; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; padding: 14px 10px 5px; }
.nav-group:first-child { padding-top: 2px; }
.nav button {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 10px;
  background: transparent;
  color: #dbe6f5;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.nav button .n-tile {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--tile, #46608a) 88%, #fff) 0%, var(--tile, rgba(255, 255, 255, .1)) 45%, color-mix(in srgb, var(--tile, #46608a) 72%, #0d1a31) 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 0 0 1px rgba(255, 255, 255, .08), 0 1px 3px rgba(0, 0, 0, .28);
}
.nav button .n-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav button:hover:not(:disabled) { background: rgba(255, 255, 255, .09); color: #fff; }
.nav button.active { background: rgba(255, 255, 255, .13); color: #fff; }
.nav button.active::before {
  content: ""; position: absolute; left: -6px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--gold);
}
.nav button:disabled { opacity: .48; cursor: not-allowed; }
.nav .lock { color: #92a4c2; }
.nav .lock .icon { width: 13px; height: 13px; }

.side-foot { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: var(--sp-3); display: grid; gap: 8px; }
.env-chip {
  display: inline-flex; align-items: center; gap: 7px; align-self: start;
  background: rgba(254, 231, 128, .14); color: var(--gold);
  border: 1px solid rgba(254, 231, 128, .3);
  border-radius: var(--r-pill); padding: 4px 10px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
}
.side-foot .tenant { color: #a9bdd8; font-size: 12px; padding: 0 4px; }
.side-foot .tenant b { color: #fff; font-weight: 700; }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 12;
  display: flex; gap: var(--sp-4); justify-content: space-between; align-items: center;
  padding: 16px 28px;
  background: rgba(244, 247, 252, .82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { color: var(--navy); font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 0; }
.topbar .sub { color: var(--muted); margin: 3px 0 0; font-size: 13.5px; max-width: 64ch; }
.top-right { display: flex; align-items: center; gap: var(--sp-4); }
.freshness { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; font-weight: 600; white-space: nowrap; }
.freshness .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-fill); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--navy-3), var(--navy)); box-shadow: var(--shadow-sm);
}
.user-meta { line-height: 1.25; text-align: right; }
.user-meta b { display: block; color: var(--ink); font-size: 13px; font-weight: 700; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { display: block; color: var(--faint); font-size: 11px; }

.content { padding: 24px 28px 40px; width: 100%; max-width: 1220px; }
.stack { display: grid; gap: var(--sp-4); }
.section-gap { margin-top: var(--sp-4); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.stat {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 16px 15px; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent, var(--link)); }
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat .s-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat .s-label { color: var(--muted); font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.stat .s-ico {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  color: var(--accent, var(--link));
  background: color-mix(in srgb, var(--accent, var(--link)) 13%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, var(--link)) 22%, #fff);
}
.stat .s-ico .icon { width: 17px; height: 17px; }
.stat .s-value { color: var(--navy); font-size: 32px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; margin-top: 12px; overflow-wrap: anywhere; }
.stat .s-sub { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; margin-top: 7px; }
.s-status { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 12px; padding: 1px 0; }
.s-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.s-status.good { color: var(--good-ink); } .s-status.good .dot { background: var(--good); }
.s-status.warn { color: var(--warn-ink); } .s-status.warn .dot { background: var(--warn); }
.s-status.bad { color: var(--bad-ink); } .s-status.bad .dot { background: var(--bad); }

/* ---------- Tachometer gauges (dashboard KPIs) ---------- */
.gauge-card { display: flex; flex-direction: column; }
.g-wrap { position: relative; margin: 6px auto 0; width: min(100%, 190px); }
.g-svg { display: block; width: 100%; height: auto; }
.g-zone { fill: none; stroke-linecap: butt; }
.g-track { fill: none; stroke: var(--surface-2); }
.g-prog { fill: none; stroke-linecap: round; }
.g-tick { stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }
.g-tick.major { stroke: var(--faint); }
@keyframes gsweep { from { transform: rotate(0deg); } }
.g-needle {
  transform-origin: 100px 104px;
  transform: rotate(var(--sweep, 0deg));
  animation: gsweep 1s cubic-bezier(.25, .9, .3, 1.05);
}
.g-value {
  margin-top: 2px; text-align: center;
  color: var(--navy); font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.gauge-card .s-sub { justify-content: center; margin-top: 9px; }

/* ---------- Upload drop zone + file chips ---------- */
.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); padding: 18px 16px; text-align: center;
  color: var(--muted); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.drop:hover, .drop.over { border-color: var(--link); background: var(--info-fill); }
.drop .d-ico {
  width: 38px; height: 38px; border-radius: 10px; margin: 0 auto 8px;
  display: grid; place-items: center; color: var(--link);
  background: color-mix(in srgb, var(--link) 12%, #fff);
}
.drop b { display: block; color: var(--ink); font-size: 13.5px; font-weight: 700; }
.drop p { margin: 3px 0 0; font-size: 12px; }
.drop input[type="file"] { display: none; }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 5px 7px 5px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.file-chip .fc-name { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .fc-size { color: var(--faint); font-weight: 500; }
.file-chip button {
  border: 0; background: transparent; color: var(--faint); display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; padding: 0;
}
.file-chip button:hover { background: var(--bad-fill); color: var(--bad-ink); }
.file-chip .icon { width: 13px; height: 13px; }

/* ---------- Panels / cards ---------- */
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--sp-4); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.panel.pad { padding: 18px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; color: var(--navy); font-size: 15px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel-head .ph-ico { color: var(--accent, var(--link)); display: grid; place-items: center; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.panel-body { padding: 18px; }
.panel-body.flush { padding: 0; }
.panel .stack { padding: 18px; }
h3.sub-h { margin: 0 0 10px; color: var(--navy); font-size: 13.5px; font-weight: 800; }

.source { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px 14px; background: var(--surface); }
.source b { color: var(--navy); font-size: 14px; }
.source .cite { color: var(--link-body); font-size: 12px; font-weight: 700; }
.source p { margin: 8px 0 0; color: var(--ink-2); font-size: 13.5px; }

.mini-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; background: var(--surface); }
.mini b { display: block; color: var(--navy); font-size: 17px; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.mini span { display: block; color: var(--muted); font-size: 10.5px; font-weight: 800; margin-top: 5px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Module cards (dashboard) ---------- */
.mod-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mod-card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.mod-card:not(:disabled):hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.mod-card:disabled { opacity: .62; cursor: not-allowed; }
.mod-card .m-tile {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent, var(--link)) 82%, #fff) 0%, var(--accent, var(--link)) 46%, color-mix(in srgb, var(--accent, var(--link)) 76%, #0d1a31) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), 0 2px 5px color-mix(in srgb, var(--accent, var(--link)) 32%, transparent);
}
.mod-card .m-tile .icon { width: 18px; height: 18px; }
.mod-card .m-body { min-width: 0; flex: 1; }
.mod-card .m-body b { display: block; color: var(--navy); font-size: 14px; font-weight: 700; }
.mod-card .m-body p { margin: 3px 0 9px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.mod-card .m-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; padding: 10px 14px; background: var(--surface-2);
  color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
}
tbody td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: 0; }
td b, td strong { color: var(--navy); font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
tr.click { cursor: pointer; transition: background .12s ease; }
tr.click:hover td { background: var(--surface); }
.cell-sub { display: block; color: var(--faint); font-size: 12px; font-weight: 500; margin-top: 2px; }

/* progress bar inside cells */
.bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--good); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }
.bar-wrap { display: flex; align-items: center; gap: 10px; }
.bar-wrap .pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); min-width: 40px; text-align: right; font-size: 13px; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-pill); padding: 3px 10px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--good-ink); background: var(--good-fill); }
.pill.warn { color: var(--warn-ink); background: var(--warn-fill); }
.pill.bad { color: var(--bad-ink); background: var(--bad-fill); }
.pill.info { color: var(--link); background: var(--info-fill); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--navy); background: var(--navy); color: #fff;
  border-radius: var(--r-sm); padding: 9px 14px; font-weight: 700; font-size: 14px;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:hover:not(:disabled) { background: var(--navy-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.gold { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn.gold:hover:not(:disabled) { background: #ffdf5c; border-color: #ffdf5c; }
.btn.ghost { background: transparent; color: var(--navy); border-color: var(--line-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--surface); border-color: var(--muted); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-back { color: var(--muted); background: transparent; border-color: transparent; padding-left: 4px; }
.btn-back:hover:not(:disabled) { color: var(--navy); background: var(--surface); }

/* ---------- Forms ---------- */
label { display: block; color: var(--navy); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 10px 12px; background: #fff; color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--link); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.field-2 { grid-column: span 2; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1 1 220px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .grow { flex: 1 1 260px; }

.diff {
  margin: 0; max-height: 320px; overflow: auto; white-space: pre-wrap;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #0d1a31; color: #cfe0f5;
  padding: 14px; font-size: 12.5px; font-family: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace; line-height: 1.55;
}
.notice { border: 1px solid #cfe3ef; background: var(--info-fill); color: #285567; border-radius: var(--r-sm); padding: 11px 13px; font-size: 13px; }
.notice b { color: var(--link-body); }
.error { color: var(--bad-ink); font-weight: 600; font-size: 13.5px; }
.muted { color: var(--muted); }

/* Inline spinner for in-flight buttons / actions */
@keyframes spin { to { transform: rotate(360deg); } }
.spin {
  display: inline-block; width: 13px; height: 13px; flex: none;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .6s linear infinite; vertical-align: -2px;
}

/* ---------- Empty & skeleton ---------- */
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty .e-ico { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); }
.empty .e-ico .icon { width: 22px; height: 22px; }
.empty b { display: block; color: var(--ink); font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.empty p { margin: 0 auto; font-size: 13px; max-width: 42ch; }
td .empty { padding: 26px 12px; }

@keyframes shimmer { 100% { background-position: -200% 0; } }
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, #e6edf6 37%, var(--surface-2) 63%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.sk-stat { height: 118px; border-radius: var(--r-md); }
.sk-line { height: 13px; margin: 9px 0; }
.sk-row { height: 44px; margin: 0; border-radius: 0; border-bottom: 1px solid var(--line); background-size: 200% 100%; }
.sk-block { height: 240px; border-radius: var(--r-md); }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand {
  background: linear-gradient(180deg, var(--navy-2), var(--navy) 55%, var(--navy-deep));
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-brand .a-top { display: flex; align-items: center; gap: 12px; }
.auth-brand h2 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 12px; max-width: 15ch; }
.auth-brand p { color: #c3d3e8; font-size: 15px; max-width: 40ch; margin: 0; }
.auth-feats { display: grid; gap: 12px; margin-top: 26px; }
.auth-feat { display: flex; gap: 11px; align-items: center; color: #dbe6f5; font-size: 14px; font-weight: 600; }
.auth-feat .af-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: var(--gold); }
.auth-foot { color: #8ea3c2; font-size: 12px; }
.auth-panel { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login { width: 100%; max-width: 400px; }
.login h1 { color: var(--navy); font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 5px; }
.login > p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login .stack { gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 40; }
.toast-msg { display: flex; align-items: center; gap: 9px; background: var(--navy); color: #fff; border-radius: var(--r-sm); padding: 11px 14px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: toast-in .22s ease; max-width: 340px; }
.toast-msg .icon { color: var(--gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .grid-2, .grid-3, .mod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .side {
    position: sticky; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 8px; padding: 12px 16px;
  }
  .brand { flex: 1; padding: 0; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; margin: 0; padding: 4px 0; gap: 6px; }
  .nav-group, .side-foot { display: none; }
  .nav button { width: auto; }
  .nav button .n-label { max-width: none; }
  .nav button.active::before { left: 6px; right: 6px; top: auto; bottom: -3px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 14px 16px; }
}
@media (max-width: 560px) {
  .kpi-grid, .grid-2, .grid-3, .mod-grid, .mini-grid, .form-grid { grid-template-columns: 1fr; }
  .field-2 { grid-column: auto; }
  .user-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* AI Intelligence Platform surfaces (v2 plan) — two-column detail layout */
.intel-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); align-items: start; }
@media (max-width: 980px) { .intel-cols { grid-template-columns: 1fr; } }
.intel-cols > div > .panel + .section-gap { margin-top: var(--sp-4); }
details.source summary::-webkit-details-marker { display: none; }
details.source summary { list-style: none; }
details.source[open] summary { margin-bottom: 8px; }

/* ── Policy Assistant: formatted answers + citation cards ────────────────── */
.answer-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.answer-prose { color: var(--ink); font-size: 14.5px; line-height: 1.6; }
.answer-prose p { margin: 0 0 10px; }
.answer-prose h2.md-h, .answer-prose h3.md-h, .answer-prose h4.md-h { color: var(--navy); margin: 14px 0 6px; font-weight: 800; }
.answer-prose h2.md-h { font-size: 16px; } .answer-prose h3.md-h { font-size: 14.5px; }
.answer-prose ol.md-list, .answer-prose ul.md-list { margin: 4px 0 12px; padding-left: 22px; }
.answer-prose ol.md-list > li, .answer-prose ul.md-list > li { margin: 5px 0; padding-left: 3px; }
.answer-prose code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.md-quote { border-left: 3px solid var(--gold-deep); background: var(--surface); margin: 8px 0; padding: 8px 12px; color: var(--ink-2); border-radius: 0 6px 6px 0; font-size: 13.5px; }
.cite-list { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.cite-list-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.cite-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.cite-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.cite-head b { color: var(--navy); font-size: 14px; }
.cite-idx { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--m-assistant, #0ca678); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.cite-foot { display: flex; gap: 16px; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--faint); }
.cite-open { font-weight: 700; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

/* ── Policy Modernization: stat chips, controls, finding cards ───────────── */
.stat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.stat-chip { background: var(--surface-2); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.stat-chip b { color: var(--ink); font-weight: 800; }
.stat-chip.bad { background: var(--bad-fill); color: var(--bad-ink); } .stat-chip.bad b { color: var(--bad-ink); }
.stat-chip.warn { background: var(--warn-fill); color: var(--warn-ink); } .stat-chip.warn b { color: var(--warn-ink); }
.stat-chip.info { background: var(--info-fill); color: var(--link); } .stat-chip.info b { color: var(--link); }
.pm-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.pm-ctl { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.pm-ctl select { min-width: 150px; }
.pm-count { padding: 10px 16px 0; margin: 0; color: var(--muted); }
.find-card { border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 10px; padding: 13px 15px; margin: 12px 16px 0; background: var(--panel); }
.find-card.sev-high { border-left-color: var(--bad); } .find-card.sev-medium { border-left-color: var(--warn); }
.find-card.sev-low { border-left-color: var(--link); } .find-card.sev-info { border-left-color: var(--line-strong); }
.find-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.find-title { font-size: 14.5px; color: var(--ink-2); } .find-title b { color: var(--navy); }
.find-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.find-block { margin-top: 10px; }
.find-label { font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px; }
.find-cite { display: flex; gap: 7px; align-items: flex-start; margin: 4px 0; color: var(--ink-2); font-size: 13px; }
.find-cite a { font-weight: 700; }
.find-actions { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* ── Policy text reader ──────────────────────────────────────────────────── */
.policy-text { margin-top: 12px; max-height: 480px; overflow-y: auto; white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }

/* ── Studio ↔ Modernization chips ────────────────────────────────────────── */
.mod-cell { white-space: nowrap; }
.mod-chip { border: 0; background: transparent; padding: 2px; display: inline-flex; gap: 5px; align-items: center; border-radius: 8px; }
.mod-chip:hover { background: var(--surface-2); }
