/* ==========================================================================
   Data Governance Modernization Platform - Prototype
   styles.css

   Design intent: an archival consulting instrument. Dense, quiet, and
   legible. Serif for titles and report headings because the output is a
   professional deliverable; system sans for every working control.
   No external fonts, no remote assets, no network calls.
   ========================================================================== */

:root {
  --ink:        #16202b;
  --ink-soft:   #35434f;
  --muted:      #566574;
  --muted-2:    #7c8894;
  --paper:      #ffffff;
  --canvas:     #f2f4f6;
  --canvas-2:   #e9edf1;
  --line:       #cbd3da;
  --line-soft:  #e2e7ec;
  --rail:       #1d2c3b;
  --rail-2:     #152230;
  --rail-text:  #c5d2dd;
  --rail-active:#ffffff;

  --accent:      #10605c;
  --accent-dark: #0b4744;
  --accent-soft: #e2efed;

  --good:      #2c6446;
  --good-soft: #e5f0e9;
  --warn:      #8a5300;
  --warn-soft: #faf0df;
  --bad:       #9a2b2b;
  --bad-soft:  #f7e7e7;
  --info:      #274e80;
  --info-soft: #e6ecf5;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --rail-w: 244px;
  --radius: 3px;
  --pad: 20px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.35; }
