/* The dashboard's whole stylesheet. Tokens first; every color below reads a token. */

:root {
  color-scheme: light dark;
  /* The brand mark, as livesnap-web draws it around an insight's highlights; the same in both
     themes. */
  --brand-gradient: linear-gradient(to right, hsl(357 96.3% 57.8%), hsl(293 100% 71%), hsl(216 100% 58.4%));
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-muted: #f1f0ec;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  --text: #1f1f1d;
  --text-secondary: #5f5e5a;
  --text-muted: #8a8984;
  --accent: #185fa5;
  --accent-bg: #e6f1fb;
  --warning: #854f0b;
  --warning-bg: #faeeda;
  --danger: #a32d2d;
  --danger-bg: #fcebeb;
  --success: #1d9e75;
  --radius: 6px;
  /* Chart series: twelve hues that read in both themes (`SeriesColor`); only "other" is grey. */
  --c1: #534ab7;
  --c2: #1d9e75;
  --c3: #d85a30;
  --c4: #378add;
  --c5: #d4537e;
  --c6: #ba7517;
  --c7: #639922;
  --c8: #0f6e56;
  --c9: #8a5a2b;
  --c10: #1f3a8a;
  --c11: #7a7d1e;
  --c12: #a0307f;
  --c-other: #b4b2a9;
  /* Run calendar and timeline geometry. */
  --rc-cell: 10px;
  --rc-gap: 2px;
  --rc-weekdays: 27px;
  --rt-lane: 20px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181817;
    --surface: #222220;
    --surface-muted: #2c2c2a;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    --text: #ecebe6;
    --text-secondary: #b4b2a9;
    --text-muted: #888780;
    --accent: #85b7eb;
    --accent-bg: #0c447c;
    --warning: #fac775;
    --warning-bg: #633806;
    --danger: #f09595;
    --danger-bg: #791f1f;
    --success: #5dcaa5;
    --c1: #7f77dd;
    --c2: #5dcaa5;
    --c3: #f0997b;
    --c4: #85b7eb;
    --c5: #ed93b1;
    --c6: #ef9f27;
    --c7: #97c459;
    --c8: #9fe1cb;
    --c9: #c49a6c;
    --c10: #8fa8f0;
    --c11: #c5c860;
    --c12: #e07cc8;
    --c-other: #5f5e5a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}

h1 { font-size: 20px; font-weight: 500; margin: 0; }
h2 { font-size: 15px; font-weight: 500; margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--text-muted); }
tr.removed > td:not(:last-child) { opacity: 0.5; }

/* ---- shell ---- */

/* The shell fills the viewport and never scrolls; the sidebar and the page scroll on their own. */
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }

