/*
 * cc-remora. Components only; every colour, size and space comes from tokens.css.
 * Rules of the system are written down in docs/design.md.
 */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  -webkit-text-size-adjust: 100%;
}
.scroll { scrollbar-color: var(--scroll-thumb) transparent; scrollbar-width: thin; }
@supports not (scrollbar-color: auto) {
  .scroll { scrollbar-width: auto; }
  ::-webkit-scrollbar { width: 12px; height: 12px; }
  .scroll::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 6px; border: 2px solid var(--scroll-track); }
  ::-webkit-scrollbar-track { background: var(--scroll-track); }
  .scroll::-webkit-scrollbar-thumb { border: 0; }
  .scroll::-webkit-scrollbar-track { background: transparent; }
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font: 400 var(--t-md)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1 { font-size: var(--t-xl); line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: var(--t-md); line-height: 1.3; font-weight: 600; }
h3 { font-size: var(--t-sm); line-height: 1.3; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--s-value) 30%, transparent); }
.ico { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }
a > .ico { margin-left: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); } .out { color: var(--out); }

/* --- the container: one width, one gutter, shared by the bar and the page -------- */
.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
main.wrap { padding-block: var(--s6) var(--s9); }
main:focus { outline: none; }

.skip { position: absolute; left: var(--gutter); top: -60px; z-index: 30; background: var(--surface); color: var(--ink); padding: var(--s2) var(--s3); border-radius: var(--r-ctl); border: 1px solid var(--line-strong); }
.skip:focus { top: var(--s2); }

