/* Deliberately small and hand-written: the dashboard is tables, filters and one chart,
   and a CSS framework would be a build step this project has no other need for.

   The palette is the Pricechecker product's own, sampled from the signed-in dashboard and
   the sign-in screen rather than guessed. Two things about it are load-bearing:

   - **Chrome is charcoal, not red.** Brand red and "this listing undercuts" red are within
     a few degrees of each other, so a red header would make every severity figure read as
     decoration. The product already solves this: red appears in data, never in furniture.
     Brand red is confined to the sign-in page and the logo mark.
   - **Light only.** The product has no dark mode, and a dashboard that renders differently
     from the client's other tab invites "is this the same data?" at exactly the wrong
     moment.
*/

:root {
  /* Brand */
  --brand: #c81721;
  --brand-ink: #fff;
  --chrome: #444;
  --chrome-ink: #f2f2f2;

  /* Surfaces */
  --canvas: #f9f9f9;
  --surface: #fff;
  --rule: #e3e3e3;
  --rule-strong: #d2d2d2;

  /* Text */
  --ink: #1f1f1f;
  --muted: #6b6b6b;

  /* The member lines on the product detail chart: identity, not magnitude, so a
     categorical set rather than a ramp. Seven, not eight — slot 8 of the theme these are
     taken from is a red, and red in this product means "undercut", never "member number
     eight". Past seven the tail folds into `--series-other`; a generated hue is
     indistinguishable from an existing one under colour-vision deficiency.

     Validated against this file's own `--surface`, not eyeballed:
       node scripts/validate_palette.js "#2a78d6,#eb6834,#1baf7a,#eda100,#e87ba4,#008300,#4a3aa7" \
         --mode light --surface "#ffffff"
     Lightness band, chroma floor, CVD separation (worst adjacent pair ΔE 9.1 protan) and
     normal-vision separation (worst ΔE 19.6) all pass. Three hues fall below 3:1 contrast
     against the surface, which is not dismissable — it is discharged by the members × runs
     fallback table under the chart, which states every line in text. Do not reorder these:
     the checks are run on adjacent pairs, so the order is the thing that passed. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-other: #8a8da8;

  /* Data. Never used for furniture — see the note above. */
  --bad: #e82f44;
  --bad-bg: #fdecee;
  --good: #3fbb18;
  --neutral: #c6c8db;
  --accent: #74a4c7;
  --accent-bg: #eef4f9;
  --accent-ring: #cfe0ed;

  --warn-bg: #fdf3e3;
  --warn-ink: #7a4a00;

  --radius: 4px;
  --radius-lg: 6px;
}

* { box-sizing: border-box; }

/* `hidden` means hidden, everywhere.
 *
 * The browser hides `[hidden]` from its own stylesheet, and *any* author rule setting
 * `display` beats it — origin wins before specificity is even considered. So a component
 * that sets a display, as most do, silently un-hides itself the moment something sets the
 * attribute on it. It has caught this dashboard three times: the folded member list rendered
 * open, and the zoom reset button showed with nothing to reset. Stated once here rather than
 * patched per component, which is what left the third one to be found by looking. */
[hidden] { display: none !important; }

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

/* ----------------------------------------------------------------- chrome ---- */

.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.25rem;
  height: 52px;
  background: var(--chrome);
  color: var(--chrome-ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}

.brand b { font-weight: 700; }

/* The asset is the whole wordmark at 1672x326, so it is sized by height and left to keep its
   own ratio. `width: auto` has to be said: the `width` attribute on the element is there to
   reserve space before it loads, and without this it would win and squash the mark. */
.brand .mark { height: 22px; width: auto; flex: none; }

.site-nav { display: flex; gap: 0.25rem; align-items: center; }

.site-nav a,
.nav-pending {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--chrome-ink);
  text-decoration: none;
}

.site-nav a:hover { background: rgb(255 255 255 / 12%); }

/* The current section, as a filled pill — the product's own active state. */
.site-nav a[aria-current="page"],
.site-nav a[aria-current="page"]:hover {
  background: #fff;
  color: #1f1f1f;
  font-weight: 600;
}

/* Views not built yet read as disabled rather than being absent, so the shape of the
   dashboard is legible before all of it exists. */
.nav-pending { color: rgb(255 255 255 / 45%); cursor: default; }

.site-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.site-user form { margin: 0; }

/* On a phone the header cannot hold the brand, four sections, help, the name and sign-out on
   one line, and the overflow pushed "Sign out" off the page. The header wraps: brand, help and
   account on the first row, the sections on a second row that scrolls sideways if it must. The
   name is hidden there; the avatar still says who is signed in. */
@media (max-width: 760px) {
  .site-header {
    height: auto;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0.75rem;
  }
  .site-nav {
    order: 3;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
  }
  .site-nav a { padding: 0.3rem 0.6rem; white-space: nowrap; }
  .site-user { margin-left: auto; }
  .site-user-name { display: none; }
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Help menu */
.site-help {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid rgb(255 255 255 / 55%);
  border-radius: 50%;
  background: transparent;
  color: rgb(255 255 255 / 85%);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
  padding: 0;
  margin: 0;
}

.help-btn:hover,
.help-btn[aria-expanded="true"] {
  background: rgb(255 255 255 / 12%);
  border-color: #fff;
  color: #fff;
}

.help-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  max-height: 500px;
}

.help-popover[hidden] {
  display: none;
}

.help-tabs {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  border-bottom: 1px solid var(--rule);
}

.help-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-align: center;
  position: relative;
}

