/* Sell Global ops dashboard.
 *
 * Colour comes from the validated reference data-viz palette. Two rules from
 * it are load-bearing rather than cosmetic:
 *
 *   1. Status colours are reserved - good / warning / serious / critical - and
 *      are never reused as decoration or as a "series" colour. On this
 *      dashboard a red thing always means something is wrong.
 *
 *   2. A status colour never carries meaning alone. Every pill and banner
 *      ships a glyph and a word, because on the light surface `warning` and
 *      `serious` sit below 3:1 contrast by design, and because a reader with
 *      colour vision deficiency must get the same answer as everyone else.
 *
 * Dark mode is selected, not flipped: its own steps from the same ramps,
 * declared under both the OS media query and an explicit data-theme scope.
 */

/* BRAND vs STATUS - read this before adding a colour.
 *
 * The house style follows MerchantSpring, which is navy chrome with an orange
 * accent. That orange (#f5a623) is within a whisker of this palette's
 * --status-warning (#fab219), so used carelessly it destroys rule 1 above:
 * orange would mean "brand" in one place and "something is wrong" in another,
 * on the same page, and the reader has no way to tell which.
 *
 * The rule that keeps both: BRAND COLOUR LIVES ONLY ON THE NAVY CHROME -
 * topbar, sidebar, primary buttons. Status colour lives only on content
 * surfaces. The two never share a background, so orange-on-navy is never
 * mistaken for a warning and amber-on-white is never mistaken for branding.
 *
 * If you ever need the accent on a white surface, take --brand-ink instead.
 * It is the same hue darkened to carry text contrast, and it reads as a link,
 * not as an alarm.
 */
:root {
  color-scheme: light;

  --brand-navy:     #0c2d5e;   /* topbar, sidebar */
  --brand-navy-2:   #0a2650;   /* its darker step, for hovers */
  --brand-on-navy:  #ffffff;
  --brand-accent:   #f5a623;   /* active nav, primary button - ON NAVY ONLY */
  --brand-ink:      #b4700a;   /* the accent, safe on a light surface */

  --surface-1:      #ffffff;   /* cards, tables */
  --plane:          #f4f6f9;   /* page behind them */
  --card-shadow:    0 1px 2px rgba(12, 45, 94, 0.06);
  --th-band:        #eaf2fb;   /* table header band */
  --th-ink:         #1c4b8a;
  /* Current vs comparison: one hue, two steps (blue 450 / 250), validated as an
   * ordinal pair on #ffffff and #1a1a19. See viz.py. */
  --viz-current:    #2a78d6;
  --viz-comparison: #86b6ef;
  --viz-track:      #cde2fb;
  --ink:            #16202c;
  --ink-secondary:  #4a5568;
  --ink-muted:      #7b8794;
  --grid:           #e3e8ee;
  --axis:           #c3ccd6;

  --series-1:       #2a78d6;
  /* Diverging pair for signed amounts (money in / money out). The red
   * is the CATEGORICAL red, not status-critical: a fee is not a fault. */
  --diverging-negative: #e34948;

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;

  /* Tinted grounds for banners: the hue at low alpha over the surface, so the
   * text on top keeps its own ink token and stays legible in both modes. */
  --wash-good:     rgba(12, 163, 12, 0.10);
  --wash-warning:  rgba(250, 178, 25, 0.16);
  --wash-serious:  rgba(236, 131, 90, 0.14);
  --wash-critical: rgba(208, 59, 59, 0.11);

  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --brand-navy:    #0a2245;
    --brand-navy-2:  #081b38;
    --brand-on-navy: #ffffff;
    --brand-accent:  #f7b53f;
    --brand-ink:     #f0a92e;
    --card-shadow:   0 1px 2px rgba(0, 0, 0, 0.4);
    --th-band:       #17243a;
    --th-ink:        #9dc0ea;
    --viz-current:    #3987e5;
    --viz-comparison: #184f95;
    --viz-track:      #0d366b;
    --surface-1:     #1a1a19;
    --plane:         #0d0d0d;
    --ink:           #ffffff;
    --ink-secondary: #c3c2b7;
    --ink-muted:     #898781;
    --grid:          #2c2c2a;
    --axis:          #383835;
    --series-1:      #3987e5;
    --diverging-negative: #e66767;
    --wash-good:     rgba(12, 163, 12, 0.16);
    --wash-warning:  rgba(250, 178, 25, 0.14);
    --wash-serious:  rgba(236, 131, 90, 0.14);
    --wash-critical: rgba(208, 59, 59, 0.18);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-navy:  #0a2245;
  --brand-navy-2:  #081b38;
  --brand-on-navy: #ffffff;
  --brand-accent:  #f7b53f;
  --brand-ink:   #f0a92e;
  --card-shadow:   0 1px 2px rgba(0, 0, 0, 0.4);
  --th-band:       #17243a;
  --th-ink:        #9dc0ea;
  --viz-current:    #3987e5;
  --viz-comparison: #184f95;
  --viz-track:      #0d366b;
  --surface-1:     #1a1a19;
  --plane:         #0d0d0d;
  --ink:           #ffffff;
  --ink-secondary: #c3c2b7;
  --ink-muted:     #898781;
  --grid:          #2c2c2a;
  --axis:          #383835;
  --series-1:      #3987e5;
  --diverging-negative: #e66767;
  --wash-good:     rgba(12, 163, 12, 0.16);
  --wash-warning:  rgba(250, 178, 25, 0.14);
  --wash-serious:  rgba(236, 131, 90, 0.14);
  --wash-critical: rgba(208, 59, 59, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
}

body.centred {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* --- Chrome ------------------------------------------------------------- */

/* Navy bar, centred nav, orange on the active item. Brand colour never leaves
 * this bar - see the note at the top of the file. */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  height: 60px;
  background: var(--brand-navy);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--brand-on-navy);
  text-decoration: none;
  white-space: nowrap;
}