/* --- top bar: a real full-width element with the container inside ----------------- */
.bar { background: var(--bar); color: var(--bar-ink); border-bottom: 1px solid var(--bar-line); position: sticky; top: 0; z-index: 20; }
.bar-row { display: flex; align-items: center; gap: var(--s6); min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: var(--s2); color: var(--bar-ink); font-weight: 600; font-size: var(--t-lg); letter-spacing: -.01em; flex: none; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; display: block; }
.nav { display: flex; gap: 2px; align-self: stretch; min-width: 0; }
.nav a { display: inline-flex; align-items: center; padding-inline: var(--s3); color: var(--bar-muted); font-weight: 500; white-space: nowrap; position: relative; }
.nav a:hover { color: var(--bar-ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--bar-ink); }
.nav a[aria-current="page"]::after { content: ''; position: absolute; inset: auto var(--s3) 0; height: 2px; background: var(--bar-accent); border-radius: 2px 2px 0 0; }
.nav a:focus-visible { outline-color: var(--bar-accent); outline-offset: -4px; }
.bar-status { margin-left: auto; display: flex; align-items: center; gap: var(--s3); flex: none; }
.feed { display: inline-flex; align-items: center; gap: var(--s2); color: var(--bar-muted); font-size: var(--t-sm); white-space: nowrap; }
.feed b { color: var(--bar-ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s-quiet); flex: none; }
.dot.up { background: var(--mark-good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mark-good) 22%, transparent); }
.dot.down { background: var(--mark-bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mark-bad) 22%, transparent); }
.dot.stale { background: var(--mark-warn); }
.mode-slot { display: inline-flex; gap: var(--s2); }
.bar .chip { --chip-ink: var(--bar-ink); --chip-bg: var(--bar-hover); border-color: var(--bar-line); }
.bar .chip.mode-dry-run { --chip-ink: var(--bar-accent); --chip-bg: #14294a; border-color: #23426f; }
.bar .chip.mode-live { --chip-ink: #fff; --chip-bg: var(--live); border-color: var(--live); }
.bar .chip.paused { --chip-ink: var(--mark-warn); --chip-bg: #2e2a1c; border-color: #57491f; }
.bar .chip:hover { text-decoration: none; filter: brightness(1.12); }
.bar .icon-btn { color: var(--bar-muted); border-color: transparent; background: transparent; }
.bar .icon-btn:hover { color: var(--bar-ink); background: var(--bar-hover); border-color: transparent; }
.bar :focus-visible { outline-color: var(--bar-accent); }
@media (max-width: 1020px) {
  .bar-row { flex-wrap: wrap; gap: 0 var(--s4); }
  .nav { order: 3; flex: 0 0 100%; overflow-x: auto; margin-inline: calc(var(--s3) * -1); min-height: 44px; border-top: 1px solid var(--bar-line); scrollbar-width: none; }
  .feed .feed-text { display: none; }
}

/* --- page head: title on the left, what scopes the page on the right -------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s5); }
.page-head .lead { color: var(--muted); margin-top: 2px; max-width: 72ch; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: var(--s1); color: var(--muted); font-size: var(--t-sm); margin-bottom: var(--s1); }
.crumb svg { width: 14px; height: 14px; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }

/* A heading between groups of cards on one page. */
.section-head { margin-top: var(--s5); display: grid; gap: 2px; }
.section-head h2 { font-size: var(--t-lg); }

/* --- layout grids ------------------------------------------------------------- */
.stack { display: grid; gap: var(--s4); min-width: 0; align-content: start; }
.stack > * { min-width: 0; }
.grid { display: grid; gap: var(--s4); }
.grid > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split-main { grid-template-columns: minmax(0, 1fr) 360px; }
.split-side { grid-template-columns: 400px minmax(0, 1fr); }
.calc { align-items: start; gap: var(--s5); }
.form-grid.calc-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
@media (max-width: 520px) { .form-grid.calc-inputs { grid-template-columns: minmax(0, 1fr); } }
.calc-table { margin-top: var(--s4); border-top: 1px solid var(--line); margin-inline: calc(var(--s5) * -1); margin-bottom: calc(var(--s5) * -1); }
@media (max-width: 1100px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split-main, .split-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); } }

/* --- cards --------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: 0 1px 2px var(--shadow), inset 0 1px 0 var(--edge); display: flex; flex-direction: column; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s4) var(--s5) 0; }
.card-head .sub { color: var(--muted); font-size: var(--t-sm); font-weight: 400; margin-top: 1px; }
.card-head .actions { display: flex; align-items: center; gap: var(--s2); }
.card-body { padding: var(--s4) var(--s5) var(--s5); min-width: 0; }
.card-body.flush { padding: var(--s3) 0 0; }
.card-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); color: var(--muted); font-size: var(--t-sm); }
.well { background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s3) var(--s4); }

/* --- figures ------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); }
.kpi { padding: var(--s4) var(--s5); display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s3); align-items: end; }
.kpi .label { grid-column: 1 / -1; color: var(--muted); font-size: var(--t-sm); }
.kpi .value { font-size: var(--t-2xl); line-height: 1.15; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.kpi .value small { font-size: .6em; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.kpi .spark { width: 84px; height: 30px; align-self: center; }
.kpi .delta { grid-column: 1 / -1; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: var(--t-sm); font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.delta svg { width: 12px; height: 12px; flex: none; }
.delta.good { color: var(--good); } .delta.bad { color: var(--bad); }
.delta .span { color: var(--muted); margin-left: 3px; }

.hero { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3) var(--s7); }
.hero .figure .label { color: var(--muted); font-size: var(--t-sm); display: flex; align-items: center; gap: var(--s2); }
.hero .figure .value { font-size: var(--t-xl); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; }
.hero .figure.lead .value { font-size: var(--t-hero); line-height: 1.05; letter-spacing: -.03em; }
.hero .figure .value .cents { color: var(--muted); font-weight: 500; }
.key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--s-quiet); flex: none; }
.key.box { width: 10px; height: 10px; border-radius: 3px; }
.tone-value { --tone: var(--s-value); } .tone-cost { --tone: var(--s-cost); } .tone-net { --tone: var(--s-net); } .tone-quiet { --tone: var(--s-quiet); }
.tone-bad { --tone: var(--mark-bad); } .tone-good { --tone: var(--mark-good); } .tone-warn { --tone: var(--mark-warn); }
.tone-tier-1 { --tone: var(--tier-1); } .tone-tier-2 { --tone: var(--tier-2); } .tone-tier-3 { --tone: var(--tier-3); } .tone-tier-4 { --tone: var(--tier-4); }
.key[class*="tone-"] { background: var(--tone); }
.key.outline[class*="tone-"] { background: transparent; box-shadow: inset 0 0 0 1.5px var(--tone); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s4) var(--s5); }
.facts.tight { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.bleed { margin-inline: calc(var(--s5) * -1); }
.facts dt { color: var(--muted); font-size: var(--t-sm); }
.facts dd { font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.facts.rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
.facts.rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); padding-block: var(--s2); border-bottom: 1px solid var(--line); }
.facts.rows > div:last-child { border-bottom: 0; }
.facts.rows dd { text-align: right; }

/* --- controls ------------------------------------------------------------------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--ctl); padding: 0 var(--s4); border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: var(--muted); text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-solid); }
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--surface)); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border-color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--on-solid); }
.btn.live { background: var(--live); border-color: var(--live); color: #fff; }
.btn.live:hover { background: #a8430b; border-color: #a8430b; }
.btn.small { min-height: 28px; padding: 0 var(--s3); font-size: var(--t-sm); }
@media (pointer: coarse) { .btn.small { min-height: 40px; } }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.busy { cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: var(--ctl); height: var(--ctl); border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; flex: none; padding: 0; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
  min-height: var(--ctl); width: 100%; padding: 0 var(--s3); border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--field); color: var(--ink); transition: border-color .12s;
}
input:hover, select:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input:user-invalid { border-color: var(--bad); }
input::placeholder { color: var(--muted); opacity: 1; }
select { appearance: none; padding-right: var(--s7); background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.field { display: grid; gap: var(--s1); align-content: start; }
.field > label, .field > .label { font-weight: 500; }
.field .help { color: var(--muted); font-size: var(--t-sm); line-height: 1.4; }
.field .with-unit { position: relative; }
.field .with-unit input { padding-right: 52px; }
.field .with-unit .unit { position: absolute; right: var(--s3); top: 50%; translate: 0 -50%; color: var(--muted); font-size: var(--t-sm); pointer-events: none; }
.field.changed > label::after, .field.changed > .label::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--s-value); margin-left: var(--s2); vertical-align: middle; }
.field.wide { grid-column: 1 / -1; }
.field .help.warn { color: var(--warn); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s5); }

.switch { display: inline-flex; align-items: center; gap: var(--s3); cursor: pointer; min-height: var(--ctl); }
.switch input { appearance: none; width: 36px; height: 20px; min-height: 0; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--inset); position: relative; cursor: pointer; flex: none; padding: 0; transition: background .12s, border-color .12s; }
.switch input::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: translate .12s, background .12s; }
.switch input:checked { background: var(--s-value); border-color: var(--s-value); }
.switch input:checked::after { translate: 16px 0; background: #fff; }
.switch input:disabled { opacity: .5; cursor: progress; }

.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.seg button { min-height: calc(var(--ctl) - 6px); min-width: 44px; padding: 0 var(--s3); border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px var(--shadow); }

.tabs { display: flex; gap: var(--s1); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs button { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--ctl); padding: 0 var(--s3); border: 1px solid transparent; border-radius: var(--r-ctl); background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); background: var(--hover); }
.tabs button[aria-pressed="true"] { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.tabs .count { font-size: var(--t-xs); font-variant-numeric: tabular-nums; color: var(--muted); background: var(--inset); border-radius: var(--r-chip); padding: 1px 6px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 220px; max-width: 340px; position: relative; margin-left: auto; }
.toolbar .search input { padding-left: 34px; }
.toolbar .search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }

/* --- chips: a dot and a word, never colour alone ---------------------------------- */
.chip { --chip-ink: var(--ink-2); --chip-bg: var(--inset); display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--s2); border-radius: var(--r-chip); border: 1px solid color-mix(in srgb, var(--chip-ink) 22%, transparent); background: var(--chip-bg); color: var(--chip-ink); font-size: var(--t-xs); font-weight: 500; white-space: nowrap; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.plain::before { display: none; }
.chip.good { --chip-ink: var(--good); --chip-bg: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.chip.bad { --chip-ink: var(--bad); --chip-bg: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.chip.warn { --chip-ink: var(--warn); --chip-bg: color-mix(in srgb, var(--warn) 14%, var(--surface)); }
.chip.accent { --chip-ink: var(--accent); --chip-bg: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.chip.out { --chip-ink: var(--out); --chip-bg: color-mix(in srgb, var(--out) 14%, var(--surface)); }
.chip.dim { --chip-ink: var(--muted); }
.chip.dim::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }

/* --- addresses ------------------------------------------------------------------- */
.addr { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; position: relative; }
.addr .copy { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; position: relative; }
.addr .copy:hover { color: var(--ink); background: var(--hover); }
.addr .copy svg { width: 14px; height: 14px; }
.addr .copy[data-copied] { color: var(--good); }
.addr .copy[data-failed] { color: var(--bad); }
@media (hover: hover) {
  td .addr .copy, .list .addr .copy { opacity: 0; }
  tr:hover .addr .copy, li:hover .addr .copy, .addr .copy:focus-visible, .addr .copy[data-copied], .addr .copy[data-failed] { opacity: 1; }
}
@media (pointer: coarse) { .addr .copy { width: 36px; height: 36px; } }

.addr.full { white-space: normal; overflow-wrap: anywhere; }
.addr.full > :first-child { min-width: 0; }
.attach { display: flex; gap: var(--s2); }
.attach .attach-count { width: 76px; }
.host-filter { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.facts .sub { display: block; font-size: var(--t-xs); font-weight: 400; }
.card-pad { padding: var(--s2) var(--s5) var(--s4); }
table.data tr.untracked td { color: var(--muted); }
table.data td .switch { min-height: 0; vertical-align: middle; }
table.data td .link-btn.sub { font-weight: 400; }

.resolve { display: grid; gap: var(--s2); }
.resolve li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.resolve .btn { min-width: 96px; }
.problem-card { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
table.data tr.failed td:first-child { box-shadow: inset 2px 0 0 var(--mark-bad); }
.kpi .value.warn { color: var(--warn); }

/* --- tables ---------------------------------------------------------------------- */
.table-scroll { overflow-x: auto; max-width: 100%; position: relative; }
.table-scroll:focus-visible { outline-offset: -2px; }
.table-scroll.capped { max-height: 340px; overflow-y: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-stretch: 92%; }
table.data th, table.data td { text-align: left; padding: 9px var(--s3); border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: var(--s5); }
table.data th:last-child, table.data td:last-child { padding-right: var(--s5); }
table.data thead th { color: var(--muted); font-size: var(--t-sm); font-weight: 500; background: var(--inset); border-top: 1px solid var(--line); position: sticky; top: 0; }
table.data th:has(> button) { padding-block: 0; }
table.data th > button { display: inline-flex; align-items: center; gap: var(--s1); min-height: 36px; border: 0; background: none; padding: 0; color: inherit; font-weight: 500; cursor: pointer; }
table.data th > button:hover { color: var(--ink); }
table.data th > button svg { width: 12px; height: 12px; opacity: 0; }
table.data th[aria-sort] { color: var(--ink); }
table.data th[aria-sort] > button svg { opacity: 1; }
table.data th[aria-sort="ascending"] > button svg { rotate: 180deg; }
table.data .r { text-align: right; }
table.data th.r > button { flex-direction: row-reverse; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--hover); }
table.data tbody tr.link { cursor: pointer; }
table.data td.wrap-cell { white-space: normal; min-width: 220px; max-width: 420px; color: var(--ink-2); font-stretch: 100%; }
table.data td.wrap-cell:empty { min-width: 0; }
table.data td .sub { display: block; color: var(--muted); font-size: var(--t-xs); }
table.data td.dim, table.data .dim { color: var(--muted); }
table.data tr.best td { background: color-mix(in srgb, var(--s-value) 9%, var(--surface)); }
table.data tr.selected td { box-shadow: inset 0 1px 0 var(--s-value), inset 0 -1px 0 var(--s-value); }
table.data.compact th, table.data.compact td { padding-block: 6px; }
@media (max-width: 760px) {
  table.data th:first-child, table.data td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--line); }
  table.data thead th:first-child { background: var(--inset); z-index: 2; }
}
.pager { display: flex; align-items: center; gap: var(--s2); }

/* --- lists: live spins, activity, connections --------------------------------------- */
.list { display: grid; }
.list > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: 9px var(--s5); border-bottom: 1px solid var(--line); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.list .main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { display: block; color: var(--muted); font-size: var(--t-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .end { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .end .meta { text-align: right; }
.list.wrap-text .main, .list > li.placeholder .main { white-space: normal; }
.list-scroll { overflow-y: auto; min-height: 0; flex: 1 1 0; position: relative; }
.live-card .list-scroll { min-height: 300px; }
@media (max-width: 1100px) { .live-card .list-scroll { flex: none; max-height: 420px; } }
.tier { width: 8px; height: 8px; border-radius: 2px; background: var(--tone, var(--s-quiet)); flex: none; }
.spin.ours { background: color-mix(in srgb, var(--s-value) 9%, transparent); box-shadow: inset 2px 0 0 var(--s-value); }
.spin.fresh { animation: arrive .5s ease-out; }
@keyframes arrive { from { background-color: color-mix(in srgb, var(--s-value) 18%, transparent); } }
.level { width: 8px; height: 8px; border-radius: 50%; background: var(--s-quiet); flex: none; }
.level.warn { background: var(--mark-warn); } .level.error { background: var(--mark-bad); }
.live-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--t-sm); font-weight: 400; }
.live-tag .dot { width: 6px; height: 6px; box-shadow: none; }

/* --- pipeline strip ---------------------------------------------------------------- */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) 12px repeat(2, minmax(0, 1fr)); gap: var(--s2); align-items: stretch; }
.pipeline .gap { border-left: 1px solid var(--line); margin-left: 5px; }
.stage { display: grid; gap: 2px; padding: var(--s3); border-radius: var(--r-ctl); background: var(--inset); border: 1px solid var(--line); color: var(--ink); position: relative; min-width: 0; }
a.stage:hover { text-decoration: none; border-color: var(--line-strong); }
.stage .name { color: var(--muted); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage .count { font-size: var(--t-xl); font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stage .meter { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--tone) 22%, var(--surface)); overflow: hidden; margin-top: var(--s1); }
.stage .meter i { display: block; height: 100%; border-radius: 2px; background: var(--tone); min-width: 0; }
.stage.zero .count { color: var(--muted); font-weight: 500; }
.stage.flow:not(:nth-child(6))::after { content: ''; position: absolute; right: calc(var(--s2) * -1 - 1px); top: 50%; width: var(--s2); height: 1px; background: var(--line-strong); }
@media (max-width: 900px) { .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pipeline .gap { display: none; } .stage.flow::after { display: none; } }
@media (max-width: 420px) { .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- segmented bars and ranked bars --------------------------------------------------- */
.segbar { display: flex; gap: 2px; height: 8px; }
.segbar i { display: block; border-radius: 4px; background: var(--tone, var(--s-quiet)); min-width: 3px; }
.segbar.tall { height: 28px; }
.segbar.tall i { border-radius: 4px; display: flex; align-items: center; padding-left: var(--s2); font-style: normal; font-size: var(--t-xs); font-weight: 600; color: #fff; overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums; }
.segbar.tall i.tone-tier-4 { color: light-dark(#0b0b0b, #ffffff); }
.segbar.tall i:is(.tone-tier-1, .tone-tier-2) { color: light-dark(#ffffff, #0b0b0b); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); color: var(--ink-2); font-size: var(--t-sm); }
.legend span { display: inline-flex; align-items: center; gap: var(--s2); }
.ranked { display: grid; gap: var(--s3); }
.ranked li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s1) var(--s3); align-items: baseline; }
.ranked .track { grid-column: 1 / -1; grid-row: 2; }
.ranked .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranked .track { height: 8px; border-radius: 4px; background: var(--inset); }
.ranked .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--s-value); min-width: 2px; }
.ranked .val { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); white-space: nowrap; }

/* --- the share strip: one cell per wallet in the split -------------------------------- */
.shares { display: flex; flex-wrap: wrap; gap: 3px; }
.shares i { width: 14px; height: 22px; border-radius: 3px; background: var(--s-quiet); }
.shares i.ours { background: var(--s-value); }
.shares i.late { background: transparent; box-shadow: inset 0 0 0 1.5px var(--s-quiet); }
.share-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); }
.share-line strong { font-size: var(--t-xl); font-weight: 600; letter-spacing: -.01em; }

