/* Ultra Soft order flow console
   ---------------------------------------------------------------------------
   The neutral ramp is pulled off Ultra Soft's own logo rather than picked in
   the abstract: the wordmark is #293844, so the greys carry that same blue
   cast and the console sits next to the logo without arguing with it. It was
   previously a green-biased teal, which read as a stock template.

   Light is the default and the operating system is not consulted. This sits
   next to a spreadsheet and a Zoho tab all day, both of which are white, and a
   laptop set to dark used to open it dark before anybody had chosen anything.
   Dark is a preference, applied only by the toggle and remembered in
   localStorage.

   Channel identity colours are validated colourblind-safe and are deliberately
   left at their tested values. Dark plane keeps the blue and the green and
   nudges Amazon from #eb6834 to #e76530, which is what brings the set inside
   the dark lightness band; hue and identity are unaffected. The fourth,
   `--channel-inhouse`, was added later for orders quoted in Zoho: violet sits
   clear of the blue, orange and green for red-green colour blindness, which is
   the common case, and it is the one channel that is not a sales channel.

   Status colours come in two forms. The plain token is the fill: dots, bars,
   the coverage strip. The `-ink` token is the same colour taken dark enough to
   be read as text on its own wash, because the fill values are not. That
   split exists because the amber "waiting for you" figure - the single most
   important number on the dashboard - was #fab219 on white, which is roughly
   1.8:1 and effectively unreadable.

   Channel colour never carries meaning alone - every channel dot sits beside
   its name. Status colours are reserved for state and are never reused as
   decoration.
   --------------------------------------------------------------------------- */

:root {
  /* Native controls and scrollbars follow the same rule as everything else:
     light unless `data-theme` says otherwise, never the operating system. */
  color-scheme: light;

  /* --- light plane (default) --- */
  --plane: #f1f5f8;
  --surface: #ffffff;
  --surface-sunken: #eaeff4;
  --surface-raised: #ffffff;

  --ink: #182530;
  --ink-secondary: #4a5b6a;
  --ink-muted: #63727c;

  --line: #dce3ea;
  --line-strong: #c2ccd6;

  --accent: #1179bd;
  --accent-ink: #0c5f95;
  --accent-wash: #e7f0f8;

  --good: #1a7f4b;
  --warning: #d99418;
  --serious: #d9663a;
  --critical: #c22f2f;

  --good-ink: #17703f;
  --warning-ink: #8c5f0b;
  --serious-ink: #ab4a24;
  --critical-ink: #b02626;

  --good-wash: #e6f2ea;
  --warning-wash: #fbf1dd;
  --serious-wash: #fbece5;
  --critical-wash: #fae8e8;

  --channel-website: #2a78d6;
  --channel-amazon: #eb6834;
  --channel-ebay: #1baf7a;
  --channel-inhouse: #7048c4;

  --shadow: 0 1px 2px rgba(24, 37, 48, 0.05), 0 4px 12px rgba(24, 37, 48, 0.04);

  /* The Zoho call meter (13 Oct), emphasis form: this system in the accent, everyone else's use in grey (context), the
     unused track a wash of the same blue. Validated (dataviz): CVD ΔE 16.9, normal-vision ΔE 20.1. */
  --meter-ours: #1179bd;
  --meter-others: #9aa8b4;

  --radius: 8px;
  --radius-sm: 5px;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dark plane. Applied only when somebody asks for it with the toggle, which
   is remembered in localStorage and re-applied before first paint.

   Deliberately NOT wired to `prefers-color-scheme`. This is a business tool
   somebody opens next to a spreadsheet and a Zoho tab, both of which are
   white; following the operating system meant a laptop set to dark opened it
   dark, which is not the impression it should make on first sight. Light is
   the product, dark is a preference. */
:root[data-theme="dark"] {
  /* The Zoho call meter (13 Oct): this system's calls a step darker than the accent, validated against the dark
     surface (dataviz validator: lightness band, CVD ΔE 15.2, normal-vision ΔE 16.2); everyone else's in grey. */
  --meter-ours: #2f8fd4;
  --meter-others: #5b6873;
  color-scheme: dark;

  --plane: #0e1418;
  --surface: #161d23;
  --surface-sunken: #121920;
  --surface-raised: #1c242c;

  --ink: #e6edf3;
  --ink-secondary: #a5b5c2;
  --ink-muted: #7b8b98;

  --line: #263039;
  --line-strong: #37444f;

  --accent: #3d9ee0;
  --accent-ink: #6fbcec;
  --accent-wash: #12283a;

  --good: #35b06d;
  --warning: #e0a83c;
  --serious: #ea8358;
  --critical: #e05c5c;

  --good-ink: #4cc283;
  --warning-ink: #edbb5c;
  --serious-ink: #f09a75;
  --critical-ink: #ef7b7b;

  --good-wash: #10251a;
  --warning-wash: #2e2513;
  --serious-wash: #2f1d16;
  --critical-wash: #331717;

  --channel-website: #3987e5;
  --channel-amazon: #e76530;
  --channel-ebay: #1baf7a;
  --channel-inhouse: #9b7ae8;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.9rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono, .sku, .id, .ts {
  font-family: var(--mono);
  font-size: 0.86em;
  font-variant-numeric: tabular-nums;
}

/* Tabular figures wherever numbers line up in columns. */
table, .num, .tile-value, .stage-count { font-variant-numeric: tabular-nums; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* --- header ---------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 64px; }

/* Identity. Ultra Soft's own logo, not a mark invented for the occasion, and
   set beside a plain label for what this particular thing is. The strapline is
   stripped from the artwork in scripts/build_logo_assets.py, because at this
   size it renders as five pixels of grey mush. */
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 34px; width: auto; flex: none; }
.brand-logo-dark { display: none; }
.brand-divider { flex: none; width: 1px; height: 24px; background: var(--line-strong); }
.brand-sub { color: var(--ink-secondary); font-size: 0.815rem; font-weight: 500; }

/* The wordmark is Ultra Soft's navy, which disappears on the dark plane, so
   there is a second file with the wordmark recoloured and the droplet left
   alone. Swapped in CSS rather than by script so it is right on first paint. */
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }

@media (max-width: 560px) {
  .brand-divider, .brand-sub { display: none; }
}

.topbar-meta { display: flex; align-items: center; gap: 10px; flex: none; }

/* Navigation on its own line, grouped. Eight tabs of equal weight made
   somebody read all eight to find the one they wanted. */
.navbar { border-top: 1px solid var(--line); background: var(--surface-sunken); }
.navbar-inner { display: flex; align-items: center; gap: 6px; height: 42px; overflow-x: auto; }
.nav-divider { width: 1px; height: 18px; background: var(--line-strong); flex: none; margin: 0 6px; }

.tabs { display: flex; gap: 3px; flex: none; }
.tabs-secondary .tab { color: var(--ink-muted); }
.tab {
  padding: 6px 12px; border-radius: var(--radius-sm); white-space: nowrap;
  color: var(--ink-secondary); font-size: 0.85rem; font-weight: 500;
}
.tab:hover { background: var(--surface); text-decoration: none; }
.tab[aria-current="page"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.tab-outline {
  margin-left: auto; border: 1px solid var(--line-strong); background: var(--surface);
}

/* --- page heading ---------------------------------------------------------- */

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 22px 0 4px;
}
.page-head h1 { font-size: 1.4rem; letter-spacing: -0.02em; }
.page-sub { color: var(--ink-secondary); font-size: 0.875rem; margin: 5px 0 0; max-width: 82ch; }
.page-actions { display: flex; gap: 8px; flex: none; padding-top: 4px; }
@media (max-width: 720px) {
  .page-head { flex-direction: column; }
  .page-actions { padding-top: 0; }
}

/* --- first run ------------------------------------------------------------- */

