/* Atlas Order Recovery — see DESIGN.md for the reasoning behind these tokens.
   Register: product. Restrained colour, one type family, fixed rem scale. */

:root {
  /* Surfaces. --chrome is deliberately DARKER than --bg: the app bar and
     toolbars read as a frame around the content, not as raised cards. */
  --bg:        oklch(.165 .006 265);
  --chrome:    oklch(.132 .006 265);
  --surface:   oklch(.212 .007 265);
  --surface-2: oklch(.258 .008 265);
  --line:      oklch(.305 .009 265);
  --line-soft: oklch(.255 .008 265);

  /* Ink. Every value below is AA against --bg and --surface at its size;
     --ink-faint is the floor and is only used for labels. */
  --ink:       oklch(.955 .004 265);
  --ink-dim:   oklch(.745 .012 265);
  --ink-faint: oklch(.660 .012 265);

  /* The accent does three jobs: primary action, current nav, focus ring.
     Semantic hues own everything that reports state, so they never compete. */
  --accent:      oklch(.680 .150 258);
  --accent-soft: oklch(.680 .150 258 / .16);
  --on-accent:   oklch(.155 .020 258);

  --ok:   oklch(.740 .150 155);
  --warn: oklch(.800 .140 82);
  --bad:  oklch(.705 .175 25);

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 14px;
  --r-pill: 999px;

  --shadow: 0 1px 2px oklch(0 0 0 / .35), 0 8px 24px -12px oklch(0 0 0 / .6);

  --ease: cubic-bezier(.22, 1, .36, 1);   /* ease-out-quart */
  --fast: 140ms;
  --slow: 220ms;

  --z-sticky: 10;
  --z-appbar: 20;
  --z-toast:  40;

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

  --shell: 1400px;
}

/* ---------------------------------------------------------------- reset */

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

/* The UA sheet gives [hidden] `display: none`, which any later `display:` rule
   silently beats — and several here set `display: flex`. That is how the bulk
   bar came to sit on the Missing list announcing "0 selected" whether or not
   anything was. Everything that toggles visibility from JS depends on this. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.55 var(--ui);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;              /* the document never scrolls sideways */
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.mono, code, pre { font-family: var(--mono); }
.num, td.num, .mono { font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: 8px; top: -60px;
  background: var(--accent); color: var(--on-accent);
  padding: 9px 14px; border-radius: var(--r); font-weight: 600;
  z-index: var(--z-toast); transition: top var(--fast) var(--ease);
}
.skip:focus { top: 8px; text-decoration: none; }

/* ------------------------------------------------------------- app bar */

.appbar {
  position: sticky; top: 0; z-index: var(--z-appbar);
  background: var(--chrome);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; min-height: 52px; flex-wrap: wrap;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--ink); font-weight: 600; font-size: 14px;
  letter-spacing: -.01em; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 22px; height: 22px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  font: 700 11px/1 var(--ui); letter-spacing: -.02em;
}

.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a {
  color: var(--ink-dim); padding: 6px 11px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

.appbar .side {
  margin-left: auto; display: flex; align-items: center; gap: 12px;
  color: var(--ink-dim); font-size: 13px;
}
.who { display: flex; align-items: baseline; gap: 6px; }
.who b { color: var(--ink); font-weight: 600; }

/* A tiny always-visible chip for the two facts that change what a click
   does: the replay mode, and whether a run is in flight. */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-dim); white-space: nowrap;
}
.chip .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  flex: none;
}
.chip b { color: var(--ink); font-weight: 600; }
.chip.live { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 35%, var(--line)); }
.chip.live .dot { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .25; } }

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

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 20px; }

