/* weknora-ingest web UI (docs/specs/09-web-ui.md). One set of tokens for light and dark; state colours always come with a glyph and a label. */

:root {
    --bg: #f9f9f7; --surface: #fcfcfb; --surface-2: #f3f2ee;
    --text: #0b0b0b; --text-2: #52514e; --text-3: #6b6a65;
    --line: #e1e0d9; --line-2: #c3c2b7;
    --link: #1c5cab; --accent: #1c5cab; --accent-ink: #ffffff; --accent-soft: #e7eff9; --accent-soft-ink: #1c5cab;
    --good: #0ca30c; --good-ink: #006300; --good-soft: #e5f3e5;
    --crit: #d03b3b; --crit-ink: #a62727; --crit-soft: #fbe8e8;
    --warn: #fab219; --warn-ink: #7a5200; --warn-soft: #fdf2d6;
    --idle: #898781; --idle-soft: #efeee9;
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
    --shadow: rgba(0, 0, 0, 0.14);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
        --text: #ffffff; --text-2: #c3c2b7; --text-3: #9b9a93;
        --line: #2c2c2a; --line-2: #383835;
        --link: #6da7ec; --accent: #256abf; --accent-ink: #ffffff; --accent-soft: #14263f; --accent-soft-ink: #86b6ef;
        --good-ink: #5fd35f; --good-soft: #16301a;
        --crit-ink: #f08a8a; --crit-soft: #3a1b1b;
        --warn-ink: #f2c24f; --warn-soft: #33290f;
        --idle-soft: #2a2a28;
        --s1: #3987e5; --s2: #d95926; --s3: #199e70;
        --shadow: rgba(0, 0, 0, 0.5);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --text: #ffffff; --text-2: #c3c2b7; --text-3: #9b9a93;
    --line: #2c2c2a; --line-2: #383835;
    --link: #6da7ec; --accent: #256abf; --accent-ink: #ffffff; --accent-soft: #14263f; --accent-soft-ink: #86b6ef;
    --good-ink: #5fd35f; --good-soft: #16301a;
    --crit-ink: #f08a8a; --crit-soft: #3a1b1b;
    --warn-ink: #f2c24f; --warn-soft: #33290f;
    --idle-soft: #2a2a28;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* ---- base ---- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: 'Spline Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.45;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
h3 { margin: 0; font-size: 14px; font-weight: 600; }
p { margin: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
.mono { font-family: 'Spline Sans Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.xsmall { font-size: 12.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.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; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row-nowrap { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; }
.grow { flex: 1 1 0; min-width: 0; }
.nowrap { white-space: nowrap; }
.ink-good { color: var(--good-ink); } .ink-crit { color: var(--crit-ink); } .ink-warn { color: var(--warn-ink); } .ink-accent { color: var(--accent-soft-ink); }

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

.hdr { background: var(--surface); border-bottom: 1px solid var(--line); }
.hdr-in { max-width: 1280px; margin: 0 auto; padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav a:hover { text-decoration: none; background: var(--surface-2); }
.nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.hdr-gap { flex: 1 1 0; min-width: 0; }
.attention-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; background: var(--warn-soft); color: var(--warn-ink); font-size: 12.5px; font-weight: 600; }
.attention-chip:hover { text-decoration: none; }
.who { display: inline-flex; align-items: center; gap: 10px; }
.who-avatar { width: 30px; height: 30px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; text-transform: uppercase; }
.who-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who-name { font-weight: 600; font-size: 13.5px; max-width: 220px; }
.who-sub { font-size: 12px; color: var(--text-3); }
.linkbtn { padding: 0; border: 0; background: transparent; color: var(--link); cursor: pointer; font-size: inherit; }
.linkbtn:hover { text-decoration: underline; }

/* The user menu: the name opens a panel with the theme and the sign-out. A details element, so it works without the circuit. */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; padding: 4px 8px 4px 4px; margin: -4px -8px -4px -4px; border-radius: 10px; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--surface-2); }
.user-menu > summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.who-caret { display: inline-flex; color: var(--text-3); transition: transform 0.12s; }
.user-menu[open] .who-caret { transform: rotate(180deg); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 264px; max-width: calc(100vw - 16px); padding: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 10px 28px var(--shadow); }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; min-width: 0; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; }
.menu-label { font-size: 13px; color: var(--text-2); }
.menu-row .seg button { display: inline-flex; align-items: center; gap: 6px; }
.menu-panel form { margin: 0; padding-top: 4px; margin-top: 4px; border-top: 1px solid var(--line); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); }