.sidebar {
  background: var(--surface-muted);
  border-right: 1px solid var(--border);
  padding: 16px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.brand { font-weight: 500; padding: 0 8px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.logo { width: 22px; height: 22px; flex: none; }

.sidebar-footer { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.env {
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.env-dev { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.env-prod { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.nav-section { font-size: 12px; color: var(--text-muted); margin: 14px 8px 4px; }

.nav-item {
  display: block;
  padding: 5px 8px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
}
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--surface); color: var(--text); font-weight: 500; }
.nav-button { width: 100%; text-align: left; font: inherit; border: 0; background: none; cursor: pointer; }

/* ---- staff sign-in ---- */

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.login-brand { margin: 0; padding: 0; font-size: 16px; }
.login-lead { margin: 0; font-size: 13px; }
.login-providers, .login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form label { font-size: 13px; color: var(--text-secondary); }
.login-form input { font: inherit; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.login-button { width: 100%; padding: 7px 14px; text-align: center; text-decoration: none; }
.login-back { font-size: 13px; text-align: center; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.crumb { display: flex; gap: 6px; min-width: 0; }
.crumb a { color: inherit; text-decoration: none; }
.crumb a:hover { color: var(--text); }
.crumb-page { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The containing block of what it positions absolutely, `.sr-only` included: otherwise those
   resolve against the page, which then grows past the shell and scrolls the sidebar away. */
.content { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }

time[title] { text-decoration: underline dotted var(--border-strong); text-underline-offset: 3px; cursor: help; }

/* ---- forms ---- */

.settings-form { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.choice { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.button {
  font: inherit;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.button:hover { background: var(--surface-muted); }
.button-danger { color: var(--danger); border-color: var(--danger); }
.button-danger:hover { background: var(--danger-bg); }
.runback-detail-row > td { background: var(--surface-muted); padding: 8px 16px 16px; }
.runback-detail h3:first-child { margin-top: 4px; }
.panel p { margin: 4px 0; }

/* ---- page building blocks ---- */

.page-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.page-heading { display: flex; gap: 12px; align-items: center; min-width: 0; }
.scope { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

code { font-family: var(--mono); font-size: 12px; background: var(--surface-muted); padding: 1px 4px; border-radius: 4px; }
code .op { font-family: "STIX Two Math", "Cambria Math", "Apple Symbols", "Segoe UI Symbol", "Noto Sans Math", serif; font-size: 1.15em; padding: 0 1px; }

.panel-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

.notice { margin: 0; padding: 8px 12px; border-radius: var(--radius); font-size: 13px; }
.notice-warning { background: var(--warning-bg); color: var(--warning); }

/* ---- filters ---- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Every select and input, one look; the pickers beside a heading are a size smaller. */
.filters select, .filters input[type="date"], .filters input[type="search"], .filters input[type="text"],
.version-picker select, .range-picker select, .range-picker input[type="date"] {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  color-scheme: light dark;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 8px;
}
.version-picker select, .range-picker select, .range-picker input[type="date"] { padding: 2px 6px; }
.filters input[type="search"] { width: 260px; }
.trace-form input[type="text"] { width: 420px; max-width: calc(100vw - 64px); }
.trace-verdict { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); font-size: 14px; background: var(--surface-muted); }
.trace-match { background: color-mix(in srgb, var(--success) 14%, transparent); }
.trace-miss { background: var(--warning-bg); color: var(--warning); }
.notice-danger { background: var(--danger-bg); color: var(--danger); }
.notice-danger ul { margin: 6px 0 0; padding-left: 18px; }
/* The Debug tab's run log: the article and its outcome, then one row per step, each opening onto
   its data; match opens per plan onto the evaluated query, where it held and the filters. */
.rl { --hit-tint: color-mix(in srgb, var(--success) 20%, transparent); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.rl-head { padding: 16px 20px 14px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border); }
.rl-title { font-size: 16px; font-weight: 500; line-height: 1.4; text-wrap: balance; }
.rl-title a { color: var(--text); text-decoration: none; }
.rl-title a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--text-muted); }
.rl-ext { font-size: 12px; color: var(--text-muted); margin-left: 6px; }
.rl-facts, .rl-entities { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--text-secondary); align-items: baseline; }
.rl-entities { gap: 4px; }
.rl-facts b, .rl-entities b { font-weight: 400; color: var(--text-muted); margin-right: 5px; }
.rl-entities .term { margin: 0; }
.rl-outcome { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; background: none; font-size: 14px; color: var(--text); }
.rl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-muted); }
.rl-outcome-ok .rl-dot { background: var(--success); }
.rl-outcome-bad .rl-dot { background: var(--danger); }
.rl-empty { padding: 12px 20px; margin: 0; }
.rl-step + .rl-step { border-top: 1px solid var(--border); }
.rl-row { width: 100%; display: grid; grid-template-columns: 12px 10px 90px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 20px; background: none; border: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.rl-row:hover { background: var(--surface-muted); }
.rl-caret, .rl-pc { color: var(--text-muted); font-size: 9px; transition: transform .15s; display: inline-block; }
.rl-step.open > .rl-row .rl-caret, .rl-t tr.is-open .rl-pc { transform: rotate(90deg); }
.rl-sdot { width: 8px; height: 8px; border-radius: 50%; }
.rl-sdot.ok { background: var(--success); }
.rl-sdot.fail { background: var(--danger); }
.rl-sdot.skip { background: var(--text-muted); opacity: .5; }
.rl-sdot.wait { border: 1.5px solid var(--text-muted); }
.rl-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-sum { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-right { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rl-fail .rl-name, .rl-fail .rl-sum { color: var(--danger); }
.rl-skip .rl-name, .rl-wait .rl-name { color: var(--text-muted); font-weight: 400; }
.rl-body { padding: 2px 20px 16px 54px; display: flex; flex-direction: column; gap: 10px; }
.rl-body-bar { display: flex; justify-content: flex-end; }
.rl-raw-toggle { font: inherit; font-size: 12px; background: none; border: 1px solid var(--border); border-radius: 6px; padding: 1px 9px; color: var(--text-secondary); cursor: pointer; }
.rl-raw-toggle[aria-pressed="true"] { background: var(--surface-muted); color: var(--text); }
.rl-raw, .rl-log { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.55; background: var(--surface-muted); border-radius: 6px; padding: 12px 14px; overflow: auto; max-height: 420px; color: var(--text-secondary); white-space: pre-wrap; }
.rl-log .e { color: var(--danger); }
.rl-none { margin: 0; font-size: 13px; }
.rl-tw { overflow-x: auto; }
.rl-t { border-collapse: collapse; width: 100%; font-size: 13px; }
.rl-t th { text-align: left; font-weight: 400; font-size: 12px; color: var(--text-muted); padding: 4px 14px 6px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rl-t td { padding: 7px 14px 7px 0; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: top; }
.rl-t .r { text-align: right; font-variant-numeric: tabular-nums; }
.rl-t .m { font-family: var(--mono); font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.rl-t .wrap { white-space: normal; min-width: 260px; color: var(--text-secondary); }
.rl-t .ok { color: var(--success); }
.rl-t .bad { color: var(--danger); }
.rl-t .dim, .rl-t tr.dim td { color: var(--text-muted); }
.rl-t tr.rl-expandable { cursor: pointer; }
.rl-t tr.rl-expandable:hover > td { background: var(--surface-muted); }
.rl-pc { width: 14px; }
.rl-t tr.rl-detail > td { padding: 6px 0 18px 14px; white-space: normal; }
.rl-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 860px) { .rl-grid { grid-template-columns: minmax(0, 1fr); } }
.rl-sec { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rl-right-col { gap: 18px; }
.rl-sec h4 { margin: 0; font-size: 12px; font-weight: 500; color: var(--text-muted); letter-spacing: .02em; }
.rl-sec code.query { display: block; white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: auto; }
.rl-note { margin: 0; font-size: 12.5px; }
.rl-q { display: flex; flex-direction: column; gap: 6px; font-size: 13px; max-height: 480px; overflow: auto; }
.rl-grp { display: flex; flex-direction: column; gap: 6px; padding-left: 12px; border-left: 2px solid var(--border); }
.rl-grp.t { border-left-color: var(--success); }
.rl-grp.f { border-left-color: var(--danger); }
.rl-op { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.rl-v { font-size: 11px; font-weight: 500; }
.rl-v.t { color: var(--success); }
.rl-v.f { color: var(--danger); }
.rl-terms { display: flex; flex-wrap: wrap; gap: 4px; }
.rl .term { margin: 0; color: var(--text-muted); white-space: nowrap; }
.rl .term.hit { background: var(--hit-tint); color: var(--success); font-weight: 500; }
.rl .term.occurs { text-decoration: underline dotted var(--text-muted); text-underline-offset: 3px; color: var(--text-secondary); }
.rl .term.neg-hit { background: var(--danger-bg); color: var(--danger); font-weight: 500; }
.rl-phrase { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 1px 4px; border-radius: 6px; border: 1px dashed var(--border-strong); }
.rl-phrase.held { border-color: var(--success); }
.rl-j { color: var(--text-muted); font-size: 11px; }
.rl-why { margin: 0; font-size: 12.5px; color: var(--danger); }
.rl-frag { margin-left: 6px; color: var(--text-muted); text-decoration: none; font-size: 12px; }
.rl-frag:hover { color: var(--accent); }
.rl-unit { display: flex; flex-direction: column; gap: 4px; }
.rl-unit-key { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.rl-unit-key.ok { color: var(--success); }
.rl-snippet { font-size: 13px; line-height: 1.6; color: var(--text-secondary); background: var(--surface-muted); border-radius: 6px; padding: 8px 12px; white-space: normal; }
.hl-match { background: var(--hit-tint, color-mix(in srgb, var(--success) 20%, transparent)); color: var(--success); border-radius: 3px; padding: 0 2px; font-weight: 500; }
.hl-partial { text-decoration: underline dotted var(--text-muted); text-underline-offset: 3px; }
.rl-filters { display: flex; flex-direction: column; gap: 6px; }
.rl-f { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; font-size: 12.5px; }
.rl-s { font-size: 12px; line-height: 20px; }
.rl-s.t { color: var(--success); }
.rl-s.f { color: var(--danger); }
.rl-f code { background: none; padding: 0; color: var(--text); overflow-wrap: anywhere; }
.rl-val, .rl-val code { color: var(--text-muted); }
.explain { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 640px) {
  .rl-row { grid-template-columns: 12px 10px minmax(0, 1fr) auto; }
  .rl-sum { grid-column: 3 / -1; grid-row: 2; }
  .rl-body { padding-left: 20px; }
}
@media (prefers-reduced-motion: reduce) { .rl-caret, .rl-pc { transition: none; } }
.filters .check { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-secondary); }
.custom-range { display: flex; gap: 8px; font-size: 13px; color: var(--text-secondary); }

/* ---- tiles ---- */

.cost-view { display: flex; flex-direction: column; gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile p { margin: 0; }
.tile-label { font-size: 13px; color: var(--text-secondary); }
.tile-value { font-size: 24px; font-weight: 500; margin-top: 2px !important; }
.tile-note { font-size: 12px; color: var(--text-muted); margin-top: 2px !important; }
.tile-warning { background: var(--warning-bg); border-color: transparent; }
.tile-warning p { color: var(--warning); }

/* ---- chart ---- */

.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--text-secondary); }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; background: var(--c-other); }
.c1 { background: var(--c1); } .c2 { background: var(--c2); } .c3 { background: var(--c3); } .c4 { background: var(--c4); }
.c5 { background: var(--c5); } .c6 { background: var(--c6); } .c7 { background: var(--c7); } .c8 { background: var(--c8); }
.c9 { background: var(--c9); } .c10 { background: var(--c10); } .c11 { background: var(--c11); } .c12 { background: var(--c12); }
.c-other { background: var(--c-other); }

/* ---- a monitoring's daily budget: the Cost chart's line and the Properties row ---- */
.chart-plot { position: relative; }
.cost-cap { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--danger); pointer-events: none; z-index: 1; }
.cost-cap-label { position: absolute; right: 4px; top: 2px; font-size: 11px; color: var(--danger); background: var(--surface); padding: 0 4px; border-radius: 3px; white-space: nowrap; }
.inline-form .budget-cap-input { min-width: 0; width: 110px; }
.inline-form .icon-emoji-input { min-width: 0; width: 64px; font-size: 18px; text-align: center; }
.monitoring-icon { margin-right: 4px; }
.monitoring-icon-lg { font-size: 28px; line-height: 1; margin-right: 0; }
.button-inline { margin-left: 8px; padding: 1px 8px; font-size: 12px; }

.chart { display: grid; grid-template-columns: max-content minmax(0, 1fr); grid-template-rows: 180px auto; column-gap: 8px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--text-muted); text-align: right; }
.chart-plot {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  border-bottom: 1px solid var(--border-strong);
  background: linear-gradient(to bottom, transparent calc(50% - 0.5px), var(--border) calc(50% - 0.5px), var(--border) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}
.chart-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column-reverse; gap: 1px; }
.chart-col:hover { background: var(--surface-muted); }
.chart-seg { min-height: 1px; border-radius: 1px; }
.chart-col.current .chart-seg { opacity: 0.55; }
.chart-labels { grid-column: 2; display: flex; gap: 2px; font-size: 11px; color: var(--text-muted); }
.chart-labels span { flex: 1; min-width: 0; white-space: nowrap; overflow: visible; }

/* ---- tables ---- */

.group-by { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.pill { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-secondary); text-decoration: none; }
.pill:hover { background: var(--surface-muted); }
.pill.active { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
button.pill { background: none; font: inherit; cursor: pointer; }
button.pill:disabled { cursor: not-allowed; opacity: 0.45; }
button.pill:disabled:hover { background: none; }
.as-of { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; font-weight: 400; }
table.data thead th { color: var(--text-muted); font-size: 12px; }
table.data tfoot th, table.data tfoot td { font-weight: 500; border-bottom: 0; }
table.data .num { text-align: right; white-space: nowrap; }
table.data .bar-col { width: 18%; }
table.data.mentions td { vertical-align: top; }
table.data.mentions .ext { margin-left: 4px; font-size: 11px; color: var(--text-muted); }
table.data.mentions .source { display: block; font-size: 12px; }
table.data.mentions .excerpt { margin: 4px 0 0; font-size: 12px; max-width: 72ch; }
.bar { display: block; height: 7px; border-radius: 2px; background: var(--c4); opacity: 0.7; }

.health { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--text-secondary); }
.health .warning { color: var(--warning); }

/* ---- lists and detail pages ---- */

/* `<.status>`: the dot is a pseudo-element; the word beside it is real text at zero size. */
.status { display: inline; white-space: nowrap; }
.status::before {
  content: "";
  display: inline-block;
  vertical-align: middle;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-other);
}
.status-active::before { background: var(--success); }
.status-text { font-size: 0; line-height: 0; }
table.data .status-col { width: 1%; padding-right: 0; }
.status-label { margin-left: 4px; }

.copy-field { display: inline-flex; align-items: center; gap: 6px; }
.copy-field:has(.wrap-anywhere) { display: flex; min-width: 0; }
.wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
}
.copy-button:hover { background: var(--surface-muted); color: var(--text); }
.copy-button.copied::after { content: "Copied"; color: var(--accent); }
.copy-button.copy-failed::after { content: "Copy failed"; color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab { padding: 6px 12px; color: var(--text-secondary); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }

.insight header { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.insight header .tag { margin-left: 0; }
.insight p { margin: 6px 0; }
.insight ul { margin: 6px 0; padding-left: 20px; }
.insight .sources { font-size: 12px; color: var(--text-muted); }

.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  white-space: nowrap;
}
.tag-warning { background: var(--warning-bg); color: var(--warning); }

.row-link { color: var(--text); font-weight: 500; text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.id { font-family: var(--mono); font-size: 12px; margin-left: 6px; }

table.data th a.sort { color: inherit; text-decoration: none; }
table.data th a.sort:hover, table.data th a.sort.active { color: var(--text); }

.pager { display: flex; gap: 16px; justify-content: flex-end; margin-top: 10px; font-size: 13px; }
.back { margin: 0; font-size: 13px; }
.back a { color: var(--text-secondary); text-decoration: none; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--text-secondary); }
.facts dd { margin: 0; }

h3 { font-size: 13px; font-weight: 500; margin: 14px 0 6px; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }

@media (max-width: 720px) {
  table.data .bar-col, table.data .wide-only { display: none; }
  .filters input[type="search"] { width: 100%; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }

  .shell { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .content { overflow: visible; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* Monitoring header: properties beside the schedule, stacked when narrow. */
.header-columns { display: grid; grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.header-columns .panel { min-width: 0; }
@media (max-width: 1100px) { .header-columns { grid-template-columns: minmax(0, 1fr); } }

/* Run calendar (`RunCalendar`): fill = insights written, dot = runs Oban still holds, outline = scheduled. */
.run-calendar { overflow-x: auto; padding-bottom: 4px; font-size: 11px; color: var(--text-muted); }
.rc-months, .rc-grid.rc-days { display: grid; grid-auto-flow: column; grid-auto-columns: var(--rc-cell); gap: var(--rc-gap); }
.rc-months { margin-left: calc(var(--rc-weekdays) + var(--rc-gap)); height: 16px; }
.rc-month { white-space: nowrap; overflow: visible; }
.rc-body { display: flex; gap: var(--rc-gap); }
.rc-weekdays { display: grid; grid-template-rows: repeat(7, var(--rc-cell)); gap: var(--rc-gap); width: var(--rc-weekdays); line-height: var(--rc-cell); font-size: 10px; }
.rc-grid.rc-days { grid-template-rows: repeat(7, var(--rc-cell)); }
.rc-cell {
  position: relative;
  display: inline-block;
  width: var(--rc-cell);
  height: var(--rc-cell);
  border-radius: 2px;
  background: var(--surface-muted);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}
.rc-cell[data-insights="1"] { background: color-mix(in srgb, var(--accent) 30%, var(--surface-muted)); }
.rc-cell[data-insights="2"] { background: color-mix(in srgb, var(--accent) 55%, var(--surface-muted)); }
.rc-cell[data-insights="3"] { background: color-mix(in srgb, var(--accent) 78%, var(--surface-muted)); }
.rc-cell[data-insights="4"] { background: var(--accent); }
.rc-cell.rc-scheduled { outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -1px; }
.rc-cell.rc-scheduled[data-scheduled="2"] { outline-color: color-mix(in srgb, var(--accent) 65%, transparent); }
.rc-cell.rc-scheduled[data-scheduled="3"] { outline-color: color-mix(in srgb, var(--accent) 85%, transparent); }
.rc-cell.rc-scheduled[data-scheduled="4"] { outline-color: var(--accent); }
.rc-cell.rc-current { box-shadow: 0 0 0 1.5px var(--text); }
.rc-cell.rc-diff-both { background: var(--accent); }
.rc-cell.rc-diff-current { outline: 1.5px dashed var(--danger); outline-offset: -1.5px; }
.rc-cell.rc-diff-proposed { outline: 1.5px solid var(--success); outline-offset: -1.5px; }
.rc-cell.rc-run::after {
  content: "";
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 1px var(--surface);
}
.rc-cell.rc-run-no_insight::after, .rc-cell.rc-run-skipped::after { background: var(--text-muted); }
.rc-cell.rc-run-running::after { background: var(--accent); }
.rc-cell.rc-run-incomplete::after, .rc-cell.rc-run-failed::after { background: var(--danger); }
.rc-skipped { visibility: hidden; }
.rc-hour-row { display: grid; grid-template-columns: 90px repeat(24, var(--rc-cell)); gap: var(--rc-gap); margin-bottom: var(--rc-gap); align-items: center; }
.rc-row-label { white-space: nowrap; }
button.rc-row-label { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.rc-row-label:hover, button.rc-row-label:focus-visible { color: var(--text); text-decoration: underline; }
.rc-hour-label { line-height: var(--rc-cell); overflow: visible; white-space: nowrap; }
.rc-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--text-secondary); }
.rc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.panel .rc-note { margin-top: 8px; font-size: 12px; }

/* Plan tab (`PlanView`): one panel per tracked item, then the YAML of the same document. */
.plan-views { margin: 16px 0 12px; }
.plan { margin-bottom: 16px; }
.plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.plan-head h2 { margin: 0; }
.plan-part { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 4px; }
.plan-leg { margin: 8px 0 12px; }
.plan-leg h4 { font-size: 13px; font-weight: 500; margin: 0 0 4px; }
.plan-leg p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.plan-list { margin: 0; padding-left: 18px; }
.plan-list li { margin: 3px 0; }
.plan-clause { margin-right: 10px; }
code.q { white-space: pre-wrap; overflow-wrap: anywhere; }
.q-operator { color: var(--accent); font-weight: 700; }
.q-paren { color: var(--warning); font-weight: 600; }
.q-phrase { color: var(--success); font-weight: 500; }
.q-prefix { font-style: italic; color: var(--accent); }
.q-error { text-decoration: underline wavy var(--danger); text-underline-offset: 3px; text-decoration-skip-ink: none; }
.q-warning { text-decoration: underline wavy var(--warning); text-underline-offset: 3px; text-decoration-skip-ink: none; }
.q-refused { margin-left: 6px; font-size: 12px; color: var(--warning); cursor: help; }
.term { display: inline-block; margin: 0 2px; padding: 0 6px; border-radius: 4px; background: var(--surface-muted); font-family: var(--mono); font-size: 12px; }
.term.generated { background: var(--accent-bg); color: var(--accent); }
.plan-row { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin: 6px 0; }
.plan-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.plan-row-terms { margin: 0; }
.expansion-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.plan-lifecycle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.diff-added { color: var(--success); }
.diff-added::before { content: "+ "; }
.diff-removed { color: var(--danger); text-decoration: line-through; }
.diff-removed::before { content: "− "; }
.tag-success { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.decision-bar { position: relative; display: flex; height: 10px; border-radius: 5px; overflow: visible; margin: 10px 0 8px; max-width: 520px; }
.decision-bar > span:not(.db-mark) { height: 100%; }
.db-reject { background: var(--surface-muted); border-radius: 5px 0 0 5px; }
.db-judge { background: color-mix(in srgb, var(--warning) 45%, transparent); }
.db-accept { background: var(--success); border-radius: 0 5px 5px 0; }
.db-mark { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text); }
.db-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.plan-page { margin: 8px 0 12px; }
.plan-page a { word-break: break-all; }
.plan-yaml pre { margin: 0; padding: 12px; overflow-x: auto; background: var(--surface-muted); border-radius: var(--radius); font: 12px/1.5 var(--mono); }
.plan-yaml pre code { background: none; padding: 0; font: inherit; }

/* highlight.js token colors (YAML view): VS Code's Light+ and Dark+, the palette most eyes expect. */
:root {
  --hl-key: #800000;
  --hl-string: #a31515;
  --hl-number: #098658;
  --hl-literal: #0000ff;
  --hl-comment: #008000;
}
@media (prefers-color-scheme: dark) {
  :root {
    --hl-key: #569cd6;
    --hl-string: #ce9178;
    --hl-number: #b5cea8;
    --hl-literal: #569cd6;
    --hl-comment: #6a9955;
  }
}
.hljs-attr, .hljs-attribute { color: var(--hl-key); }
.hljs-string { color: var(--hl-string); }
.hljs-number { color: var(--hl-number); }
.hljs-literal, .hljs-type, .hljs-keyword { color: var(--hl-literal); }
.hljs-comment, .hljs-meta { color: var(--hl-comment); }
.hljs-bullet, .hljs-punctuation { color: var(--text-secondary); }
.hljs-addition { color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
.hljs-deletion { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }


button.rc-cell { padding: 0; border: 0; cursor: pointer; font: inherit; }
button.rc-cell:hover, button.rc-cell:focus-visible { outline: 1.5px solid var(--text); outline-offset: 0; }

/* ---- a day as a timeline: time across, one bar per run, stacked when they overlap ---- */

.run-timeline { font-size: 11px; color: var(--text-muted); padding: 0 4px 4px; }
.rt-axis { position: relative; height: 16px; }
.rt-hour { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.rt-hour:first-child { transform: none; }
.rt-track {
  position: relative;
  height: calc(var(--lanes) * var(--rt-lane) + 18px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  overflow: hidden;
}
.rt-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); opacity: 0.6; }
.rt-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 2; }
.rt-run {
  position: absolute;
  top: calc(var(--lane) * var(--rt-lane) + 4px);
  height: 14px;
  min-width: 4px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--success);
  font: inherit;
  transition: filter 150ms ease-out;
}
button.rt-run { cursor: pointer; }
.rt-run:hover, .rt-run:focus-visible { filter: brightness(1.25); outline: 1.5px solid var(--text); outline-offset: 1px; }
.rt-run-no_insight, .rt-run-skipped { background: var(--text-muted); }
.rt-run-running { background: var(--accent); }
.rt-run-incomplete, .rt-run-failed { background: var(--danger); }
.rt-run.rt-selected { box-shadow: 0 0 0 2px var(--text); z-index: 1; }
.rt-scheduled {
  position: absolute;
  bottom: 3px;
  width: 2px;
  height: 10px;
  margin-left: -1px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--accent) 60%, transparent);
}

/* The hovered cell's row and column, tinted over whatever fills them, fading in and out. */
.run-calendar .rc-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--text) 14%, transparent);
  opacity: 0;
  transition: opacity 150ms ease-out;
  pointer-events: none;
}
.run-calendar .rc-cell.rc-cross::before { opacity: 1; }
.rc-row-label, .rc-hour-label { transition: color 150ms ease-out; }
.rc-row-label.rc-cross, .rc-hour-label.rc-cross { color: var(--text); }
.rc-cell.rc-selected { box-shadow: 0 0 0 2px var(--text); z-index: 1; }
/* The Runback tab's week: an hour that held a fire picks it for the form. */
button.rc-cell[phx-click="runback_fire"] { cursor: pointer; }
.rc-cell[data-picked] { box-shadow: 0 0 0 2px var(--accent, var(--text)); z-index: 1; }
.run-search { min-width: 220px; }
.rc-hour-row.rc-focus .rc-row-label { color: var(--text); font-weight: 600; }
.runs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 14px 0 10px; }
.range-picker { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.range-picker form { margin: 0; }
.range-picker .step { font: inherit; font-size: 13px; min-width: 26px; padding: 2px 8px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: none; color: var(--text-secondary); cursor: pointer; }
.range-picker .step:hover:not(:disabled) { background: var(--surface-muted); }
.range-picker .step:disabled { opacity: 0.4; cursor: default; }
.rl-qhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rl-qhead h4 { margin: 0; }
.rl-qtabs { display: flex; gap: 6px; font-size: 12px; }
.rl-qview code.query { max-height: 420px; }

/* ---- the sidebar's folding groups ---- */

.nav-parent { display: flex; align-items: center; gap: 2px; }
.nav-parent .nav-item { flex: 1; }
.nav-toggle { border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: 4px 6px; border-radius: var(--radius); font: inherit; line-height: 1; transition: transform 0.15s; }
.nav-toggle:hover { background: var(--surface); color: var(--text); }
.nav-tree.collapsed .nav-toggle { transform: rotate(-90deg); }
.nav-tree.collapsed .nav-children { display: none; }
.nav-children { padding-left: 12px; }

/* ---- Bright Data dumps ---- */

.tag-accent { background: var(--accent-bg); color: var(--accent); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.dump-status { white-space: nowrap; }
.dump-status .tag { margin-left: 0; }
.info { margin-left: 4px; color: var(--text-muted); cursor: help; }
.info:hover, .info:focus-visible { color: var(--text); }
.progress { display: inline-block; vertical-align: middle; width: 90px; height: 7px; border-radius: 4px; background: var(--surface-muted); overflow: hidden; margin-right: 6px; }
.progress span { display: block; height: 100%; background: var(--accent); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); min-width: 260px; }
.field-error { color: var(--danger); font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---- the Entities pages: external id pills, the changes timeline ---- */
.pill a { color: inherit; text-decoration: none; }
.page-header .pill, td .pill { display: inline-block; margin-right: 4px; font-size: 12px; padding: 0 8px; }
.timeline .change + .change { margin-top: 8px; }
.timeline .sides { display: grid; grid-template-columns: max-content 1fr; gap: 2px 8px; margin: 2px 0 0; }
.timeline .sides dt { color: var(--text-secondary); }
.timeline .sides dd { margin: 0; }
.tag .id { font-size: inherit; }
.avatar {
  position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; overflow: hidden; vertical-align: middle;
  background: var(--surface-muted); color: var(--text-secondary); font-size: 9px; font-weight: 500;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-large { width: 48px; height: 48px; font-size: 16px; }
.person { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.links { display: inline-flex; gap: 4px; }
.links a, .links span { font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 4px; background: var(--surface-muted); color: var(--text-secondary); text-decoration: none; }
.links a:hover { color: var(--text); }
.dump-path { margin: 4px 0 0; font-family: var(--mono); font-size: 12px; }
.donut-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin: 12px 0; }
.donut { position: relative; flex: none; width: 132px; height: 132px; border-radius: 50%; }
.donut span {
  position: absolute; inset: 18px; border-radius: 50%; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 500;
}
.donut small { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.legend { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 6px; }
.legend li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
.legend b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
/* One line per change: every cell on one line, the two values clipped, whole in their title. */
table.data.changes td { white-space: nowrap; vertical-align: middle; }
table.data.changes td.clip { max-width: 0; width: 30%; overflow: hidden; text-overflow: ellipsis; }
.fact-source { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.disabled { color: var(--text-tertiary, var(--text-secondary)); opacity: 0.55; cursor: not-allowed; }

/* A row that expands into a full-width row under it, e.g. which tracked items of a monitoring
   target a group. The detail row spans the table, so opening it never moves the columns. */
button.disclosure { background: none; border: 0; padding: 0; font: inherit; color: var(--text-secondary); cursor: pointer; }
button.disclosure:hover { color: var(--text); }
button.disclosure .chevron { display: inline-block; transition: transform 0.15s; }
tbody.targets.open button.disclosure .chevron { transform: rotate(90deg); }
tbody.targets .targets-items { display: none; }
tbody.targets.open .targets-items { display: table-row; }
tbody.targets.open > tr:first-child td { border-bottom: 0; }
.targets-items td { padding-top: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 2px 0; }

/* One client's holdings on an entity page: its ids, names, groups and facts. */
.client-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-top: 12px; }
.client-card h3 { margin: 0 0 8px; font-size: 15px; display: flex; gap: 8px; align-items: baseline; }
.client-card .id { font-size: 12px; }
table.data.compact td { padding-top: 4px; padding-bottom: 4px; }
table.data.compact tr:last-child td { border-bottom: 0; }

/* A traced plan's inspector: what the plan asked on the left, the article on the right, annotated
   by the selected section. */
.insp { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; }
@media (max-width: 900px) { .insp { grid-template-columns: minmax(0, 1fr); } }
.insp-cap { margin: 0 0 6px; font-size: 12px; }
.insp-sec { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.insp-sec.on { border-color: var(--accent, var(--border-strong)); }
.insp-head { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.insp-head .ok, .insp-q .ok, .insp-phead .ok { color: var(--success); }
.insp-head .bad, .insp-q .bad { color: var(--danger); }
.insp-head .muted { color: var(--text-secondary); }
.insp-body { padding: 0 10px 10px; }
.insp-q { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 8px; margin-top: 4px; background: none; border: 1px solid transparent; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.insp-q.on { border-color: var(--border); background: var(--surface-2, transparent); }
.insp-qtext { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.insp-qscore { flex-shrink: 0; white-space: nowrap; }
.insp-passage { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.insp-passage.ok { border-color: var(--success); }
.insp-phead { display: flex; justify-content: space-between; font-size: 12px; }
.insp-ptext { margin: 4px 0 6px; }
.sim { position: relative; height: 4px; border-radius: 2px; background: var(--border); }
.sim-fill { position: absolute; left: 0; top: 0; height: 4px; border-radius: 2px; background: var(--text-secondary); }
.sim-fill.ok { background: var(--success); }
.sim-threshold { position: absolute; top: -3px; width: 1px; height: 10px; background: var(--text); }
td.rl-focus { cursor: pointer; }
td.rl-focus:hover { text-decoration: underline; }

/* A traced plan's entity enrichment: each step of a person's verification, and the article's
   profile beside the client's record. */
.enr-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.enr-compare p { margin: 2px 0; }
.enr-row summary { cursor: pointer; }
.enr-row p { margin: 4px 0 8px; }
.enr-head { margin: 0 0 6px; }
.enr-head .ok { color: var(--success); }
.enr-head .bad { color: var(--danger); }
.enr-why { margin: 0 0 10px; }
.enr-facts th[scope="row"] { font-weight: 500; color: var(--text-secondary); }
.enr-facts .ok { color: var(--success); }
.enr-facts .bad { color: var(--danger); }
.enr-chain { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 10px 0; font-size: 12px; }
.enr-chain .decided { color: var(--success); font-weight: 600; }
.enr-chain .skipped { opacity: 0.7; }
.enr-more { margin: 6px 0 8px; }
.enr-more > summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); }
.enr-more[open] > summary { margin-bottom: 6px; }

/* Insights */
.insight-summary { max-width: 48ch; }
.insight-view { display: grid; gap: 12px; max-width: 860px; }
/* As livesnap-web shows an insight's highlights: a 1px brand-gradient ring over the surface, and a
   soft glow of the same gradient behind it, from the frame so it stays under the panel. */
.insight-lead-frame { position: relative; }
.insight-lead-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 17px;
  background: var(--brand-gradient);
  opacity: 0.35;
  filter: blur(12px);
}
.insight-lead {
  position: relative;
  border: 1px solid transparent;
  border-radius: 17px;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--brand-gradient) border-box;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
.insight-lead p { margin: 0 0 6px; font-size: 15px; }
.insight-lead ul { margin: 0; padding-left: 20px; }
.insight-count { margin: 0; font-size: 13px; }
.insight-json pre { margin: 0; padding: 12px; overflow: auto; max-height: 70vh; background: var(--surface-muted); border-radius: var(--radius); font: 12px/1.5 var(--mono); }
.insight-json pre code { background: none; padding: 0; font: inherit; }
.article-text { margin: 0; padding: 12px; overflow: auto; max-height: 70vh; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-muted); border-radius: var(--radius); font: 12px/1.5 var(--mono); }
.text-views { margin-bottom: 12px; }
.text-views .tab { background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; cursor: pointer; }
.article-markdown { max-height: 70vh; overflow: auto; max-width: 72ch; line-height: 1.6; overflow-wrap: anywhere; }
.article-markdown > :first-child { margin-top: 0; }
.article-markdown h1, .article-markdown h2, .article-markdown h3 { line-height: 1.3; margin: 1.2em 0 0.4em; }
.article-markdown h1 { font-size: 20px; }
.article-markdown h2 { font-size: 17px; }
.article-markdown h3 { font-size: 15px; }
.article-markdown blockquote { margin: 0.8em 0; padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-secondary); }
.article-markdown table { border-collapse: collapse; }
.article-markdown th, .article-markdown td { border: 1px solid var(--border); padding: 4px 8px; }
.entity-card header { display: flex; gap: 12px; align-items: flex-start; }
.entity-card-name { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.entity-card-name .tag { align-self: flex-start; margin-left: 0; font-family: var(--mono); font-size: 11px; }
.entity-card .linkedin { font-size: 12px; text-decoration: none; }
.change-group { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.change-category { margin: 0 0 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.entity-change + .entity-change { margin-top: 8px; }
.entity-change p { margin: 0; }
.transition { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.transition .from { color: var(--text-secondary); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.transitions { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.transitions dt { color: var(--text-secondary); font-size: 12px; }
.transitions dd { margin: 0; }
.page-card-body { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.page-card-body ul { margin: 6px 0; padding-left: 20px; }
.page-domain { margin: 0 0 4px; font-weight: 600; }
.page-url { font-size: 12px; }
.page-thumb { flex: 0 0 160px; }
.page-thumb img { display: block; width: 160px; height: 110px; object-fit: cover; object-position: top; border: 1px solid var(--border); border-radius: var(--radius); }
.page-links { margin: 6px 0 0; padding-left: 20px; }
.page-card details { margin-top: 8px; }
.page-card details pre { margin: 8px 0 0; padding: 12px; overflow: auto; max-height: 420px; background: var(--surface-muted); border-radius: var(--radius); font: 12px/1.5 var(--mono); }
.page-card details pre code { background: none; padding: 0; font: inherit; }
@media (max-width: 720px) { .page-card-body { flex-direction: column; } }
.group-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.group-counts .tag { margin-left: 0; }
.article-card header { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 13px; }
.article-card header .tag { margin-left: auto; }
.article-source { font-weight: 500; }
.article-card h3 { margin: 6px 0; font-size: 16px; }
.article-card h3 a { color: var(--text); text-decoration: none; }
.article-card h3 a:hover { text-decoration: underline; }
.article-card > .tag { margin-left: 0; }
.article-summary { margin: 8px 0; padding-left: 20px; }
.article-card details { margin-top: 8px; font-size: 13px; }
.matched-entities { margin-top: 12px; }
.entity-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.entity-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.entity-chip .tag { margin-left: 0; }
.score-pill { padding: 1px 6px; border-radius: 999px; font: 12px var(--mono); cursor: help; border: 1px solid; }
.score-good { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.score-weak { color: var(--warning); background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.score-poor { color: var(--danger); background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.score-pill .score { opacity: 0.75; margin-left: 4px; }
.client-identifier { display: inline-flex; align-items: center; gap: 2px; }
.popover-anchor { position: relative; display: inline-flex; }
.info-icon { border: 0; background: none; padding: 0 2px; color: var(--text-muted); font-size: 13px; line-height: 1; cursor: help; }
.info-icon:hover, .info-icon:focus-visible { color: var(--text); }
.popover {
  visibility: hidden; opacity: 0; position: absolute; z-index: 20; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); width: max-content; max-width: 340px; padding: 10px 12px;
  background: #111827; color: #f3f4f6; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font-size: 12.5px; line-height: 1.45; text-align: left; white-space: normal; pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s;
}
.popover::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #111827; }
.popover-anchor:hover .popover, .popover-anchor:focus-within .popover { visibility: visible; opacity: 1; }
.popover-title { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #9ca3af; }
.popover-reason { display: block; margin-bottom: 4px; }
.popover ul { margin: 0; padding-left: 16px; }
.popover li { margin: 4px 0; }
.popover-meta { margin-left: 6px; color: #9ca3af; font-size: 11px; }
.popover-meta span + span::before { content: " · "; }
.popover-meta .strong { color: #6ee7b7; }
.popover-meta .weak { color: #fcd34d; }
.popover-context { display: block; color: #d1d5db; font-size: 11.5px; }
.popover-foot { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid #374151; color: #9ca3af; font-size: 11px; }
@media (prefers-reduced-motion: reduce) { .popover { transition: none; } }
.insight header .insight-open { color: inherit; }
.insight header .insight-open-full { margin-left: auto; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / 0.5); }
.modal { width: min(1200px, 95vw); max-height: 92vh; overflow: auto; padding: 20px 24px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.modal-actions .spacer { flex: 1; }
.modal-narrow { width: min(480px, 95vw); }
.form-stack { display: grid; gap: 14px; }
.form-stack label { display: grid; gap: 4px; }
.form-stack input { font: inherit; font-size: 13px; padding: 6px 8px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); width: 100%; box-sizing: border-box; }
.form-stack .hint { font-size: 13px; }
.cron-text { margin: 8px 0 0; font-weight: 500; }
.cron-merged { margin-top: 12px; }
.cron-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; margin-top: 12px; }
.cron-side { min-width: 0; }
.cron-side h3 code { font-weight: normal; margin-left: 6px; }
.cron-next { margin: 4px 0 0; padding-left: 18px; }

/* The Runback tab's form: what to run back, its options, and what it will do. */
.rb-form { display: grid; gap: 12px; margin: 12px 0; }
.rb-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.rb-block h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.rb-block > summary { display: flex; gap: 12px; align-items: baseline; cursor: pointer; list-style: none; }
.rb-block > summary::-webkit-details-marker { display: none; }
.rb-block > summary::before { content: "▸"; color: var(--text-secondary); }
.rb-block[open] > summary::before { content: "▾"; }
.rb-block > summary h3 { margin: 0; }
.rb-block[open] > summary { margin-bottom: 10px; }
.rb-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; align-items: start; }
.rb-field { display: grid; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.rb-field input, .rb-field select, .rb-field textarea { font: inherit; font-size: 13px; color: var(--text); padding: 6px 8px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); }
.rb-wide { grid-column: 1 / -1; max-width: 520px; }
.rb-check { display: flex; gap: 8px; align-items: center; align-self: end; padding-bottom: 6px; color: var(--text); font-size: 13px; }
.rb-hint { margin: 8px 0 0; font-size: 12px; }
.rb-window { margin: 0 0 10px; font-size: 14px; font-weight: 500; }
.rb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-bottom: 10px; }
.rb-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-muted); }
.rb-stat-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rb-stat-label { font-size: 12px; color: var(--text-secondary); }
.rb-stat-bad .rb-stat-value { color: var(--danger, #b42318); }
.rb-summary .notice { margin-bottom: 10px; }
.rb-actions { margin-top: 4px; }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.button-primary:hover { background: var(--accent); filter: brightness(1.1); }
.button[disabled] { opacity: 0.5; cursor: not-allowed; filter: none; }

/* Search: hits as livesnap-api's search returns them, the highlighter's matches marked. */
.search-facets { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; font-size: 13px; }
.search-hits { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.search-hit { border-top: 1px solid var(--border); padding-top: 10px; }
.search-hit p { margin: 0 0 4px; }
.search-hit-head { font-size: 13px; }
.search-hit-matches { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); }
.search-hit mark { background: var(--warning-bg); color: inherit; border-radius: 2px; padding: 0 1px; }
.sparkline { vertical-align: middle; color: var(--accent); }
ul.plain { list-style: none; margin: 0; padding: 0; }

/* Administration: a list of checkboxes, one per line; a select with a visible label. */
.check-list { display: grid; gap: 6px; margin: 4px 0 12px; }
.check-list label { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.check-list label input { margin: 0; }
.labelled { display: inline-flex; gap: 6px; align-items: center; color: var(--text-secondary); }
.labelled select { font: inherit; font-size: 13px; }

/* Admin pages: what was done, as a toast over the page, so nothing moves. */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { margin: 0; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; background: var(--text); color: var(--surface); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); animation: toast-out 0.4s ease-in 5s forwards; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; padding: 0 2px; font: inherit; font-size: 16px; line-height: 1; color: inherit; opacity: 0.7; cursor: pointer; }
.toast button:hover { opacity: 1; }
.toast-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); animation: none; }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }

/* A list of values edited as pills, with a field that adds one. */
.pill-field { display: grid; gap: 4px; }
.pill-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 5px 6px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); }
.pill-input:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.pill-input .pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 10px; font-size: 13px; }
.pill-input form { flex: 1; min-width: 140px; }
.pill-input form input, .form-stack .pill-input form input { width: 100%; border: 0; outline: 0; padding: 3px 4px; background: none; color: var(--text); font: inherit; font-size: 13px; }
.pill-remove { background: none; border: 0; padding: 0 4px; font: inherit; font-size: 15px; line-height: 1; color: inherit; opacity: 0.6; cursor: pointer; border-radius: 999px; }
.pill-remove:hover { opacity: 1; background: var(--surface-muted); }
.pill-danger { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.pill-problem { font-size: 13px; color: var(--danger); }
.modal .pill-field, .form-stack + .form-stack { margin-top: 14px; }
.plan-edit input[type="text"] { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-sizing: border-box; }
.plan-edit .plan-row-terms input { width: 100%; }
.plan-edit-line { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.plan-edit-line input { flex: 1; }
.plan-edit .plan-row-head { flex-wrap: wrap; gap: 8px; }
.row-tools { display: inline-flex; gap: 4px; margin-left: auto; }
.row-tools .button { padding: 2px 8px; }
.q-field { position: relative; background: var(--surface); border-radius: var(--radius); }
.q-overlay, .q-textarea { display: block; width: 100%; box-sizing: border-box; margin: 0; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-family: var(--mono); font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; tab-size: 4; letter-spacing: normal; }
.q-overlay { position: absolute; inset: 0; pointer-events: none; border-color: transparent; color: var(--text); background: transparent; overflow: hidden; }
.q-textarea { position: relative; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: var(--text); min-height: 34px; }
.q-textarea:focus { outline: none; border-color: var(--accent); }
.q-textarea::placeholder { color: var(--text-muted); }
.q-field[data-dirty] .q-overlay { visibility: hidden; }
.q-field[data-dirty] .q-textarea { color: var(--text); }
.q-match { background: color-mix(in srgb, var(--warning) 28%, transparent); border-radius: 2px; outline: 1px solid var(--warning); }
.q-diagnostics { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.q-diagnostics .diag-error { color: var(--danger); }
.q-diagnostics .diag-warning { color: var(--warning); }
.term-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); min-height: 32px; box-sizing: border-box; }
.term-pills:focus-within { border-color: var(--accent); }
.term-pill { display: inline-flex; align-items: center; gap: 2px; padding: 0 2px 0 8px; border-radius: 999px; background: var(--surface-muted); border: 1px solid var(--border); font-size: 13px; font-weight: 400; line-height: 22px; white-space: nowrap; }
.term-pills .term-pill-remove { border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; margin: 0; min-height: 0; height: auto; box-shadow: none; }
.term-pill-remove:hover { color: var(--danger); }
.plan-edit .term-pills input[type="text"] { flex: 1; width: auto; min-width: 120px; border: 0; background: transparent; padding: 3px 4px; outline: none; }