.start { padding: 0; overflow: hidden; }
.start-head { padding: 20px 22px 0; }
.start-head h2 { font-size: 1.05rem; }
.start-head p { max-width: 72ch; margin-top: 6px; }
.start-body { padding: 18px 22px; }
.start-card {
  display: flex; flex-direction: column;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.start-card > form:last-child { margin-top: auto; padding-top: 10px; }
.start-foot { padding: 13px 22px; border-top: 1px solid var(--line); background: var(--surface-sunken); }

/* --- footer ---------------------------------------------------------------- */

.foot {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline;
  padding-top: 20px; padding-bottom: 30px;
  border-top: 1px solid var(--line); margin-top: 40px;
  font-size: 0.8rem; color: var(--ink-secondary);
}

.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-secondary);
  border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; font: inherit; font-size: 0.8rem;
}
.theme-toggle:hover { border-color: var(--line-strong); }

/* --- mode banner ----------------------------------------------------------- */

/* A ruled notice rather than a filled panel. It was a pale blue rounded box
   with a circled i in it, which is the house style of every generated admin
   page on the internet and made a genuinely important statement - that nothing
   is being sent to anyone's accounts - look like decoration. */
.banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 15px; margin: 18px 0;
  font-size: 0.845rem; color: var(--ink-secondary);
}
.banner strong { color: var(--ink); }
.banner-icon { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--ink-muted); }

/* For notices that are information rather than a mode change, so a temporary
   rate-limit wait does not shout as loudly as "nothing is being sent". */
.banner-quiet {
  background: var(--surface-sunken); border-left-color: var(--line-strong);
}

/* --- what this does -------------------------------------------------------- */

/* Explanation sits back; data comes forward. Everything used to be a white
   card, so the standing "what this does" panel had the same visual weight as
   the figures and the page gave no order to read it in. Needs `.card.explain`
   to outrank `.card`, which is declared after this block. */
.card.explain { padding: 16px 18px; background: var(--surface-sunken); }
.explain-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.explain-head h2 { margin: 0; }
.explain-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.explain-step { display: flex; gap: 10px; align-items: flex-start; }
.explain-step p { margin: 3px 0 0; }
.explain-num {
  flex: none; width: 21px; height: 21px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-wash); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 0.72rem; font-weight: 640; margin-top: 1px;
}

/* --- coverage strip -------------------------------------------------------- */

.coverage-bar {
  display: flex; gap: 2px; height: 9px; margin-bottom: 12px;
  border-radius: 999px; overflow: hidden; background: var(--surface-sunken);
}
.coverage-seg { display: block; min-width: 4px; }
.seg-good    { background: var(--good); }
.seg-warning { background: var(--warning); }
.seg-neutral { background: var(--line-strong); }
.seg-muted   { background: color-mix(in srgb, var(--ink-muted) 40%, transparent); }

.coverage-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.8rem; color: var(--ink-secondary); }
.coverage-item { display: inline-flex; align-items: center; gap: 6px; }
.coverage-item strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.dot-good    { background: var(--good); }
.dot-warning { background: var(--warning); }
.dot-neutral { background: var(--line-strong); }
.dot-muted   { background: color-mix(in srgb, var(--ink-muted) 50%, transparent); }

.small.warning { color: var(--warning-ink); }

/* --- layout ---------------------------------------------------------------- */

main { padding: 4px 0 60px; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head h2 { flex: none; }
.section-head .hint { color: var(--ink-muted); font-size: 0.815rem; font-weight: 400; }
.section-head .spacer { margin-left: auto; }

/* Bordered, not floating. Every card, tile and table used to carry the same
   soft drop shadow, so nothing on the page was any more important than
   anything else and the whole thing read as a stack of identical widgets. A
   hairline does the same job of separating a panel from the plane. */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-pad { padding: 16px 18px; }

/* Scenario cards sit in a row; pin their action to the bottom so the buttons
   line up regardless of how much text each card carries. */
.card-stack { display: flex; flex-direction: column; }
.card-stack > form:last-child, .card-stack > .card-foot { margin-top: auto; padding-top: 10px; }

.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .explain-steps { grid-template-columns: 1fr; gap: 14px; }
  /* The stages stack here, and a note under each would make the diagram
     several screens tall. The stage labels alone still read. */
  .stage-note { display: none; }
}

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

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.tile { background: var(--surface); padding: 15px 17px; }
.tile-label { color: var(--ink-muted); font-size: 0.775rem; font-weight: 500; letter-spacing: 0.01em; }
.tile-value { font-size: 1.7rem; font-weight: 640; line-height: 1.15; margin-top: 5px; letter-spacing: -0.02em; }
.tile-note { color: var(--ink-muted); font-size: 0.775rem; margin-top: 3px; }
/* The text-weight colours, not the fill ones - see the note at the top. */
.tile-value.good { color: var(--good-ink); }
.tile-value.warning { color: var(--warning-ink); }
.tile-value.critical { color: var(--critical-ink); }

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

.pipeline { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.stage {
  flex: 1 1 0; min-width: 118px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; position: relative;
}
.stage-count { font-size: 1.4rem; font-weight: 640; line-height: 1.1; }
.stage-label { color: var(--ink); font-size: 0.79rem; font-weight: 560; margin-top: 3px; }
/* One line of what actually happens at this stage. The pipeline read as five
   nouns with numbers under them, which explains nothing to a first-time
   visitor. Hidden on narrow screens, where the stages stack and the notes
   would be longer than the diagram. */
.stage-note {
  color: var(--ink-muted); font-size: 0.72rem; line-height: 1.4; margin-top: 5px;
}
.stage.is-empty .stage-count { color: var(--ink-muted); }
.stage-arrow { display: flex; align-items: center; color: var(--line-strong); flex: none; }

.stage.side-held { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); background: var(--warning-wash); }
.stage.side-held .stage-count { color: var(--warning-ink); }
.stage.side-problem { border-color: color-mix(in srgb, var(--critical) 40%, var(--line)); background: var(--critical-wash); }
.stage.side-problem .stage-count { color: var(--critical-ink); }
.stage.side-held.is-empty, .stage.side-problem.is-empty { background: var(--surface); border-color: var(--line); }
.stage.side-held.is-empty .stage-count, .stage.side-problem.is-empty .stage-count { color: var(--ink-muted); }

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

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  text-align: left; font-size: 0.735rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-muted); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-sunken); }
td.num, th.num { text-align: right; }
.table-scroll { overflow-x: auto; }

.empty { padding: 30px 18px; text-align: center; color: var(--ink-muted); font-size: 0.875rem; }

/* --- chips & badges -------------------------------------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--radius-sm); font-size: 0.775rem; font-weight: 550;
  border: 1px solid var(--line); background: var(--surface-sunken); color: var(--ink-secondary);
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: currentColor; }

/* Channel identity: a coloured dot next to a name, never colour alone. */
/* The class is built from the channel value, which is `woocommerce`, not
   `website`. `.channel-website` never matched anything, so the one dot on the
   dashboard nobody questioned was quietly falling back to the chip's own text
   colour. Found when a fourth channel was added and its dot worked. */
.channel-woocommerce .dot { background: var(--channel-website); }
.channel-amazon  .dot { background: var(--channel-amazon); }
.channel-ebay    .dot { background: var(--channel-ebay); }
.channel-inhouse .dot { background: var(--channel-inhouse); }

