/* Jal Prahari - light, high-trust government UI.
   Status colours (critical / warning / good / no data) always come with an icon
   and a text label, never colour alone. */

:root {
  color-scheme: light;
  --font: "Google Sans", "Noto Sans Devanagari", "Nirmala UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hi: "Noto Sans Devanagari", "Nirmala UI", "Google Sans", system-ui, sans-serif;

  --bg: #ffffff;
  --panel: #f8f8f6;
  --line: #e5e4df;
  --line-strong: #d3d2cb;
  --ink: #16171a;
  --ink-2: #52514e;
  --muted: #7a7974;

  --accent: #1c5cab;
  --accent-hover: #184f95;
  --accent-soft: #eaf1fb;

  --critical: #d03b3b;
  --critical-bg: #fdeeee;
  --critical-ink: #9a1f1f;
  --warning: #fab219;
  --warning-bg: #fff5dc;
  --warning-ink: #7a5000;
  --good: #0ca30c;
  --good-bg: #e8f6e8;
  --good-ink: #0b6a0b;
  --nodata: #a3a29c;
  --nodata-bg: #f0efec;
  --nodata-ink: #52514e;

  --series: #2a78d6;
  --grid: #e9e8e2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 17, 20, 0.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  font-optical-sizing: auto;
}
[lang="hi"] { font-family: var(--font-hi); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); }
button { font: inherit; }
.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; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.app { max-width: 1440px; margin: 0 auto; padding: 0 24px 40px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 34px; height: 34px; flex: none; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.brand-name [lang="hi"] { font-weight: 600; color: var(--accent); margin-left: 6px; font-size: 18px; }
.brand-sub { color: var(--ink-2); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.countdown {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.countdown b { color: var(--ink); font-weight: 600; }
.countdown .days { font-weight: 700; color: var(--critical-ink); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--panel); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn:focus-visible, .ghat-card:focus-visible, .chip:focus-visible, .tile:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn-small { height: 30px; padding: 0 10px; font-size: 13px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- ask bar ---------- */
.ask { margin-top: 16px; padding: 12px 14px; }
.ask-row { display: flex; align-items: center; gap: 10px; }
.ask-icon { width: 20px; height: 20px; color: var(--muted); flex: none; }
#ask-input {
  flex: 1; min-width: 0; height: 40px; border: 0; outline: none;
  font: 400 15px var(--font); color: var(--ink); background: transparent;
}
#ask-input::placeholder { color: var(--muted); }
.engine-pill {
  font-size: 12px; color: var(--ink-2); background: var(--panel); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.engine-pill.ai { color: var(--accent); background: var(--accent-soft); border-color: #cfe0f6; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-left: 30px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.answer { margin-top: 12px; border-top: 1px solid var(--line); padding: 12px 4px 4px 30px; }
.answer-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.answer-q { font-weight: 600; color: var(--ink); font-size: 14px; margin-right: 4px; }
.answer-close { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 0 4px; }
.answer-body { font-size: 14px; line-height: 1.6; max-width: 980px; }
.answer-body p + p, .answer-body p + ul, .answer-body ul + p, .answer-body table + p, .answer-body p + table { margin-top: 8px; }
.answer-body ul { margin: 6px 0 0; padding-left: 18px; }
.answer-body li + li { margin-top: 4px; }
.answer-body table { border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.answer-body th, .answer-body td { border-bottom: 1px solid var(--line); padding: 5px 12px 5px 0; text-align: left; vertical-align: top; }
.answer-body th { color: var(--muted); font-weight: 500; }
.answer-foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.speed { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ink); }
.speed svg { width: 13px; height: 13px; color: var(--warning); }
.verify { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.verify.ok { background: var(--good-bg); color: var(--good-ink); }
.verify.bad { background: var(--warning-bg); color: var(--warning-ink); }
.notice { font-size: 12px; color: var(--warning-ink); background: var(--warning-bg); padding: 4px 8px; border-radius: 6px; }
.thinking { display: inline-flex; gap: 4px; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* citation chips: every number links to its PDF page */
.cite {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap;
  color: var(--accent); background: var(--accent-soft); border: 1px solid #d6e4f6;
  padding: 2px 6px 2px 5px; border-radius: 5px; text-decoration: none; vertical-align: 1px;
}
.cite:hover { background: #dbe8f8; }
.cite.nolink { color: var(--ink-2); background: var(--nodata-bg); border-color: var(--line); cursor: help; }

/* upload result banner */
.banner { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 11px 14px; border-radius: 8px; font-size: 13.5px; border: 1px solid; }
.banner.success { background: var(--good-bg); border-color: #bfe3bf; color: #0a4f0a; }
.banner.error { background: var(--critical-bg); border-color: #f2c4c4; color: #7a1717; }
.banner.info { background: var(--panel); border-color: var(--line); color: var(--ink-2); }
.banner > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner .banner-body { flex: 1; min-width: 0; }
.banner b { font-weight: 600; }
.banner ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.banner li + li { margin-top: 2px; }
.banner .banner-close { border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; }
.cite svg { width: 9px; height: 9px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.tile {
  text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; box-shadow: var(--shadow); color: inherit;
}
.tile:hover { border-color: var(--line-strong); }
.tile-value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.tile-value small { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.tile-label { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.tile-meter { height: 6px; border-radius: 3px; background: #f2e3e3; margin-top: 10px; overflow: hidden; }
.tile-meter span { display: block; height: 100%; background: var(--critical); border-radius: 3px; }
.tile-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(360px, 420px) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.col-detail, .col-list { min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.link-quiet { font-size: 13px; color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- ranked list ---------- */
.ghat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ghat-card {
  width: 100%; text-align: left; display: grid; grid-template-columns: 34px 1fr; gap: 0 10px;
  padding: 12px 14px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; color: inherit; position: relative;
}
.ghat-card:hover { border-color: var(--line-strong); }
.ghat-card[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: #fbfdff; }
.rank {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff; background: var(--nodata);
}
.rank.t-critical { background: var(--critical); }
.rank.t-warning { background: var(--warning); color: #3d2a00; }
.rank.t-safe { background: var(--good); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ghat-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.ghat-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.ghat-sub [lang="hi"] { color: var(--ink-2); }
.score { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.score b { display: block; font-size: 18px; color: var(--ink); font-weight: 700; line-height: 1.1; }
.reasons { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.reasons li { position: relative; padding-left: 12px; }
.reasons li::before { content: ""; position: absolute; left: 1px; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.reasons li + li { margin-top: 2px; }
.gap-flag {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  font-size: 12px; font-weight: 500; color: var(--nodata-ink); background: var(--nodata-bg);
  padding: 2px 8px; border-radius: 5px;
}
.gap-flag svg { width: 12px; height: 12px; }
.gap-flag + .gap-flag { margin-left: 4px; }

/* strips: one square per test */
.strips { margin-top: 10px; display: grid; gap: 3px; }
.strip { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.strip-label { width: 26px; flex: none; }
.strip-groups { display: flex; gap: 5px; }
.strip-group { display: flex; gap: 2px; }
.sq { width: 9px; height: 9px; border-radius: 2px; background: var(--nodata-bg); }
.sq.pass { background: var(--good); }
.sq.fail { background: var(--critical); }
.sq.missing, .sq.notable { background: repeating-linear-gradient(135deg, #d7d6d0 0 1.5px, #f3f2ef 1.5px 3.5px); }
.sq.durga { outline: 0; }
.strip-axis { display: flex; gap: 5px; margin-left: 32px; font-size: 10px; color: var(--muted); }
.strip-axis span { width: 31px; text-align: center; }
.strip-axis span.d { color: var(--ink-2); font-weight: 600; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 999px;
}
.badge svg { width: 13px; height: 13px; flex: none; }
.badge.t-critical { background: var(--critical-bg); color: var(--critical-ink); }
.badge.t-warning { background: var(--warning-bg); color: var(--warning-ink); }
.badge.t-safe { background: var(--good-bg); color: var(--good-ink); }
.badge.t-nodata { background: var(--nodata-bg); color: var(--nodata-ink); }
.badge.l-priority { background: var(--critical-bg); color: var(--critical-ink); }
.badge.l-standard { background: var(--warning-bg); color: var(--warning-ink); }
.badge.l-routine, .badge.l-none { background: var(--nodata-bg); color: var(--nodata-ink); }

/* ---------- map ---------- */
.map-card { overflow: hidden; }
#map { height: 300px; background: #eef0ee; }
.map-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 7px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.pin {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font: 700 13px var(--font); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  background: var(--nodata); transition: transform .12s;
}
.pin.t-critical { background: var(--critical); }
.pin.t-warning { background: var(--warning); color: #3d2a00; }
.pin.t-safe { background: var(--good); }
.pin.selected { transform: scale(1.25); box-shadow: 0 0 0 3px var(--accent), 0 1px 4px rgba(0,0,0,.35); }
.leaflet-tooltip { font: 500 12.5px var(--font); }
.leaflet-container { font-family: var(--font); }

/* ---------- detail ---------- */
.detail { margin-top: 16px; padding: 20px 22px 22px; }
.detail-head { display: flex; align-items: flex-start; gap: 14px; }
.detail-head .rank { width: 40px; height: 40px; font-size: 17px; flex: none; }
.detail-title { flex: 1; min-width: 0; }
.detail-title h2 { font-size: 21px; font-weight: 600; line-height: 1.25; }
.detail-title .hi-name { font-size: 15px; color: var(--ink-2); margin-top: 2px; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.detail-score { text-align: right; flex: none; }
.detail-score .big { font-size: 28px; font-weight: 700; line-height: 1; }
.detail-score .lbl { font-size: 12px; color: var(--muted); }
.breakdown { font-size: 12px; color: var(--ink-2); margin-top: 6px; }

.callouts { display: grid; gap: 8px; margin-top: 16px; }
.callout { display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.callout svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.callout.gap { background: var(--nodata-bg); color: var(--ink); border: 1px solid #e2e1dc; }
.callout.gap svg { color: var(--ink-2); }
.callout.site { background: var(--warning-bg); color: #4a3200; border: 1px solid #f6e1ad; }
.callout.site svg { color: var(--warning-ink); }
.callout [lang="hi"] { display: block; color: var(--ink-2); margin-top: 3px; font-size: 12.5px; }

.summary { margin-top: 16px; padding: 12px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.summary-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.summary-head b { color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
.summary p { font-size: 14px; line-height: 1.55; }
.summary p[lang="hi"] { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }

.two-col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; margin-top: 20px; }
.block-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; display: flex; align-items: baseline; gap: 8px; }
.block-title .muted { font-weight: 400; }
.why { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.why li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; font-size: 13.5px; line-height: 1.5; }
.why li svg { width: 15px; height: 15px; margin-top: 3px; }
.why li.concern svg { color: var(--critical); }
.why li.ok svg { color: var(--good); }
.why .hi { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }

.deploy { display: grid; gap: 8px; }
.deploy-row { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.deploy-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deploy-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.deploy-name svg { width: 16px; height: 16px; color: var(--ink-2); }
.deploy-why { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }

.section { margin-top: 24px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.section-title h3 { font-size: 15px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.pass { background: var(--series); }
.dot.fail { background: var(--critical); }
.dot.missing { background: #fff; border: 1.5px solid var(--nodata); }
.swatch-zone { width: 14px; height: 9px; background: rgba(208, 59, 59, 0.12); border-top: 1px solid var(--critical); display: inline-block; }
.swatch-hatch { width: 14px; height: 9px; display: inline-block; background: repeating-linear-gradient(135deg, #d7d6d0 0 1.5px, #f6f5f2 1.5px 4px); }

.chart { margin-top: 10px; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.chart-title b { font-weight: 600; }
.chart-title span { color: var(--muted); font-size: 12px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg text { font-family: var(--font); }
.trend-lines { margin-top: 2px; display: grid; gap: 1px; font-size: 12.5px; color: var(--ink-2); }
.trend-lines .v-worse, .trend-lines .v-still-failing { color: var(--critical-ink); font-weight: 500; }
.trend-lines .v-better { color: var(--good-ink); font-weight: 500; }
.hit { cursor: pointer; }
.hit:focus { outline: none; }
.hit:focus-visible + .ring, .hit:hover + .ring { stroke: var(--ink); }

.tooltip {
  position: fixed; z-index: 2000; pointer-events: none; max-width: 300px;
  background: #fff; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 10px; font-size: 12.5px; line-height: 1.45; box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.tooltip .tt-muted { color: var(--muted); font-size: 11.5px; }
.tooltip .tt-val { font-weight: 700; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.data { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data thead th { background: var(--panel); color: var(--ink-2); font-weight: 500; font-size: 12px; position: sticky; top: 0; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.readings th.param { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 150px; font-weight: 500; color: var(--ink); }
table.readings thead th.param { background: var(--panel); z-index: 2; }
table.readings th.param small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
table.readings td { text-align: center; min-width: 46px; cursor: pointer; }
table.readings .ev { text-align: center; border-left: 1px solid var(--line); }
table.readings .ev a { color: inherit; text-decoration: none; }
table.readings .ev a:hover { color: var(--accent); }
table.readings .ev .pg { display: block; color: var(--accent); font-size: 11px; }
table.readings .ev.durga { color: var(--ink); font-weight: 600; }
table.readings td.first { border-left: 1px solid var(--line); }
td.c-fail { background: var(--critical-bg); color: var(--critical-ink); font-weight: 600; }
td.c-pass { color: var(--good-ink); }
td.c-info { color: var(--ink); }
td.c-bdl { color: var(--ink-2); font-style: italic; }
td.c-missing { color: var(--muted); background: repeating-linear-gradient(135deg, #f1f0ec 0 2px, #fff 2px 6px); }
td.c-notable { color: var(--muted); background: repeating-linear-gradient(135deg, #ecebe6 0 2px, #f8f8f6 2px 7px); white-space: normal; font-size: 12px; vertical-align: middle; cursor: default; }
tr.sep th, tr.sep td { border-top: 2px solid var(--line-strong); }
.table-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .15s; display: inline-block; }
details.fold[open] > summary::before { transform: rotate(90deg); }

.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- about + footer ---------- */
.about { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.about .card { padding: 16px 18px; }
.about h2 { font-size: 15px; margin-bottom: 8px; }
.about ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: grid; gap: 6px; }
.about .tier-rules { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.about .tier-rules div { display: flex; gap: 8px; align-items: flex-start; }
.footer { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer a { color: var(--ink-2); }

/* ---------- brief overlay ---------- */
.brief-overlay { position: fixed; inset: 0; z-index: 3000; background: #eceae4; overflow: auto; }
.brief-toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line);
}
.brief-toolbar h2 { font-size: 15px; margin-right: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 0 12px; height: 34px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.brief-engine { font-size: 12px; color: var(--muted); }
.pages { display: grid; justify-content: center; gap: 24px; padding: 24px 16px 60px; }
.brief-overlay.only-en .page[lang="hi"], .brief-overlay.only-hi .page[lang="en"] { display: none; }

.page {
  width: 210mm; min-height: 297mm; padding: 11mm 13mm 9mm; background: #fff; color: #111;
  box-shadow: 0 2px 12px rgba(0,0,0,.12); display: flex; flex-direction: column;
  font-size: 9.5pt; line-height: 1.4;
}
.page[lang="hi"] { font-family: var(--font-hi); font-size: 9.5pt; line-height: 1.5; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 6px; border-bottom: 2px solid #1c5cab; }
.org { font-weight: 600; font-size: 9.5pt; color: #1c5cab; }
.org small { display: block; color: #555; font-weight: 400; font-size: 8.5pt; }
.doc-meta { text-align: right; font-size: 8.5pt; color: #555; }
.doc-meta b { color: #111; }
.page h1 { font-size: 15pt; font-weight: 700; margin-top: 8px; line-height: 1.25; }
.page .subtitle { font-size: 9.5pt; color: #444; margin-top: 1px; }
.memo { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 6px 0 0; font-size: 9pt; }
.memo dt { color: #555; }
.memo dd { margin: 0; border-bottom: 1px dotted #bbb; min-height: 1.4em; outline: none; }
.memo dd:focus { background: #fffbe6; }
.page h2 { font-size: 10.5pt; font-weight: 700; margin-top: 9px; margin-bottom: 3px; color: #111; }
.page p { margin: 0; }
.page table { width: 100%; border-collapse: collapse; font-size: 8.5pt; line-height: 1.35; }
.page table th, .page table td { border: 1px solid #d6d5cf; padding: 3px 5px; vertical-align: top; text-align: left; }
.page table thead th { background: #f3f3f0; font-weight: 600; font-size: 8pt; }
.page table.deploy-t th { width: 22%; background: #f8f8f6; font-weight: 600; }
.page .pbadge { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 8.5pt; white-space: nowrap; }
.page .pbadge svg { width: 10px; height: 10px; }
.page .pbadge.t-critical { color: #9a1f1f; }
.page .pbadge.t-warning { color: #7a5000; }
.page .pbadge.t-safe { color: #0b6a0b; }
.page .fails { display: block; color: #666; font-size: 7.5pt; margin-top: 0; }
.page .gapcell { color: #444; }
.page .pages-cell { font-size: 7.5pt; color: #444; white-space: nowrap; }
.page .pages-cell a { color: #1c5cab; text-decoration: none; }
.page .closing { margin-top: 6px; font-size: 8pt; color: #444; }
.page-foot { margin-top: auto; padding-top: 6px; border-top: 1px solid #ddd; display: flex; justify-content: space-between; gap: 8px; font-size: 7.5pt; color: #777; }
.brief-loading { padding: 80px; text-align: center; color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app { padding: 0 14px 30px; }
  .topbar { flex-wrap: wrap; }
  .brand-sub { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-hint { display: none; }
  .countdown { display: none; }
  .engine-pill { display: none; }
  .chips, .answer { padding-left: 0; }
  .detail { padding: 16px; }
  .detail-head { flex-wrap: wrap; }
  .detail-title { flex-basis: calc(100% - 56px); }
  .detail-score { width: 100%; text-align: left; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .detail-score .breakdown { margin-top: 0; }
}

/* ---------- print: only the brief ---------- */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .app, .tooltip { display: none !important; }
  .brief-overlay { position: static; overflow: visible; background: #fff; display: block !important; }
  .brief-toolbar { display: none; }
  .pages { display: block; padding: 0; }
  .page { box-shadow: none; margin: 0; width: 210mm; min-height: 296mm; break-after: page; page-break-after: always; }
  .page:last-child { break-after: auto; page-break-after: auto; }
  .memo dd { border-bottom-color: #999; }
  a { color: inherit; }
}

/* ---------- resource allocator (base) ---------- */
.allocator { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.alloc-head { flex: 0 1 13rem; }
.alloc-lede { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.alloc-inputs { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.alloc-field label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.alloc-field label svg { width: 15px; height: 15px; }
.alloc-field label [lang="hi"] { color: var(--muted); font-weight: 400; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: #fff; }
.stepper button { width: 34px; height: 38px; border: 0; background: transparent; font-size: 18px; color: var(--ink-2); cursor: pointer; }
.stepper button:hover { background: var(--panel); }
.stepper input { width: 3.2rem; height: 38px; border: 0; text-align: center; font: 600 17px var(--font); color: var(--ink); background: transparent; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.alloc-summary { flex: 1 1 16rem; display: grid; gap: 4px; font-size: 13px; }
.alloc-line { display: flex; align-items: flex-start; gap: 6px; }
.alloc-line svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.alloc-line.short { color: var(--critical-ink); }
.alloc-line.ok { color: var(--good-ink); }
.alloc-line.unplaced { color: var(--ink-2); }
.btn-outline { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-outline:hover { background: var(--accent-soft); }

.alloc { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 8px; }
.alloc:empty { display: none; }
.alloc-set { display: inline-flex; gap: 4px; }
.alloc-n { display: inline-flex; align-items: center; gap: 4px; min-width: 42px; height: 26px; padding: 0 7px; border-radius: 6px; font-size: 13px; }
.alloc-n svg { width: 13px; height: 13px; }
.alloc-n b { font-weight: 700; font-variant-numeric: tabular-nums; }
.alloc-n.s-given { background: var(--accent-soft); color: var(--accent); }
.alloc-n.s-short { background: var(--critical-bg); color: var(--critical-ink); box-shadow: inset 0 0 0 1px rgba(194, 38, 27, 0.35); }
.alloc-n.s-held { background: repeating-linear-gradient(135deg, #ECE9E2 0 4px, #F6F4EF 4px 8px); color: var(--ink-2); }
.alloc-n.s-not-needed { color: #b9b5ad; }
.alloc-n.s-none { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.alloc-note { font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.alloc-note.test { color: var(--ink-2); }
.alloc-note.short { color: var(--critical-ink); }

.deploy-right { display: inline-flex; align-items: center; gap: 8px; }
.deploy-alloc { font-size: 12px; font-weight: 600; white-space: nowrap; }
.deploy-alloc:empty { display: none; }
.deploy-alloc.s-given { color: var(--accent); }
.deploy-alloc.s-short { color: var(--critical-ink); }
.deploy-alloc.s-held, .deploy-alloc.s-none, .deploy-alloc.s-not-needed { color: var(--muted); }

/* ---------- brief: units line and page 3, the deployment plan ---------- */
.units-line { margin-top: 4px; font-size: 8.5pt; color: #444; }
.brief-overlay.only-plan .page:not(.plan-page) { display: none; }
.plan-page .h1-hi { display: block; font-family: var(--font-hi); font-size: 12pt; font-weight: 600; color: #444; margin-top: 2px; }
.plan-page .bi { display: block; font-family: var(--font-hi); font-size: 7.5pt; font-weight: 400; color: #666; line-height: 1.35; }
.plan-page [lang="hi"] { font-family: var(--font-hi); }
.onhand { display: flex; gap: 8px; align-items: stretch; margin: 10px 0 12px; }
.onhand-label { align-self: center; min-width: 58px; font-size: 9pt; font-weight: 600; }
.onhand-item { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid #d6d5cf; border-radius: 6px; font-size: 8.5pt; }
.onhand-item b { font-size: 18pt; line-height: 1; color: #102A4C; }
.plan-t th.pc, .plan-t td.pc { text-align: center; width: 12%; vertical-align: middle; }
.plan-t td.pc b { font-size: 14pt; line-height: 1.1; }
.plan-t .pc.given b { color: #102A4C; }
.plan-t .pc.short { background: #FBEAE7; }
.plan-t .pc.short b { color: #8E1A11; }
.plan-t .pc.held { background: repeating-linear-gradient(135deg, #EFEDE8 0 3px, #fff 3px 7px); }
.plan-t .pc.held b { font-size: 8.5pt; }
.plan-t .pc.none b { color: #aaa; }
.plan-t td.reason { font-size: 8.5pt; }
.plan-t tr.crit td:first-child { box-shadow: inset 3px 0 0 #C2261B; }
.plan-t tfoot td { font-weight: 600; background: #F6F6F3; vertical-align: middle; }
.plan-t tfoot .bi { display: inline; margin-left: 4px; }
.plan-list { margin: 4px 0 0; padding-left: 18px; font-size: 9pt; }
.plan-list li + li { margin-top: 5px; }
.approve { display: flex; gap: 36px; margin-top: 18px; font-size: 9pt; }
.approve i { display: inline-block; width: 170px; height: 14px; margin-left: 8px; border-bottom: 1px solid #999; vertical-align: bottom; }
