/*
 * Stordax platform — internal ops UI.
 *
 * Colour roles come from the validated data-viz palette: categorical slots 1 and 3 carry the
 * only two identities the map encodes (lead, client), everything else is ink or surface, and
 * status colours stay reserved for state and always ship with a label beside them.
 *
 * Dark values are declared twice on purpose: the media query follows the OS, the [data-theme]
 * scope lets the header toggle win in both directions.
 */

:root {
  color-scheme: light;

  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --surface-sunken: #f2f1ed;
  --ink: #0b0b0b;
  --ink-secondary: #52514e;
  --ink-muted: #898781;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);

  /* Categorical slot 1 / slot 3 — the map's two identities. Validated all-pairs, both modes. */
  --lead: #2a78d6;
  --client: #1baf7a;
  --context: #898781;

  /* Sequential blue, for magnitude (lead bars, staleness). */
  --seq-100: #cde2fb;
  --seq-250: #86b6ef;
  --seq-450: #2a78d6;
  --seq-600: #184f95;

  /* Reserved status — never reused as a series colour, never shown without its label. */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --radius: 10px;
  --radius-sm: 6px;
  --gap: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --surface-sunken: #131312;
    --ink: #ffffff;
    --ink-secondary: #c3c2b7;
    --ink-muted: #898781;
    --line: #2c2c2a;
    --line-strong: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --lead: #3987e5;
    --client: #199e70;
    --seq-100: #104281;
    --seq-250: #184f95;
    --seq-450: #3987e5;
    --seq-600: #86b6ef;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --surface-sunken: #131312;
  --ink: #ffffff;
  --ink-secondary: #c3c2b7;
  --ink-muted: #898781;
  --line: #2c2c2a;
  --line-strong: #383835;
  --ring: rgba(255, 255, 255, 0.10);
  --lead: #3987e5;
  --client: #199e70;
  --seq-100: #104281;
  --seq-250: #184f95;
  --seq-450: #3987e5;
  --seq-600: #86b6ef;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- shell ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
/* The wordmark is the one place Inter Tight appears; everything else stays on the system face. */
@font-face { font-family: 'Inter Tight'; src: url('/fonts/inter-tight-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-family: 'Inter Tight', system-ui, sans-serif; font-weight: 800; font-size: 1.05rem; letter-spacing: -0.035em; text-decoration: none; white-space: nowrap; color: inherit; }
.brand .mark { width: 1.05rem; height: 1.05rem; flex: none; }
.brand span { color: var(--ink-muted); font-weight: 400; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: -0.01em; }
.masthead nav { display: flex; gap: 0.25rem; margin-right: auto; flex-wrap: wrap; }
.masthead nav a {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-secondary);
  font-weight: 500;
}
.masthead nav a:hover { background: var(--surface-sunken); color: var(--ink); }
.masthead nav a[aria-current="page"] { background: var(--ink); color: var(--plane); }

.whoami { display: flex; flex-direction: column; line-height: 1.25; text-align: right; min-width: 0; }
.whoami .who { font-weight: 600; }
.whoami .scope { font-size: 0.78rem; color: var(--ink-muted); max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main.centred { display: flex; align-items: center; justify-content: center; min-height: 100vh; max-width: none; padding: 2rem 1rem; }
.signin { width: min(24rem, 100%); }
.signin h1 { margin-bottom: 0.1rem; }
.signin .sub { color: var(--ink-secondary); margin: 0 0 1.25rem; }
.signin form { display: grid; gap: 0.85rem; }
.signin .field { display: grid; gap: 0.3rem; }
.signin label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); font-weight: 600; }
.signin input {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
}
.signin button {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--plane);
  cursor: pointer;
}
.signin .empty-state { margin-top: 1rem; font-size: 0.85rem; }

.stage-form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.stage-form select {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
}
.stage-form button, .note-form button {
  font: inherit;
  font-weight: 550;
  padding: 0.35rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--plane);
  cursor: pointer;
}
.stage-form .empty-state { padding: 0; flex: 1 1 16rem; font-size: 0.85rem; }

.note-form { display: grid; gap: 0.5rem; justify-items: start; margin-bottom: 1rem; }
.note-form textarea {
  font: inherit;
  width: 100%;
  resize: vertical;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
}

.feed-item .actor {
  color: var(--ink-muted);
  font-size: 0.8rem;
  border: 1px solid var(--ring);
  border-radius: 999px;
  padding: 0.02rem 0.4rem;
  white-space: nowrap;
}

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

