/* Kyvo console — design tokens + components. Light by default, dark via [data-theme=dark] or system preference. */
@font-face { font-family: 'Inter Variable'; src: url('fonts/inter-latin-wght.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --font: 'Inter Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --bg: #ffffff; --surface: #ffffff; --subtle: #f7f7f8; --hover: #f4f4f5; --sel: #eef2ff;
  --line: #ebebed; --line-2: #dedee2;
  --ink: #0a0a0b; --ink-2: #3f3f46; --mute: #71717a; --faint: #a1a1aa;
  --accent: #2563eb; --accent-ink: #1d4ed8; --accent-soft: #eff4ff;
  --btn: #0a0a0b; --btn-ink: #ffffff; --btn2: #f1f1f3; --btn2-ink: #0a0a0b; --btn2-hover: #e7e7ea;
  --good: #15803d; --good-bg: #e7f7ec; --bad: #b91c1c; --bad-bg: #fdecec; --warn: #a16207; --warn-bg: #fdf5dc; --info: #1d4ed8; --info-bg: #eaf1fe; --neutral-bg: #f1f1f3;
  --shadow: 0 1px 2px rgba(10, 10, 11, .04), 0 1px 1px rgba(10, 10, 11, .02);
  --shadow-lg: 0 12px 40px rgba(10, 10, 11, .14), 0 2px 6px rgba(10, 10, 11, .06);
  --r: 14px; --r-sm: 10px; --side: 248px; --pre-bg: #0d1117; --pre-ink: #d6e2f5;
  --chart-grid: #ededf0; --chart-line: #2563eb; --chart-fill: rgba(37, 99, 235, .10);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0b0b0d; --surface: #131316; --subtle: #0f0f12; --hover: #1b1b20; --sel: #1a2340;
  --line: #24242a; --line-2: #2e2e35;
  --ink: #f4f4f5; --ink-2: #d4d4d8; --mute: #a1a1aa; --faint: #71717a;
  --accent: #4f8bff; --accent-ink: #8ab4ff; --accent-soft: #16213b;
  --btn: #f4f4f5; --btn-ink: #0b0b0d; --btn2: #222228; --btn2-ink: #f4f4f5; --btn2-hover: #2c2c33;
  --good: #4ade80; --good-bg: #10261a; --bad: #f87171; --bad-bg: #2c1414; --warn: #facc15; --warn-bg: #2a2310; --info: #8ab4ff; --info-bg: #16213b; --neutral-bg: #222228;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
  --pre-bg: #08080a; --chart-grid: #26262c; --chart-line: #4f8bff; --chart-fill: rgba(79, 139, 255, .16);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin: 0 0 16px; line-height: 1.25; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; }
code, pre, kbd { font-family: var(--mono); font-size: 12px; }
code { background: var(--subtle); border: 1px solid var(--line); padding: 1px 5px; border-radius: 6px; }
pre { background: var(--pre-bg); color: var(--pre-ink); padding: 14px; border-radius: var(--r-sm); overflow: auto; max-height: 420px; }
pre code { background: none; border: 0; padding: 0; }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--ink-2); font-size: 11px; text-align: center; line-height: 1.5; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
::selection { background: var(--accent-soft); }

/* Focus: always visible for keyboard users */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Forms */
label { display: block; font-size: 12px; font-weight: 550; margin: 12px 0 5px; color: var(--ink-2); }
input, select, textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: 10px; font: inherit; color: var(--ink); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
input[type='checkbox'], input[type='radio'] { width: auto; accent-color: var(--accent); }
input[type='color'] { padding: 3px; }
input:disabled, select:disabled, textarea:disabled { background: var(--subtle); color: var(--mute); }
textarea { line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

/* Buttons: black pill primary, grey pill secondary */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border: 1px solid transparent; border-radius: 999px; background: var(--btn); color: var(--btn-ink); font: 550 13px/1.2 var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, opacity .12s, transform .05s; text-decoration: none; }
button:hover, .btn:hover { opacity: .88; text-decoration: none; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.sec, .btn.sec { background: var(--btn2); color: var(--btn2-ink); }
button.sec:hover, .btn.sec:hover { background: var(--btn2-hover); opacity: 1; }
button.ghost { background: transparent; color: var(--ink-2); padding: 6px 10px; }
button.ghost:hover { background: var(--hover); opacity: 1; }
button.red { background: var(--bad); color: #fff; } button.green { background: var(--good); color: #fff; }
:root[data-theme='dark'] button.red, :root[data-theme='dark'] button.green { color: #0b0b0d; }
button.sm, .btn.sm { padding: 5px 11px; font-size: 12px; }
button svg, .btn svg { width: 16px; height: 16px; flex-shrink: 0; }
button.icon svg { width: 18px; height: 18px; }
button.icon { padding: 7px; border-radius: 10px; background: transparent; color: var(--ink-2); }
button.icon:hover { background: var(--hover); opacity: 1; }
a > button { pointer-events: none; }

/* App layout */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--subtle) calc(var(--side) - 1px), var(--line) calc(var(--side) - 1px), var(--line) var(--side), var(--bg) var(--side)); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--subtle); border-right: 1px solid var(--line); padding: 14px 10px 16px; display: flex; flex-direction: column; gap: 1px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 14px; font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--ink); }
.brand .mark { width: 28px; height: 28px; border-radius: 7px; padding: 2px; background: #fff; object-fit: contain; flex: none; }
.brand small { margin-left: auto; font-weight: 500; font-size: 11px; color: var(--mute); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-g { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 16px 10px 6px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.nav-i { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 9px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; cursor: pointer; background: none; border: 0; text-align: left; line-height: 1.3; white-space: normal; justify-content: flex-start; }
.nav-i:hover { background: var(--hover); color: var(--ink); opacity: 1; text-decoration: none; }
.nav-i.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.nav-i svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--mute); }
.nav-i.on svg { color: var(--ink); }
.nav-i .badge { margin-left: auto; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 99px; line-height: 18px; }
.nav-i .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .15s; }
.nav-i.open .chev { transform: rotate(90deg); }
.nav-sub { display: none; padding: 2px 0 4px 27px; }
.nav-sub.open { display: block; }
.nav-sub .nav-i { font-size: 13px; padding: 5px 10px; color: var(--mute); }
.nav-sub .nav-i.on { color: var(--ink); background: var(--surface); }
.side-foot { margin-top: auto; padding-top: 14px; }
.who { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex-shrink: 0; }
.who b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 12px; color: var(--mute); }