.state { border-width: 1px; }
.state-neutral { background: var(--surface-sunken); color: var(--ink-secondary); border-color: var(--line); }
.state-good     { background: var(--good-wash);     color: var(--good-ink);     border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.state-warning  { background: var(--warning-wash);  color: var(--warning-ink); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.state-serious  { background: var(--serious-wash);  color: var(--serious-ink); border-color: color-mix(in srgb, var(--serious) 40%, transparent); }
.state-critical { background: var(--critical-wash); color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 38%, transparent); }

.rung {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.75rem; font-weight: 600; padding: 2px 7px; border-radius: var(--radius-sm);
  background: var(--surface-sunken); color: var(--ink-secondary); border: 1px solid var(--line);
}
.rung-num { font-family: var(--mono); color: var(--ink-muted); }

/* --- buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 14px; font: inherit; font-size: 0.85rem; font-weight: 550;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-sunken); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-sm { padding: 5px 10px; font-size: 0.79rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- forms ----------------------------------------------------------------- */

label { display: block; font-size: 0.8rem; font-weight: 550; color: var(--ink-secondary); margin-bottom: 5px; }
/* password is in this list because the passcode gate is the first screen
   anyone sees, and without it that field fell back to the browser default -
   which on the dark plane is a grey box that looks broken. */
input[type="text"], input[type="email"], input[type="number"], input[type="password"],
input[type="search"], select, textarea {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 0.875rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

/* The catalogue upload is the one control a client actually operates, and it
   was the browser's raw "Choose File" widget sitting next to styled buttons. */
input[type="file"] { font: inherit; font-size: 0.85rem; color: var(--ink-secondary); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-size: 0.85rem; font-weight: 550;
  margin-right: 10px; padding: 7px 13px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
input[type="file"]::file-selector-button:hover { background: var(--surface-sunken); }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.checkbox label { margin: 0; }

/* --- trace timeline -------------------------------------------------------- */

.trace { list-style: none; margin: 0; padding: 0; }
.trace li { display: grid; grid-template-columns: 92px 18px 1fr; gap: 12px; padding: 0; }
.trace-time { font-family: var(--mono); font-size: 0.775rem; color: var(--ink-muted); padding-top: 13px; text-align: right; }
.trace-rail { position: relative; display: flex; justify-content: center; }
.trace-rail::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line);
}
.trace li:first-child .trace-rail::before { top: 18px; }
.trace li:last-child .trace-rail::before { bottom: calc(100% - 18px); }
.trace-node {
  position: relative; width: 10px; height: 10px; border-radius: 50%; margin-top: 14px;
  background: var(--ink-muted); box-shadow: 0 0 0 3px var(--surface);
}
.trace-node.good { background: var(--good); }
.trace-node.warning { background: var(--warning); }
.trace-node.serious { background: var(--serious); }
.trace-node.critical { background: var(--critical); }
.trace-body { padding: 10px 0 14px; min-width: 0; }
.trace-headline { font-weight: 550; font-size: 0.885rem; }
.trace-meta { color: var(--ink-muted); font-size: 0.785rem; margin-top: 2px; }

/* --- match explanation ----------------------------------------------------- */

.match-flow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.8rem;
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 11px;
}
.match-flow .arrow { color: var(--ink-muted); }
.match-flow .val { color: var(--ink); font-weight: 500; }
.match-flow .lbl { color: var(--ink-muted); font-size: 0.9em; }

.line-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: var(--surface); }
.line-card.held { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); background: var(--warning-wash); }
.line-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.line-name { font-weight: 600; }
.reason { color: var(--ink-secondary); font-size: 0.85rem; margin: 9px 0 0; }

.suggestion { margin-top: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.candidates { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.candidates li { display: flex; align-items: center; gap: 10px; font-size: 0.83rem; }
.score-bar { flex: none; width: 68px; height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; }
.score-fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* --- code panels ----------------------------------------------------------- */

.code {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 0.79rem; line-height: 1.55; color: var(--ink);
  white-space: pre; tab-size: 2;
}
.call { margin-bottom: 14px; }
.call-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.call-url { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-secondary); word-break: break-all; }
.call-note { color: var(--ink-muted); font-size: 0.8rem; margin: 6px 0 8px; }

details.disclosure { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
details.disclosure summary { cursor: pointer; color: var(--ink-secondary); font-size: 0.83rem; font-weight: 550; }
details.disclosure summary:hover { color: var(--ink); }
details.disclosure > *:not(summary) { margin-top: 10px; }

/* --- audit findings -------------------------------------------------------- */

.finding { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.finding-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; }
.finding-mark { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.finding-mark.ok { background: var(--good); }
.finding-mark.info { background: var(--accent); }
.finding-mark.warning { background: var(--warning); }
.finding-mark.serious { background: var(--serious); }
.finding-title { font-weight: 600; font-size: 0.925rem; }
.finding-headline { color: var(--ink-secondary); font-size: 0.87rem; margin-top: 3px; }
.finding-why { color: var(--ink-secondary); font-size: 0.855rem; line-height: 1.55; padding: 0 16px 14px 37px; }
.finding-body { padding: 0 16px 14px 37px; }
.sku-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.sku-list code {
  background: var(--surface-sunken); border: 1px solid var(--line);
  padding: 2px 6px; border-radius: 4px; font-size: 0.76rem;
}
.group-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.group-list li { font-size: 0.83rem; color: var(--ink-secondary); }
.group-list strong { color: var(--ink); }

/* --- picker ---------------------------------------------------------------- */

.picker-results { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.picker-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); cursor: pointer; font-size: 0.85rem;
}
.picker-row:last-child { border-bottom: none; }
.picker-row:hover { background: var(--accent-wash); }
.picker-row .sku { flex: none; width: 120px; font-weight: 600; }
.picker-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-secondary); }
.picker-row .pr { flex: none; font-variant-numeric: tabular-nums; }

.basket { list-style: none; padding: 0; margin: 0; }
.basket li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.basket li:last-child { border-bottom: none; }
.basket .sku { flex: none; width: 120px; font-weight: 600; }
.basket .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-secondary); font-size: 0.85rem; }
.basket input[type="number"] { width: 72px; }

.muted { color: var(--ink-muted); }
.small { font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: 10px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.provenance-real { color: var(--good-ink); }
.provenance-constructed { color: var(--warning-ink); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.85rem; }
.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; }

/* --- the ask panel --------------------------------------------------------- */

.answer-body {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
}
.ask-suggestion { font-weight: 450; color: var(--ink-secondary); }
.answer-thinking { color: var(--ink-muted); font-style: italic; }

/* --- capability coverage --------------------------------------------------- */

.cap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.cap-not_built { background: var(--surface-sunken); }
.cap-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cap-mark { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-muted); }
.cap-mark.tone-good { background: var(--good); }
.cap-mark.tone-warning { background: var(--warning); }
.cap-mark.tone-neutral { background: var(--accent); }
.cap-mark.tone-muted { background: var(--line-strong); }
.cap-title { font-weight: 600; font-size: 0.925rem; }
.cap-evidence { margin-left: auto; color: var(--ink-muted); font-size: 0.78rem; }
.cap-body { color: var(--ink-secondary); font-size: 0.865rem; line-height: 1.55; margin: 9px 0 0; }
.cap-gap {
  color: var(--ink-secondary); font-size: 0.845rem; line-height: 1.55; margin: 9px 0 0;
  padding-left: 11px; border-left: 2px solid var(--line-strong);
}
.cap-gap strong { color: var(--ink); }

/* --- field mapping editor -------------------------------------------------- */

.map-table { display: grid; gap: 2px; }
.map-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(140px, 1.2fr) minmax(150px, 1.2fr) minmax(120px, 1fr) minmax(130px, 1.1fr) auto;
  gap: 10px; align-items: end;
  padding: 11px 8px; border-bottom: 1px solid var(--line);
}
.map-row:last-child { border-bottom: none; }
.map-row:hover { background: var(--surface-sunken); }
.map-row.is-off { opacity: 0.55; }
.map-cap {
  display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-muted); margin-bottom: 3px; font-weight: 600;
}
.map-row input[type="text"], .map-row select { padding: 5px 8px; font-size: 0.8rem; }
.map-row .mono { font-family: var(--mono); }
.map-arg { margin-top: 4px; }
.map-label { align-self: center; }
.map-name { font-weight: 600; font-size: 0.85rem; display: block; }
.map-note { display: block; color: var(--ink-muted); font-size: 0.75rem; margin-top: 3px; line-height: 1.4; }
.map-result { align-self: center; }
.map-value { font-size: 0.8rem; display: block; word-break: break-word; }
.map-raw { display: block; color: var(--ink-muted); font-size: 0.72rem; margin-top: 2px; }
.map-actions { align-self: center; }

@media (max-width: 1100px) {
  .map-row { grid-template-columns: 1fr 1fr; }
}

