/* ==========================================================================
   VFF Shipment Tracker: Vanta Forward Foundation
   Monochrome brand (black ink on warm white). Color is reserved for data:
   stage colors (validated color-blind-safe in this order) + status red/green.
   ========================================================================== */

:root {
  /* Brand ink & surfaces */
  --ink: #0b0b0b;
  --ink-2: #2b2b29;
  --text: #1c1c1a;
  --text-2: #52514e;
  --muted: #6f6e69;
  --faint: #a3a29c;
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #f1f0ec;
  --line: #e6e5e0;
  --line-2: #efeee9;
  --focus: #2a78d6;

  /* Stage colors: categorical slots in fixed order (never re-ordered) */
  --s0: #a3a29c;
  --s1: #2a78d6;  /* Order form submitted - blue */
  --s2: #eb6834;  /* Sent to PCs for People - orange */
  --s3: #1baf7a;  /* Invoice paid - aqua */
  --s4: #eda100;  /* Shipped - yellow */
  --s5: #e87ba4;  /* Arrived at school - magenta */
  --s6: #008300;  /* Receipt signed - green */

  /* Single-series data color */
  --series: #2a78d6;

  /* Status (reserved; always shown with an icon + label) */
  --crit: #d03b3b;
  --crit-bg: #fcf0ef;
  --crit-line: #f2cfcc;
  --good: #0ca30c;
  --good-text: #006300;
  --good-bg: #eef7ee;
  --good-line: #cde6cd;
  --info-bg: #eef4fc;
  --info-text: #1c5cab;
  --info-line: #cfe0f5;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 2px 8px rgba(11, 11, 11, .04);
  --shadow-lg: 0 4px 12px rgba(11, 11, 11, .06), 0 16px 40px rgba(11, 11, 11, .08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Avenir Next", "Avenir", "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 600; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--font); }