/* --- charts ---------------------------------------------------------------------------- */
.chart { position: relative; min-width: 0; }
.chart:focus-visible { outline-offset: 4px; }
.chart svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.chart text { font-family: var(--font); font-size: 11.5px; font-variant-numeric: tabular-nums; fill: var(--muted); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--tone); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--tone); opacity: .1; }
.chart .bar { fill: var(--tone); }
.chart .pt { fill: var(--tone); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart .band { fill: transparent; }
.chart .band.on { fill: var(--hover); }
.chart .band.pick { cursor: pointer; }
.chart .mark-band { fill: color-mix(in srgb, var(--s-value) 10%, transparent); }
.chart .mark-label { fill: var(--ink); font-weight: 600; font-size: 12px; }
.chart .sel-ring { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.chart .zero { stroke: var(--axis); }
.chart-tip { position: absolute; z-index: 5; top: 0; left: 0; pointer-events: none; min-width: 150px; max-width: 260px; padding: var(--s2) var(--s3); border-radius: var(--r-ctl); background: var(--raised); border: 1px solid var(--line-strong); box-shadow: 0 6px 20px var(--shadow-deep); font-size: var(--t-sm); }
.chart-tip .when { color: var(--muted); margin-bottom: var(--s1); }
.chart-tip .row { display: flex; align-items: center; gap: var(--s2); white-space: nowrap; }
.chart-tip .row b { font-weight: 600; font-variant-numeric: tabular-nums; margin-left: auto; padding-left: var(--s4); }
.chart-tip .row span { color: var(--ink-2); }
.chart-empty { display: grid; place-items: center; color: var(--muted); font-size: var(--t-sm); border: 1px dashed var(--line-strong); border-radius: var(--r-ctl); text-align: center; padding: var(--s4); }
svg.spark { display: block; overflow: visible; }
svg.spark .line { fill: none; stroke: var(--tone, var(--s-quiet)); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
svg.spark .pt { fill: var(--tone, var(--s-quiet)); stroke: var(--surface); stroke-width: 2; }

/* --- states: loading, empty, failed ------------------------------------------------------- */
.state { display: grid; justify-items: start; gap: var(--s2); padding: var(--s7) var(--s5); color: var(--muted); max-width: 68ch; }
.state strong { color: var(--ink); font-size: var(--t-lg); font-weight: 600; }
.state .btn { margin-top: var(--s2); }
.state.center { justify-items: center; text-align: center; margin-inline: auto; }
.state.loading { grid-auto-flow: column; justify-content: start; align-items: center; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.stale { opacity: .55; transition: opacity .15s; }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); }
.notice svg { width: 16px; height: 16px; flex: none; }
.notice .grow { flex: 1 1 240px; min-width: 0; }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--surface)); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.notice.warn svg { color: var(--warn); }
.notice.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--surface)); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.notice.bad svg { color: var(--bad); }
.notice.info svg { color: var(--accent); }