.path-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.path-list li { font-size: 0.76rem; }
.path-list code { font-size: 0.72rem; }

/* --- the passcode gate --------------------------------------------------
   Its own page rather than a modal over the dashboard, because there is
   nothing behind it to see and pretending otherwise wastes a click. */
.lock-page { display: grid; place-items: center; min-height: 100vh; background: var(--plane); }
.lock {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.lock-logo { height: 34px; margin-bottom: 18px; }
.lock h1 { font-size: 1.05rem; margin: 0 0 8px; }
.lock form { display: flex; gap: 8px; margin: 18px 0 0; }
.lock input { flex: 1 1 auto; }
.lock button {
  flex: none; padding: 0 16px; border-radius: 6px; cursor: pointer;
  background: var(--accent); border: 1px solid var(--accent); color: #fff;
}
.lock button:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.lock-error { color: var(--critical, #b3261e); margin: 10px 0 0; }
.lock-note { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }

/* --- the flow map ----------------------------------------------------------
   Six stages down a numbered spine, each holding the steps that happen there.
   The left edge of every step carries its route colour, so which of the two
   paths a step belongs to reads without a label; the chip carries whether it
   exists. Those are two different questions and they are never merged into one
   colour, because "not built" and "not on this route" mean opposite things.  */

.mono { font-family: var(--mono); }

.fm-legend {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  margin: 18px 0 6px; font-size: 0.79rem; color: var(--ink-muted);
}
.fm-key { display: inline-flex; align-items: center; gap: 7px; }
/* The swatch stands in for a node's left edge, and a node draws that edge with
   border-left-color. The route classes therefore say nothing about background,
   so the swatch has to name each colour itself - which is why these three sit
   next to the three they mirror. */
.fm-swatch { width: 3px; height: 15px; border-radius: 2px; background: var(--line-strong); }
.fm-swatch.route-website { background: var(--channel-website); }
.fm-swatch.route-quoted  { background: var(--channel-inhouse); }
.fm-swatch.route-both    { background: var(--line-strong); }

.fm-stage { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 20px; padding-bottom: 26px; }
.fm-stage:first-of-type { margin-top: 22px; }

/* The spine. Drawn from the rail column rather than as a border on the stage,
   so it starts below the number instead of running through it. */
.fm-rail { position: relative; display: flex; justify-content: center; }
.fm-rail::after {
  content: ""; position: absolute; top: 44px; bottom: -26px; width: 2px;
  background: var(--line-strong); border-radius: 1px;
}
.fm-stage-last .fm-rail::after { display: none; }

.fm-num {
  position: relative; z-index: 1; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-wash); color: var(--accent-ink);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-size: 0.92rem; font-weight: 650;
}

.fm-body { min-width: 0; }
.fm-stage-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 6px 0 11px;
}
.fm-stage-head h2 { flex: none; }
.fm-stage-head .hint { color: var(--ink-muted); font-size: 0.815rem; }

.fm-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 12px; }

.fm-node {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius); padding: 13px 15px 12px;
}
/* An unbuilt step sits back rather than shouting. It is the plan, not a fault. */
.fm-node.tone-muted { background: var(--surface-sunken); }

.route-website { border-left-color: var(--channel-website); }
.route-quoted  { border-left-color: var(--channel-inhouse); }
.route-both    { border-left-color: var(--line-strong); }

/* Wraps rather than truncating. "Built from the documentation" is a long chip
   and it sat next to SHIPSTATION, which is a long owner; ellipsising the owner
   turned the one system we have never actually called into "SHIPS...". */
.fm-node-head { display: flex; align-items: center; gap: 6px 9px; flex-wrap: wrap; margin-bottom: 9px; }
.fm-owner {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-muted);
}
.fm-node-head .chip { margin-left: auto; }

.fm-node-title { font-size: 0.89rem; font-weight: 600; line-height: 1.35; margin: 0 0 6px; }
.fm-node-body { font-size: 0.825rem; color: var(--ink-secondary); line-height: 1.55; margin: 0; }

