/* rail dashboard. The core block is shared with depot and connect; rail's own
   rules sit below it. */

/* tint: the only per-app values */
:root {
  --accent: #059669;
  --accent-light: color-mix(in oklab, #059669 72%, white);
  --accent-hover: #10b981;
  --accent-dim: color-mix(in oklab, #059669 16%, transparent);
}

/* core:start -- shared by rail, depot and connect. Byte-identical in all
   three; a test pins its hash. Change it in every repo or in none. The four
   --accent tokens above this block are the only per-app values. */

:root {
  --bg: #0f172a;
  --card: rgba(31, 41, 55, 0.5);
  --well: rgba(15, 23, 42, 0.6);
  --border: #374151;
  --border-strong: #4b5563;
  --rule: rgba(55, 65, 81, 0.6);
  --row-rule: rgba(55, 65, 81, 0.45);
  --text: #e2e8f0;
  --body: #d1d5db;
  --muted: #9ca3af;
  --dim: #828a99;
  --indigo: #4f46e5;
  --ok: #34d399;
  --ok-bg: rgba(5, 150, 105, 0.16);
  --ok-border: rgba(5, 150, 105, 0.38);
  --warn: #fbbf24;
  --warn-bg: rgba(217, 119, 6, 0.16);
  --warn-border: rgba(217, 119, 6, 0.45);
  --bad: #fb7185;
  --bad-bg: rgba(225, 29, 72, 0.16);
  --bad-border: rgba(225, 29, 72, 0.45);
  --neutral: #94a3b8;
  --neutral-bg: rgba(100, 116, 139, 0.16);
  --neutral-border: rgba(100, 116, 139, 0.38);
  --info: #a5b4fc;
  --info-bg: rgba(79, 70, 229, 0.18);
  --info-border: rgba(79, 70, 229, 0.38);
  --series: #64748b;
  --series-hi: #94a3b8;
  --series-err: #f43f5e;
  --grid: #263043;
  --tip: #1f2937;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, pre { margin: 0; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: #ffffff; }
svg { display: block; }
form { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 12px; }
.hidden { display: none !important; }
.right { text-align: right; }
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }

/* Identity bar */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--rule);
}
.brand-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand:hover { color: inherit; }
.mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--indigo);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-name { display: flex; align-items: baseline; gap: 8px; font-size: 18px; font-weight: 600; color: #ffffff; }
.brand-name .sep { color: var(--muted); }
.brand-name .accent { color: var(--accent-light); }
.chip {
  margin-left: 4px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-light);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill-age { font-size: 11px; color: var(--muted); }
.pill.warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn); }
.pill.bad { border-color: var(--bad-border); background: var(--bad-bg); color: var(--bad); }
.session { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); }
.session form { display: inline; }
.session select {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: #ffffff;
}
.role {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--info-bg);
  color: var(--info);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Buttons. The transparent border keeps a filled button the same height as
   an outlined one. Text on the accent is the page ground, for contrast. */