/* --- timeline: the six steps of a remora ---------------------------------------------------- */
.timeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.step { display: grid; gap: var(--s1); padding-right: var(--s3); position: relative; padding-top: 26px; min-width: 0; }
.step::before { content: ''; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--line-strong); }
.step:last-child::before { right: auto; width: 0; }
.step::after { content: ''; position: absolute; left: 0; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.step.done::before { background: var(--s-value); }
.step.done::after { background: var(--s-value); border-color: var(--s-value); }
.step.now::after { border-color: var(--s-value); box-shadow: 0 0 0 4px color-mix(in srgb, var(--s-value) 22%, transparent); }
.step.broke::after { background: var(--mark-bad); border-color: var(--mark-bad); }
.step .name { font-weight: 600; }
.step .what { color: var(--muted); font-size: var(--t-sm); }
.step.todo .name { color: var(--muted); font-weight: 500; }
.step a { font-size: var(--t-sm); display: inline-flex; align-items: center; gap: var(--s1); font-variant-numeric: tabular-nums; }
.step a svg { width: 12px; height: 12px; }
@media (max-width: 860px) {
  .timeline { grid-template-columns: minmax(0, 1fr); }
  .step { padding: 0 0 var(--s4) 28px; }
  .step::before { left: 6px; right: auto; top: 4px; bottom: -4px; width: 2px; height: auto; }
  .step:last-child::before { height: 0; }
  .step::after { top: 2px; }
}

/* --- mode switch ------------------------------------------------------------------------------ */
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.mode { display: grid; gap: var(--s1); text-align: left; padding: var(--s4); border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; align-content: start; }
.mode:hover { border-color: var(--muted); background: var(--hover); }
.mode .name { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-weight: 600; font-size: var(--t-lg); }
.mode .what { color: var(--muted); font-size: var(--t-sm); }
.mode[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--inset); cursor: default; }
.mode.live[aria-pressed="true"] { border-color: var(--live); box-shadow: inset 0 0 0 1px var(--live); background: color-mix(in srgb, var(--live) 9%, var(--surface)); }
@media (max-width: 760px) { .modes { grid-template-columns: minmax(0, 1fr); } }