.help-tab:hover {
  background: var(--canvas);
  color: var(--ink);
}

.help-tab[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

.help-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.help-tab-content {
  display: none;
  overflow-y: auto;
  flex: 1;
  padding: 1rem;
}

.help-tab-content.active {
  display: flex;
  flex-direction: column;
}

.help-search {
  padding: 0.65rem;
  font-size: 0.85rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  margin-bottom: 0.75rem;
  font-family: inherit;
}

.help-search::placeholder {
  color: var(--muted);
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  flex: 1;
}

.help-list-item {
  padding: 0.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--canvas);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.85rem;
}

.help-list-item:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.help-list-item-title {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.help-list-item-description {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.help-list-item-category {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.5rem;
}

.help-list-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-ghost {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  color: var(--chrome-ink);
  background: transparent;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: var(--radius);
}

.btn-ghost:hover { background: rgb(255 255 255 / 12%); }

/* ------------------------------------------------------------- freshness ---- */

.freshness {
  margin: 0;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.freshness-stale {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-bottom-color: #e8d3a8;
}

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

main { padding: 1.5rem 1.25rem 3rem; }
/* One width for every section on the page: the filter bar, the tiles, the table card and
   the pager all sit inside `.wrap`, so they line up by construction rather than by three
   matching numbers somebody has to keep in step.

   Widened from 1200px when the member table grew its compliant-view columns to ten and
   started scrolling sideways inside its own card — a scrollbar under one section of a page
   whose other sections fit is read as a rendering fault, not as an invitation. */
.wrap { max-width: 1440px; margin: 0 auto; }

h1 { font-size: 1.35rem; font-weight: 600; margin: 0 0 0.25rem; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 0.5rem; }

.page-sub { color: var(--muted); margin: 0 0 1.25rem; font-size: 0.9rem; }

.note { color: var(--muted); font-size: 0.88rem; }

/* The summary's movement line. A sentence rather than a row of arrows: the figure only means
   anything beside the date it is measured from, and a sentence is the only shape that keeps
   the two together. */
.movement {
  margin: 0.9rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
}
.movement b { font-variant-numeric: tabular-nums; }

/* The latest run: its own band between the denominators and the window, because "what happened
   overnight" is the question somebody opens a dashboard for in the morning. A single row rather
   than a row of cards — it is three figures, and boxing each one gave the smallest question on
   the page the heaviest frame. */
.runrow {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  margin: 0 0 1.25rem;
}

.runrow-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.runrow-head h3 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.runrow-sub { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* Three figures as sub-cards filling the row. A description list because that is what this is —
   each figure is the value of the thing its label names — and the grouping survives wrapping.

   `auto-fit` with a floor rather than three fixed columns: the cards share the full width
   evenly on a desktop and drop to two, then one, when there is no longer room for a label at a
   readable size. The same gap as the card rows above and below, so the three bands read as one
   grid rather than three arrangements. */
.runstats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin: 0;
}

.runstats > div {
  background: var(--canvas);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 0.7rem 1rem;
}

.runstats dt { margin: 0; font-size: 0.85rem; color: var(--muted); }
.runstats dt a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule-strong); }
.runstats dt a:hover, .runstats dt a:focus-visible { color: var(--ink); border-bottom-color: var(--ink); }

.runstats dd {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The direction each figure moved, beside the figure rather than in a sentence of its own.
   Every figure in this row counts an offence, so down is unambiguously the better number and
   the colour says only that. It does **not** say why: a rise is frequently the client's own
   Agency Price going up rather than members discounting, which is what the disclosure directly
   beneath the row exists to tell the reader. Colour for direction, words for cause.

   The sign is written into the text (`+26`, `-11`) and not carried by colour alone, so the
   direction survives a monochrome print and a reader who cannot separate the two hues. */
.delta {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 0.4rem;
}

.delta-up { color: var(--bad); }
.delta-down { color: var(--good); }

/* Explanatory text folded away in place. `<details>` needs no script, is reachable by keyboard,
   and prints and degrades as plain text — which matters on a page whose chart already carries a
   no-JavaScript fallback. It expands in the flow rather than floating: a panel over the page
   hides the very figures it is explaining. */
.legend { margin: 0.75rem 0 0; }

.legend > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  width: fit-content;
}

.legend > summary::-webkit-details-marker { display: none; }
.legend > summary::marker { content: ""; }
.legend > summary:hover, .legend > summary:focus-visible { color: var(--ink); }

.legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 1px solid currentcolor;
  font-size: 0.7rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
}

.legend-body {
  margin-top: 0.5rem;
  padding-left: 1.45rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-body p { margin: 0 0 0.5rem; }
.legend-body p:last-child { margin-bottom: 0; }
.legend-body strong { color: var(--ink); font-weight: 600; }

/* The two leader tables, side by side on a desktop and stacked below it. They answer the
   mirrored halves of one question — which products are being undercut, and by whom — so
   reading them together is the point; `minmax(0, 1fr)` rather than `1fr` because a long
   product title would otherwise push the column wider than its share and break the pairing. */
.leaders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
.leaders .card { margin-bottom: 0; }
@media (max-width: 1000px) {
  .leaders { grid-template-columns: 1fr; }
}
.error { color: var(--bad); }

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.card.flush { padding: 0; overflow: hidden; }

/* ----------------------------------------------------------------- stats ---- */

.stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 1.25rem; }

.stat {
  flex: 1 1 160px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
}

