/* aml-dash — ops console */

:root {
  --radius: 4px;
  --radius-lg: 6px;
  --row-h: 28px;
  --row-h-comfy: 36px;
  --gap: 12px;
  --pad: 14px;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --fs-xl: 20px;
  --fs-xxl: 28px;
}

/* ===== Themes ===== */

/* Console (default) — near-black, cool blue accent, red/amber/green status */
[data-theme="console"] {
  --bg: #0c0e11;
  --bg-1: #121519;
  --bg-2: #171b20;
  --bg-3: #1d2228;
  --bg-hover: #1a1f25;
  --border: #23292f;
  --border-2: #2d343c;
  --fg: #e6e9ed;
  --fg-1: #b6bcc4;
  --fg-2: #7e858d;
  --fg-3: #555b63;
  --accent: oklch(0.70 0.12 240);
  --accent-2: oklch(0.55 0.12 240);
  --accent-bg: oklch(0.35 0.08 240 / 0.18);
  --ok: oklch(0.72 0.15 155);
  --warn: oklch(0.78 0.15 75);
  --err: oklch(0.67 0.18 25);
  --info: oklch(0.70 0.12 240);
  --muted: oklch(0.55 0.02 240);
  --ok-bg: oklch(0.40 0.10 155 / 0.18);
  --warn-bg: oklch(0.50 0.12 75 / 0.18);
  --err-bg: oklch(0.45 0.14 25 / 0.18);
  --muted-bg: oklch(0.30 0.01 240 / 0.30);
  --shadow: 0 1px 0 rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
  --grid-stripe: rgba(255,255,255,0.015);
  color-scheme: dark;
}

/* Paper — sober government, near-white, ink, deep blue */
[data-theme="paper"] {
  --bg: #f4f3ee;
  --bg-1: #ffffff;
  --bg-2: #faf9f4;
  --bg-3: #edeae0;
  --bg-hover: #ecebe4;
  --border: #d9d6cb;
  --border-2: #c4c0b2;
  --fg: #14181d;
  --fg-1: #333942;
  --fg-2: #636a73;
  --fg-3: #8e949c;
  --accent: oklch(0.40 0.12 255);
  --accent-2: oklch(0.32 0.14 255);
  --accent-bg: oklch(0.40 0.12 255 / 0.08);
  --ok: oklch(0.48 0.13 155);
  --warn: oklch(0.58 0.15 65);
  --err: oklch(0.50 0.17 25);
  --info: oklch(0.40 0.12 255);
  --muted: oklch(0.55 0.02 255);
  --ok-bg: oklch(0.75 0.10 155 / 0.25);
  --warn-bg: oklch(0.80 0.12 65 / 0.30);
  --err-bg: oklch(0.75 0.13 25 / 0.25);
  --muted-bg: oklch(0.85 0.01 255 / 0.40);
  --shadow: 0 1px 0 rgba(20,24,29,0.04), 0 2px 6px rgba(20,24,29,0.06);
  --grid-stripe: rgba(0,0,0,0.02);
  color-scheme: light;
}

/* Amber — phosphor CRT */
[data-theme="amber"] {
  --bg: #0b0805;
  --bg-1: #130e07;
  --bg-2: #19130a;
  --bg-3: #1f180e;
  --bg-hover: #1c1509;
  --border: #2a2012;
  --border-2: #3a2d19;
  --fg: #f3c780;
  --fg-1: #d5a661;
  --fg-2: #927142;
  --fg-3: #5a4527;
  --accent: oklch(0.82 0.14 75);
  --accent-2: oklch(0.72 0.14 75);
  --accent-bg: oklch(0.55 0.12 75 / 0.18);
  --ok: oklch(0.82 0.16 130);
  --warn: oklch(0.82 0.14 75);
  --err: oklch(0.72 0.17 35);
  --info: oklch(0.82 0.14 75);
  --muted: oklch(0.55 0.04 75);
  --ok-bg: oklch(0.45 0.12 130 / 0.18);
  --warn-bg: oklch(0.50 0.12 75 / 0.20);
  --err-bg: oklch(0.45 0.14 35 / 0.20);
  --muted-bg: oklch(0.30 0.02 75 / 0.35);
  --shadow: 0 1px 0 rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.45);
  --grid-stripe: rgba(243, 199, 128, 0.025);
  color-scheme: dark;
}
[data-theme="amber"] body {
  text-shadow: 0 0 1px rgba(243,199,128,0.15);
}

