/* MjødNet design system. Brand rules: calm dark surfaces, one warm accent (honey),
   red only for alerts, nothing rounded (corners are cut), flat facets, IBM Plex.
   Shapes: cards are octagons, buttons and chips have two cut corners, operator chips are comb cells. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/IBMPlexSans-Regular-Latin1.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/IBMPlexSans-Medium-Latin1.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/IBMPlexSans-SemiBold-Latin1.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/IBMPlexMono-Regular-Latin1.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/IBMPlexMono-Medium-Latin1.woff2) format("woff2"); }

:root {
  /* brand palette */
  --black: #0b0b0c; --web: #202024;
  --g1: #151518; --g2: #3f3f42; --g3: #5a5a5e; --g4: #7a7a7d; --g5: #a8a8ab;
  --honey: #ffbf00; --honey-light: #ffd21f; --honey-deep: #f29a00; --honey-dark: #c48a00;
  --honey-ink: #8f5f00; /* honey as text on light surfaces: 4.5:1 or better on all of them */ --red: #ae0914; --paper: #f4f4f2;

  /* dark theme (default): surfaces, text, accent */
  --bg: var(--black); --surface: #121214; --surface-2: #1a1a1d; --line: var(--web);
  --fg: #ececee; --muted: #8d8d92; --accent: var(--honey); --accent-fg: var(--black); --link: var(--honey);
  --alert: #ea4b53; /* brand red lifted to 4.5:1 on the dark surfaces; alerts only */

  /* semantics: honey and graphite carry data, red marks what needs attention */
  --op-ai: var(--alert); --op-human: var(--honey-light); --op-script: #858588; --op-unknown: var(--g3); --op-scanner: #7b93ff;
  --intent-targeted: var(--alert); --intent-mass: var(--op-script); --intent-new: var(--op-scanner);
  --sev-high: var(--alert); --ok: var(--honey);
  /* categories: honey first, then hues far apart in tone; no red (alerts only); --c8 is "other" */
  --c1: var(--honey); --c2: #3fb0ac; --c3: #7b93ff; --c4: #b98ae6; --c5: #7cc46a; --c6: #e58fb8; --c7: #d9d2b8; --c8: var(--g3);
  --bar: var(--g2);
  --map-empty: #1d1d21; --map-lo: #4a3a10; --map-hi: var(--honey);

  --cut: 10px; --cut-s: 5px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --honey-text: var(--honey); --focus: var(--honey);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: var(--paper); --surface: #ffffff; --surface-2: #ebebe8; --line: #dcdcd8;
  --fg: #141416; --muted: #66666b; --accent: var(--honey); --accent-fg: var(--black); --link: var(--honey-ink);
  --alert: var(--red);
  --op-human: var(--honey-ink); --op-script: #6b6b6e; --intent-mass: var(--op-script); --op-unknown: var(--g5); --op-scanner: #4a68d9;
  --c1: #e8a400; --c2: #1f8a86; --c3: #4a68d9; --c4: #8a55c4; --c5: #4f9a3e; --c6: #c45a8c; --c7: #8c7a45; --c8: var(--g5);
  --bar: #b8b8bc;
  --map-empty: #e3e3df; --map-lo: #f6e2a8; --map-hi: #d48f00;
  color-scheme: light;
  --honey-text: var(--honey-ink); --focus: var(--honey-ink);
}
/* System theme: follow the OS unless the viewer picked one. No script needed, so nothing flashes. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: var(--paper); --surface: #ffffff; --surface-2: #ebebe8; --line: #dcdcd8;
    --fg: #141416; --muted: #66666b; --accent: var(--honey); --accent-fg: var(--black); --link: var(--honey-ink);
    --alert: var(--red);
    --op-human: var(--honey-ink); --op-script: #6b6b6e; --intent-mass: var(--op-script); --op-unknown: var(--g5); --op-scanner: #4a68d9;
    --c1: #e8a400; --c2: #1f8a86; --c3: #4a68d9; --c4: #8a55c4; --c5: #4f9a3e; --c6: #c45a8c; --c7: #8c7a45; --c8: var(--g5);
    --bar: #b8b8bc;
    --map-empty: #e3e3df; --map-lo: #f6e2a8; --map-hi: #d48f00;
    color-scheme: light;
    --honey-text: var(--honey-ink); --focus: var(--honey-ink);
  }
}

* { box-sizing: border-box; border-radius: 0 !important; }
body { margin: 0; font: 400 14px/1.5 var(--sans); background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover, p a, li a, dd > a { text-decoration: underline; }
h1, h2, h3, h4, b, strong { font-weight: 600; }
h1, h2, h3, h4 { margin: 0 0 12px; }
p, ul, ol, pre { margin: 12px 0; }
ul, ol { padding-left: 24px; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
small { font-size: 12px; }

/* chamfered shapes: 45° cuts, top-left and bottom-right */
.cut { clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }

header { display: flex; gap: 24px; align-items: center; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; }
.brand img { height: 24px; width: auto; display: block; }
.logo-light { display: none !important; }
:root[data-theme="light"] .logo-light { display: block !important; }
:root[data-theme="light"] .logo-dark { display: none !important; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .logo-light { display: block !important; }
  :root:not([data-theme="dark"]) .logo-dark { display: none !important; }
}
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav a { min-height: 32px; color: var(--muted); padding: 4px 12px; font-weight: 500; clip-path: polygon(var(--cut-s) 0, 100% 0, 100% calc(100% - var(--cut-s)), calc(100% - var(--cut-s)) 100%, 0 100%, 0 var(--cut-s)); }
nav a:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
nav a.on { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
main { padding: 20px; max-width: 1500px; margin: 0 auto; }

button, select, input, textarea { font: 500 13px var(--sans); padding: 8px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); }
button { cursor: pointer; clip-path: polygon(var(--cut-s) 0, 100% 0, 100% calc(100% - var(--cut-s)), calc(100% - var(--cut-s)) 100%, 0 100%, 0 var(--cut-s)); }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
button.ghost { background: transparent; }
/* Keyboard focus. --focus is honey as the theme can show it; chamfered elements (clip-path)
   would cut an outside ring off, so theirs is drawn inside. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
button:focus-visible, nav a:focus-visible, .card:focus-visible, .heat .cell:focus-visible, .tabs a.button:focus-visible, a.card:focus-visible { outline-offset: -2px; }
button.primary:focus-visible { outline-color: var(--accent-fg); }
tr.link:focus-visible { outline-offset: -2px; }
tr.link:focus-visible td { background: var(--surface-2); }

.card { background: var(--surface); border: 1px solid var(--line); padding: 20px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: 0; color: var(--fg); display: flex; justify-content: flex-start; align-items: center; gap: 8px; }
.card h3 small { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: auto; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); margin-bottom: 16px; }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
@media (max-width: 1100px) { .s3, .s4, .s5, .s6, .s7, .s8 { grid-column: span 12; } .kpis .s3 { grid-column: span 6; } }
.kpi .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi-link { color: inherit; text-decoration: none; display: block; }
.kpi-link:hover { border-color: var(--accent); text-decoration: none; }
.kpi-link .v { color: var(--fg); }
.kpi-link .l { color: var(--link); }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.toolbar h2 { margin: 0 8px 0 0; font-size: 20px; }
.toolbar.center { justify-content: center; }
.filters select, .filters input { max-width: 13rem; }
.check { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.check input { accent-color: var(--honey); }
.muted { color: var(--muted); }
.mono, code { font-family: var(--mono); font-size: 13px; word-break: break-all; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--surface-2); }
td.n { text-align: right; font-variant-numeric: tabular-nums; }
td.clip { max-width: 34rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.clip > div { overflow: hidden; text-overflow: ellipsis; }
td.nowrap, span.nowrap { white-space: nowrap; }
table.wide td.clip { max-width: 13rem; }
table.fixed { table-layout: fixed; }
table.delta col:first-child { width: 52%; } table.delta col + col { width: 16%; }
table.fixed td.clip { max-width: none; }
table.fixed th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.wide td .tag.camp { white-space: normal; }
table.wide td:has(> .tag.camp) { max-width: 11rem; }
.card.scroll-x, .card { overflow-x: auto; }
.card:has(> dl.kv), .card:has(form) { overflow-x: visible; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); font-size: 12px; margin: 0 4px 4px 0; white-space: nowrap; color: var(--muted);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px); }
/* clip-path cuts the border off with the corner; draw the 1px diagonal back in the border colour,
   just inside the cut. --chamfer is the cut size of the element. */
.tag:not(.item-state), .heat .cell, button { position: relative; }
.tag:not(.item-state), .heat .cell { --chamfer: 4px; }
button { --chamfer: var(--cut-s); }
.tag:not(.item-state)::before, .tag:not(.item-state)::after, .heat .cell::before, .heat .cell::after, button::before, button::after {
  content: ""; position: absolute; width: calc(var(--chamfer) * 1.4142); height: 0; border: 0 solid; border-color: inherit;
  transform: rotate(-45deg); pointer-events: none; }
.tag:not(.item-state)::before, .heat .cell::before, button::before { left: -1px; top: calc(var(--chamfer) - 1px); border-top-width: 1px; transform-origin: 0 0; }
.tag:not(.item-state)::after, .heat .cell::after, button::after { left: calc(100% + 1px - var(--chamfer)); bottom: -1px; border-bottom-width: 1px; transform-origin: 0 100%; }
.tag .dot { width: 7px; height: 7px; background: currentColor; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.op-human { color: var(--op-human); border-color: var(--op-human); }
.op-script { color: var(--op-script); border-color: var(--op-script); }
.op-scanner { color: var(--op-scanner); border-color: var(--op-scanner); }
.op-ai-agent { color: var(--op-ai); border-color: var(--op-ai); font-weight: 500; }
.op-unknown, .op-pending { color: var(--op-unknown); }
.in-mass { color: var(--intent-mass); border-color: var(--intent-mass); }
.in-new { color: var(--intent-new); border-color: var(--intent-new); }
.in-targeted { color: var(--intent-targeted); border-color: var(--intent-targeted); font-weight: 500; }
.tag.camp { color: var(--fg); border-color: var(--line); background: var(--surface-2); }
.sev-high { color: var(--sev-high); }
.svc { display: inline-flex; align-items: center; gap: 8px; }
.svc svg { width: 16px; height: 16px; flex: none; color: var(--muted); }

.bar-list { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 14px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { grid-column: 1 / -1; height: 5px; background: var(--surface-2); overflow: hidden; margin-top: -4px; }
.bar-row .fill { height: 100%; background: var(--bar); }
.bar-row.top .fill { background: var(--honey); }
.bar-row .lbl { color: var(--fg); }

svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { fill: var(--muted); font-size: 12px; font-family: var(--mono); }
svg.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend.live span { cursor: default; }
.legend.live span { transition: opacity .2s; }
.legend.live span.dim { opacity: .4; }
svg.chart path[data-key] { transition: opacity .2s; }
svg.chart.focus path[data-key] { opacity: .25; }
svg.chart.focus path[data-key].on { opacity: 1; }
.legend i { width: 10px; height: 10px; display: inline-block; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.tip { position: fixed; pointer-events: none; background: var(--fg); color: var(--bg); padding: 4px 8px; font-size: 13px; z-index: 20; max-width: 320px; }

.heat { display: grid; gap: 8px; }
.heat .tac { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-bottom: 4px; }
.heat .cells { display: flex; flex-wrap: wrap; gap: 4px; }
.heat .cell { background: var(--surface-2); padding: 2px 8px; font-size: 12px; border: 1px solid var(--line); font-family: var(--mono); color: var(--fg); text-decoration: none;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline td:first-child { white-space: nowrap; color: var(--muted); font-family: var(--mono); font-size: 13px; }
details summary { cursor: pointer; min-height: 24px; } /* 24px: the smallest target WCAG 2.2 allows */
details pre { white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; padding: 8px 12px; background: var(--surface-2); border-left: 2px solid var(--accent); }
.error { color: var(--sev-high); }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }

/* sign-in: the comb behind the mark */
body.login { background: var(--black) url(brand/honeycomb-tile.svg) repeat; background-size: 60px auto; }
body.login header nav, body.login header button { visibility: hidden; }
/* The login card is dark in both themes: links and focus keep dark-theme honey. */
#login-form { --link: var(--honey); --focus: var(--honey); max-width: 440px; margin: 80px auto; display: grid; gap: 16px; padding: 24px; background: rgba(18, 18, 20, .94); border: 1px solid var(--web); color: #ececee; }
/* Cards and the login card are octagons. The diagonals are corner backgrounds, so they stay put in
   cards that scroll sideways. Comes after both background shorthands. */
.card, #login-form { --chamfer: var(--cut); --chamfer-line: var(--line);
  clip-path: polygon(var(--chamfer) 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, var(--chamfer) 100%, 0 calc(100% - var(--chamfer)), 0 var(--chamfer));
  background-image: linear-gradient(135deg, transparent calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071 + 1px), transparent calc(var(--chamfer) * .7071 + 1px)),
    linear-gradient(225deg, transparent calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071 + 1px), transparent calc(var(--chamfer) * .7071 + 1px)),
    linear-gradient(45deg, transparent calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071 + 1px), transparent calc(var(--chamfer) * .7071 + 1px)),
    linear-gradient(315deg, transparent calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071), var(--chamfer-line) calc(var(--chamfer) * .7071 + 1px), transparent calc(var(--chamfer) * .7071 + 1px));
  background-size: var(--chamfer) var(--chamfer); background-position: top left, top right, bottom left, bottom right; background-repeat: no-repeat; background-origin: border-box; }