.theme-toggle {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-secondary);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-muted); }

main { max-width: 1240px; margin: 0 auto; padding: 1.75rem 1.5rem 5rem; }

.page-head { margin-bottom: 1.5rem; }
h1 { font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 0.2rem; font-weight: 650; }
.page-head p { margin: 0; color: var(--ink-secondary); }

h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.card + .card, section + section { margin-top: var(--gap); }
.grid-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--gap); margin-top: var(--gap); align-items: start; }
.grid-2 > section { margin-top: 0; }

/* ---------- stat tiles ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; }
.kpi dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-muted); font-weight: 600; }
.kpi dd { margin: 0.35rem 0 0; font-size: 2rem; line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; }
.kpi .note { display: block; font-size: 0.8rem; color: var(--ink-secondary); font-weight: 400; letter-spacing: 0; margin-top: 0.15rem; }
.kpi.is-lead dd { color: var(--lead); }
.kpi.is-client dd { color: var(--client); }

/* ---------- map ---------- */

.map-card { padding: 0; overflow: hidden; }
.map-head { display: flex; align-items: baseline; gap: 1rem; padding: 1.15rem 1.25rem 0.85rem; flex-wrap: wrap; }
.map-head h2 { margin: 0; }
/* A short, wide container forces the fit to the north–south extent and pads the sides with a
   whole neighbouring country; a taller panel keeps the country the subject. */
#map { height: 560px; background: var(--surface-sunken); }
.leaflet-container { font: inherit; background: var(--surface-sunken); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }
.leaflet-popup-content { margin: 0.7rem 0.9rem; line-height: 1.45; }
.leaflet-popup-content .pop-name { font-weight: 600; display: block; }
.leaflet-popup-content .pop-meta { color: var(--ink-secondary); font-size: 0.85rem; }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--surface-sunken); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--ink-muted); }
.leaflet-control-attribution a { color: var(--ink-secondary); }

.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-left: auto; font-size: 0.85rem; color: var(--ink-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.legend .ramp { gap: 0.5rem; }
.legend .ramp .swatch + .swatch { margin-left: -0.4rem; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; }
.swatch.s1 { background: var(--seq-100); }
.swatch.s2 { background: var(--seq-250); }
.swatch.s3 { background: var(--seq-450); }
.swatch.s4 { background: var(--seq-600); }
.swatch.client-ring { background: var(--seq-250); box-shadow: 0 0 0 2px var(--client); }

.map-empty { padding: 2.5rem 1.25rem 3rem; text-align: center; color: var(--ink-secondary); }

/* ---------- horizontal bars ---------- */

.bars { display: grid; gap: 0.55rem; }
.bar-row { display: grid; grid-template-columns: 8.5rem 1fr auto; align-items: center; gap: 0.75rem; }
.bar-row .label { color: var(--ink-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; background: var(--surface-sunken); border-radius: 3px; height: 10px; }
.bar-fill { display: block; height: 10px; background: var(--seq-450); border-radius: 0 4px 4px 0; min-width: 3px; }
.bar-row .value { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -1.25rem -1.15rem; padding: 0 1.25rem 1.15rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.55rem 1rem 0.55rem 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 600;
  border-bottom-color: var(--line-strong);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-sunken); }
td.num, th.num { text-align: right; padding-right: 1.5rem; font-variant-numeric: tabular-nums; }
td.name a { font-weight: 550; text-decoration: none; }
td.name a:hover { text-decoration: underline; }
td.muted, .muted { color: var(--ink-muted); }
/* Keep free text from pushing a row's actions off the horizontal scroll. */
td.truncate { max-width: 15rem; overflow: hidden; text-overflow: ellipsis; }
.cell-note { display: inline-block; max-width: 20rem; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; color: var(--ink-muted); }
th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--ink); }
th .sort-arrow { color: var(--ink); }