.stat b {
  display: block;
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat b a {
  color: inherit;
  text-decoration: none;
}

.stat b a:hover {
  color: #1f6ea8;
  text-decoration: underline;
}

.stat b a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* The denominator in "391 of 1283", and in "12 of 203" on the member page. Grey and well
   below the figure's own size, so the tile still reads as one number at a glance — the ratio
   is there to be read second, not to compete with the number it qualifies. */
.stat b small {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
}

/* The pairing note, folded into its tile. The summary takes the place of the tile's caption,
   so it matches `.stat > span` rather than the summary-page legend it shares markup with —
   the tiles must still read as a row of captioned figures with every note closed. */
.legend-stat { margin: 0; }
.legend-stat > summary { font-size: 0.78rem; }
.legend-stat .legend-body { font-size: 0.8rem; padding-left: 0; }

/* The tile's caption, and only the caption. Scoped to a direct child because the run tile
   now has spans nested inside its control, and this rule was shrinking the date itself. */
.stat > span {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Two views of one run set. Radio inputs rather than script, so the tabs work before any
   JavaScript has run and survive its absence entirely. */
.tabs { display: flex; flex-wrap: wrap; }
.tabs > input { position: absolute; opacity: 0; pointer-events: none; }

.tabs > label {
  order: -1;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--rule);
}

.tabs > input:checked + label {
  color: var(--ink);
  font-weight: 600;
  border-color: var(--rule);
  border-bottom-color: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
}

/* Focus has to be visible on the label, because the input it belongs to is off-screen. */
.tabs > input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -2px; }

.tab-panel { display: none; width: 100%; padding-top: 1rem; }
#view-prices:checked ~ #panel-prices,
#view-when:checked ~ #panel-when,
#tab-sellers:checked ~ #panel-sellers,
#tab-matches:checked ~ #panel-matches { display: block; }

/* The plot and its key, side by side. The key was across the top and wrapped to three rows on
   a crowded product, pushing the plot down the page; as a column it takes one row per member
   however many there are, and the plot keeps a constant height. */
.chart-layout { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
/* Dragging a zoom box across the plot otherwise selects whatever text the pointer crosses,
   so the reader ends a zoom with half the page highlighted. */
.chart-layout .chart-wrap { flex: 1 1 380px; min-width: 0; user-select: none; }

/* The only standing sign that the plot can be dragged. The zoom box itself exists only while
   the button is held, so without this the feature is invisible until you already know it is
   there — which is exactly how it was missed. The class is set by the script and only when
   the zoom plugin actually loaded, so the cursor never promises something that is not there. */
.chart-wrap.is-zoomable canvas { cursor: crosshair; }
.chart-side { flex: 0 1 230px; min-width: 190px; }

/* The key itself is drawn into this by the chart script, one member per row. */
.series-key { display: flex; flex-direction: column; gap: 0.3rem; }

.series-key button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.15rem 0.2rem;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.series-key button:hover { background: var(--canvas); }
.series-key button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* A hidden series is struck through as well as faded, so its state does not rest on a colour
   difference alone. */
.series-key button[aria-pressed="false"] { color: var(--muted); }
.series-key button[aria-pressed="false"] .key-name { text-decoration: line-through; }

.series-key .key-mark { flex: none; }
.series-key .key-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The two notes, below the whole layout so an open one is the width of the card rather than
   of the key's gutter. The triggers keep their sides — chart note left, key note right — so
   each still points at what it explains; only the body is full width. */
.chart-notes { display: flex; flex-direction: column; margin-top: 0.75rem; }
.chart-notes .legend { margin: 0.15rem 0; }
/* The summary is inline-level, so an auto margin does not move it; aligning the inline box
   inside a right-aligned block does. The body is put back to the left because it is prose. */
.chart-notes .legend-right { text-align: right; }
.chart-notes .legend-right .legend-body { text-align: left; }

/* The members the "other" line stands for. Indented under it, and off the page until asked
   for, so the key is eight rows rather than twenty-three. */
.series-group { display: flex; flex-direction: column; gap: 0.3rem; margin-left: 0.9rem; }

.series-reveal {
  align-self: flex-start;
  margin-left: 0.9rem;
  padding: 0.1rem 0.2rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  cursor: pointer;
}

.series-reveal:hover, .series-reveal:focus-visible { color: var(--ink); border-bottom-color: var(--ink); }

/* The chart's series controls. Under the key, because they act on it. */
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0 0.2rem;
}

/* ------------------------------------------------------------- heatmap ---- */

/* Members down, runs across. The grid can be wider than the card on a 60-day window, so it
   scrolls in its own box rather than stretching the page. */
.heatmap-scroll { overflow-x: auto; }

/* Fills the card when it can, scrolls when it cannot.
 *
 * `width: 100%` spreads the spare width across the run columns, so a 13-run window makes a
 * grid the width of the page rather than a narrow block with half the card blank beside it —
 * and the cells grow with it, which is the part that matters for reading a shade.
 *
 * The floor is a per-column `min-width`, not a width on the table. A `max-content` minimum
 * with any percentage column in the table resolves circularly and blew this grid out to
 * 22,400px on the first attempt. Column minimums say the same thing without the loop: a
 * 60-day window exceeds the card, the cells keep their size, and the box around them scrolls.
 */
.heatmap {
  border-collapse: collapse;
  font-size: 0.8rem;
  width: 100%;
}

.heatmap thead th, .heatmap .heat { min-width: 3.2rem; }
.heatmap .heatmap-name { white-space: nowrap; }
.heatmap th, .heatmap td { padding: 0.3rem 0.45rem; text-align: center; white-space: nowrap; }
.heatmap thead th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--rule); }