/* auto margins either side centre the nav without absolute positioning, so it
 * still wraps sanely on a narrow screen instead of overlapping the brand. */
.topbar nav {
  display: flex;
  gap: 6px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.topbar nav a {
  padding: 8px 14px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-weight: 550;
  white-space: nowrap;
}
.topbar nav a:hover { background: var(--brand-navy-2); color: #fff; }

/* The active item carries BOTH colour and weight. Colour alone would fail for
 * a reader who cannot separate the hues from the white siblings. */
.topbar nav a.on {
  color: var(--brand-accent);
  font-weight: 700;
  background: transparent;
}

.logout {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.logout:hover { color: #fff; border-color: rgba(255, 255, 255, 0.6); }

main { padding: 24px; max-width: 1500px; }

footer {
  padding: 20px 24px 40px;
  color: var(--ink-muted);
  font-size: 12px;
  max-width: 800px;
}

/* --- Card: the unit everything sits in ---------------------------------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 18px 20px;
  margin: 0 0 18px;
}
.card > :first-child { margin-top: 0; }
.card > :last-child  { margin-bottom: 0; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 0 0 18px;
}
.card-grid .card { margin: 0; }

/* --- KPI ---------------------------------------------------------------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 4px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

/* Movement is a fact about the number, not a status, so it uses the
 * diverging pair rather than status-good / status-critical. A fall in
 * revenue is not a system fault. The arrow is the non-colour channel. */
.kpi-delta { font-size: 13px; font-weight: 650; white-space: nowrap; }
.kpi-delta.up   { color: var(--status-good); }
.kpi-delta.down { color: var(--diverging-negative); }

/* --- Filter bar --------------------------------------------------------- */

.filters {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 14px 18px;
  margin: 0 0 18px;
}

/* Label above control, which is what the reference does and what makes a row
 * of six filters readable at a glance. */
.filters label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 4px;
}
.filters .field { display: flex; flex-direction: column; }

.filters select,
.filters input[type="date"],
.filters input[type="text"] {
  font: inherit;
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 150px;
}
.filters select:focus-visible,
.filters input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
}

button, .btn {
  font: inherit;
  font-weight: 650;
  color: #fff;
  background: var(--brand-navy);
  border: 1px solid var(--brand-navy);
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--brand-navy-2); }

/* --- Type --------------------------------------------------------------- */

h1 { font-size: 22px; margin: 0 0 6px; font-weight: 650; }
h2 { font-size: 16px; margin: 32px 0 6px; font-weight: 650; }
h2 .muted { font-weight: 400; font-size: 13px; }

.lede { color: var(--ink-secondary); margin: 0 0 14px; max-width: 76ch; }
.muted { color: var(--ink-muted); }
.small { font-size: 12px; }
.mono, code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.warn-text { color: var(--status-serious); font-weight: 600; }

.note {
  margin-top: 20px;
  padding: 12px 14px;
  border-left: 2px solid var(--grid);
  color: var(--ink-muted);
  font-size: 12.5px;
  max-width: 80ch;
}

pre {
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
}

/* --- Banners and pills -------------------------------------------------- */

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--grid);
  margin: 0 0 18px;
  max-width: 90ch;
}
.banner.good     { background: var(--wash-good);     border-color: var(--status-good); }
.banner.warning  { background: var(--wash-warning);  border-color: var(--status-warning); }
.banner.critical { background: var(--wash-critical); border-color: var(--status-critical); }