/* density */
[data-density="compact"] { --row-h: 26px; --pad: 12px; --gap: 10px; --fs-md: 12px; --fs-sm: 11px; }
[data-density="comfortable"] { --row-h: 36px; --pad: 18px; --gap: 14px; --fs-md: 13px; --fs-sm: 12px; }

/* ===== Reset ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ===== Layout ===== */
.app {
  display: grid;
  grid-template-columns: 208px 1fr;
  grid-template-rows: 36px 1fr 22px;
  height: 100vh;
}
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  font-size: var(--fs-sm);
}
.topbar .brand {
  display: flex; align-items: center; gap: 8px;
  width: 208px; padding: 0 14px;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.brand-mark {
  width: 14px; height: 14px;
  background: var(--accent);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 3px;
  background: var(--bg-1);
}
.topbar .crumbs {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px;
  color: var(--fg-2);
  font-family: var(--font-mono);
}
.topbar .crumbs .sep { color: var(--fg-3); }
.topbar .crumbs .here { color: var(--fg); }
.topbar .right {
  display: flex; align-items: stretch;
}
.topbar .right > * {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px;
  border-left: 1px solid var(--border);
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}
.topbar .right .env-tag {
  color: var(--warn);
}
.topbar .right button:hover { background: var(--bg-hover); color: var(--fg); }
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fg-3);
  display: inline-block;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.dot.err { background: var(--err); box-shadow: 0 0 6px var(--err); }

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-1);
  overflow-y: auto;
  padding: 8px 0;
  font-size: var(--fs-sm);
}
.nav-group { padding: 10px 14px 4px; color: var(--fg-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  color: var(--fg-1);
  cursor: pointer;
  border-left: 2px solid transparent;
  user-select: none;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--fg); }
.nav-item.active {
  background: var(--bg-2);
  border-left-color: var(--accent);
  color: var(--fg);
}
.nav-item .num {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: left;
  flex: 0 0 auto;
}
.nav-item > span:not(.num):not(.kbd) { flex: 1 1 auto; min-width: 0; }
.nav-item .num + span:not(.kbd) { margin-left: 0; }
.nav-item.active .num { color: var(--accent); }
.nav-item .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 14px;
  margin-left: auto;
  min-width: 16px;
  text-align: center;
  flex: 0 0 auto;
}

.main {
  overflow: auto;
  background: var(--bg);
  position: relative;
}

.statusbar {
  grid-column: 1 / -1;
  display: flex; align-items: center;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-2);
  padding: 0 12px;
  gap: 16px;
  overflow: hidden;
}
.statusbar .seg { display: flex; align-items: center; gap: 6px; }
.statusbar .seg.right { margin-left: auto; }
.statusbar .seg b { font-weight: 600; color: var(--fg); }

/* ===== Common ===== */
.page {
  padding: 18px 22px;
  max-width: 1400px;
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-size: var(--fs-xxl);
  font-weight: 600;
  letter-spacing: -0.015em;
  font-family: var(--font-sans);
}
.page-title .mono {
  font-family: var(--font-mono);
  font-size: 0.65em;
  color: var(--fg-2);
  font-weight: 400;
  margin-left: 10px;
}
.page-sub {
  color: var(--fg-2);
  font-size: var(--fs-md);
  margin-top: 4px;
  max-width: 52ch;
}

.section {
  margin-top: 22px;
}
.section-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section-head .rule { flex: 1; height: 1px; background: var(--border); }

.panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--fg-1);
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.btn:hover { background: var(--bg-3); color: var(--fg); }
.btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-2); color: var(--bg); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { color: var(--err); border-color: var(--err); background: var(--err-bg); }
.btn.sm { padding: 3px 8px; font-size: var(--fs-xs); }
.btn.lg { padding: 8px 16px; font-size: var(--fs-md); }
.btn .kbd { margin-left: 6px; font-size: 10px; opacity: 0.7; border: 1px solid currentColor; padding: 0 4px; border-radius: 3px; opacity: .55; }