#login-form { --chamfer: 16px; --chamfer-line: var(--web); }
.kpi-link:hover { --chamfer-line: var(--accent); }
#login-form .mark { width: 72px; height: 72px; margin: 0 auto 4px; display: block; }
#login-form h3 { margin: 0; text-align: center; font-size: 16px; text-transform: none; letter-spacing: 0; justify-content: center; }
#login-form h3::before { display: none; }
#login-form p { margin: 0; text-align: center; font-size: 14px; color: #8d8d92; }
#login-form input { background: #0b0b0c; color: #ececee; border-color: var(--web); font-family: var(--mono); }

main { transition: opacity .15s; }
body.busy main { opacity: .45; transition-delay: .2s; pointer-events: none; }

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover, th.sorted { color: var(--fg); }

/* Insights */
.kpi .trend { color: var(--muted); font-size: 12px; margin-top: 4px; }
td.up, .trend.up { color: var(--fg); font-weight: 600; }
td.down, .trend.down { color: var(--muted); }
h3.section { margin: 24px 0 4px; font-weight: 500; font-size: 12px; letter-spacing: 0; color: var(--muted); }
.card h4 { margin: 16px 0 8px; font-size: 12px; letter-spacing: 0; color: var(--muted); font-weight: 500; }
dl.kv { margin-bottom: 8px; }
.tag.alert { background: var(--red); color: #fff; border-color: var(--red); }

/* Heatmap: weekday × hour */
.hm { display: grid; grid-template-columns: 2.4rem repeat(24, 1fr); gap: 4px; font-size: 11px; font-family: var(--mono); }
.hm-h { color: var(--muted); text-align: left; }
.hm-d { color: var(--muted); align-self: center; }
.hm-c { aspect-ratio: 1; background: var(--line); min-width: 0; }
.toolbar button.on { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); font-weight: 500; }

.explain { font-family: var(--sans, inherit); font-size: 13px; margin: 4px 0 4px; color: var(--fg); white-space: normal; }
.explain ol { margin: 4px 0 4px 20px; padding: 0; }
.explain details summary { cursor: pointer; font-size: 12px; }
button.small { font-size: 12px; padding: 4px 8px; margin-top: 4px; }

.tag.premium { padding: 2px 8px; background: transparent; color: var(--muted); border: 1px solid var(--line); font-size: 12px; letter-spacing: 0; margin-left: 8px; vertical-align: middle; }
#me { font-size: 12px; margin-left: auto; }
/* The login card is dark in both themes: the SSO button keeps its own colours, not the theme's --fg/--line. */
#login-form a.button { display: block; text-align: center; padding: 8px; border: 1px solid var(--web); color: #ececee; background: #0b0b0c; text-decoration: none; }
#login-form a.button:hover, #login-form a.button:focus-visible { border-color: var(--accent); color: var(--accent); }
#login-form input { width: 100%; margin-bottom: 8px; }

.tabs a.button { padding: 4px 12px; border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.tabs a.button.on { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); font-weight: 500; }

dl.settings dd { margin-bottom: 12px; }