.pagehead {
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(var(--chrome), var(--bg));
}
.pagehead .shell {
  display: flex; align-items: flex-end; gap: 12px 24px;
  flex-wrap: wrap; padding-top: 13px; padding-bottom: 12px;
}
.pagehead .titles { min-width: 0; flex: 1 1 380px; }
.pagehead h1 {
  font-size: 19px; font-weight: 620; letter-spacing: -.02em;
  line-height: 1.2; text-wrap: balance;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pagehead h1 .mono { font-size: 17px; letter-spacing: -.01em; }
.pagehead p {
  color: var(--ink-dim); margin-top: 2px; max-width: 78ch;
  font-size: 12.5px; line-height: 1.45; text-wrap: pretty;
}
.pagehead .actions {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
}
.pagehead .actions form { display: flex; gap: 8px; align-items: flex-end; }
.pagehead .actions label { margin-bottom: 4px; }
.pagehead .actions .hours { width: 92px; }
.crumb {
  display: inline-block; margin-bottom: 8px; font-size: 12.5px;
  color: var(--ink-dim);
}
.crumb:hover { color: var(--ink); }

main { padding: 14px 0 56px; }

/* ---------------------------------------------------------------- panel */

.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
}
.panel > header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line-soft);
}
.panel > header h2 {
  font-size: 13.5px; font-weight: 600; letter-spacing: -.005em;
}
.panel > header .meta { margin-left: auto; color: var(--ink-dim); font-size: 12.5px; }
.panel .body { padding: 14px 16px; }
.panel .body > * + * { margin-top: 14px; }
.panel .note { color: var(--ink-dim); font-size: 13px; text-wrap: pretty; }

/* min-width:0 is load-bearing: a grid track defaults to min-content, so the
   680px-min table inside a panel would otherwise blow the column out and push
   the whole page sideways on a phone. */
.split { display: grid; gap: 18px; align-items: start; }
.split > * { min-width: 0; }
@media (min-width: 1040px) {
  .split { grid-template-columns: minmax(0, 1fr) 340px; }
  .split .rail { position: sticky; top: 72px; }
}

/* ------------------------------------------------------- definition grid */

.facts {
  display: grid; gap: 14px 22px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.facts > div { min-width: 0; }
/* The rail is 340px: without a smaller floor the facts stack one per row and
   push everything below it off the fold. */
.rail .facts { grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); }
/* Timestamps are 19 mono characters and will not fit half a rail. */
.facts > div.wide { grid-column: 1 / -1; }
.facts dt, .lbl {
  font-size: 11.5px; font-weight: 600; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px;
}
.facts dd { font-size: 14px; overflow-wrap: anywhere; }
.facts dd.big { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }

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

.stats {
  display: grid; gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--r);
  overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}
.stat { background: var(--surface); padding: 10px 14px; }
.stat .n {
  font: 600 21px/1.15 var(--ui); letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat .l {
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 2px;
}
.stat.is-ok   .n { color: var(--ok); }
.stat.is-warn .n { color: var(--warn); }
.stat.is-bad  .n { color: var(--bad); }
.stat.is-zero .n { color: var(--ink-faint); }   /* nothing wrong reads quiet */

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

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-dim);
  border: 1px solid transparent;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.badge.lg { font-size: 13px; padding: 5px 13px 5px 10px; }

.b-in_odoo, .b-recovered, .b-info, .b-ok {
  color: var(--ok); background: color-mix(in oklab, var(--ok) 15%, var(--surface));
  border-color: color-mix(in oklab, var(--ok) 28%, transparent);
}
.b-known_log, .b-missing, .b-warn {
  color: var(--warn); background: color-mix(in oklab, var(--warn) 15%, var(--surface));
  border-color: color-mix(in oklab, var(--warn) 28%, transparent);
}
.b-no_payload, .b-failed, .b-error, .b-bad {
  color: var(--bad); background: color-mix(in oklab, var(--bad) 15%, var(--surface));
  border-color: color-mix(in oklab, var(--bad) 28%, transparent);
}
/* Batch stages, and the row state that means "we have not looked yet". Muted
   on purpose: an uncompared row is an absence of knowledge, not a warning. */
.b-not_compared, .b-draft, .b-fetched, .b-compared, .b-done,
.b-fetching, .b-comparing, .b-recovering {
  color: var(--ink-dim); background: var(--surface-2);
  border-color: var(--line);
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--r-sm); border: 1px solid transparent;
  font: 600 13.5px/1.35 var(--ui); cursor: pointer; white-space: nowrap;
  background: var(--accent); color: var(--on-accent);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              color var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.btn:hover { background: color-mix(in oklab, var(--accent) 88%, white); text-decoration: none; }
.btn:active { background: color-mix(in oklab, var(--accent) 88%, black); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--accent); }

.btn.ghost {
  background: transparent; color: var(--ink); border-color: var(--line);
}
.btn.ghost:hover { background: var(--surface-2); border-color: var(--ink-faint); }

.btn.quiet {
  background: transparent; color: var(--ink-dim); border-color: transparent;
  padding: 5px 9px; font-size: 12.5px;
}
.btn.quiet:hover { background: var(--surface-2); color: var(--ink); }