.fm-node-note {
  font-size: 0.785rem; color: var(--ink-secondary); line-height: 1.5;
  margin: 10px 0 0; padding: 8px 10px;
  background: var(--surface-sunken); border-left: 2px solid var(--line-strong);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.fm-node.tone-muted .fm-node-note { background: var(--surface); }

.fm-metric {
  margin-top: auto; padding-top: 10px; font-size: 0.745rem; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.fm-node-body + .fm-metric, .fm-node-note + .fm-metric { margin-top: 11px; }

.fm-stage-foot {
  font-size: 0.815rem; color: var(--ink-muted); line-height: 1.55;
  margin: 12px 0 0; padding-left: 11px; border-left: 2px solid var(--line);
}

@media (max-width: 720px) {
  .fm-stage { grid-template-columns: 30px minmax(0, 1fr); gap: 0 12px; }
  .fm-num { width: 26px; height: 26px; font-size: 0.8rem; }
  .fm-rail::after { top: 34px; }
}

/* --- overview --------------------------------------------------------------
   Charts are inline SVG scaled by CSS. Colour does two jobs here and they are
   kept apart: channel hues carry identity (which channel), status tokens carry
   state (good/warning/serious). Neither is ever used for the other, and a bar
   whose only job is magnitude gets the single accent rather than a ramp.      */

.ov-tiles {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.ov-tile { padding: 14px 16px; }
.ov-none { color: var(--ink-muted); font-weight: 400; }

.ov-split { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); align-items: start; }

.ov-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.ov-head h2 { flex: none; }
.ov-head .hint { color: var(--ink-muted); font-size: 0.79rem; }

.ov-empty { color: var(--ink-muted); font-size: 0.84rem; margin: 0; padding: 18px 0; text-align: center; }

/* --- the line chart --- */
.ov-chart { display: block; width: 100%; height: auto; overflow: visible; }
.ov-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ov-area { fill: var(--accent); opacity: 0.09; stroke: none; }
.ov-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.ov-peak { fill: var(--ink-secondary); font-size: 11px; font-weight: 600;
           font-family: var(--sans); font-variant-numeric: tabular-nums; }
.ov-hit { fill: transparent; }
.ov-hit:hover { fill: var(--accent); opacity: 0.07; }
.ov-axis { display: flex; justify-content: space-between; margin-top: 4px;
           font-size: 0.74rem; color: var(--ink-muted); }

/* --- horizontal bars --- */
.ov-bars { display: grid; gap: 9px; }
.ov-bar-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center; gap: 10px; color: inherit;
}
a.ov-bar-row:hover { text-decoration: none; }
a.ov-bar-row:hover .ov-bar-label { color: var(--accent-ink); }
.ov-bar-label {
  font-size: 0.79rem; color: var(--ink-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ov-bar-track { height: 8px; background: var(--surface-sunken); border-radius: 4px; overflow: hidden; }
.ov-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 3px; }
.ov-bar-fill.tone-good     { background: var(--good); }
.ov-bar-fill.tone-warning  { background: var(--warning); }
.ov-bar-fill.tone-serious  { background: var(--serious); }
.ov-bar-fill.tone-critical { background: var(--critical); }
.ov-bar-fill.tone-neutral  { background: var(--line-strong); }
.ov-bar-value { font-size: 0.79rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* --- the channel table, with the bar inside the revenue cell --- */
.ov-table td { vertical-align: middle; }
.ov-cell-bar { display: flex; align-items: center; gap: 10px; justify-content: flex-end;
               font-variant-numeric: tabular-nums; }
.ov-inline-track { flex: 1 1 auto; max-width: 120px; height: 6px;
                   background: var(--surface-sunken); border-radius: 3px; overflow: hidden; }
.ov-inline-fill { display: block; height: 100%; border-radius: 3px; min-width: 3px; background: var(--accent); }
.channel-fill-woocommerce { background: var(--channel-website); }
.channel-fill-amazon      { background: var(--channel-amazon); }
.channel-fill-ebay        { background: var(--channel-ebay); }
.channel-fill-inhouse     { background: var(--channel-inhouse); }

/* --- what each connection unlocks --- */
.ov-waiting { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 12px; }
.ov-source {
  background: var(--surface-sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px;
}
.ov-source-head { display: flex; align-items: center; gap: 9px; }
.ov-source-head strong { font-size: 0.89rem; }
.ov-source-head .chip { margin-left: auto; }
.ov-source-scope { font-size: 0.72rem; color: var(--ink-muted); margin: 5px 0 0; word-break: break-word; }
.ov-source-note { font-size: 0.79rem; color: var(--ink-secondary); line-height: 1.5; margin: 8px 0 0; }
.ov-source-items { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.ov-pill {
  font-size: 0.72rem; color: var(--ink-secondary);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 2px 9px;
}

@media (max-width: 1000px) {
  .ov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-split { grid-template-columns: minmax(0, 1fr); }
}

/* --- filter row -------------------------------------------------------------
   Above a list, never inside it. Each chip carries its own count so a filter
   that would return nothing says so before it is clicked rather than after.  */
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 20px; font-size: 0.8rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-secondary);
}
.filter:hover { border-color: var(--line-strong); text-decoration: none; }
.filter.is-on {
  background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent-ink); font-weight: 600;
}
.filter-n { font-variant-numeric: tabular-nums; color: var(--ink-muted); font-weight: 500; }
.filter.is-on .filter-n { color: var(--accent-ink); }
.filter.is-empty { opacity: 0.5; }

/* --- ultrasoft-orders additions -------------------------------------------- */

.env-banner { background: var(--warning-wash); color: var(--warning-ink); border-bottom: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); font-weight: 600; text-align: center; padding: 6px 12px; font-size: 0.85rem; letter-spacing: 0.04em; }
.notice { margin: 12px 0; }
.notice-good { color: var(--good-ink); }
.notice-bad { color: var(--critical-ink); }
.ok { color: var(--good-ink); }
.bad { color: var(--critical-ink); }
.kv-table th { width: 30%; text-align: left; font-weight: 500; color: var(--ink-secondary); padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.section { margin: 22px 0; }
.section h2 { font-size: 1.05rem; margin: 0 0 10px; }
form.inline-form { display: inline; }

/* Held orders tab: how many orders wait for a decision (step 5b). */
.count { display: inline-block; min-width: 1.5em; padding: 0 6px; border-radius: 999px; font-size: 12px; line-height: 1.6;
         text-align: center; background: var(--surface-sunken); color: var(--ink-muted); }
.count-bad { background: var(--critical-ink); color: #fff; }


/* --- The Zoho call meter (Connections page, 13 Oct; interim, before the designed UI) ------------------------------ */
.h-note { font-size: 0.8rem; font-weight: 400; color: var(--ink-muted); margin-left: 8px; }
.meter-card { margin-top: 12px; }
.meter-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.status-pill { font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.status-pill.good { color: var(--good-ink); background: var(--good-wash); }
.status-pill.warning { color: var(--warning-ink); background: var(--warning-wash); }
.status-pill.critical { color: var(--critical-ink); background: var(--critical-wash); }
.meter { position: relative; display: flex; gap: 2px; height: 14px; border-radius: 4px; background: var(--accent-wash); overflow: visible; }
.meter-seg { height: 100%; min-width: 0; }
.meter-seg:first-child { border-radius: 4px 0 0 4px; }
.meter-ours, .key.meter-ours { background: var(--meter-ours); }
.meter-others, .key.meter-others { background: var(--meter-others); }
.key.meter-left { background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--line-strong); }
.meter-warning .meter-others { background: var(--warning); }
.meter-critical .meter-others { background: var(--critical); }
.meter-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--warning); border-radius: 1px; }
.meter-mark-brake { background: var(--critical); }
.meter-scale { position: relative; height: 18px; font-size: 0.72rem; color: var(--ink-muted); margin-top: 4px; }
.meter-scale span { position: absolute; transform: translateX(-50%); }
.meter-scale span:first-child { left: 0; transform: none; }
.meter-scale .end { right: 0; transform: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 8px 0 0; font-size: 0.83rem; color: var(--ink-secondary); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend b { color: var(--ink); font-weight: 600; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.meter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.hbars { margin-top: 10px; display: grid; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 8px; font-size: 0.83rem; }
.hbar-label { color: var(--ink-secondary); }
.hbar-track { height: 10px; }
.hbar { display: block; height: 10px; background: var(--meter-ours); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-value { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.cols { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 110px; align-items: end; margin: 12px 0 6px;
        border-bottom: 1px solid var(--line); }
.col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.col-bar { width: min(24px, 70%); background: var(--meter-ours); border-radius: 4px 4px 0 0; min-height: 2px; }
.col-label { position: absolute; bottom: -18px; font-size: 0.72rem; color: var(--ink-muted); }
.cols + details { margin-top: 22px; font-size: 0.83rem; }
table.compact td, table.compact th { padding: 4px 8px; }
@media (max-width: 560px) {
  .meter-scale .mark-label { display: none; }          /* the marks stay; the note below says what they are */
  .meter-tiles { grid-template-columns: 1fr; }         /* no empty cell beside the third tile */
}

/* ---------------------------------------------------------------------------
   The redesign (11 Nov), part 1: the order page's journey strip and "Needs you"
   box. Seven steps; each state has one colour, and never colour alone: a done
   step carries a tick, a step needing a person an "!", and every step's state
   is said in words for screen readers and in its tooltip.
   --------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.journey { padding: 18px 20px 14px; }
.journey-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(7, minmax(104px, 1fr));
  overflow-x: auto;
}
.journey-step { position: relative; display: flex; flex-direction: column; gap: 4px; padding-right: 10px; min-width: 0; }
/* the line to the next step, coloured by this step's state */
.journey-step::after {
  content: ""; position: absolute; top: 12px; left: 32px; right: 4px; height: 3px; border-radius: 2px;
  background: var(--line);
}
.journey-step:last-child::after { display: none; }
.journey-step.is-done::after { background: var(--good); }

.journey-dot {
  width: 26px; height: 26px; border-radius: 50%; box-sizing: border-box; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; line-height: 1;
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink-muted);
}
.journey-name { margin-top: 4px; font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.journey-note { font-size: 0.775rem; color: var(--ink-muted); overflow-wrap: anywhere; }

.is-done    .journey-dot { background: var(--good); border-color: var(--good); color: #fff; }
.is-working .journey-dot,
.is-waiting .journey-dot { background: var(--accent-wash); border: 3px solid var(--accent); }
.is-needs   .journey-dot { background: var(--warning-wash); border: 3px solid var(--warning); color: var(--warning-ink); }
.is-needs   .journey-name { color: var(--warning-ink); }
.is-problem .journey-dot { background: var(--critical); border-color: var(--critical); color: #fff; }
.is-problem .journey-name { color: var(--critical-ink); }
.is-off     .journey-dot { border-style: dashed; }
.is-off     .journey-name,
.is-todo    .journey-name { color: var(--ink-muted); }

/* The journey as a flow (12 Nov, Josh's idea, mock-up approved): the trunk, then a lane per part after the plan, joining at
   Completed. One line runs dot to dot, green as far as the order has got. Each lane is 100px tall, 14px apart, its dot's centre
   29px down (a 16px label, then half the 26px dot); its curves are drawn from its place in the list (--i, set on the page). */
.flow { display: flex; align-items: flex-start; overflow-x: auto; padding: 2px 2px 6px; isolation: isolate; }  /* 16 Nov: the lanes' z-index stays inside the flow, so they scroll under the order's pinned header */
.flow ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-start; flex: none; }
.flow .flow-trunk, .flow .flow-end { padding-top: 16px; }
.flow-step { width: 104px; padding: 0; align-items: center; text-align: center; --in: var(--line-strong); --out: var(--line-strong); }
.flow-step::after { content: none; }
.flow-step::before {
  content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 2px;
  background: linear-gradient(to right, var(--in) 50%, var(--out) 50%);
}
.flow-step.in-done { --in: var(--good); }
.flow-step.out-done { --out: var(--good); }
.flow-step.in-none { --in: transparent; }
.flow-step.out-none { --out: transparent; }
.flow-step .journey-dot { position: relative; z-index: 1; }
.flow-end .flow-step { width: 120px; }
.flow-lanes { display: flex; flex-direction: column; gap: 14px; flex: none; }
.flow-lane { position: relative; height: 100px; padding: 0 24px; --fork: var(--line-strong); --join: var(--line-strong); }
.flow-lane.fork-done { --fork: var(--good); }
.flow-lane.join-done { --join: var(--good); }
.flow-lane-name { display: block; height: 16px; padding-left: 10px; font-size: 0.72rem; line-height: 16px; color: var(--ink-muted); white-space: nowrap; }
.flow-lane-name b { font-weight: 700; letter-spacing: 0.06em; color: var(--ink); }
.flow-lane::before, .flow-lane::after {
  content: ""; position: absolute; width: 24px; box-sizing: border-box;
  top: calc(28px - var(--i, 0) * 114px); height: calc(var(--i, 0) * 114px + 2px);
}
.flow-lane::before { left: 0; border-left: 2px solid var(--fork); border-bottom: 2px solid var(--fork); border-bottom-left-radius: 16px; }
.flow-lane::after { right: 0; border-right: 2px solid var(--join); border-bottom: 2px solid var(--join); border-bottom-right-radius: 16px; }
.flow-lane:first-child::before, .flow-lane:first-child::after { border-radius: 0; }

.needs-you {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 20px;
  background: var(--warning-wash); border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
}
.needs-you-text { flex: 1 1 420px; display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--ink); }
.needs-you-kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warning-ink); }
.needs-you-title { font-size: 1.05rem; }
.needs-you .btn { min-height: 44px; display: inline-flex; align-items: center; }

/* The live test window (11 Nov): staging is writing to Ultra Soft's real Zoho. Red, not the usual amber, so nobody mistakes it for the
   everyday staging notice. */
.env-banner-live { background: var(--critical-wash); color: var(--critical-ink); border-bottom-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.env-banner-live a { color: inherit; text-decoration: underline; margin-left: 8px; }

/* ---------------------------------------------------------------------------
   The redesign, part 2 (11 Nov): the order page in two columns. The order
   itself (its facts, customer and lines) on the left, staying in view; where it
   has got to on the right. Each part folds to one line when it's fine, and is
   open when someone's needed. One column on a narrow screen.
   --------------------------------------------------------------------------- */
.order-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1040px) {
  .order-layout { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
  .order-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
}
.order-side, .order-main { min-width: 0; display: grid; gap: 16px; align-content: start; }
.order-side .section, .order-main .section { margin: 0; }
.order-side .table-scroll { overflow-x: auto; }
.order-facts p { margin: 0 0 6px; line-height: 1.6; }

.fold-card { padding: 0; }
.fold-card > details > *:not(summary) { margin-left: 16px; margin-right: 16px; }
.fold-card > details > *:last-child { margin-bottom: 14px; }
.fold-head {
  cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 12px 16px; min-height: 44px; box-sizing: border-box;
}
.fold-head::-webkit-details-marker { display: none; }
.fold-head::before {
  content: ""; width: 7px; height: 7px; flex: none; margin-right: 6px;
  border-right: 2px solid var(--ink-muted); border-bottom: 2px solid var(--ink-muted);
  transform: rotate(-45deg); transition: transform 0.15s ease;
}
details[open] > .fold-head::before { transform: rotate(45deg); }
.fold-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-sm, 6px); }
.fold-section > .fold-head { padding-left: 0; }
.fold-section > .fold-head h2 { display: inline; margin: 0; }
@media (prefers-reduced-motion: reduce) { .fold-head::before { transition: none; } }

/* ---------------------------------------------------------------------------
   The redesign, part 3 (11 Nov): the Orders page. The counters that need
   someone first (and clickable), the intake figures folded away; what needs
   attention as an inbox, oldest first; the list with filters and a search.
   --------------------------------------------------------------------------- */
.lede-line { margin: 0 0 4px; max-width: 75ch; }
.tiles-key { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile-link { text-decoration: none; color: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.tile-link:hover { border-color: var(--accent); }
.tile-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-value.warn { color: var(--warning-ink); }
.tile-value-small { font-size: 1rem !important; }
.small { font-size: 0.8rem; }
.nowrap { white-space: nowrap; }

.inbox { list-style: none; margin: 0; padding: 0; }
.inbox-row {
  display: grid; grid-template-columns: minmax(150px, max-content) 90px minmax(0, 1fr) max-content max-content;
  gap: 8px 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line);
}
.inbox-row:first-child { border-top: 0; }
.inbox-kind { justify-self: start; white-space: normal; }
.inbox-order { font-weight: 650; }
.inbox-why { color: var(--ink-secondary); min-width: 0; overflow-wrap: anywhere; }
.inbox-since { font-size: 0.8rem; white-space: nowrap; }
.inbox-open { min-height: 36px; display: inline-flex; align-items: center; }
@media (max-width: 760px) {
  .inbox-row { grid-template-columns: minmax(0, 1fr) max-content; }
  .inbox-kind, .inbox-why { grid-column: 1 / -1; }
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-filter { min-height: 36px; }
.btn-filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.search { margin-left: auto; }
.search input { min-height: 36px; width: min(320px, 70vw); padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; }
.search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.order-link { font-weight: 650; white-space: nowrap; }
tr[hidden] { display: none; }

/* The redesign, part 4 (11 Nov): the frame. Section headings a step larger so a page scans by its parts; a little less space
   between sections; the navigation's current page clearer. */
h2 { font-size: 1.08rem; }
.section { margin-top: 28px; }
.page-head h1 { font-size: 1.5rem; }
.navbar .tab[aria-current="page"] { font-weight: 650; }
.tabs-secondary .tab { min-height: 34px; display: inline-flex; align-items: center; }

/* ---------------------------------------------------------------------------
   The redesign, part 5 (11 Nov): a left sidebar, like the menu staff use all
   day in Zoho (its layout, not its look: our logo and colours). Folds to
   icons, remembered; on a phone it opens from a Menu button over the page.
   --------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
body.sidebar-folded .shell { grid-template-columns: 64px minmax(0, 1fr); }
.shell-main { min-width: 0; display: flex; flex-direction: column; }
.shell-main main { flex: 1; width: 100%; box-sizing: border-box; }

.sidebar {
  position: sticky; top: 0; height: 100vh; box-sizing: border-box; overflow-y: auto; z-index: 30;
  display: flex; flex-direction: column; gap: 14px; padding: 16px 10px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.sidebar-top { padding: 4px 6px 8px; border-bottom: 1px solid var(--line); }
.side-brand { flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; text-decoration: none; }
.side-brand .brand-logo { height: 30px; }
.side-brand .brand-sub { display: block; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }

.side-nav { display: grid; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; box-sizing: border-box;
  border-radius: var(--radius-sm); color: var(--ink-secondary); text-decoration: none; font-size: 0.9rem; font-weight: 520;
}
.side-link:hover { background: var(--surface-sunken); color: var(--ink); }
.side-link[aria-current="page"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 650; }
.side-link:focus-visible, .side-fold:focus-visible, .menu-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.side-link .count { margin-left: auto; }
.side-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-foot .theme-toggle { justify-self: start; }
.side-fold {
  display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-muted); font: inherit; font-size: 0.82rem; cursor: pointer; text-align: left;
}
.side-fold:hover { background: var(--surface-sunken); color: var(--ink); }
.side-fold-arrow { width: 20px; text-align: center; font-size: 1rem; }
.side-revision { font-size: 0.72rem; padding: 0 10px; }

/* Folded: icons only. */
body.sidebar-folded .side-label, body.sidebar-folded .side-chips, body.sidebar-folded .side-revision,
body.sidebar-folded .sidebar-top, body.sidebar-folded .sidebar-foot .theme-toggle, body.sidebar-folded .side-link .count { display: none; }
body.sidebar-folded .side-link, body.sidebar-folded .side-fold { justify-content: center; padding: 8px 0; }
body.sidebar-folded .side-fold-arrow { transform: rotate(180deg); }

/* The top bar is for phones only; the footer's revision lives in the sidebar on wide screens. */
.shell-main > .topbar { display: none; }
.menu-button { display: none; }
.menu-scrim { position: fixed; inset: 0; background: rgba(10, 20, 30, 0.45); z-index: 25; }

@media (max-width: 900px) {
  .shell, body.sidebar-folded .shell { grid-template-columns: minmax(0, 1fr); }
  .shell-main > .topbar { display: block; }
  .menu-button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 82vw); height: auto;
    transform: translateX(-105%); transition: transform 0.2s ease; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
  body.menu-open .sidebar { transform: none; }
  .side-fold { display: none; }
  body.sidebar-folded .side-label, body.sidebar-folded .side-chips, body.sidebar-folded .side-revision,
  body.sidebar-folded .sidebar-top, body.sidebar-folded .sidebar-foot .theme-toggle { display: revert; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
/* The page name comes first in the link's markup (the screen's tests and screen readers read it first); the icon is drawn first. */
.side-link .side-icon { order: -1; }
body.sidebar-folded .side-link { font-size: 0; gap: 0; }
@media (max-width: 900px) { body.sidebar-folded .side-link { font-size: 0.9rem; gap: 10px; } }
/* Polish (11 Nov): the sidebar's logo a size up, so it reads at a glance. */
.side-brand .brand-logo { height: 42px; }

/* ===========================================================================
   The redesign v2 (11 Nov), from the mock-up Julien chose: an app laid out
   like Zoho. A dark sidebar; on Orders, the list down the left (25 a page,
   filters, search) and the order on the right, in tabs.
   =========================================================================== */

/* The sidebar, dark in both themes (Zoho's layout, our own colours). */
.sidebar { --side-bg: #17222e; --side-ink: #c9d4de; --side-muted: #8fa1b3; --side-line: #263445; --side-hover: #223041; --side-on: #2a3a4d;
  background: var(--side-bg); border-right-color: var(--side-line); color: var(--side-ink); }
.sidebar .sidebar-top, .sidebar .sidebar-foot { border-color: var(--side-line); }
.sidebar .brand-logo-light { display: none; }
.sidebar .brand-logo-dark { display: block; }
.sidebar .brand-sub { color: var(--side-muted); }
.sidebar .side-link { color: var(--side-ink); }
.sidebar .side-link:hover { background: var(--side-hover); color: #ffffff; }
.sidebar .side-link[aria-current="page"] { background: var(--side-on); color: #ffffff; }
.sidebar .side-fold, .sidebar .side-revision { color: var(--side-muted); }
.sidebar .side-fold:hover { background: var(--side-hover); color: #ffffff; }
.sidebar .theme-toggle { background: transparent; color: var(--side-ink); border-color: var(--side-line); }
.sidebar .count { background: #3a4a5d; color: #ffffff; }
.sidebar .count.count-bad { background: #d99418; color: #17222e; }

/* Workspace pages: full width, no page title of their own (the list and the order have their own). */
main.wrap-wide { max-width: none; padding-left: 0; padding-right: 0; padding-bottom: 0; }
.wrap-wide > .page-head { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.workspace { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); align-items: start; min-height: 100vh; }
.wrap-wide + .foot { display: none; }

/* The list pane. */
.list-pane { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); min-width: 0; }
.list-head { display: grid; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-title h2 { font-size: 1.15rem; margin: 0; }
.list-total { font-weight: 500; font-size: 0.85rem; }
.list-needs { margin-left: auto; text-decoration: none; }
.list-search input { width: 100%; box-sizing: border-box; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.875rem; }
.list-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; min-height: 30px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-secondary); text-decoration: none; background: var(--surface); }
.pill:hover { border-color: var(--accent); color: var(--accent-ink); }
.pill[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.list-rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list-row { display: grid; gap: 4px; padding: 11px 16px 11px 13px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent;
  text-decoration: none; color: var(--ink); }
.list-row:hover { background: var(--surface-sunken); }
.list-row.is-selected { background: var(--accent-wash); border-left-color: var(--accent); }
.list-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.list-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-number { font-size: 0.9rem; white-space: nowrap; }
.list-name { color: var(--ink-secondary); font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list-total-money { margin-left: auto; font-weight: 650; font-size: 0.84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-meta { font-size: 0.75rem; color: var(--ink-muted); }
.list-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.list-meta .chip { margin-left: auto; font-size: 0.7rem; padding: 1px 7px; }
.list-empty { padding: 18px 16px; }
.list-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--ink-secondary); }
.list-pages { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.btn-icon { min-width: 32px; min-height: 32px; padding: 0; justify-content: center; display: inline-flex; align-items: center; text-decoration: none; }
.btn-icon.is-disabled { opacity: 0.4; pointer-events: none; }

/* The right side: the overview (Orders) or the order. */
.detail { min-width: 0; display: flex; flex-direction: column; }
.detail-overview { padding: 20px 28px 40px; }
.detail-overview > .section:first-child, .detail-overview > p:first-child { margin-top: 0; }
.detail-head { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 28px 0; display: grid; gap: 8px; }
.detail-back { display: none; font-size: 0.85rem; text-decoration: none; }
.detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.detail-title h2 { font-size: 1.3rem; margin: 0; }
.detail-facts { font-size: 0.85rem; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; }
.detail-tabs { display: flex; gap: 2px; overflow-x: auto; }
.detail-tab { position: relative; min-height: 40px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--ink-secondary); font: inherit; font-size: 0.875rem; font-weight: 520; cursor: pointer; white-space: nowrap; }
.detail-tab:hover { color: var(--ink); }
.detail-tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 650; }
.detail-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tab-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--warning); vertical-align: middle; }
.detail-body { padding: 18px 28px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; }  /* 26 Nov: one column that never grows past the screen, so a wide journey scrolls inside its own card (Julien chose this; the journey's code untouched) */
.detail-body > .section, .detail-body .order-layout > * > .section { margin-top: 0; }
.detail-body > .notice { margin: 0; }
/* With tabs, the order's own parts stack in one column; the overview's customer and lines sit side by side on a wide screen. */
.workspace-page .order-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.workspace-page .order-side { position: static; max-height: none; overflow: visible; }
@media (min-width: 1600px) {  /* 26 Nov: two columns only where they fit; at 1280 the customer and lines were squeezed */
  .workspace-page .order-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-page .order-side > .order-facts { grid-column: 1 / -1; }
}
.detail [hidden] { display: none !important; }

/* The journey's steps in progress spin until they're done; one needing a person pulses (Julien, 11 Nov). Still for reduced motion. */
.is-working .journey-dot, .is-waiting .journey-dot { position: relative; border-color: var(--accent-wash); }
.is-working .journey-dot::after, .is-waiting .journey-dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--accent);
  border-right-color: var(--accent); animation: journey-spin 1.1s linear infinite;
}
.is-waiting .journey-dot::after { animation-duration: 2.2s; }
.is-needs .journey-dot { animation: journey-pulse 1.8s ease-in-out infinite; }
@keyframes journey-spin { to { transform: rotate(360deg); } }
@keyframes journey-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warning) 45%, transparent); } 60% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) {
  .is-working .journey-dot::after, .is-waiting .journey-dot::after, .is-needs .journey-dot { animation: none; }
}