/* ===== Inputs ===== */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.field label .opt { color: var(--fg-3); text-transform: none; letter-spacing: 0; margin-left: 4px; }
.input, .select, textarea.input {
  height: 30px;
  padding: 0 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: var(--fs-md);
  outline: none;
  font-family: var(--font-sans);
  width: 100%;
}
textarea.input { height: auto; padding: 8px 10px; font-family: var(--font-mono); font-size: var(--fs-sm); }
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.input.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.input::placeholder { color: var(--fg-3); }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-2) 50%), linear-gradient(135deg, var(--fg-2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}

/* Segmented control */
.seg-control {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.seg-control button {
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--fg-2);
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.seg-control button.active {
  background: var(--bg-3);
  color: var(--fg);
}
.seg-control button:hover:not(.active) { color: var(--fg-1); }

/* Checkbox */
.check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm);
}
.check input { display: none; }
.check .box {
  width: 14px; height: 14px;
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  border-radius: 2px;
  position: relative;
  flex-shrink: 0;
}
.check input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}
.check input:checked + .box::after {
  content: "";
  position: absolute;
  left: 3px; top: 0px;
  width: 5px; height: 8px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ===== Tables ===== */
.table-wrap { width: 100%; overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
table.data th, table.data td {
  padding: 0 10px;
  height: var(--row-h);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data thead th {
  position: sticky; top: 0;
  background: var(--bg-2);
  font-weight: 500;
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  user-select: none;
}
table.data thead th:hover { color: var(--fg); }
table.data thead th .sort-ind { opacity: 0.5; margin-left: 4px; font-size: 9px; }
table.data thead th.sorted { color: var(--fg); }
table.data thead th.sorted .sort-ind { opacity: 1; color: var(--accent); }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody tr.selected { background: var(--accent-bg); }
table.data tbody tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
table.data tbody tr:nth-child(even) td { background: var(--grid-stripe); }
table.data tbody tr:nth-child(even):hover td { background: var(--bg-hover); }
table.data td.mono { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-1); }
table.data td.num { font-variant-numeric: tabular-nums; text-align: right; font-family: var(--font-mono); }
table.data thead th.num { text-align: right; }
table.data td.fade { color: var(--fg-2); }

/* ===== Status chips ===== */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px;
  height: 18px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 3px;
  background: var(--muted-bg);
  color: var(--muted);
  white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.err { background: var(--err-bg); color: var(--err); }
.chip.info { background: var(--accent-bg); color: var(--info); }
.chip.muted { background: var(--muted-bg); color: var(--fg-2); }
.chip.outline { background: transparent; border: 1px solid currentColor; }
.chip .tick { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Pulsing dot for in-flight */
.chip.running .tick { animation: pulse 1s infinite ease-in-out; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

/* Плавное появление карточки активной проверки на экране «Диагностика»
   (без резкого мигания при upsert/remove SSE-событиях). */
@keyframes diagCardIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Progress ===== */
.progress-bar {
  height: 3px;
  background: var(--bg-3);
  overflow: hidden;
  border-radius: 2px;
  position: relative;
}
.progress-bar > div {
  height: 100%;
  background: var(--accent);
  transition: width .3s ease-out;
}
.progress-bar.indet > div {
  width: 30% !important;
  animation: indet 1.4s infinite ease-in-out;
}
@keyframes indet {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(430%); }
}

/* ===== KV / card ===== */
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 12px;
  font-size: var(--fs-sm);
}
.kv dt { color: var(--fg-2); font-family: var(--font-mono); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 1px; }
.kv dd { color: var(--fg); font-family: var(--font-mono); font-size: var(--fs-sm); }

/* Metric card */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.metric {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  overflow: hidden;
}
.metric .lbl {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
}
.metric .val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.metric .val .unit { font-size: 12px; color: var(--fg-2); font-weight: 400; margin-left: 3px; }
.metric .sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-2); }
.metric .spark { position: absolute; right: 8px; bottom: 6px; opacity: 0.35; }