.btn.danger { background: var(--bad); color: var(--on-accent); }
.btn.danger:hover { background: color-mix(in oklab, var(--bad) 88%, white); }

.btn.sm { padding: 5px 11px; font-size: 12.5px; }

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

label, .lbl { display: block; }
label {
  font-size: 11.5px; font-weight: 600; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px;
}
input, select {
  width: 100%; padding: 8px 11px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); font: 400 13.5px/1.45 var(--ui);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
input::placeholder { color: var(--ink-faint); }
input:hover, select:hover { border-color: var(--ink-faint); }
input:focus, select:focus { border-color: var(--accent); outline-offset: 1px; }
input[type="date"], input[type="datetime-local"], input[type="number"] {
  font-family: var(--mono); font-size: 13px;
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%),
                    linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.fields {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}
.fields > div { min-width: 0; }
.fields > div.wide { grid-column: 1 / -1; }

/* The filter bar reads as one control, not six loose inputs. */
.toolbar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  background: var(--chrome);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.toolbar > div { flex: 1 1 145px; min-width: 0; }
.toolbar > .act { flex: 0 0 auto; }

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

/* The wrapper is the scroll container, which is what makes `thead` sticky do
   anything — a bare overflow-x box has nothing to scroll vertically against. */
.tablewrap { overflow: auto; overscroll-behavior: contain; }
@media (min-width: 721px) { .tablewrap { max-height: 72vh; } }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
thead th {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--surface-2); color: var(--ink-dim);
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; white-space: nowrap;
  text-align: left; padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
tbody tr { transition: background var(--fast) var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
/* Timestamps and ids are meaningless once they wrap; the wrapper scrolls. */
td.mono, th.mono {
  font-family: var(--mono); font-size: 12.5px; white-space: nowrap;
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.detail { color: var(--ink-dim); font-size: 13px; max-width: 44ch; }
.panel > .tablewrap:last-child table tbody tr:last-child td { border-bottom: 0; }

.foot {
  padding: 11px 18px; border-top: 1px solid var(--line-soft);
  color: var(--ink-dim); font-size: 12.5px;
}

/* A paused schedule is still worth reading, just not worth looking at. */
tbody tr.off td { color: var(--ink-faint); }
tbody tr.off b { font-weight: 500; }

.empty {
  padding: 40px 18px; text-align: center; color: var(--ink-dim);
}
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 5px; }
.empty p { max-width: 46ch; margin: 0 auto 14px; text-wrap: pretty; }

/* ---------------------------------------------------------------- flash */

.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 15px; border-radius: var(--r); margin-bottom: 16px;
  background: color-mix(in oklab, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent);
  color: var(--ink);
}

/* ---------------------------------------------------------------- steps */

.steps {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
  list-style: none; padding: 0;
}
.steps > * {
  padding: 3px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line); color: var(--ink-dim); font-size: 12px;
  font-weight: 500;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.steps > .on {
  background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 40%, transparent);
  color: var(--accent);
}

.presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.presets .lbl { margin: 0 4px 0 0; }
.presets .btn[aria-pressed="true"] {
  background: var(--accent-soft); color: var(--accent);
}

/* ------------------------------------------------------- webhook viewer */

.deliveries { display: flex; flex-direction: column; }
.deliveries > * + * { border-top: 1px solid var(--line-soft); }

details.delivery > summary {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; cursor: pointer; list-style: none;
  transition: background var(--fast) var(--ease);
}
details.delivery > summary::-webkit-details-marker { display: none; }
details.delivery > summary:hover { background: var(--surface-2); }
details.delivery[open] > summary { background: var(--surface-2); }
summary .caret {
  flex: none; color: var(--ink-faint); font-size: 10px;
  transition: transform var(--fast) var(--ease);
}
details.delivery[open] summary .caret { transform: rotate(90deg); }
summary .event { font-weight: 600; font-size: 13.5px; }
summary .url {
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1 1 200px; min-width: 0;
}
summary .when {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.status {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-sm); flex: none;
  background: var(--surface-2); color: var(--ink-dim);
}
.status.ok  { color: var(--ok);   background: color-mix(in oklab, var(--ok) 15%, var(--surface)); }
.status.bad { color: var(--bad);  background: color-mix(in oklab, var(--bad) 15%, var(--surface)); }

.delivery .detail-body { padding: 0 18px 18px; }
.jsonhead {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 7px;
}
.jsonhead .lbl { margin: 0; }
.jsonhead .act { margin-left: auto; }