.staleness { display: inline-flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }
.staleness .track { display: block; width: 52px; height: 6px; border-radius: 3px; background: var(--surface-sunken); flex: none; }
.staleness .fill { display: block; height: 6px; border-radius: 0 3px 3px 0; background: var(--seq-450); min-width: 2px; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.5rem 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 550;
  border: 1px solid var(--ring);
  background: var(--surface-sunken);
  color: var(--ink-secondary);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.lead { color: var(--lead); background: color-mix(in srgb, var(--lead) 11%, transparent); }
.badge.client { color: var(--client); background: color-mix(in srgb, var(--client) 13%, transparent); }
.badge.unknown { color: var(--serious); background: color-mix(in srgb, var(--serious) 15%, transparent); }
.badge.never { color: var(--critical); background: color-mix(in srgb, var(--critical) 12%, transparent); }
.badge.plain::before { display: none; }

/* ---------- filters ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.filters select {
  font: inherit;
  padding: 0.35rem 1.6rem 0.35rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23898781' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 0.45rem center/12px;
  color: inherit;
  appearance: none;
  cursor: pointer;
}
.filters button {
  font: inherit;
  font-weight: 550;
  padding: 0.35rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--plane);
  cursor: pointer;
}
.filters .reset { color: var(--ink-secondary); text-decoration: none; padding: 0.35rem 0.4rem; }
.filters .reset:hover { color: var(--ink); text-decoration: underline; }
.result-count { margin-left: auto; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ---------- request form & notices ---------- */

.notice { border-radius: var(--radius); padding: 0.7rem 1rem; margin-bottom: var(--gap); border: 1px solid var(--ring); }
.notice.ok { background: color-mix(in srgb, var(--good) 12%, transparent); }
.notice.error { background: color-mix(in srgb, var(--critical) 12%, transparent); }
.notice code { background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 0.1rem 0.35rem; border-radius: 4px; }

.request-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem; }
.request-form .field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 6rem; }
.request-form .field.grow { flex: 1 1 14rem; }
.request-form .field.narrow { max-width: 7rem; }
.request-form label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); font-weight: 600; }
.request-form label .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.request-form input {
  font: inherit;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  min-width: 0;
}
.request-form input:focus-visible { outline: 2px solid var(--lead); outline-offset: 1px; }
.request-form button {
  font: inherit;
  font-weight: 550;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--plane);
  cursor: pointer;
}