/* ===== Toolbar ===== */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  font-size: var(--fs-sm);
  flex-wrap: wrap;
}
.toolbar .search {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.toolbar .search .input { padding-left: 28px; }
.toolbar .search::before {
  content: "⌕";
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--fg-3);
  font-size: 14px;
  pointer-events: none;
}
.toolbar .sep { width: 1px; height: 20px; background: var(--border); }

/* ===== Tabs ===== */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 7px 14px;
  color: var(--fg-2);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--fg); }
.tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* ===== Drawer ===== */
.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(840px, 100%);
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.25);
  transform: translateX(100%);
  transition: transform .22s ease-out;
  display: flex; flex-direction: column;
  z-index: 50;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head .title { font-weight: 600; flex: 1; }
.drawer-body {
  flex: 1; overflow: auto;
  padding: 16px;
}

.backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 49;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

/* code block */
.codeblock {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-1);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.55;
}
.codeblock .tok-key { color: var(--accent); }
.codeblock .tok-str { color: var(--ok); }
.codeblock .tok-num { color: var(--warn); }
.codeblock .tok-null { color: var(--fg-3); }
.codeblock .tok-punct { color: var(--fg-2); }

/* ===== Tweaks panel ===== */
.tweaks {
  position: fixed;
  right: 18px;
  bottom: 36px;
  width: 260px;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  padding: 12px;
  z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
  font-size: var(--fs-sm);
}
.tweaks .tw-title {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  display: flex; justify-content: space-between; align-items: center;
}
.tweaks .tw-row { display: flex; flex-direction: column; gap: 4px; }
.tweaks .tw-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-2); text-transform: uppercase; letter-spacing: 0.06em; }

/* Check row specific */
.check-row {
  display: grid;
  grid-template-columns: 34px 140px 1fr 100px 72px 72px 28px;
  align-items: center;
  padding: 0 12px;
  height: var(--row-h);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: var(--fs-sm);
  gap: 10px;
}
.check-row:hover { background: var(--bg-hover); }
.check-row.selected { background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
.check-row .cid {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--fg-3);
  letter-spacing: 0.02em;
}
.check-row .src { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-2); }
.check-row .name { color: var(--fg); }
.check-row .dur { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--fg-2); text-align: right; font-variant-numeric: tabular-nums; }
.check-row .caret { color: var(--fg-3); text-align: right; font-size: 10px; }

/* Sparkline stroke */
.spark-line { stroke: var(--fg-2); fill: none; stroke-width: 1; }
.spark-line.up { stroke: var(--ok); }
.spark-line.down { stroke: var(--err); }

/* Scrollbars (webkit) */
.main::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .drawer-body::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb, .drawer-body::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 5px;
  border: 2px solid var(--bg);
}

/* utilities */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--fg-2); }
.muted2 { color: var(--fg-3); }
.small { font-size: var(--fs-xs); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }

/* Form grid for person input */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.form-grid .col-2 { grid-column: span 2; }
.form-grid .col-3 { grid-column: span 3; }
.form-grid .col-4 { grid-column: span 4; }

/* Details block inside check drawer */
.detail-header {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.detail-header .num {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 18px; font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
}

/* command palette hint */
.hint-row {
  display: flex; align-items: center; gap: 6px;
  padding: 0 6px;
  height: 100%;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.hint-row .kbd {
  border: 1px solid var(--border-2);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 14px;
  background: var(--bg-2);
}

/* CRT scanlines for amber theme only */
[data-theme="amber"] .main::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 3px
  );
  z-index: 200;
  mix-blend-mode: multiply;
}

/* sparkline used inline */
.sparkline { display: inline-block; vertical-align: middle; }

/* highlight */
mark.hl { background: var(--accent-bg); color: var(--fg); border-radius: 2px; padding: 0 2px; }

/* empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px;
  color: var(--fg-3);
  text-align: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

/* divider */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* input with suffix */
.input-group { position: relative; }
.input-group .suffix {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  pointer-events: none;
}
.input-group .input { padding-right: 60px; }