.btn-ghost, .btn-accent, .btn-danger {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-ghost { background: none; border-color: var(--border-strong); color: #ffffff; }
.btn-ghost:hover { border-color: var(--muted); color: #ffffff; }
.btn-accent { background: var(--accent); color: var(--bg); font-weight: 600; }
.btn-accent:hover { background: var(--accent-hover); color: var(--bg); }
.btn-accent:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-danger { background: none; border-color: var(--bad-border); color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-small { padding: 3px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; padding: 9px 16px; font-size: 14px; }
.link-danger, .link-action { font: inherit; font-size: 13px; background: none; border: none; padding: 0; cursor: pointer; }
.link-danger { color: var(--bad); }
.link-action { color: var(--accent-light); }
.link-danger:hover, .link-action:hover { color: #ffffff; }

/* Navigation: the working pages, then a subordinate row. */
.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 44px;
  padding: 0 32px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}
.nav a {
  font-size: 14px;
  color: var(--body);
  height: 43px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: #ffffff; }
.nav a.active { color: #ffffff; border-bottom-color: var(--accent-light); }
.subnav {
  display: flex;
  align-items: center;
  gap: 26px;
  height: 38px;
  padding: 0 32px;
  background: var(--well);
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
}
.subnav-group { display: flex; align-items: center; gap: 10px; }
.subnav-label { font-size: 10px; font-weight: 700; letter-spacing: 0.09em; color: var(--muted); text-transform: uppercase; }
.subnav a { font-size: 13px; color: var(--body); white-space: nowrap; }
.subnav a:hover, .subnav a.active { color: #ffffff; }
.subnav a.active { font-weight: 600; text-decoration: underline 2px var(--accent-light); text-underline-offset: 6px; }

/* Tabs inside a page */
.page-tabs { display: flex; align-items: center; gap: 22px; border-bottom: 1px solid var(--rule); margin-bottom: 20px; overflow-x: auto; }
.page-tabs a { font-size: 14px; color: var(--body); height: 40px; display: flex; align-items: center; border-bottom: 2px solid transparent; white-space: nowrap; }
.page-tabs a:hover { color: #ffffff; }
.page-tabs a.active { color: #ffffff; border-bottom-color: var(--accent-light); }
.page-tabs .count { margin-left: 6px; color: var(--muted); font-size: 12px; }

/* Content */
.content { flex: 1; width: 100%; max-width: 1152px; margin: 0 auto; padding: 32px; }
.page-title { font-size: 24px; font-weight: 700; color: #ffffff; margin-bottom: 20px; }
.page-title.mono { font-size: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.page-head .page-title { margin-bottom: 0; }
.lede { font-size: 13px; color: var(--muted); margin: -12px 0 20px; max-width: 780px; line-height: 1.5; }
.legend { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 0 0 22px; max-width: 780px; }
.breadcrumb { font-size: 13px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 14px; }
.section-title:first-child { margin-top: 0; }
.section-title h2 { font-size: 16px; font-weight: 600; color: #ffffff; }
.section-title a { font-size: 14px; }
.section-title .note { font-size: 12px; color: var(--dim); }

/* Health strip: the conditions that fail silently. Each tile states the
   reading and its age, so a check that froze cannot read as a passing one. */
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 28px; }
.health-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.health-tile .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); flex-shrink: 0; }
.health-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.health-label { font-size: 13px; font-weight: 600; color: #ffffff; }
.health-detail { font-size: 12.5px; color: var(--muted); }
.health-tile.warn { border-color: var(--warn-border); background: rgba(217, 119, 6, 0.10); }
.health-tile.warn .dot { background: var(--warn); }
.health-tile.warn .health-detail { color: var(--warn); }
.health-tile.bad { border-color: var(--bad-border); background: rgba(225, 29, 72, 0.10); }
.health-tile.bad .dot { background: var(--bad); }
.health-tile.bad .health-detail { color: var(--bad); }

/* Tiles. The text stacks; an optional mark sits to its right. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.tile {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.tile-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.tile-value { font-size: 22px; font-weight: 600; color: #ffffff; overflow-wrap: anywhere; }
.tile-note, .tile-delta { font-size: 12px; color: var(--muted); }
.tile-delta.ok { color: var(--ok); }
.tile-delta.bad { color: var(--bad); }

/* Chart: small multiples on one time axis. Text wears text tokens; only
   the marks carry the series color. */
.chart {
  position: relative;
  padding: 16px 16px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  margin-bottom: 28px;
}
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.chart-title { display: flex; align-items: baseline; gap: 10px; }
.chart-title b { font-size: 15px; font-weight: 600; color: #ffffff; }
.chart-title span { font-size: 12px; color: var(--muted); }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .panel-title { font-size: 12px; font-weight: 600; fill: var(--text); }
.chart .peak { font-size: 11px; font-weight: 600; fill: var(--text); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--series); }
.chart .bar.hi { fill: var(--series-hi); }
.chart .bar.err { fill: var(--series-err); }
.chart .bar.err.hi { fill: var(--bad); }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; opacity: 0.7; }
.chart-tip {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background: var(--tip);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  min-width: 150px;
}
.chart-tip .row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.chart-tip .key { width: 12px; height: 2px; border-radius: 1px; background: var(--series); flex-shrink: 0; }
.chart-tip .key.err { background: var(--series-err); }
.chart-tip b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.chart details { margin-top: 6px; }
.chart summary { font-size: 13px; color: var(--accent-light); cursor: pointer; list-style: none; width: max-content; }
.chart summary:hover { color: #ffffff; }
.chart details table { margin-top: 8px; }
.chart details td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Tables. Console 13, dense on purpose. */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.table-wrap + .table-wrap { margin-top: 28px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 11px 16px;
  background: var(--well);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--row-rule); color: var(--body); white-space: nowrap; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.mono { font-size: 12.5px; }
td.name { color: var(--text); max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
td.wrap { white-space: normal; max-width: 420px; }
td.empty { color: var(--dim); text-align: center; padding: 40px 16px; white-space: normal; }
td.actions { text-align: right; }
td.actions form { display: inline; margin-left: 12px; }
.table-title { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; color: #ffffff; }
.chart .table-wrap { border: none; background: none; border-radius: 0; }
.chart th { background: none; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* Status badges: the one place color carries meaning in the console. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--neutral);
  font-size: 12px;
  font-weight: 500;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.ok { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok); }
.badge.pending, .badge.warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn); }
.badge.bad { border-color: var(--bad-border); background: var(--bad-bg); color: var(--bad); }
.badge.accent { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-light); }
.badge.info { border-color: var(--info-border); background: var(--info-bg); color: var(--info); }

/* Pagination */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; font-size: 13px; color: var(--muted); }
.pager-links { display: flex; gap: 8px; }
.pager-links a, .pager-links .disabled { padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; color: #ffffff; }
.pager-links a:hover { border-color: var(--muted); }
.pager-links .disabled { border-color: var(--border); color: var(--border-strong); }

/* Cards and detail grids */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.card h2 { font-size: 16px; font-weight: 600; color: #ffffff; margin-bottom: 18px; }
.card.narrow { max-width: 520px; }
.card + .card { margin-top: 16px; }
.detail dl { display: grid; grid-template-columns: 160px 1fr; gap: 12px 24px; font-size: 14px; }
.detail dt { color: var(--muted); }
.detail dd { color: var(--body); overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; }
.fact-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
.fact-value { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field, .fields > * + * { margin-top: 16px; }
.field label, .field .label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field .req { color: var(--bad); }
.field input, .field select, .field textarea, .filters input, .filters select {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.field textarea { font-family: var(--mono); font-size: 13px; line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.field .help { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 .field + .field { margin-top: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.filters .field + .field { margin-top: 0; }
.filters label { display: grid; gap: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.filters input, .filters select { width: auto; max-width: 100%; min-width: 0; padding: 7px 12px; font-size: 13px; }

/* Notices */
.notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); font-size: 14px; color: var(--text); margin-bottom: 16px; }
.notice.bad { border-color: var(--bad-border); background: rgba(225, 29, 72, 0.12); }
.notice.ok { border-color: var(--ok-border); background: rgba(5, 150, 105, 0.12); }
.notice.warn { border-color: var(--warn-border); background: rgba(217, 119, 6, 0.12); }
.notice code {
  flex: 1;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  user-select: all;
  overflow-wrap: anywhere;
  white-space: normal;
}
code.inline { padding: 1px 5px; background: var(--well); border-radius: 4px; font-size: 12.5px; color: var(--text); }

/* Login and the other single-card pages */
.content.login { display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 19px; font-weight: 700; color: #ffffff; margin-bottom: 6px; }
.login-card p { font-size: 13px; line-height: 1.5; color: var(--muted); margin-bottom: 20px; }
.login-card .field + .btn-accent, .login-card .field + .btn-block { margin-top: 16px; }

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 32px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}
.footer .mono { font-size: 13px; }

/* Phone */
@media (max-width: 640px) {
  .bar, .nav, .subnav, .footer { padding-left: 20px; padding-right: 20px; }
  .content { padding: 20px; }
  .chip, .pill { display: none; }
  .session .mono, .session .role { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .detail dl { grid-template-columns: 1fr; gap: 4px 0; }
  .detail dt { margin-top: 10px; }
}

/* core:end */

/* rail-specific rules, below the core */

/* Layout */
.measure { max-width: 720px; }
.title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card.detail, .notice.created { margin-bottom: 24px; }
.section-title .btn-accent, .section-title .btn-ghost { font-size: 13px; }
.section-title h2 .dim { font-weight: 400; }
.table-wrap + .legend { margin-top: 16px; }
.note { display: block; margin-top: 2px; font-size: 12px; color: var(--dim); }
.form-actions .note { margin-top: 0; }

/* Tables */
td.addr { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
td.summary { white-space: normal; word-break: break-word; }
table.top td { vertical-align: top; }
table.loose th, table.loose td { white-space: normal; vertical-align: top; }
table.loose td { overflow-wrap: break-word; }
table.loose .mono { word-break: break-all; }
.clip { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Range row: one control that scopes every tile, chart and table below. */
.range { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.range-presets { display: flex; align-items: center; gap: 10px; }
.chips { display: flex; align-items: center; gap: 6px; }
.chips a { padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; color: var(--body); }
.chips a:hover { border-color: var(--muted); color: #ffffff; }
.chips a.active { border-color: var(--accent-light); color: #ffffff; }

/* Tile extras: a sparkline mark, and a TXID that must fit on one line. */
.spark { flex-shrink: 0; overflow: visible; }
.spark path { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--series); stroke: #172030; stroke-width: 2; }
.spark.err path { stroke: var(--series-err); }
.spark.err circle { fill: var(--series-err); }
.tile-value.txid { font-size: 15px; line-height: 1.35; }

/* Forms. The core sizes every .field input as a text box; a checkbox or a
   radio keeps its own box. */
.field textarea { min-height: 96px; }
.field input[type="checkbox"], .field input[type="radio"], .filters input[type="checkbox"], .controls input {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
}
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field.check label, .field label.check { color: var(--body); }
.filters label.check { display: inline-flex; align-items: center; gap: 6px; padding-bottom: 8px; }
.filters .clear { padding-bottom: 8px; font-size: 13px; }
.inline { display: flex; align-items: center; gap: 10px; }
.inline.grow { flex: 1; }
.inline input { flex: 1; min-width: 0; }
.inline .join { font-size: 13px; color: var(--muted); white-space: nowrap; }
td .inline { gap: 6px; }
td .inline input[type="text"] {
  flex: none;
  width: 130px;
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.mode { display: flex; flex-direction: column; gap: 10px; }
.mode label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}
.mode label.on { border-color: var(--accent-light); }
.mode input { margin-top: 3px; }
.mode b { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.mode span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

/* Upload policy. The reveal is CSS-only; where :has is unsupported the
   fields stay visible. */
.uploads { margin: 24px 0 16px; padding-top: 20px; border-top: 1px solid var(--rule); }
.uploads-policy { margin-top: 16px; padding-left: 20px; border-left: 1px solid var(--border); }
.uploads:not(:has(.uploads-on:checked)) .uploads-policy { display: none; }

/* Cards with a meaning: a destructive action, a key shown once. */
.card.danger { border-color: var(--bad-border); background: var(--bad-bg); }
.card.danger h2 { color: var(--bad); }
.card.danger .confirm-name { color: var(--text); font-weight: 600; }
.card.keybox { border-color: var(--ok-border); }
.card.keybox h2 { color: var(--ok); }
.card.keybox textarea { min-height: 120px; font-size: 12px; }

/* A created form: the endpoint and a snippet to paste. */
.notice.created { flex-direction: column; align-items: stretch; gap: 10px; }
.created .endpoint { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.created pre {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--body);
  overflow-x: auto;
}

/* Message detail: one card per recipient, its attempts as a timeline. */
.rcpt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.rcpt-addr { font-weight: 600; color: var(--text); word-break: break-all; }
.rcpt-facts { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.attempt { margin-left: 4px; padding: 6px 0 6px 12px; border-left: 2px solid var(--border); }
.attempt + .attempt { border-top: 1px solid var(--row-rule); }
.attempt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--muted); }
.attempt-time { font-family: var(--mono); color: var(--body); }
.attempt-resp { margin-top: 3px; font-family: var(--mono); font-size: 12.5px; color: var(--body); white-space: pre-wrap; word-break: break-word; }

/* Forwarding. From munging reads, it never edits: inherited is muted behind
   the arrow, an override is brighter. */
.munge { display: inline-flex; align-items: center; gap: 6px; }
.munge svg, .munge-legend svg { flex-shrink: 0; }
.munge.inherited { color: var(--muted); }
.munge.override { color: var(--text); font-weight: 500; }
.munge-legend { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.munge-legend svg { margin-top: 2px; }
.kv { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.kv b { font-weight: 500; color: var(--body); }

/* Live feed. Three event kinds have no core badge tone of their own. */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--rule); }
.controls label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--body); cursor: pointer; }
.controls .status { margin-left: auto; font-size: 12px; color: var(--muted); }
.controls .status.live { color: var(--ok); }
.controls .status.down { color: var(--bad); }
.badge.k-webhook { border-color: rgba(139, 92, 246, 0.38); background: rgba(139, 92, 246, 0.18); color: #c4b5fd; }
.badge.k-http { border-color: rgba(234, 88, 12, 0.38); background: rgba(234, 88, 12, 0.18); color: #fb923c; }
.badge.k-forward { border-color: rgba(236, 72, 153, 0.38); background: rgba(236, 72, 153, 0.18); color: #f9a8d4; }

/* DMARC: findings, the pass meter, policy chips, class filters, the pager. */
.finding-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.finding { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.finding.fail { border-color: var(--bad-border); background: var(--bad-bg); }
.finding.warn { border-color: var(--warn-border); background: var(--warn-bg); }
.finding-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.finding-title { font-size: 14px; font-weight: 600; color: #ffffff; }
.finding-detail { font-size: 12.5px; color: var(--muted); }
.finding-domain { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.finding-info { margin-bottom: 24px; }
.finding-info summary { margin-bottom: 12px; font-size: 13px; color: var(--accent-light); cursor: pointer; width: max-content; }
.meter { display: inline-block; vertical-align: middle; margin-right: 8px; }
.meter-bg { fill: var(--row-rule); }
.meter-fill { fill: var(--ok); }
.meter-fill.warn { fill: var(--warn); }
.policy-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips.wrap { flex-wrap: wrap; margin-bottom: 14px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; }

/* Rail account setup and responsive dashboard navigation. */
.app-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); flex: 1; }
.sidebar { border-right: 1px solid var(--border); background: var(--card); }
.sidebar .nav, .sidebar .subnav { display: flex; flex-direction: column; padding: 20px 14px; gap: 4px; height: auto; align-items: stretch; overflow: visible; border-bottom: 0; }
.sidebar .nav a, .sidebar .subnav a { padding: 10px 12px; height: auto; border: 0; border-radius: 8px; }
.sidebar .nav a.active, .sidebar .subnav a.active { background: var(--row-rule); color: var(--text); }
.sidebar .subnav { padding-top: 0; background: transparent; }
.sidebar .subnav-group { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; }
.sidebar .subnav-label { padding: 14px 12px 6px; }
.navigation-menu > summary { display: none; cursor: pointer; padding: 14px 20px; font-weight: 600; }
.message-nav { display: flex; flex-wrap: wrap; gap: 18px; padding-bottom: 20px; font-size: 13px; }
.message-nav a.active { color: var(--text); text-decoration: underline; text-underline-offset: 6px; }
.skip-link { position: absolute; left: 16px; top: -80px; padding: 12px; background: var(--card); z-index: 10; }
.skip-link:focus { top: 12px; }
.setup-card { max-width: 760px; }
.setup-steps { padding-left: 24px; display: grid; gap: 22px; }
.setup-steps li > p { margin: 6px 0 10px; color: var(--muted); }
.setup-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.account-card { margin-bottom: 24px; }
.account-card p { margin: 10px 0; color: var(--muted); line-height: 1.6; }
.signup-card { width: 100%; max-width: 520px; }
.dns-value { overflow-wrap: anywhere; }
.dns-copy { display: flex; align-items: start; gap: 12px; margin: 12px 0; }
.dns-copy code { flex: 1; min-width: 0; }
.secret-output { width: 100%; min-height: 180px; font-family: var(--mono); }
.copy-status { font-size: 12px; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .navigation-menu > summary { display: block; }
  .sidebar .nav { flex-direction: row; flex-wrap: wrap; padding: 4px 12px 12px; }
  .sidebar .subnav { padding: 0 12px 12px; }
  .sidebar .subnav-group { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .setup-grid { grid-template-columns: minmax(0, 1fr); }
  .dns-copy { flex-wrap: wrap; }
}

.onboarding-head { flex-direction: column; align-items: flex-start; gap: 8px; }
.onboarding-head p { color: var(--muted); }
.credential-method { border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-top: 20px; }
.credential-method legend { padding: 0 8px; font-size: 14px; font-weight: 600; }
.dns-record + .dns-record { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 18px; }
.dns-record h3 { font-size: 14px; margin-bottom: 12px; }
.signup-card h1 { font-size: 24px; }
.onboarding-notice { display: block; line-height: 1.6; }
.onboarding-notice p { margin: 8px 0 0; }
@media (max-width: 760px) {
  .dns-copy { flex-direction: column; }
  .dns-copy code { width: 100%; }
}
