/* ==========================================================================
   THE BRIDGE — one stylesheet
   Dark-first by intent: every prototype in the Post-Sprint spec is dark, the
   app runs on shop floors and in trucks, and the Gantt boards read better on
   a dark ground. Single committed theme, every color painted explicitly.
   ========================================================================== */

:root {
  color-scheme: dark;

  --ground:      #0b0f15;
  --surface:     #131a23;
  --surface-2:   #19222d;
  --surface-3:   #202b38;
  --line:        #26323f;
  --line-soft:   #1c2530;

  --ink:         #e3ebf4;
  --ink-dim:     #8a9bad;
  --ink-faint:   #5d6d7e;

  --accent:      #3d8ee8;
  --accent-soft: rgba(61, 142, 232, 0.14);
  --accent-line: rgba(61, 142, 232, 0.42);

  --good:        #40a86a;
  --warn:        #d4a129;
  --bad:         #e05c4f;
  --navy:        #3a5c96;
  --orange:      #d9822b;

  --rail: 232px;
  --topbar: 52px;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Barlow", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --r: 6px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

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

/* ---- micro-label: the signature of the system ------------------------- */
.lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Shell
   ========================================================================== */

#app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  height: var(--topbar);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}

.wordmark {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
}
.wordmark em { font-style: normal; color: var(--accent); }

.crumb {
  color: var(--ink-faint);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb b { color: var(--ink); font-weight: 600; }

.topbar .spacer { flex: 1 1 auto; }

.topbar-ctl { display: flex; align-items: center; gap: 8px; }

.rail-toggle {
  display: none;
  background: none; border: 1px solid var(--line);
  border-radius: var(--r); width: 32px; height: 30px;
  cursor: pointer; color: var(--ink-dim);
}

select.ctl, input.ctl, textarea.ctl {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  padding: 5px 9px;
  font-size: 12.5px;
  max-width: 100%;
}
select.ctl:hover, input.ctl:hover { border-color: var(--line); background: var(--surface-3); }
input.ctl::placeholder { color: var(--ink-faint); }

.badge-env {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em;
  border: 1px solid var(--line); color: var(--ink-faint);
  padding: 3px 7px; border-radius: 3px; white-space: nowrap;
}

/* ---- body split -------------------------------------------------------- */
.shell { flex: 1 1 auto; display: flex; min-height: 0; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px 0 40px;
}

.rail-group { margin-bottom: 4px; }
.rail-group > .lbl { padding: 12px 16px 6px; display: block; }

.rail a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px 6px 14px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
}
.rail a:hover { background: var(--surface-2); color: var(--ink); }
.rail a.on {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}
.rail a .count {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-faint);
}
.rail a.on .count { color: var(--accent); }
.rail a .soon {
  margin-left: auto; font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.08em; color: var(--warn); opacity: 0.75;
}

.main { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; min-width: 0; }

.page { padding: 22px 24px 64px; max-width: 1560px; }

.page-head { margin-bottom: 20px; }
.page-head h1 {
  font-size: 25px; font-weight: 700; margin: 3px 0 0;
  letter-spacing: -0.01em; text-wrap: balance;
}
.page-head .rule { width: 34px; height: 2px; background: var(--accent); margin: 9px 0 10px; }
.page-head p { color: var(--ink-dim); margin: 0; max-width: 70ch; font-size: 13px; }

.head-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head-row .spacer { flex: 1 1 auto; }