/* The glyph is the non-colour channel. It is why these read correctly in
 * greyscale, in forced-colors mode, and to a reader who cannot separate the
 * hues at all. */
.glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex: none;
  color: #fff;
}
.banner.good .glyph, .pill.good .glyph         { background: var(--status-good); }
.banner.warning .glyph, .pill.warning .glyph   { background: var(--status-warning); color: #3a2a00; }
.pill.serious .glyph                           { background: var(--status-serious); color: #3a1a00; }
.banner.critical .glyph, .pill.critical .glyph { background: var(--status-critical); }
/* Informational, not a status: neutral ink, so it never borrows a colour that
 * means good, warning or critical elsewhere on the page. */
.banner.info { background: var(--plane); }
.banner.info .glyph { background: var(--ink-secondary); color: var(--surface-1); font-style: italic; font-family: Georgia, serif; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--grid);
}
.pill .glyph { width: 15px; height: 15px; font-size: 10px; }
.pill.good     { background: var(--wash-good); }
.pill.warning  { background: var(--wash-warning); }
.pill.serious  { background: var(--wash-serious); }
.pill.critical { background: var(--wash-critical); }

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.alert.critical { background: var(--wash-critical); }

/* --- Tables ------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 8px;
}

th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--grid);
  vertical-align: top;
}

/* Header sits on a tinted band and STICKS, because these tables run to
 * hundreds of SKUs and a column of money with the heading scrolled off the
 * top is a column of unlabelled numbers. */
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--th-band);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--th-ink);
  white-space: nowrap;
  border-bottom: 1px solid var(--grid);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--plane); }

.r { text-align: right; }

/* Tabular figures so columns of money line up on the decimal point. Without
 * this, proportional digits make a column of amounts impossible to scan. */
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--axis);
  background: var(--plane);
}

tr.detail:hover { background: transparent; }
table.inner { border: none; margin: 8px 0 0; font-size: 12px; }
table.inner th, table.inner td { padding: 4px 8px; }

/* Wide tables scroll inside their own box. The page body must never scroll
 * sideways - a horizontal scrollbar on <body> hides the right-hand columns
 * of every table at once.
 *
 * max-height is what makes the sticky header actually work, and the reason is
 * a spec quirk worth knowing: setting overflow-x to auto forces overflow-y to
 * auto too. So this element is ALREADY a vertical scroll container - but with
 * no height limit it never scrolls, and a header sticking to the top of a
 * container that never scrolls does nothing at all. Give it a height and the
 * header does its job.
 */
.scroll {
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 260px);
  border-radius: 10px;
}
.scroll table { margin-bottom: 0; border-radius: 0; box-shadow: none; }

/* Freeze the identifying column. On a table this wide the numbers in the
 * right-hand columns are meaningless once the SKU has scrolled out of view -
 * the same failure as a scrolled-away header, on the other axis. */
.scroll.freeze td:first-child,
.scroll.freeze th:first-child {
  position: sticky;
  left: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--grid);
}
.scroll.freeze th:first-child { background: var(--th-band); z-index: 3; }
.scroll.freeze tbody tr:hover td:first-child { background: var(--plane); }
.scroll.freeze tr.total td:first-child { background: var(--plane); }

