/* LUCRIX shell styles. Every colour is a token; the dark set overrides the light one.
   Theme: <html data-theme="light|dark">, or no attribute to follow the system setting. */
:root {
  --bg: #f4f6fb; --grid: rgba(15, 23, 42, .045);
  --surface: #ffffff; --surface-2: #f8fafc; --hover: rgba(15, 23, 42, .05);
  --ink: #0f172a; --muted: #5b6478; --line: #e2e8f0; --line-strong: #cbd5e1;
  --accent: #4f46e5; --accent-ink: #ffffff; --accent-soft: rgba(79, 70, 229, .10); --link: #2f5fd0;
  --primary: #0f172a; --primary-ink: #ffffff;
  --danger: #b42318; --danger-soft: rgba(180, 35, 24, .08);
  --warn: #93370d; --warn-soft: #fef3c7; --warn-line: #f5c451;
  --ok: #067647; --ok-soft: #dcfce7;
  --top: #0b1220; --top-ink: #e2e8f0; --top-muted: #8b95a9; --top-accent: #7aa2ff; --top-line: #1f2a40;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px; --side: 248px; --topbar: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --grid: rgba(148, 163, 184, .06);
    --surface: #121a2b; --surface-2: #0f1626; --hover: rgba(226, 232, 240, .06);
    --ink: #e5e9f2; --muted: #9aa4b8; --line: #243049; --line-strong: #33415e;
    --accent: #8b8cf8; --accent-ink: #0b1020; --accent-soft: rgba(139, 140, 248, .16); --link: #8fb0ff;
    --primary: #e5e9f2; --primary-ink: #0b1020;
    --danger: #f97066; --danger-soft: rgba(249, 112, 102, .12);
    --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12); --warn-line: rgba(253, 176, 34, .45);
    --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .14);
    --top: #060a14; --top-line: #1a2338;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --grid: rgba(148, 163, 184, .06);
  --surface: #121a2b; --surface-2: #0f1626; --hover: rgba(226, 232, 240, .06);
  --ink: #e5e9f2; --muted: #9aa4b8; --line: #243049; --line-strong: #33415e;
  --accent: #8b8cf8; --accent-ink: #0b1020; --accent-soft: rgba(139, 140, 248, .16); --link: #8fb0ff;
  --primary: #e5e9f2; --primary-ink: #0b1020;
  --danger: #f97066; --danger-soft: rgba(249, 112, 102, .12);
  --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12); --warn-line: rgba(253, 176, 34, .45);
  --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .14);
  --top: #060a14; --top-line: #1a2338;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 var(--font); color: var(--ink); background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px; min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 12px; }

/* ------------------------------------------------------------ controls */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 10px; min-height: 38px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); vertical-align: -3px; }
.btn {
  font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; background: var(--primary); color: var(--primary-ink);
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--hover); filter: none; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn.link { background: none; border: 0; color: var(--link); padding: 4px 6px; min-height: 0; font-weight: 500; }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.icon-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: rgba(255, 255, 255, .08); }

.field { display: block; }
.field > .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field > .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.check small { display: block; color: var(--muted); }

/* ------------------------------------------------------------ chips, badges */
.badge {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); white-space: nowrap;
}
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.section-label { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--top); color: var(--top-ink); border-bottom: 1px solid var(--top-line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--top-ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.mark {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #5b5cf0, #3b82f6); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 800; letter-spacing: .06em; }
.brand-name .sub { font-family: var(--mono); font-weight: 500; letter-spacing: 0; color: var(--top-accent); margin-left: 6px; }
.powered { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--top-muted); white-space: nowrap; }
.topbar .tenant-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.topbar .badge { color: var(--top-accent); border-color: var(--top-accent); background: rgba(122, 162, 255, .1); }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #24324f; color: #dbe4ff; font-weight: 700; font-size: 12px; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; z-index: 50;
}
.popover .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.popover .menu-item { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.popover .menu-item:hover { background: var(--hover); text-decoration: none; }
.popover .field { padding: 6px 10px; }

.context-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--warn-soft); color: var(--warn);
  border-bottom: 1px solid var(--warn-line); font-weight: 600; position: sticky; top: var(--topbar); z-index: 25;
}
.context-bar .btn { margin-left: auto; }