.tag.overdue { background: var(--critical, #b3261e); color: #fff; }
form.inline { display: inline; }
form.inline input[type="text"] { font: inherit; font-size: 0.85rem; padding: 0.15rem 0.4rem; margin: 0 0.4rem 0 0.6rem; width: min(24rem, 60vw); }
.stamp-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.stamp-form input { flex: 1 1 18rem; font: inherit; padding: 0.35rem 0.5rem; }
.feed-item.unanswered .what { font-weight: 500; }
.link-button { font: inherit; background: none; border: none; padding: 0; color: var(--ink-secondary); cursor: pointer; text-decoration: underline; }
.link-button:hover { color: var(--critical); }

/* ---------- activity feed ---------- */

.feed { display: grid; gap: 0.1rem; }
.feed-item { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: none; }
.feed-item time { color: var(--ink-muted); font-variant-numeric: tabular-nums; font-size: 0.85rem; white-space: nowrap; }
.feed-item .what { color: var(--ink-secondary); overflow: hidden; text-overflow: ellipsis; }
.feed-item .what a { font-weight: 550; color: var(--ink); text-decoration: none; }
.feed-item .what a:hover { text-decoration: underline; }

/* ---------- pipeline board ---------- */

.board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.85rem; align-items: start; }
.column { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem; min-height: 7rem; }
.column h3 { margin: 0 0 0.6rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-secondary); display: flex; justify-content: space-between; gap: 0.5rem; }
.column h3 .count { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.column .stage-bar { height: 3px; border-radius: 2px; margin-bottom: 0.7rem; }
.ticket { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.55rem 0.65rem; text-decoration: none; margin-bottom: 0.5rem; }
.ticket:last-child { margin-bottom: 0; }
.ticket:hover { border-color: var(--ink-muted); }
.ticket .t-name { font-weight: 550; display: block; overflow-wrap: break-word; }
.ticket .t-meta { color: var(--ink-muted); font-size: 0.8rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column .empty { color: var(--ink-muted); font-size: 0.85rem; padding: 0.25rem; }

/* ---------- business detail ---------- */

.detail-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.detail-head .titles { margin-right: auto; }
.detail-head h1 { margin-bottom: 0.25rem; }
.detail-head .addr { color: var(--ink-secondary); margin: 0; }
.crumb { display: inline-block; color: var(--ink-secondary); text-decoration: none; margin-bottom: 0.9rem; }
.crumb:hover { color: var(--ink); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.facts > div { min-width: 0; }
.facts dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); font-weight: 600; }
.facts dd { margin: 0.2rem 0 0; overflow-wrap: break-word; }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.links li { display: flex; gap: 0.6rem; align-items: baseline; }
.links .kind { color: var(--ink-muted); min-width: 5.5rem; font-size: 0.85rem; }
.links a { overflow-wrap: anywhere; }
.links .method { color: var(--ink-muted); font-size: 0.8rem; }

pre {
  margin: 0;
  padding: 0.9rem;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.empty-state { color: var(--ink-secondary); padding: 0.5rem 0 0.25rem; }
/* §20.86: their website today, with the findings for the sales conversation. */
.website-today h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); font-weight: 600; margin: 1.4rem 0 0.2rem; }
.review-head { display: grid; gap: 0.6rem; }
.review-score { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; margin: 0; }
.review-score strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.review-summary { padding: 1rem 1.2rem 1.1rem; border-radius: var(--radius-sm); border-left: 4px solid var(--lead); background: color-mix(in srgb, var(--lead) 9%, transparent); }
.review-summary span { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--lead); margin-bottom: 0.35rem; }
.review-summary p { margin: 0; font-size: 1.25rem; line-height: 1.45; font-weight: 500; color: var(--ink); text-wrap: pretty; }
.findings { list-style: none; margin: 0; padding: 0; }
.finding { display: grid; gap: 0.3rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.finding:last-child { border-bottom: none; padding-bottom: 0; }
.finding-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.finding-head strong { font-size: 1.02rem; font-weight: 600; overflow-wrap: break-word; }
.finding-detail { margin: 0; color: var(--ink); overflow-wrap: break-word; }
.finding-why { margin: 0; color: var(--ink-secondary); font-size: 0.92rem; overflow-wrap: break-word; }
.finding-why span { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; color: var(--ink-muted); margin-bottom: 0.1rem; }
.finding-where { margin: 0; color: var(--ink-muted); font-size: 0.82rem; }
.finding-where a { color: inherit; }
.empty-state code { background: var(--surface-sunken); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }

/* ---------- client delivery ---------- */

/*
 * The delivery timeline and the publish gate. State never rides on colour alone: every step
 * carries its mark and its label, and an overdue request says "due" next to the date.
 */
.delivery { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; gap: 0.1rem; }
.delivery .step { display: grid; grid-template-columns: 1.2rem 1fr auto; gap: 0.6rem; align-items: baseline; padding: 0.4rem 0; border-bottom: 1px solid var(--line); color: var(--ink-muted); }
.delivery .step:last-child { border-bottom: none; }
.delivery .step .mark { text-align: center; }
.delivery .is-done { color: var(--ink-secondary); }
.delivery .is-done .mark { color: var(--good); }
.delivery .is-current { color: var(--ink); font-weight: 550; }
.delivery .is-current .mark { color: var(--lead); }
.delivery .owner { color: var(--ink-muted); font-weight: 400; font-size: 0.85rem; }
.delivery time { color: var(--ink-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.blockers { margin: 0 0 1.2rem; padding-left: 1.1rem; color: var(--ink-secondary); }
.blockers li { padding: 0.15rem 0; }

.ticket .t-step { display: block; margin-top: 0.3rem; font-size: 0.78rem; color: var(--ink-secondary); border-top: 1px solid var(--line); padding-top: 0.3rem; }
.ticket .t-step.is-client { color: var(--serious); }
.ticket .t-step.is-done { color: var(--client); }

/* Past the two working days we promised. The word "due" carries it; the rule is the accent. */
.feed-item.overdue { border-left: 3px solid var(--critical); padding-left: 0.6rem; }
.feed-item.overdue time { color: var(--critical); font-weight: 550; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  main { padding: 1.25rem 1rem 4rem; }
  /* Two rows on a phone: identity and controls above, the nav as its own full-width row.
     Squeezing all of it onto one line wraps the name and truncates the territory. */
  .masthead { gap: 0.5rem 0.75rem; padding: 0.55rem 0.85rem; flex-wrap: wrap; }
  .brand { margin-right: auto; }
  .brand span { display: none; }
  .masthead nav { order: 3; width: 100%; gap: 0; margin-right: 0; overflow-x: auto; }
  .masthead nav a { padding: 0.3rem 0.6rem; }
  /* Name over territory keeps the first row narrow enough for the sign-out and the toggle. */
  .whoami { text-align: left; }
  .whoami .scope { max-width: 7.5rem; }
  .whoami .who { font-size: 0.9rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .kpi dd { font-size: 1.6rem; }
  .board { grid-template-columns: 1fr; }
  #map { height: 320px; }
  .legend { width: 100%; margin-left: 0; }
}