/* Phones: one column. On an order's page the list steps aside, with a way back to it. */
@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .list-pane { position: static; height: auto; max-height: none; border-right: 0; }
  .workspace-page .list-pane { display: none; }
  .detail-back { display: inline-block; }
  .detail-head, .detail-body, .detail-overview { padding-left: 16px; padding-right: 16px; }
}

/* The redesign v2 (11 Nov), the other pages: a header band for the page's title, its sections as tabs, long tables in pages with a
   search above them. */
main.wrap:not(.wrap-wide) > .page-head { margin: 0 -20px 18px; padding: 18px 20px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.page-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-top: 24px; }
.page-tab { min-height: 40px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-secondary);
  font: inherit; font-size: 0.875rem; font-weight: 520; cursor: pointer; white-space: nowrap; }
.page-tab:hover { color: var(--ink); }
.page-tab[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 650; }
.page-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.page-tabs + [data-page-tab], .page-tabs ~ [data-page-tab] { margin-top: 18px; }
main [data-page-tab][hidden] { display: none !important; }
.table-search { display: block; margin: 0 0 10px; }
.table-search input { width: min(340px, 100%); box-sizing: border-box; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 0.875rem; }
.table-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.table-pager { display: flex; align-items: center; gap: 10px; padding: 10px 2px 0; font-size: 0.82rem; color: var(--ink-secondary); }
.table-pager-nav { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.table-pager .btn-icon:disabled { opacity: 0.4; cursor: default; }

/* Named logins (26 Nov): the account at the menu's foot, and the sign-in page. */
.side-account { display: grid; gap: 2px; }
.side-who { padding: 0 10px; font-size: 0.8rem; color: var(--side-muted, var(--ink-muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-who b { color: var(--side-ink, var(--ink)); font-weight: 600; }
.sign-in-body { background: var(--bg, var(--surface-sunken)); min-height: 100vh; }
.sign-in { max-width: 380px; margin: 0 auto; padding: 12vh 16px 40px; }
.sign-in-brand { display: grid; justify-items: center; gap: 4px; margin-bottom: 20px; }
.sign-in-brand .brand-logo { width: 180px; height: auto; }
.sign-in h1 { font-size: 1.25rem; margin: 0 0 14px; }
.sign-in input[type="text"], .sign-in input[type="password"] { width: 100%; }
.sign-in .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }

/* --- the UI pass's shared parts (26 Nov; macros in templates/_ui.html) ----------------------------------------------
   Figure cards that are links (Zoho's "Sales Activity"): separate cards, so a short last row never leaves a grey gap. */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.fig { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
a.fig:hover { border-color: var(--line-strong); }
a.fig:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fig-value { font-size: 1.75rem; font-weight: 680; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink-secondary); }
.fig-label { font-weight: 600; font-size: 0.875rem; }
.fig-note { color: var(--ink-muted); font-size: 0.78rem; }
.fig.critical .fig-value { color: var(--critical-ink); }
.fig.serious .fig-value { color: var(--serious-ink); }
.fig.warning .fig-value { color: var(--warning-ink); }
.fig.info .fig-value { color: var(--accent-ink); }
.fig.good .fig-value { color: var(--good-ink); }
/* "Ready": the next step is ours and automatic (blue), beside good, warning, serious, critical and neutral. */
.state-info { background: var(--accent-wash); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
/* How this page works: the long explanation, folded under the heading. */
details.how { margin: 8px 0 0; max-width: 82ch; }
details.how > summary { cursor: pointer; color: var(--accent-ink); font-size: 0.85rem; font-weight: 550; width: fit-content; }
details.how > div { color: var(--ink-secondary); font-size: 0.875rem; line-height: 1.55; padding: 8px 0 2px; }
details.how > div p { margin: 0 0 8px; }
/* Empty: say why, and offer the next step. */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-secondary); font-size: 0.875rem; }
.empty-state b { color: var(--ink); font-size: 0.95rem; }
/* Tabs that run off a phone's edge fade out, so it's plain there are more. */
@media (max-width: 760px) {
  .page-tabs { mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
}
/* List and decision panel (Held orders, option B; Zoho's list-and-record): the list on the left, the chosen one on the right. */
.split { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.split-list { flex: 1 1 260px; max-width: 340px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.split-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 0.9rem; }
.split-item:hover { background: var(--surface-sunken); }
.split-item[aria-current="true"] { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.split-item .muted { font-size: 0.8rem; }
.split-panel { flex: 999 1 380px; min-width: 0; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.split-panel p { margin: 4px 0 0; }
.split-title { font-size: 1.15rem; }
.split-sub { font-size: 0.9rem; margin-bottom: 8px; }
.split-panel .grow { flex: 1 1 260px; display: flex; }
.split-panel .grow input { flex: 1; }
@media (max-width: 760px) { .split-list { max-width: none; border-right: 0; } }
.held-waiting { display: flex; flex-wrap: wrap; gap: 6px; }
.held-waiting a.chip { text-decoration: none; color: var(--ink); }
.held-card { margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.held-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.held-card p { margin: 0; }
/* Zoho items (option B): the find bar above three tabs; each old section is a subheading inside its tab. */
.zoho-find { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; max-width: 760px; scroll-margin-top: 130px; }
.zoho-find .grow { flex: 1 1 320px; display: flex; }
.zoho-find .grow input { flex: 1; min-height: 40px; font-size: 0.95rem; }
h3.sub { font-size: 0.95rem; margin: 22px 0 10px; }
[data-page-tab] > h3.sub:first-of-type { margin-top: 4px; }
.zrows { display: flex; flex-direction: column; }
.zrow { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.zrow:last-child { border-bottom: 0; }
.zrow-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.zrow p { margin: 0; }
.zrow .grow { flex: 1 1 240px; display: flex; }
.zrow .grow input { flex: 1; }
/* Connections (option A): a card per connection, each with its own state, facts and buttons. */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.conn-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.conn-card p { margin: 0; }
.conn-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.conn-head h2 { font-size: 1.05rem; margin: 0; }
.conn-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 0.875rem; }
.conn-facts dt { color: var(--ink-muted); }
.conn-facts dd { margin: 0; overflow-wrap: anywhere; }
.conn-meter { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; }
.conn-meter-head { display: flex; justify-content: space-between; gap: 10px; }
@media (max-width: 420px) { .conn-grid { grid-template-columns: 1fr; } }
/* Money: the switches as chips under the heading. */
.money-switches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; font-size: 0.85rem; }
.money-filter { margin-top: 16px; }
/* Marketing writes: each field as before → after, lists as chips (new entries marked +). */
.mk-changes { display: flex; flex-direction: column; gap: 4px; min-width: 320px; }
.mk-change { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) auto minmax(0, 1fr); gap: 4px 10px; align-items: start; font-size: 0.85rem; }
.mk-old { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.mk-old .chip { text-decoration: line-through; }
.mk-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
/* Order page, the rest around the journey (26 Nov): four facts in a row, the customer in one card, "In our system" folded. */
.fact-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; }
.fact-row .fact { padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; }
.fact-row .fact b { font-size: 0.95rem; }
.customer-card { display: flex; flex-direction: column; gap: 12px; }
.customer-card h2 { margin: 0; }
.customer-zoho { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); }
.customer-zoho p { margin: 0 0 4px; }
details.our-system > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; cursor: pointer; margin-bottom: 10px; list-style: none; }
details.our-system > summary::-webkit-details-marker { display: none; }
details.our-system > summary::before { content: "▸"; color: var(--ink-muted); width: 1em; }
details.our-system[open] > summary::before { content: "▾"; }
details.our-system > summary h2 { display: inline; margin: 0; }
/* Orders overview: the last-received card shows a date, so its value is smaller. */
.figs-key .fig:last-child .fig-value { font-size: 1.05rem; line-height: 1.3; }
/* A table that becomes a card per row on a phone (each cell labelled from its data-label). */
@media (max-width: 760px) {
  table.stack-table thead { display: none; }
  table.stack-table, table.stack-table tbody, table.stack-table tr, table.stack-table td { display: block; width: 100%; box-sizing: border-box; }
  table.stack-table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.stack-table td { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; padding: 3px 0; border: 0; }
  table.stack-table td::before { content: attr(data-label); color: var(--ink-muted); font-size: 0.8rem; }
}
/* "Are you sure?": a decision that can't be undone, with what it does said plainly. */
.confirm-card { max-width: 640px; display: flex; flex-direction: column; gap: 10px; }
.confirm-card h2, .confirm-card p { margin: 0; }
.confirm-buttons { margin-top: 6px; }
