/* PlanSphere — phase-5 surface.
   A navy command rail against cool paper. Inter carries the interface, IBM Plex
   Mono carries every number and unit, so a reading always looks like a reading.
   The tokens below are the whole palette; only chart series name colours
   outside this block, and they are named explicitly in app.js. */
:root {
  --page: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f4f6fc;
  --ink: #0f172a;
  --ink-2: #475569;
  --muted: #94a3b8;
  --line: #e8ebf3;
  --line-2: #eef1f8;

  --rail-top: #0b1f45;
  --rail-bot: #061027;
  --rail-ink: #c7d3e8;
  --rail-muted: #8395b5;
  --rail-line: rgba(255, 255, 255, .09);

  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eaf1fe;
  --good: #16a34a;
  --good-soft: #eafaf0;
  --bad: #dc2626;
  --bad-soft: #fdeeee;
  --warn: #d97706;
  --warn-soft: #fff7ea;
  --violet: #7c3aed;
  --violet-soft: #f4f0ff;

  --series-blue: #2563eb;
  --series-orange: #f97316;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);
  --shadow-lift: 0 2px 6px rgba(15, 23, 42, .06), 0 14px 34px rgba(15, 23, 42, .08);

  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--ink); font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -0.015em; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(150deg, #0b1f45 0%, #061027 100%); }
.login-card { background: var(--surface); border-radius: 18px; padding: 36px 34px;
  width: 400px; max-width: 100%; box-shadow: 0 24px 60px rgba(4, 12, 32, .45); }
.login-mark { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 14px; }
.login-logo { height: 118px; width: auto; display: block; }
.login-mark .glyph { width: 42px; height: 42px; border-radius: 12px; background: var(--brand);
  display: grid; place-items: center; color: #fff; flex: 0 0 42px; }
.login-mark b { display: block; font-size: 16px; font-weight: 700; line-height: 1.2; }
.login-mark span { display: block; font-size: 12.5px; color: var(--ink-2); }
.login-sub { color: var(--ink-2); margin: 0 0 22px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font: 600 11px/1 var(--mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
.field input:focus, .field select:focus { outline: 2px solid var(--brand); outline-offset: 1px;
  border-color: var(--brand); }
.login-err { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.creds-sep { display: block; height: 1px; background: var(--line); margin: 10px 0; }
.demo-creds { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px;
  font: 12px/1.8 var(--mono); color: var(--ink-2); }
.demo-creds b { color: var(--ink); }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--brand); background: var(--brand); color: #fff;
  border-radius: var(--radius-sm); padding: 9px 16px; font-weight: 600; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background .14s; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.full { width: 100%; justify-content: center; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: #b91c1c; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.lg { padding: 11px 18px; box-shadow: 0 6px 16px rgba(37, 99, 235, .28); }
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--rail-top) 0%, var(--rail-bot) 100%);
  color: var(--rail-ink); position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; padding: 18px 0 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 18px 20px; }
.brand .glyph { width: 36px; height: 36px; border-radius: 11px; flex: 0 0 36px;
  background: #fff; border: 1px solid rgba(255, 255, 255, .16); overflow: hidden;
  display: grid; place-items: center; color: #fff; }
.brand .glyph img { width: 34px; height: 34px; display: block; }
.brand b { display: block; color: #fff; font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand span { display: block; color: var(--rail-muted); font-size: 12px; }
.nav-flow { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px;
  border: 0; background: none; text-align: left; color: var(--rail-muted); font-size: 13.5px;
  border-radius: var(--radius-sm); transition: background .13s, color .13s; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .32); }
.nav-item:focus-visible { outline: 2px solid #7fb0ff; outline-offset: -2px; }
.nav-sep { height: 1px; background: var(--rail-line); margin: 14px 24px; }
.rail-art { margin-top: auto; height: 152px; opacity: .55; pointer-events: none; }
.rail-art svg { width: 100%; height: 100%; display: block; }

.main { padding: 22px 26px 56px; min-width: 0; }
.main > * { max-width: 1640px; }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
.topbar h1 { font-size: 23px; margin: 0; font-weight: 700; }
.run-note { font: 12px var(--mono); color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.who { color: var(--ink-2); font-size: 13px; }
.who b { color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); display: grid; place-items: center; font: 700 12px var(--mono);
  border: 1px solid #d7e5fd; }
.range-pick { display: inline-flex; align-items: center; gap: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 11px;
  color: var(--ink); font-size: 13px; }
.range-pick svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 15px; }
.range-pick select { border: 0; background: none; color: var(--ink); font: 500 13px var(--sans);
  padding: 2px; cursor: pointer; }
.range-pick select:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 3px; font-size: 15.5px; font-weight: 700; }
.eyebrow { font: 600 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); }
.sub { color: var(--ink-2); font-size: 12.5px; margin: 4px 0 14px; }

.section-head { display: flex; align-items: center; gap: 12px; margin: 4px 2px 10px; }
.section-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.section-head::after { content: ""; flex: 1; height: 1px;
  background: repeating-linear-gradient(90deg, var(--line) 0 3px, transparent 3px 7px); }
.section-note { font-size: 12px; color: var(--muted); }

/* shared round glyph chip */
.icon-chip { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.icon-chip svg { width: 17px; height: 17px; }

/* ---------- workspace chip + empty state ---------- */
.ws-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font: 600 11.5px var(--sans); padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.ws-chip svg { width: 13px; height: 13px; }
.ws-chip.own { background: var(--brand-soft); border-color: #d7e5fd; color: var(--brand-dark); }

.empty-state { text-align: center; padding: 46px 28px 34px; max-width: 620px; margin: 24px auto; }
.empty-state .icon-chip { margin: 0 auto 14px; background: var(--brand-soft); color: var(--brand); }
.empty-state h2 { margin: 0 0 8px; font-size: 17px; }
.empty-state > p { color: var(--ink-2); font-size: 13.5px; margin: 0 auto; max-width: 46ch; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 20px 0 18px; }
.empty-state .sub { font-size: 12.2px; max-width: 52ch; margin: 0 auto; }

/* ---------- KPI tiles ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpi-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px)  { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card { display: block; text-align: left; width: 100%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px 14px; box-shadow: var(--shadow);
  transition: border-color .13s, box-shadow .13s; }
.kpi-card:hover { border-color: #d3dcef; box-shadow: var(--shadow-lift); }
.kpi-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.kpi-card.open { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-lift); }
.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; min-height: 30px; }
.kpi-top .icon-chip { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; }
.kpi-top .icon-chip svg { width: 14px; height: 14px; }
.klabel { font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 1.25; }
.kbody { display: flex; align-items: center; gap: 10px; }
.kvalue { font: 700 25px/1 var(--sans); font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em; white-space: nowrap; }
.kv-suffix { font-size: 16px; font-weight: 600; }
.kv-unit { font: 500 12px var(--mono); color: var(--ink-2); margin-left: 5px; }
.kv-empty { color: var(--muted); font-weight: 500; }
.kspark { flex: 1; min-width: 0; height: 26px; }
.kspark svg { width: 100%; height: 100%; display: block; }
.kd { font: 600 11.5px/1 var(--mono); white-space: nowrap; margin-left: auto; }
.kd.good { color: var(--good); }
.kd.bad { color: var(--bad); }
.kd.flat { color: var(--muted); font-weight: 500; }
.kmeter { position: relative; height: 6px; border-radius: 999px; background: var(--line); margin: 14px 0 0; }
.kmeter i { display: block; height: 100%; border-radius: 999px; }
.kmeter u { position: absolute; top: -3px; width: 2px; height: 12px; border-radius: 1px;
  background: var(--ink); opacity: .45; transform: translateX(-1px); }
.ktarget { font: 500 11px/1 var(--mono); color: var(--muted); margin-top: 9px; }
.kpi-trace:not(:empty) { margin: 12px 0 4px; }
.trace-card { border-color: var(--brand); margin-bottom: 0; }

/* ---------- insights ---------- */
.insights { background: linear-gradient(112deg, #ffffff 56%, #faf7ff 100%);
  border: 1px solid #ece6fb; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden; }
.insights-art { position: absolute; right: -12px; bottom: -16px; width: 200px; height: 84px;
  opacity: .38; pointer-events: none; }
.insights-head { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; position: relative; }
.insights-head .icon-chip { background: var(--violet-soft); color: var(--violet);
  border-radius: 9px; width: 28px; height: 28px; }
.insights-head b { color: var(--violet); font-size: 14.5px; font-weight: 700; }
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: relative; }
@media (max-width: 900px) { .insight-grid { grid-template-columns: 1fr; } }
.insight { padding: 0 22px; border-left: 1px solid #ece6fb; }
.insight:first-child { padding-left: 0; border-left: 0; }
@media (max-width: 900px) {
  .insight { padding: 14px 0 0; border-left: 0; border-top: 1px solid #ece6fb; }
  .insight:first-child { padding-top: 0; border-top: 0; }
}
.insight b { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.insight p { margin: 0 0 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.insight a { font-size: 12.5px; font-weight: 600; }

/* ---------- charts ---------- */
.fig { width: 100%; height: auto; display: block; }
.ax { font: 10px var(--mono); fill: var(--muted); }
.ax.dim { opacity: .65; }
.ax.lead { font-weight: 600; fill: var(--ink-2); }
.chart-box { overflow-x: auto; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2);
  margin: 2px 0 10px; flex-wrap: wrap; align-items: center; }
.chart-legend .sw { display: inline-block; width: 12px; height: 3px; border-radius: 2px;
  vertical-align: middle; margin-right: 6px; }
.chart-legend .sw.dash { background: none; border-top: 2px dashed var(--muted); height: 0; }

.donut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
.donut-cell { min-width: 0; }
.donut-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.donut-wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.donut-legend { flex: 1; min-width: 148px; display: grid; gap: 8px; }
.donut-row { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.donut-row .sw { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.donut-name { color: var(--ink-2); white-space: nowrap; }
.donut-pct { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums;
  color: var(--ink-2); }
.donut-val { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink);
  min-width: 72px; text-align: right; }
.donut-sub { font: 11.5px var(--mono); color: var(--muted); margin: 13px 0 0; }

.util-bar { background: var(--line); border-radius: 999px; height: 8px; width: 110px;
  display: inline-block; vertical-align: middle; overflow: hidden; }
.util-bar i { display: block; height: 100%; background: var(--series-blue); }
.util-bar i.over { background: var(--bad); }
.util-bar i.hot { background: #f59e0b; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { font: 600 10px/1.3 var(--mono); letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 130px; max-width: 260px; }
tbody tr:hover td { background: var(--surface-2); }
.tag { font: 600 11px var(--mono); color: var(--brand-dark); background: var(--brand-soft);
  padding: 2px 7px; border-radius: 5px; }
.late { color: var(--bad); font-weight: 600; }
.winner td { background: var(--brand-soft); }
.clickable { cursor: pointer; color: var(--brand); }
.clickable:hover { text-decoration: underline; text-decoration-style: dotted; }
th.clickable { color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; font: 600 11px/1 var(--mono);
  letter-spacing: .04em; text-transform: uppercase; padding: 4px 8px; border-radius: 5px; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 2px; }
.chip.critical, .chip.High { background: var(--bad-soft); color: #9c2323; }
.chip.critical::before, .chip.High::before { background: var(--bad); }
.chip.warning, .chip.Medium { background: var(--warn-soft); color: #7a5600; }
.chip.warning::before, .chip.Medium::before { background: #f59e0b; }
.chip.healthy, .chip.Low { background: var(--good-soft); color: #10693c; }
.chip.healthy::before, .chip.Low::before { background: #22c55e; }

/* ---------- the explain trace (signature) ---------- */
.trace { background: #0b1a36; color: #dbe7fb; font: 12.5px/1.85 var(--mono);
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 10px 0; overflow-x: auto;
  white-space: pre-wrap; }
.trace .op { color: #fbbf24; font-weight: 600; }
.trace .kw { color: #7fb0ff; }
.trace-title { font: 600 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 14px 0 0; }

/* ---------- controls ---------- */
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.controls .spacer { flex: 1 1 auto; }
.controls select, .controls input { padding: 8px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
.controls select:focus, .controls input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.pill-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: #fff; }
.pill-tabs.wrap { flex-wrap: wrap; }
.pill-tabs button { border: 0; background: none; padding: 8px 14px; color: var(--ink-2); font-size: 13px; }
.pill-tabs button:hover { background: var(--surface-2); }
.pill-tabs button.active { background: var(--brand); color: #fff; font-weight: 600; }

.override-input { width: 78px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px;
  font: 12.5px var(--mono); text-align: right; }
.override-input.has-ov { border-color: var(--series-orange); background: #fff4ed; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff;
  padding: 12px 17px; border-radius: var(--radius-sm); font-size: 13px; opacity: 0;
  transition: opacity .25s; z-index: 50; max-width: 420px; box-shadow: var(--shadow-lift); }
.toast.show { opacity: 1; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px 0; }
  .nav-flow { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .rail-art, .nav-sep { display: none; }
  .main { padding: 16px 14px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* ---------- modal (run warning, clear data, admin reset) ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(6, 16, 39, .55); z-index: 60;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: var(--radius); padding: 26px 28px 22px; max-width: 520px; width: 100%;
  box-shadow: var(--shadow-lift); }
.modal h2 { margin: 12px 0 8px; font-size: 18px; }
.modal-body p { margin: 0 0 10px; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.modal-body b { color: var(--ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.icon-chip.danger { color: var(--bad); background: var(--bad-soft); }
.modal .icon-chip { width: 40px; height: 40px; }
.modal .icon-chip svg { width: 20px; height: 20px; }

/* ---------- S&OP — single screen ---------- */
.sop-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 14px 20px; }
.sop-cycle b { font: 600 20px/1.2 var(--mono); letter-spacing: -.02em; display: block; }
.sop-ctl { display: flex; flex-direction: column; gap: 4px; }
.sop-ctl select { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; font-size: 13px; }
.sop-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
@media (max-width: 1100px) { .sop-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .sop-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sop-kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-align: left;
  display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: box-shadow .14s, border-color .14s; }
.sop-kpi:hover { border-color: var(--brand); box-shadow: var(--shadow-lift); }
.sop-kpi b { font: 600 24px/1.2 var(--mono); letter-spacing: -.02em; }
.sop-kpi .ksub { font-size: 12px; color: var(--ink-2); }
.sop-kpi.warn .ksub { color: #9c2323; font-weight: 600; }
.sop-kpi.warn { box-shadow: inset 3px 0 0 var(--bad); }
.exc-list { display: flex; flex-direction: column; gap: 6px; }
.exc-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; text-align: left; font-size: 13.5px; cursor: pointer; }
.exc-row:hover { background: var(--surface-2); }
.exc-row .chip { min-width: 34px; justify-content: center; }
.exc-go { margin-left: auto; color: var(--muted); display: inline-flex; }
.exc-go svg { width: 16px; height: 16px; }
.dec-list { display: flex; flex-direction: column; gap: 8px; }
.dec-row { display: grid; grid-template-columns: 34px 1fr auto auto auto auto; gap: 12px; align-items: center;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
@media (max-width: 900px) { .dec-row { grid-template-columns: 34px 1fr; } }
.dec-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #7a5600; background: var(--warn-soft); }
.dec-icon svg { width: 16px; height: 16px; }
.dec-icon.capacity { color: #9c2323; background: var(--bad-soft); }
.dec-icon.excess { color: var(--brand-dark); background: var(--brand-soft); }
.dec-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dec-body .sub { margin: 0; font-size: 12px; }
.dec-action { font: 600 12px var(--mono); color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.dec-action svg { width: 14px; height: 14px; }
.dec-edit { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dec-edit[hidden], [hidden] { display: none !important; }
.dec-edit select, .dec-edit input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; background: #fff; }
.dec-edit input { flex: 1 1 220px; }
.sop-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; position: sticky; bottom: 12px; z-index: 5;
  box-shadow: var(--shadow-lift); }
.sop-foot .run-note { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sop-reports { position: relative; }
.sop-reports summary { list-style: none; cursor: pointer; }
.sop-reports summary::-webkit-details-marker { display: none; }
.sop-reports summary svg:last-child { width: 14px; height: 14px; }
.sop-menu { position: absolute; bottom: calc(100% + 8px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift); padding: 6px; display: flex; flex-direction: column; min-width: 280px; z-index: 6; }
.sop-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--ink); font-size: 13px; }
.sop-menu a:hover { background: var(--surface-2); text-decoration: none; }
.sop-menu a svg { width: 15px; height: 15px; color: var(--muted); }
.drill { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.drill h3 { font-size: 13px; margin: 14px 0 6px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; font-family: var(--mono); }
.grid-tbl td.num, .grid-tbl th.num { font-size: 12px; padding-left: 8px; padding-right: 8px; }
.grid-tbl tr.total td { border-top: 2px solid var(--ink); background: var(--surface-2); }
tr.late-row td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

/* ---------- evaluation copy ---------- */
.test-mode body, .test-mode .main, .test-mode .sidebar { user-select: none; -webkit-user-select: none; }
.test-mode input, .test-mode textarea, .test-mode select { user-select: text; -webkit-user-select: text; }
.test-mode a[download]:not(.keep-dl), .test-mode #mexport, .test-mode [data-t] .btn { display: none !important; }
.test-mode img, .test-mode svg { -webkit-user-drag: none; }
.watermark { position: fixed; right: 18px; bottom: 14px; z-index: 40; pointer-events: none;
  font: 600 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: rgba(15, 23, 42, .28); }
@media print { .test-mode #app { display: none; } }
.demo-creds svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }

/* ---------- reports hub: pick many, download once ---------- */
.reports-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; }
.reports-bar .sub { margin: 0; }
.rsel-group { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.reports-tbl td.rsel-cell { width: 28px; }
.reports-tbl input[type=checkbox], .rsel-group input { width: 15px; height: 15px; accent-color: var(--brand); }
.rsel-actions { white-space: nowrap; display: flex; gap: 6px; justify-content: flex-end; }
.test-mode .reports-bar, .test-mode .rsel-cell, .test-mode .rsel-group { display: none !important; }