.mainwrap { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.search-btn { flex: 0 1 420px; display: flex; align-items: center; gap: 8px; justify-content: flex-start; background: var(--subtle); color: var(--mute); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-weight: 450; }
.search-btn:hover { background: var(--hover); opacity: 1; }
.search-btn svg { width: 15px; height: 15px; }
.search-btn kbd { margin-left: auto; }
.top .spacer { flex: 1; }
.env { width: auto; border-radius: 999px; padding: 6px 28px 6px 12px; font-size: 12.5px; font-weight: 550; background-color: var(--subtle); }
.env.sandbox { background-color: var(--warn-bg); color: var(--warn); border-color: transparent; }
.menu-btn { display: none; }
main { flex: 1; padding: 28px 32px 64px; max-width: 1360px; width: 100%; }
main > p:first-child { margin-bottom: 8px; font-size: 13px; }
main > p:first-child a { color: var(--mute); }
main > p:first-child a:hover { color: var(--ink); }

/* Page header */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ph h1 { margin: 0; }
.ph .sub { color: var(--mute); margin: 4px 0 0; }
.ph .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 20px; overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 12px; border-radius: 0; background: none; color: var(--mute); font-weight: 550; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; opacity: 1; }
.tabs .on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .n { color: var(--faint); font-weight: 500; margin-left: 4px; }
.seg { display: inline-flex; background: var(--btn2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { background: transparent; color: var(--ink-2); padding: 5px 12px; font-size: 12.5px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.seg button:hover { opacity: 1; color: var(--ink); }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 16px 20px 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid, .card + .grid { margin-top: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.stat .n { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.stat .l { color: var(--mute); font-size: 12px; font-weight: 550; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > input, .row > select { width: auto; }
.muted { color: var(--mute); }
.faint { color: var(--faint); }
.err { color: var(--bad); margin-top: 8px; }
.ok { color: var(--good); }
.key { background: var(--warn-bg); color: var(--ink); padding: 12px; border-radius: var(--r-sm); word-break: break-all; margin-top: 12px; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.checks td:first-child { font-weight: 600; width: 170px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--mute); font-weight: 550; font-size: 12px; white-space: nowrap; background: transparent; }
tr:last-child > td { border-bottom: 0; }
.card > table th:first-child, .card > table td:first-child, .card .tw th:first-child, .card .tw td:first-child { padding-left: 4px; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }
.card.flush table th:last-child, .card.flush table td:last-child { padding-right: 20px; }
tr.click, [data-nav] { cursor: pointer; }
tr.click:hover > td, .lrow[data-nav]:hover { background: var(--hover); }
.kb-cur > td, .lrow.kb-cur { background: var(--sel) !important; }
.kb-cur > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.lrow.kb-cur { box-shadow: inset 2px 0 0 var(--accent); }
td b { font-weight: 600; }
td .muted, td .faint { font-size: 12px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 550; line-height: 18px; background: var(--neutral-bg); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.pill.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.approved, .pill.pass, .pill.clear, .pill.clean, .pill.parsed, .pill.captured, .pill.normal, .pill.allow, .pill.active, .pill.closed_false_positive, .pill.low, .pill.default, .pill.delivered, .pill.published, .pill.live, .pill.good { background: var(--good-bg); color: var(--good); }
.pill.declined, .pill.fail, .pill.hit, .pill.suspicious, .pill.high, .pill.block, .pill.escalated, .pill.sar_filed, .pill.closed_true_positive, .pill.disabled, .pill.failed, .pill.severe, .pill.bad, .pill.rejected { background: var(--bad-bg); color: var(--bad); }
.pill.review, .pill.in_review, .pill.collecting, .pill.medium, .pill.investigating, .pill.invited, .pill.alert, .pill.manual, .pill.warning, .pill.unverified, .pill.test, .pill.sandbox, .pill.open, .pill.unsaved, .pill.pending, .pill.warn, .pill.resubmitted { background: var(--warn-bg); color: var(--warn); }
.pill.submitted, .pill.in_progress, .pill.pending_approval, .pill.draft, .pill.info, .pill.created { background: var(--info-bg); color: var(--info); }
.pill.filed { background: #f1ecfe; color: #6d28d9; } :root[data-theme='dark'] .pill.filed { background: #241a3d; color: #c4b5fd; }
.pill.prohibited { background: var(--ink); color: var(--bg); }
.pill.expired, .pill.abandoned, .pill.archived, .pill.legacy, .pill.none, .pill.unscored { background: var(--neutral-bg); color: var(--mute); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--mute); background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; line-height: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); opacity: 1; }
.chip.on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.chip .x { color: var(--faint); margin-left: 2px; }
.chip .x:hover { color: var(--bad); }

/* Home */
.greet { font-size: 30px; font-weight: 650; letter-spacing: -.03em; margin: 8px 0 6px; }
.summary { color: var(--ink-2); font-size: 15px; margin-bottom: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chips .chip svg { width: 14px; height: 14px; color: var(--accent); }
.answer { border: 1px solid var(--line); background: var(--subtle); border-radius: var(--r); padding: 16px 18px; margin-bottom: 22px; }
.answer h3 { display: flex; align-items: center; gap: 8px; }
.answer ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); }
.answer li { margin: 3px 0; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 12px; }
.sec-h h2 { margin: 0; font-size: 16px; }
.metric { padding: 18px 20px; }
.metric .l { font-size: 13px; color: var(--mute); font-weight: 550; display: flex; justify-content: space-between; gap: 8px; }
.metric .v { font-size: 30px; font-weight: 650; letter-spacing: -.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.metric .d { font-size: 12.5px; color: var(--mute); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-weight: 600; font-size: 12px; padding: 1px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); background: var(--good-bg); } .delta.down { color: var(--bad); background: var(--bad-bg); } .delta.flat { color: var(--mute); background: var(--neutral-bg); }

/* List rows (inbox, needs-decision) */
.list { display: flex; flex-direction: column; }
.lrow { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 20px; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow .t b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .t span { color: var(--mute); font-size: 12.5px; }
.lrow .why { color: var(--ink-2); font-size: 12.5px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.lrow .meta { display: flex; gap: 10px; align-items: center; color: var(--mute); font-size: 12.5px; white-space: nowrap; }
.typetag { font-size: 11.5px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.typetag svg { width: 15px; height: 15px; color: var(--mute); }
.reason { background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 11.5px; line-height: 18px; color: var(--ink-2); }

/* Empty states */
.empty { text-align: center; padding: 44px 20px; color: var(--mute); }
.empty .ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; background: var(--good-bg); color: var(--good); }
.empty .ic.neutral { background: var(--subtle); color: var(--mute); border: 1px solid var(--line); }
.empty .ic svg { width: 22px; height: 22px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; font-weight: 600; }
.empty p { max-width: 420px; margin: 0 auto 12px; }

/* Skeletons */
.sk { background: linear-gradient(90deg, var(--subtle) 25%, var(--hover) 37%, var(--subtle) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } * { transition: none !important; } }

/* Filters / saved views */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type='search'], .filters .q { flex: 1 1 220px; min-width: 160px; }
.filters select, .filters input { width: auto; }
.filters .tog { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: 13px; color: var(--ink-2); padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; background: var(--surface); }
.saved { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -4px 0 14px; }
.saved .lbl { font-size: 12px; color: var(--faint); margin-right: 2px; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-t { fill: var(--mute); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ar { fill: var(--chart-fill); }
.chart .bar { fill: var(--chart-line); }
.chart .bar.dim { opacity: .35; }
.chart .hit:hover + .bar, .chart .bar:hover { opacity: .8; }
.chart .xh { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .pt { fill: var(--surface); stroke: var(--chart-line); stroke-width: 2; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 7px 10px; border-radius: 9px; box-shadow: var(--shadow-lg); max-width: 260px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.tip b { font-weight: 650; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hb { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.hb .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hb .track { height: 10px; background: var(--subtle); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.hb .fill { height: 100%; background: var(--chart-line); border-radius: 99px; }
.hb .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 550; }
.funnel { display: flex; flex-direction: column; gap: 10px; }
.fs { display: grid; grid-template-columns: 96px 1fr 120px; gap: 12px; align-items: center; }
.fs .bar { height: 30px; background: var(--chart-line); border-radius: 8px; min-width: 3px; display: flex; align-items: center; padding: 0 10px; color: #fff; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
:root[data-theme='dark'] .fs .bar { color: #08101f; }
.fs .lab { font-weight: 550; text-transform: capitalize; }
.fs .drop { font-size: 12px; color: var(--mute); text-align: right; }
.fs .drop b { color: var(--bad); font-weight: 600; }
details.data { margin-top: 10px; font-size: 12px; color: var(--mute); }
details.data summary { cursor: pointer; width: max-content; }
details.data table { margin-top: 8px; }

/* Modals, palette, toast */
.ov { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 11, .36); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; animation: fade .12s ease; }
:root[data-theme='dark'] .ov { background: rgba(0, 0, 0, .6); }
@keyframes fade { from { opacity: 0; } }
.dlg { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 76vh; overflow: auto; padding: 22px; }
.dlg h2 { font-size: 17px; }
.dlg .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.pal { padding: 0; width: min(640px, 100%); overflow: hidden; display: flex; flex-direction: column; }
.pal input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 15px; background: transparent; box-shadow: none !important; }
.pal .res { overflow: auto; max-height: 52vh; padding: 6px; }
.pal .grp { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 10px 12px 4px; }
.pal .it { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.pal .it.on { background: var(--hover); }
.pal .it svg { width: 16px; height: 16px; color: var(--mute); flex-shrink: 0; }
.pal .it .s { color: var(--mute); font-size: 12px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.pal .foot { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 12px; color: var(--mute); display: flex; gap: 14px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.keys div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lg); animation: fade .15s ease; }
.toast.bad { background: var(--bad); color: #fff; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--subtle); }
.auth { width: min(400px, 100%); background: var(--surface); padding: 32px; border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.auth .brand { padding: 0 0 22px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth button[type='submit'], .auth form > button { width: 100%; margin-top: 18px; padding: 11px; }

/* Detail helpers */
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.imgs { display: flex; gap: 12px; flex-wrap: wrap; } .imgs figure { margin: 0; width: 180px; }
.imgs img { width: 180px; height: 130px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.imgs figcaption { font-size: 11px; color: var(--mute); margin-top: 4px; }
.review-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.review-bar input { flex: 1 1 260px; width: auto; }
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mod { display: flex; flex-direction: column; gap: 8px; }
.mod .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
.mod .ico svg { width: 18px; height: 18px; }
.mod p { color: var(--mute); font-size: 13px; flex: 1; margin: 0; }
.timeline { position: relative; }
.ev { display: grid; grid-template-columns: 74px 22px minmax(0, 1fr); gap: 10px; padding: 9px 20px; align-items: start; border-top: 1px solid var(--line); font-size: 13px; }
.ev .tm { color: var(--mute); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.ev .dt { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--subtle); border: 1px solid var(--line); color: var(--mute); }
.ev .dt svg { width: 12px; height: 12px; }
.ev .dt.wh { background: var(--info-bg); color: var(--info); border-color: transparent; }
.ev .dt.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.ev .detail { color: var(--mute); font-size: 12px; font-family: var(--mono); overflow-wrap: anywhere; margin-top: 2px; }
.day-h { padding: 14px 20px 6px; font-size: 12px; font-weight: 600; color: var(--mute); background: var(--subtle); border-top: 1px solid var(--line); }
.day-h:first-child { border-top: 0; }

/* Workflow builder restyle (builder.js injects its own CSS; these win via higher specificity) */
body .wfb-pal, body .wfb-insp, body .wfb-item, body .wfb-node, body .wfb-zoom, body .wfb-zoom button { background-color: var(--surface); color: var(--ink); border-color: var(--line); }
body .wfb-wrap { background-color: var(--surface); border-color: var(--line); background-image: radial-gradient(var(--line-2) 1px, transparent 1px); }
body .wfb-pal, body .wfb-insp, body .wfb-wrap { border-radius: var(--r); }
body .wfb-item:hover { border-color: var(--faint); }
body .wfb-node { border-color: var(--line-2); box-shadow: var(--shadow); border-radius: 12px; }
body .wfb-node .hd { border-radius: 11px 11px 0 0; font-family: var(--font); }
body .wfb-node .bd { color: var(--mute); }
body .wfb-port { background: var(--surface); }
body .wfb-svg path { stroke: var(--faint); } body .wfb-svg path.sel, body .wfb-svg path.ghost { stroke: var(--accent); }
body .wfb-node.sel { outline-color: var(--accent); }
body .wfb-zoom button { padding: 3px 10px; border-radius: 6px; }
body .wfb-modal { background: rgba(10, 10, 11, .4); }
body .wfb-modal > div { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
body .wfb-bar h1 { font-size: 22px; }
body .wfb { height: calc(100vh - 190px); }

/* Responsive: tablet & below → off-canvas sidebar */
@media (max-width: 1100px) {
  .cols { grid-template-columns: 1fr; }
  main { padding: 22px 22px 56px; }
  .top { padding: 10px 22px; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 40; }
  .menu-btn { display: inline-flex; }
  body .wfb { grid-template-columns: 150px 1fr 250px; }
}
@media (max-width: 760px) {
  .cols-2 { grid-template-columns: 1fr; }
  .lrow { grid-template-columns: 1fr; gap: 6px; }
  .search-btn kbd { display: none; }
  .keys { grid-template-columns: 1fr; }
  body .wfb { grid-template-columns: 1fr; height: auto; }
  body .wfb-wrap { height: 60vh; }
  .hb { grid-template-columns: 1fr 1fr 54px; }
}
@media print { .side, .top { display: none; } .app { display: block; } }