/* Grouped navigation */
nav details.menu { position: relative; display: inline-block; }
nav details.menu summary { min-height: 32px; list-style: none; cursor: pointer; padding: 4px 12px; font-weight: 500; color: var(--muted); user-select: none; }
nav details.menu summary::-webkit-details-marker { display: none; }
nav details.menu summary::after { content: " ▾"; font-size: 12px; }
nav details.menu.on summary, nav details.menu[open] summary { color: var(--fg); }
nav details.menu.on summary { background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
nav details.menu > div { position: absolute; top: 100%; left: 0; z-index: 20; min-width: 11rem; padding: 4px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; }
nav details.menu > div a { display: block; padding: 4px 8px; white-space: nowrap; }

.card.secret { border: 1px solid var(--accent); margin-bottom: 16px; }
.card.secret pre { white-space: pre-wrap; word-break: break-all; margin: 8px 0; }

/* Footer: the bee keeps watch */
footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px 16px 32px; color: var(--muted); font-size: 12px; }
footer img { width: 18px; height: 18px; }
body.login footer { position: fixed; bottom: 0; left: 0; right: 0; color: #8d8d92; }

.tag.warn { color: var(--honey-text); border-color: var(--accent); }

/* Terminal replay: always dark, like a terminal */
pre.term { background: #0b0b0c; color: #e6e6e6; padding: 12px 16px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; font: 13px/1.45 var(--mono); margin: 8px 0 0; }

/* Brand progress and loader (handoff: progress.css, loader.css) */
/* MjødNet comb progress bar: two interlocked rows of hex cells that fill with honey left to right.
   Determinate: set --p (0…1) on .mj-comb, e.g. style="--p:.42". Indeterminate: add class .mj-busy.
   Size with font-size (1em = one cell width). Light pages: add .mj-light.
   Markup: <div class="mj-comb" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="42" style="--p:.42">
             <i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
           </div>   (18 cells: top and bottom row alternate) */
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }
.mj-comb {
  --n: 18;                     /* number of cells */
  --mj-cell: #2a2a2e;                /* empty cell */
  --mj-rim: #45454a;                 /* cell outline facet */
  --mj-honey: #ffbf00; --mj-honey-deep: #e08600;
  position: relative; display: inline-block; font-size: 16px;
  width: calc(9em + .5em + 8*.06em); height: calc(1.155em*1.75 + .06em);
}
.mj-comb.mj-light { --mj-cell: #e2e2de; --mj-rim: #c8c8c4; --mj-honey: #ffbf00; --mj-honey-deep: #d89a00; }
.mj-comb i {
  --fill: clamp(0, var(--p)*var(--n) - var(--i), 1);     /* 0 … 1 for this cell */
  position: absolute; width: 1em; height: 1.155em;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(135deg, var(--mj-rim) 50%, var(--mj-cell) 50%);
}
.mj-comb i::before {               /* honey rises from the bottom of the cell */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--fill)*100%);
  background: linear-gradient(135deg, var(--mj-honey) 50%, var(--mj-honey-deep) 50%);
}
.mj-comb i:nth-child(1) { --i: 0; left: calc(0*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(2) { --i: 1; left: calc(0*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(3) { --i: 2; left: calc(1*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(4) { --i: 3; left: calc(1*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(5) { --i: 4; left: calc(2*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(6) { --i: 5; left: calc(2*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(7) { --i: 6; left: calc(3*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(8) { --i: 7; left: calc(3*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(9) { --i: 8; left: calc(4*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(10) { --i: 9; left: calc(4*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(11) { --i: 10; left: calc(5*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(12) { --i: 11; left: calc(5*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(13) { --i: 12; left: calc(6*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(14) { --i: 13; left: calc(6*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(15) { --i: 14; left: calc(7*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(16) { --i: 15; left: calc(7*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb i:nth-child(17) { --i: 16; left: calc(8*1.06em + 0*1.06em); top: 0; }
.mj-comb i:nth-child(18) { --i: 17; left: calc(8*1.06em + 0.5*1.06em); top: calc(1.155em*.75 + .06em); }
.mj-comb.mj-busy { animation: mj-fill 2.4s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes mj-fill { 0% { --p: 0; } 80%, 100% { --p: 1; } }
@media (prefers-reduced-motion: reduce) { .mj-comb.mj-busy { animation: none; --p: .5; } }

/* MjødNet CSS loader: a 7-cell honeycomb that builds up (ring clockwise, honey core last) and
   collapses, 1.8 s loop. Size with --mj-unit (defaults to 1em per cell). Colours follow the --mj-* tokens.
   Markup: <span class="mj-loader" role="status" aria-label="Loading"><i></i><i></i><i></i><i></i><i></i><i></i><i></i></span> */
.mj-loader {
  --mj-unit: 1em;
  --mj-cell: #5e5e61;       /* ring cells: graphite */
  --mj-honey: #ffbf00;      /* core cell */
  --mj-edge: #ffd21f;       /* top-left facet of the core */
  position: relative; display: inline-block;
  width: calc(3.2 * var(--mj-unit)); height: calc(3.2 * var(--mj-unit)); font-size: 16px; vertical-align: middle;
}
.mj-loader.mj-light { --mj-cell: #3f3f42; --mj-honey: #e8a400; --mj-edge: #ffbf00; }
.mj-loader i {
  position: absolute; width: calc(1 * var(--mj-unit)); height: calc(1.155 * var(--mj-unit));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  /* two flat facets, light top-left and darker bottom-right: low-poly, no gradient */
  background: linear-gradient(135deg, color-mix(in srgb, var(--mj-cell) 100%, white 18%) 50%, var(--mj-cell) 50%);
  transform: scale(.15); opacity: 0;
  animation: mj-build 1.8s cubic-bezier(.4, 0, .2, 1) infinite;
}
.mj-loader i:last-child { background: linear-gradient(135deg, var(--mj-edge) 50%, var(--mj-honey) 50%); }
.mj-loader i:nth-child(1) { left: calc(50% + calc(0.530 * var(--mj-unit)) - calc(.5 * var(--mj-unit))); top: calc(50% + calc(-0.918 * var(--mj-unit)) - calc(.577 * var(--mj-unit))); animation-delay: 0.0s; }
.mj-loader i:nth-child(2) { left: calc(50% + calc(1.060 * var(--mj-unit)) - calc(.5 * var(--mj-unit))); top: calc(50% + calc(0.000 * var(--mj-unit)) - calc(.577 * var(--mj-unit))); animation-delay: 0.1s; }
.mj-loader i:nth-child(3) { left: calc(50% + calc(0.530 * var(--mj-unit)) - calc(.5 * var(--mj-unit))); top: calc(50% + calc(0.918 * var(--mj-unit)) - calc(.577 * var(--mj-unit))); animation-delay: 0.2s; }
.mj-loader i:nth-child(4) { left: calc(50% + calc(-0.530 * var(--mj-unit)) - calc(.5 * var(--mj-unit))); top: calc(50% + calc(0.918 * var(--mj-unit)) - calc(.577 * var(--mj-unit))); animation-delay: 0.3s; }
.mj-loader i:nth-child(5) { left: calc(50% + calc(-1.060 * var(--mj-unit)) - calc(.5 * var(--mj-unit))); top: calc(50% + calc(0.000 * var(--mj-unit)) - calc(.577 * var(--mj-unit))); animation-delay: 0.4s; }
.mj-loader i:nth-child(6) { left: calc(50% + calc(-0.530 * var(--mj-unit)) - calc(.5 * var(--mj-unit))); top: calc(50% + calc(-0.918 * var(--mj-unit)) - calc(.577 * var(--mj-unit))); animation-delay: 0.5s; }
.mj-loader i:nth-child(7) { left: calc(50% + calc(0.000 * var(--mj-unit)) - calc(.5 * var(--mj-unit))); top: calc(50% + calc(0.000 * var(--mj-unit)) - calc(.577 * var(--mj-unit))); animation-delay: 0.6s; }
@keyframes mj-build {
  0%       { transform: scale(.15); opacity: 0; }
  14%      { transform: scale(1);   opacity: 1; }
  78%      { transform: scale(1);   opacity: 1; }
  92%,100% { transform: scale(.15); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mj-loader i { animation: none; transform: none; opacity: 1; }
  .mj-loader i:last-child { animation: mj-pulse 1.8s ease-in-out infinite; }
  @keyframes mj-pulse { 50% { opacity: .45; } }
}

/* Light theme versions follow the page theme, not a class. */
:root[data-theme="light"] .mj-comb { --mj-cell: #e2e2de; --mj-rim: #c8c8c4; --mj-honey-deep: #d89a00; }
:root[data-theme="light"] .mj-loader { --mj-cell: #3f3f42; --mj-honey: #e8a400; --mj-edge: #ffbf00; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .mj-comb { --mj-cell: #e2e2de; --mj-rim: #c8c8c4; --mj-honey-deep: #d89a00; }
  :root:not([data-theme="dark"]) .mj-loader { --mj-cell: #3f3f42; --mj-honey: #e8a400; --mj-edge: #ffbf00; }
}
/* Header progress: shown while a page loads */
header .mj-comb { font-size: 5px; visibility: hidden; margin: 0 8px; }
body.busy header .mj-comb { visibility: visible; }
.page-loader { display: flex; justify-content: center; padding: 64px 0; }
.page-loader img { width: 180px; height: 180px; }
.page-loader .comb-light { display: none; }
:root[data-theme="light"] .page-loader .comb-light { display: block; } :root[data-theme="light"] .page-loader .comb-dark { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .page-loader .comb-light { display: block; } :root:not([data-theme="dark"]) .page-loader .comb-dark { display: none; } }
button .mj-loader { --mj-unit: 4px; margin-right: 8px; }
/* Login badge */
#login-form .badge-dark, #login-form .badge-light { width: auto; height: 64px; margin: 8px auto 16px; display: block; }
#login-form .badge-light { display: none; }
:root[data-theme="light"] #login-form .badge-light { display: block; } :root[data-theme="light"] #login-form .badge-dark { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) #login-form .badge-light { display: block; } :root:not([data-theme="dark"]) #login-form .badge-dark { display: none; } }

/* hidden always wins over display rules */
[hidden] { display: none !important; }

/* Infrastructure graph */
.infra-graph { width: 100%; height: auto; display: block; }
.infra-graph .edge { stroke: var(--line); stroke-width: 1; }
.infra-graph .edge.calls { stroke: var(--alert); stroke-dasharray: 3 3; opacity: .7; }
.infra-graph .node { stroke: var(--bg); stroke-width: 1; }
.infra-graph .node.source { fill: var(--g4); }
.infra-graph .node.source.listed { fill: var(--g4); stroke: var(--honey); stroke-width: 2; }
.infra-graph .node.host { fill: var(--g5); }
.infra-graph .node.host.listed { stroke: var(--fg); stroke-width: 2; }
.infra-graph .node.payload { fill: var(--g3); }
.infra-graph .node.c2 { fill: var(--alert); }
.infra-graph .node.link { cursor: pointer; }
.infra-graph .label { fill: var(--muted); font: 11px var(--mono); }
.graph-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 8px; vertical-align: -1px; }
.graph-legend .dot.source { background: var(--g4); } .graph-legend .dot.host { background: var(--g5); }
.graph-legend .dot.payload { background: var(--g3); border-radius: 0; } .graph-legend .dot.c2 { background: var(--alert); }
.graph-legend .dot.listed { background: transparent; border: 2px solid var(--honey); }
tr[data-cluster].on td { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.graph-wrap { position: relative; }
.graph-tip { position: absolute; z-index: 5; max-width: 250px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; line-height: 1.35; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.graph-tip b { display: block; color: var(--fg); font-weight: 600; margin-bottom: 4px; }
.graph-tip .mono { font-family: var(--mono); word-break: break-all; }
.graph-tip .tags { color: var(--muted); }
.infra-graph.focus .node:not(.near) { opacity: .25; }
.infra-graph.focus .edge:not(.hot) { opacity: .15; }
.infra-graph .edge.hot { stroke: var(--accent); stroke-width: 1.5; }

/* Phones and narrow windows: logo and buttons on the first row, the menu below at full width. */
@media (max-width: 760px) {
  header { flex-wrap: wrap; gap: 4px 8px; padding: 8px 16px; }
  header .brand { margin-right: auto; }
  header .brand img { width: 104px; height: auto; }
  header nav { order: 10; flex: 1 0 100%; gap: 4px; margin: 0 -8px; }
  nav a, nav details.menu summary { padding: 8px 8px; font-size: 16px; }
  /* Menus open under the whole menu bar, left-aligned, so none runs off the screen. */
  header nav { position: relative; }
  nav details.menu { position: static; }
  nav details.menu > div { left: .4rem; right: .4rem; top: 100%; min-width: 0; }
  header .mj-comb { display: none; }
  #me { font-size: 13px; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #logout { padding: 4px 8px; font-size: 14px; white-space: nowrap; }
  #me { max-width: 7.5rem; }
}

/* Phones and tablets (one column of cards): wide tables scroll sideways inside their card
   instead of squeezing columns to a word per line. */
@media (max-width: 1100px) {
  .card { -webkit-overflow-scrolling: touch; }
  .card table th, .card table td { white-space: nowrap; }
  .card table td.clip, .card table td.mono { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
  .card table td:not(.clip):not(.mono) { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 760px) {
  .card h3 { display: block; }
  .card h3 small { display: block; margin: 4px 0 0; }
  .card p, .card li, .card dd { overflow-wrap: anywhere; }
}

/* Phones: label above its field, fields full width. */
@media (max-width: 760px) {
  dl.kv { grid-template-columns: 1fr; row-gap: 4px; }
  dl.kv dt { margin-top: 8px; }
  dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
  dl.kv dd input:not([type=checkbox]):not([type=radio]), dl.kv dd select, dl.kv dd textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
}
@media (max-width: 440px) { #me { display: none; } }

/* Replay: input the terminal never echoed (scripts on stdin, exec commands) */
.term .term-in { display: block; color: var(--honey-text); border-left: 2px solid var(--accent); padding-left: 8px; margin: 4px 0; opacity: .9; }
.replay-clock { margin-left: auto; }

/* Behaviour page: operator tags take the operator colour, sparklines sit in table rows. */
/* Operator chips are comb cells: a flat hexagon pointing left and right. A border cannot follow the
   slanted sides, so the outline is a hollow polygon in ::before, one seam joining its outer and inner rings. */
.tag:is(.op-human, .op-script, .op-scanner, .op-ai-agent, .op-unknown, .op-pending) { --op-line: var(--op-unknown); padding: 2px 12px; border-color: transparent;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 50%, calc(100% - 7px) 100%, 7px 100%, 0 50%); }
.tag.op-human { --op-line: var(--op-human); } .tag.op-script { --op-line: var(--op-script); } .tag.op-scanner { --op-line: var(--op-scanner); }
.tag.op-ai-agent { --op-line: var(--op-ai); color: var(--op-ai); }
.tag:is(.op-human, .op-script, .op-scanner, .op-ai-agent, .op-unknown, .op-pending)::before { inset: -1px; width: auto; height: auto; border: 0; transform: none; background: var(--op-line);
  clip-path: polygon(evenodd, 7px 0, calc(100% - 7px) 0, 100% 50%, calc(100% - 7px) 100%, 7px 100%, 0 50%, 7px 0,
    7.55px 1px, calc(100% - 7.55px) 1px, calc(100% - 1.2px) 50%, calc(100% - 7.55px) calc(100% - 1px), 7.55px calc(100% - 1px), 1.2px 50%, 7.55px 1px); }
.tag:is(.op-human, .op-script, .op-scanner, .op-ai-agent, .op-unknown, .op-pending)::after { content: none; }
svg.spark { display: block; }
.nets-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.nets-row input:first-child { flex: 1 1 9rem; max-width: 13rem; min-width: 0; }
.nets-row input:nth-child(2) { flex: 2 1 10rem; min-width: 0; }

/* Settings → General: two-column layout, section nav, widgets, sticky save bar */
.settings-layout { display: grid; grid-template-columns: 14rem 1fr; gap: 16px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 4.5rem; }
.settings-section { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 8px; color: var(--muted);
  border-left: 2px solid transparent; }
.settings-section:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
.settings-section.on { color: var(--fg); font-weight: 500; background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.settings-section .tag { margin: 0; color: var(--muted); border-color: var(--line); }
.settings-content { min-width: 0; }
.settings-content .card { margin-bottom: 16px; }
.settings-warn { margin-bottom: 12px; display: block; white-space: normal; }
.setting-item { display: contents; }
dl.settings dt.changed { color: var(--fg); font-weight: 600; position: relative; padding-left: 12px; }
dl.settings dt.changed::before { content: ""; position: absolute; left: 0; top: .35em; width: 6px; height: 6px; background: var(--accent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.reset-link { font-size: 12px; }

.save-bar { position: sticky; bottom: 0; z-index: 4; display: flex; gap: 12px; align-items: center; padding: 12px 16px; margin-top: 16px;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .25); }

/* bool: a styled checkbox switch */
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { display: inline-block; width: 2.2rem; height: 1.2rem; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex: none; }
.switch-track::before { content: ""; position: absolute; top: 1px; left: 1px; width: 1rem; height: 1rem; background: var(--muted); transition: transform .1s, background .1s; }
.switch-input:checked + .switch-track { border-color: var(--accent); }
.switch-input:checked + .switch-track::before { transform: translateX(1rem); background: var(--accent); }
.switch-input:focus-visible + .switch-track { outline: 1px solid var(--accent); outline-offset: 1px; }

.duration-input { display: inline-flex; gap: 8px; align-items: center; }

/* choice: segmented buttons */
.segmented { display: inline-flex; }
.segmented button { border-radius: 0; margin: 0; }
.segmented button + button { margin-left: -1px; }
.segmented button.on { background: var(--surface-2); color: var(--fg); border-color: var(--line); box-shadow: inset 0 -2px 0 var(--accent); z-index: 1; position: relative; }

/* kinds: a checkbox list with label and help per row */
.kinds-list { display: grid; gap: 8px; }
.kinds-row { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.kinds-row input { margin-top: 4px; }

/* cidrs/list: single-column row editor, reuses the nets-row look */
.rows-row { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.rows-row input { flex: 1 1 auto; min-width: 0; }

@media (max-width: 760px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .settings-section { border-left: none; border-bottom: 2px solid transparent; padding: 4px 8px; }
  .settings-section.on { border-bottom-color: transparent; }
  /* an entry wraps onto two lines: keep each one visibly together */
  .nets-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
  .nets-row input:first-child { max-width: none; }
}

/* Long commands and URLs wrap instead of widening the page. */
pre.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Session replay and measured input timing. Colours follow both console themes. */
.replay-stack { display: grid; gap: 16px; }
.replay-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 28%); gap: 16px; }
.replay-main, .replay-rail { min-width: 0; }
.term.replay-terminal { background: var(--bg); color: var(--fg); padding: 12px 16px; max-height: 420px; min-height: 160px; overflow: auto; font: 12px/1.5 var(--mono); }
.replay-line { min-height: 1.5em; white-space: pre-wrap; overflow-wrap: anywhere; }
.replay-terminal .term-in { display: inline; color: var(--honey-text); border: 0; padding: 0; margin: 0; background: var(--surface-2); opacity: 1; }
.replay-burst { display: inline-block; margin-left: 8px; padding: 0 8px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); font: 12px/1.6 var(--sans); vertical-align: middle; white-space: normal; }
.replay-meter { min-height: 32px; padding: 4px 0; color: var(--honey-text); font-size: 12px; }
.replay-rail > input { width: 100%; margin-bottom: 8px; }
.replay-commands { max-height: 550px; overflow: auto; }
.replay-command { display: flex; flex-wrap: wrap; gap: 4px 8px; text-align: left; width: 100%; margin-bottom: 4px; padding: 8px; min-height: 32px; font-size: 12px; }
.replay-command code { flex: 1 1 100%; overflow-wrap: anywhere; white-space: pre-wrap; font: 12px/1.5 var(--mono); }
.replay-command.current { border-color: var(--accent); background: var(--surface-2); }
.replay-command[hidden], .replay-line[hidden] { display: none; }
.replay-scrub, .replay-rhythm { display: block; width: 100%; height: 70px; background: var(--surface-2); }
.replay-scrub { cursor: crosshair; touch-action: none; }
.replay-scrub:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay-rhythm { height: 24px; margin-top: 8px; }
.replay-cursor { stroke: var(--fg); stroke-width: 2; }
.replay-match { stroke: var(--alert); stroke-width: 2; }
.replay-chapter { fill: var(--accent); }
.replay-chapters { display: flex; gap: 4px; flex-wrap: wrap; padding-top: 4px; }
.replay-chapters button { min-height: 24px; min-width: 24px; font-size: 12px; }
.replay-caption { font-size: 12px; margin: 8px 0; }
.toolbar button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); font-weight: 500; }
.typing-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 24px; }
.typing-signals { display: block; font-size: 12px; }
.typing-signals dt { font-weight: 600; margin-top: 12px; }
.typing-signals dd { margin: 4px 0 16px; color: var(--muted); overflow-wrap: anywhere; }
.typing-chart { min-width: 0; }
.typing-grid h4 { margin: 8px 0; }
.replay-assumption { stroke: var(--muted); stroke-dasharray: 5 4; }
@media (max-width: 800px) {
  .replay-grid, .typing-grid { grid-template-columns: minmax(0, 1fr); }
  .replay-commands { max-height: 280px; }
}
.typing-chart-scroll { overflow-x: auto; }
.typing-chart-scroll svg.typing-chart { min-width: 600px; }
.replay-chapter:focus-visible { outline: 2px solid var(--accent); }

/* Reduced motion: no transitions; the loaders above already stop or slow down. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Shared evidence drawer and vertical lure journey. */
.drawer-backdrop { position: fixed; inset: 0; z-index: 100; background: rgb(0 0 0 / .55); display: flex; justify-content: flex-end; }
.evidence-drawer { width: min(42rem, 90vw); height: 100%; background: var(--surface); color: var(--fg); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; animation: drawer-enter .18s ease-out; }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-heading h2 { margin: 0; font-size: 16px; }
.drawer-body { overflow-y: auto; overflow-x: hidden; padding: 20px; min-height: 0; overflow-wrap: anywhere; }
.drawer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.journey-timeline { list-style: none; padding: 0 0 0 12px; margin: 0; }
.journey-step { position: relative; border-left: 1px solid var(--line); padding: 0 0 24px 20px; min-width: 0; }
.journey-step::before { content: ""; position: absolute; width: 7px; height: 7px; background: var(--accent); left: -4px; top: .5rem; }
.journey-step h3 { margin: 0 0 4px; font-size: 16px; }
.journey-step p { margin: 8px 0; }
.journey-elapsed { font-family: var(--mono); font-size: 12px; padding-bottom: 8px; }
.journey-step:has(> .journey-elapsed)::before { top: 2.2rem; }
.journey-shown { display: flex; flex-direction: column; }
.lure-hit-message { max-width: 24rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.journey-message { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.journey-delivery { padding-left: 12px; border-left: 2px solid var(--line); }
@keyframes drawer-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 759px) { .evidence-drawer { width: 100%; } .drawer-body { padding: 16px; } }
@media (prefers-reduced-motion: reduce) { .evidence-drawer { animation: none; } }

/* Inbox keeps triage context quiet and evidence tables inside their cards. */
.inbox-health { margin: 0 0 4px; }
.inbox-traffic { margin: 0 0 16px; }
.inbox-states { gap: 4px; }
.inbox-mine { display: inline-flex; align-items: center; gap: 4px; }
.inbox-status { min-height: 32px; margin: 8px 0; }
.inbox-shortcuts { padding: 12px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 8px; }
.inbox-table { min-width: 1060px; }
.inbox-table td:first-child, .inbox-table th:first-child { width: 3rem; }
.inbox-row:focus { outline: 1px solid var(--focus); outline-offset: -2px; background: var(--surface-2); }
.inbox-row:has(input:checked) td { background: var(--surface-2); }
.tag.item-state { border: 0; padding: 2px 0; color: var(--muted); clip-path: none; }
.tag.item-state-new { color: var(--fg); }
.item-state-new::before { content: ""; width: 6px; height: 6px; background: var(--honey); flex: none; }
.item-state-resolved { color: var(--muted); }
.item-back { display: inline-block; margin-bottom: 12px; }
.item-stack { display: grid; gap: 16px; min-width: 0; }
.item-stack .kv dd { overflow-wrap: anywhere; min-width: 0; }
.item-note-form { display: grid; gap: 8px; justify-items: start; }
.item-note-form textarea { width: 100%; min-height: 6rem; resize: vertical; }
.item-notes article { border-bottom: 1px solid var(--line); margin-bottom: 12px; padding-bottom: 8px; }
.item-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.item-activity { margin: 0; padding-left: 20px; overflow-wrap: anywhere; }
.item-activity li + li { margin-top: 8px; }
@media (max-width: 760px) {
  .item-actions { align-items: stretch; }
  .item-actions > button, .item-actions > a { flex: 1 1 9rem; text-align: center; }
  .inbox-states .button { padding: 4px 8px; }
  .inbox-shortcuts { overflow-wrap: anywhere; }
}

/* Brief facts remain readable on phones and on paper. */
.brief-page { max-width: 64rem; margin: 0 auto; overflow-wrap: anywhere; }
.brief-heading { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.brief-heading h2 { flex: 1 1 20rem; margin: 8px 0; }
.brief-outcome { font-size: 20px; line-height: 1.55; margin: 24px 0; }
.brief-receipts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; margin: 0; }
.brief-receipts dt { color: var(--muted); font-size: 14px; }
.brief-receipts dd { margin: 4px 0 0; font-weight: 600; white-space: pre-wrap; }
.brief-page .journey-step:last-child { padding-bottom: 0; }
.brief-page .journey-step time { font: 13px var(--mono); }
.brief-indicators { padding-left: 20px; overflow-wrap: anywhere; }
.brief-sharing { margin-top: 16px; }
.brief-created input { flex: 1 1 18rem; min-width: 0; }
.brief-links { padding: 0; list-style: none; }
.brief-links li { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 12px 0; }
.brief-links button { flex: none; }
.brief-footer { margin-top: 24px; }
@media (max-width: 600px) {
  .brief-receipts { grid-template-columns: minmax(0, 1fr); }
  .brief-controls, .brief-sharing .toolbar, .brief-links li { flex-direction: column; align-items: stretch; }
  .brief-created input { flex: auto; width: 100%; }
  .brief-heading h2 { flex-basis: 100%; }
}
@media print {
  @page { size: A4; margin: 68px; }
  body:has(.brief-page) { background: white; color: black; }
  body:has(.brief-page) > header, body:has(.brief-page) > footer,
  .brief-page .brief-controls, .brief-page .brief-sharing, .brief-page [role="status"] { display: none !important; }
  body:has(.brief-page) main { max-width: none; margin: 0; padding: 0; opacity: 1; }
  .brief-page { max-width: none; --fg: black; --muted: #444; --line: #bbb; --accent: #555; --honey-text: #444; --surface: white; }
  .brief-page .card { background: none; border: 1px solid #bbb; box-shadow: none; clip-path: none; overflow: visible; }
  .brief-page .muted, .brief-page dt, .brief-page .tag { color: #444; }
  .brief-page .tag { background: none; border-color: #777; }
  .brief-page .tag:is(.op-human, .op-script, .op-scanner, .op-ai-agent, .op-unknown, .op-pending) { border-color: #777; clip-path: none; }
  .brief-page .tag:is(.op-human, .op-script, .op-scanner, .op-ai-agent, .op-unknown, .op-pending)::before { content: none; }
  .brief-page .journey-step { border-color: #777; break-inside: avoid; page-break-inside: avoid; }
  .brief-page .journey-step::before { background: #555; }
  .brief-page .brief-receipts > div { break-inside: avoid; }
}

/* Evidence links stay quiet until the analyst interacts with them. */
td a, td a.tag { color: var(--fg); text-decoration: none; }
td a:hover, td a:focus-visible { text-decoration: underline; }

table, .kpi, svg.chart, .bar-row, .hm, .replay-clock, time, .count { font-variant-numeric: tabular-nums; }

.overview-kpis { grid-template-columns: 2fr 1fr 1fr 1fr; }
.overview-kpis > .s3 { grid-column: auto; }
.overview-kpis > :first-child .v { font-size: 32px; }
@media (max-width: 1100px) { .overview-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpis > .s3 { grid-column: auto; } }
@media (min-width: 1280px) {
  header { gap: 16px; flex-wrap: nowrap; }
  header nav { flex-wrap: nowrap; min-width: 0; }
  header nav > a, header nav summary, #logout { white-space: nowrap; }
  #me { min-width: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  header > .brand, #theme, #logout, header .mj-comb { flex-shrink: 0; }
}

.funnel { display: grid; gap: 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
.funnel-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 8px; }
.funnel-track { grid-column: 1 / -1; background: var(--surface-2); height: 12px; }
.funnel-bar { height: 100%; background: var(--bar); margin: 0 auto; }
.funnel-bar.last { background: var(--honey); }
a.tag:focus-visible { outline-offset: -2px; }
/* Exposure Watch */
td.exp-title { min-width: 16rem; }
.exp-addr { word-break: normal; white-space: nowrap; }
.exp-products { display: flex; flex-wrap: wrap; margin: 0 0 12px; }
