/* shark-mesh console, after docs/design/console-redesign: a fixed left rail
   of grouped sections, a context bar, and a page column of cards. Dark
   first; the light theme follows the system unless the viewer picked one
   (data-theme on <html>). Every colour is a token on :root and the themes
   only swap tokens. Corners are 2 px on controls and 4 px on cards, borders
   carry depth, and indigo is kept for focus, the active rail entry and tab,
   links and chart series 1. Numbers, ids, IPs and hashes are mono. */
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-tight.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/jetbrains-mono.woff2") format("woff2"); }

:root {
  --bg: #1d1d1e; --surface: #25272c; --surface-2: #2c2e34; --surface-3: #33363d; --row-hover: #2a2c31; --code-bg: #18181a;
  --line: #333438; --line-2: #515257; --ink: #f0f1f2; --ink-2: #c9ccd1; --ink-3: #9a9ba0;
  --accent: #6977c9; --accent-2: #9da6e3; --accent-wash: rgba(105, 119, 201, .16); --acc-line: rgba(105, 119, 201, .4);
  --btn: #f0f1f2; --btn-ink: #1d1d1e;
  --good: #4bc99b; --good-wash: rgba(75, 201, 155, .12); --good-line: rgba(75, 201, 155, .3);
  --warn: #f0b358; --warn-wash: rgba(240, 179, 88, .12); --warn-line: rgba(240, 179, 88, .32);
  --crit: #f2708e; --crit-wash: rgba(242, 112, 142, .13); --crit-line: rgba(242, 112, 142, .36);
  --c1: #6977c9; --c2: #54e1e1; --c3: #b967e2; --c4: #7fb2ff; --c5: #c9ccd1; --c6: #8f8f97;
  --grid: #2c2e34; --scrim: rgba(0, 0, 0, .6); --shadow: 0 12px 32px rgba(0, 0, 0, .5);
  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f3ef; --surface: #ffffff; --surface-2: #faf9f6; --surface-3: #eeece6; --row-hover: #f7f6f2; --code-bg: #faf9f6;
    --line: #e5e2da; --line-2: #d2cdc2; --ink: #1d1c19; --ink-2: #57534b; --ink-3: #6f6a60;
    --accent: #4f5bb5; --accent-2: #3d489c; --accent-wash: rgba(79, 91, 181, .1); --acc-line: rgba(79, 91, 181, .35);
    --btn: #1d1c19; --btn-ink: #ffffff;
    --good: #1f7a3d; --good-wash: #e3f2e7; --good-line: rgba(31, 122, 61, .3);
    --warn: #965a00; --warn-wash: #faefd9; --warn-line: rgba(150, 90, 0, .3);
    --crit: #b4233f; --crit-wash: #fbe5ea; --crit-line: rgba(180, 35, 63, .3);
    --c1: #4f5bb5; --c2: #0f8f8f; --c3: #8a3fb5; --c4: #2f6fc4; --c5: #5f6168; --c6: #77736a;
    --grid: #eeece6; --scrim: rgba(0, 0, 0, .35); --shadow: 0 2px 4px rgba(40, 34, 24, .05), 0 14px 36px rgba(40, 34, 24, .12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #faf9f6; --surface-3: #eeece6; --row-hover: #f7f6f2; --code-bg: #faf9f6;
  --line: #e5e2da; --line-2: #d2cdc2; --ink: #1d1c19; --ink-2: #57534b; --ink-3: #6f6a60;
  --accent: #4f5bb5; --accent-2: #3d489c; --accent-wash: rgba(79, 91, 181, .1); --acc-line: rgba(79, 91, 181, .35);
  --btn: #1d1c19; --btn-ink: #ffffff;
  --good: #1f7a3d; --good-wash: #e3f2e7; --good-line: rgba(31, 122, 61, .3);
  --warn: #965a00; --warn-wash: #faefd9; --warn-line: rgba(150, 90, 0, .3);
  --crit: #b4233f; --crit-wash: #fbe5ea; --crit-line: rgba(180, 35, 63, .3);
  --c1: #4f5bb5; --c2: #0f8f8f; --c3: #8a3fb5; --c4: #2f6fc4; --c5: #5f6168; --c6: #77736a;
  --grid: #eeece6; --scrim: rgba(0, 0, 0, .35); --shadow: 0 2px 4px rgba(40, 34, 24, .05), 0 14px 36px rgba(40, 34, 24, .12);
  color-scheme: light;
}