/* ==========================================================================
   Primitives
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.card-head {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card-head h2 { font-size: 14.5px; font-weight: 600; margin: 0; }
.card-head .spacer { flex: 1 1 auto; }
.card-body { padding: 14px; }
.card-foot {
  padding: 10px 14px; border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 12px;
}

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.g4x { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .g4x { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px)  { .g4x { grid-template-columns: 1fr; } }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* stat tile — used only where the figure is the point */
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 13px 12px;
}
.tile .lbl { display: block; margin-bottom: 5px; }
.tile .v {
  font-size: 25px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.tile .v small { font-size: 13px; font-weight: 600; color: var(--ink-dim); }
.tile .sub { color: var(--ink-faint); font-size: 11.5px; margin-top: 3px; }
.tile.good .v { color: var(--good); }
.tile.bad .v { color: var(--bad); }
.tile.warn .v { color: var(--warn); }

/* buttons */
.btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 5px 11px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--accent-line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: none; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.sm { padding: 3px 8px; font-size: 11.5px; }

.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 7px 12px; cursor: pointer; color: var(--ink-dim); font-size: 13px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button .n {
  font-family: var(--mono); font-size: 10px; margin-left: 5px; color: var(--ink-faint);
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button {
  background: var(--surface); border: none; padding: 4px 10px;
  font-size: 12px; cursor: pointer; color: var(--ink-dim);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }

/* pills */
.pill {
  display: inline-block;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-dim);
  white-space: nowrap;
}
.pill.good { color: var(--good); border-color: rgba(64,168,106,0.45); background: rgba(64,168,106,0.1); }
.pill.warn { color: var(--warn); border-color: rgba(212,161,41,0.45); background: rgba(212,161,41,0.1); }
.pill.bad  { color: var(--bad);  border-color: rgba(224,92,79,0.45);  background: rgba(224,92,79,0.1); }
.pill.info { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.light { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; }
.light.green { background: var(--good); }
.light.yellow { background: var(--warn); }
.light.red { background: var(--bad); }

/* links to records — the thing that makes this one app */
.rec {
  color: var(--accent); cursor: pointer; text-decoration: none;
  border-bottom: 1px solid transparent;
}
.rec:hover { border-bottom-color: var(--accent-line); }

/* ---- tables ------------------------------------------------------------ */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 500;
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
table.t td {
  padding: 8px 10px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.t tbody tr:hover { background: var(--surface-2); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.group td {
  background: var(--surface-2); font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-dim); padding: 6px 10px;
}
table.t tr.total td { border-top: 1px solid var(--line); font-weight: 600; }
table.t .muted { color: var(--ink-faint); }
table.t .sub2 { display: block; color: var(--ink-faint); font-size: 11px; }

.empty {
  padding: 28px 14px; text-align: center; color: var(--ink-faint); font-size: 13px;
}

/* ---- forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > .lbl { margin-bottom: 1px; }
.field input, .field select, .field textarea {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 6px 9px; font-size: 13px; width: 100%;
}
.field textarea { resize: vertical; min-height: 62px; }
.fgrid { display: grid; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); }

/* ---- modal + drawer ---------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(4, 7, 11, 0.62);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; width: min(660px, 100%);
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.modal-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
.x {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--ink-faint); font-size: 18px; line-height: 1; padding: 2px 4px;
}
.x:hover { color: var(--ink); }

.drawer-scrim {
  position: fixed; inset: 0; background: rgba(4, 7, 11, 0.55); z-index: 90;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(1080px, 96vw);
  background: var(--ground);
  border-left: 1px solid var(--line);
  z-index: 91;
  display: flex; flex-direction: column;
  box-shadow: -14px 0 44px rgba(0,0,0,0.5);
}
.drawer-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: var(--surface); flex: 0 0 auto;
}
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 48px; }

.drawer-split { display: flex; gap: 16px; align-items: flex-start; }
.drawer-menu {
  width: 178px; flex: 0 0 178px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); overflow: hidden;
  position: sticky; top: 0;
}
.drawer-menu button {
  display: flex; width: 100%; text-align: left; gap: 8px;
  background: none; border: none; border-left: 2px solid transparent;
  padding: 7px 12px; cursor: pointer; color: var(--ink-dim); font-size: 12.5px;
}
.drawer-menu button:hover { background: var(--surface-2); color: var(--ink); }
.drawer-menu button.on {
  background: var(--accent-soft); border-left-color: var(--accent);
  color: var(--ink); font-weight: 600;
}
.drawer-menu button .count { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.drawer-pane { flex: 1 1 auto; min-width: 0; }

/* stage bar */
.stagebar { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 10px; }
.stagebar span {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em;
  padding: 3px 9px; background: var(--surface-2);
  color: var(--ink-faint); border: 1px solid var(--line-soft);
  text-transform: uppercase;
}
.stagebar span.done { color: var(--ink-dim); }
.stagebar span.now {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}

/* ==========================================================================
   Gantt + schedule boards
   ========================================================================== */

.board { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.board-scroll { overflow-x: auto; }
.gt { border-collapse: collapse; width: 100%; font-size: 12px; }
.gt th {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.07em;
  color: var(--ink-faint); font-weight: 500; text-transform: uppercase;
  padding: 6px 4px; border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-soft); text-align: center;
  background: var(--surface); white-space: nowrap;
}
.gt th.rowhead, .gt td.rowhead {
  position: sticky; left: 0; z-index: 3; background: var(--surface);
  text-align: left; min-width: 208px; max-width: 208px;
  border-right: 1px solid var(--line);
}
.gt td {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  height: 30px; padding: 0; position: relative;
}
.gt td.cell { min-width: 34px; }
.gt tbody tr:hover td.rowhead { background: var(--surface-2); }
.gt .rowhead .pname {
  display: block; padding: 5px 8px; font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gt .rowhead .meta { color: var(--ink-faint); font-size: 10.5px; }
.gt tr.subrow td.rowhead .pname { padding-left: 22px; color: var(--ink-dim); }
.gt td.weekend { background: rgba(255,255,255,0.016); }
.gt td.today { box-shadow: inset 1px 0 0 var(--accent); }

.bar {
  position: absolute; top: 5px; bottom: 5px;
  border-radius: 3px; font-size: 10.5px; line-height: 20px;
  padding: 0 6px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; cursor: pointer; color: #fff;
  border: 1px solid rgba(0,0,0,0.3);
}
.bar.c-default { background: #2b3644; color: var(--ink); }
.bar.c-territory { background: var(--terr, #8c2f39); }
.bar.c-green { background: var(--good); }
.bar.c-yellow { background: var(--warn); color: #2b1f00; }
.bar.c-red { background: var(--bad); }
.bar.c-navy { background: var(--navy); }
.bar.c-orange { background: var(--orange); color: #2b1600; }
.bar.pinned {
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.22) 0 4px, transparent 4px 8px);
  cursor: default;
}
.bar.done { opacity: 0.45; text-decoration: line-through; }

.capacity-row td { background: var(--surface-2); height: 26px; }
.capacity-row td.rowhead { background: var(--surface-2); }
.capacity-row .v {
  display: block; text-align: center; font-family: var(--mono);
  font-size: 11px; padding: 4px 2px; cursor: pointer;
}
.capacity-row .v.deficit { color: var(--bad); font-weight: 600; }
.capacity-row .v.surplus { color: var(--good); }

/* installer board */
.slot {
  position: absolute; left: 1px; right: 1px;
  border-radius: 3px; font-size: 10px; line-height: 1.15;
  padding: 2px 4px; overflow: hidden; cursor: pointer;
  color: #fff; border: 1px solid rgba(0,0,0,0.3);
}
.slot.custom { border-style: dashed; background: #2b3644; color: var(--ink-dim); }
.bank {
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.chip {
  display: block; width: 100%; text-align: left;
  font-size: 10.5px; padding: 3px 5px; margin: 2px 0;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 3px; cursor: pointer; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip.armed { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }

.hint {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 18px; z-index: 80;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 600;
  padding: 7px 14px; border-radius: 999px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.45);
}

/* ---- KPI grid ---------------------------------------------------------- */
.kpi-cell { text-align: center; font-variant-numeric: tabular-nums; }
.kpi-cell .v { display: block; font-size: 12.5px; }
.kpi-cell .meter {
  display: block; height: 2px; margin: 3px auto 0; width: 34px;
  background: var(--line); position: relative;
}
.kpi-cell .meter i { position: absolute; top: 0; bottom: 0; display: block; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.zero { color: var(--ink-faint); }

/* ---- charts ------------------------------------------------------------ */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-dim); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.hbar { display: grid; grid-template-columns: 148px 1fr 62px; gap: 9px; align-items: center; margin-bottom: 7px; font-size: 12.5px; }
.hbar .track { background: var(--surface-2); height: 15px; border-radius: 2px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--accent); }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-dim); font-size: 12px; }

/* ---- notice ------------------------------------------------------------ */
.notice {
  border: 1px solid var(--line); border-left: 2px solid var(--accent);
  background: var(--surface); border-radius: var(--r);
  padding: 11px 13px; font-size: 12.5px; color: var(--ink-dim);
}
.notice.warn { border-left-color: var(--warn); }
.notice b { color: var(--ink); font-weight: 600; }
.notice p { margin: 6px 0 0; }

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  background: var(--surface-3); border: 1px solid var(--accent-line);
  border-left: 2px solid var(--accent);
  border-radius: var(--r); padding: 10px 14px; font-size: 12.5px;
  max-width: 340px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar-ctl select.ctl { width: 104px; text-overflow: ellipsis; }
  .badge-env { display: none; }
  .rail {
    position: fixed; top: var(--topbar); bottom: 0; left: 0; z-index: 50;
    transform: translateX(-100%); transition: transform 0.16s ease;
  }
  .rail.open { transform: none; }
  .rail-toggle { display: block; }
  .page { padding: 16px 16px 56px; }
  .drawer-split { flex-direction: column; }
  .drawer-menu { width: 100%; flex: 0 0 auto; position: static; display: flex; overflow-x: auto; }
  .drawer-menu button { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; }
  .drawer-menu button.on { border-left: none; border-bottom-color: var(--accent); }
  .crumb { display: none; }
}

/* ---- timeline track ---------------------------------------------------- */
.gt td.track { padding: 0; position: relative; }
.track-inner {
  position: relative; height: 30px;
  background-image: linear-gradient(to right, var(--line-soft) 0 1px, transparent 1px);
  background-size: var(--colw) 100%;
  background-repeat: repeat;
}
.track-inner.tall { height: 34px; }
.gt tr.capacity-row .track-inner { height: 26px; }
.track-note {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: flex-end; padding-right: 8px;
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  pointer-events: none;
}
.cap-cell {
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10.5px; cursor: pointer;
}
.cap-cell:hover { background: var(--surface-3); }
.bar.dragging { opacity: 0.75; z-index: 5; }
.gt .today-line {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--accent); opacity: 0.55; pointer-events: none;
}
.swatches {
  position: absolute; z-index: 60; display: flex; gap: 3px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--r); padding: 4px;
}
.swatches button {
  width: 18px; height: 18px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.35);
  cursor: pointer; padding: 0;
}

/* ==========================================================================
   Material lifecycle
   ========================================================================== */
.notice.bad { border-left-color: var(--bad); }

/* % complete control — Partial / Full */
.pctc { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; }
.pctc label { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-dim); cursor: pointer; }
.pctc input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.pctc .pctn { width: 56px; text-align: right; font-family: var(--mono); padding: 3px 6px; }
.pctc .pctn:disabled { opacity: 0.45; }
.pctc.compact { gap: 5px; }
.pctc.compact .pctn { width: 50px; }

/* readiness marker on mobilization bars */
.rd-mark {
  font-style: normal; font-weight: 700; display: inline-block; min-width: 13px; height: 13px;
  line-height: 13px; text-align: center; border-radius: 50%; margin-right: 4px; font-size: 10px;
  background: #0b0f15; vertical-align: 1px;
}
.rd-mark.bad { color: #ff8a7e; }
.rd-mark.warn { color: var(--warn); }

/* load-up: mobilization list + pick ticket */
.loadup { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .loadup { grid-template-columns: 1fr; } }
.mob-list { display: flex; flex-direction: column; max-height: 70vh; overflow-y: auto; }
.mob-list button {
  background: none; border: none; border-bottom: 1px solid var(--line-soft); text-align: left;
  padding: 9px 12px; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  border-left: 2px solid transparent;
}
.mob-list button span { color: var(--ink-dim); font-size: 12px; }
.mob-list button:hover { background: var(--surface-2); }
.mob-list button.on { background: var(--accent-soft); border-left-color: var(--accent); }
.ticket { background: var(--surface); border: 1px solid var(--ink-faint); border-radius: var(--r); }
.ticket-head {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px;
  padding: 12px 14px; border-bottom: 2px solid var(--ink-dim);
}
.ticket-head .lbl { display: block; margin-bottom: 2px; }
.ticket-head b { font-weight: 600; }
.ticket table.t td { border-bottom: 1px dashed var(--line); }
.tick-box { display: inline-block; width: 15px; height: 15px; border: 1.5px solid var(--ink-dim); border-radius: 2px; vertical-align: middle; }
.num.neg, .neg { color: var(--bad); }
.num.pos, .pos { color: var(--good); }

/* pay application builder */
.pa-shell {
  position: fixed; inset: 0; z-index: 95; background: var(--ground);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.pa-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.pa-top h2 { margin: 2px 0 0; font-size: 17px; font-weight: 700; }
.pa-top h2 .muted { color: var(--ink-dim); font-weight: 500; font-size: 14px; }
.pa-top .spacer { flex: 1 1 auto; }
.pa-tabs { padding: 0 18px; background: var(--surface); }
.pa-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 60px; }
.pa-y { background: rgba(212, 161, 41, 0.08) !important; border-color: rgba(212, 161, 41, 0.45) !important; }
.pa-d { width: 110px; text-align: right; }
.g703t th.ctlhead, .g703t td.ctlcell { background: rgba(61, 142, 232, 0.07); }
.g703t td { padding: 6px 8px; }
tr.pa-label td { background: var(--surface-2); }

/* paper preview of the G702 */
.paper-wrap { overflow-x: auto; padding: 16px; background: #d9dde2; }
.sheet {
  width: 8.5in; min-height: 10in; margin: 0 auto; background: #fff; color: #000;
  padding: 0.45in 0.5in; font: 9pt/1.28 "Times New Roman", Times, serif;
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}
.sheet .ttl { text-align: center; font-size: 12.5pt; font-weight: 700; letter-spacing: 0.4px; }
.sheet .sub { text-align: center; font-size: 8.5pt; margin-bottom: 8px; }
.sheet .k { font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 700; }
.sheet .v { font-weight: 700; min-height: 11px; }
.g702top { display: grid; grid-template-columns: 1.3fr 1.05fr 1.05fr; border: 1px solid #000; }
.g702top > div { padding: 5px 7px; border-right: 1px solid #000; }
.g702top > div:last-child { border-right: 0; }
.g702mid { display: grid; grid-template-columns: 1.02fr 1fr; border: 1px solid #000; border-top: 0; }
.g702mid > div { padding: 6px 8px; }
.g702mid > div:first-child { border-right: 1px solid #000; }
.sheet table.lines { width: 100%; border-collapse: collapse; }
.sheet table.lines td { padding: 2px 0; vertical-align: bottom; }
.sheet table.lines td.d { border-bottom: 1px dotted #555; width: 100%; }
.sheet table.lines td.m { text-align: right; white-space: nowrap; padding-left: 10px; font-variant-numeric: tabular-nums; }
.sheet table.lines td.m span { display: inline-block; min-width: 92px; border-bottom: 1px solid #000; text-align: right; padding: 0 3px; }
.sheet table.lines tr.strong td { font-weight: 700; }
.sheet table.co { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 8.4pt; }
.sheet table.co th, .sheet table.co td { border: 1px solid #000; padding: 2px 5px; }
.sheet table.co td.n { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .cert { font-size: 7.9pt; text-align: justify; }
.sheet .sig { font-size: 8.4pt; margin-top: 8px; line-height: 1.9; }
.sheet .amtcert { border: 1px solid #000; padding: 4px 7px; margin-top: 8px; font-weight: 700; display: flex; justify-content: space-between; }
/* G702 prints landscape: four header boxes across */
.sheet.land { width: 11in; min-height: 8.5in; padding: 0.4in 0.5in; }
.sheet.land .g702top { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* ==========================================================================
   Proposal print
   --------------------------------------------------------------------------
   The proposal PDF is the browser's own print, so this is the whole of it:
   a sheet sized to US Letter on screen, and a print block that hides the
   application around it. No library, no server, and the layout is CSS
   anyone can change rather than coordinates in someone's script.
   ========================================================================== */

.printwrap {
  position: fixed; inset: 0; z-index: 400;
  background: var(--surface-1);
  display: flex; flex-direction: column;
}
.printbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); flex: 0 0 auto;
}
.sheetwrap { flex: 1 1 auto; overflow: auto; padding: 24px 16px 48px; }

.sheet {
  width: 8.5in; min-height: 11in; margin: 0 auto; padding: 0.75in 0.8in;
  background: #ffffff; color: #16202b;
  font-family: Barlow, system-ui, sans-serif; font-size: 11pt; line-height: 1.5;
  box-shadow: 0 2px 24px rgba(0,0,0,0.5);
}
.sheet .phead {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2px solid #16202b; padding-bottom: 10px; margin-bottom: 22px;
}
.sheet .pbrand { font-size: 17pt; font-weight: 700; letter-spacing: 0.06em; }
.sheet .pmeta { font-size: 9pt; color: #5d6d7e; }
.sheet .pmeta.right { text-align: right; }
.sheet .ptitle { font-size: 19pt; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.sheet .psub { font-size: 11pt; color: #5d6d7e; margin: 2px 0 20px; }

.sheet .pinfo { width: 100%; border-collapse: collapse; margin-bottom: 24px; font-size: 9.5pt; }
.sheet .pinfo td { padding: 3px 10px 3px 0; vertical-align: top; }
.sheet .pinfo td:nth-child(odd) {
  color: #5d6d7e; text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 8pt; width: 1%; white-space: nowrap; padding-top: 5px;
}

.sheet .psec { margin-bottom: 20px; break-inside: avoid; }
.sheet .psec h3 {
  font-size: 10pt; text-transform: uppercase; letter-spacing: 0.08em;
  margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid #c9d2db;
}
.sheet .psec p { margin: 0 0 8px; white-space: pre-wrap; }

.sheet .ptable { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 10pt; }
.sheet .ptable th, .sheet .ptable td { padding: 5px 8px; border-bottom: 1px solid #e2e8ee; }
.sheet .ptable th {
  font-size: 8pt; text-transform: uppercase; letter-spacing: 0.06em;
  color: #5d6d7e; border-bottom: 1px solid #16202b;
}
.sheet .ptable .n { text-align: right; font-variant-numeric: tabular-nums; }
.sheet .ptable .grand td { border-top: 1px solid #16202b; border-bottom: none; }
.sheet .pfoot {
  margin-top: 28px; padding-top: 10px; border-top: 1px solid #c9d2db;
  font-size: 9pt; color: #5d6d7e;
}

@media print {
  body.printing > #app, body.printing > .scrim,
  body.printing > .drawer, body.printing > .drawer-scrim,
  body.printing > .toast, body.printing .printbar { display: none !important; }
  body.printing { background: #fff; }
  .printwrap { position: static; display: block; }
  .sheetwrap { overflow: visible; padding: 0; }
  .sheet { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .sheet .psec { break-inside: avoid; }
  @page { size: letter; margin: 0.7in; }
}

@media (max-width: 900px) {
  .sheet { width: auto; padding: 24px 18px; }
}

/* ==========================================================================
   Backlog Runout — a wide month grid with the identifying columns pinned
   --------------------------------------------------------------------------
   Twenty-four month columns do not fit on any screen, so the project name
   and its status stay put while the months scroll under them. Everything
   here is scoped to .fc-grid; the ordinary tables elsewhere are untouched.
   ========================================================================== */
.fc-grid { overflow: auto; max-height: min(74vh, 780px); }
.fc-grid table.t { min-width: max-content; }
.fc-grid thead th { position: sticky; top: 0; z-index: 5; background: var(--surface-2); }
.fc-grid th.fc-stick, .fc-grid td.fc-stick { position: sticky; background: var(--surface); z-index: 3; }
.fc-grid thead th.fc-stick { z-index: 7; }
.fc-grid th.fc-name, .fc-grid td.fc-name {
  left: 0; min-width: 210px; max-width: 240px; text-align: left;
}
.fc-grid th.fc-stat, .fc-grid td.fc-stat {
  left: 210px; min-width: 116px; text-align: left;
  border-right: 2px solid var(--line-2, var(--line));
}
.fc-grid tbody tr:hover td { background: var(--surface-2); }
.fc-grid tbody tr:hover td.fc-stick { background: var(--surface-2); }
.fc-grid th.mo { min-width: 78px; }
.fc-grid th.mo.jan, .fc-grid td.mo.jan { border-left: 2px solid var(--line-2, var(--line)); }
.fc-grid tfoot td { position: sticky; bottom: 0; z-index: 6; background: var(--surface-3, var(--surface-2)); font-weight: 600; }
.fc-grid tfoot td.fc-stick { z-index: 8; }

/* A cell carrying an override, so an edited figure never looks derived. */
.fc-grid td.over, table.sum td.over { background: var(--accent-soft, rgba(61,142,232,.12)); }

/* Where the Monthly Gantt says something different, its figure sits faintly
   behind the forecast's. The two are separate numbers by design; this only
   makes the gap visible, and nothing here reads from the board. */
.fc-grid td.cell.sched { position: relative; }
.fc-grid span.schedghost {
  position: absolute; left: 6px; bottom: 1px; pointer-events: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 9px;
  color: var(--ink-faint); opacity: .8;
}
.fc-grid td.cell { padding: 0 4px; }
.fc-grid input.daycell {
  width: 100%; min-width: 58px; border: 0; background: transparent; text-align: right;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px;
  font-variant-numeric: tabular-nums; padding: 4px 4px; color: inherit;
  -moz-appearance: textfield;
}
.fc-grid input.daycell::-webkit-outer-spin-button,
.fc-grid input.daycell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fc-grid td.cell:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }

/* A link that is really a button — used where a figure opens its editor. */
.lnk {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
  cursor: pointer; text-align: inherit; border-bottom: 1px solid transparent;
}
.lnk:hover { border-bottom-color: var(--accent); }
.lnk.num { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* Summary tables: quarter and year rollups read heavier than their months. */
table.sum tr.qtr td { background: var(--surface-2); font-weight: 600; }
table.sum tr.yr td {
  background: var(--surface-3, var(--surface-2)); font-weight: 700;
  border-top: 1px solid var(--line-2, var(--line));
}
table.sum input.goalcell {
  width: 100%; min-width: 74px; border: 0; background: transparent; text-align: right;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px;
  font-variant-numeric: tabular-nums; padding: 2px 4px; color: inherit;
  -moz-appearance: textfield;
}
table.sum input.goalcell::-webkit-outer-spin-button,
table.sum input.goalcell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
table.sum td.goal:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }

/* ==========================================================================
   After Action Review
   ========================================================================== */
.rdo { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 2px 0; cursor: pointer; }
.rdo input { cursor: pointer; margin: 0; }
label.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
label.chk input { margin: 0; cursor: pointer; }
ul.tight { margin: 0 0 4px; padding-left: 18px; }
ul.tight li { margin: 2px 0; font-size: 12.5px; color: var(--ink-dim); }
tr.late td { background: color-mix(in srgb, var(--bad) 8%, transparent); }

/* Onboarding: rows the Bridge has ruled out read quieter than open ones. */
tr.na td { opacity: .5; }
tr.open td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