.main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.main.tight { padding-top: 24px; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.page-head .lede { margin-top: 4px; color: var(--text-2); }
.crumbs { font-size: 13px; color: var(--text-3); }
.crumbs .sep { margin: 0 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: -4px; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 500; }
.tabs a:hover { text-decoration: none; background: var(--surface-2); border-top-left-radius: 8px; border-top-right-radius: 8px; }
.tabs a.active { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }

/* ---- cards, rows, tables ---- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card.accent { border-color: var(--accent); }
.card.clip { overflow: hidden; }
.pad { padding: 18px 20px; }
.pad-s { padding: 14px 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.sub { margin-top: 2px; font-size: 13px; color: var(--text-2); }
.cards { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.cards > .card { min-width: 0; }
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 220px; }
.kpi-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.kpi-value { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; }
.kpi-hero { font-size: 56px; line-height: 1; font-weight: 600; letter-spacing: -0.025em; }
.kpi-foot { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.meter { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.bar { flex: none; width: 96px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.bar > span { display: block; height: 6px; border-radius: 3px; background: var(--s1); }

.divided > * + * { border-top: 1px solid var(--line); }
.item-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 20px; border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.section-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 16px; padding-bottom: 6px; border-bottom: 1px solid var(--line-2); font-size: 13px; font-weight: 600; }

.table { overflow-x: auto; container: tbl / inline-size; }
.table > .inner { min-width: var(--min, 720px); }
.t-row { display: grid; grid-template-columns: var(--cols); gap: 12px; align-items: center; padding: 11px 20px; border-top: 1px solid var(--line); }
.t-row.compact { padding: 6px 20px; }
.t-head { background: var(--surface-2); padding: 8px 20px; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.t-row.link-row:hover { background: var(--surface-2); }
.t-row.selected { background: var(--accent-soft); }

/* ---- controls ---- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { border-color: var(--crit); background: var(--crit); color: #fff; font-weight: 600; }
.btn.danger:hover { filter: brightness(1.08); background: var(--crit); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; background: transparent; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-ink); }
.chip-btn .n { font-variant-numeric: tabular-nums; font-weight: 600; }

.input, .select, .textarea { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13.5px; }
.input.sm, .select.sm { height: 32px; font-size: 13px; }
.textarea { height: auto; min-height: 96px; padding: 8px 12px; line-height: 1.4; resize: vertical; }
.input.mono, .textarea.mono { font-size: 13px; }
.input.error { border-color: var(--crit); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-3); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search .input { padding-left: 34px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 500; }
.hint { font-size: 12.5px; color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 8px; }
.check input { width: 16px; height: 16px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--idle-soft); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good-ink); }
.pill.crit { background: var(--crit-soft); color: var(--crit-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.accent { background: var(--accent-soft); color: var(--accent-soft-ink); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; }
.count.warn { background: var(--warn-soft); color: var(--warn-ink); }
.count.crit { background: var(--crit-soft); color: var(--crit-ink); }
.count.accent { background: var(--accent-soft); color: var(--accent-soft-ink); }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; background: var(--surface-2); }
.alert.crit { background: var(--crit-soft); color: var(--crit-ink); }
.alert.warn { background: var(--warn-soft); color: var(--warn-ink); }
.alert.good { background: var(--good-soft); color: var(--good-ink); }
.alert.accent { background: var(--accent-soft); color: var(--accent-soft-ink); }
.alert > svg { flex: none; margin-top: 1px; }
.note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.note > svg { flex: none; margin-top: 2px; }
.empty { padding: 28px 20px; text-align: center; color: var(--text-2); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 16px 28px; padding: 16px 20px; }
.facts .k { font-size: 12.5px; color: var(--text-3); }
.facts .v { margin-top: 2px; font-weight: 600; }
.facts .s { font-size: 12.5px; color: var(--text-2); }
.facts > div { min-width: 0; }
.facts .v, .facts .s { overflow-wrap: anywhere; }

.dialog-back { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.45); }
.dialog { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 22px 24px; box-shadow: 0 12px 40px var(--shadow); }
.dialog h2 { font-size: 18px; letter-spacing: -0.01em; }

/* ---- charts ---- */

.chart { display: flex; gap: 12px; margin-top: 20px; }
.chart-axis { position: relative; width: 30px; height: 200px; flex: none; }
.chart-axis > div { position: absolute; right: 0; transform: translateY(50%); font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-plot { position: relative; height: 200px; }
.chart-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.chart-grid.base { border-top-color: var(--line-2); }
.chart-cols { position: absolute; inset: 0; display: flex; }
.chart-col { flex: 1 1 0; min-width: 0; height: 200px; padding: 0; margin: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; cursor: default; position: relative; }
.chart-col:hover, .chart-col:focus-visible { background: var(--surface-2); }
.chart-col .seg-bar { display: block; width: 24px; }
.chart-col .peak { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip { display: none; position: absolute; top: 4px; z-index: 2; pointer-events: none; width: 188px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 6px 18px var(--shadow); text-align: left; }
.chart-col:hover .chart-tip, .chart-col:focus-visible .chart-tip { display: block; }
.chart-col .chart-tip.left { left: calc(100% + 8px); }
.chart-col .chart-tip.right { right: calc(100% + 8px); }
.chart-tip .t { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.chart-tip .r { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.7; }
.chart-tip .r i { width: 12px; height: 3px; border-radius: 2px; }
.chart-x { display: flex; margin-top: 8px; }
.chart-x > div { flex: 1 1 0; min-width: 0; text-align: center; font-size: 12px; line-height: 1.3; color: var(--text-3); min-height: 30px; }
.legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }

/* ---- glyphs ---- */

.glyph { flex: none; vertical-align: middle; }
.icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---- source tree ---- */

.tree-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(0, 250px) 96px 68px; gap: 12px; align-items: center; min-height: 36px; padding: 0 16px; border-top: 1px solid var(--line); }
.tree-row.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tree-row.hl { background: var(--warn-soft); }
.tree-name { display: flex; align-items: center; gap: 4px; min-width: 0; }
.tree-name .namebtn { min-width: 0; padding: 2px 4px; border: 0; border-radius: 4px; background: transparent; color: var(--text); font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 13px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-name .namebtn:hover { text-decoration: underline; }
.tree-toggle { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tree-toggle:hover { background: var(--surface-2); }
.comp { display: flex; gap: 2px; height: 6px; }
.comp > span { min-width: 3px; border-radius: 2px; }

/* ---- small screens ---- */

@media (max-width: 720px) {
    .hdr-in { padding: 10px 16px; gap: 10px 14px; }
    .main { padding: 20px 16px 48px; }
    h1 { font-size: 22px; }
    .kpi-hero { font-size: 44px; }
    .who-name { max-width: 140px; }
}

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

.signin { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; }
.signin > main { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 20px; }
.signin-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.signin-brand { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.signin-card { border-radius: 14px; padding: 26px 24px 24px; }

.link-row:hover { text-decoration: none; }

/* ---- rule editor ---- */

.pat { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.pat code { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'Spline Sans Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 13px; font-weight: 500; }
.pat.removed { background: var(--surface-2); }
.iconbtn { flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); }

/* ---- selection page ---- */

.sel-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.sel-tree { flex: 999 1 640px; min-width: 0; }
.sel-side { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.inspector { border-top: 1px solid var(--line); background: var(--surface-2); padding: 16px 20px; }
.change-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.change-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; }
.change-sign { flex: none; width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-soft-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; }

/* ---- held deletions ---- */

.dec-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.dec-main { flex: 999 1 620px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.dec-side { flex: 1 1 380px; min-width: 0; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.choice { text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; }
.choice:hover:not([disabled]) { background: var(--surface-2); }
.choice[disabled] { opacity: 0.6; cursor: not-allowed; }
.choice.on.accent { border: 2px solid var(--accent); background: var(--accent-soft); padding: 11px 13px; }
.choice.on.crit { border: 2px solid var(--crit); background: var(--crit-soft); padding: 11px 13px; }
.confirm { padding: 14px; border-radius: 10px; border: 1px solid var(--accent); background: var(--surface-2); }
.confirm.crit { border-color: var(--crit); }
.confirm h3 { font-size: 14px; }
.step { width: 22px; height: 22px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }

dl.kv { margin: 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
dl.kv dt { color: var(--text-3); }
dl.kv dd { margin: 0; }
.pathbtn { display: block; max-width: 100%; padding: 2px 0; border: 0; background: transparent; color: var(--text); font-family: "Spline Sans Mono", ui-monospace, monospace; font-size: 12.5px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pathbtn:hover { text-decoration: underline; }

.group-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.member-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 92px 70px 128px; gap: 12px; align-items: center; min-height: 40px; padding: 0 16px; border-top: 1px solid var(--line); }

.chip-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 12px; font-weight: 600; }
.chip-tag.idle { background: var(--idle-soft); color: var(--text); }
.chip-tag button { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; line-height: 1; }
.chip-tag button:hover { background: rgba(0, 0, 0, 0.1); }
.chip-add { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--line-2); background: transparent; color: var(--text-2); font-size: 12px; cursor: pointer; }
.chip-add:hover { background: var(--surface-2); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr) 32px; gap: 6px 8px; align-items: center; }
.pair-k, .pair-v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }

.source-card { text-align: left; width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.source-card:hover { background: var(--surface-2); }
.source-card.on { border: 2px solid var(--accent); background: var(--accent-soft); padding: 13px 15px; }

.browse-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 110px 90px 112px; gap: 12px; align-items: center; min-height: 42px; padding: 0 14px; border-top: 1px solid var(--line); }

/* ---- activity ---- */

.params { margin-top: 4px; }
.params summary { cursor: pointer; font-size: 12px; color: var(--text-3); width: max-content; }
.params summary:hover { color: var(--text-2); }
.params pre { margin: 6px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }

.rev-btn { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; align-items: baseline; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; }
.rev-btn:hover { background: var(--surface-2); }
.rev-btn.on { background: var(--accent-soft); border-color: var(--accent); }

.diff-line { display: flex; gap: 6px; padding: 1px 6px; border-radius: 4px; }
.diff-line.add { background: var(--good-soft); color: var(--good-ink); }
.diff-line.del { background: var(--crit-soft); color: var(--crit-ink); }

/* A table narrower than a row needs keeps its columns by dropping the words that an icon or the run page already says. */
@container tbl (max-width: 860px) {
    .table > .inner { min-width: var(--min-narrow, var(--min, 720px)); }
    .t-row { grid-template-columns: var(--cols-narrow, var(--cols)); }
    .hide-narrow { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

.two-up { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; align-items: start; }

/* A version group on a phone keeps the file and its button; the date and the size are on the Items page. */
@media (max-width: 640px) {
    .member-row { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; padding: 6px 12px; }
    .member-row > :nth-child(3), .member-row > :nth-child(4) { display: none; }
}

/* Columns a narrow table leaves out (the knowledge base moves under the source), and the line that replaces them. */
.col-narrow { display: none; }
@container tbl (max-width: 860px) {
    .col-wide { display: none; }
    .col-narrow { display: block; }
}