/* Two-line identity cell: what it is, then how to find it. */
.cell-primary { font-weight: 600; display: block; }
.cell-meta {
  display: block;
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.cell-meta .sep { opacity: 0.45; margin: 0 6px; }

/* A missing value is a dash, never a zero - the same rule the charts follow.
 * An em dash reads as "no figure"; a 0 reads as "we measured nothing", and
 * those are different claims. */
.none { color: var(--ink-muted); }

details summary {
  cursor: pointer;
  color: var(--ink-secondary);
  font-size: 12.5px;
  padding: 4px 0;
}

/* --- Charts ------------------------------------------------------------- */

.sparkcell, .barcell, .metercell { white-space: nowrap; }
.spark, .meter, .pnlbar { display: inline-block; vertical-align: middle; }
.metercell .num { margin-left: 8px; font-size: 12.5px; }

/* --- Forms -------------------------------------------------------------- */

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.filters label { font-size: 12px; color: var(--ink-muted); }

select, input[type="date"], input[type="password"], button {
  font: inherit;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--axis);
  background: var(--surface-1);
  color: var(--ink);
}

button {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }

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

/* --- Login -------------------------------------------------------------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: 12px;
  padding: 28px;
}

.login { width: 100%; max-width: 340px; }
.login h1 { margin-bottom: 2px; }
.login label { display: block; margin: 18px 0 6px; font-size: 12px; color: var(--ink-muted); }
.login input { width: 100%; }
.login button { width: 100%; margin-top: 18px; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { height: auto; padding: 10px 16px; }
}

/* The dots in the wordmark, echoing the reference logo. Decorative only, so
 * it is hidden from assistive tech rather than being read out as bullets. */
.brand-dots {
  color: var(--brand-accent);
  letter-spacing: -1px;
  font-size: 13px;
  margin: 0 3px;
  vertical-align: 2px;
}

/* Filter fields: label ABOVE control. Each label+control pair needs its own
 * wrapper, because in a flex row every child is its own item - a bare
 * <label> next to a bare <select> sits BESIDE it, not above it. */
.filters .field label { margin-bottom: 4px; }

@media (max-width: 720px) {
  .topbar { height: auto; padding: 10px 16px; gap: 10px; }
  .topbar nav { margin: 0; width: 100%; }
  main { padding: 16px; }
  .filters { padding: 12px 14px; gap: 12px; }
  .filters select,
  .filters input[type="date"] { min-width: 0; width: 100%; }
  .filters .field { flex: 1 1 160px; }
}

/* =========================================================================
 * Dashboard / Clients / Marketplace - the MerchantSpring-shaped pages
 * ========================================================================= */

/* --- Operations menu (the gear) ------------------------------------------ */

.navmenu { position: relative; }
.navmenu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.78);
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 550;
}
.navmenu summary::-webkit-details-marker { display: none; }
.navmenu summary:hover,
.navmenu[open] summary { background: var(--brand-navy-2); color: #fff; }
.navmenu.on summary { color: var(--brand-accent); }
.navmenu summary:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

.navmenu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: var(--surface-1);
  border: 1px solid var(--grid);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(12, 45, 94, 0.14);
  padding: 6px;
  z-index: 20;
}
.navmenu .menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.navmenu .menu a span {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-muted);
}
.navmenu .menu a:hover,
.navmenu .menu a[aria-current="page"] { background: var(--plane); }

/* --- Page structure ------------------------------------------------------ */

.page-head { margin: 4px 0 16px; }
.page-head h1 { font-size: 24px; letter-spacing: -0.01em; margin: 0; }
.page-head .muted { margin: 4px 0 0; }
.eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.sep { opacity: 0.45; margin: 0 7px; }

.crumbs { font-size: 13px; margin: 0 0 8px; color: var(--ink-muted); }
.crumbs a { color: var(--ink-secondary); }
.crumbs span[aria-hidden] { margin: 0 7px; opacity: 0.6; }

.currency-section { margin: 0 0 30px; }
.section-title {
  font-size: 15px;
  margin: 26px 0 10px;
  letter-spacing: 0.01em;
}