/* --- unsaved changes bar: full width, container inside ----------------------------------------- */
.savebar { position: sticky; bottom: 0; z-index: 10; background: var(--raised); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 20px var(--shadow); margin-top: var(--s5); }
.savebar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding-block: var(--s3); }
.savebar .actions { display: flex; gap: var(--s2); }

/* --- dialog --------------------------------------------------------------------------------------- */
dialog { border: 1px solid var(--line-strong); border-radius: var(--r-card); background: var(--raised); color: var(--ink); padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 24px 60px var(--shadow-deep); }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { background: rgb(6 12 22 / .55); overflow: hidden; overscroll-behavior: contain; }
dialog form { display: grid; gap: var(--s4); padding: var(--s5); }
dialog h2 { font-size: var(--t-lg); }
dialog .body { color: var(--ink-2); display: grid; gap: var(--s3); }
dialog .buttons { display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; }

/* --- toasts ----------------------------------------------------------------------------------------- */
#toasts { position: fixed; z-index: 40; left: 50%; bottom: var(--s5); translate: -50% 0; display: grid; gap: var(--s2); justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--on-solid); padding: var(--s2) var(--s4); border-radius: var(--r-ctl); box-shadow: 0 8px 24px var(--shadow-deep); font-weight: 500; }
.toast.bad { background: var(--bad); }

.secret { display: flex; gap: var(--s2); align-items: center; }
.secret code { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-family: var(--font); font-variant-numeric: tabular-nums; background: var(--inset); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: var(--s2) var(--s3); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: end; }
.inline-form .field { flex: 1 1 200px; }

/* --- sign-in page ------------------------------------------------------------------------------------- */
.login { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto 2fr; padding: var(--gutter); }
.login .card { grid-row: 2; width: min(380px, 100%); margin-inline: auto; padding: var(--s7) var(--s6) var(--s6); display: grid; gap: var(--s5); }
.login .brand { color: var(--ink); font-size: var(--t-xl); }
.login .brand svg { width: 34px; height: 34px; }
.login form { display: grid; gap: var(--s4); }
.login .foot { color: var(--muted); font-size: var(--t-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .chip, .stage, .card, .btn, .seg button[aria-pressed="true"] { border: 1px solid CanvasText; }
  .dot, .tier, .level, .key { forced-color-adjust: none; }
}
