/* Shared shell styles for the console, the portal, and the credential pages.
   One file rather than a copy per page: there is no build step here, so a <link>
   is the only mechanism that keeps four pages looking like one product. */

.offer-option-search { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.offer-option-search input { width: 180px; max-width: 100%; }

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #12151a;
  --muted: #667085;
  --accent: #2f6feb;
  --good: #12805c;
  --bad: #b42318;
  --radius: 10px;
  /* The drawer scrim. It is the one derived surface that must NOT come from
     --text: --text is the token that flips polarity between the themes, so a
     scrim mixed from it dims on light and BRIGHTENS on dark — a 40% white veil
     over a #0f1115 page, which reads as a rendering fault at exactly the moment
     the drawer wants the eye. A scrim darkens in both themes, so each theme
     mixes it from whichever of the eight tokens is dark there: --text on light,
     --bg on dark. No literal, and no base token changes. */
  --scrim: color-mix(in srgb, var(--text) 45%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #171a21; --border: #262b35;
    --text: #e8eaed; --muted: #98a2b3; --accent: #6aa2ff;
    --good: #3ccb9a; --bad: #f97066;
    --scrim: color-mix(in srgb, var(--bg) 72%, transparent);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 24px;
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "PingFang TC",
        "Microsoft JhengHei", sans-serif;
  background: var(--bg); color: var(--text);
}
html:lang(zh-TW) body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", "PingFang TC", "Microsoft JhengHei",
               "PingFang SC", "Microsoft YaHei", sans-serif;
}
header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.brand-logo { display: block; width: auto; max-width: 100%; height: auto; }
/* The light-ink wordmark exists for the console's dark top bar only. */
.brand-logo--light { display: none; }
.portal-header { align-items: center; }
.portal-brand {
  display: flex; align-items: center; margin: 0; padding: 4px 9px;
  border: 1px solid var(--border); border-radius: 9px; background: #fff;
}
.brand-logo--portal { width: 180px; max-height: 56px; object-fit: contain; }
.sub { color: var(--muted); font-size: 13px; }
.live { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.dot.is-error { background: var(--bad); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
/* A column, so the number can be pinned to the bottom. Grid stretches every
   card in a row to the tallest of them, so bottom-aligning the value is what
   makes the numbers share a baseline — without it a label that wraps to two
   lines ("Conversion rate") pushes its own number 18px below every other number
   on the dashboard, which reads as the row being broken. Reserving two lines on
   every label would also align them, at the cost of a blank line under seven
   cards out of eight. */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column;
}
.card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card .value {
  font-size: 26px; font-weight: 600; margin-top: auto; padding-top: 6px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.card .value.good { color: var(--good); }
section { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
section h2 { font-size: 13px; margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
/* The Offer table is genuinely wider than a laptop, and macOS/iOS overlay
   scrollbars are invisible until you already scrolled — so the fact that there
   is more to the right has to be painted. Two layers: a panel-coloured cover
   attached to the CONTENT, and a shadow attached to the SCROLLPORT. While there
   is content to the right the cover sits off past the visible edge and the
   shadow shows; scroll to the end and the cover lands on the shadow and hides
   it. No new tokens — the shadow is mixed from --text, so it darkens on light
   and lightens on dark by itself. */
.scroll {
  overflow-x: auto;
  background:
    linear-gradient(to left, var(--panel), var(--panel)) right center / 24px 100% no-repeat,
    linear-gradient(to left, color-mix(in srgb, var(--text) 14%, transparent), transparent)
      right center / 24px 100% no-repeat;
  background-attachment: local, scroll;
  background-color: var(--panel);
}
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 16px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: none; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table-sort {
  border: 0; padding: 0; background: transparent; color: inherit;
  font: inherit; cursor: pointer;
}
.table-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.empty { padding: 20px 16px; color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.link-cell { max-width: 460px; overflow: hidden; text-overflow: ellipsis; }

/* Portal primitives — tabs, filter bar, status badges, the link builder.
   They live here rather than in a <style> block on publisher.html so the portal
   inherits the same tokens as the console: one --accent, one dark-mode block.
   A page-local palette is how two surfaces of one product drift apart. */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; }
.toolbar .spacer { margin-left: auto; }
/* A label and its control are one thing.
   As two separate flex items in a wrapping toolbar they wrap independently, and
   the row breaks between a label and the select it names — measured on the
   offer list: "Model [All] Country" on one line and "[All] Access" on the next,
   so every control after the first wrap sits under the wrong word. Eight lines
   of that at 1440px. One inline-flex item per pair, with no wrapping inside it,
   is the whole fix: the row still wraps, but only between fields. */
.toolbar .filter { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: 0 0 auto; }
.toolbar .filter label { margin: 0; }
.toolbar .filter select { width: auto; max-width: 260px; }
/* Short free-text and numeric boxes. Used on the toolbars for a country code,
   an event id, a payout bound: none of them wants the 100% an <input> gets by
   default, and at narrow widths that default was the min/max pair each taking a
   full line of its own. */
input.narrow { width: 96px; }
.chip {
  font: inherit; font-size: 13px; cursor: pointer; border-radius: 999px;
  padding: 5px 12px; border: 1px solid var(--border);
  background: transparent; color: var(--text);
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
/* The one action in a row that moves it forward (Request access): the accent
   outline, without competing with the page's own primary buttons. */
.chip.primary { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.primary:disabled { opacity: .5; cursor: default; }
/* The portal's All / Mine / Starred lists: one row of chips over the filters. */
.scope-bar { gap: 6px; padding-bottom: 0; }
.scope-bar .sub { margin-left: 6px; }
.scope-bar [data-offer-scope][aria-busy="true"]::before {
  content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 6px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  vertical-align: -2px; animation: offer-loading-spin .7s linear infinite;
}
@keyframes offer-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .scope-bar [data-offer-scope][aria-busy="true"]::before { animation: none; }
}
/* The theme switch (mountThemeToggle in client.js): Light | Dark as two chips,
   the pressed one being the theme on screen. */
.theme-toggle { display: inline-flex; gap: 4px; white-space: nowrap; }
/* The offer list's category counts: the number sits inside the chip, quieter
   than the name, in figures that line up from chip to chip. */
.cat-summary { padding-top: 0; }
/* Folded, the category counts are one line: the label, the category in force
   and its count. Open, the chips sit under it. */
.cat-summary > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 0; list-style: none; font-size: 13px;
}
.cat-summary > summary::-webkit-details-marker { display: none; }
.cat-summary > summary::after {
  content: '▾'; opacity: .55; font-size: 11px; transition: transform .15s;
}
.cat-summary[open] > summary::after { transform: rotate(180deg); }
.cat-summary > summary:hover { color: var(--accent); }
.cat-current { font-weight: 600; }
.cat-chips { padding-top: 0; gap: 6px; }
.chip .n { margin-left: 4px; opacity: .65; font-variant-numeric: tabular-nums; }
/* The star left of an offer's tracking link: hollow until the channel stars it,
   filled after. Starred offers are the ones whose status reaches Messages. */
.star-toggle {
  background: none; border: 0; padding: 2px 6px 2px 0; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--muted, #999); vertical-align: middle;
}
.star-toggle[aria-pressed="true"] { color: #f5a623; }
.star-toggle:hover { color: #f5a623; }
td.nowrap { white-space: nowrap; }
/* A text-sized button for a link inside a table cell (View offer). */
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 8px 14px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.tab[aria-selected="true"] {
  background: var(--panel); border-color: var(--border); color: var(--text); font-weight: 600;
}
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge.good { color: var(--good); border-color: currentColor; }
.badge.warn { color: var(--accent); border-color: currentColor; }
.badge.bad  { color: var(--bad);  border-color: currentColor; }

/* An unread notice.
   A left rule rather than a background tint: the severity badge in the row is
   already carrying colour, and a second colour behind it makes a critical
   warning harder to pick out rather than easier. The rule reads at a glance
   down the edge of the table and does not compete with anything. */
tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.unread td strong { font-weight: 700; }
input.mini { width: auto; padding: 6px 9px; font-size: 13px; }
/* inline-flex, not inline: these labels wrap a checkbox and a text span, and as
   plain inline content the two sit on a shared baseline that the checkbox does
   not actually share — the text overflowed its own label box by 7px on the
   notices filter bar. A flex row with a gap puts them on one centred line and
   costs nothing where the label is only text. */
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 0 0; }
select {
  font: inherit; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
button.link {
  background: none; border: none; color: var(--accent); padding: 0;
  font: inherit; text-decoration: underline; cursor: pointer;
  /* Left, not centred. A button is inline-block and centres its own text, so a
     long link that wraps to a second line arrives centred in the middle of a
     left-aligned paragraph. */
  text-align: left;
}

/* One onboarding step.
   It used to be a run of inline content — number, link button, two spans and a
   chip — inside a single div. Buttons are inline-block, so the long link and
   the taller chip each formed a box that the surrounding line boxes then
   overlapped: measured on the overview, three pairs of siblings in step 5 were
   intersecting by up to 414 x 24 pixels. A flex row with the number, the prose
   and the action as three items cannot do that. */
.onboard-step {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 4px 8px; margin: 8px 0; line-height: 1.6;
}
.onboard-step + .onboard-step { border-top: 1px solid var(--border); padding-top: 8px; }
/* flex-start, not baseline, and the number carries the same line-height as the
   prose so the two still line up.
   The step title is a <button>, which is an inline-block atom: a long one forms
   a box two lines tall, and `align-items: baseline` then aligns the number to
   that box's LAST baseline — dropping "5." to the bottom of its own step while
   the link sat above it. Top alignment is what a numbered list actually wants,
   and it does not care how tall the content beside the number turns out to be. */
.onboard-num { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.6; }
/* basis 0, not auto: with `auto` the basis is the sentence's own width, which
   is wider than the space left beside the number, so the whole block wraps and
   the number ends up alone on a line above its own step. Basis 0 lets the text
   take whatever is left and wrap inside itself, which is what a numbered list
   looks like. */
.onboard-text { flex: 1 1 0; min-width: 0; }
.onboard-action { display: block; margin-top: 8px; }
.builder { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.builder .subs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.builder .subs > div { display: flex; flex-direction: column; gap: 4px; }
.builder .subs label { margin: 0; font-size: 11px; color: var(--muted); }
.builder input.sub { width: 120px; }
.builder .out { display: flex; gap: 8px; align-items: center; }
.builder .out input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.pager { display: flex; gap: 10px; align-items: center; padding: 12px 16px; color: var(--muted); font-size: 13px; }
body.portal #panel-offers .pager { flex-wrap: wrap; }
#offer-pages, #offer-jump-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#offer-jump { width: 76px; min-width: 0; }
.note { padding: 12px 16px; color: var(--muted); font-size: 13px; }
.trunc { max-width: 160px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }

/* The portal in the console's look, where it is cheap: the console's surfaces,
   headings, table heads and badges, read from the shared tokens (body.portal
   carries them, see the token block). Scoped to body.portal — the portal, its
   guide and the sign-in page — so the console's own rules are untouched. */
body.portal section { box-shadow: var(--shadow); }
body.portal section h2 { display: flex; align-items: center; gap: 10px; color: var(--text); letter-spacing: 0; text-transform: none; }
body.portal section h2::before { content: ""; flex: 0 0 auto; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); }
body.portal thead th { background: var(--panel-2); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
body.portal tfoot tr.total td { font-weight: 600; background: var(--panel-2); border-top: 1px solid var(--border); border-bottom: 0; }
body.portal .badge { border-color: transparent; font-weight: 600; background: color-mix(in srgb, var(--muted) 14%, transparent); }
body.portal .badge.good { background: color-mix(in srgb, var(--good) 14%, transparent); }
body.portal .badge.warn { color: color-mix(in srgb, var(--s4) 68%, var(--text)); background: color-mix(in srgb, var(--s4) 16%, transparent); }
body.portal .badge.bad { background: color-mix(in srgb, var(--bad) 13%, transparent); }
body.portal .tab[aria-selected="true"] { color: var(--accent); box-shadow: var(--shadow); }
body.portal .card { box-shadow: var(--shadow); }
body.portal .builder { background: var(--panel-2); }
/* The dashboard: earnings on the left with their trend, eight smaller figures on
   the right. */
.pub-dash { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; margin-bottom: 20px; }
.pub-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pub-metrics .card .value { font-size: 20px; }
/* Beside the earnings card on a narrow desktop, four across clips a
   two-currency EPC; below 900px the dashboard stacks and four fit again. */
@media (min-width: 901px) and (max-width: 1023px) { .pub-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pub-hero { gap: 4px; border-top: 3px solid var(--good); }
.pub-hero > .value { font-size: 30px; margin-top: 2px; }
.pub-amounts { display: flex; flex-wrap: wrap; gap: 2px 16px; align-items: baseline; }
.pub-metrics .value.pub-amounts { flex-direction: column; gap: 0; font-size: 16px; }
.pub-pending { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; color: var(--muted); font-size: 13px; }
.pub-trend { margin: auto 0 0; padding-top: 8px; }
.pub-trend svg { display: block; width: 100%; height: 64px; overflow: visible; }
.pub-trend figcaption { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.pub-legend::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--c); }
.range-select { display: none; }
.range-chips, .range-dates { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.link-hint { margin: 8px 0 0; white-space: normal; }
tr.st-detail > td { padding: 0; white-space: normal; text-align: left; }
tr.st-detail h4 { margin: 14px 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 900px) {
  .pub-dash { grid-template-columns: minmax(0, 1fr); }
}

/* Operator console: multi-field create forms and the live margin readout.
   No new tokens and no literal colours — the console reads its greens, reds and
   accents from the same eight variables the portal does, which is what keeps the
   two surfaces in step across the light/dark switch. */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid select, .form-grid input { width: 100%; }
.meter { display: flex; gap: 20px; align-items: baseline; flex-wrap: wrap; }
.meter b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
/* input{width:100%} is unqualified, so a checkbox dropped into a grid field
   would stretch across its whole column. */
.form-grid input[type="checkbox"], .builder input[type="checkbox"],
table input[type="checkbox"], #report-columns input[type="checkbox"] { width: auto; }
/* An inline panel sits in a cell of a table that is deliberately wider than the
   screen (the Offer table is ~1750px and lives inside .scroll). Without a bound
   its form-grid lays out across that whole width and half the fields end up past
   the right edge of the viewport, reachable only by scrolling the table
   sideways. The panel is a form, not a row, so it takes a form's width. */
.row-panel { max-width: 900px; }

/* A panel embedded in a table cell inherits `td { white-space: nowrap }`, which
   is correct for a data cell and wrong for everything a panel contains.
   Measured on the offer Edit row: the grid was 868px wide with 1290px of
   content. Nothing could wrap, so every hint sentence ran off the right edge
   mid-word, and — the part that looked like a rendering fault rather than a
   long line — the amount input and its unit select, each width:100% of a 280px
   column, could not break onto separate lines and sat SIDE BY SIDE, so the
   select spilled into the neighbouring column as an unlabelled empty box beside
   the wrong field.
   Scoped to the panel rather than lifted from td, because a data cell still
   wants nowrap: a payout wrapping between its digits is unreadable. Rules that
   set nowrap explicitly — .badge, .trunc, .kv .k — are unaffected, being direct
   declarations rather than inheritance. */
td .builder, td .row-panel { white-space: normal; }
/* The conversion detail panel: label/value pairs that wrap into columns instead
   of a nine-column table nobody can read a single row of. */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 16px; }
.kv > div { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.kv .k { color: var(--muted); font-size: 12px; white-space: nowrap; }
.kv .v { overflow: hidden; text-overflow: ellipsis; }
.builder .cards { margin-bottom: 0; }
.macros { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* The first-run guide is a numbered list of things to go do, not a paragraph. */
.steps > div + div { margin-top: 8px; }
/* The clipboard fallback needs somewhere real to put the text: a Selection over
   a display:none node selects nothing, which is how the old fallback managed to
   say "press Ctrl+C" with an empty clipboard. Rendered, focusable, selectable,
   and invisible — not display:none, not visibility:hidden. */
.offscreen {
  position: fixed; top: 0; left: 0; width: 1px; height: 1px;
  padding: 0; border: 0; opacity: 0; pointer-events: none;
}

/* ============================================================================
   Operator console shell — top bar + left sidebar + working area.
   ============================================================================
   Every selector below is class-prefixed. A bare element selector here (an
   `a { }`, a `nav { }`) would reach into login.html and set-password.html, which
   share this stylesheet and have no shell at all.

   The single highest-risk edit in this file would be `body { padding: 0 }`:
   publisher.html, login.html, set-password.html and index.html all depend on the
   24px gutter that rule provides. So the console opts in by class instead, and
   the body rule above is untouched. `.tabs` / `.tab` also stay in the file even
   though admin.html no longer uses them — publisher.html still does. */
/* ---- LIGHT (console default). Replaces app.css 301-318: the old body.console
   token block AND the :root { --sidebar-w … --nav-active-bg } block. The four
   --nav-* tokens are kept but now DERIVED from the theme, so the rail flips with
   it. Series colours stay on :root (app.css 652-655). The console's <head>
   script always sets html[data-theme] to 'light' or 'dark', so this is the
   explicit-light set as well as the fallback.
   The channel portal (body.portal) wears the same tokens in both themes, so
   the two surfaces of one product cannot drift apart; the layout below the
   token list stays the console's own. */
body.console { padding: 0; min-height: 100dvh; }
body.console, body.portal {
  color-scheme: light;
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #f5f7fa;        /* secondary surface: toolbar bands, thead, builder, in-panel tiles, hover */
  --border: #dfe3ea;
  --text: #101828;
  --muted: #5b6577;
  --accent: #087591;         /* brand teal, 5.6:1 on white */
  /* Accent as text on its own tint (a pressed chip): the plain accent came to
     4.48:1 there, so light deepens it a step. */
  --accent-ink: color-mix(in srgb, var(--accent) 80%, var(--text));
  --good: #0e6b4c;           /* 5.3:1 on its own 14% badge tint; #12805c was 4.1 */
  --bad: #b42318;
  /* Amber text. Mixed from the palette step toward --text, so it darkens on
     light and lightens on dark; light needs the deeper mix to clear 4.5:1 on
     its own tint (68% gave 3.6). */
  --warn-ink: color-mix(in srgb, var(--s4) 50%, var(--text));
  --radius: 10px;            /* panels, cards, dialogs */
  --radius-sm: 6px;          /* controls, badges, tiles inside panels, action chips */
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --scrim: color-mix(in srgb, var(--text) 45%, transparent);
  --nav-bg: var(--panel);
  --nav-active-bg: color-mix(in srgb, var(--accent) 10%, transparent);
  --nav-accent: var(--accent);
  --nav-link-accent: var(--accent);
  --sidebar-w: 224px; --topbar-h: 48px; --topbar-min: 48px;
  background: var(--bg); color: var(--text);
}

/* ~20 nav links precede the content on every page now. */
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 60;
  padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  text-decoration: none; transform: translateY(-300%);
}
.skip-link:focus { transform: none; outline: 2px solid var(--accent); }

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
  margin: 0; width: 100%; min-height: var(--topbar-min); height: var(--topbar-h);
  padding: 2px 10px; color: #333; background: #fff; border: 0;
  box-shadow: 0 0 2px 1px var(--nav-accent);
}
/* The wrapper generates no extra box, so the mobile menu button, brand and
   session controls remain direct flex items in the fixed 45px bar. */
.topbar-main { display: contents; }
.topbar .live { order: 2; }
.topbar .brand {
  display: flex; flex: 0 0 auto; align-items: center; gap: 9px; height: 100%;
  text-decoration: none; color: #666;
}
.topbar .brand h1 { display: flex; align-items: center; margin: 0; line-height: 1; }
.topbar .brand-logo--topbar { width: 118px; max-height: 40px; object-fit: contain; }
.topbar .brand .sub, .topbar .live { color: #666; }
.topbar .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topbar button.quiet, .topbar .chip { color: #666; border-color: #d5d5d5; }

/* Nothing in the fixed bar may grow taller than the bar.
   A label that wraps to two lines inside a 45px bar does not merely look
   cramped: the control grows past the bar in BOTH directions and sits on top of
   the page beneath it. Measured at 900px, Sign out ran from -5px to 50px in a
   0-45px bar. So wrapping is forbidden here rather than tolerated, and a bar
   that runs out of room clips instead of breaking out of itself. */
.topbar .live { min-width: 0; }
.topbar .live > * { flex: 0 0 auto; white-space: nowrap; }

/* Below this the bar cannot hold the connection tick, the operator address, two
   reference links, three language buttons and Sign out at once, so the
   reference links go: they are conveniences and both destinations are reachable
   from inside the console, while identity and Sign out are not negotiable.
   Hiding them is what keeps the bar within its own height — the alternative
   tried first, clipping the row with overflow:hidden, kept the height but cut
   off Sign out, which is the worst thing in the bar to lose. */
@media (max-width: 1129px) {
  body.console .topbar .doc-chip { display: none; }
}
/* Their stand-ins at the foot of the nav (admin.html .nav-refs), shown only on
   the widths where the bar has dropped them. */
body.console .nav-refs { display: none; }
@media (max-width: 1129px) {
  body.console .nav-refs { display: block; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
}
/* .toolbar sets display:flex and .badge sets display:inline-block, both of which
   beat the user-agent [hidden] rule. */
.toolbar[hidden], .badge[hidden] { display: none; }

.shell {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start; min-height: 100dvh; padding-top: var(--topbar-h);
  transition: grid-template-columns 1s;
}
/* min-width:0 is what lets the 12-column Offer table scroll inside .scroll
   instead of forcing the grid column wider than the viewport. */
.workspace { min-width: 0; padding: 20px 20px 40px; background: var(--bg); }
.workspace:focus { outline: none; }
.rangebar { padding: 0 0 16px; }

.nav {
  position: sticky; top: var(--topbar-h);
  height: calc(100dvh - var(--topbar-h)); overflow-y: auto;
  min-width: 0; width: 100%; padding: 8px 0 24px;
  color: #bbb; background: var(--nav-bg); border: 0;
  overflow-x: hidden; white-space: nowrap;
  transition: opacity .2s, visibility 0s;
}
.nav-groups, .nav-list { list-style: none; margin: 0; padding: 0; }
.nav-group + .nav-group { margin-top: 2px; }
.nav-list { max-height: 300px; overflow-x: hidden; overflow-y: auto; }
.nav-group-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  height: 40px; padding: 0 18px; border: 0; border-radius: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; text-align: left;
  background: transparent; color: #bbb;
}
.nav-group-toggle::after { content: "\25BE"; font-size: 10px; margin-left: 8px; }
.nav-group-toggle[aria-expanded="false"]::after { content: "\25B8"; }
.nav-group-toggle:hover { color: #fff; background: var(--nav-active-bg); }
.nav-group-toggle:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: -2px; }
/* A collapsed group still shows where you are. */
.nav-group.is-current { background: var(--nav-active-bg); box-shadow: inset 0 0 5px rgba(0, 0, 0, .3); }
.nav-group.is-current .nav-group-toggle { color: #fff; }

.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 40px;
  padding: 0 15px 0 33px; border-radius: 0;
  font-size: 12px; font-weight: 400; color: #fff; text-decoration: none;
}
.nav-item:hover { color: var(--nav-link-accent); }
/* input:focus covers inputs only; a link needs its own. */
.nav-item:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: -2px; }
.nav-item[aria-current="page"] {
  color: var(--nav-link-accent); font-weight: 600;
}
.nav-item .badge { margin-left: auto; color: var(--nav-link-accent); border-color: currentColor; }

.sidebar-switch {
  position: fixed; top: min(300px, max(0px, calc(100dvh - 40px))); left: 0; z-index: 39;
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 40px; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: var(--nav-accent); color: #12151a;
  transition: left 1s;
}
.sidebar-switch span::before { content: "\203A"; font-size: 24px; line-height: 1; }
.console.sildebar-show .sidebar-switch { left: var(--sidebar-w); }
.console.sildebar-show .sidebar-switch span::before { content: "\2039"; }
.sidebar-switch:focus-visible { outline: 2px solid #12151a; outline-offset: -4px; }

@media (min-width: 900px) {
  .console:not(.sildebar-show) .shell { grid-template-columns: 0 minmax(0, 1fr); }
  .console:not(.sildebar-show) .nav { opacity: 0; visibility: hidden; }
}

.nav-toggle { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1099px) {
  .workspace { padding: 16px 16px 32px; }
}

/* Off-canvas drawer. Not an icon rail: there is no icon set, and inventing one
   is a large addition for a narrow range. */
@media (max-width: 899px) {
  .shell { grid-template-columns: 1fr; transition: none; }
  /* visibility, not transform alone. A translated drawer is still focusable and
     still in the accessibility tree: tabbing past sign-out used to drop into 26
     invisible controls with the focus ring painted 258px off-screen, and a
     screen reader read the whole menu while the toggle reported
     aria-expanded=false.
     visibility:hidden inherits, removes descendants from sequential focus
     navigation and from the a11y tree, and is undone by visibility:visible on
     .is-open. Being media-query-scoped it also cannot leak above 900px the way
     a JS `inert` flag can. The 0s transition DELAYED by the slide length is
     what keeps it from flipping at the halfway mark and truncating the
     animation — visibility is a discrete property and would otherwise switch
     mid-transition. */
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w); height: 100dvh; z-index: 50;
    transform: translateX(-100%); opacity: 1; visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .nav.is-open { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s; }
  .nav-toggle { display: inline-flex; }
  .sidebar-switch { display: none; }
  .nav-backdrop.is-open {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: var(--scrim);
  }
  .workspace { padding: 14px 12px 32px; }
  .topbar .brand .sub { display: none; }
  .topbar .dot, .topbar #tick, .topbar #who { display: none; }
  .topbar #tick.is-error { display: inline; color: var(--bad); font-weight: 600; }
}

@media (max-width: 459px) {
  .topbar { gap: 8px; padding-inline: 6px; }
  .topbar .brand { display: none; }
  .topbar .live { gap: 6px; }
  .topbar #signout { padding-inline: 8px; }
}
/* .nav.is-open carries a transition of its own now, and a class beats a bare
   element selector on specificity regardless of order — so both have to be
   named here or reduced motion would keep the 200ms slide. */
@media (prefers-reduced-motion: reduce) {
  .shell, .nav, .nav.is-open, .sidebar-switch { transition: none; }
}

/* Buttons and forms — the credential pages and the sign-out control. */
button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 9px 14px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
@media (prefers-color-scheme: dark) {
  body:not(.console):not(.portal) button:not(.quiet):not(.chip):not(.link) { color: #12151a; }
}
/* The portal's theme is its own switch, not the system's: dark ink on the
   bright dark-theme accent, white on the light one. */
html[data-theme="dark"] body.portal button:not(.quiet):not(.chip):not(.link):not(.linkish):not(.tab):not(.star-toggle):not(.table-sort) { color: var(--panel); }
button.quiet { background: transparent; color: var(--muted); border-color: var(--border); }
button[disabled] { opacity: .6; cursor: not-allowed; }
.auth { max-width: 380px; margin: 12vh auto 0; }
.auth section { padding: 22px; }
.auth h1 { margin-bottom: 4px; }
.auth p.hint { color: var(--muted); font-size: 13px; margin: 6px 0 18px; }
.auth section p.hint { margin: 16px 0 0; }
label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
input {
  font: inherit; width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg { margin-top: 14px; font-size: 13px; min-height: 20px; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--good); }
.global-msg {
  margin: 0 0 14px; padding: 10px 12px; min-height: 0;
  border: 1px solid currentColor; border-radius: var(--radius); background: var(--panel);
}
.global-msg[hidden] { display: none; }
/* The portal's view-as banner sets display:flex inline, which beats the
   user-agent [hidden] rule; without this every channel saw "Read-only". */
#view-banner[hidden] { display: none !important; }

/* Branded credential pages keep the dark wordmark legible in both colour
   schemes by giving it a small white surface, rather than maintaining two
   separate logo files that can drift. */
body.auth-page {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34%),
    var(--bg);
}
.auth-page .langbar { max-width: 420px; margin-top: clamp(24px, 8vh, 72px); }
.auth-page .auth { max-width: 420px; }
.auth-page .auth-brand {
  display: flex; align-items: center; justify-content: center;
  margin: 0 0 14px; padding: 10px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: #fff;
  box-shadow: 0 14px 40px color-mix(in srgb, var(--text) 10%, transparent);
}
.auth-page .brand-logo--auth { width: min(100%, 260px); max-height: 108px; object-fit: contain; }
.auth-page .auth section {
  border-top: 3px solid var(--accent);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--text) 9%, transparent);
}

@media (max-width: 480px) {
  .portal-header .live {
    flex: 1 1 100%; width: 100%; min-width: 0; margin-left: 0; flex-wrap: wrap;
  }
  .portal-header #who { min-width: 0; overflow-wrap: anywhere; }
  .builder .out { flex-wrap: wrap; }
  .builder .out input { min-width: 0; }
  body.auth-page { padding: 16px; }
  .auth-page .langbar { margin-top: 8px; }
  .auth-page .auth-brand { padding: 8px 12px; }
  .brand-logo--portal { width: 150px; }
  /* Under 16px iOS zooms the page into a field the moment it is focused. */
  .auth-page input { font-size: 16px; }
}

/* The portal on a phone (measured at 375 x 812): the tabs have to be reachable
   without scrolling past eight cards, and the link builder usable without
   scrolling a 1,150px table sideways. So the header and range bar shrink, the
   figures tighten, the tabs scroll in one row, and the offer table becomes one
   card per offer with the builder full width under it. */
@media (max-width: 640px) {
  /* The portal page only: login and the guide wear body.portal for the tokens
     and keep their own padding. */
  body.portal:has(> .portal-header) { padding: 12px; }
  body.portal :is(input, select, textarea), body.portal .builder .out input { font-size: 16px; }
  .portal-header { gap: 6px 10px; margin-bottom: 12px; }
  .portal-header > .sub, .portal-header #tick { display: none; }
  .brand-logo--portal { width: 120px; }
  #rangebar { padding: 10px 12px; gap: 8px; }
  #rangebar .range-chips, #rangebar .range-utc, #rangebar .spacer { display: none; }
  #rangebar .range-select { display: block; flex: 1 1 100%; }
  /* Two date boxes and Apply do not fit one 351px row, so on a phone they show
     only once "Custom range" is picked from the dropdown. */
  #rangebar:not(.is-custom) .range-dates { display: none; }
  #rangebar .range-dates { flex: 1 1 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
  #rangebar .range-dates input { width: 100%; min-width: 0; }
  #rangebar .range-dates #apply-range { grid-column: 1 / -1; }
  .pub-dash { gap: 8px; margin-bottom: 12px; }
  .pub-hero > .value { font-size: 24px; }
  .pub-trend svg { height: 48px; }
  /* Four across clips a two-currency EPC at phone width. */
  .pub-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pub-metrics .card { padding: 8px 10px; }
  .pub-metrics .card .label { font-size: 10px; letter-spacing: .02em; }
  .pub-metrics .card .value { font-size: 16px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 12px; }
  .tab { flex: 0 0 auto; padding: 7px 11px; }
  #tbl-offers thead { display: none; }
  #tbl-offers, #tbl-offers tbody, #tbl-offers tr, #tbl-offers td { display: block; width: 100%; }
  #tbl-offers tr[hidden] { display: none; }
  #tbl-offers tr[data-offer-row] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  #tbl-offers tr[data-offer-row] td { padding: 0; border: 0; text-align: left; white-space: normal; }
  #tbl-offers td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; }
  #tbl-offers td.o-name { grid-column: 1 / -1; order: -1; font-weight: 600; }
  #tbl-offers td.o-link { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
  #tbl-offers td.o-link [data-builder] { flex: 1 1 auto; }
  #tbl-offers tr[data-builder-row] td { padding: 0; border-bottom: 1px solid var(--border); }
  .builder .subs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder input.sub { width: 100%; }
  .builder .out { flex-wrap: wrap; }
  .builder .out input { flex: 1 1 100%; min-width: 0; }
}

/* ============================================================================
   Language switcher.
   ============================================================================
   A native <select> (mountLangSwitcher in client.js) listing each language by
   its own name. No flags: Windows has no regional-indicator glyphs and showed
   "CN 简体中文", and a flag names a country rather than a language. */
.langswitch { display: inline-flex; flex-wrap: nowrap; gap: 4px; white-space: nowrap; }

/* The credential pages have no chrome to hang it on, so it gets its own row
   above the card. It sits ABOVE the heading on purpose: someone who cannot read
   the form has to meet the switcher before the form, not after it. */
.langbar { max-width: 380px; margin: 12vh auto 0; display: flex; justify-content: flex-end; }
/* .auth's own top margin would then push the card another 12vh down the page. */
.langbar + .auth { margin-top: 10px; }

@media (max-width: 459px) {
  .langswitch { gap: 2px; }
}

/* Offer picker (Smartlinks). A native <dialog> opened with showModal(), so Esc,
   focus containment and the top layer come from the browser. The result list is
   the only scrolling region; the search and the Add button stay in view. */
dialog.picker {
  width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--text);
  display: flex; flex-direction: column;
}
dialog.picker:not([open]) { display: none; }
dialog.picker::backdrop { background: var(--scrim); }
/* The target dialog: a short form, not a result list. */
dialog.plan-dialog { width: min(640px, calc(100vw - 32px)); }
/* Bulk actions on offers: a wide dialog with two panes. The edit pane is a
   short form; the grant pane is the two-sided picker, each side scrolling on
   its own so the move buttons stay in view. */
dialog.bulk-dialog { width: min(1240px, calc(100vw - 32px)); height: min(860px, calc(100vh - 48px)); }
.bulk-tabs { padding: 0; gap: 6px; border: 0; }
.bulk-pane { padding: 16px; overflow: auto; flex: 1 1 auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.bulk-pane[hidden] { display: none; }
.inline-pair { display: flex; gap: 6px; }
.inline-pair input { flex: 1 1 90px; min-width: 0; }
.grant-top { display: flex; flex-direction: column; gap: 6px; }
.grant-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grant-row > .sub:first-child { min-width: 44px; }
.grant-pubs, #grant-list, #grant-filters { padding: 0; gap: 6px; border: 0; flex-wrap: wrap; }
.shuttle { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1 1 auto; min-height: 280px; }
.shuttle-side { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); min-height: 0; overflow: hidden; }
.shuttle-head, .shuttle-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; }
.shuttle-head { border-bottom: 1px solid var(--border); }
.shuttle-head .spacer { flex: 1; }
.shuttle-foot:empty { display: none; }
.shuttle-foot { border-top: 1px solid var(--border); }
.shuttle-body { overflow: auto; flex: 1 1 auto; }
.shuttle-body thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.shuttle-body tr[data-grant-row] { cursor: pointer; }
.shuttle-body tr[data-grant-row]:hover td { background: var(--bg); }
.shuttle-body td.wrap, .shuttle-body th.wrap { white-space: normal; min-width: 180px; text-align: left; width: 100%; }
.shuttle-body td.num { white-space: nowrap; }
@media (max-width: 900px) { .shuttle { grid-template-columns: 1fr; } }
.plan-dialog-body { padding: 16px; overflow: auto; }
/* The confirm dialog: one question and two buttons. */
dialog.confirm-dialog { width: min(460px, calc(100vw - 32px)); }
.confirm-body { display: grid; gap: 18px; padding: 20px; }
.confirm-body p { margin: 0; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.confirm-body .actions { display: flex; justify-content: flex-end; gap: 8px; }
.picker-head, .picker-foot {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px;
}
.picker-head { border-bottom: 1px solid var(--border); }
.picker-foot { border-top: 1px solid var(--border); }
.picker-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.picker-head .spacer, .picker-foot .spacer { flex: 1; }
.picker-search { flex: 1 1 280px; }
.picker-body { overflow: auto; flex: 1 1 auto; min-height: 240px; }
.picker-body thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.picker-body tr[data-pick-row] { cursor: pointer; }
.picker-body tr[data-pick-row]:hover td { background: var(--bg); }
.picker-body td.wrap { white-space: normal; min-width: 240px; }
/* The name is the second column here (the tick box is first), so it has to be
   told to align like a first column. */
.picker-body td.wrap, .picker-body th.wrap { text-align: left; }

/* Tools → Parameter table: words, not figures, so every column reads from the
   left, and the description wraps instead of pushing the table off screen. */
/* The Smartlink being edited. A long member list scrolls inside its own box so
   the bulk controls above it and Save below it are both always reachable, and
   the header stays readable while you scroll. */
.sl-draft { max-height: 60vh; overflow-y: auto; }
.sl-draft thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }

.params-table th, .params-table td { text-align: left; vertical-align: top; }
.params-table td.desc { white-space: normal; min-width: 280px; }
.picker-note { padding: 8px 16px 0; font-size: 12px; color: var(--muted); }
/* Selected members and issued links sit in the editor and the list as compact tables. */
.sl-links { display: flex; flex-direction: column; gap: 8px; white-space: normal; }
.sl-links .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sl-links .row input.mono { flex: 1 1 360px; font-size: 12px; }

/* ============================================================================
   Dashboard charts, analysis, the project board and the payment panel.
   ============================================================================
   Charts are inline SVG built in admin.html. Series colours are the one place
   this file carries literal colours beyond the shell: they are a validated
   categorical palette (adjacent-pair CVD-safe, in fixed slot order) and are
   not derived from the theme tokens on purpose — a chart with eight series
   cannot be drawn from a theme that has one accent. */
:root {
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}
.chart { position: relative; padding: 8px 16px 12px; min-height: 120px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--border); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .08; }
/* Money still in review, stacked on the decided line: visibly the same series,
   visibly not counted yet. */
.chart .area.stacked { opacity: .22; }
.chart .line.stacked { stroke-width: 1.5; stroke-dasharray: 4 3; opacity: .8; }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .bar { stroke: var(--panel); stroke-width: 2; }
/* A bucket that is not whole (a week cut by the epoch or still running). */
.chart .bar.faded { opacity: .4; }
/* In review on top of a bar: the same hue, dashed and see-through, so it is
   not read as a pale (partial) week. */
.chart .bar.stacked { fill-opacity: .22; stroke-width: 1.5; stroke-dasharray: 3 2; }
.chart .bar-label, .chart .pt-label { fill: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .cursor { stroke: var(--muted); stroke-dasharray: 3 3; pointer-events: none; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  padding: 6px 9px; border-radius: 8px; font-size: 12px; line-height: 1.5;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--text) 12%, transparent);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chart-tip b { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
.chart-tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 0 16px 10px; font-size: 12px; color: var(--muted); }
.chart-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-legend .sw.stacked { opacity: .35; }
.chart-empty { padding: 24px 16px; color: var(--muted); font-size: 13px; }

/* Donut + its list: the list carries the exact figures so the slice never has to. */
.donut { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut svg { width: 180px; height: 180px; }
.donut .center { fill: var(--text); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut .center-sub { fill: var(--muted); font-size: 11px; }
.donut ol { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.donut li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid var(--border); }
.donut li:last-child { border-bottom: 0; }
.donut li .sw { flex: none; width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.donut li .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut li .v { font-variant-numeric: tabular-nums; }
.donut li .p { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
@media (max-width: 599px) { .donut { grid-template-columns: 1fr; justify-items: center; } }
/* In a card too narrow for the ring and a readable list side by side, the list
   goes under the ring: squeezed beside it, the names shrank to nothing. */
@container (max-width: 459px) {
  .donut { grid-template-columns: 1fr; justify-items: center; }
  .donut ol { width: 100%; }
}

/* Two sections side by side, one on a phone. A div rather than a section so
   the routing sweep (every [data-view]) can hide the pair as one. */
.dash-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-split section { margin-bottom: 0; }
.dash-split[hidden] { display: none; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 12px 16px; padding: 12px 16px; align-items: center; }
@media (max-width: 599px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.dash-kpis .card { padding: 10px 12px; }
.dash-kpis .card .value { font-size: 22px; }
.dash-kpis .card .sub { margin-top: 2px; }
.dash-gauge svg { width: 100%; max-width: 200px; display: block; margin: 0 auto; }
.dash-gauge .g-track { stroke: var(--border); }
.dash-gauge .g-val { stroke: var(--s1); stroke-linecap: round; }
.dash-gauge .g-val.over { stroke: var(--good); }
.dash-gauge .g-num { fill: var(--text); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-gauge .g-sub { fill: var(--muted); font-size: 11px; }
.rank-list td.n { color: var(--muted); }
/* A name that may wrap, so the money beside it stays inside the card; so may
   a heading, which is otherwise the widest thing in a column of numbers. */
.rank-list td.wrap { white-space: normal; min-width: 8em; overflow-wrap: anywhere; }
.rank-list th { white-space: normal; vertical-align: bottom; }
.rank-bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--s1); vertical-align: middle; margin-right: 6px; }
.rank-up { color: var(--good); } .rank-down { color: var(--bad); } .rank-same { color: var(--muted); }
.rank-guess { opacity: .6; }

/* Suggestions. One card per rule hit: severity, the sentence, the rows under
   it and the link to act on it. The rule is a left edge, like an unread
   notice, so the eye can run down the list. */
.reco-list { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.reco {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px;
  background: var(--bg); box-shadow: inset 3px 0 0 var(--muted);
}
.reco.warning { box-shadow: inset 3px 0 0 var(--accent); }
.reco.critical { box-shadow: inset 3px 0 0 var(--bad); }
.reco .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reco .head strong { flex: 1 1 auto; }
.reco .body { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.reco ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.reco ul li span { color: var(--muted); }
/* The folded informational suggestions: one line at the end of the list. */
.reco-list .reco-more { align-self: flex-start; }
.ai-box {
  margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg); white-space: pre-wrap;
  font-size: 13px; line-height: 1.6;
}
.ai-box[hidden] { display: none; }
.ai-box .ai-actions { margin-top: 8px; white-space: normal; }
.ai-box .ai-actions[hidden] { display: none; }

/* The payment panel and the statement detail, inline under a statement row. */
.stmt-detail { white-space: normal; }
.stmt-detail .kv { margin-bottom: 8px; }
.stmt-detail table { font-size: 13px; }
.stmt-detail h4 { margin: 10px 0 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stmt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 8px; }
/* subtotal + adjustments = total − paid = outstanding, as one line of figures. */
.stmt-math { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 8px 0 10px; font-variant-numeric: tabular-nums; }
.stmt-math .k { color: var(--muted); font-size: 12px; margin-right: 4px; }
.stmt-math .op { color: var(--muted); }
.stmt-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.stmt-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
/* The statements page's owed-money cards: the figure under its label, then one
   line per list it opens, so the figures line up whatever follows them. */
.bl-card .value { margin-top: 0; padding: 2px 0 4px; }
/* Notices above a billing table or inside a statement: what no row can show. */
.bl-alerts { display: grid; gap: 6px; padding: 12px 16px 0; }
.bl-alerts:empty { display: none; }
.bl-alert { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; border: 1px solid var(--border); background: color-mix(in srgb, var(--muted) 8%, transparent); }
.bl-alert.warn { border-color: color-mix(in srgb, var(--s4) 45%, transparent); background: color-mix(in srgb, var(--s4) 10%, transparent); }
.bl-alert.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 9%, transparent); }
.stmt-detail .bl-alert, .row-panel .bl-alert { margin: 6px 0; }
tr.bl-subtotal td { font-weight: 600; border-top: 1px solid var(--border); }

/* Settings version history. */
.version-history { max-inline-size: 960px; padding: 12px 16px 20px; }
.version-month { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.version-timeline {
  list-style: none; margin: 0 0 0 4px; padding-inline-start: 16px;
  border-inline-start: 1px solid var(--border);
}
.version-timeline > li { position: relative; }
.version-timeline > li + li { margin-block-start: 10px; }
.version-timeline > li::before {
  content: ""; position: absolute; inset-inline-start: -21px; inset-block-start: 16px;
  inline-size: 9px; block-size: 9px; border-radius: 50%; background: var(--accent);
}
.version-entry {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg);
}
.version-entry > summary { cursor: pointer; padding: 9px 12px; }
.version-entry > summary::marker { color: var(--muted); }
.version-entry > summary:hover::marker { color: var(--accent); }
.version-entry > summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius);
}
.version-entry > summary > * { margin-inline-end: 8px; }
.version-entry time, .version-number { font-variant-numeric: tabular-nums; }
.version-entry time { white-space: nowrap; }
.version-changes {
  margin: 0; padding: 10px 14px 12px 32px; border-block-start: 1px solid var(--border);
}
.version-changes li + li { margin-block-start: 6px; }

/* ============================================================================
   The project board (Gantt).
   ============================================================================
   A grid: fixed columns on the left, a scrolling timeline on the right whose
   width is days × the day width. Bars are absolutely positioned inside the
   row's timeline cell; drag moves them by whole days. */
.gantt { overflow-x: auto; }
.gt { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-width: 100%; }
/* On a phone a 300px list left the timeline 49px. The list keeps the title,
   red when late, next to its striped bar; owner, progress, reordering and the
   overdue badge wait for a wider screen. .gt first to outrank the rules below. */
@media (max-width: 599px) {
  .gt { grid-template-columns: 150px minmax(0, 1fr); }
  .gt .gt-left .gt-row :is(.move, .who, .pct, .gt-late) { display: none; }
}
.gt-left, .gt-right { min-width: 0; }
.gt-left { position: sticky; left: 0; z-index: 2; background: var(--panel); border-right: 1px solid var(--border); }
.gt-right { overflow-x: auto; }
.gt-head, .gt-row { display: flex; align-items: center; height: 36px; border-bottom: 1px solid var(--border); }
.gt-head { height: 44px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.gt-group { height: 30px; padding: 0 10px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12px; background: var(--bg); border-bottom: 1px solid var(--border); }
.gt-group .n { color: var(--muted); font-weight: 400; }
.gt-left .gt-row { padding: 0 6px 0 10px; gap: 6px; }
.gt-left .gt-row .title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.gt-left .gt-row .title button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-left .gt-row .title button:hover { color: var(--accent); }
.gt-left .gt-row .who { color: var(--muted); font-size: 11px; white-space: nowrap; max-width: 70px; overflow: hidden; text-overflow: ellipsis; }
.gt-left .gt-row .pct { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; width: 32px; text-align: right; }
.gt-left .gt-row .move { display: inline-flex; flex-direction: column; gap: 0; }
.gt-left .gt-row .move button { border: 0; background: none; padding: 0 2px; font-size: 9px; line-height: 1; color: var(--muted); cursor: pointer; }
.gt-left .gt-row .move button:hover { color: var(--accent); }
.gt-left .gt-row input[type="checkbox"] { width: auto; margin: 0; }
.gt-row.done .title { text-decoration: line-through; color: var(--muted); }
.gt-row.cancelled .title { color: var(--muted); }
.gt-right .gt-head { position: relative; }
/* Two rows: months over days (or weeks). "is-today", not "today": the
   overview's .today panel rule would pad the column and push every later bar
   off its dates. */
.gt-right .gt-head.gt-scale { flex-direction: column; align-items: stretch; }
.gt-scale-row { position: relative; display: flex; flex: 1 1 50%; min-height: 0; }
.gt-scale-row + .gt-scale-row { border-top: 1px solid var(--border); }
.gt-seg { flex: 0 0 auto; display: flex; align-items: center; padding-left: 4px; font-size: 10px; border-left: 1px solid var(--border); overflow: clip; white-space: nowrap; }
/* A month scrolled half out of view keeps its name at the visible edge (clip,
   not hidden, so the segment does not become the sticky label's scroller). */
.gt-seg > span { position: sticky; left: 4px; }
.gt-now { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 35%, transparent); pointer-events: none; }
.gt-day { flex: 0 0 var(--dw); width: var(--dw); text-align: center; font-size: 10px; color: var(--muted); border-left: 1px solid var(--border); height: 100%; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.gt-day.weekend { background: color-mix(in srgb, var(--text) 4%, transparent); }
.gt-day.is-today { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 700; }
.gt-right .gt-row { position: relative; }
.gt-right .gt-row .cell { flex: 0 0 var(--dw); width: var(--dw); height: 100%; border-left: 1px solid var(--border); cursor: cell; }
.gt-right .gt-row .cell.weekend { background: color-mix(in srgb, var(--text) 4%, transparent); }
.gt-right .gt-row .cell.is-today { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.gt-right .gt-row .cell:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.gt-right .gt-group { border-left: 0; }
.gt-bar {
  position: absolute; top: 7px; height: 22px; border-radius: 6px;
  background: var(--s1); color: #fff; font-size: 11px; line-height: 22px;
  padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: grab; user-select: none; touch-action: none; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.gt-bar.dragging { cursor: grabbing; opacity: .85; z-index: 3; }
.gt-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.28); pointer-events: none; }
.gt-bar .lbl { position: relative; }
/* At most a quarter of the bar each, so a one-day bar zoomed out to weeks
   still has a middle to grab and move. */
.gt-bar .h { position: absolute; top: 0; bottom: 0; width: min(8px, 25%); cursor: ew-resize; }
.gt-bar .h.l { left: 0; } .gt-bar .h.r { right: 0; }
.gt-bar.high { background: var(--s2); }
.gt-bar.low { background: var(--s7); }
.gt-bar.done { background: var(--s3); }
.gt-bar.cancelled { background: var(--muted); }
/* Overdue takes over the whole bar, striped, so it cannot pass for a priority. */
.gt-bar.late { background: repeating-linear-gradient(135deg, var(--bad) 0 6px, color-mix(in srgb, var(--bad) 78%, #000) 6px 12px); }
.gt-left .gt-row .gt-late { flex: 0 0 auto; height: 18px; font-size: 10.5px; }
.gt-row.late .title button { color: var(--bad); }
/* The dates a dragged bar would get, above it while the pointer is down. */
.gt-tip { position: absolute; top: -20px; z-index: 4; padding: 1px 6px; border-radius: 4px; font-size: 11px; white-space: nowrap; pointer-events: none; background: var(--text); color: var(--panel); }
.gt-legend .sw { background: var(--s1); }
.gt-legend .sw.high { background: var(--s2); }
.gt-legend .sw.low { background: var(--s7); }
.gt-legend .sw.done { background: var(--s3); }
.gt-legend .sw.cancelled { background: var(--muted); }
.gt-legend .sw.late { background: repeating-linear-gradient(135deg, var(--bad) 0 3px, color-mix(in srgb, var(--bad) 78%, #000) 3px 6px); }
.gt-legend .sw.now { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.gt-editor { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.gt-editor textarea { width: 100%; font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); min-height: 60px; }
.gt-empty { padding: 24px 16px; color: var(--muted); font-size: 13px; }

/* ============================================================================
   The cockpit: the overview and the analysis page in dark tokens.
   ============================================================================
   html[data-theme="dark"] body.console is set by the router on those two views only. Everything
   built from the eight tokens (sections, tables, chips, cards) darkens by
   itself; the rules below add the surface, the glow and the new components.
   The series colours are the palette's dark steps, validated against this
   surface. */
/* ---- DARK. Replaces app.css 809-817 (the cockpit token block). Selected by
   the html[data-theme="dark"] attribute that admin.html's <head> script and
   client.js setTheme() write; there is no body.dash-dark any more (the router
   no longer toggles it — only a stale comment at admin.html:246 mentions it).
   Specificity (0,2,2) beats body.console (0,1,1). Nothing else changes: every
   rule in the appended block reads tokens, so the whole console — not two
   routes — darkens from this one block. */
html[data-theme="dark"] body.console, html[data-theme="dark"] body.portal {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #121a2e;
  --panel-2: #182238;
  --border: #22304f;
  --text: #e6ebf7;
  --muted: #8e9cbb;
  --accent: #22d3ee;         /* ~10:1 on --panel; filled buttons use color: var(--panel) (dark ink) */
  --accent-ink: var(--accent);
  --good: #34d399;
  --bad: #fb7185;
  --warn-ink: color-mix(in srgb, var(--s4) 68%, var(--text));
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 10px 30px rgba(0, 0, 0, .35);
  --scrim: color-mix(in srgb, var(--bg) 72%, transparent);
  --nav-bg: color-mix(in srgb, var(--panel) 70%, var(--bg));
  --nav-active-bg: color-mix(in srgb, var(--accent) 14%, transparent);
  --nav-accent: var(--accent);
  --nav-link-accent: var(--accent);
  --s1: #3987e5; --s2: #f0763d; --s3: #2ec38f; --s4: #e8b019;
  --s5: #ec6fa0; --s6: #22a06b; --s7: #9085e9; --s8: #f26a6a;
}

/* Rows of panels. */
.dash-row { display: grid; gap: 16px; margin-bottom: 16px; }
.dash-row section { margin-bottom: 0; min-width: 0; }
.dash-row[hidden] { display: none; }
.dash-row-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.dash-row-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dash-row-2-1 { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
/* Three panels a row only where each gets a readable width; on a laptop the
   row is two, and an odd last panel (or stack of panels) takes the full width
   rather than leaving a hole. */
@media (min-width: 900px) and (max-width: 1679px) {
  .dash-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .dash-row-3 > .dash-stack:last-child:nth-child(odd) { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
@media (max-width: 1000px) { .dash-row-2-1 { grid-template-columns: 1fr; } }
/* Each panel is a size container: what fits inside it (the hero's columns, a
   donut's layout, a table's optional columns) depends on the panel's own
   width, which the sidebar and the row decide, not on the viewport's. */
.dash-hero-wrap, :is(.dash-row, .dash-stack, [data-an-group]) > section { container-type: inline-size; }
@container (max-width: 580px) { .rank-list .opt { display: none; } }
.dash-stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.dash-stack section { margin-bottom: 0; }
.dash-grid-stack { grid-template-columns: 1fr; }
.chart-tall { min-height: 260px; }
.chart-note { padding: 0 16px 10px; }
.chart-note:empty { display: none; }

/* The alert strip: the critical and warning suggestions, one chip each. */
.dash-alerts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-alerts[hidden] { display: none; }
.dash-alerts a {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; text-decoration: none; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.dash-alerts a.critical {
  border-color: color-mix(in srgb, var(--bad) 60%, transparent);
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--bad) 30%, transparent);
}
.dash-alerts a .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px currentColor; }
.dash-alerts a.critical .dot { background: var(--bad); color: var(--bad); }
.dash-alerts .all { margin-left: auto; opacity: .8; }

/* The eight numbers. */
.dash-hero-wrap h2 { justify-content: space-between; }
.dash-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 14px 16px 16px; }
/* Eight tiles as two rows of four (money, then volume), never five and three. */
@container (min-width: 440px) { .dash-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 820px) { .dash-hero { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hero {
  position: relative; padding: 12px 14px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 70%, #000 30%);
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px;
  background: linear-gradient(90deg, var(--hero-c, var(--accent)), transparent);
}
.hero .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.hero .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.1; }
.hero .value.good { color: var(--good); } .hero .value.neg { color: var(--bad); }
.hero .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.hero .spark { margin-left: auto; width: 84px; height: 26px; flex: 0 0 auto; }
.hero .spark path { fill: none; stroke: var(--hero-c, var(--accent)); stroke-width: 1.5; }
.hero .spark .fill { fill: var(--hero-c, var(--accent)); opacity: .18; stroke: none; }
.delta { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); } .delta.flat { color: var(--muted); }

/* Today against yesterday, three bars. */
.today { padding: 12px 16px 14px; display: grid; gap: 10px; }
.today .row { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.today .row .k { color: var(--muted); }
.today .bar { position: relative; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; }
.today .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.today .bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--muted); }
.today .v { font-variant-numeric: tabular-nums; text-align: right; }
.today .v small { display: block; color: var(--muted); font-size: 11px; }

/* The funnel: stacked bars whose width is the share of the top. */
.funnel { padding: 12px 16px 14px; display: grid; gap: 6px; }
.funnel .step { display: grid; grid-template-columns: 110px 1fr 80px; gap: 10px; align-items: center; font-size: 12px; }
.funnel .step .k { color: var(--muted); }
.funnel .step .bar { height: 14px; border-radius: 4px; background: var(--s1); min-width: 2px; box-shadow: 0 0 8px color-mix(in srgb, var(--s1) 60%, transparent); }
.funnel .step.pending .bar { background: var(--s4); box-shadow: none; }
.funnel .step.rejected .bar { background: var(--bad); box-shadow: none; }
.funnel .step .v { text-align: right; font-variant-numeric: tabular-nums; }
.funnel .step .v small { color: var(--muted); }

/* Horizontal bar lists (country, category). */
.hbars { padding: 10px 16px 12px; display: grid; gap: 6px; }
.hbars .r { display: grid; grid-template-columns: 64px 1fr 88px; gap: 8px; align-items: center; font-size: 12px; }
.hbars .r .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .r .bar { height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--s1), var(--accent)); min-width: 2px; }
.hbars .r .v { text-align: right; font-variant-numeric: tabular-nums; }
.hbars .r .v small { color: var(--muted); }

/* Small labelled numbers (settlement, quality). */
.kv-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 12px 16px 14px; }
.kv-tiles .t { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 70%, #000 30%); }
.kv-tiles .t .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kv-tiles .t .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kv-tiles .t .v.neg { color: var(--bad); } .kv-tiles .t .v.good { color: var(--good); }
.kv-tiles .t .s { font-size: 11px; color: var(--muted); }

/* The weekday x hour heatmap. */
.heatmap { padding: 10px 16px 12px; }
.heatmap svg { width: 100%; height: auto; display: block; }
.heatmap text { fill: var(--muted); font-size: 9px; }
.heatmap rect { rx: 2; }

/* Sparklines inside tables. */
.spark-cell svg { width: 90px; height: 22px; vertical-align: middle; }
.spark-cell path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.rank-list td.tag .badge { font-size: 10px; }
.rank-list .rank-bar { background: linear-gradient(90deg, var(--s1), var(--accent)); }

/* ============================================================================
   Console theme pass — append at the END of public/app.css.
   Scoped to body.console; publisher/login/set-password keep the :root set.
   Tokens used: the eight base tokens + --panel-2 --shadow --radius --radius-sm
   --scrim --nav-* --sidebar-w --topbar-h --s1..--s8 --accent-ink --warn-ink.
   Nothing else.
   Accent glow exists ONLY under html[data-theme="dark"] (last block).
   Amber ("warn") is derived symmetrically: color-mix(var(--s4) 68%, var(--text))
   darkens on light and lightens on dark, so one expression serves both themes;
   amber TEXT on its own tint uses --warn-ink, which mixes deeper on light.
   Delete: app.css 818-856 (old cockpit decoration) and 963-974 (old
   .lang-select/.theme-toggle) — both are re-declared here.
   ========================================================================== */

/* ---- Base, focus, motion ---------------------------------------------- */
body.console { font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
body.console :where(button, a, select, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.console :where(input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
body.console ::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
body.console hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
body.console { --line: var(--border); } /* the inline var(--line, #ddd) at admin.html:5399 */
body.console .mono, body.console code, body.console .chip.mono, body.console .badge.mono, body.console input.mono, body.console .out input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
}

/* ---- Top bar ------------------------------------------------------------ */
body.console .topbar {
  height: var(--topbar-h); min-height: var(--topbar-min); padding: 0 16px; gap: 10px;
  color: var(--text); background: color-mix(in srgb, var(--panel) 90%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); box-shadow: none;
}
body.console .topbar .brand { color: var(--text); gap: 10px; }
body.console .topbar .brand-logo--topbar { width: 104px; max-height: 32px; }
body.console .topbar .brand .sub { padding-left: 10px; border-left: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; }
body.console .topbar .live { color: var(--muted); font-size: 12px; gap: 8px; }
body.console .topbar #who {
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--text);
}
body.console .topbar .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }
body.console .topbar .dot.is-error { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }
body.console .topbar #tick.is-error { color: var(--bad); font-weight: 600; }
body.console .topbar .chip, body.console .topbar button.quiet { height: 28px; color: var(--muted); border-color: var(--border); background: transparent; }
body.console .topbar .doc-chip { border-color: transparent; border-radius: var(--radius-sm); padding: 0 9px; text-decoration: none; }
body.console .topbar .chip:hover, body.console .topbar button.quiet:hover { color: var(--text); background: var(--panel-2); }
body.console .topbar #signout:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); background: color-mix(in srgb, var(--bad) 6%, var(--panel)); }
/* Language dropdown + theme toggle (mountLangSwitcher / mountThemeToggle). */
body.console .topbar #langbar, body.console .langswitch { display: inline-flex; align-items: center; gap: 6px; }
body.console .lang-select {
  height: 28px; padding: 0 24px 0 10px; font-size: 12.5px; font-weight: 500; width: auto;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background-color: transparent; color: var(--muted); box-shadow: none;
}
body.console .lang-select:hover { color: var(--text); background-color: var(--panel-2); }
/* One bordered control, two segments; the pressed segment is the theme on screen. */
body.console .theme-toggle { align-items: center; gap: 2px; height: 28px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
body.console .theme-toggle .chip.theme-opt { height: 22px; padding: 0 8px; gap: 4px; border: 0; border-radius: 4px; font-size: 12px; font-weight: 500; color: var(--muted); background: transparent; box-shadow: none; }
body.console .theme-toggle .chip.theme-opt:hover { color: var(--text); background: var(--panel-2); }
body.console .theme-toggle .chip.theme-opt[aria-pressed="true"] { color: var(--accent-ink); font-weight: 600; background: color-mix(in srgb, var(--accent) 14%, transparent); }
body.console .theme-toggle .ico { font-size: 13px; line-height: 1; }

/* ---- Shell + sidebar switch ------------------------------------------- */
body.console .shell { transition: grid-template-columns .25s ease; }
body.console .workspace { padding: 24px 28px 56px; background: var(--bg); }
body.console .sidebar-switch {
  top: calc(var(--topbar-h) + 14px); width: 22px; height: 30px; padding: 0;
  border: 1px solid var(--border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--panel); color: var(--muted); box-shadow: var(--shadow); transition: left .25s ease, color .12s;
}
body.console.sildebar-show .sidebar-switch { left: calc(var(--sidebar-w) - 1px); }
body.console .sidebar-switch span::before { font-size: 18px; }
body.console .sidebar-switch:hover { color: var(--accent); filter: none; }
body.console .sidebar-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
body.console .skip-link { border-radius: var(--radius-sm); box-shadow: var(--shadow); }

/* ---- Sidebar nav -------------------------------------------------------- */
body.console .nav { padding: 12px 10px 32px; color: var(--muted); background: var(--nav-bg); border-right: 1px solid var(--border); scrollbar-width: thin; }
body.console .nav-list { max-height: none; overflow: visible; }
body.console .nav-group + .nav-group { margin-top: 10px; }
body.console .nav-group-toggle {
  height: 26px; margin: 0 0 2px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); box-shadow: none;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
body.console .nav-group-toggle::after { font-size: 9px; opacity: .7; transition: transform .15s; }
body.console .nav-group-toggle[aria-expanded="false"]::after { content: "\25BE"; transform: rotate(-90deg); }
body.console .nav-group-toggle:hover { color: var(--text); background: var(--panel-2); filter: none; }
body.console .nav-group-toggle:focus-visible, body.console .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.console .nav-group.is-current { background: transparent; box-shadow: none; }
body.console .nav-group.is-current .nav-group-toggle { color: var(--text); }
body.console .nav-item { position: relative; height: 32px; margin: 1px 0; padding: 0 10px 0 22px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text); transition: background .12s, color .12s; }
body.console .nav-item:hover { color: var(--text); background: var(--panel-2); }
body.console .nav-item[aria-current="page"] { color: var(--nav-link-accent); font-weight: 600; background: var(--nav-active-bg); }
body.console .nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--nav-accent); }
body.console .nav-item .badge { margin-left: auto; height: 18px; min-width: 20px; justify-content: center; padding: 0 6px; font-size: 10.5px; color: var(--accent); border-color: transparent; background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* ---- Sections, headers, gutters ---------------------------------------- */
body.console section { box-shadow: var(--shadow); }
body.console section h2 {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px;
  color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none;
}
/* The first panel of a view carries the view's name, so it reads as the page
   title: one step above the panel headings, which are one step above the body
   text. Hidden views and the first-run guide do not count. */
body.console #main > :nth-child(1 of section[data-view]:not([hidden], #onboard)) > h2 {
  min-height: 52px; font-size: 18px; font-weight: 650; letter-spacing: -.01em;
}
body.console section h2::before { content: ""; flex: 0 0 auto; width: 3px; height: 14px; border-radius: 2px; background: var(--accent); opacity: .85; }
body.console section h2 .sub { font-size: 12px; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }
body.console section h2 .h2-tools { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; font-weight: 400; text-transform: none; letter-spacing: 0; }
body.console section h2 .h2-tools select, body.console section h2 .h2-tools .chip { height: 28px; padding-block: 0; font-size: 12px; }
body.console .dash-hero-wrap h2 { justify-content: flex-start; }
body.console .builder h3, body.console section > h3, body.console #params-groups h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text); }
body.console #params-groups h3 { padding: 16px 16px 0; margin: 0; }
body.console h3.sub, body.console .stmt-detail h4 { margin: 16px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
body.console .stmt-detail h4 { margin: 12px 0 4px; }
body.console section > .sub, body.console section > p.sub, body.console section > .msg, body.console section > div:not([class]) { padding: 12px 16px; margin: 0; }
body.console section > p.sub + p.sub { padding-top: 0; }
body.console section > .cards { padding: 12px 16px 0; margin-bottom: 4px; }

/* ---- Buttons: primary / secondary / link --------------------------------- */
/* body.console button (0,1,2) beats every bare-class button rule; .chip,
   .table-sort, .nav-group-toggle, .sidebar-switch are re-declared here. */
body.console button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 85%, #000); background: var(--accent); color: var(--panel);
  font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(16,24,40,.08), inset 0 1px 0 rgba(255,255,255,.14);
  transition: filter .12s, background .12s, box-shadow .12s, color .12s;
}
body.console button:hover { filter: brightness(1.07); }
body.console button:active { filter: brightness(.95); box-shadow: none; }
body.console button[disabled] { opacity: .5; cursor: not-allowed; filter: none; }
body.console button.quiet { background: var(--panel); color: var(--text); border-color: var(--border); font-weight: 500; box-shadow: 0 1px 1px rgba(16,24,40,.04); }
body.console button.quiet:hover { filter: none; background: var(--panel-2); border-color: color-mix(in srgb, var(--muted) 40%, var(--border)); }
body.console button.link, body.console button.linkish {
  display: inline; height: auto; padding: 0; border: 0; border-radius: 2px; background: none; box-shadow: none;
  color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; text-align: left; white-space: normal;
}
body.console button.link:hover, body.console button.linkish:hover { filter: none; color: color-mix(in srgb, var(--accent) 75%, var(--text)); }
body.console .table-sort { height: auto; padding: 0; border: 0; border-radius: 2px; background: transparent; box-shadow: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
body.console .star-toggle { height: auto; padding: 2px 6px 2px 0; border: 0; background: none; box-shadow: none; font-size: 18px; color: var(--muted); }
body.console .star-toggle[aria-pressed="true"], body.console .star-toggle:hover { color: color-mix(in srgb, var(--s4) 68%, var(--text)); filter: none; }
body.console [data-conv-to="fraud"]:hover, body.console [data-conv-to="rejected"]:hover, body.console #conv-fraud:hover, body.console #conv-reject:hover {
  color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); background: color-mix(in srgb, var(--bad) 7%, var(--panel));
}
body.console .actions { margin-top: 18px; gap: 8px; }
body.console td .actions { margin-top: 6px; gap: 6px; }
body.console .actions .chip { height: 34px; padding: 0 14px; font-size: 13px; }
body.console .macros .chip { height: 24px; padding: 0 8px; font-size: 11.5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---- Chips: [aria-pressed] = filter toggle (pill), otherwise = action ---- */
body.console .chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--panel); color: var(--text);
  font-size: 12.5px; font-weight: 500; line-height: 1; white-space: nowrap; box-shadow: none; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
body.console .chip:hover { filter: none; background: var(--panel-2); border-color: color-mix(in srgb, var(--muted) 40%, var(--border)); }
body.console .chip[disabled] { opacity: .5; cursor: not-allowed; }
body.console .chip[aria-pressed="false"] { color: var(--muted); }
body.console .chip[aria-pressed="true"] { color: var(--accent-ink); font-weight: 600; border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
body.console .chip:not([aria-pressed]) { border-radius: var(--radius-sm); }
body.console .chip.quiet { background: transparent; border-color: transparent; color: var(--muted); }
body.console .chip.quiet:hover { background: var(--panel-2); color: var(--text); }
body.console .chip .n { margin-left: 2px; opacity: .65; font-weight: 400; }
body.console td .chip { height: 26px; padding: 0 10px; font-size: 12px; }
body.console td .chip + .chip { margin-left: 4px; }
/* A row's occasional actions fold into "More". It opens in place: a popover inside
   the scrolling table would be clipped by it. */
body.console .more-menu { display: inline-block; vertical-align: top; margin-left: 4px; }
body.console .more-menu > summary { list-style: none; cursor: pointer; }
body.console .more-menu > summary::-webkit-details-marker { display: none; }
body.console .more-menu > summary::after { content: '▾'; font-size: 10px; opacity: .7; }
body.console .more-menu[open] > summary { color: var(--accent); }
/* The items stack under "More", right-aligned to it: opening the menu makes the
   row taller, never the column wider (the column is pinned to the right edge). */
body.console .more-menu .more-items { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 6px; width: 0; min-width: 100%; }
body.console .more-menu .more-items .chip + .chip { margin-left: 0; }
/* Verdict chips (conversion review): approve, reject and fraud read apart at a glance. */
body.console .chip.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }
body.console .chip.warn { color: color-mix(in srgb, var(--s4) 68%, var(--text)); border-color: color-mix(in srgb, var(--s4) 45%, var(--border)); }
body.console .chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }

/* ---- Toolbars, filter bars, range bar ---------------------------------- */
body.console .toolbar { padding: 10px 16px; gap: 8px; border-bottom: 1px solid var(--border); background: var(--panel); }
/* The conversion queue's one-line account of the filtered set. */
body.console .conv-summary { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; }
body.console .conv-summary .chip { height: 24px; }
body.console #conv-listbar:has(> .conv-summary:empty) { display: none; }
body.console #conv-decide { padding: 10px 16px; }
/* The queue's filters in as few lines as they fit: rows are what the page is for. */
body.console #conv-filters select { max-width: 150px; }
body.console #conv-filters input.mini { min-width: 0; width: 150px; }
body.console .toolbar:has(+ .toolbar) { border-bottom: 0; padding-bottom: 4px; }
body.console .toolbar + .toolbar { padding-top: 4px; }
body.console .toolbar:last-child { border-bottom: 0; }
body.console section > .toolbar:is(:has(+ .scroll), :has(+ .builder)) { border-bottom: 0; }
body.console .toolbar label, body.console .toolbar .filter label, body.console label.inline, body.console form.toolbar > label { margin: 0; font-size: 12px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
body.console .toolbar input:not([type="checkbox"]), body.console .toolbar select, body.console .toolbar button:not(.link):not(.linkish), body.console .toolbar .chip { height: 30px; padding-top: 0; padding-bottom: 0; font-size: 12.5px; }
body.console .toolbar input:not([type="checkbox"]), body.console .toolbar select { width: auto; }
body.console .toolbar input[type="checkbox"] { width: 15px; }
body.console .toolbar .msg { margin: 0; min-height: 0; font-size: 12px; }
body.console .builder .toolbar { padding: 0; border: 0; background: transparent; margin-bottom: 8px; }
/* The upstream integration page's how-to-connect steps, shown until the integration exists. */
body.console .yd-start ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; }
body.console .yd-start li + li { margin-top: 4px; }
body.console .rangebar { padding: 0 0 16px; border: 0; background: transparent; }
body.console .cat-summary { padding: 0 16px 12px; border: 0; }
body.console .cat-summary .chip { height: 26px; font-size: 12px; padding: 0 10px; }
body.console .cat-chips { padding: 8px 0 0; gap: 6px; border: 0; }
/* Report page. The column picker and the rarer filters fold into a panel under
   their chip, so the section lets it hang over the table instead of clipping
   it. The filters share one line at laptop width, the scope line reads under
   them, and each totals card is one line per part, so the table starts no
   lower than it did before the strip existed. */
body.console section[data-view="reports"] { overflow: visible; }
body.console .rp-pop { position: relative; }
body.console .rp-pop > summary { list-style: none; cursor: pointer; }
body.console .rp-pop > summary::-webkit-details-marker { display: none; }
body.console .rp-pop > summary::after { content: "\25BE"; font-size: 10px; opacity: .7; }
body.console .rp-pop[open] > summary { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
/* Placed by placePopPanel in admin.html, which slides it back on screen. */
body.console .rp-pop-body {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; display: grid; gap: 8px; min-width: 220px; max-width: calc(100vw - 32px);
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow);
}
body.console #rp-cols .rp-pop-body { grid-template-columns: repeat(2, minmax(0, max-content)); column-gap: 18px; }
body.console .rp-pop-body select { max-width: 100%; }
body.console .rp-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
body.console #report-filters select { max-width: 190px; }
body.console #report-filters > select { flex: 1 1 110px; min-width: 0; }
body.console .rp-scope { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 8px 16px 0; }
body.console .rp-scope:not(:has(span:not(:empty))) { display: none; }
/* Equal cards that never cut a figure short: each is at least as wide as its
   longest line, and the strip wraps before it truncates. */
body.console .cards.rp-kpis { display: flex; flex-wrap: wrap; padding-top: 10px; }
body.console .rp-kpis:empty { display: none; }
body.console .rp-kpis .card { flex: 1 1 0; min-width: max-content; padding: 8px 12px; }
body.console .rp-kpis .card .value { font-size: 18px; }
body.console .rp-kpis .card > :is(.value, .sub) { margin-top: 0; white-space: nowrap; }
body.console .rp-kpis .card .value .sub { font-weight: 500; letter-spacing: 0; }
/* Filter rows fold behind one button on a phone (the data-filters toolbars;
   admin.html adds the button). */
body.console .chip.filters-toggle { display: none; }
@media (max-width: 599px) {
  body.console .chip.filters-toggle { display: inline-flex; margin: 8px 16px; }
  body.console section:not(.filters-open) > [data-filters] { display: none; }
}

/* ---- Inputs, selects, labels, forms ------------------------------------ */
body.console label { display: block; margin: 12px 0 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
body.console .form-grid > div > label:first-child, body.console form > label:first-child { margin-top: 0; }
body.console label.inline { color: var(--text); font-weight: 400; }
body.console label.inline.sub { color: var(--muted); }
body.console input:where(:not([type="checkbox"], [type="radio"], [type="range"])), body.console select, body.console textarea, body.console .gt-editor textarea {
  font: inherit; font-size: 13px; width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background-color: var(--panel); color: var(--text);
  box-shadow: inset 0 1px 1px rgba(16,24,40,.03); transition: border-color .12s, box-shadow .12s;
}
body.console textarea, body.console .gt-editor textarea { height: auto; min-height: 76px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
body.console input::placeholder, body.console textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
body.console input[readonly]:not([type="checkbox"]) { background-color: var(--panel-2); color: var(--muted); }
body.console :is(input, select, textarea):hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--border)); }
body.console :is(input, select, textarea):focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
body.console input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
/* A select marked by a form check, and the sentence set under the field it is about. */
body.console select[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
body.console .field-err { margin-top: 5px; font-size: 12px; line-height: 1.45; color: var(--bad); white-space: normal; }
body.console :is(input, select, textarea):is(:user-invalid) { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
body.console :is(input, select, textarea)[disabled] { opacity: .55; cursor: not-allowed; background-color: var(--panel-2); }
body.console select {
  appearance: none; -webkit-appearance: none; padding-right: 26px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
body.console select[multiple] { appearance: auto; padding-right: 10px; height: auto; background-image: none; }
body.console input[type="checkbox"], body.console input[type="radio"] { width: 15px; height: 15px; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }
body.console input[type="date"], body.console input[type="month"] { width: auto; min-width: 150px; }
body.console input.mini { width: auto; min-width: 180px; }
body.console input.narrow { width: 88px; min-width: 0; }
body.console .form-grid { gap: 4px 16px; align-items: start; }
body.console .form-grid > div { min-width: 0; }
body.console .form-grid .sub, body.console .builder .sub { margin-top: 5px; font-size: 12px; line-height: 1.5; color: var(--muted); }
body.console .form-grid > div:has(> input[type="number"] + select.narrow) { display: grid; grid-template-columns: minmax(0, 1fr) 150px; column-gap: 8px; align-items: end; }
body.console .form-grid > div:has(> input[type="number"] + select.narrow) > :is(label, .sub, .actions) { grid-column: 1 / -1; }
body.console .form-grid > div:has(> input[type="number"] + select.narrow) > select.narrow { width: 100%; }
body.console #pw-form, body.console form:not(.form-grid):not(.toolbar) > label + input { max-width: 480px; }
body.console .out { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.console .out input { flex: 1 1 240px; min-width: 0; }
body.console .out + .out { margin-top: 8px; }
body.console .meter { padding: 10px 12px; gap: 20px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--panel); }
body.console .meter b { font-size: 20px; letter-spacing: -.02em; }

/* ---- Messages ------------------------------------------------------------ */
body.console .msg { margin-top: 12px; font-size: 13px; min-height: 0; }
body.console .msg:empty { display: none; }
body.console .msg.err { color: var(--bad); } body.console .msg.ok { color: var(--good); }
body.console .msg.warn { color: color-mix(in srgb, var(--s4) 68%, var(--text)); }
body.console .msg.err:not(:empty), body.console .msg.ok:not(:empty), body.console .msg.warn:not(:empty) { padding: 8px 10px; border-radius: var(--radius-sm); background: color-mix(in srgb, currentColor 9%, transparent); }
/* Sticky under the top bar: the message answers whatever was just pressed,
   and that is often a row far down a long list. */
body.console .global-msg {
  position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5;
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; padding: 10px 14px; font-size: 13px;
  border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  background: color-mix(in srgb, var(--bad) 8%, var(--panel)); color: var(--bad); box-shadow: var(--shadow);
}
body.console .global-msg[hidden] { display: none; }

/* ---- Builder + row panels + kv ------------------------------------------ */
body.console .builder { padding: 16px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
body.console section > .builder:last-child { border-bottom: 0; }
body.console .builder + .builder { border-top: 0; }
body.console .builder .note { padding: 0; }
body.console .builder .subs label { margin: 0; font-size: 11px; }
body.console td .builder, body.console td .row-panel {
  white-space: normal; margin: 6px 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); box-shadow: var(--shadow);
}
body.console td .builder .builder { border: 0; background: transparent; padding: 8px 0 0; box-shadow: none; margin: 0; }
body.console tr.row-panel-row > td, body.console tr.detail > td, body.console tr[data-approve-row] > td, body.console tr[data-pub-row] > td, body.console tr[data-event-row] > td { white-space: normal; padding: 8px 16px 12px; }
body.console tr.detail > td > .form-grid { max-width: 900px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
body.console .kv { gap: 6px 16px; }
body.console .kv .k { font-size: 12px; } body.console .kv .v { font-size: 13px; }
body.console .kv .v.neg { color: var(--bad); }
body.console .stmt-detail table { font-size: 12.5px; margin-top: 4px; }
body.console .bl-cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
body.console .bl-card button.link { display: block; margin-top: 3px; font-size: 12px; line-height: 1.4; text-decoration: none; }
body.console .bl-card button.link:hover { text-decoration: underline; }
body.console .bl-card button.link.neg { color: var(--bad); }
body.console .bl-card button.link.sub { color: var(--muted); }
body.console #bg-result table { margin-top: 10px; font-size: 12.5px; }
body.console .sl-links .row input.mono { height: 30px; }

/* ---- Tables ------------------------------------------------------------- */
body.console .scroll.tall { max-height: min(70vh, 720px); overflow: auto; }   /* opt-in bounded scroller: sticky thead */
body.console table { font-size: 13px; border-collapse: separate; border-spacing: 0; }
body.console th, body.console td { padding: 8px 14px; vertical-align: middle; }
body.console th:first-child, body.console td:first-child { padding-left: 16px; }
body.console th:last-child, body.console td:last-child { padding-right: 16px; }
body.console thead th {
  position: sticky; top: 0; z-index: 1; height: 36px; padding-top: 0; padding-bottom: 0;
  background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  box-shadow: inset 0 -1px 0 var(--border);
}
/* Upper-casing is a Latin convention. In a Chinese UI it only shouts the odd
   Latin word: "OFFER" in a header next to 「Offer 列表」 in the nav. */
html:lang(zh) body.console :is(thead th, .nav-group-toggle, .card .label, .hero .label, .kv-tiles .t .k, h3.sub, .stmt-detail h4, .mini-h, .gt-head) {
  text-transform: none; letter-spacing: 0;
}
body.console th.sortable { cursor: pointer; }
body.console th.sortable:hover { color: var(--text); }
body.console th.sorted, body.console th[aria-sort="ascending"], body.console th[aria-sort="descending"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
body.console tbody tr:nth-child(even):not(.row-panel-row):not(.detail) > td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
body.console tbody tr:not(.row-panel-row):not(.detail):hover > td { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
body.console tbody tr:last-child td { border-bottom: 0; }
body.console tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* Text-bearing cells read from the left; figures stay right-aligned. */
body.console td.n, body.console td.tag, body.console :is(th, td).dim { text-align: left; }
body.console th.tag { text-align: left; }

/* The offer list. The tick box and the name stay pinned when the table scrolls
   sideways, so a row is still readable at its far end; a pinned cell needs an
   opaque background, so the zebra and hover tints are laid over the panel. */
body.console #tbl-offers .pin:first-child { width: 46px; min-width: 46px; max-width: 46px; padding-right: 0; box-sizing: border-box; }
body.console #tbl-offers td.pin { position: sticky; z-index: 1; background: var(--panel); }
body.console #tbl-offers thead th.pin { z-index: 3; }
/* The offsets have rules of their own, of equal weight and in this order: while
   left: 0 rode on the td/th rules above it outranked the name's 46px, and the
   name slid over the tick box as soon as the table scrolled. */
body.console #tbl-offers .pin { left: 0; }
body.console #tbl-offers .pin-2 { left: 46px; box-shadow: inset -1px 0 0 var(--border); }
body.console #tbl-offers tbody tr:nth-child(even) > td.pin {
  background: linear-gradient(color-mix(in srgb, var(--panel-2) 55%, transparent), color-mix(in srgb, var(--panel-2) 55%, transparent)), var(--panel);
}
body.console #tbl-offers tbody tr:hover > td.pin { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
body.console #tbl-offers td { vertical-align: top; }
body.console #tbl-offers .ol-title { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; max-width: 240px; }
body.console #tbl-offers .ol-name { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
body.console #tbl-offers .ol-detail { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
body.console #tbl-offers .ol-badges { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
/* The badges stack, so a header longer than its badges wraps rather than
   widening the column. */
body.console #tbl-offers th.wrap { white-space: normal; }
body.console #tbl-offers td > .sub { margin-top: 2px; }
body.console td .row-menu-btn { padding: 0 9px; font-size: 14px; letter-spacing: .08em; }
/* The row menu is a popover: it opens in the top layer, placed under its button
   (right edges aligned) by the toggle handler, so no scroll box can clip it. */
body.console .row-menu {
  position: fixed; inset: auto; margin: 0; transform: translateX(-100%);
  min-width: 168px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); box-shadow: var(--shadow), 0 10px 28px rgba(0, 0, 0, .18);
}
body.console .row-menu button {
  display: flex; justify-content: flex-start; width: 100%; height: 32px; padding: 0 10px;
  border: 0; border-radius: calc(var(--radius-sm) - 2px); background: transparent; color: inherit;
  font-weight: 500; box-shadow: none;
}
body.console .row-menu button:hover, body.console .row-menu button:focus-visible { filter: none; background: var(--panel-2); outline: 0; }
body.console td:is(:has(> .badge), :has(> .chip), :has(> button), :has(> .trunc), :has(> code), :has(> .sl-links)) { text-align: left; }
/* The operation log and the operator account tables hold names, events, dates
   and controls rather than figures, so every column reads from the left. */
body.console :is(#tbl-audit, #tbl-operators, #tbl-op-keys) :is(th, td) { text-align: left; }
/* The log's change column carries sentences and lists — a smartlink's members,
   what an account was created with. It wraps, bounded, so one structured edit
   cannot push the actor column off the screen. */
body.console td.audit-change { white-space: normal; min-width: 260px; max-width: 560px; }
/* A text column says so on its header too; :has() above can only see a cell's contents. */
body.console :is(th, td).txt { text-align: left; }
/* The conversion queue's decision column, and the channel list's actions, stay on
   screen however wide the row gets. */
body.console :is(#tbl-conversions, #tbl-publishers) :is(th, td).acts { position: sticky; right: 0; background: var(--panel); box-shadow: inset 1px 0 0 var(--border); }
body.console :is(#tbl-conversions, #tbl-publishers) thead th.acts { z-index: 2; background: var(--panel-2); box-shadow: inset 1px 0 0 var(--border), inset 0 -1px 0 var(--border); }
body.console :is(#tbl-conversions, #tbl-publishers) tbody tr:nth-child(even) > td.acts { background: color-mix(in srgb, var(--panel-2) 55%, var(--panel)); }
body.console :is(#tbl-conversions, #tbl-publishers) tbody tr:hover > td.acts { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
/* On a phone a pinned column would cover most of the table, so it scrolls with the rest. */
@media (max-width: 899px) {
  body.console :is(#tbl-conversions, #tbl-publishers) td.acts { position: static; box-shadow: none; }
  body.console :is(#tbl-conversions, #tbl-publishers) thead th.acts { right: auto; box-shadow: inset 0 -1px 0 var(--border); }
}
body.console #tbl-conversions tr[data-conv-id]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
body.console #tbl-conversions td.stat { white-space: normal; min-width: 110px; max-width: 220px; }
body.console #tbl-publishers td.acct { white-space: normal; min-width: 130px; max-width: 200px; }
/* Two-line cells (offer over publisher, date over time) at a reading table's
   leading made every queue row 50px, so a laptop screen showed no more rows than
   before the columns were cut. Tighter leading keeps them near 40px. */
body.console #tbl-conversions td { padding-top: 4px; padding-bottom: 4px; line-height: 1.3; }
body.console #tbl-conversions td .sub { line-height: 1.25; }
body.console :is(#tbl-conversions, #tbl-publishers) td.acts .chip { padding: 0 8px; }
body.console #tbl-conversions :is(th, td):first-child { padding-right: 6px; }
body.console td.n { color: var(--muted); width: 32px; font-size: 12px; }
body.console td.sub, body.console td .sub { font-size: 12px; }
body.console .empty, body.console .chart-empty, body.console .gt-empty { padding: 28px 16px; color: var(--muted); font-size: 13px; text-align: center; }
body.console .params-table td.desc { font-size: 13px; line-height: 1.45; }
/* The report's action column stays in view while the money columns scroll
   sideways; opaque, so the figures passing under it do not show through. */
body.console #tbl-report :is(th, td).act { position: sticky; right: 0; z-index: 1; background: var(--panel); box-shadow: inset 1px 0 0 var(--border); }
body.console #tbl-report thead th.act { z-index: 2; background: var(--panel-2); }
body.console #tbl-report tbody tr:nth-child(even) > td.act { background: color-mix(in srgb, var(--panel-2) 55%, var(--panel)); }
body.console .picker-body tr[data-pick-row]:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
body.console .rank-list td.tag .badge { font-size: 10px; height: 18px; }
body.console .rank-bar { height: 5px; background: linear-gradient(90deg, var(--s1), var(--accent)); }
body.console .spark-cell path { stroke: var(--accent); }

/* ---- Badges + status vocabulary ----------------------------------------- */
body.console .badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px; border: 1px solid transparent;
  font-size: 11px; font-weight: 600; letter-spacing: .01em; line-height: 1; vertical-align: middle; color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent);
}
body.console .badge.good, body.console .badge.ok { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
body.console .badge.warn { color: var(--warn-ink); background: color-mix(in srgb, var(--s4) 16%, transparent); }
body.console .badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
body.console .badge.mono { font-weight: 500; letter-spacing: 0; }
body.console .badge[hidden] { display: none; }
body.console .pos, body.console .delta.up, body.console .rank-up, body.console .card .value.good, body.console .hero .value.good, body.console .kv-tiles .t .v.good { color: var(--good); }
body.console .neg, body.console .delta.down, body.console .rank-down, body.console .hero .value.neg, body.console .kv-tiles .t .v.neg { color: var(--bad); }
body.console .caution { color: color-mix(in srgb, var(--s4) 68%, var(--text)); }
body.console .delta.flat, body.console .rank-same { color: var(--muted); }
body.console .delta { font-size: 12px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); }

/* ---- Notes, pagers, steps ------------------------------------------------ */
body.console .note { padding: 12px 16px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
body.console :is(.scroll, .pager, .gantt, .reco-list, .builder, .chart, .heatmap) + .note { border-top: 1px solid var(--border); }
body.console .note strong { color: var(--text); font-weight: 600; }
body.console .note + .note { padding-top: 0; }
body.console .picker-note { padding: 8px 18px 0; font-size: 12px; }
body.console .pager { padding: 10px 16px; gap: 8px; font-size: 12.5px; border-top: 1px solid var(--border); }
body.console .pager .chip { height: 26px; padding: 0 10px; font-size: 12px; }
body.console .pager .chip[disabled] { opacity: .4; }
body.console .pager > span { margin-left: auto; }
/* The page-size select sits in a flex row; the form rule's width:100% stretched
   it across the pager and wrapped the count beside it onto two lines. */
body.console .pager select { width: auto; height: 26px; font-size: 12px; }
body.console .onboard-step + .onboard-step { border-top: 1px solid var(--border); padding-top: 8px; }

/* ---- Dialogs ------------------------------------------------------------- */
body.console dialog.picker { border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.28), var(--shadow); }
body.console dialog.picker::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
body.console .picker-head, body.console .picker-foot { padding: 14px 18px; gap: 10px; }
body.console .picker-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
body.console .picker-head :is(input, select), body.console .picker-foot .chip, body.console .picker-foot .quiet, body.console .picker-head .quiet { height: 32px; }
body.console .picker-foot { padding: 12px 18px; background: var(--panel-2); border-radius: 0 0 14px 14px; }
body.console .plan-dialog-body { padding: 4px 18px 18px; }
body.console .plan-dialog .actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
@media (prefers-reduced-motion: no-preference) { body.console dialog.picker[open] { animation: dw-dialog-in .16s ease-out; } }
@keyframes dw-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---- Cockpit components: cards, hero, kv-tiles, today, funnel, hbars, reco, ai-box, alerts, heatmap */
body.console .cards { gap: 12px; }
body.console .card, body.console .hero, body.console .kv-tiles .t { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
body.console .card { padding: 14px 16px; }
body.console .card .label, body.console .hero .label, body.console .kv-tiles .t .k { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
body.console .card .value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
body.console .card .sub { margin-top: 2px; font-size: 12px; }
body.console .dash-kpis .card { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--panel-2); box-shadow: none; }
body.console .dash-kpis .card .value { font-size: 20px; }
/* Tiles INSIDE a panel sit on the secondary surface, not another white. */
body.console .dash-hero { padding: 16px; gap: 12px; }
body.console .hero { padding: 14px 16px; background: var(--panel-2); box-shadow: none; }
body.console .hero::after { height: 3px; background: linear-gradient(90deg, var(--hero-c, var(--accent)), transparent 85%); }
body.console .hero .value { font-size: 28px; font-weight: 700; letter-spacing: -.025em; }
body.console .hero .foot { margin-top: 8px; }
body.console .hero .spark .fill { opacity: .16; }
body.console .kv-tiles { padding: 14px 16px 16px; }
body.console .kv-tiles .t { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--panel-2); box-shadow: none; }
body.console .kv-tiles .t .v { font-size: 18px; letter-spacing: -.01em; }
body.console .today .bar i { box-shadow: none; }
body.console .funnel .step .bar { box-shadow: none; }
body.console .funnel .step.pending .bar { background: color-mix(in srgb, var(--s4) 68%, var(--text)); }
body.console .today .row, body.console .funnel .step, body.console .hbars .r, body.console .donut ol { font-size: 13px; }
body.console .dash-gauge .g-val { filter: none; }
body.console .dash-gauge .g-num { font-size: 24px; }
body.console .donut .center { font-size: 18px; }
body.console .heatmap text { font-size: 10px; }
body.console .reco-list { padding: 14px 16px; }
body.console .reco { padding: 12px 14px 12px 16px; border-radius: var(--radius-sm); background: var(--panel-2); box-shadow: inset 3px 0 0 var(--muted); }
body.console .reco.warning { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--s4) 68%, var(--text)); }
body.console .reco.critical { box-shadow: inset 3px 0 0 var(--bad); }
body.console .reco .head strong { font-weight: 600; }
body.console .ai-box { margin: 14px 16px 0; border-radius: var(--radius-sm); background: var(--panel-2); }
body.console .dash-alerts a {
  height: 30px; padding: 0 12px; font-weight: 500; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--s4) 45%, transparent); background: color-mix(in srgb, var(--s4) 12%, var(--panel));
}
body.console .dash-alerts a .dot { background: color-mix(in srgb, var(--s4) 68%, var(--text)); box-shadow: none; }
body.console .dash-alerts a.critical { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 12%, var(--panel)); box-shadow: none; }
body.console .dash-alerts a.critical .dot { background: var(--bad); }
body.console .dash-row, body.console .dash-split, body.console .dash-stack { gap: 16px; }

/* ---- Charts ---------------------------------------------------------------- */
body.console .chart .grid line { stroke: color-mix(in srgb, var(--border) 85%, transparent); }
body.console .chart .line { filter: none; }
body.console .chart .area { opacity: .12; }
body.console .chart .bar { stroke: var(--panel); }
body.console .chart-tip { border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel); color: var(--text); box-shadow: var(--shadow); padding: 6px 10px; }
body.console .chart-legend { padding: 0 16px 12px; gap: 12px; }
body.console .chart-legend .sw, body.console .chart-tip .sw { border-radius: 2px; }
body.console .chart-note { font-size: 12px; padding: 0 16px 12px; }

/* ---- Gantt board ----------------------------------------------------------- */
body.console .gt-head { height: 40px; font-size: 11px; letter-spacing: .05em; background: var(--panel-2); }
body.console .gt-group { background: var(--panel-2); }
body.console .gt-left { background: var(--panel); box-shadow: 1px 0 0 var(--border); border-right: 0; }
body.console .gt-left .gt-row :is(.move, .title) button { height: auto; box-shadow: none; font-weight: 400; display: inline-block; border-radius: 3px; }
/* Side by side at 24px: stacked 10px arrows were too small to hit. */
body.console .gt-left .gt-row .move { flex-direction: row; gap: 0; }
body.console .gt-left .gt-row .move button { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; font-size: 11px; }
body.console .gt-day.is-today, body.console .gt-right .gt-row .cell.is-today { background: color-mix(in srgb, var(--accent) 12%, transparent); }
body.console .gt-right .gt-row .cell:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
body.console .gt-bar { border-radius: var(--radius-sm); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
/* Light: the raw palette steps under white labels were 2.8-4.4:1, so each bar
   is its step deepened toward black and progress is a darker band. Dark keeps
   the raw step under dark ink (restored below). A bar variant names its colour
   in --gt-c and gets both. Only background-color is set here, so a variant that
   paints a pattern (a background-image) still shows on top in either theme. */
body.console .gt-bar { background-color: color-mix(in srgb, var(--gt-c, var(--s1)) 70%, #000); }
body.console .gt-bar.high { --gt-c: var(--s2); }
body.console .gt-bar.low { --gt-c: var(--s7); }
body.console .gt-bar.done { --gt-c: var(--s3); }
body.console .gt-bar.cancelled { --gt-c: var(--muted); }
body.console .gt-bar .fill { background: color-mix(in srgb, #000 22%, transparent); }
html[data-theme="dark"] body.console .gt-bar { background-color: var(--gt-c, var(--s1)); }
html[data-theme="dark"] body.console .gt-bar .fill { background: color-mix(in srgb, #fff 26%, transparent); }
body.console .gt-editor { padding: 12px 16px; background: var(--panel-2); }
body.console .gt-legend { padding-top: 10px; }

/* ---- Responsive re-declarations (body.console out-specifies the old ones) ---- */
@media (max-width: 1099px) { body.console .workspace { padding: 20px 20px 40px; } }
@media (max-width: 899px) {
  body.console .nav { position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); height: 100dvh; z-index: 50; padding-top: 16px; box-shadow: var(--shadow); transform: translateX(-100%); opacity: 1; visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  body.console .nav.is-open { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s; }
  body.console .sidebar-switch { display: none; }
  body.console .workspace { padding: 14px 12px 32px; }
  body.console .topbar .dot, body.console .topbar #tick, body.console .topbar #who { display: none; }
  body.console .topbar #tick.is-error { display: inline; }
}
@media (max-width: 459px) { body.console .topbar { gap: 6px; padding-inline: 8px; } body.console .theme-toggle .lbl { display: none; } }
@media (prefers-reduced-motion: reduce) {
  body.console :is(.shell, .nav, .nav.is-open, .sidebar-switch, .chip, button, .nav-item, .nav-group-toggle::after, input, select, textarea) { transition: none; }
  body.console dialog.picker[open] { animation: none; }
}

/* ============================================================================
   DARK ONLY — the cockpit decoration and every accent glow. Nothing here runs
   in light. Replaces app.css 818-856.
   ========================================================================== */
html[data-theme="dark"] body.console .workspace {
  background:
    radial-gradient(1200px 500px at 8% -10%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, color-mix(in srgb, var(--s7) 9%, transparent), transparent 55%), var(--bg);
}
html[data-theme="dark"] body.console .topbar { background: color-mix(in srgb, var(--panel) 85%, transparent); }
/* The light-ink wordmark on the dark bar, rather than a white patch behind the dark one. */
html[data-theme="dark"] body.console .topbar .brand-logo--ink { display: none; }
html[data-theme="dark"] body.console .topbar .brand-logo--light { display: block; }
html[data-theme="dark"] body.console section {
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 94%, #fff 6%), var(--panel));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 5%, transparent), var(--shadow);
}
html[data-theme="dark"] body.console section h2::before { background: linear-gradient(180deg, var(--accent), var(--s7)); opacity: 1; box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); }
html[data-theme="dark"] body.console .nav-item[aria-current="page"]::before { box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent); }
html[data-theme="dark"] body.console .topbar .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent), 0 0 8px var(--good); }
html[data-theme="dark"] body.console button:where(:not(.quiet, .chip, .link, .linkish, .table-sort, .nav-group-toggle, .sidebar-switch, .star-toggle)) { box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent); }
/* A row-menu item is a list entry, not a primary action. */
html[data-theme="dark"] body.console .row-menu button { box-shadow: none; }
html[data-theme="dark"] body.console button.quiet, html[data-theme="dark"] body.console .chip { background: color-mix(in srgb, var(--panel) 80%, #000); }
html[data-theme="dark"] body.console .chip[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent); }
html[data-theme="dark"] body.console :is(input, select, textarea) { background-color: color-mix(in srgb, var(--panel) 72%, #000); }
html[data-theme="dark"] body.console .lang-select { background-color: transparent; }
html[data-theme="dark"] body.console :is(input, select, textarea):focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent); }
html[data-theme="dark"] body.console th.sorted { box-shadow: inset 0 -2px 0 var(--accent), 0 2px 8px color-mix(in srgb, var(--accent) 40%, transparent); }
html[data-theme="dark"] body.console .badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; box-shadow: 0 0 6px currentColor; }
html[data-theme="dark"] body.console .badge:empty::before, html[data-theme="dark"] body.console .nav-item .badge::before, html[data-theme="dark"] body.console .rank-list .badge::before { content: none; }
html[data-theme="dark"] body.console .card, html[data-theme="dark"] body.console .hero, html[data-theme="dark"] body.console .kv-tiles .t, html[data-theme="dark"] body.console .dash-kpis .card, html[data-theme="dark"] body.console .reco, html[data-theme="dark"] body.console .ai-box { background: color-mix(in srgb, var(--panel) 80%, #000); }
html[data-theme="dark"] body.console .hero::after { box-shadow: 0 0 10px var(--hero-c, var(--accent)); }
html[data-theme="dark"] body.console .today .bar i { box-shadow: 0 0 10px var(--accent); }
html[data-theme="dark"] body.console .funnel .step .bar { box-shadow: 0 0 8px color-mix(in srgb, var(--s1) 55%, transparent); }
html[data-theme="dark"] body.console .funnel .step:is(.pending, .rejected) .bar { box-shadow: none; }
html[data-theme="dark"] body.console .hbars .r .bar { box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent); }
html[data-theme="dark"] body.console .rank-bar { box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent); }
html[data-theme="dark"] body.console .dash-alerts a.critical { box-shadow: 0 0 12px color-mix(in srgb, var(--bad) 30%, transparent); }
html[data-theme="dark"] body.console .dash-alerts a .dot { box-shadow: 0 0 8px currentColor; }
html[data-theme="dark"] body.console .dash-gauge .g-val { filter: drop-shadow(0 0 8px var(--accent)); }
html[data-theme="dark"] body.console .chart .line { filter: drop-shadow(0 0 5px currentColor); }
html[data-theme="dark"] body.console .chart .area { opacity: .18; }
html[data-theme="dark"] body.console .chart .grid line { stroke: color-mix(in srgb, var(--border) 80%, transparent); }
html[data-theme="dark"] body.console .chart .bar { stroke: color-mix(in srgb, var(--panel) 80%, #000); }
html[data-theme="dark"] body.console .chart-tip { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
html[data-theme="dark"] body.console .gt-bar { box-shadow: 0 1px 2px rgba(0,0,0,.5), 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent); }
html[data-theme="dark"] body.console .heatmap rect { stroke: none; }
html[data-theme="dark"] body.console dialog.picker { box-shadow: 0 24px 64px rgba(0,0,0,.6), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }
body.console .lang-select option, body.console select option { background: var(--panel); color: var(--text); }
/* body.console button (0,1,2) reached these two as well. */
body.console .nav-group-toggle { justify-content: space-between; width: 100%; text-align: left; }
body.console .nav-toggle { display: none; }
@media (max-width: 899px) { body.console .nav-toggle { display: inline-flex; height: 28px; padding: 0 10px; color: var(--muted); background: transparent; border-color: var(--border); box-shadow: none; } }
/* The lifecycle panel's two short lists. */
.dash-split-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; padding: 0 16px 14px; }
.mini-h { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mini-list ol { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mini-list li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list li .sub { flex: 0 1 auto; font-size: 11px; white-space: nowrap; }
.mini-list li .v { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Bars whose labels are words, not country codes. */
.hbars.wide .r { grid-template-columns: minmax(120px, 160px) 1fr 120px; }
.hbars.wide .r .k { white-space: normal; line-height: 1.3; }
/* Fixes from the review of the design pass. */
body.console button.link.trunc { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
body.console .gt-bar { color: var(--panel); }
/* White on the light theme's orange and green is about 3:1; dark ink reads. A
   late bar is red whatever its priority and keeps the light ink. */
html:not([data-theme="dark"]) body.console .gt-bar:is(.high, .done):not(.late) { color: var(--text); }
html[data-theme="dark"] body.console :is(input[readonly]:not([type="checkbox"]), :is(input, select, textarea)[disabled]) { background-color: var(--panel-2); }
/* Paper is white whatever the screen was. */
@media print {
  html[data-theme="dark"] body.console {
    color-scheme: light; --bg: #fff; --panel: #fff; --panel-2: #f5f7fa; --border: #dfe3ea;
    --text: #101828; --muted: #5b6577; --accent: #087591; --good: #0e6b4c; --bad: #b42318; --shadow: none;
    --accent-ink: color-mix(in srgb, var(--accent) 80%, var(--text));
    --warn-ink: color-mix(in srgb, var(--s4) 50%, var(--text));
    /* The light steps too: white on the dark theme's green, deepened, is 4.4:1. */
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
    --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  }
  /* The light theme's Gantt bars, not the dark theme's raw steps under white labels. */
  html[data-theme="dark"] body.console .gt-bar { background-color: color-mix(in srgb, var(--gt-c, var(--s1)) 70%, #000); }
  html[data-theme="dark"] body.console .gt-bar .fill { background: color-mix(in srgb, #000 22%, transparent); }
  body.console .topbar, body.console .nav, body.console .sidebar-switch, body.console .rangebar { display: none; }
  body.console .shell { grid-template-columns: 1fr; padding-top: 0; }
  body.console .workspace { background: #fff; padding: 0; }
  body.console section { box-shadow: none; break-inside: avoid; }
}

/* The signed-in account tiled over the page (mountWatermark in client.js). A
   mask filled with --text, so it follows the theme; above everything and
   click-through, because under the page every opaque panel would hide it. */
.dw-watermark {
  position: fixed; inset: 0; z-index: 2147483000; pointer-events: none;
  background-color: var(--text); opacity: .07;
  -webkit-mask-repeat: repeat; mask-repeat: repeat;
  -webkit-mask-size: 320px 200px; mask-size: 320px 200px;
}
html[data-theme="dark"] .dw-watermark { opacity: .06; }
.dw-watermark[hidden] { display: none; }

/* A task's note in the Gantt editor: rich text with pictures (admin.html,
   "Task notes"). Headings are the note's sections (背景 / 目标 / 结果). */
body.console .rt-label { display: block; margin: 0 0 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
body.console .rt { border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); background: var(--panel); }
body.console .rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); }
body.console .rt-bar .chip { height: 26px; padding: 0 9px; font-size: 12px; }
body.console .rt-body { min-height: 180px; max-height: 60vh; overflow: auto; padding: 10px 12px; line-height: 1.6; color: var(--text); outline: none; overflow-wrap: anywhere; }
body.console .rt-body:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
body.console .rt-body h3 { margin: 14px 0 4px; font-size: 14px; font-weight: 600; padding-left: 8px; border-left: 3px solid var(--accent); }
body.console .rt-body h3:first-child { margin-top: 0; }
body.console .rt-body h4 { margin: 10px 0 4px; font-size: 13px; font-weight: 600; }
body.console .rt-body p { margin: 0 0 4px; }
body.console .rt-body ul, body.console .rt-body ol { margin: 0 0 6px; padding-left: 22px; }
body.console .rt-body img { display: block; max-width: 100%; max-height: 420px; margin: 6px 0; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; }
body.console .rt-body a { color: var(--accent-ink, var(--accent)); }
body.console .rt-hint { padding: 4px 12px 6px; font-size: 12px; }

/* Publisher workspace. Scoped so the operator console and public guides retain their layout. */
body.portal.publisher-workspace {
  --bg: #f7f7fb; --panel: #fff; --panel-2: #eef0f5; --border: #d8dce6;
  --text: #304565; --muted: #667794; --accent: #514bff; --accent-ink: #443ddd;
  --shadow: none; --radius: 12px; --pub-rail-w: 52px; --pub-sidebar-w: 236px;
  padding: 0 0 0 calc(var(--pub-rail-w) + var(--pub-sidebar-w)); min-height: 100dvh;
  font-size: 14px;
}
html[data-theme="dark"] body.portal.publisher-workspace {
  --bg: #101522; --panel: #192133; --panel-2: #232d42; --border: #35415b;
  --text: #e0e7f5; --muted: #a4b2cc; --accent: #a8a2ff; --accent-ink: #bcb7ff;
}
.publisher-workspace .pub-rail {
  position: fixed; inset: 0 auto 0 0; width: var(--pub-rail-w); z-index: 42;
  display: flex; align-items: center; flex-direction: column; gap: 8px;
  padding: 12px 5px; background: var(--panel-2); border-right: 1px solid var(--border);
}
.publisher-workspace .pub-rail button {
  display: grid; place-items: center; width: 40px; height: 42px; padding: 0;
  background: transparent; border: 0; border-radius: 8px; color: var(--muted); font-size: 24px;
}
.publisher-workspace .pub-rail button:is(:hover, :focus-visible, :first-child) { background: var(--panel); color: var(--accent-ink); }
.publisher-workspace .pub-rail button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-rail-spacer { flex: 1; }
.publisher-workspace .pub-sidebar {
  position: fixed; inset: 0 auto 0 var(--pub-rail-w); width: var(--pub-sidebar-w); z-index: 41;
  padding: 22px 18px 18px; border-right: 1px solid var(--border); background: var(--panel);
  overflow-y: auto; display: flex; flex-direction: column;
}
.publisher-workspace .portal-brand { border: 0; border-radius: 8px; padding: 6px; align-self: center; background: #fff; }
.publisher-workspace .brand-logo--portal { width: 172px; max-height: 64px; }
.pub-partner-label { display: flex; align-items: center; gap: 9px; margin: 12px 0 22px; font-size: 10px; color: var(--muted); white-space: nowrap; letter-spacing: .06em; }
.pub-partner-label::before, .pub-partner-label::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.publisher-workspace .pub-nav { display: flex; flex-direction: column; gap: 2px; margin: 0; overflow: visible; flex-wrap: nowrap; border: 0; padding: 0; }
.publisher-workspace .pub-nav .tab {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; padding: 8px 10px;
  min-height: 34px; border: 0; border-radius: 6px; color: var(--text); background: transparent;
  font-size: 13px; font-weight: 400; white-space: normal; box-shadow: none;
}
.publisher-workspace .pub-nav .tab::before { content: ''; width: 15px; height: 15px; flex: 0 0 15px; background: currentColor; mask: var(--pub-icon) center / contain no-repeat; }
#tab-overview { --pub-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M3 4h18v13H3zM8 21h8m-4-4v4'/%3E%3C/svg%3E"); }
#tab-offers { --pub-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M3 6h18v14H3zM8 6V3h8v3M3 11h18'/%3E%3C/svg%3E"); }
#tab-postbacks { --pub-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='m8 4-5 5 5 5M3 9h12a6 6 0 0 1 0 12'/%3E%3C/svg%3E"); }
#tab-stats, #tab-conversions, #tab-statements { --pub-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M4 3v18h17M8 17v-5m5 5V7m5 10V4'/%3E%3C/svg%3E"); }
#tab-notices { --pub-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M4 4h16v12H9l-5 4z'/%3E%3C/svg%3E"); }
#tab-account { --pub-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='7' r='4' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M4 22v-3a8 8 0 0 1 16 0v3'/%3E%3C/svg%3E"); }
.publisher-workspace .pub-nav .tab:hover { background: var(--panel-2); }
.publisher-workspace .pub-nav .tab[aria-selected="true"] { background: var(--panel-2); color: var(--accent-ink); font-weight: 600; }
.pub-nav-group { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 10px 4px; }
.pub-sidebar-guide { margin: auto 12px 0; padding-top: 36px; color: var(--muted); font-size: 12px; }
.publisher-workspace .pub-tool-nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); background: transparent; border: 0; text-align: left; font-size: 13px; white-space: normal; }
.publisher-workspace .pub-tool-nav:hover { background: var(--panel-2); }
.publisher-workspace .portal-header { min-height: 62px; margin: 0; padding: 12px 28px; gap: 12px; border-bottom: 1px solid var(--border); background: var(--panel); }
.pub-header-label { font-size: 12px; color: var(--muted); }
.publisher-workspace .portal-header .live { flex-wrap: wrap; justify-content: flex-end; }
.publisher-workspace #main { padding: 24px 28px 32px; min-width: 0; max-width: 1920px; margin: 0 auto; }
.pub-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.pub-breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.publisher-workspace #pub-page-title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.025em; }
.publisher-workspace #portal-range { border-radius: 8px; margin-bottom: 20px; }
.publisher-workspace #rangebar { padding: 12px 14px; gap: 8px; }
.publisher-workspace :is(.chip, input, select) { border-radius: 6px; }
.publisher-workspace .chip { font-size: 12px; padding: 6px 10px; }
.publisher-workspace .chip.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
html[data-theme="dark"] .publisher-workspace .chip.primary { color: var(--panel); }
.publisher-workspace #cards { display: block; margin: 0 0 20px; }
.pub-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.publisher-workspace .pub-kpi { padding: 0; overflow: hidden; }
.publisher-workspace .pub-kpi > .label { padding: 10px 13px; background: var(--panel-2); color: var(--text); text-transform: none; font-size: 12px; font-weight: 600; letter-spacing: 0; }
.pub-kpi-body { display: flex; flex: 1; flex-direction: column; padding: 14px 13px; min-height: 168px; }
.publisher-workspace .pub-kpi .value { margin: 2px 0 0; padding-top: 0; font-size: 25px; font-weight: 650; color: var(--text); }
.publisher-workspace .pub-kpi .sub { font-size: 11px; }
.pub-kpi-dash { width: 24px; height: 2px; background: #72abff; margin: 22px 0; }
.pub-kpi-detail { border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto; font-size: 11px; color: var(--muted); }
.pub-kpi-detail > span { white-space: nowrap; }
.pub-performance-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 4fr); gap: 20px; }
.publisher-workspace .pub-tracking-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; padding: 32px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: var(--text); white-space: normal; text-align: center; }
.pub-tracking-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 12px; background: #554bff; color: #fff; font-size: 38px; margin-bottom: 5px; }
.publisher-workspace .pub-tracking-card > .sub { font-size: 12px; line-height: 1.7; max-width: 210px; }
.publisher-workspace .pub-tracking-card > .chip { border: 0; background: var(--panel-2); color: var(--accent-ink); }
.publisher-workspace .pub-performance { margin: 0; min-width: 0; }
.publisher-workspace section h2 { background: var(--panel-2); padding: 11px 15px; font-size: 13px; }
.publisher-workspace section h2::before { display: none; }
.pub-performance-content { padding: 18px 20px 22px; min-height: 320px; }
.pub-performance-summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--border); font-size: 12px; }
.pub-performance-summary > .sub { margin-left: auto; font-size: 11px; }
.pub-performance-summary strong { font-size: 21px; color: var(--accent-ink); }
.publisher-workspace .pub-trend { padding: 24px 0 0; margin: 0; }
.publisher-workspace .pub-trend svg { height: 220px; }
.publisher-workspace .pub-trend figcaption { margin-top: 14px; font-size: 11px; }
.pub-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.publisher-workspace .pub-shortcut { display: flex; align-items: center; gap: 14px; padding: 20px 16px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); text-align: left; white-space: normal; }
.pub-shortcut > span:nth-child(2) { display: grid; gap: 6px; flex: 1; }
.pub-shortcut strong { font-size: 13px; font-weight: 600; }
.pub-shortcut > span:nth-child(2) > span { font-size: 12px; color: var(--muted); line-height: 1.6; }
.pub-shortcut-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 9px; background: var(--panel-2); color: var(--accent-ink); font-size: 23px; }
.publisher-workspace :is(.pub-shortcut, .pub-tracking-card):hover { border-color: var(--accent); }
.publisher-workspace [data-panel] > .toolbar { padding: 14px 16px; gap: 10px; }
.publisher-workspace #offer-q { min-width: 220px; flex: 1; }
.publisher-workspace thead th { text-transform: none; letter-spacing: 0; font-size: 12px; }
.publisher-workspace tbody td { padding-top: 13px; padding-bottom: 13px; }
.publisher-workspace tbody tr:hover { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.publisher-workspace #view-banner { position: relative; z-index: 43; }
.pub-mobile-menu, .pub-nav-scrim { display: none; }
body.portal.publisher-workspace.pub-nav-collapsed { --pub-sidebar-w: 0px; }
.publisher-workspace.pub-nav-collapsed .pub-sidebar { display: none; }
@media (max-width: 1500px) {
  .pub-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pub-kpi-body { min-height: 140px; }
  .pub-kpi-dash { margin: 16px 0; }
}
@media (max-width: 1100px) {
  body.portal.publisher-workspace { --pub-sidebar-w: 208px; }
  .publisher-workspace .pub-sidebar { padding-left: 12px; padding-right: 12px; }
  .publisher-workspace .portal-header { padding: 12px 20px; }
  .publisher-workspace #main { padding: 20px; }
  .publisher-workspace .portal-header #tick, .pub-header-label { display: none; }
  .pub-shortcuts { grid-template-columns: 1fr; gap: 10px; }
  .pub-performance-row { grid-template-columns: minmax(170px, 1fr) minmax(0, 3fr); gap: 16px; }
}
@media (max-width: 800px) {
  body.portal.publisher-workspace { padding: 0; --pub-sidebar-w: 244px; }
  .publisher-workspace .pub-rail { display: none; }
  .publisher-workspace .pub-sidebar { display: none; left: 0; width: 244px; z-index: 51; }
  .publisher-workspace.pub-nav-open .pub-sidebar { display: flex; }
  .publisher-workspace .pub-mobile-menu { display: block; font-size: 22px; padding: 2px 6px; }
  .publisher-workspace.pub-nav-open .pub-nav-scrim { display: block; position: fixed; inset: 0; z-index: 50; border: 0; border-radius: 0; padding: 0; background: #10182866; }
  .publisher-workspace .portal-header { padding: 12px 16px; flex-wrap: nowrap; }
  .publisher-workspace .portal-header .live { flex: 1; width: auto; margin: 0; gap: 8px; }
  .publisher-workspace #main { padding: 18px 16px 28px; }
  .publisher-workspace #guide-link, .publisher-workspace #account-status { display: none; }
  .pub-performance-row { grid-template-columns: 1fr; }
  .publisher-workspace .pub-tracking-card { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; padding: 18px; text-align: left; }
  .pub-tracking-icon { width: 46px; height: 46px; font-size: 30px; margin: 0; }
  .publisher-workspace .pub-tracking-card > .sub { max-width: none; flex-basis: 100%; }
}
@media (max-width: 480px) {
  .pub-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .publisher-workspace .pub-kpi > .label { font-size: 11px; padding: 9px 11px; }
  .pub-kpi-body { padding: 12px 11px; min-height: 146px; }
  .publisher-workspace .pub-kpi .value { font-size: 23px; }
  .publisher-workspace .pub-kpi-detail { font-size: 10px; }
  .publisher-workspace #pub-page-title { font-size: 21px; }
  .pub-breadcrumb { font-size: 10px; }
  .publisher-workspace .portal-header #who { flex-basis: 100%; text-align: right; }
  .publisher-workspace #panel-offers > .toolbar > select { flex: 1; min-width: 110px; max-width: 100%; }
  .publisher-workspace .pub-trend svg { height: 180px; }
}

/* Dense catalogue and focused tools, following the publisher workspace shell. */
.publisher-workspace .pub-sidebar .portal-header { flex-direction: column; align-items: stretch; padding: 18px 0 0; margin-top: auto; min-height: 0; border: 0; background: transparent; }
.publisher-workspace .pub-sidebar .pub-header-label { display: none; }
.publisher-workspace .pub-sidebar .portal-header .live { display: flex; margin: 0; width: 100%; gap: 9px 7px; justify-content: flex-start; font-size: 11px; }
.publisher-workspace .pub-sidebar #who { font-size: 12px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.publisher-workspace .pub-sidebar #tick { font-size: 10px; }
.publisher-workspace .pub-sidebar #guide-link { display: none; }
.publisher-workspace .pub-sidebar #signout { padding: 4px 0; font-size: 11px; }
.publisher-workspace .pub-sidebar #langbar { flex: 1; }
.publisher-workspace .pub-sidebar-guide { margin: 0; padding: 10px 0 0; font-size: 11px; }
.publisher-workspace #main { padding-top: 22px; }
.publisher-workspace .pub-page-heading { align-items: flex-end; margin-bottom: 26px; }
.publisher-workspace .pub-page-heading > div { min-width: 0; flex: 1; }
.publisher-workspace #pub-page-title { font-size: 22px; line-height: 1.4; overflow-wrap: anywhere; }
.publisher-workspace #panel-offers { overflow: visible; border: 0; background: transparent; border-radius: 0; }
.publisher-workspace #panel-offers > h2 { display: none; }
.publisher-workspace #offer-scope { padding: 0 0 6px; gap: 5px; }
.publisher-workspace #offer-scope-note { flex: 1 1 245px; font-size: 11px; }
.publisher-workspace .pub-request-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 6px 10px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.publisher-workspace .pub-request-bar > label { margin: 0; font-size: 12px; cursor: pointer; }
.publisher-workspace .pub-request-bar input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--accent); }
.publisher-workspace #request-clear { margin-left: auto; }
.publisher-workspace #request-selected { min-width: 120px; }
.publisher-workspace .pub-request-feedback:not(:empty) { flex-basis: 100%; overflow-wrap: anywhere; }
.publisher-workspace #offer-scope > .chip { border: 0; background: transparent; border-radius: 6px; font-size: 12px; }
.publisher-workspace #offer-scope > .chip[aria-pressed="true"] { background: var(--panel-2); color: var(--accent-ink); }
.publisher-workspace #offer-ai-status { margin: 0 0 12px; }
.pub-offer-table-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 7px 0; }
.publisher-workspace #panel-offers .pub-offer-toolbar { position: relative; margin-left: auto; padding: 0; gap: 5px; background: transparent; }
.publisher-workspace .pub-offer-filters { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.pub-offer-searchbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.publisher-workspace .pub-offer-searchbar #offer-q { flex: 1 1 260px; width: auto; padding: 6px 10px; }
.publisher-workspace .pub-offer-filters .pub-field { min-width: 0; margin: 0; gap: 4px; font-weight: 600; }
.publisher-workspace .pub-offer-filters .pub-field > label { margin: 0; }
.publisher-workspace #offer-main-filters > summary { display: none; }
.pub-offer-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 9px; margin-top: 7px; }
@media (min-width: 1320px) {
  .pub-offer-filter-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.publisher-workspace .pub-offer-filters :is(select, input[type="search"], #offer-country) {
  width: 100%; min-width: 0; min-height: 32px; box-sizing: border-box; font-size: 13px; font-weight: 400;
}
.publisher-workspace #offer-country { justify-content: space-between; border-radius: 6px; padding: 5px 9px; background: var(--panel-2); }
.publisher-workspace #offer-country::after { content: "▾"; }
.publisher-workspace #offer-country-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.publisher-workspace #offer-country-menu { position: relative; }
.publisher-workspace .pub-country-options { left: 0; right: auto; width: min(290px, calc(100vw - 64px)); box-sizing: border-box; gap: 8px; }
.publisher-workspace #offer-country-options { max-height: 250px; overflow-y: auto; }
.publisher-workspace #offer-country-options fieldset { min-width: 0; margin: 0 0 6px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }
.publisher-workspace #offer-country-options label { padding: 5px 0; font-weight: 400; cursor: pointer; }
.publisher-workspace #offer-advanced .pub-column-options { width: min(230px, calc(100vw - 48px)); }
.publisher-workspace #panel-offers .pub-applied-filters { gap: 4px; padding: 0; }
.publisher-workspace .pub-applied-filters .chip { overflow-wrap: anywhere; text-align: left; }
.publisher-workspace #offer-export-menu .pub-column-options { width: min(250px, calc(100vw - 40px)); }
.publisher-workspace #offer-export-menu button { text-align: left; }
.pub-popover { position: relative; }
.pub-popover > summary { display: flex; align-items: center; gap: 7px; list-style: none; cursor: pointer; background: var(--panel); border: 1px solid var(--border); }
.pub-popover > summary::-webkit-details-marker { display: none; }
.pub-popover[open] > summary { border-color: var(--accent); color: var(--accent-ink); }
.pub-popover .pub-column-options { position: absolute; top: calc(100% + 8px); right: 0; z-index: 25; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px #18243b22; }
.pub-column-options { width: 200px; display: grid; gap: 12px; }
.pub-column-options label { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.publisher-workspace .pub-column-options input[type="checkbox"] { width: 15px; min-width: 15px; height: 15px; margin: 0; }
.publisher-workspace .pub-column-options .pub-field { align-items: stretch; }
.publisher-workspace #saved-filters-fields, .publisher-workspace #report-preferences-fields,
.publisher-workspace #notice-preferences-fields { border: 0; margin: 0; padding: 8px 0; min-width: 0; }
.publisher-workspace #saved-filter-choice { min-width: 0; width: 100%; }
.publisher-workspace input[type="checkbox"], .publisher-workspace input[type="radio"] { accent-color: var(--accent); }
.publisher-workspace #panel-offers > .scroll { border: 1px solid var(--border); border-radius: 12px; max-height: max(300px, calc(100dvh - 240px)); overflow: auto; }
.publisher-workspace #tbl-offers { background: var(--panel); }
.publisher-workspace #tbl-offers :is(th, td) { text-align: left; padding: 13px 14px; font-size: 12px; }
.publisher-workspace #tbl-offers thead { position: sticky; top: 0; z-index: 3; }
.publisher-workspace #tbl-offers th { font-weight: 600; background: var(--panel-2); }
.publisher-workspace #tbl-offers .o-name { white-space: normal; min-width: 230px; max-width: 420px; }
.pub-offer-name { display: flex; align-items: center; gap: 12px; }
.pub-offer-avatar { display: grid; place-items: center; flex: 0 0 34px; height: 38px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); color: var(--muted); font-size: 16px; font-weight: 600; }
.publisher-workspace .pub-offer-title { border: 0; background: none; padding: 0; color: var(--accent-ink); text-align: left; white-space: normal; font-size: 12px; font-weight: 500; line-height: 1.6; }
.publisher-workspace .pub-offer-title:hover { text-decoration: underline; }
.pub-offer-platform { display: block; margin-top: 2px; font-size: 10px; }
.pub-reason { display: inline-block; margin: 4px 4px 0 0; }
.pub-row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.publisher-workspace .pub-row-actions .chip { font-size: 11px; padding: 5px 9px; }
.publisher-workspace .pub-row-actions .star-toggle { font-size: 18px; }
.pub-commission-cell { min-width: 110px; }
.pub-commission-cell strong { font-weight: 600; }
.pub-commission-cell .sub { font-size: 10px; }
.pub-commission-quote + .pub-commission-quote { margin-top: 6px; }
.publisher-workspace #panel-offers > .pager { margin-top: 12px; position: sticky; bottom: 0; z-index: 5; justify-content: flex-end; padding: 12px 0; background: var(--bg); border: 0; font-size: 11px; }
.publisher-workspace #offer-page { flex-basis: 100%; text-align: right; font-size: 11px; }
.publisher-workspace #offer-jump-form { margin: 0; }
.publisher-workspace #offer-limit { font-size: 12px; }
.pub-detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pub-loading { padding: 55px 20px; text-align: center; color: var(--muted); }
.pub-detail-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; margin-bottom: 20px; border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--accent) 6%, var(--panel)); font-size: 13px; }
.pub-detail-banner > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.pub-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pub-detail-card { min-width: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); }
.pub-detail-card > summary { padding: 13px 20px; background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 600; }
.pub-detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 28px; padding: 24px 20px; margin: 0; }
.pub-detail-fields dt, .pub-delivery-detail dt { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.pub-detail-fields dd, .pub-delivery-detail dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.pub-detail-card-body { padding: 24px 20px; }
.pub-detail-card-body .pub-detail-fields { padding: 0 0 22px; }
.pub-detail-card-body > .sub { margin: 0 0 20px; font-size: 12px; }
.pub-detail-price { margin-bottom: 12px; }
.pub-detail-price > strong { font-size: 30px; letter-spacing: -.02em; color: var(--text); }
.pub-detail-price .sub { margin-top: 5px; font-size: 12px; }
.publisher-workspace .pub-tool-dialog, .publisher-workspace .pub-postback-dialog { width: min(1080px, calc(100vw - 40px)); max-width: none; max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border); border-radius: 13px; color: var(--text); background: var(--panel); box-shadow: 0 20px 70px #10182838; }
.publisher-workspace .pub-postback-dialog { width: min(760px, calc(100vw - 40px)); }
.publisher-workspace :is(.pub-tool-dialog, .pub-postback-dialog)::backdrop { background: #18243599; }
.pub-dialog-heading { position: sticky; top: 0; z-index: 2; background: var(--panel); display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.pub-dialog-heading h2 { font-size: 17px; margin: 0; }
.publisher-workspace .pub-close { font-size: 25px; line-height: 1; padding: 0 3px; color: var(--muted); border: 0; background: none; }
.pub-tool-layout { display: grid; grid-template-columns: 46% 54%; }
.linkgen-builder { padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
body.console .linkgen-builder { padding: 0; background: var(--panel); }
.linkgen-builder [hidden] { display: none !important; }
.linkgen-builder .linkgen-choice { display: flex; margin: 0 0 16px; }
.linkgen-builder .pub-field { display: flex; margin: 0 0 13px; }
.linkgen-builder :is(select, .pub-field input) { width: 100%; min-width: 0; }
.linkgen-step { display: flex; align-items: center; gap: 10px; }
.linkgen-step > span:first-child { display: inline-grid; place-items: center; flex: 0 0 25px; height: 25px; border-radius: 50%; color: var(--accent); background: var(--panel-2); font-weight: 600; }
.linkgen-landing { margin: 20px 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--border); min-width: 0; }
.linkgen-landing legend { padding: 0 0 8px; font-size: 14px; font-weight: 600; }
.linkgen-choice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; cursor: pointer; font-size: 13px; }
.linkgen-choice input { flex: 0 0 16px; width: 16px; min-width: 16px; margin: 3px 0 0; }
.linkgen-choice small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.linkgen-choice:has(input:disabled) { opacity: .65; cursor: default; }
.linkgen-hint { padding: 10px 12px; border-radius: 6px; background: var(--panel-2); color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.linkgen-generate { width: 100%; margin-top: 18px; padding: 12px; }
.linkgen-summary { margin: 16px 0 0; font-size: 12px; }
.linkgen-summary > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.linkgen-summary dt { color: var(--muted); }
.linkgen-summary dd { margin: 0; overflow-wrap: anywhere; }
.pub-tool-config, .pub-tool-results { min-width: 0; max-height: calc(100dvh - 140px); overflow: auto; padding: 22px 24px; }
.pub-tool-config { border-right: 1px solid var(--border); }
.pub-tool-layout h3, .pub-dialog-content h3 { margin: 0 0 15px; font-size: 14px; font-weight: 600; }
.pub-mode-switch { padding: 0; border: 0; margin: 0 0 18px; display: flex; gap: 4px; border-radius: 6px; background: var(--panel-2); }
.pub-mode-switch legend { display: block; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
.pub-mode-switch label { position: relative; flex: 1; padding: 7px; text-align: center; font-size: 12px; cursor: pointer; border: 1px solid transparent; border-radius: 6px; }
.pub-mode-switch label:has(input:checked) { border-color: var(--border); background: var(--panel); box-shadow: 0 1px 3px #1a223514; }
.pub-mode-switch label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-mode-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pub-field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 13px; font-size: 12px; }
.publisher-workspace .pub-field input { width: 100%; min-width: 0; padding: 9px 11px; font-size: 13px; }
.pub-tool-offers { max-height: 215px; min-height: 90px; overflow-y: auto; border: 1px solid var(--border); border-radius: 7px; margin-top: 10px; }
.pub-tool-offer { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pub-tool-offer:last-child { border-bottom: 0; }
.pub-tool-offer:hover, .pub-tool-offer:has(input:checked) { background: var(--panel-2); }
.pub-tool-offer:has(input:disabled) { opacity: .6; cursor: default; }
.pub-tool-offer strong { display: block; font-size: 12px; font-weight: 500; }
.pub-tool-offer .sub { display: block; font-size: 10px; margin-top: 3px; }
.publisher-workspace .pub-tool-offer input { width: 15px; min-width: 15px; height: 15px; margin: 0; flex: 0 0 auto; }
.pub-tool-offer > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.pub-tool-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 22px; color: var(--muted); font-size: 11px; }
.pub-tool-subs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.pub-tool-config > .sub, .pub-tool-results > .sub { font-size: 11px; line-height: 1.7; }
.pub-tool-results-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.pub-tool-results-heading h3 { margin: 0; }
.pub-tool-empty { color: var(--muted); padding: 25px 16px; text-align: center; font-size: 12px; }
.pub-tool-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 350px; line-height: 1.7; }
.pub-tool-welcome .pub-tracking-icon { margin-bottom: 24px; }
.pub-tool-welcome strong { color: var(--text); font-size: 14px; }
.pub-generated-link { padding: 16px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 9px; }
.pub-generated-link > div:first-child { font-size: 12px; line-height: 1.6; }
.pub-generated-link textarea { display: block; width: 100%; margin: 12px 0; resize: vertical; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel-2); color: var(--text); font: 12px/1.7 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
#tracking-dialog[data-entry="offer-list"] .pub-tool-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#tracking-dialog[data-entry="offer-list"] .pub-mode-switch {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; background: transparent;
}
#tracking-dialog[data-entry="offer-list"] .pub-mode-switch legend {
  margin-bottom: 8px; color: var(--text); font-size: 13px; font-weight: 600;
}
#tracking-dialog[data-entry="offer-list"] .pub-mode-switch label {
  display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px;
  margin: 0; padding: 9px 11px; border-color: var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font-size: 13px; text-align: left;
}
#tracking-dialog[data-entry="offer-list"] .pub-mode-switch label:hover {
  border-color: var(--accent);
}
#tracking-dialog[data-entry="offer-list"] .pub-mode-switch label:has(input:checked) {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  color: var(--accent-ink); font-weight: 600; box-shadow: none;
}
#tracking-dialog[data-entry="offer-list"] .pub-mode-switch input {
  position: static; flex: 0 0 16px; width: 16px; min-width: 16px; height: 16px; margin: 0; opacity: 1;
}
#tracking-dialog[data-entry="offer-list"] #tracking-picker > summary { color: var(--accent-ink); cursor: pointer; font-size: 13px; }
#tracking-dialog[data-entry="offer-list"] #tracking-picker h3 { margin-top: 12px; }
#tracking-dialog[data-entry="offer-list"] .pub-tool-offers { max-height: 132px; }
#tracking-dialog[data-entry="offer-list"] .pub-tool-offer { margin: 0; }
#tracking-dialog[data-entry="offer-list"] .pub-tool-pager { margin-bottom: 12px; }
#tracking-dialog[data-entry="offer-list"] .linkgen-step > span:first-child { display: none; }
#tracking-dialog[data-entry="offer-list"] #tracking-advanced { margin-top: 16px; }
#tracking-dialog[data-entry="offer-list"] #tracking-advanced > summary,
#tracking-dialog[data-entry="offer-list"] #tracking-advanced > .sub,
#tracking-dialog[data-entry="offer-list"] .pub-optional-subs > .sub:last-child,
#tracking-dialog[data-entry="offer-list"] .linkgen-landing:not(:has(#tracking-custom:checked)) > .pub-field { display: none; }
#tracking-dialog[data-entry="offer-list"] .linkgen-landing { margin: 0 0 14px; padding-top: 0; border: 0; }
#tracking-dialog[data-entry="offer-list"] .pub-tracking-landing-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#tracking-dialog[data-entry="offer-list"] .linkgen-choice { margin: 0 0 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
#tracking-dialog[data-entry="offer-list"] .linkgen-choice:has(input:checked) { border-color: var(--accent); background: var(--panel-2); }
#tracking-dialog[data-entry="offer-list"] .pub-optional-subs { margin: 0; }
#tracking-dialog[data-entry="offer-list"] .pub-tool-subs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 8px; }
#tracking-dialog[data-entry="offer-list"] .pub-tool-results-heading { gap: 8px; }
#tracking-dialog[data-entry="offer-list"] .pub-tool-results-heading .chip { white-space: normal; text-align: left; }
#tracking-dialog[data-entry="offer-list"] .pub-generated-link textarea { margin: 0; }
@media (max-width: 800px) {
  #tracking-dialog[data-entry="offer-list"] .pub-tool-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  #tracking-dialog[data-entry="offer-list"] .pub-tracking-landing-options { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #tracking-dialog[data-entry="offer-list"] .pub-tool-subs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.pub-dialog-content { padding: 24px; }
.pub-dialog-content > .sub { font-size: 12px; line-height: 1.8; }
.pub-config-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pub-dialog-actions { position: sticky; bottom: 0; background: var(--panel); display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }
.pub-macro-picker { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; }
.publisher-workspace .pub-macro-picker .chip { font-size: 11px; padding: 5px 9px; }
.pub-segment { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; font-size: 12px; }
.pub-segment .is-active { padding: 8px 12px; border-radius: 6px; background: var(--panel-2); color: var(--accent-ink); font-weight: 600; }
.publisher-workspace .pub-url-cell { white-space: normal; text-align: left; min-width: 220px; max-width: 520px; overflow-wrap: anywhere; font-size: 12px; }
.publisher-workspace #pb-config-table :is(th, td), .publisher-workspace #my-pb-log :is(th, td) { text-align: left; font-size: 12px; }
.publisher-workspace #my-pb-log td { vertical-align: top; }
.publisher-workspace .pub-log-toolbar { padding: 15px 16px; gap: 9px; }
.publisher-workspace .pub-log-toolbar input { flex: 1; min-width: 220px; font-size: 12px; }
.publisher-workspace #panel-postbacks section > .pub-list-caption { padding: 0 16px 14px; }
.pub-delivery-detail summary { color: var(--accent-ink); cursor: pointer; font-size: 12px; }
.pub-delivery-detail[open] { min-width: 290px; max-width: 420px; }
.pub-delivery-detail dl { margin: 12px 0; white-space: normal; padding: 12px; background: var(--panel-2); border-radius: 7px; }
.pub-delivery-detail dd { font-size: 11px; margin-bottom: 12px; }
.pub-delivery-detail dd:last-child { margin: 0; }
@media (max-width: 1000px) {
  .pub-detail-grid { gap: 14px; }
  .pub-detail-fields { gap: 20px 16px; }
}
@media (max-width: 800px) {
  .publisher-workspace .pub-page-heading { align-items: center; gap: 12px; }
  .publisher-workspace .pub-page-heading .pub-mobile-menu { display: block; padding: 3px 5px; }
  .publisher-workspace .pub-sidebar #who { flex-basis: auto; text-align: left; }
  .publisher-workspace .pub-sidebar #account-status { display: inline-flex; }
  .publisher-workspace .pub-sidebar #tick { display: inline; }
  .publisher-workspace .pub-sidebar .portal-header { padding: 20px 0 0; }
  .pub-detail-grid { grid-template-columns: 1fr; }
  .pub-detail-banner { flex-direction: column; align-items: stretch; }
  .pub-tool-layout { grid-template-columns: 1fr; }
  .pub-tool-config, .pub-tool-results { max-height: none; overflow: visible; padding: 20px; }
  .pub-tool-config { border-right: 0; border-bottom: 1px solid var(--border); }
  .pub-tool-welcome { min-height: 200px; }
  .publisher-workspace .pub-tool-dialog { max-height: calc(100dvh - 28px); width: calc(100vw - 24px); }
}
@media (max-width: 640px) {
  .publisher-workspace #panel-offers > .scroll { max-height: none; }
  .publisher-workspace #tbl-offers tr[data-offer-row] { padding: 16px; gap: 10px 16px; }
  .publisher-workspace #tbl-offers td { padding: 0; }
  .publisher-workspace #tbl-offers .o-name { min-width: 0; max-width: none; }
  .publisher-workspace #tbl-offers td.o-link { display: block; }
  .publisher-workspace #tbl-offers .pub-row-actions { flex-wrap: wrap; }
  .publisher-workspace #tbl-offers .pub-offer-title { font-size: 14px; }
  .publisher-workspace #panel-offers > .pager { position: static; justify-content: flex-start; }
  .pub-popover { position: static; }
  .pub-popover .pub-column-options { left: 0; right: 0; width: 100%; top: 100%; }
  .pub-detail-fields { grid-template-columns: 1fr; }
  .publisher-workspace #pub-refresh { font-size: 11px; padding: 5px 8px; }
  .pub-dialog-heading { padding: 17px 20px; }
  .pub-dialog-heading h2 { font-size: 15px; }
  .publisher-workspace :is(.pub-tool-config, .pub-dialog-content) input, .pub-generated-link textarea { font-size: 16px; }
  .publisher-workspace .pub-log-toolbar input { min-width: 0; flex-basis: 100%; }
}

/* Publisher link downloads and optional onboarding. */
.pub-account-options { position:absolute; right:0; top:100%; z-index:45; display:grid; gap:12px; width:240px; padding:16px; border:1px solid var(--border); border-radius:8px; background:var(--panel); box-shadow:var(--shadow); }
.pub-checklist, .pub-optional-subs { margin:18px 0; padding:16px; border:1px solid var(--border); border-radius:8px; background:var(--panel); }
.pub-checklist summary, .pub-optional-subs summary { cursor:pointer; font-weight:600; }
.pub-checklist ol { margin-bottom:0; padding-left:24px; }
.pub-checklist li { padding:6px 0; }
.pub-checklist button { white-space:normal; text-align:left; }
.pub-link-context { display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:12px; margin:10px 0; }
#link-export-dialog { max-width:600px; }
#link-export-dialog .actions { display:flex; gap:8px; flex-wrap:wrap; }
.publisher-workspace [hidden] { display:none !important; }
@media (max-width:640px) {
  .publisher-workspace #offer-scope .pub-account-options { position:static; margin-top:8px; max-width:calc(100vw - 48px); }
}

@media (max-width: 760px) {
  .publisher-workspace #offer-scope-note { flex-basis: 100%; }
  .publisher-workspace #offer-main-filters > summary { display: list-item; width: fit-content; margin-top: 7px; cursor: pointer; font-size: 13px; }
  .publisher-workspace .pub-offer-searchbar #offer-q { flex-basis: 100%; }
  .pub-offer-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .publisher-workspace .pub-offer-filters select { padding-inline: 6px; }
  .publisher-workspace .pub-offer-filters input[type="search"] { font-size: 16px; }
}
@media (max-width: 350px) {
  .pub-offer-filter-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Publisher promotion details, shared by registration and the account editor. */
.promotion-field { display: grid; gap: 6px; margin: 14px 0 6px; }
.promotion-field textarea { width: 100%; box-sizing: border-box; min-width: 0; }
.promotion-group { margin: 14px 0 6px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.promotion-group legend { font-weight: 600; }
.promotion-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.promotion-choice { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; }
.promotion-choice input { width: auto; flex: 0 0 auto; margin: 3px 0 0; }
.promotion-choice[hidden] { display: none; }
.promotion-regions { max-height: 190px; overflow: auto; margin-top: 10px; }
#promotion-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