pre.json {
  margin: 0; padding: 14px 16px; max-height: 460px;
  overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--r);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  tab-size: 2; white-space: pre; color: var(--ink-dim);
}
pre.json .k { color: var(--ink); }              /* keys stay brightest */
pre.json .s { color: var(--ok); }
pre.json .n { color: var(--accent); }
pre.json .b { color: var(--warn); }             /* true / false / null */
pre.json .p { color: var(--ink-faint); }        /* punctuation */

.skeleton {
  height: 13px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%,
              var(--line) 50%, var(--surface-2) 75%);
  background-size: 280px 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton + .skeleton { margin-top: 10px; }
@keyframes shimmer { to { background-position: -280px 0; } }

.inline-error {
  padding: 14px 18px; color: var(--bad); font-size: 13px;
  background: color-mix(in oklab, var(--bad) 9%, var(--surface));
}
.inline-error a { color: var(--bad); text-decoration: underline; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 720px) {
  .appbar { padding: 10px 14px; min-height: 0; row-gap: 8px; }
  .appbar .side { margin-left: 0; width: 100%; order: 3; }
  .nav { order: 4; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .shell { padding: 0 14px; }
  .pagehead .shell { padding-top: 18px; padding-bottom: 16px; }
  .pagehead h1 { font-size: 20px; }
  .pagehead .actions { width: 100%; }
  .pagehead .actions .btn { flex: 1 1 auto; }
  .panel .body, .toolbar { padding: 14px; }
  details.delivery > summary { padding: 12px 14px; }
  .delivery .detail-body { padding: 0 14px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------ bulk selection */

.bulkbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--accent-soft);
  border-bottom: 1px solid color-mix(in oklab, var(--accent) 30%, transparent);
  font-size: 13px;
}
.bulkbar b { font-variant-numeric: tabular-nums; }
.bulkbar .warn-note { color: var(--warn); font-size: 12.5px; }
td.pick, th.pick { width: 34px; padding-right: 0; }
td.pick input, th.pick input {
  width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer;
}
tbody tr:has(.pick input:checked) { background: var(--accent-soft); }

/* ------------------------------------------------------- live tailing */

/* A run is minutes of network waiting. These two surfaces exist so that time
   reads as progress rather than as a hang. */

.tailbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--ink-dim);
}
.tail-state::before {
  content: ""; display: inline-block; vertical-align: middle;
  width: 7px; height: 7px; margin-right: 8px; border-radius: 50%;
  background: var(--ink-faint);
}
.tail-state.is-live { color: var(--ink); }
.tail-state.is-live::before {
  background: var(--warn);
  animation: pulse 1.8s ease-in-out infinite;
}
.tail-state.is-lost::before { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }
/* This is a control, not a field label — the global uppercase/tracked label
   style is for the things above inputs, and it wraps this one onto two lines. */
.tail-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  margin: 0; color: var(--ink-dim); white-space: nowrap;
  font: 400 12.5px/1 var(--ui); text-transform: none; letter-spacing: 0;
}
.tail-toggle input {
  width: auto; margin: 0; accent-color: var(--accent); cursor: pointer;
}

/* Newest first, matching the table under it and the wizard's own reading
   order. Monospace because most of these lines are counts. */
.ticker {
  list-style: none; margin: 0; padding: 4px 18px 16px;
  font-size: 12.5px; font-family: var(--mono, ui-monospace, monospace);
}
.ticker li {
  padding: 5px 0 5px 16px; position: relative; color: var(--ink-dim);
  border-top: 1px solid var(--line-soft);
  animation: tick-in 240ms cubic-bezier(.16, 1, .3, 1);
}
.ticker li:first-child { color: var(--ink); border-top: 0; }
.ticker li::before {
  content: ""; position: absolute; left: 0; top: 12px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--ok);
}
.ticker li.tick-bad::before { background: var(--bad); }
@keyframes tick-in { from { opacity: 0; transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  .ticker li { animation: none; }
}

/* A number nobody can calibrate is a number nobody should be asked to set.
   These carry the measurement that produced the default. */
.hint {
  margin: 6px 0 0; font-size: 11.5px; line-height: 1.5;
  color: var(--ink-faint); text-transform: none; letter-spacing: 0;
  font-weight: 400;
}

/* -------------------------------------------------- staged wizard actions */

/* Three buttons that differ in consequence, not just in label. The third one
   writes to Odoo, so it does not look like the other two. */
.choices { display: grid; gap: 8px; }
@media (min-width: 820px) {
  .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.choice {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink); cursor: pointer; font: inherit;
  transition: border-color var(--fast) var(--ease),
              background var(--fast) var(--ease), opacity var(--fast);
}
.choice:hover:not(:disabled) { border-color: var(--accent); background: var(--surface); }
.choice b { font-size: 12.5px; font-weight: 600; }
.choice span { font-size: 11.5px; color: var(--ink-faint); text-wrap: pretty; }
/* Disabled while a batch works: starting a second search would leave the
   first running unwatched. */
.choice:disabled { opacity: .42; cursor: not-allowed; }
.choice.writes {
  border-color: color-mix(in oklab, var(--warn) 40%, var(--line));
  background: color-mix(in oklab, var(--warn) 7%, var(--surface-2));
}
.choice.writes:hover { border-color: var(--warn); }
.choice.writes b::after {
  content: "writes"; float: right;
  font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--warn);
}

