/* certflow admin. No script anywhere: charts are server-rendered SVG and
   HTML whose colours come from the classes below, so light and dark mode swap
   here and nowhere else. */

:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1b1f24; --text-2: #52514e; --muted: #6b7380; --line: #dde1e6;
  --accent: #2457c5; --accent-wash: #e9effb; --hover: rgba(11, 11, 11, 0.05);
  --ok: #1f7a4d; --ok-bg: #e3f4ea; --idle: #5d6673; --idle-bg: #eceff2;
  --waiting: #8a6100; --waiting-bg: #fdf3d8; --behind: #b3540b; --behind-bg: #fde8d6;
  --stalled: #b42318; --stalled-bg: #fde4e1;

  /* Chart chrome and the validated categorical palette (8 slots, fixed
     order), light steps. Checked with the dataviz validator: every adjacent
     pair passes CVD and normal-vision separation. */
  --grid: #e1e0d9; --axis: #c3c2b7; --tick: #898781;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --so: #a8a69e; --sp: #898781;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --panel: #191d23; --text: #e6e9ee; --text-2: #c3c2b7; --muted: #98a2b0; --line: #2c323b;
    --accent: #8fb1ff; --accent-wash: #1c2840; --hover: rgba(255, 255, 255, 0.06);
    --ok: #5fd39a; --ok-bg: #173527; --idle: #98a2b0; --idle-bg: #242a32;
    --waiting: #f0c45a; --waiting-bg: #3a2f12; --behind: #f5a15e; --behind-bg: #3d2614;
    --stalled: #ff8a80; --stalled-bg: #45201d;
    --grid: #2c2c2a; --axis: #383835; --tick: #898781;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --so: #6b6a65; --sp: #898781;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 4px; }
h3 { font-size: 14px; margin: 18px 0 2px; }
h3.spaced, .spaced { margin-top: 28px; }
.muted { color: var(--muted); }
.desc { color: var(--text-2); margin: 0 0 12px; font-size: 13px; max-width: 80ch; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.error { color: var(--stalled); background: var(--stalled-bg); padding: 8px 12px; border-radius: 6px; }
.note { color: var(--text-2); font-size: 13px; margin: 0 0 12px; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* ---- Layout: sidebar + main, like Cloudflare Radar ---- */
body.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel);
  border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; padding: 0 10px 12px; }
.side nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-group { margin: 16px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.side nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.side nav a:hover { background: var(--hover); }
.side nav a.on { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.side nav a.sub { padding-left: 22px; font-size: 13px; color: var(--text-2); }
.side-foot { border-top: 1px solid var(--line); padding: 12px 10px 0; display: flex;
  justify-content: space-between; align-items: center; font-size: 13px; }
.side-foot form { margin: 0; }
.main { min-width: 0; }
main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }
.page-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 4px 0 16px; }

@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 8px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; }
  .side nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .nav-group, .side nav a.sub { display: none; }
  .side nav a { white-space: nowrap; }
  .side-foot { border: 0; padding: 0; margin-left: auto; gap: 12px; }
  main { padding: 16px 16px 40px; }
}