/* `.heatmap th` also sets an alignment and outranks a single class, so this one has to be
   said with the table in front of it. Barely visible while the name column was narrow; once
   it took the grid's slack the names sat centred in a wide column. */
.heatmap .heatmap-name {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A sequential ramp: one hue, light to dark, more is a deeper undercut. Not the categorical
   palette — the cell's job is magnitude and the member is already named by its row — and not
   the undercut red either, which in this product means "this is an offence" and would make
   every cell shout. Steps are stepped for contrast: the two darkest carry white text.

   The bands themselves are fixed in `queries.MemberSeriesPoint.depth_band`, not here, so two
   products can be compared and the thresholds are stated once. */
.heat { font-variant-numeric: tabular-nums; border: 1px solid #fff; }
.heat-1 { background: #e4eefb; }
.heat-2 { background: #b7d3f6; }
.heat-3 { background: #6da7ec; }
.heat-4 { background: #2a78d6; color: #fff; }
.heat-5 { background: #184f95; color: #fff; }

/* Not seen. Deliberately outside the ramp: an absent member has not been found compliant, and
   a pale step would say they had. */
.heat-none { color: var(--muted); background: var(--canvas); }

/* -------------------------------------------------------------- run pick ---- */

/* The tile's two controls. Exactly one is shown, decided by `js` on <html> before first
   paint — see the note in base.html. Neither is hidden with [hidden] or inline styles,
   because this markup is inside the htmx swap target and must be correct the instant it
   lands, with no script having run. */
.run-trigger { display: none; }
.js .run-form { display: none; }
.js .run-trigger { display: inline-flex; }

.run-form { display: flex; gap: 0.4rem; align-items: center; }

.run-form select {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  max-width: 100%;
}

/* Sized to match `.stat b`, so the tile reads as a figure that happens to be clickable
   rather than as a form control dropped into a row of figures.

   It carries its border and its caret at rest, not on hover. The first version showed the
   affordance only once the pointer was already on it, which is the wrong way round: the
   reader has to suspect the date is a control before the page will confirm it. Two of the
   three tiles are plain numbers, so nothing here says "this one is different" unless this
   one says it. The caret sits in its own compartment behind a rule — the shape a select
   has — because a lone glyph beside a large number reads as punctuation. */
.run-trigger {
  align-items: center;
  gap: 0;
  font: inherit;
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  margin-left: -0.45rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}

.run-trigger:hover { border-color: var(--chrome); }
.run-trigger:hover .caret { background: var(--rule); }
.run-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.run-trigger .run-date { padding: 0.1rem 0.5rem 0.1rem 0.45rem; }

.run-trigger .caret {
  display: flex;
  align-items: center;
  align-self: stretch;
  padding: 0 0.5rem;
  font-size: 1.15rem;
  color: var(--ink);
  background: var(--canvas);
  border-left: 1px solid var(--rule-strong);
}

.rp-panel {
  position: absolute;
  z-index: 40;
  width: 268px;
  padding: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgb(0 0 0 / 14%);
}

.rp-head { display: flex; align-items: center; gap: 0.3rem; margin-bottom: 0.45rem; }

.rp-title { flex: 1; text-align: center; font-size: 0.85rem; font-weight: 600; }

.rp-nav {
  font: inherit;
  line-height: 1;
  width: 1.7rem;
  height: 1.7rem;
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.rp-nav:hover:not(:disabled) { background: var(--canvas); }
.rp-nav:disabled { color: var(--rule-strong); cursor: default; }

.rp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.rp-dow {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
  padding-bottom: 0.2rem;
}

.rp-day {
  font: inherit;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  aspect-ratio: 1;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.rp-day:hover:not(:disabled) { background: var(--canvas); border-color: var(--rule-strong); }

/* A day with no run. Flat and unbordered rather than greyed-out-but-boxed: it is not a
   choice that has been temporarily withdrawn, it is a day this service cannot answer for. */
.rp-day:disabled {
  color: #c3c3c3;
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.rp-day.is-selected {
  color: #fff;
  background: #0c0c0c;
  border-color: #0c0c0c;
}

.rp-foot {
  margin: 0.55rem 0 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--muted);
}

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  margin: 0 0 1.25rem;
}

.fgroup { display: flex; flex-direction: column; gap: 0.3rem; }
.fgroup.grow { flex: 1 1 260px; }

.fgroup > span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.filter-options-group { flex-direction: row; gap: 0.5rem; align-items: center; }

.filters input,
.filters select {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  max-width: 100%;
}

.filters input[type="search"] { width: 100%; }

.btn {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.38rem 1rem;
  cursor: pointer;
  border: 1px solid #0c0c0c;
  border-radius: var(--radius);
  background: #0c0c0c;
  color: #fff;
}

.btn:hover { background: #262626; border-color: #262626; }

/* Filter and Reset are one pair. Left to wrap independently they land on separate rows and
   read as two unrelated buttons, so they wrap together or not at all. */
.fgroup.actions { flex-direction: row; flex-wrap: nowrap; gap: 0.5rem; align-items: stretch; margin-top: 1.1rem; }

/* The actions sit hard right, away from the inputs they act on. `margin-left: auto` rather
   than `justify-content` on the bar: the search box already grows to fill, so pushing only
   this group leaves the filters reading left-to-right and the buttons where a reader's eye
   ends up. It collapses to zero when the bar wraps, so on a narrow screen the buttons take
   their own row from the left rather than stranded on the right. */
.fgroup.actions.push-right { margin-left: auto; }
@media (max-width: 760px) {
  .fgroup.actions.push-right { margin-left: 0; }
}
.fgroup.actions .btn { white-space: nowrap; }

/* Category values run to three segments and, given the room Run left behind, the select
   grows to fit the longest of them and pushes the buttons onto a second row. Capped: the
   native dropdown opens at its own width, so nothing is lost by the closed control being
   narrower than its widest option. */
.filters select { max-width: 13rem; }

/* Reset sits beside Filter and must not compete with it: same size and baseline, no fill. */
.btn-quiet {
  display: inline-block;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--rule-strong);
}

.btn-quiet:hover { background: #f2f2f2; }

.btn-subtle {
  display: inline-block;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border-color: var(--rule-strong);
}

.btn-subtle:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--ink);
}

.btn-bad {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.btn-bad:hover {
  background: #c52436;
  border-color: #c52436;
}

.btn-sm { font-size: 0.8rem; padding: 0.3rem 0.7rem; }

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

.tablewrap { overflow-x: auto; }

.rows { border-collapse: collapse; width: 100%; font-size: 0.88rem; }

.rows th,
.rows td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}

.rows thead th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #fbfbfb;
  white-space: nowrap;
}

.rows tbody tr:last-child td { border-bottom: 0; }
.rows tbody tr:hover { background: #fafcfd; }

.rows .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.rows .sku { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
/* The identity column is the way into the product detail page, and it says so at rest.
   The run picker shipped with its affordance on hover only and the client missed the
   control entirely (design §6) — a reader has to suspect a thing is clickable before the
   page will confirm it. A dotted underline is the quiet version of that: enough to mark
   the column as interactive, not so much that the table reads as a page of links, and no
   second glyph competing with the outbound arrow on the title beside it. */
.rows td.sku a {
  color: var(--muted);
  text-decoration: underline dotted var(--rule-strong);
  text-underline-offset: 3px;
}
.rows td.sku a:hover {
  color: var(--ink);
  text-decoration: underline solid currentcolor;
}

/* The product title links out to Google Shopping. Underlined only on hover: 400 underlined
   titles down a page is a wall of blue, and the column is read as data first. */
.rows td.product a { color: var(--ink); text-decoration: none; }
.rows td.product a:hover { text-decoration: underline; }
.rows td.product .ext { color: var(--muted); font-size: 0.75rem; }

/* The offence itself, and the only place red is allowed to carry meaning. */
.rows td.undercut { color: var(--bad); font-weight: 700; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  white-space: nowrap;
  background: var(--bad-bg);
  color: var(--bad);
}

/* The benchmark moved after the run, so the figure recorded then cannot be restated.
   Muted rather than red: it is a caveat about our own data, not a fault of the member. */
.moved { color: var(--muted); font-style: italic; font-weight: 400; }

/* The raw listing-row count on the member table. It runs about a tenth above the pair
   count because the provider returns one offer under several tracking URLs, so it is
   deliberately quieter than the column beside it: present, never the headline. */
.rows td.muted-num { color: var(--muted); }
.rows thead th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* The row expander on the product table, and the sub-table it reveals. The sub-table is
   quieter than its parent throughout: it is detail under a row, not a second dataset. */
.rows th.expander-head, .rows td.expander { width: 2rem; padding-right: 0; }

.expand {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  border-radius: var(--radius);
}
.expand:hover { color: var(--ink); background: var(--canvas); }
.expand[aria-expanded="true"] span[aria-hidden] { display: inline-block; transform: rotate(90deg); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* An opened row and its panel have to read as one object, or the table looks like rows of
   the same weight repeating. Three things do that: the parent row takes a tinted, bottom-
   border-less "open" state so it joins what follows; the panel is inset on the canvas
   ground with a left rule running down it; and the panel carries a caption, so the reader
   lands on a sentence rather than straight into a second grid. */
.rows tbody tr.is-open > td {
  background: #f4f7f9;
  border-bottom-color: transparent;
}
.rows tbody tr.is-open:hover > td { background: #f4f7f9; }
.rows tbody tr.is-open td.expander .expand { color: var(--ink); }

.rows tr.listings-row > td { padding: 0 0 0.75rem; background: #f4f7f9; }
.rows tr.listings-row:hover > td { background: #f4f7f9; }

.listings-panel {
  margin: 0 0.9rem 0 2.6rem;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
  overflow: hidden;
}

.sub-caption {
  margin: 0;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  background: #fbfcfd;
}
.sub-caption strong { color: var(--ink); }

.sub-rows { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.sub-rows th {
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
.sub-rows td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.sub-rows tbody tr:last-child td { border-bottom: 0; }
.sub-rows .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sub-rows td.undercut { color: var(--bad); font-weight: 700; }
.sub-rows .code { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 0.4rem; }

/* The member panel's two product columns, matching the main product table's treatment so
   the same product reads the same way on either page. The catalogue title is clamped for
   the same reason the advertised one is. */
.sub-rows .sku { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }

/* The member panel carries two long title columns where the product panel carries one, and
   left to themselves the pair set the width of the whole sub-table — which then widened the
   member table above it and pushed its last column into a horizontal scroll. 12rem each is
   what makes the panel fit inside the 1200px content width exactly; the full text is on each
   cell's tooltip either way, so nothing is lost but the sprawl. */
.sub-rows td.product {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-rows-products td.advertised { max-width: 12rem; }

.sub-rows td.product a { color: var(--ink); text-decoration: none; }
.sub-rows td.product a:hover { text-decoration: underline; }
.sub-rows td.product .ext { color: var(--muted); font-size: 0.75rem; }

/* The shared-shopfront clause inside the panel's caption. Amber ink, no amber ground: the
   full-width row above is the disclosure, this is the reminder that it applies here too. */
.sub-caveat { color: var(--warn-ink); }

/* The member's own advertised title. Long and unpredictable, so it is clamped rather than
   allowed to set the width of the whole sub-table. */
.sub-rows td.advertised {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* One offer returned under several tracking URLs. Stated, never silently folded away — and
   openable, because a badge that names a thing the reader cannot then look at is what this
   replaced. The pill is now the summary of a `<details>`: same size and colour it had, so
   the cell reads as it did until someone asks. */
.dupe { margin-top: 0.25rem; }

.dupe > summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--rule-strong);
  border-radius: 99px;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
  width: fit-content;
}

.dupe > summary::-webkit-details-marker { display: none; }
.dupe > summary::marker { content: ""; }
.dupe > summary:hover, .dupe > summary:focus-visible { color: var(--ink); }

.dupe-links {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.8rem;
}

/* The explanation the `title=` attribute used to hold — invisible on a printout and on
   touch, which is how it reached us as a question. */
.dupe-note {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 28rem;
}

.sub-empty { padding: 0.75rem; margin: 0; color: var(--muted); font-size: 0.82rem; }

/* Shared shopfront. Two retailers trade under one website each, attribution anchors to
   the lowest customer code, and this row says so under the member it was anchored to.
   Amber rather than red: it is a caveat about whose figures these are, not an offence. */
.rows tr.disclosure td {
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 0.82rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.rows tr.disclosure:hover td { background: var(--warn-bg); }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
}

/* Previous and Next keep the ends, so the numbers between them never shift sideways as the
   reader pages through. */
.pager-step { padding: 0.25rem 0.6rem; border-radius: var(--radius); }
.pager-step.is-disabled { color: var(--muted); opacity: 0.45; }
.pager-step:not(.is-disabled):hover { background: #f2f2f2; }

.pager-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  list-style: none;
  margin: 0 auto;
  padding: 0;
}

.pager-page {
  display: inline-block;
  min-width: 1.9rem;
  padding: 0.25rem 0.4rem;
  text-align: center;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}

.pager-page:hover { background: #f2f2f2; }

/* The current page is not a link, and says so by being filled rather than merely bold —
   bold alone is indistinguishable from a hover on a list of numerals. */
.pager-page.is-current {
  background: #0c0c0c;
  color: #fff;
  font-weight: 600;
}

.pager-gap { color: var(--muted); padding: 0.25rem 0.15rem; }

/* A legend used as a caveat above a table rather than inside a tile. Same disclosure, but
   it needs room beneath it and its summary carries the claim itself, so the claim stays
   readable at full contrast while only the explanation folds away. */
/* The caveat under the member grid.

   Left-aligned, and that is the whole point of the rule. The `<details>` is the box that
   grows when it opens — its width goes from the summary's to the body's, which is far wider
   — so right-aligning it made the box grow leftward and drag the summary line across the
   page on every click. A control that moves when you press it is a control you have to
   re-find. Anchored left, it grows rightward into empty space and the summary does not
   shift by a pixel. */
.caveat-foot {
  margin: 0.6rem 0 1.25rem;
}

.legend-inline { margin: 0; }
.legend-inline > summary { font-size: 0.88rem; }
.legend-inline > summary strong { color: var(--ink); font-weight: 600; }

.empty {
  padding: 1.25rem;
  margin: 0;
  background: var(--surface);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
}

a { color: #1f6ea8; }

/* ------------------------------------------------- product detail + chart ---- */

/* The one page that is a range rather than a run, and the only one that shows a member
   priced correctly. Both differences are made visible rather than left to be inferred. */

.crumb { margin: 0 0 0.75rem; font-size: 0.85rem; }

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.chart-head h2 { margin: 0; font-size: 1rem; }

/* Plain links, styled as a segmented control. A navigation rather than a filter: it needs
   no script, and there is nothing here for an htmx swap to leave half-built. */
.windows { display: flex; gap: 2px; }

.window {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--rule);
}

.window:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.window:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.window:hover { color: var(--ink); border-color: var(--rule-strong); }

.window.is-current {
  color: var(--surface);
  background: var(--chrome);
  border-color: var(--chrome);
}

/* The canvas is shown only to a browser that will draw in it. With no JavaScript a canvas
   is an empty framed box, and one sitting above the table of the same figures reads as a
   chart that failed rather than a page that never offered one. Same before-first-paint
   class the run picker uses, so neither half is ever flashed at the wrong reader. */
.chart-wrap { display: none; position: relative; height: 280px; }
.js .chart-wrap { display: block; }
.js .chart-wrap.is-hidden { display: none; }

/* The same points in words, for a browser that will not run the chart. Hidden only once
   JavaScript has announced itself — the same before-first-paint class the run picker uses,
   so the fallback is never flashed at a reader who is about to get the chart. `is-shown`
   is set by the chart script when Chart.js is missing: the canvas would otherwise be an
   empty box and the only thing the page said. */
.js .chart-fallback { display: none; }
.js .chart-fallback.is-shown { display: block; }
.chart-fallback { margin-top: 0.75rem; border-top: 1px solid var(--rule); }

.chart-caption {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.chart-caption strong { color: var(--ink); }

/* Said in the table as the chart says it with a dash: this benchmark was not recorded by
   the run, it is the product's price now. */
.inferred {
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.3rem;
}

/* A compliant member is not good news to be celebrated in green — it is the expected
   state, and colouring it would put the eye on the rows that need no attention. */
.compliant-num { color: var(--muted); font-weight: 400; }

.tag-bad { background: var(--bad-bg); color: var(--bad); }
.tag-ok { background: #f0f1f4; color: var(--muted); }
.tag-muted { background: var(--canvas); color: var(--muted); border: 1px solid var(--rule); font-weight: 500; }

/* "Matching competitor" (ADR-012): below the agency price but priced with the market, so
   not a breach. Amber, the colour this page already uses for "worth a look, not an offence"
   (the shared-shopfront disclosure) — never the red of `tag-bad`, and never the grey of
   `tag-ok`, which means "at or above the benchmark" and would be untrue here. */
.tag-match { background: var(--warn-bg); color: var(--warn-ink); font-weight: 500; }
/* Competitor names and prices under the status tag, one per line. */
.match-floor { font-size: 0.85em; }
.match-line { display: block; white-space: nowrap; }
.match-toggle { display: block; padding: 0; border: 0; background: none; font: inherit; font-size: 0.85em; color: #1f6ea8; text-decoration: underline; cursor: pointer; }

/* "Not found this run" on the member table's wider view. Deliberately *not* `tag-ok`:
   finding nothing is a gap in our own coverage, and giving it the same pill as a member we
   checked and found compliant would make the page state the one thing it must never state
   — absence as proof of compliance. Outlined rather than filled so it reads as a row
   awaiting an answer rather than a verdict, which is exactly what it is. */
.tag-unknown {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line, #d6d8de);
  font-weight: 400;
}

.sub-caption.padded { padding: 0.7rem 0.9rem; }

/* "Open ↗" is two words the eye reads as one control, and the arrow wrapping onto its own
   line makes the last column look broken. The duplicate-URL badge below it may wrap. */
.rows td.listing-cell a { white-space: nowrap; }

/* --------------------------------------------------------------- sign-in ---- */

/* The one page that wears the brand: full-bleed red, the mark, and nothing else to look
   at. It is also the first thing the client sees at UAT. */

body.signin-page {
  background: var(--brand);
  color: var(--brand-ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.signin-page main { flex: 1; display: grid; place-items: center; padding: 2rem 1.25rem; }

/* A white card on the brand-red field.
 *
 * The page used to put the form straight onto the red, which worked while the wordmark was
 * drawn inline in white. The client's own asset is brand red on white — on the red field its
 * tick all but disappears, and recolouring somebody's logo to fit our background is not ours
 * to do. So the card gives the logo the surface it was drawn for, and the red stays as the
 * field around it. */
.signin {
  width: 100%;
  max-width: 21rem;
  background: var(--surface);
  color: var(--ink);
  padding: 2.25rem 2rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgb(0 0 0 / 18%);
}

.signin .brand {
  justify-content: center;
  font-size: 1.9rem;
  margin-bottom: 1.75rem;
}

/* Larger on the sign-in page, where the mark is the only thing on screen above the form. */
.signin .brand .mark { height: 34px; width: auto; }

.signin label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

/* On white now, so the field needs an edge of its own — borderless only read as a field
   while the surround was red. */
.signin input {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.signin input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.signin p { margin: 0 0 1.15rem; }

.signin .btn {
  display: block;
  width: 60%;
  margin: 1.75rem auto 0;
  padding: 0.55rem 1rem;
}

.signin .note { margin-top: 1.75rem; text-align: center; }

.signin .helptext,
.signin .note { color: var(--muted); font-size: 0.8rem; }

/* The one place `--bad` is furniture rather than data, and it earns it: a failed sign-in is
   a state, not a measurement, and it is the only red on a card that has no figures on it. */
.signin .error {
  color: var(--bad);
  background: var(--bad-bg);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.signin-foot {
  padding: 1rem 1.25rem;
  font-size: 0.78rem;
  color: rgb(255 255 255 / 75%);
}

/* The sign-in screen shows the mark and nothing else, as the product's does — but a page
   with no heading is a page a screen reader cannot announce. */
.visually-hidden-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- review queue ------------------------------------------------------------------- */

.review-counts { margin: 0 0 0.9rem; color: var(--muted); }
.review-why { display: block; margin-top: 0.15rem; }

/* Warn colours, not the data reds: this is furniture, and --bad is reserved for figures. */
.review-error {
  margin: 0 0 0.9rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--warn-ink);
  color: var(--warn-ink);
  background: var(--warn-bg);
}

.review-table .seller { font-weight: 600; }
.review-table .reason { color: var(--muted); }
.review-table .nowrap { white-space: nowrap; }

/* The queue is scanned across rather than down — seller, website, the member you are about
   to name — so the columns need more air between them than a table of figures does. */
.review-table th,
.review-table td {
  padding: 0.75rem 1.1rem;
  vertical-align: top;
}

/* Align text-only cells with the visual baseline of the input box and buttons.
   An input has 1px border and 0.35rem padding, so plain text starting at the cell top
   would otherwise sit ~5px higher than the text inside the input box. */
.review-table td.seller,
.review-table td.nowrap,
.review-table td.website-cell,
.review-table td.decision-cell,
.review-table td.member-cell,
.review-table td.who-cell {
  padding-top: calc(0.75rem + 5px);
}

.review-table .code {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: 0.4rem;
  font-size: 0.82rem;
}

.review-table .attribute-cell {
  vertical-align: top;
}

.review-table .attribute-cell input {
  min-width: 15rem;
  width: 100%;
  max-width: 22rem;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  vertical-align: top;
}

/* Where the value in the box came from. Not decoration: a website match is strong, and a
   name match was wrong five times in nineteen on a real day's queue — which is the whole
   safeguard now that the control is pre-filled. */
.basis {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* The weak kind, marked by shape rather than colour: this palette reserves colour for data,
   and a red badge on a third of the rows stops being read by the second morning. */
.basis-name { font-style: italic; }

.review-table .website-cell { font-size: 0.85rem; }
/* Two addresses in one field is five members out of 202; when neither matched the seller
   both are offered, stacked, rather than one being picked. */
.review-table .website-cell a { display: block; }
.review-table .website-cell a + a { margin-top: 0.25rem; }

/* Action buttons stay flush top to align with the input box, and align to the right of the cell.
   Standard table cell layout preserves column widths and borders without flexbox anomalies. */
.review-table td.row-actions {
  text-align: right;
  white-space: nowrap;
  vertical-align: top;
  width: 1%;
}

.review-table .row-actions form {
  display: inline-block;
  vertical-align: top;
  margin: 0;
}

.review-table .row-actions form + form {
  margin-left: 0.5rem;
}

.review-table .row-actions .btn {
  vertical-align: top;
}

.review-table .row-actions .revert-reason {
  display: inline-block;
  padding-top: 5px;
  font-size: 0.8rem;
}

.review-table .row-actions-head {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.review-heading { margin: 1.4rem 0 0.2rem; font-size: 1.05rem; }
.review-note { display: block; font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.review-rest { margin-top: 1.4rem; }
.review-rest > summary { cursor: pointer; padding: 0.6rem 0; font-weight: 600; }
/* The decided list mirrors the queue's columns, so a reader who has learned one has learned
   the other. */
.review-decided .website-cell a { display: block; }

/* --- product match review / exclusion popover ---------------------------------------- */

.rows th.row-actions-head,
.rows td.row-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.exclude-dropdown {
  position: relative;
  display: inline-block;
}

.exclude-dropdown > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.exclude-dropdown > summary::-webkit-details-marker { display: none; }
.exclude-dropdown > summary::marker { content: ""; }

.exclude-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 0.85rem;
  text-align: left;
  white-space: normal;
}

.exclude-popover .popover-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.exclude-popover select {
  width: 100%;
  font-size: 0.82rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  margin-bottom: 0.65rem;
}

.exclude-popover .popover-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 0.75rem;
}

.exclude-popover .popover-checkbox input {
  margin: 0;
  cursor: pointer;
}

.exclude-popover .popover-actions {
  display: flex;
  justify-content: flex-end;
}

/* Excluded listings section at bottom of product listings card */
.excluded-section {
  border-top: 1px solid var(--rule);
  padding: 0.75rem 1rem;
  background: var(--canvas);
}

.excluded-section details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.excluded-section details > summary:hover {
  color: var(--ink);
}

/* ------------------------------------------------ competitor prices card ---- */

.competitor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.competitor-head-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.competitor-head-title h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.competitor-count {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--rule);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  line-height: 1.3;
}

.competitor-head-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.competitor-table .competitor-cell {
  font-weight: 500;
  color: var(--ink);
}

.competitor-table .competitor-price {
  font-weight: 600;
}

.competitor-table .competitor-diff {
  font-variant-numeric: tabular-nums;
}

.competitor-table .competitor-avail {
  color: var(--muted);
  text-transform: capitalize;
}

.competitor-empty {
  padding: 1rem 1.1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* The busy state while a filter, sort or page swaps the products or members table
   (js/loading.js). The old rows stay in place, dimmed, so the reader keeps their bearings;
   blanking them would read as "no results". The label is shown as text as well as the spinner,
   so reduced motion loses only the animation, not the message. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#product-rows,
#member-rows {
  position: relative;
}

#product-rows[aria-busy="true"] > *,
#member-rows[aria-busy="true"] > * {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.15s ease-in;
}

#product-rows[aria-busy="true"]::before,
#member-rows[aria-busy="true"]::before {
  content: "Loading…";
  position: absolute;
  z-index: 2;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: 9.75rem;
  padding: 0.6rem 1.15rem 0.6rem 2.85rem;
  line-height: 1.2;
  /* Accent blue, not red: red in this product means "undercut", and a red pill over the
     table would read as a finding. The text stays ink — the accent is under 3:1 on white. */
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 600;
}

#product-rows[aria-busy="true"]::after,
#member-rows[aria-busy="true"]::after {
  content: "";
  position: absolute;
  z-index: 3;
  /* Inside the pill's left padding. The pill has a fixed width so this offset is exact:
     half the pill (4.875rem) back from the centre, then into the padding. Vertically, the
     pill is 2 x 0.6rem padding + 1.32rem of text + 2px of border; the ring is centred on it. */
  top: calc(1.5rem + 0.66rem + 1px);
  left: calc(50% - 4.875rem + 1rem);
  box-sizing: border-box;
  width: 1.2rem;
  height: 1.2rem;
  border: 3px solid var(--accent-ring);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rows-spin 0.7s linear infinite;
}

@keyframes rows-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  #product-rows[aria-busy="true"]::after,
  #member-rows[aria-busy="true"]::after {
    animation: none;
  }
}

/* A link to the member's page as seen on another day, for a listing whose own link never
   arrived (backfill_name_attribution). Quieter than "Open" and italic, so it never reads as
   the link this price was read from. */
a.last-known {
  color: var(--muted);
  font-style: italic;
  font-size: 0.85em;
}