/* ---- base ------------------------------------------------------------------ */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.45 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: inherit; text-decoration: none; }
a.lk, .kv a, .feed b a, p a, .note a, .empty a { color: var(--accent-2); }
a.lk:hover, .kv a:hover, .note a:hover, .empty a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
p { margin: 0; }
svg.ic { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---- frame: rail | context bar over the page -------------------------------- */
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.rail { border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; background: var(--bg); }
.brand { display: flex; gap: 9px; align-items: center; padding: 0 8px 14px; }
.bm { width: 26px; height: 26px; border-radius: 3px; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
.bm svg.ic { width: 15px; height: 15px; }
.brand b { display: block; font-size: 14px; font-weight: 600; }
.brand small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; }
.nsec { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 14px 10px 5px; }
.ni { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 3px; color: var(--ink-2); font-size: 13.5px; }
.ni:hover { background: var(--row-hover); color: var(--ink); }
.ni.on { background: var(--surface-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.ni svg.ic { opacity: .85; }
.ni .cnt { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.ni .cnt.w { color: var(--crit); }
.ver { font-family: var(--mono); font-size: 10px; color: var(--ink-3); padding: 14px 10px 4px; margin-top: auto; }
.work { min-width: 0; display: flex; flex-direction: column; }
.ctx { position: sticky; top: 0; z-index: 5; height: 50px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: 8px; padding: 0 20px 0 28px; background: var(--bg); color: var(--ink-3); min-width: 0; }
.crumb { display: flex; gap: 7px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb a:hover { color: var(--ink); }
.crumb b { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.sp { flex: 1; }
.ib { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; flex: none; border: 1px solid var(--line-2);
  border-radius: 2px; background: transparent; color: var(--ink-2); cursor: pointer; padding: 0; }
.ib:hover { background: var(--surface-2); color: var(--ink); }
.menu-btn { display: none; }
.av { width: 28px; height: 28px; border-radius: 3px; background: var(--surface-3); display: grid; place-items: center; font-family: var(--mono);
  font-size: 11px; color: var(--ink-2); flex: none; }
/* the user menu: the avatar, Sign out inside */
.um { position: relative; }
.um summary { list-style: none; cursor: pointer; border-radius: 3px; }
.um summary::-webkit-details-marker { display: none; }
.um-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 4px; box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.um-pop p { padding: 6px 8px 8px; font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.um-pop form { margin: 0; }
.um-pop button { width: 100%; text-align: left; height: 32px; padding: 0 8px; border: 0; border-radius: 2px; background: transparent;
  color: var(--ink); font-size: 13px; cursor: pointer; }
.um-pop button:hover { background: var(--surface-2); }
main { padding: 22px 28px 64px; min-width: 0; }

/* ---- page head, tabs, filter bar ------------------------------------------- */
.ph { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.ph h1 { font-size: 25px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.ph p { margin: 4px 0 0; color: var(--ink-3); max-width: 68ch; }
.ph .id { font-family: var(--mono); font-size: 11.5px; }
.ph.sub-head { margin: 20px 0 10px; }
.ph.sub-head h1 { font-size: 16px; }
.cnt-box { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line-2); border-radius: 2px; padding: 1px 7px; color: var(--ink-2); font-weight: 400; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
.actions form, .card-h form { margin: 0; display: inline-flex; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12.5px; background: transparent;
  border: 1px solid var(--line-2); border-radius: 2px; padding: 6px 12px; cursor: pointer; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.pri { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.btn.pri:hover { opacity: .9; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn.dn { color: var(--crit); border-color: var(--crit-line); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.dn:hover { background: var(--crit-wash); }
.btn.block { width: 100%; padding: 9px 12px; }
.btn svg.ic { width: 13px; height: 13px; }
.ptabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; overflow-x: auto; }
.ptabs a { padding: 9px 14px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.ptabs a:hover { color: var(--ink); }
.ptabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.ptabs a i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 6px; }
.fbar { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; flex-wrap: wrap; }
.fbar .note { margin: 0; }
.inp, .fbar input, .fbar select { font: 12.5px var(--font); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 2px;
  color: var(--ink-2); padding: 6px 10px; min-width: 0; height: auto; }
.inp.grow, .fbar input[type="search"] { flex: 1; min-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 2px; overflow: hidden; flex: none; }
.seg a, .seg button { border: 0; background: transparent; font-family: var(--mono); font-size: 11px; padding: 5px 10px; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg a.on, .seg button.on { background: var(--surface-3); color: var(--ink); }

/* ---- cards, KPI tiles, grids ------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; margin-bottom: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2 { font-size: 14px; margin: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-h .note { margin: 0; }
.card-b { padding: 12px 14px; }
.card-b > * + * { margin-top: 10px; }
.card.hl { border-color: var(--acc-line); }
.card.hl > .card-h { background: var(--accent-wash); }
.ovl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.xp { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 2px;
  color: var(--ink-2); font-size: 11.5px; background: transparent; cursor: pointer; }
.xp:hover { background: var(--surface-2); color: var(--ink); }
.xp svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.xp .x-close, dialog.xd .xp .x-open { display: none; }
dialog.xd .xp .x-close { display: inline; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid32 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-bottom: 16px; }
.grid2 > .card, .grid32 > .card, .stack > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 11px 14px; display: block; min-width: 0; }
a.kpi:hover { border-color: var(--line-2); }
.kpi.hot { border-color: var(--warn-line); }
.kpi .v { font-family: var(--mono); font-size: 23px; display: block; margin: 4px 0 2px; font-weight: 500; overflow-wrap: anywhere; }
.kpi .v small { font-size: 13px; color: var(--ink-3); }
.kpi .v.t { font-size: 15px; }
.kpi .s { font-size: 11.5px; color: var(--ink-3); display: block; }

/* ---- tables ----------------------------------------------------------------- */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 400;
  text-align: left; padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td, tr[data-detail]:hover td, tr[data-detail].open td { background: var(--row-hover); }
tr[data-detail] { cursor: pointer; }
tr.detail-row > td { padding: 0; background: var(--surface-2); }
tr.detail-row pre { max-height: 480px; }
td.n, th.n { text-align: right; font-family: var(--mono); }
td.nw { white-space: nowrap; }
table.wide { min-width: 900px; }
td.n, td .sub, td .pill { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.sub { display: block; color: var(--ink-3); font-size: 11px; font-family: var(--mono); font-weight: 400; }
.sub.cut { max-width: 240px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; }
.strong { font-weight: 600; }
.muted { color: var(--ink-3); } .good { color: var(--good); } .warn { color: var(--warn); } .crit { color: var(--crit); }
.pill { display: inline-block; font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 2px; border: 1px solid var(--line-2);
  color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.pill.good { color: var(--good); border-color: var(--good-line); background: var(--good-wash); }
.pill.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-wash); }
.pill.crit { color: var(--crit); border-color: var(--crit-line); background: var(--crit-wash); }
.pill.acc { color: var(--accent-2); border-color: var(--acc-line); background: var(--accent-wash); }
.pill.new { color: var(--warn); border-style: dashed; border-color: var(--warn-line); }
.pill + .pill { margin-left: 4px; }
/* a share as a thin bar, drawn in SVG: the CSP allows no inline style */
.meter { width: 70px; height: 5px; display: inline-block; vertical-align: middle; margin-right: 6px; border-radius: 2px; overflow: hidden; }
.meter.w120 { width: 120px; }
.meter-track { fill: var(--surface-3); }
.meter-fill { fill: var(--accent); }
.meter-fill.w { fill: var(--warn); } .meter-fill.c { fill: var(--crit); }
.note { color: var(--ink-3); font-size: 12px; margin: 0 0 16px; max-width: 90ch; }
.card-note { color: var(--ink-3); font-size: 12px; margin: 0; padding: 9px 14px; border-top: 1px solid var(--line); }
.empty { padding: 28px 14px; text-align: center; color: var(--ink-3); }

/* key / value rows */
.kv { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); margin: 0; }
.kv > dt, .kv > dd { padding: 8px 14px; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; margin: 0; }
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }
.kv > dt { color: var(--ink-3); font-family: var(--mono); font-size: 11.5px; }
.kv > dd { font-family: var(--mono); font-size: 12px; }
pre { margin: 0; padding: 12px 14px; background: var(--code-bg); font: 11.5px/1.6 var(--mono); color: var(--ink-2); overflow: auto; max-height: 440px; white-space: pre; }

/* feeds: a dot, a line, a muted line, a time on the right */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.feed li:last-child { border-bottom: 0; }
.feed li > div { min-width: 0; overflow-wrap: anywhere; }
.feed .m { color: var(--ink-3); font-size: 12px; }
.feed .tm { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; padding-left: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--ink-3); display: inline-block; }
.dot.crit { background: var(--crit); } .dot.warn { background: var(--warn); } .dot.good { background: var(--good); }

/* ---- charts ----------------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-3); padding: 8px 14px 0; list-style: none; margin: 0; }
.legend li, .legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend.inline { padding: 0; }
.sw { width: 10px; height: 3px; display: inline-block; }
.mark { font-size: 11px; }
.sw.c1, .bar.c1 { background: var(--c1); fill: var(--c1); } .sw.c2, .bar.c2 { background: var(--c2); fill: var(--c2); }
.sw.c3, .bar.c3 { background: var(--c3); fill: var(--c3); } .sw.c4, .bar.c4 { background: var(--c4); fill: var(--c4); }
.sw.c5, .bar.c5 { background: var(--c5); fill: var(--c5); } .sw.c6, .bar.c6 { background: var(--c6); fill: var(--c6); }
.sw.good, .bar.good { background: var(--good); fill: var(--good); } .sw.warn, .bar.warn { background: var(--warn); fill: var(--warn); }
.sw.crit, .bar.crit { background: var(--crit); fill: var(--crit); } .sw.off, .bar.off { background: var(--ink-3); fill: var(--ink-3); }
.mark.c1 { color: var(--c1); } .mark.c2 { color: var(--c2); }
svg.ch { display: block; width: 100%; height: auto; padding: 4px 0 6px; }
svg.ch text { fill: var(--ink-3); font: 10px var(--mono); }
svg.ch .gl { stroke: var(--grid); }
svg.ch .gl.zero { stroke: var(--ink-3); }
svg.ch .ln { fill: none; stroke-width: 1.5; stroke-linejoin: round; }
svg.ch .area { stroke: none; fill-opacity: .12; }
svg.ch .track { fill: var(--surface-3); }
svg.ch .hit { fill: transparent; }
svg.ch .hit:hover { fill: var(--ink); fill-opacity: .06; }
.ln.c1 { stroke: var(--c1); } .ln.c2 { stroke: var(--c2); } .ln.c3 { stroke: var(--c3); }
.ln.c4 { stroke: var(--c4); } .ln.c5 { stroke: var(--c5); } .ln.c6 { stroke: var(--c6); }
.ln.good { stroke: var(--good); } .ln.warn { stroke: var(--warn); } .ln.crit { stroke: var(--crit); }
.area.c1 { fill: var(--c1); } .area.c2 { fill: var(--c2); } .area.c3 { fill: var(--c3); }
.area.c4 { fill: var(--c4); } .area.c5 { fill: var(--c5); } .area.c6 { fill: var(--c6); }
.chart-empty { padding: 28px 14px; text-align: center; color: var(--ink-3); }
/* sparklines and the official-vs-ours dumbbell */
svg.spark { display: block; overflow: visible; }
.spark-cell { white-space: nowrap; } .spark-cell svg.spark { display: inline-block; vertical-align: middle; margin-right: 6px; }
svg.spark .base { stroke: var(--line-2); stroke-dasharray: 2 3; }
svg.spark polyline { fill: none; stroke-width: 1.4; }
svg.spark .good { stroke: var(--good); } svg.spark .warn { stroke: var(--warn); }
svg.spark .crit { stroke: var(--crit); } svg.spark .off { stroke: var(--c6); }
svg.spark circle.good { fill: var(--good); } svg.spark circle.warn { fill: var(--warn); }
svg.spark circle.crit { fill: var(--crit); } svg.spark circle.off { fill: var(--c6); }
.dumb { display: block; width: 100%; height: 18px; overflow: visible; }
.dumb .axis { stroke: var(--line); stroke-width: 1; }
.dumb .gap { fill: color-mix(in srgb, var(--good) 55%, transparent); }
.dumb .gap.behind { fill: color-mix(in srgb, var(--crit) 55%, transparent); }
.dumb .ours { fill: var(--c1); }
.dumb .official { fill: var(--c2); }
.hero th, .hero td { padding-left: 10px; padding-right: 10px; }
.hero tr.l0 td { background: var(--surface-2); }
.hero tr.l0 td:first-child { font-weight: 700; }
.hero tr.l1 td:first-child { padding-left: 28px; font-weight: 600; }
.hero tr.l2 td:first-child { padding-left: 46px; color: var(--ink-2); }
.hero tr[hidden] { display: none; }
.hero td.dumb-cell, .hero th.dumb-cell { min-width: 180px; }
.tree-sub { font: inherit; font-family: var(--mono); font-size: 10.5px; font-weight: 400; color: var(--accent-2); background: transparent; border: 0; padding: 0 0 0 10px; cursor: pointer; }
.tree-sub:hover { text-decoration: underline; }
.seg button + button { border-left: 1px solid var(--line-2); }
.caret { display: inline-block; width: 16px; color: var(--ink-3); cursor: pointer; user-select: none; background: none; border: 0; padding: 0; }
.cc { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line-2); border-radius: 2px; padding: 0 5px; margin-right: 6px; color: var(--ink-2); font-weight: 400; }
.matrix td { text-align: right; font-family: var(--mono); font-size: 12px; }
.matrix td:first-child { text-align: left; font-family: var(--font); }
.heat { display: inline-block; min-width: 56px; padding: 1px 6px; border-radius: 2px; }
.heat.h1 { background: color-mix(in srgb, var(--c1) 12%, transparent); } .heat.h2 { background: color-mix(in srgb, var(--c1) 24%, transparent); }
.heat.h3 { background: color-mix(in srgb, var(--c1) 36%, transparent); } .heat.h4 { background: color-mix(in srgb, var(--c1) 55%, transparent); }

/* a card enlarged over the page */
dialog.xd { width: min(1200px, 95vw); max-width: none; padding: 0; border: 0; background: transparent; color: var(--ink); }
dialog.xd::backdrop { background: var(--scrim); }
dialog.xd .card { margin: 0; }
dialog.xd svg.ch { max-height: 72vh; }
/* a small dialog, as the design's Patterns board draws it: the confirmation
   (layout.ConfirmButton, app.js) and the small edits (Upgrade, Edit). Its
   form is the body: a title, fields with their label above, a muted note,
   Cancel and the action on the right. The action comes first in the
   markup, so Enter in a field submits it rather than Cancel; the row
   reverses it on screen. */
dialog.dlg { width: min(460px, 92vw); max-width: none; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--surface);
  color: var(--ink); }
dialog.dlg::backdrop { background: var(--scrim); }
form[data-confirm-title] { display: inline-flex; margin: 0; }
.dlg-b { display: flex; flex-direction: column; gap: 10px; padding: 16px; margin: 0; }
.dlg-b h2 { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.dlg-b label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-3); }
.dlg-b [hidden] { display: none; }
.masked { -webkit-text-security: disc; }
.dlg-b input { font: 12.5px var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 2px;
  padding: 6px 10px; min-width: 0; }
.dlg-b input.mono { font: 12px var(--mono); }
.dlg-b input:focus { outline: none; border-color: var(--accent); }
.dlg-b .actions { flex-direction: row-reverse; justify-content: flex-start; }
.dlg-b .hint { font-size: 12px; }
.dlg-b label small { font-size: 11.5px; }

/* ---- forms ------------------------------------------------------------------ */
form.form { display: grid; gap: 14px; max-width: 480px; }
form.form label { display: grid; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
form.form label small { font-family: var(--font); font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
form.form input, form.form select { font: 13px var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 2px; height: 32px; padding: 0 10px; min-width: 0; }
form.form input.mono { font-family: var(--mono); font-size: 12px; }
form.form input:focus, form.form select:focus { outline: none; border-color: var(--accent); }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin: 0 0 16px; border: 1px solid var(--crit-line);
  background: var(--crit-wash); border-radius: 4px; color: var(--ink); flex-wrap: wrap; }
.alert svg.ic { color: var(--crit); }
.alert.warn { border-color: var(--warn-line); background: var(--warn-wash); }
.alert.warn svg.ic { color: var(--warn); }
.alert .btn { margin-left: auto; }
.alert .dot { margin-top: 0; }
.secret-row { display: flex; gap: 8px; flex-wrap: wrap; }
.secret-row input { flex: 1 1 220px; min-width: 0; font: 12px var(--mono); color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: 2px; height: 30px; padding: 0 10px; }
.secret-url { overflow-wrap: anywhere; font-size: 11.5px; color: var(--ink-3); }

/* ---- sign in ---------------------------------------------------------------- */
body.bare { display: flex; align-items: center; justify-content: center; padding: 40px 16px; min-height: 100vh; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.login .brand { padding: 0; }
.login-card { padding: 22px; margin: 0; }
.login-card h1 { margin: 0 0 14px; font-size: 20px; font-weight: 600; }
.login-card form.form { max-width: none; }
.login-foot { font-size: 12px; color: var(--ink-3); }

/* ---- narrow screens: the rail goes behind the menu button ------------------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 20; transform: translateX(-100%); transition: transform .15s; }
  body.rail-open .rail { transform: none; box-shadow: 0 0 0 100vmax var(--scrim); }
  .menu-btn { display: inline-flex; }
  .ctx { padding: 0 16px; }
  main { padding-left: 16px; padding-right: 16px; }
  .grid2, .grid32 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > dt { border-bottom: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }
.kv form.inline { display: inline-flex; margin: 0 0 0 8px; vertical-align: middle; }