.groupby { border-bottom: 1px solid var(--line-soft); }
.groupby > summary {
  padding: 10px 18px; cursor: pointer; font-size: 12.5px;
  color: var(--ink-dim); list-style: none;
}
.groupby > summary::before { content: "▸ "; }
.groupby[open] > summary::before { content: "▾ "; }
.groups {
  display: grid; gap: 18px; padding: 0 18px 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.groups h4 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-faint); margin-bottom: 7px;
}
.groups ul { list-style: none; padding: 0; font-size: 12.5px; }
.groups li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 3px 0; border-bottom: 1px solid var(--line-soft);
}
.groups li b { font-variant-numeric: tabular-nums; color: var(--ink-dim); }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px 18px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--ink-dim);
}

/* ------------------------------------------------ collapsible criteria */

.crit > summary {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; cursor: pointer; list-style: none;
  border-bottom: 1px solid var(--line-soft);
}
.crit > summary::-webkit-details-marker { display: none; }
.crit > summary::before {
  content: "▸"; color: var(--ink-faint); font-size: 11px;
}
.crit[open] > summary::before { content: "▾"; }
.crit > summary h2 {
  display: inline; font-size: 13.5px; font-weight: 600;
}
.crit .digest {
  color: var(--ink-dim); font-size: 12.5px; font-variant-numeric: tabular-nums;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crit > summary .meta { margin-left: auto; color: var(--ink-faint); font-size: 12px; }

/* ---------------------------------------------------- running indicator */

/* Visible from across a desk. "Stage: fetching" in grey meta text was not an
   indicator; an operator could not tell a working batch from a finished one. */
.runflag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  background: color-mix(in oklab, var(--warn) 14%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--warn) 38%, transparent);
  color: var(--warn); font-size: 11.5px; font-weight: 600;
}
.runflag .spin {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--warn) 30%, transparent);
  border-top-color: var(--warn);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  margin-top: 12px; font-family: var(--mono); font-size: 12px;
  color: var(--ink-dim);
}

@media (prefers-reduced-motion: reduce) {
  .runflag .spin { animation: none; border-top-color: transparent;
                   background: var(--warn); }
}

/* --------------------------------------------------------- sortable list */

th.sortable { padding: 0; }
th.sortable a {
  display: flex; align-items: center; gap: 5px;
  padding: 10px 14px; color: inherit; font: inherit;
}
th.sortable a:hover { color: var(--ink); text-decoration: none; }
th.sortable.on a { color: var(--ink); }
th.sortable .arrow { color: var(--accent); font-size: 10px; }
/* Reserve the arrow's width so the header does not jump when sort changes. */
th.sortable .arrow::after { content: ""; display: inline-block; width: 0; }

/* A state badge doubles as a filter — the select above does the same job, but
   the badge is where the eye already is. */
a.badge:hover { text-decoration: none; filter: brightness(1.25); }

/* The progress log is what you want while a batch works and noise once it is
   done, so it folds. Open while working, shut afterwards. */
.tickerwrap { border-top: 1px solid var(--line-soft); }
.tickerwrap > summary {
  padding: 9px 16px; cursor: pointer; list-style: none;
  font-size: 12px; color: var(--ink-dim);
}
.tickerwrap > summary::-webkit-details-marker { display: none; }
.tickerwrap > summary::before { content: "▸ "; }
.tickerwrap[open] > summary::before { content: "▾ "; }
.tickerwrap .ticker { padding-top: 0; }