h4 { font-size: 14px; line-height: 1.4; font-family: var(--sans); font-weight: 650; }
p { margin: 0 0 10px; max-width: 78ch; }
a { color: var(--accent-dark); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.rail :focus-visible { outline-color: #8fd4cd; }

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

/* ---- Skip link ---------------------------------------------------------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 16px; font-weight: 600;
}
.skip:focus { left: 8px; top: 8px; }

/* ---- Shell -------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  background: var(--rail); color: var(--rail-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rail-head { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.rail-mark { font-family: var(--serif); font-size: 17px; color: #fff; line-height: 1.25; display: block; }
.rail-sub { font-size: 11.5px; color: #90a4b5; margin-top: 3px; display: block; }
.rail-pilot {
  margin: 12px 14px 6px; padding: 7px 9px; border: 1px solid #4c6b62; background: #1a3a37;
  color: #a9ded6; font-size: 11px; line-height: 1.35; border-radius: var(--radius);
}
.rail nav { padding: 8px 8px 20px; }
.rail-group { font-size: 11px; color: #7f93a5; padding: 12px 10px 4px; letter-spacing: .02em; }
.rail a.navitem {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; color: var(--rail-text); text-decoration: none;
  border-radius: var(--radius); font-size: 13.5px; line-height: 1.3;
}
.rail a.navitem:hover { background: rgba(255,255,255,.07); color: #fff; }
.rail a.navitem[aria-current="page"] {
  background: var(--rail-2); color: var(--rail-active); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.navitem .ico { width: 15px; height: 15px; flex: 0 0 15px; opacity: .85; }
.navitem .count {
  margin-left: auto; font-size: 11px; color: #8fa5b6; font-variant-numeric: tabular-nums;
}
.navitem[aria-current="page"] .count { color: #cfe0ea; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* ---- Context bar -------------------------------------------------------- */
.context {
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 9px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  position: sticky; top: 0; z-index: 40;
}
.context .ctx-item { font-size: 12px; color: var(--muted); }
.context .ctx-item b { color: var(--ink); font-weight: 600; }
.context .spacer { margin-left: auto; }
.savechip {
  font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.savedot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: 0 0 7px; }
.savedot.pending { background: var(--warn); }

/* ---- Page --------------------------------------------------------------- */
.page { padding: 22px 24px 60px; max-width: 1240px; width: 100%; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-current] { color: var(--ink); }
.pagehead { margin-bottom: 18px; }
.pagehead .lede { color: var(--muted); max-width: 76ch; margin-top: 5px; }
.pagehead-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pagehead-row .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Panels (rule-separated, not a card kit) ---------------------------- */
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 16px;
}
.panel > .panel-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.panel > .panel-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.panel > .panel-body { padding: 16px; }
.panel > .panel-body.tight { padding: 0; }
.panel-note { font-size: 12px; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.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-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }

/* ---- Stat blocks -------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line-soft); }
.stat { padding: 12px 16px; border-right: 1px solid var(--line-soft); }
.stat:last-child { border-right: 0; }
.stat .k { font-size: 11.5px; color: var(--muted); display: block; }
.stat .v { font-family: var(--serif); font-size: 23px; line-height: 1.15; display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 11.5px; color: var(--muted-2); display: block; }
.stat.is-bad .v { color: var(--bad); }
.stat.is-warn .v { color: var(--warn); }
.stat.is-good .v { color: var(--good); }

/* ---- Tables ------------------------------------------------------------- */
.tablewrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data caption { text-align: left; padding: 10px 16px; color: var(--muted); font-size: 12px; }
table.data th, table.data td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
table.data thead th {
  background: var(--canvas-2); color: var(--ink-soft); font-weight: 650; font-size: 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.data tbody tr:hover { background: #f7f9fa; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .pubid { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
table.data tbody tr.is-suppressed { background: var(--bad-soft); }
table.data tbody tr.is-suppressed:hover { background: #f2dcdc; }
.rowlink { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-dark); text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.rowlink:hover { color: var(--ink); }

/* ---- Badges and status -------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; line-height: 1.5; padding: 1px 7px; border-radius: 2px;
  border: 1px solid var(--line); background: var(--canvas-2); color: var(--ink-soft);
  white-space: nowrap; font-weight: 600;
}
.badge.good { background: var(--good-soft); border-color: #b6d2c2; color: var(--good); }
.badge.warn { background: var(--warn-soft); border-color: #e0c48c; color: var(--warn); }
.badge.bad  { background: var(--bad-soft); border-color: #dfb4b4; color: var(--bad); }
.badge.info { background: var(--info-soft); border-color: #b9c8de; color: var(--info); }
.badge.accent { background: var(--accent-soft); border-color: #9fc9c4; color: var(--accent-dark); }
.badge.plain { background: transparent; }
.badge .glyph { font-weight: 700; }

.pilotbar {
  border: 1px solid #9fc9c4; background: var(--accent-soft); color: var(--accent-dark);
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 12.5px; line-height: 1.5;
}
.pilotbar b { display: block; font-size: 13px; margin-bottom: 2px; }
.pilotbar.compact { padding: 7px 11px; margin-bottom: 12px; }

.limitbox {
  border: 1px solid #dfb4b4; background: var(--bad-soft); color: #6d1f1f;
  padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 12.5px;
}
.limitbox b { display: block; margin-bottom: 3px; }
.limitbox ul { margin: 6px 0 0 18px; padding: 0; }

.notebox {
  border: 1px solid var(--line); background: var(--canvas-2);
  padding: 12px 14px; border-radius: var(--radius); font-size: 12.5px; color: var(--ink-soft);
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.2;
  padding: 7px 13px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.btn:hover { background: var(--canvas-2); }
.btn.primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { background: var(--paper); border-color: #d2a3a3; color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { font-size: 12px; padding: 4px 9px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Forms -------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field > label, .fieldlabel { display: block; font-size: 12.5px; font-weight: 650; margin-bottom: 4px; color: var(--ink-soft); }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
input[type="text"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; font-size: 13px; width: 100%; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink);
}
textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
input:disabled, select:disabled, textarea:disabled { background: var(--canvas-2); color: var(--muted); }
.inline-err { color: var(--bad); font-size: 12px; margin-top: 4px; font-weight: 600; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); background: #fffafa; }

.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft); background: #fbfcfd;
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { flex: 1 1 200px; }
.filters .resultcount { margin-left: auto; font-size: 12px; color: var(--muted); align-self: center; }

/* ---- Tabs --------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 16px; }
.tabs button {
  font: inherit; font-size: 13px; font-weight: 600; padding: 8px 13px; cursor: pointer;
  background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent-dark); border-bottom-color: var(--accent); }

/* ---- Disclosure --------------------------------------------------------- */
details.disclose { border: 1px solid var(--line-soft); border-radius: var(--radius); margin: 8px 0; background: #fbfcfd; }
details.disclose > summary {
  cursor: pointer; padding: 7px 11px; font-size: 12.5px; font-weight: 650; color: var(--ink-soft);
  list-style: none; display: flex; align-items: center; gap: 7px;
}
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "+"; font-family: var(--mono); font-weight: 700; color: var(--accent); }
details.disclose[open] > summary::before { content: "\2212"; }
details.disclose > div { padding: 0 11px 11px; font-size: 12.5px; color: var(--ink-soft); }

/* ---- Measure strip (maturity, readable without color) ------------------- */
.measure { display: flex; align-items: center; gap: 8px; }
.measure .cells { display: flex; gap: 2px; }
.measure .cell {
  width: 20px; height: 15px; border: 1px solid var(--line); background: var(--paper);
  font-size: 10px; line-height: 13px; text-align: center; color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.measure .cell.on { background: var(--ink-soft); border-color: var(--ink); color: #fff; font-weight: 700; }
.measure .cell.under { background: var(--canvas-2); }
.measure .lab { font-size: 12px; color: var(--ink-soft); }
.measure.none .cells { opacity: .45; }

.distbar { display: flex; height: 16px; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; background: var(--canvas-2); }
.distbar span { display: block; font-size: 10px; line-height: 14px; text-align: center; color: #fff; overflow: hidden; }
.dist-1 { background: #6b4a4a; } .dist-2 { background: #8a6a3f; } .dist-3 { background: #476080; }
.dist-4 { background: #2f6a58; } .dist-5 { background: #1d4f42; }
.dist-sufficient { background: #2c6446; } .dist-partial { background: #8a5300; }
.dist-insufficient { background: #9a2b2b; } .dist-not-reviewed { background: #7c8894; }
.dist-none { background: #adb7c0; }
.distlegend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.distlegend i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border: 1px solid rgba(0,0,0,.2); }

/* ---- Interview workspace ------------------------------------------------ */
.iw { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 16px; align-items: start; }
.iw-main { min-width: 0; }
.iw-side { position: sticky; top: 56px; }

.iw-bar {
  background: var(--rail); color: #dce7ef; border-radius: var(--radius);
  padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; margin-bottom: 14px;
}
.iw-bar .k { font-size: 11px; color: #90a4b5; display: block; }
.iw-bar .v { font-size: 13px; color: #fff; font-weight: 600; }
.iw-bar .spacer { margin-left: auto; }
.iw-bar .timer { font-family: var(--mono); font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.iw-bar .timer.over { color: #ffb3b3; }

.iw-q { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); }
.iw-q .qhead { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.iw-q .qpath { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.iw-q .qpath .pubid { font-family: var(--mono); }
.iw-q .qtext { font-family: var(--serif); font-size: 17px; line-height: 1.45; margin: 0; max-width: 68ch; }
.iw-q .qbody { padding: 14px 16px; }

.levels { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.levelopt {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--paper);
}
.levelopt:hover { background: #f7f9fa; }
.levelopt input { margin: 3px 0 0; flex: 0 0 auto; }
.levelopt .lnum {
  font-family: var(--serif); font-size: 16px; font-weight: 700; width: 20px; flex: 0 0 20px;
  text-align: center; color: var(--muted);
}
.levelopt .lname { font-weight: 650; font-size: 13px; display: block; }
.levelopt .ldesc { font-size: 12.5px; color: var(--muted); display: block; }
.levelopt.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.levelopt.sel .lnum { color: var(--accent-dark); }
.levelopt .kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 2px; padding: 0 4px; background: var(--canvas-2);
}

.statusgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.statusopt {
  font: inherit; font-size: 12.5px; padding: 5px 10px; border: 1px solid var(--line);
  background: var(--paper); border-radius: var(--radius); cursor: pointer; color: var(--ink-soft);
}
.statusopt:hover { background: var(--canvas-2); }
.statusopt.sel { background: var(--ink-soft); border-color: var(--ink); color: #fff; font-weight: 650; }

.iw-nav {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 11px 16px; border-top: 1px solid var(--line-soft); background: #fbfcfd;
  position: sticky; bottom: 0; border-radius: 0 0 var(--radius) var(--radius);
}
.iw-nav .spacer { margin-left: auto; }
.progtrack { height: 6px; background: var(--canvas-2); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.progtrack i { display: block; height: 100%; background: var(--accent); }

.itemjump { max-height: 320px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.itemjump button {
  display: flex; gap: 8px; width: 100%; text-align: left; font: inherit; font-size: 12px;
  padding: 5px 9px; background: none; border: 0; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.itemjump button:hover { background: var(--canvas-2); }
.itemjump button[aria-current="true"] { background: var(--accent-soft); font-weight: 650; }
.itemjump .pubid { font-family: var(--mono); color: var(--muted); flex: 0 0 44px; }
.itemjump .mk { margin-left: auto; font-size: 11px; color: var(--muted); }

/* ---- Roadmap board ------------------------------------------------------ */
.board { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.boardcol { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.boardcol > h3 { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; background: var(--canvas-2); }
.boardcol > h3 .c { font-family: var(--sans); font-size: 11.5px; color: var(--muted); font-weight: 400; display: block; }
.boardcol ul { list-style: none; margin: 0; padding: 8px; display: grid; gap: 8px; }
.rmitem { border: 1px solid var(--line-soft); border-left: 3px solid var(--muted-2); border-radius: 2px; padding: 9px 10px; }
.rmitem.p-high { border-left-color: var(--bad); }
.rmitem.p-medium { border-left-color: var(--warn); }
.rmitem.p-low { border-left-color: var(--info); }
.rmitem h4 { font-size: 13px; margin-bottom: 4px; }
.rmitem .meta { font-size: 11.5px; color: var(--muted); }
.rmitem .dep { font-size: 11.5px; color: var(--warn); margin-top: 4px; }

.timeline { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tlrow { display: grid; grid-template-columns: 240px 1fr; border-bottom: 1px solid var(--line-soft); align-items: center; }
.tlrow:last-child { border-bottom: 0; }
.tlrow > .lab { padding: 7px 12px; font-size: 12.5px; border-right: 1px solid var(--line-soft); }
.tlrow > .track { position: relative; height: 34px; background: repeating-linear-gradient(to right, transparent 0 calc(25% - 1px), var(--line-soft) calc(25% - 1px) 25%); }
.tlrow > .track > .bar {
  position: absolute; top: 9px; height: 16px; border-radius: 2px; background: var(--accent);
  color: #fff; font-size: 10.5px; line-height: 16px; padding: 0 6px; overflow: hidden; white-space: nowrap;
}
.tlrow > .track > .bar.p-medium { background: #4a6a86; }
.tlrow > .track > .bar.p-low { background: #7c8894; }
.tlhead { display: grid; grid-template-columns: 240px 1fr; background: var(--canvas-2); border-bottom: 1px solid var(--line); }
.tlhead > .lab { padding: 7px 12px; font-size: 12px; font-weight: 650; border-right: 1px solid var(--line-soft); }
.tlhead > .cols { display: grid; grid-template-columns: repeat(4, 1fr); }
.tlhead > .cols span { padding: 7px 8px; font-size: 12px; font-weight: 650; border-left: 1px solid var(--line-soft); }
.tlhead > .cols span:first-child { border-left: 0; }

/* ---- Coverage matrix ---------------------------------------------------- */
.covgrid { display: grid; gap: 3px; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); }
.covcell {
  height: 26px; border: 1px solid var(--line); border-radius: 2px; font-size: 10px;
  display: flex; align-items: center; justify-content: center; background: var(--paper);
  color: var(--muted); font-family: var(--mono); cursor: help;
}
.covcell.c-scored { background: var(--good-soft); border-color: #b6d2c2; color: var(--good); font-weight: 700; }
.covcell.c-partial { background: var(--warn-soft); border-color: #e0c48c; color: var(--warn); font-weight: 700; }
.covcell.c-none { background: var(--canvas-2); }
.covcell.c-bad { background: var(--bad-soft); border-color: #dfb4b4; color: var(--bad); font-weight: 700; }

/* ---- Drawer and modal --------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: rgba(15,25,35,.42); z-index: 90; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 94vw); background: var(--paper);
  z-index: 100; display: flex; flex-direction: column; box-shadow: -3px 0 18px rgba(15,25,35,.2);
}
.drawer > header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer > header .actions { margin-left: auto; }
.drawer > .drawer-body { padding: 16px 18px 40px; overflow-y: auto; flex: 1 1 auto; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 100;
  background: var(--paper); border-radius: var(--radius); width: min(560px, 94vw);
  max-height: 86vh; overflow-y: auto; box-shadow: 0 10px 34px rgba(15,25,35,.28);
}
.modal > header { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal > .modal-body { padding: 16px 18px; }
.modal > footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* ---- Definition lists --------------------------------------------------- */
dl.kv { display: grid; grid-template-columns: 190px 1fr; gap: 0; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
dl.kv dd { margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
dl.kv.narrow { grid-template-columns: 140px 1fr; }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.bul { margin: 0 0 10px 18px; padding: 0; }
ul.bul li { margin-bottom: 4px; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--rail); color: #fff; padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; z-index: 150; box-shadow: 0 5px 18px rgba(15,25,35,.3);
}

.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; font-family: var(--serif); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Report styling ----------------------------------------------------- */
.report { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; }
.report .reptitle { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.report h2 { margin: 24px 0 10px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.report h3 { margin: 16px 0 7px; }
.report .repmeta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 0 20px; margin: 14px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.report .repmeta div { font-size: 12.5px; padding: 3px 0; }
.report .repmeta .k { color: var(--muted); display: block; font-size: 11.5px; }
.report .repfoot { margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

/* ---- Responsive --------------------------------------------------------- */
.railtoggle { display: none; }

@media (max-width: 1100px) {
  .iw { grid-template-columns: 1fr; }
  .iw-side { position: static; }
  .board { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-2-1, .g-1-2, .g3 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; flex: none; height: auto; position: static; }
  .rail nav { display: none; }
  .rail.open nav { display: block; }
  .railtoggle {
    display: inline-flex; align-items: center; gap: 8px; margin: 10px 14px;
    background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2);
    padding: 7px 12px; border-radius: var(--radius); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  }
  .g2, .board { grid-template-columns: 1fr; }
  .page { padding: 16px 14px 48px; }
  .context { padding: 8px 14px; }
  dl.kv, dl.kv.narrow { grid-template-columns: 1fr; }
  dl.kv dt { border-bottom: 0; padding-bottom: 0; }
  .tlrow, .tlhead { grid-template-columns: 1fr; }
  .report { padding: 18px 16px; }
}

/* ---- Print -------------------------------------------------------------- */
@media print {
  .rail, .context, .tabs, .filters, .iw-nav, .btn, .btnrow, .skip, .pagehead-row .actions { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .page { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; }
  .panel { border: 1px solid #999; break-inside: avoid; }
  table.data { font-size: 9.5pt; }
  table.data thead th { position: static; background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pilotbar, .limitbox, .notebox { border: 1px solid #666; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .distbar span, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  h2, h3 { break-after: avoid; }
  a { text-decoration: none; color: #000; }
  .report h2 { break-before: auto; }
}