/* ---- Cards, tiles, tables ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px 24px; margin-bottom: 20px; scroll-margin-top: 16px; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 1100px) { .cols3 { grid-template-columns: 1fr; gap: 8px; } }
@media (max-width: 900px) { .card-grid { grid-template-columns: 1fr; gap: 16px; } .card { padding: 16px; } }

.banner { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; padding: 12px 16px;
  border-radius: 8px; margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile.warn { border-color: var(--behind); }
.tile .label { color: var(--muted); font-size: 12px; }
.tile .value { font-size: 22px; font-weight: 600; }
.tile .sub { color: var(--muted); font-size: 12px; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
td.bar { width: 40%; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.status-ok { color: var(--ok); background: var(--ok-bg); }
.status-idle { color: var(--idle); background: var(--idle-bg); }
.status-waiting { color: var(--waiting); background: var(--waiting-bg); }
.status-behind { color: var(--behind); background: var(--behind-bg); }
.status-stalled { color: var(--stalled); background: var(--stalled-bg); }
.legend { color: var(--muted); font-size: 12px; line-height: 2; }

/* ---- CT page ---- */
.info { background: var(--accent-wash); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; margin: 0 0 16px; font-size: 13px; color: var(--text-2); }
.pill { display: inline-block; background: var(--accent); color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 600; padding: 1px 8px; margin-right: 8px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg a { padding: 5px 10px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-size: 13px; white-space: nowrap; }
.seg a:hover { background: var(--hover); }
.seg a.on { background: var(--accent); color: #fff; }
.filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.filters select { font: inherit; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--text); max-width: 220px; }
.filters button { font: inherit; padding: 5px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.filters .clear { font-size: 13px; color: var(--accent); }

/* Legends: the identity channel. Keys mirror the mark (a line for lines, a
   swatch for bars); text stays in ink colours, never the series colour. */
.legend-row { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 10px 0 6px; }
.legend-row.compact { gap: 6px 16px; margin: 4px 0 10px; font-size: 13px; }
.lg { display: flex; flex-direction: column; min-width: 0; }
.lg .key { font-size: 13px; color: var(--text-2); }
.lg b { font-size: 21px; font-weight: 600; }
.key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.lk { display: inline-block; width: 16px; height: 0; border-top: 3px solid var(--c); border-radius: 2px; }
.lk.dashed { border-top-style: dashed; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); flex: none; }
.split-legend { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.split-legend li { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 8px; font-size: 13px; }
.split-legend b { font-weight: 600; }
.aside-stat h3 { margin-top: 0; }

/* Series colour slots: the class sets --c, each mark type reads it. */
.s1 { --c: var(--s1); } .s2 { --c: var(--s2); } .s3 { --c: var(--s3); } .s4 { --c: var(--s4); }
.s5 { --c: var(--s5); } .s6 { --c: var(--s6); } .s7 { --c: var(--s7); } .s8 { --c: var(--s8); }
.so { --c: var(--so); } .sp { --c: var(--sp); }

/* SVG charts. Text scales with the viewBox; strokes do not. */
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart text { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
svg.chart .tick { fill: var(--tick); font-size: 12px; font-variant-numeric: tabular-nums; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; shape-rendering: crispEdges; }
svg.chart .axis { stroke: var(--axis); stroke-width: 1; vector-effect: non-scaling-stroke; }
svg.chart .ln { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
svg.chart .ln.dashed { stroke-dasharray: 5 4; }
svg.chart .area { fill: var(--c); fill-opacity: .1; stroke: none; }
svg.chart .dot { fill: var(--c); stroke: var(--panel); stroke-width: 2; vector-effect: non-scaling-stroke; }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover { fill: var(--hover); }
svg.split { display: block; width: 100%; height: 18px; margin-top: 6px; }
svg.split .bar { fill: var(--c); }

/* Horizontal bar lists: <progress> bars, 14px thick, 4px rounded data end,
   value at the tip. */
.bars { display: grid; gap: 7px; margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) 52px; align-items: center; gap: 10px; }
.bar-row:hover { background: var(--hover); border-radius: 4px; }
.bar-lbl { font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-lbl small { color: var(--muted); font-size: 12px; }
.bar-val { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
progress.bar-p { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border: 0; background: transparent; }
progress.bar-p::-webkit-progress-bar { background: transparent; }
progress.bar-p::-webkit-progress-value { background: var(--c); border-radius: 0 4px 4px 0; }
progress.bar-p::-moz-progress-bar { background: var(--c); border-radius: 0 4px 4px 0; }

/* Duration small multiples. */
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 6px; }
.multiple { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 8px; }
.multiple-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.multiple-head b { font-size: 16px; font-weight: 600; margin-left: auto; }

details.tbl { margin-top: 8px; }
details.tbl summary { cursor: pointer; color: var(--accent); font-size: 13px; }
details.tbl table { margin-top: 8px; font-size: 12.5px; }
details.tbl .scroll { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }

/* ---- Login ---- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 24px; }
.login form { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.login label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.login input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); }
.login button { margin-top: 14px; font: inherit; padding: 9px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer; }

/* Ranked list of registrable domains, flowing into columns. */
.rank { columns: 4 200px; column-gap: 24px; margin: 8px 0 0; padding-left: 28px; font-size: 13px; }
.rank li { padding: 2px 0; break-inside: avoid; overflow-wrap: anywhere; }

/* ---- Account pages ---- */
.notice { color: var(--ok); background: var(--ok-bg); padding: 8px 12px; border-radius: 6px; }
.card form input, .card form select { font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); }
.card form button { font: inherit; padding: 6px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.stack { display: grid; gap: 8px; max-width: 360px; text-align: left; }
.stack label, .add-user label { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.stack.narrow { max-width: 320px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.add-user { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 10px; }
table.users td { vertical-align: top; }
.manage summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.manage-body { display: grid; gap: 14px; padding: 12px; margin-top: 8px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); text-align: left; min-width: 300px; }
.manage-body form { margin: 0; }
.card form.danger button { background: var(--stalled); }
.danger label { font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
table.kv th { text-align: left; width: 160px; }