/* ------------------------------------------------------------ layout */
.layout { display: flex; min-height: calc(100vh - var(--topbar)); }
.sidebar {
  width: var(--side); flex: none; padding: 16px 12px 24px; border-right: 1px solid var(--line); background: var(--surface);
  position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto;
}
.has-context .sidebar { top: calc(var(--topbar) + 41px); height: calc(100vh - var(--topbar) - 41px); }
.nav-group + .nav-group { margin-top: 18px; }
.nav-group-label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--ink); font-weight: 500;
}
.nav-item:hover { background: var(--hover); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-item .ext { margin-left: auto; color: var(--muted); font-size: 12px; }
.nav-foot { margin-top: 24px; padding: 12px 10px 0; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
main { flex: 1; min-width: 0; padding: 24px 28px 96px; }
.page { max-width: 1180px; margin: 0 auto; }
.scrim { display: none; }

.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.cards > .card { margin-top: 0; }
.card h2 { font-size: 16px; margin-bottom: 4px; }
.card > p.lead { margin: 0 0 16px; color: var(--muted); }
.card-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile .num { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.tile .lbl { color: var(--muted); font-size: 13px; }
.module-card { display: flex; flex-direction: column; }
.module-card h3 { font-size: 16px; }
.module-card .card-foot { margin-top: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.table-tools { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.table-tools input { max-width: 280px; }
.wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
tbody tr:hover { background: var(--hover); }

.empty { text-align: center; padding: 40px 16px; }
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 auto 16px; max-width: 460px; }
.steps { margin: 0; padding-left: 20px; }
.steps li + li { margin-top: 6px; }
.result { font-size: 13px; }
.result.ok { color: var(--ok); }
.result.bad { color: var(--danger); }
.result.warn { color: var(--warn, #b45309); }

/* ------------------------------------------------------------ copilot, toasts, dialog */
.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 40; width: 56px; height: 56px; border-radius: 50%;
  border: 0; cursor: pointer; background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow); font-size: 22px;
}
.side-panel {
  position: fixed; right: 0; top: var(--topbar); bottom: 0; width: min(400px, 100vw); z-index: 45; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.side-panel header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-panel .body { padding: 16px; overflow-y: auto; }
#toasts { position: fixed; right: 16px; bottom: 96px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px; padding: 10px 14px; box-shadow: var(--shadow); }
.toast.bad { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn-line); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2, 6, 23, .5); }
dialog .row { justify-content: flex-end; margin-top: 18px; }

/* ------------------------------------------------------------ sign-in and setup */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--top); color: var(--top-ink); }
.auth-top select { width: auto; min-height: 32px; padding: 4px 8px; background: transparent; color: var(--top-ink); border-color: var(--top-line); }
.auth-top select option { color: #0f172a; }
.auth-card { width: min(440px, calc(100vw - 32px)); margin: 8vh auto 32px; }
.auth-card.wide { width: min(640px, calc(100vw - 32px)); margin-top: 4vh; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .stack { margin-top: 16px; }
.err { color: var(--danger); min-height: 1.2em; font-size: 13px; }

/* ------------------------------------------------------------ narrow screens */
.only-narrow { display: none; }
@media (max-width: 900px) {
  .only-narrow { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar); bottom: 0; height: auto; z-index: 35; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .has-context .sidebar { top: var(--topbar); height: auto; }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: var(--topbar) 0 0 0; background: rgba(2, 6, 23, .45); z-index: 34; }
  main { padding: 16px 16px 96px; }
  .topbar .tenant-name, .powered, .brand-name .sub { display: none; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .topbar .badge { display: none; }
  .fab { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------------------------------------------------------------- quote check */
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qc-cell { display: inline-block; text-align: right; padding: 2px 6px; border-radius: 6px; }
.qc-cell.qc-tolerance { background: var(--warn-soft); }
.qc-cell.qc-flagged { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.qc-exp { font-size: 11px; font-weight: 400; color: var(--muted); }
.qc-banner { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; border-left: 4px solid var(--line); }
.qc-banner > p { margin: 0; flex: 1 1 260px; }
.qc-banner.qc-ok { border-left-color: var(--ok); }
.qc-banner.qc-tolerance { border-left-color: var(--warn); }
.qc-banner.qc-flagged, .qc-banner.qc-unreadable { border-left-color: var(--danger); }
.qc-text { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; max-height: 420px; overflow: auto; }
details.card > summary { cursor: pointer; font-weight: 600; }
.qc-desc { display: inline-block; min-width: 200px; }
td .chip { white-space: nowrap; }
.qc-banner.qc-confirming, .qc-banner.qc-unsure { border-left-color: var(--warn); }
.qc-banner > p.small, .qc-banner > .row { flex-basis: 100%; }
.qc-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.qc-dl dt { color: var(--muted); }
.qc-dl dd { margin: 0; overflow-wrap: anywhere; }
.qc-chat { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.qc-msg { max-width: 85%; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.qc-msg.qc-user { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.qc-msg-text { white-space: pre-wrap; }
.qc-proposal { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface); }
.qc-proposal ul { margin: 6px 0; padding-left: 18px; }
@media (max-width: 640px) { .qc-msg { max-width: 100%; } }
.qc-pick-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.qc-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.qc-pick.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.qc-logo img { max-height: 56px; max-width: 200px; background: #fff; border-radius: 4px; padding: 4px; }
.qc-swatch { flex-direction: row; font-size: 12px; }
.qc-sw { width: 22px; height: 22px; border-radius: 4px; display: inline-block; }
/* quote check: step 1 / step 2 (2026-10-22) */
.qc-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.qc-step-head h2 { margin: 0; flex: 1; }
.qc-step-n { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }
.qc-step-locked { opacity: .65; }
.qc-step-locked .qc-step-n { background: var(--line-strong); }
.qc-problems { margin: 6px 0 14px; padding-left: 20px; }
.qc-problems li { margin: 4px 0; }
.qc-problems:not(.ok):not(.small) li::marker { color: var(--danger); }
.qc-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.qc-choice { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.qc-choice p { margin: 0; }
.qc-approve { margin-top: 12px; }
.qc-note { margin: 6px 0 10px; padding: 6px 12px; border-left: 3px solid var(--ok); background: var(--surface-2); white-space: pre-wrap; }
.qc-fold > summary, .qc-details > summary { cursor: pointer; }
.qc-fold > .card { border: 0; box-shadow: none; padding: 0; margin: 12px 0 0; background: transparent; }
.qc-details { margin-top: 8px; }
.qc-details > summary { padding: 10px 4px; font-weight: 600; }
/* proposal assistant panel (2026-10-22) */
.page:has(.qc-split) { max-width: none; }
.qc-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 42%); gap: 20px; align-items: start; }
.qc-split.collapsed { grid-template-columns: minmax(0, 1fr) 56px; }
.qc-split.wide { grid-template-columns: minmax(0, 1fr); }
.qc-split.wide > .qc-split-main { display: none; }
.qc-split.collapsed .qca-body, .qc-split.collapsed .qca-head > div, .qc-split.collapsed .qca-head .btn:not(.qca-size) { display: none; }
.qca { position: sticky; top: calc(var(--topbar) + 12px); height: calc(100vh - var(--topbar) - 36px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.qca-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.qca-head .muted::before { content: "● "; color: var(--ok); }
.qca-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.qca-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.qca-msg { max-width: 94%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.qca-user { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.qca-card { width: 94%; }
.qca-card p { margin: 8px 0 4px; }
.qca-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qca-text { white-space: pre-wrap; }
.qca-table { margin: 8px 0; font-size: 12px; }
.qca-table td, .qca-table th { padding: 4px 6px; }
.qca-table tr.bad td { background: var(--danger-soft); }
.qca-views ul { margin: 4px 0 6px; padding-left: 18px; }
.qca-q { font-weight: 600; }
.qca-card .row { flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.qca-blocked { border-left: 3px solid var(--warn); }
.qca-thinking { color: var(--muted); }
.qca-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.qca-input textarea { flex: 1; resize: none; min-height: 38px; max-height: 140px; }
.qca-foot { font-size: 11px; text-align: center; padding: 0 12px 10px; }
.qca-preview iframe { width: 100%; height: 360px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin: 8px 0; }
.qca-mail { white-space: pre-wrap; font: inherit; font-size: 13px; background: var(--surface-2); padding: 8px; border-radius: 6px; }
.qca-att { margin-top: 8px; padding: 6px 8px; border: 1px dashed var(--line-strong); border-radius: 6px; }
.qca-in { animation: qca-in .35s ease both; }
.qca-md p { margin: 0 0 6px; } .qca-md p:last-child { margin-bottom: 0; }
.qca-md ul { margin: 4px 0 6px; padding-left: 18px; }
.qca-md code { font-size: 12px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.qca-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.qca-fold { margin-top: 6px; }
.qca-fold > summary { cursor: pointer; list-style: none; padding: 4px 0; }
.qca-fold > summary::-webkit-details-marker { display: none; }
.qca-fold > summary .link { color: var(--accent); text-decoration: underline; }
.qca-fold[open] > summary .link { display: none; }
.qca-failed { border-left: 3px solid var(--danger, #c33); }
.qca-files { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 12px 0; }
.qca-files[hidden] { display: none; }
.qca-file { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qca-hints { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.qca-hints .chip { cursor: pointer; border: 1px solid var(--line); background: var(--surface); }
.qc-ladder { margin: 0 0 12px; padding-left: 20px; }
.qc-ladder li { margin: 2px 0; }
@keyframes qca-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 980px) { .qc-split, .qc-split.collapsed { grid-template-columns: 1fr; } .qca { position: static; height: 640px; } }

.card-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mail-test { margin-top: 12px; }
.mail-steps { margin: 8px 0; padding-left: 18px; }
.mail-steps li.ok { color: var(--ok); } .mail-steps li.bad { color: var(--danger, #c33); }

.team-tree { display: flex; flex-direction: column; gap: 6px; }
.team-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  margin-left: calc(var(--depth, 0) * 28px); background: var(--surface); }
.team-row .form-grid { flex: 1; }
.team-row details ul { margin: 4px 0 0; padding-left: 18px; }
.cap-paid { margin-left: 6px; font-size: 11px; }
.cap-all td { background: var(--surface-2); }
td.center, th.center { text-align: center; }
.row.wrap { flex-wrap: wrap; }
.days .check { margin-right: 6px; }
.auto-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.auto-form.compact .field { margin: 0; }
.auto-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px; margin-top: 6px; }
.qca-auto { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.qca-auto:empty { display: none; }
.rule-row { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 12px 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.rule-row:first-of-type { border-top: 0; }
.rule-row select[multiple] { min-width: 220px; }
@media (max-width: 720px) { .rule-row { grid-template-columns: 1fr; } }
.rule-row > .chip { justify-self: start; align-self: start; }
dialog:has(.confirm-text .stack) { width: min(760px, calc(100vw - 32px)); max-height: 90vh; overflow: auto; }
.confirm-text { white-space: pre-line; margin: 0 0 4px; }
.confirm-text .stack { white-space: normal; }
.doc-card { border-left: 3px solid var(--accent); padding: 6px 10px; margin: 6px 0; background: var(--surface-2, rgba(99,102,241,.06)); border-radius: 6px; }
.doc-card > div + div { margin-top: 2px; }
.qca-warn { border-left: 3px solid var(--warn); padding-left: 8px; }
.qca-switch { background: none; border: 0; border-top: 1px dashed var(--line, #334); border-radius: 0; color: var(--muted); font-size: 13px; padding-top: 8px; }
/* skill factory (23i): audience picker and generated code */
.qc-aud { display: flex; flex-wrap: wrap; gap: 4px 16px; max-height: 160px; overflow: auto; }
.qc-code { white-space: pre; overflow: auto; max-height: 360px; padding: 8px; background: var(--surface-2, rgba(127,127,127,.08)); border-radius: 6px; }

.auto-report { white-space: pre-wrap; font-size: 12.5px; background: var(--surface-2, rgba(127,127,127,.08)); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; margin-top: 6px; }