.card h3 { font-size: 15px; margin: 0; font-weight: 650; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .scroll { border-radius: 0; max-height: none; }
.card.flush table { border: none; border-top: 1px solid var(--grid); }
.padded { padding: 16px 20px; margin: 0; }
.card-head.padded { margin: 0; }

/* Chart two-thirds, mix one-third - the reference layout - stacking when narrow. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
  margin: 0 0 18px;
}
.split .card { margin: 0; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.filter-note {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

/* --- KPI tiles ----------------------------------------------------------- */

.kpi { min-width: 0; }
.kpi p { margin: 0; }
/* Proportional figures on the big number: tabular digits make a large
 * standalone value look loose. Tabular stays for columns (.num). */
.kpi-value { font-variant-numeric: normal; }
.kpi-row .kpi + .kpi { border-left: 1px solid var(--grid); padding-left: 18px; }
.kpi-sub-inline { font-weight: 400; color: var(--ink-muted); margin-left: 4px; }
@media (max-width: 720px) {
  .kpi-row .kpi + .kpi { border-left: none; padding-left: 0; }
}

/* --- Charts -------------------------------------------------------------- */

.chart-block { min-width: 0; }
.chart-frame { width: 100%; }
/* The SVG scales to the card; its viewBox includes the x-axis band, so a
 * narrow card never crops the date labels (a listed anti-pattern). */
.colchart { display: block; width: 100%; height: auto; }

/* Hover labels on the column chart (viz._hover). Shown at once, by CSS -
 * the pages run no script. The label never takes the pointer, so moving
 * across buckets is not snagged by the previous one's box. */
.colchart .tip { visibility: hidden; pointer-events: none; }
.colchart .hit:hover .tip { visibility: visible; }
.colchart .hit:hover .hit-area { fill: var(--viz-current); fill-opacity: 0.06; }
.colchart .tip-bg {
  fill: var(--surface-1);
  stroke: var(--axis);
  stroke-width: 1;
  filter: drop-shadow(0 2px 4px rgba(12, 45, 94, 0.15));
}
.colchart .tip-text { fill: var(--ink); }
.colchart .tip-head { font-weight: 600; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.legend li { display: flex; align-items: center; gap: 7px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch.current { background: var(--viz-current); }
.swatch.comparison { background: var(--viz-comparison); }
.swatch.ordered {
  background: repeating-linear-gradient(45deg, var(--viz-current) 0 2px, var(--viz-track) 2px 6px);
}
.kpi-unsettled .kpi-value { color: var(--ink-secondary); }

.chart-note { font-size: 12px; color: var(--ink-muted); margin: 6px 0 0; max-width: 80ch; }

.tableview { margin-top: 10px; }
.tableview summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-secondary);
  font-weight: 600;
}
.tableview .scroll { margin-top: 8px; max-height: 320px; }

/* --- Share bars ---------------------------------------------------------- */

td.share { white-space: nowrap; }
td.share svg { vertical-align: middle; margin-right: 8px; }
td.share .num { font-size: 12.5px; color: var(--ink-secondary); }
table.mix { box-shadow: none; }
table.mix td { padding-top: 8px; padding-bottom: 8px; }
table.mix a { color: var(--ink); font-weight: 600; text-decoration: none; }
table.mix a:hover { text-decoration: underline; }

/* --- Converted total ----------------------------------------------------- */

table.converted-parts { margin-top: 14px; max-width: 640px; }
.converted-note { margin: 12px 0 0; max-width: 640px; }

/* --- Clients grid -------------------------------------------------------- */

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.client-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.client-card:hover { border-color: var(--axis); box-shadow: 0 4px 14px rgba(12, 45, 94, 0.08); }
.client-card:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.client-card.unassigned { border-style: dashed; }
.client-card-head h2 { font-size: 16px; margin: 0; }
.client-card-sales { margin-top: auto; }
.client-card-sales p { margin: 0; font-size: 17px; }

.mp-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.mp-chips li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--plane);
  border: 1px solid var(--grid);
  color: var(--ink-secondary);
}

/* 3P / 1P badge. Neutral on purpose: which programme an account is in is an
 * attribute, not a status, so it borrows no status or series colour. */
.chan {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--axis);
  color: var(--ink-secondary);
  background: var(--surface-1);
}
.chan-1p { border-style: dashed; }

/* --- Rail: the client sidebar -------------------------------------------- */