/* animated state for running check row */
.check-row.running::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  animation: indet 1.4s infinite;
}
.check-row { position: relative; }

/* Amber accent override for chips in amber mode — keep warn/err/ok distinguishable */
[data-theme="amber"] .chip.info { background: oklch(0.60 0.14 75 / 0.22); color: oklch(0.88 0.14 75); }

/* ==== run-progress: live pulse on numeric changes ==== */
@keyframes aml-pulse-flash {
  0%   { background-color: var(--accent, #4aa3ff); color: #0c0e11; }
  100% { background-color: transparent; color: inherit; }
}
.pulse-flash {
  animation: aml-pulse-flash 0.65s ease-out;
  border-radius: 3px;
  padding: 0 2px;
  margin: 0 -2px;
}

/* ==== run-progress: big timer + throughput strip ==== */
.run-progress {
  display: flex;
  align-items: stretch;
  gap: 18px;
  padding: 10px 14px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
}
.run-progress .rp-timer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 180px;
}
.run-progress .rp-timer .lbl {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.run-progress .rp-timer .val {
  font-family: var(--font-mono);
  font-size: 34px;
  line-height: 1.1;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.run-progress .rp-rates {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
}
.run-progress .rp-rate .lbl {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.run-progress .rp-rate .val {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.run-progress .rp-rate .unit {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  margin-left: 4px;
}
.run-progress .rp-counter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 260px;
  flex: 1;
}
.run-progress .rp-counter .lbl {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.run-progress .rp-counter .val {
  font-family: var(--font-mono);
  font-size: 26px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.run-progress .rp-counter .val .unit {
  font-size: var(--fs-sm);
  color: var(--fg-3);
  margin-left: 6px;
}
.run-progress .rp-counter .val .inflight {
  font-size: var(--fs-sm);
  color: var(--warn, #d29922);
  margin-left: 4px;
}
.run-progress .rp-bar {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.run-progress .rp-bar-fill {
  height: 100%;
  background: var(--accent, #4aa3ff);
  transition: width 0.5s ease-out;
}

/* ==== running attempt visuals ==== */
@keyframes aml-running-stripes {
  from { background-position: 0 0; }
  to   { background-position: 16px 0; }
}
.seg-running {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.18) 0 4px,
    transparent 4px 8px
  ) !important;
  background-color: #4aa3ff !important;
  animation: aml-running-stripes 0.8s linear infinite;
}
.row-running > td {
  background: rgba(74, 163, 255, 0.07);
  border-top: 1px solid rgba(74, 163, 255, 0.25);
  border-bottom: 1px solid rgba(74, 163, 255, 0.25);
}
.row-running > td:first-child {
  border-left: 2px solid #4aa3ff;
}

/* ===== Changelog ===== */
.cl-page { max-width: 880px; }
.cl-days { display: flex; flex-direction: column; gap: 28px; margin-top: 6px; }
.cl-day-title {
  font-family: var(--font-sans);
  font-size: var(--fs-lg, 16px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 0 0 10px;
}
.cl-day-entries { display: flex; flex-direction: column; gap: 8px; }

.cl-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
  transition: border-color .12s;
}
.cl-card.open { border-color: var(--border-2); }
.cl-card-head {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  transition: background .12s;
}
.cl-card-head:hover { background: var(--bg-2); }
.cl-type {
  flex-shrink: 0;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}
.cl-type svg { display: block; }
.cl-title {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--fg);
  line-height: 1.4;
}
.cl-version {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.cl-card-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
}

/* мини-markdown тела записи */
.cl-md { font-size: var(--fs-md); color: var(--fg-1); line-height: 1.65; }
.cl-md p { margin: 8px 0; }
.cl-md p:first-child { margin-top: 8px; }
.cl-md-h {
  margin: 14px 0 4px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  font-weight: 600;
}
.cl-md-ul { margin: 6px 0; padding-left: 18px; }
.cl-md-ul li { margin: 4px 0; }
.cl-md strong { color: var(--fg); font-weight: 600; }
.cl-md code, code.cl-code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1px 4px;
  color: var(--fg);
}