code { background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.icon { flex: 0 0 auto; display: inline-block; vertical-align: -0.18em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { font-weight: 600; }
.sub { color: var(--muted); font-size: 12.5px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.crit { color: var(--crit); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.ok-text { color: var(--good-text); display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }


/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main { padding: 34px 44px 60px; max-width: 1360px; width: 100%; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--ink); color: #b9b8b2;
  display: flex; flex-direction: column; padding: 22px 16px 16px;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; color: #fff; }
.side-brand:hover { text-decoration: none; }
.side-mark { width: 40px; height: auto; }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.side-brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; letter-spacing: .01em; }
.side-brand-sub { font-size: 11.5px; color: #8d8c86; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }

.side-new {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: #fff; color: var(--ink); font-weight: 600; font-size: 14px;
  padding: 10px 12px; border-radius: 10px; margin: 0 4px 18px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.side-new:hover { text-decoration: none; box-shadow: 0 0 0 4px rgba(255,255,255,.12); }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: #6f6e69; padding: 16px 12px 6px; }
.side-label:first-child { padding-top: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px;
  color: #c9c8c2; font-size: 14px; font-weight: 500;
}
.side-nav a:hover { background: #1b1b1a; color: #fff; text-decoration: none; }
.side-nav a.active { background: #232321; color: #fff; }
.side-nav a.active .icon { color: #fff; }
.side-nav .icon { color: #8d8c86; }
.side-count {
  margin-left: auto; font-size: 11.5px; font-weight: 600; color: #a3a29c;
  background: #1f1f1d; border-radius: 999px; padding: 1px 8px; min-width: 24px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.side-count.alert { background: var(--crit); color: #fff; }

.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #222220; padding: 14px 6px 2px; margin-top: 16px; }
.side-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #2a2a28; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: 0 0 auto; }
.side-user-name { color: #e7e6e1; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: #8d8c86; cursor: pointer; padding: 7px 8px; border-radius: 8px; font: inherit; font-size: 12.5px; }
.side-logout:hover { background: #1b1b1a; color: #fff; }

/* ==========================================================================
   Page header & generic layout
   ========================================================================== */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.eyebrow { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.page-sub { color: var(--text-2); margin: 6px 0 0; font-size: 15px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; font-weight: 500; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); text-decoration: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px; }
.card-flush { padding: 0; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.link-more:hover { color: var(--ink); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.grid-2 > .card, .col-stack > .card:last-child { margin-bottom: 0; }
.grid-2 { margin-bottom: 22px; }
.grid-wide-left { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.grid-detail { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.col-stack { display: flex; flex-direction: column; gap: 22px; }

/* ==========================================================================
   Buttons, pills, chips
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; box-shadow: 0 1px 1px rgba(11,11,11,.03);
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--surface-2); border-color: #d6d5cf; text-decoration: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2a2a28; border-color: #2a2a28; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 11px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line-2);
}
.badge .dot, .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.badge-num { color: var(--muted); font-weight: 600; }

.pill-stuck, .pill-alert, .pill-ok, .count-pill {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; font-weight: 700; white-space: nowrap;
}
.pill-stuck { background: var(--crit); color: #fff; font-size: 10.5px; padding: 2px 8px 2px 6px; text-transform: uppercase; letter-spacing: .04em; }
.pill-alert { background: var(--crit-bg); color: var(--crit); border: 1px solid var(--crit-line); font-size: 12.5px; padding: 5px 11px; }
.pill-alert:hover { text-decoration: none; background: #f9e3e1; }
.pill-ok { background: var(--good-bg); color: var(--good-text); border: 1px solid var(--good-line); font-size: 12px; padding: 4px 10px; }
.count-pill { background: var(--surface-3); color: var(--text-2); font-size: 12px; padding: 3px 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.chip .icon { color: var(--muted); }

/* ==========================================================================
   Flash messages & banners
   ========================================================================== */
.flashes { display: grid; gap: 10px; margin-bottom: 22px; }
.flash {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px 11px 15px; border-radius: 11px;
  border: 1px solid transparent; font-size: 14px; font-weight: 500; transition: opacity .4s ease, transform .4s ease;
}
.flash > span { flex: 1; }
.flash.fade { opacity: 0; transform: translateY(-4px); pointer-events: none; }
.flash-success { background: var(--good-bg); color: var(--good-text); border-color: var(--good-line); }
.flash-error { background: var(--crit-bg); color: #a32b2b; border-color: var(--crit-line); }
.flash-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-line); }
.flash-x { background: none; border: 0; color: inherit; opacity: .55; cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.flash-x:hover { opacity: 1; background: rgba(0,0,0,.05); }

.banner { display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-radius: 12px; margin-bottom: 22px; font-size: 14px; border: 1px solid; }
.banner-crit { background: var(--crit-bg); color: #a32b2b; border-color: var(--crit-line); }
.banner-ok { background: var(--good-bg); color: var(--good-text); border-color: var(--good-line); }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; position: relative; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--ink); display: grid; place-items: center; margin-bottom: 14px; }
.kpi-label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 650; letter-spacing: -.02em; color: var(--ink); line-height: 1.2; margin: 2px 0 4px; }
.kpi-sub { color: var(--muted); font-size: 12.5px; }

/* Segmented bar: computers by stage (tall variant: 28px, 4px corners, 2px gaps) */
.segbar { display: flex; gap: 2px; height: 28px; margin: 4px 0 12px; }
.segbar-part { min-width: 6px; border-radius: 4px; display: flex; align-items: center; padding: 0 9px; color: #fff; font-size: 12px; font-weight: 700; cursor: default; font-variant-numeric: tabular-nums; }
.segbar-part.dark-label { color: var(--ink); }
.segbar-part:hover, .segbar-part:focus-visible { filter: brightness(.94); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 22px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }

.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stage-tile {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 16px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); overflow: hidden;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.stage-tile:hover { text-decoration: none; border-color: #d3d2cc; box-shadow: var(--shadow-lg); transform: translateY(-1px); background: var(--surface); }
.stage-tile-bar { position: absolute; left: 0; top: 0; right: 0; height: 4px; }
.stage-tile-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.stage-tile-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); }
.stage-tile-step { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stage-tile-name { font-weight: 600; font-size: 13.5px; color: var(--ink); min-height: 2.6em; line-height: 1.3; }
.stage-tile-count { font-size: 28px; font-weight: 650; color: var(--ink); letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.stage-tile-count small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stage-tile-comp { font-size: 12.5px; color: var(--text-2); }
.stage-tile-next { font-size: 12px; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 5px; }

/* To-do list */
.todo { list-style: none; margin: 0 -8px; padding: 0; }
.todo-row { display: flex; align-items: center; gap: 13px; padding: 11px 10px; border-radius: 10px; color: var(--text); }
.todo-row:hover { background: var(--surface-2); text-decoration: none; }
.todo li + li .todo-row { border-top: 1px solid var(--line-2); border-radius: 0 0 10px 10px; }
.todo-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.todo-icon.s4 { color: var(--ink); }
.todo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.todo-action { font-weight: 600; color: var(--ink); }
.todo-school { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-meta { display: flex; align-items: center; gap: 8px; }
.todo-days { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.todo-row.is-stuck .todo-days { color: var(--crit); font-weight: 700; }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 10px 0; }
.feed li + li { border-top: 1px solid var(--line-2); }
.feed-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--ink-2); margin-top: 1px; }
.feed-body { flex: 1; min-width: 0; }
.feed-line { display: flex; justify-content: space-between; gap: 10px; }
.feed-line a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-time { font-size: 12px; color: var(--faint); white-space: nowrap; }
.feed-text { font-size: 13px; color: var(--text-2); }

/* Event-type icon tones (shared by feed + timeline): neutral, with status for done/undo */
.ev-stage_completed .feed-icon, .ev-stage_completed .tl-icon { background: var(--good-bg); color: var(--good-text); }
.ev-stage_undone .feed-icon, .ev-stage_undone .tl-icon { background: var(--crit-bg); color: var(--crit); }
.ev-created .feed-icon, .ev-created .tl-icon { background: var(--ink); color: #fff; }
.feed-icon.ev-stage_completed { background: var(--good-bg); color: var(--good-text); }
.feed-icon.ev-stage_undone { background: var(--crit-bg); color: var(--crit); }
.feed-icon.ev-created { background: var(--ink); color: #fff; }

/* Column chart (single series): bars <= 24px, 4px rounded tops, hairline grid */
.colchart { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: 210px auto; column-gap: 10px; }
.colchart-y { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin: -7px 0; }
.colchart-plot { position: relative; border-bottom: 1px solid #d9d8d2; }
.gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line-2); }
.colchart-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; border-radius: 6px; }
.col:hover { background: rgba(11, 11, 11, .025); }
.col-bar { width: min(24px, 60%); background: var(--series); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.col:hover .col-bar, .col:focus-visible .col-bar { filter: brightness(.9); }
.col-label { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.colchart-x { display: flex; padding-top: 7px; }
.colchart-x span { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.table-toggle { margin-top: 16px; }
.table-toggle summary { cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.table-toggle summary:hover { color: var(--ink); }
.table-toggle .table { margin-top: 10px; }

/* Horizontal bars (single series): value at the tip */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 6px 6px; border-radius: 8px; cursor: default; }
.hbars li:hover { background: var(--surface-2); }
.hbar-label { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; display: flex; align-items: center; }
.hbar { height: 14px; background: var(--series); border-radius: 0 4px 4px 0; min-width: 3px; }
.hbar-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.hbars-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 10px; padding: 10px 6px 0; font-weight: 700; font-size: 13.5px; }

/* Tooltip */
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: #f0efec; font-size: 12.5px; line-height: 1.45; padding: 8px 11px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 260px; }
.tip b { color: #fff; }

/* ==========================================================================
   Toolbar / filters
   ========================================================================== */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.toolbar select { width: auto; min-width: 150px; }
.toolbar-spacer { flex: 1; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; display: flex; align-items: center; }
.search .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input[type=search] { padding-left: 37px; }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.check-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--text-2); }
.check-chip input { margin: 0; accent-color: var(--crit); }
.check-chip.on { background: var(--crit-bg); border-color: var(--crit-line); color: var(--crit); }
.visually-hidden-btn { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; border: 0; }
.result-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 4px 2px 14px; min-height: 36px; }
.sort select { width: auto; padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.result-line strong { color: var(--ink); }
.clear-link { display: inline-flex; align-items: center; gap: 3px; color: var(--text-2); font-weight: 600; }

.seg-toggle { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; border: 1px solid var(--line); }
.seg-toggle a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg-toggle a:hover { color: var(--ink); text-decoration: none; }
.seg-toggle a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(11,11,11,.08); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  font-weight: 600; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table.compact th { background: none; padding: 6px 8px; }
.table.compact td { padding: 7px 8px; }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table.compact th:first-child, .table.compact td:first-child { padding-left: 8px; }
.w-chev { width: 36px; color: var(--faint); padding-right: 16px !important; }
tr:hover .w-chev { color: var(--ink); }
.school-link { font-weight: 600; color: var(--ink); }
.next-cell { color: var(--text-2); }
.days { font-variant-numeric: tabular-nums; }
.row-stuck td { background: #fffafa; }
.row-stuck td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.row-stuck .days { color: var(--crit); font-weight: 700; }
.table tbody tr.row-stuck:hover td { background: #fdf3f2; }

.progress-wrap { margin-top: 7px; }
.progress { display: inline-flex; gap: 2px; }
.progress .seg { width: 16px; height: 4px; border-radius: 2px; background: var(--line); }

/* ==========================================================================
   Board view
   ========================================================================== */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.board-col { background: var(--surface-3); border-radius: var(--radius); padding: 12px; border: 1px solid var(--line-2); min-height: 200px; }
.board-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px 0; }
.board-bar { width: 4px; align-self: stretch; border-radius: 2px; }
.board-title { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-height: 3.4em; }
.board-step { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.board-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.board-count { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; }
.board-sub { font-size: 11.5px; color: var(--muted); padding: 6px 4px 10px; display: flex; align-items: flex-start; gap: 5px; min-height: 3.6em; }
.board-sub .icon { margin-top: 2px; }
.board-cards { display: flex; flex-direction: column; gap: 9px; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--text); box-shadow: 0 1px 2px rgba(11,11,11,.04); transition: box-shadow .12s ease, transform .12s ease; }
.board-card:hover { text-decoration: none; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.board-card.is-stuck { border-color: var(--crit-line); box-shadow: inset 3px 0 0 var(--crit); }
.board-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.board-card-name { font-weight: 600; color: var(--ink); line-height: 1.3; }
.board-card-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.board-card-meta { display: flex; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.board-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.board-card-meta .icon { color: var(--faint); }
.board-card-vol { font-size: 11.5px; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 5px; }
.board-empty { font-size: 12.5px; color: var(--faint); text-align: center; padding: 24px 0; border: 1px dashed #dcdbd5; border-radius: 10px; }

/* ==========================================================================
   Archive
   ========================================================================== */
.mini-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden; }
.mini-stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; }
.mini-stat + .mini-stat { border-left: 1px solid var(--line-2); }
.mini-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.mini-value { font-size: 22px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }

/* ==========================================================================
   Order page
   ========================================================================== */
.order-hero { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.order-hero-icon { width: 56px; height: 56px; border-radius: 15px; background: var(--ink); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.order-hero-main { flex: 1; min-width: 260px; }
.order-hero-main .eyebrow { margin-bottom: 4px; }
.order-hero-actions { display: flex; align-items: center; gap: 10px; }

.stepper { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 6px; }
.step-line { position: absolute; top: 18px; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.step:first-child .step-line { display: none; }
.step-line.filled { background: var(--ink); }
.step-dot {
  position: relative; z-index: 1; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line); color: var(--faint); margin-bottom: 10px;
  box-shadow: 0 0 0 4px var(--surface);
}
.step.done .step-dot { border-color: transparent; color: #fff; }
.step.done .step-dot.s4 { color: var(--ink); }
.step.current .step-dot { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px var(--surface-3); }
.step-num { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.step-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; margin: 2px 0; }
.step.todo .step-name { color: var(--faint); }
.step-date { font-size: 12px; color: var(--text-2); }
.step.current .step-date { color: var(--ink); font-weight: 600; }

.next-step {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 24px; padding: 16px 18px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.next-step-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.next-step-icon.s4 { color: var(--ink); }
.next-step-text { flex: 1; min-width: 200px; }
.next-step-text .eyebrow { margin-bottom: 2px; }
.next-step-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink); }
.next-step-sub { font-size: 13px; color: var(--muted); }
.next-step-fields { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

.dl-group + .dl-group { border-top: 1px solid var(--line-2); margin-top: 16px; padding-top: 16px; }
.dl-group h3 { margin-bottom: 10px; }
.dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.notes { margin: 0; color: var(--text); font-size: 14px; }

.files { list-style: none; margin: 0 0 14px; padding: 0; }
.files li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.file-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-3); color: var(--ink); display: grid; place-items: center; flex: 0 0 auto; }
.file-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-inner {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 22px 16px; border: 1.5px dashed #d3d2cc; border-radius: 12px; background: var(--surface-2); cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.dropzone-inner:hover, .dropzone.drag .dropzone-inner { border-color: var(--ink); background: var(--surface); }
.dropzone.has-file .dropzone-inner { border-style: solid; border-color: var(--ink); background: var(--surface); }
.dropzone-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); margin-bottom: 4px; }
.dropzone-title { font-weight: 600; color: var(--ink); }
.dropzone-sub { font-size: 12.5px; color: var(--muted); }
.dropzone input[type=file]:focus-visible + .dropzone-inner { outline: 2px solid var(--focus); outline-offset: 2px; }

.note-form { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-bottom: 20px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl { position: relative; display: flex; gap: 13px; padding-bottom: 18px; }
.tl:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 1.5px; background: var(--line); }
.tl-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); display: grid; place-items: center; flex: 0 0 auto; position: relative; z-index: 1; }
.tl-body { flex: 1; min-width: 0; padding-top: 3px; }
.tl-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; }
.tl-title { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.tl-time { font-size: 12px; color: var(--faint); }
.tl-text { font-size: 13.5px; color: var(--text-2); margin-top: 1px; }
.tl-note { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 11px; margin-top: 6px; color: var(--text); }

/* ==========================================================================
   Forms
   ========================================================================== */
input[type=text], input[type=email], input[type=number], input[type=password], input[type=search], input[type=date], select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid #dcdbd5; border-radius: 10px; padding: 9px 12px; width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6e69' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
input:hover, select:hover, textarea:hover { border-color: #c7c6c0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(11, 11, 11, .08); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field-sm input { padding: 8px 11px; min-width: 160px; }
.field-sm { font-size: 12px; color: var(--muted); }
.req { color: var(--crit); }
.opt { font-weight: 400; color: var(--faint); font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.stack { display: grid; gap: 16px; }

.input-prefix, .input-suffix { position: relative; display: flex; align-items: center; }
.input-prefix span { position: absolute; left: 12px; color: var(--muted); font-weight: 500; }
.input-prefix input { padding-left: 26px; }
.input-suffix span { position: absolute; right: 12px; color: var(--muted); font-weight: 500; }
.input-suffix input { padding-right: 52px; }

.form-card { padding: 0; }
.form-section { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 28px; padding: 26px 28px; }
.form-section + .form-section { border-top: 1px solid var(--line-2); }
.form-section-head h2 { margin: 10px 0 4px; }
.form-section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.form-section-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-3); color: var(--ink); display: grid; place-items: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; align-content: start; }
.form-grid .span-2 { grid-column: span 2; }
.field-actions { display: flex; align-items: flex-end; }
.form-actions {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 16px 28px;
  background: rgba(250, 250, 248, .92); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.check-list li { display: flex; gap: 11px; align-items: flex-start; font-size: 14px; color: var(--text); }
.check-list .icon { color: var(--muted); margin-top: 2px; }

/* Export page */
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.action-card { display: flex; flex-direction: column; margin-bottom: 0; }
.action-icon { width: 46px; height: 46px; border-radius: 13px; background: var(--ink); color: #fff; display: grid; place-items: center; margin-bottom: 16px; }
.action-card p { color: var(--text-2); font-size: 13.5px; margin: 6px 0 18px; flex: 1; }
.action-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 13px; }
.help-card { margin-top: 22px; }
.help-card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.help-card ol { margin: 0; padding-left: 20px; color: var(--text-2); line-height: 1.9; }

/* Empty states */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 34px 16px; gap: 6px; }
.empty-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); margin-bottom: 6px; }
.empty-title { font-weight: 600; color: var(--ink); font-size: 15px; }
.empty-text { color: var(--muted); font-size: 13.5px; max-width: 340px; margin-bottom: 8px; }
.error-card { max-width: 520px; margin: 60px auto; }

/* ==========================================================================
   Login
   ========================================================================== */
.login-body { background: var(--surface); }
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.login-art { background: var(--ink); color: #b9b8b2; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; gap: 28px; }
.login-logo { width: min(340px, 70%); height: auto; }
.login-tag { font-family: var(--font-display); font-size: 16px; color: #8d8c86; text-align: center; margin: 0; max-width: 320px; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-box { width: 100%; max-width: 360px; }
.login-mark { width: 52px; height: auto; margin-bottom: 18px; }
.login-box h1 { font-size: 28px; }
.login-box > .muted { margin: 6px 0 26px; }
.login-box .flashes { margin-bottom: 18px; }
.login-foot { display: flex; align-items: center; gap: 6px; justify-content: center; color: var(--faint); font-size: 12px; margin-top: 26px; }
.standalone { margin: 0 auto; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1020px) {
  .grid-2, .grid-wide-left, .grid-detail { grid-template-columns: 1fr; }
  .form-section { grid-template-columns: 1fr; gap: 16px; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-stat + .mini-stat { border-left: 0; }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 20px; }
  .step:nth-child(4) .step-line { display: none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; }
  .side-brand { padding: 0; }
  .side-new { margin: 0 0 0 auto; }
  .side-nav { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; }
  .side-label, .side-count { display: none; }
  .side-foot { border: 0; margin: 0; padding: 0; }
  .main { padding: 22px 16px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 36px 24px; }
  .login-logo { width: 200px; }
}

/* ==========================================================================
   Stage colors (last, so they win over component backgrounds)
   ========================================================================== */
.s0, .seg.s0, .step-dot.s0 { background: var(--s0); }
.s1, .seg.s1, .step-dot.s1 { background: var(--s1); }
.s2, .seg.s2, .step-dot.s2 { background: var(--s2); }
.s3, .seg.s3, .step-dot.s3 { background: var(--s3); }
.s4, .seg.s4, .step-dot.s4 { background: var(--s4); }
.s5, .seg.s5, .step-dot.s5 { background: var(--s5); }
.s6, .seg.s6, .step-dot.s6 { background: var(--s6); }
.field-label { display: inline-flex; align-items: baseline; gap: 4px; }

/* Simplified headers */
.card-note { font-size: 12.5px; color: var(--faint); white-space: nowrap; padding-top: 3px; }
.card-header h2 { line-height: 1.4; }
.login-box h1 { margin-bottom: 26px; }
.stage-tile-name { min-height: 0; }
.board-title { min-height: 0; }
.board-sub { min-height: 0; }
.stage-tile-step { font-size: 12px; font-weight: 700; color: var(--ink-2); letter-spacing: 0; }
.step-num { font-size: 11px; font-weight: 700; color: var(--faint); letter-spacing: 0; }

/* Documents card (request form + receipt) */
.doc-group + .doc-group { border-top: 1px solid var(--line-2); margin-top: 18px; padding-top: 18px; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.doc-head h3 { margin: 0; }
.dropzone-inner { padding: 16px 14px; }
.file-input { padding: 9px 12px; border: 1.5px dashed #d3d2cc; border-radius: 10px; background: var(--surface-2); font: inherit; font-size: 13.5px; cursor: pointer; }

/* Missing tracking number (warning: icon + label, never color alone) */
.banner-warn { background: #fff8e6; color: #7a5200; border-color: #f3dfa6; }
.tracking-banner { flex-wrap: wrap; }
.tracking-banner .tracking-text { flex: 1; min-width: 220px; }
.tracking-banner input[type=text] { width: 220px; padding: 7px 10px; background: #fff; }
.tag-warn { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 11px; font-weight: 700; color: #7a5200; background: #fff3d1; border: 1px solid #f3dfa6; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.board-card-tag { margin-top: 2px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill-warn { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; font-weight: 700; white-space: nowrap; background: #fff8e6; color: #7a5200; border: 1px solid #f3dfa6; font-size: 12.5px; padding: 5px 11px; }
.pill-warn:hover { text-decoration: none; background: #fff1cc; }
.check-chip.warn input { accent-color: #b07a00; }
.check-chip.warn.on { background: #fff8e6; border-color: #f3dfa6; color: #7a5200; }

/* hidden means hidden, even for buttons */
[hidden] { display: none !important; }
/* keep the filter row on one line on a laptop screen */
.toolbar .search { flex: 1 1 200px; max-width: 280px; }
.toolbar select { min-width: 0; max-width: 170px; }
.check-chip { padding: 8px 11px; font-size: 13px; white-space: nowrap; }

/* Change a completed stage's date */
.step-edit { position: relative; }
.step-edit summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 1px 6px; }
.step-edit summary::-webkit-details-marker { display: none; }
.step-edit summary .icon { color: var(--faint); }
.step-edit summary:hover { background: var(--surface-3); color: var(--ink); }
.step-edit summary:hover .icon { color: var(--ink); }
.step-edit[open] summary { background: var(--surface-3); color: var(--ink); }
.step-edit-pop {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: flex-end; gap: 8px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); text-align: left; white-space: nowrap;
}
.step-edit-pop input[type=date] { min-width: 150px; }