.with-rail {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.rail-content { min-width: 0; }

.rail {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: var(--brand-navy);
  border-radius: 10px;
  padding: 12px 8px;
}
.rail-head {
  margin: 2px 10px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  border-radius: 7px;
}
.rail-client {
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  font-size: 13.5px;
}
.rail-client:hover { background: var(--brand-navy-2); color: #fff; }
.rail-client.unassigned { font-style: italic; }
.rail-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.rail li.open > .rail-client { color: #fff; }
/* The selected item: the reference's orange bar. On navy, so it is brand
 * colour where brand colour is allowed - never a warning. Weight carries it
 * too, for readers who cannot separate the hue. */
.rail-client.on,
.rail-mp.on {
  background: var(--brand-accent);
  color: var(--brand-navy) !important;
  font-weight: 700;
}
.rail-client.on .rail-count { color: var(--brand-navy); }
.rail li.open > ul { margin: 2px 0 8px 10px; border-left: 1px solid rgba(255, 255, 255, 0.16); padding-left: 6px; }
.rail-mp {
  padding: 6px 8px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
}
.rail-mp:hover { background: var(--brand-navy-2); color: #fff; }
.rail .chan {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.7);
}
.rail .on .chan { border-color: var(--brand-navy); color: var(--brand-navy); }
.rail a:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 1px; }

@media (max-width: 900px) {
  .with-rail { grid-template-columns: 1fr; }
  .rail { position: static; max-height: 320px; }
}

/* ---- Channel Profit statement (Reports) --------------------------------
   Two periods side by side, as MerchantSpring shows them, stacking on a
   narrow screen rather than scrolling sideways. */
.statement-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  align-items: start;
}
.statement-card { padding-bottom: 4px; }
table.channel { width: 100%; }
table.channel td, table.channel th { padding: 4px 8px; }
table.channel tr.section td {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .78rem;
  color: var(--muted);
  padding-top: 12px;
}
table.channel tr.subtotal td { border-top: 1px solid var(--grid); font-weight: 600; }
/* The one converted figure: visibly secondary to the line it sits under. */
table.channel tr.converted-line td { padding-top: 2px; font-weight: 400; }
/* Weight, not a status colour: amber text on white is under 3:1 (see the top). */
.other-ccy { color: var(--ink); font-weight: 650; }
table.channel tr.total td {
  border-top: 2px solid var(--grid);
  border-bottom: 2px solid var(--grid);
  font-weight: 700;
}
table.channel tbody.metrics tr td:first-child { color: var(--muted); }
.detail-pnl { margin-top: 20px; }
.detail-pnl summary { cursor: pointer; color: var(--muted); }

/* Product identity in the per-SKU table: title first, codes underneath. */
.product-cell { min-width: 280px; max-width: 420px; }
.product-cell .cell-primary { display: block; font-weight: 500; }
.product-cell .cell-primary a { color: inherit; }
.product-cell .cell-meta { display: block; font-size: .78rem; color: var(--muted); }

/* --- People (041) ---------------------------------------------------------- */

.whoami { color: rgba(255, 255, 255, 0.78); font-size: 13px; white-space: nowrap; }
input[type="text"], input[type="email"] {
  font: inherit; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--axis); background: var(--surface-1); color: var(--ink);
}
.login input[type="text"], .login input[type="email"] { width: 100%; }
button.secondary { background: var(--surface-1); color: var(--ink); border-color: var(--axis); }
button.secondary.danger { color: var(--status-critical); border-color: var(--status-critical); }
button:disabled { opacity: .45; cursor: not-allowed; }
.admin-form { display: grid; gap: 14px; }
.admin-form .row { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.admin-form .row label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-muted); }
.admin-form button { justify-self: start; }
.client-picks { border: 1px solid var(--grid); border-radius: 8px; padding: 10px 14px; margin: 0; }
.client-picks .picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 16px; }
.client-picks label { font-size: 14px; color: var(--ink); display: flex; gap: 8px; align-items: center; }
.person { border-top: 1px solid var(--grid); }
.person > summary { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 12px 20px; cursor: pointer; }
.person.disabled > summary { opacity: .6; }
.person-name { font-weight: 600; }
.person-meta { flex-basis: 100%; }
.person-body { padding: 4px 20px 18px; display: grid; gap: 14px; }
.person-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.link-card { border-color: var(--status-good); display: grid; gap: 8px; margin-bottom: 18px; }
.link-box { width: 100%; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.download { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; }
.button-link {
  display: inline-block; padding: 6px 12px; border-radius: 6px; font-weight: 600;
  border: 1px solid var(--series-1); color: var(--series-1); text-decoration: none;
}
.button-link:hover { background: var(--th-band); }
