/* G3O dashboard: the design system (plan 36). One file of tokens, controls and patterns; every page builds on it and
   defines no colour of its own. Light by default; dark follows the system or the person's choice. */

/* -- tokens --------------------------------------------------------------------------------------------------------- */
:root {
  --bg: #F6F4EF;
  --sidebar: #ECEAE3;
  --surface: #FFFFFF;
  --surface-2: #F9F8F5;
  --surface-3: #F2F0EA;
  --chip: #E9E7E0;
  --chip-hover: #E0DDD4;
  --ink: #1A1916;
  --ink-2: #403D37;
  --muted: #6B675E;
  --faint: #9C978C;
  --line: #E4E1D9;
  --line-2: #EDEBE5;
  --line-strong: #CDC9BE;
  --accent: #1E7A3C;
  --accent-hover: #196632;
  --on-accent: #FFFFFF;
  --accent-ink: #176030;
  --accent-soft: #E3F1E7;
  --accent-soft-2: #CFE6D6;
  --warn: #B5680E;
  --warn-soft: #FBEEDB;
  --warn-ink: #7A4707;
  --ok: #2D7A45;
  --ok-soft: #E3F1E6;
  --bad: #B33A27;
  --bad-soft: #F9E4DF;
  --info: #2160A8;
  --info-soft: #E3ECF7;
  --info-ink: #1A4A82;
  --track: #E6E3DB;
  --shadow: 0 1px 2px rgba(26, 25, 22, 0.05), 0 0 0 1px rgba(26, 25, 22, 0.03);
  --shadow-card: 0 1px 2px rgba(26, 25, 22, 0.04);
  --shadow-pop: 0 16px 40px -12px rgba(26, 25, 22, 0.28), 0 2px 8px rgba(26, 25, 22, 0.08);
  --focus: 0 0 0 3px rgba(30, 122, 60, 0.22);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --side-w: 248px;
  --rail-w: 64px;
  --qr-bg: #FFFFFF;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513;
    --sidebar: #1B1A17;
    --surface: #211F1C;
    --surface-2: #1D1C19;
    --surface-3: #272522;
    --chip: #2C2A26;
    --chip-hover: #35322D;
    --ink: #ECE9E2;
    --ink-2: #CFCABF;
    --muted: #A39D91;
    --faint: #6F6A60;
    --line: #34322D;
    --line-2: #2C2A26;
    --line-strong: #47443E;
    --accent: #62BC7D;
    --accent-hover: #78C890;
    --on-accent: #111410;
    --accent-ink: #93D3A6;
    --accent-soft: #1D3324;
    --accent-soft-2: #26432F;
    --warn: #E0A458;
    --warn-soft: #3A2A18;
    --warn-ink: #F3D3AC;
    --ok: #7CC48E;
    --ok-soft: #1E3325;
    --bad: #EF8F7D;
    --bad-soft: #3E211C;
    --info: #88B8E4;
    --info-soft: #1B2C3D;
    --info-ink: #C0D9EF;
    --track: #34322D;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.35);
    --focus: 0 0 0 3px rgba(98, 188, 125, 0.3);
    --r-sm: 6px;
    --r: 8px;
    --r-lg: 12px;
    --r-xl: 16px;
    --side-w: 248px;
    --rail-w: 64px;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513;
  --sidebar: #1B1A17;
  --surface: #211F1C;
  --surface-2: #1D1C19;
  --surface-3: #272522;
  --chip: #2C2A26;
  --chip-hover: #35322D;
  --ink: #ECE9E2;
  --ink-2: #CFCABF;
  --muted: #A39D91;
  --faint: #6F6A60;
  --line: #34322D;
  --line-2: #2C2A26;
  --line-strong: #47443E;
  --accent: #62BC7D;
  --accent-hover: #78C890;
  --on-accent: #111410;
  --accent-ink: #93D3A6;
  --accent-soft: #1D3324;
  --accent-soft-2: #26432F;
  --warn: #E0A458;
  --warn-soft: #3A2A18;
  --warn-ink: #F3D3AC;
  --ok: #7CC48E;
  --ok-soft: #1E3325;
  --bad: #EF8F7D;
  --bad-soft: #3E211C;
  --info: #88B8E4;
  --info-soft: #1B2C3D;
  --info-ink: #C0D9EF;
  --track: #34322D;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.35);
  --focus: 0 0 0 3px rgba(98, 188, 125, 0.3);
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --side-w: 248px;
  --rail-w: 64px;
  color-scheme: dark;
}

/* -- base ----------------------------------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 24px; letter-spacing: -0.02em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent-ink); }
a:hover { color: var(--accent); }
svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
code, pre, .mono { font-family: var(--mono); }
.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; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lede { color: var(--muted); font-size: 14px; max-width: 640px; margin-top: 4px; }
.error { color: var(--bad); font-size: 13px; }
.error:empty { display: none; }
.row { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.wrap { flex-wrap: wrap; }
.end { justify-content: flex-end; align-items: flex-end; }
.grow { flex-grow: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft-2); }

/* -- scrollbars: thin, rounded, quiet until hovered; follows the theme through --faint / --line-strong -------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  *::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
  *::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: transparent; }
  *::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; min-height: 32px; min-width: 32px; }
  *::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }
  *::-webkit-scrollbar-thumb:active { background: var(--muted); background-clip: content-box; }
}

/* -- controls ------------------------------------------------------------------------------------------------------- */
button, .as-btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button svg, .as-btn svg { width: 16px; height: 16px; }
.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-card); }
.secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.ghost:hover:not(:disabled) { background: var(--chip); color: var(--ink); }
.danger-text { color: var(--bad); }
.link-btn.danger-text { color: var(--bad); }
.primary.danger { background: var(--bad); color: #fff; }
.primary.danger:hover:not(:disabled) { background: var(--bad); filter: brightness(0.92); }
.small-btn, button.small { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); gap: 6px; }
.small-btn svg, button.small svg { width: 15px; height: 15px; }
.lg-btn { min-height: 42px; padding: 0 20px; font-size: 14px; }
.icon-btn { min-height: 36px; min-width: 36px; padding: 0; background: transparent; color: var(--ink-2); border-color: transparent; }
.icon-btn:hover:not(:disabled) { background: var(--chip); color: var(--ink); }
.icon-btn.small { min-height: 30px; min-width: 30px; border-radius: var(--r-sm); }
.icon-btn.small svg { width: 16px; height: 16px; }
.link-btn { min-height: 28px; padding: 0 4px; background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 500; border-radius: 4px; }
.link-btn:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link-btn.accent { color: var(--accent-ink); }
.link-btn.inline { min-height: 0; padding: 0; font-size: inherit; vertical-align: baseline; }
.send { min-width: 36px; min-height: 36px; padding: 0; border-radius: var(--r); background: var(--accent); color: var(--on-accent); }
.send:hover:not(:disabled) { background: var(--accent-hover); }
.stop { background: var(--ink); color: var(--bg); }
.stop:hover:not(:disabled) { background: var(--ink-2); }

label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label .note { font-size: 12px; font-weight: 400; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], input[type="url"], select, textarea {
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  min-height: 36px;
  padding: 0 10px;
  width: 100%;
  box-shadow: var(--shadow-card);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { padding: 8px 10px; line-height: 1.5; resize: vertical; }
textarea.mono { font-family: var(--mono); font-size: 13px; background: var(--surface-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
input[type="file"] { font-size: 13px; color: var(--ink-2); }
.select-wrap { position: relative; }
.with-prefix { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-card); }
.with-prefix:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.with-prefix span { padding-left: 10px; font-family: var(--mono); color: var(--muted); font-weight: 400; }
.with-prefix input { border: none; box-shadow: none !important; font-family: var(--mono); padding-left: 2px; }
.toggle { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.toggle input { width: 16px; height: 16px; }
label.check, label.radio { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--ink); cursor: pointer; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; padding: 0; }

/* a segmented control: Light | Dark | System, List | Tiles, the rail's tabs */
.seg, .theme-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r); background: var(--chip); }
.seg button, .theme-switch button { flex: 1 1 0; min-height: 28px; padding: 0 10px; gap: 6px; border: none; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.seg button svg, .theme-switch button svg { width: 14px; height: 14px; }
.seg button:hover:not(:disabled), .theme-switch button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

/* filter chips (All | Internal reports | Data room) */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { min-height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.filter:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* menus: a <details class="menu"> with a summary trigger and a .menu-pop panel */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; z-index: 60; min-width: 220px; padding: 6px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 2px; }
.menu-pop.right { right: 0; }
.menu-pop.up { bottom: calc(100% + 6px); }
.menu-pop:not(.up) { top: calc(100% + 6px); }
.menu-btn { justify-content: flex-start; gap: 10px; min-height: 34px; padding: 0 10px; border: none; border-radius: var(--r-sm); background: none; color: var(--ink); font-size: 13.5px; font-weight: 400; width: 100%; text-align: left; }
.menu-btn:hover:not(:disabled), .menu-btn:focus-visible { background: var(--chip); outline: none; }
.menu-btn svg { width: 16px; height: 16px; color: var(--muted); }
.menu-btn.danger-text, .menu-btn.danger-text svg { color: var(--bad); }
.menu-sec { padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 8px; }
.menu-hr { border: none; border-top: 1px solid var(--line-2); margin: 4px 6px; }

/* -- chips, pills, tags, badges -------------------------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--ink-2); text-transform: capitalize; white-space: nowrap; line-height: 1.5; }
.pill:empty { display: none; }
.pill.done, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.failed, .pill.cancelled, .pill.interrupted { background: var(--bad-soft); color: var(--bad); }
.pill.running, .pill.started, .pill.starting, .pill.queued, .pill.organizing, .pill.drafting, .pill.extracting, .pill.classifying, .pill.indexing { background: var(--info-soft); color: var(--info); }
.pill.paused, .pill.pausing, .pill.waiting_for_answers, .pill.waiting { background: var(--warn-soft); color: var(--warn-ink); }
.pill.abandoned { background: var(--chip); color: var(--muted); }
.pill.room_plan { text-transform: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge svg { width: 13px; height: 13px; stroke-width: 2; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--chip); color: var(--ink-2); font-size: 11.5px; font-weight: 500; white-space: nowrap; line-height: 1.6; }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag.old { background: var(--info-soft); color: var(--info-ink); }
.tag.stale { background: var(--warn-soft); color: var(--warn-ink); white-space: normal; margin-left: 6px; }
.flag { margin-left: 8px; font-size: 12px; color: var(--accent-ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--chip); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip.chat-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.chip.chat-state.ready { background: var(--ok-soft); color: var(--ok); } .chip.chat-state.ready::before { background: var(--ok); }
.chip.chat-state.running { background: var(--info-soft); color: var(--info); } .chip.chat-state.running::before { background: var(--info); }
.chip.chat-state.waiting { color: var(--muted); }
.chip.chat-state.off { background: var(--warn-soft); color: var(--warn-ink); } .chip.chat-state.off::before { background: var(--warn); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.dot.ok { background: var(--ok); } .dot.info { background: var(--info); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

/* -- sign in -------------------------------------------------------------------------------------------------------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-side { display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; background: var(--sidebar); border-right: 1px solid var(--line); }
.login-side .brand { padding: 0; }
.login-side h2 { font-size: 30px; letter-spacing: -0.025em; max-width: 440px; line-height: 1.2; }
.login-side p { color: var(--muted); max-width: 420px; margin-top: 12px; font-size: 15px; }
.login-points { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); font-size: 14px; }
.login-points li { display: flex; gap: 10px; align-items: flex-start; }
.login-points svg { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.login-foot { font-size: 12px; color: var(--muted); }
.login-main { display: grid; place-items: center; padding: 32px 24px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-size: 24px; }
.login-card .brand { display: none; }
.login-card .primary { min-height: 40px; }
@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-side { display: none; }
  .login-card .brand { display: flex; }
}

/* -- shell ---------------------------------------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; }
html.side-collapsed .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.topbar { display: none; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); padding: 14px 0 0; display: flex; flex-direction: column; gap: 12px; overflow: hidden; min-height: 0; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 0 16px; flex-shrink: 0; }
.side-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 12px 12px; display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--ink); }
.mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; font-weight: 600; flex-shrink: 0; letter-spacing: 0.02em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-collapse { color: var(--muted); }
.side-block { display: flex; flex-direction: column; gap: 6px; }
.side-block > .eyebrow { padding: 0 6px; }

/* the project switcher */
.proj-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 6px; }
.proj-head .eyebrow { display: flex; flex-direction: row; align-items: center; gap: 4px; }
.proj-menu > summary { min-height: 26px; min-width: 26px; }
.proj-menu .menu-pop { right: 0; }
.proj-select select { min-height: 42px; font-weight: 600; font-size: 13.5px; padding: 0 30px 0 12px; border-color: var(--line); background-color: var(--surface); overflow: hidden; text-overflow: ellipsis; }
.proj-state { display: flex; align-items: center; gap: 7px; min-height: 18px; padding: 0 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-state:empty { display: none; }
.proj-state .dot { width: 7px; height: 7px; }
.side-links { display: flex; flex-direction: column; align-items: flex-start; }

/* navigation */
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item { position: relative; justify-content: flex-start; gap: 10px; min-height: 34px; padding: 0 10px; border-radius: var(--r); background: transparent; color: var(--ink-2); font-size: 13.5px; font-weight: 500; border: none; width: 100%; }
.nav-item svg { width: 17px; height: 17px; color: var(--muted); }
.nav-item:hover { background: var(--chip); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-card); }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; justify-content: center; }
.badge.warnb { background: var(--bad-soft); color: var(--bad); margin-left: auto; }
.nav-group { display: flex; flex-direction: column; gap: 6px; }
.nav-group > .eyebrow { padding: 4px 10px 0; }

/* recent chats and requests */
.recent { flex: 1 1 auto; min-height: 60px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 10px; }
.recent-head .eyebrow { display: flex; align-items: center; gap: 4px; }
.chat-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.chat-link { justify-content: flex-start; min-height: 30px; padding: 0 10px; border: none; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 400; text-align: left; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 30px; white-space: nowrap; }
.chat-link:hover { background: var(--chip); color: var(--ink); }
.chat-link[aria-current="true"] { background: var(--chip-hover); color: var(--ink); font-weight: 500; }
.chat-list .muted { padding: 2px 10px; font-size: 12.5px; }
/* archived chats (plan 37): last in Recent chats, under their own heading, each with a small lock */
.chat-group { display: flex; align-items: center; gap: 5px; margin-top: 8px; padding: 4px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.chat-group svg, .chat-link.archived svg { width: 12px; height: 12px; }
.chat-link.archived svg { margin-right: 6px; vertical-align: -1px; color: var(--muted); }
.req-block .eyebrow { padding: 0 10px; }
.req-list { display: flex; flex-direction: column; gap: 6px; padding: 2px 6px 0; }
.req-item { display: flex; flex-direction: column; gap: 3px; padding: 7px 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-2); font-size: 12.5px; line-height: 1.35; }
.req-item .req-state { color: var(--muted); font-size: 11.5px; }
.req-item .req-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.req-item .req-actions .small-btn { min-height: 26px; padding: 0 8px; font-size: 12px; }

/* account */
.side-account { flex-shrink: 0; padding: 8px 12px 10px; background: var(--sidebar); border-top: 1px solid var(--line); }
.acct-menu > summary.who { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: var(--r); min-width: 0; }
.acct-menu > summary.who:hover { background: var(--chip); }
.acct-menu[open] > summary.who { background: var(--chip); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft-2); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.who-text { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; line-height: 1.2; }
.who-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-chev { width: 14px; height: 14px; color: var(--muted); }
.acct-menu .menu-pop { left: 0; right: 0; min-width: 0; }
.acct-menu .theme-switch { width: 100%; }
.app-version { margin: 2px 10px 4px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
#tour-open.menu-btn { color: var(--ink); }
.scrim { display: none; }

/* collapsed rail: icons only, the project as its code */
html.side-collapsed .sidebar { padding: 14px 0 0; gap: 12px; }
html.side-collapsed .side-scroll { padding: 2px 8px 12px; }
html.side-collapsed .brand-text, html.side-collapsed .proj-head, html.side-collapsed .proj-state, html.side-collapsed .nav-item > span:not(.badge), html.side-collapsed .nav-group > .eyebrow,
html.side-collapsed .recent, html.side-collapsed .req-block, html.side-collapsed .who-text, html.side-collapsed .who-chev, html.side-collapsed .side-links { display: none; }
html.side-collapsed .side-top { flex-direction: column; gap: 10px; padding: 0 8px; }
html.side-collapsed .proj-select select { padding: 0; text-align: center; font-size: 11px; font-family: var(--mono); background-image: none; min-height: 36px; }
html.side-collapsed .nav-item { justify-content: center; padding: 0; min-height: 38px; }
html.side-collapsed .nav-item[aria-current="page"]::before { left: -8px; }
html.side-collapsed .nav-item .badge { position: absolute; top: 4px; right: 4px; margin: 0; min-width: 16px; height: 16px; font-size: 10px; }
html.side-collapsed .side-account { padding: 8px 8px 10px; }
html.side-collapsed .acct-menu > summary.who { justify-content: center; padding: 6px 0; }
html.side-collapsed .acct-menu .menu-pop { left: 0; min-width: 240px; }
html.side-collapsed .side-collapse svg { transform: rotate(180deg); }

/* -- pages ---------------------------------------------------------------------------------------------------------- */
.view { min-width: 0; min-height: 0; overflow-y: auto; }
.page { padding: 28px 36px 56px; display: flex; flex-direction: column; gap: 18px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page > * { flex-shrink: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 2px; }
.page-head h1 { display: flex; align-items: center; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-card); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line-2); min-height: 46px; }
.card-head h2 { font-size: 14.5px; }
.card-head input { max-width: 260px; min-height: 32px; }
.card-head.flat { border-bottom: none; padding: 0 0 10px; min-height: 0; }
.card-foot { padding: 10px 20px; border-top: 1px solid var(--line-2); }
.empty { padding: 24px 20px; color: var(--muted); }
.banner-error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: var(--r); font-size: 13.5px; }
.banner-info { padding: 10px 14px; border-radius: var(--r); background: var(--info-soft); color: var(--info-ink); font-size: 13.5px; }
.note { font-size: 13px; }
.warn { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn-ink); font-size: 13.5px; line-height: 1.5; }
.warn svg { width: 16px; height: 16px; margin-top: 2px; stroke-width: 2; flex-shrink: 0; }
.dot.warn { display: inline-block; padding: 0; border-radius: 50%; }  /* a status dot in the warn tone is a dot, not the callout above */
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }

/* help bubble (help.js): small and quiet, beside the title */
.help-btn { width: 18px; height: 18px; min-height: 18px; padding: 0; margin-left: 2px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font: 600 11px/1 var(--sans); cursor: pointer; vertical-align: middle; opacity: 0.8; }
.help-btn:hover, .help-btn[aria-expanded=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); opacity: 1; }

/* -- tables --------------------------------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
#view-knowledge .table-wrap { max-height: min(600px, 65vh); overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line-2); }
.table th { text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:first-child td { border-top: none; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tr.run { cursor: pointer; }
.table tr.run:hover td { background: var(--surface-2); }
.table tr.run.selected td { background: var(--accent-soft); }
.table tr.run.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.table .num, .table .mono { font-family: var(--mono); font-size: 12.5px; }
.table .when { color: var(--ink-2); white-space: nowrap; }
.table .bad { color: var(--bad); }
.mini { display: flex; align-items: center; gap: 8px; }
.track { width: 64px; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; flex-shrink: 0; }
.track > span { display: block; height: 100%; background: var(--info); border-radius: 3px; }
.mini .txt { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.refused td { background: var(--bad-soft); }

/* -- key figures ---------------------------------------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.tile { background: var(--surface); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 0; outline: 1px solid var(--line); }
.tile .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.tile .value { font-size: 22px; letter-spacing: -0.02em; font-weight: 600; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .value.text { font-size: 16px; padding-top: 4px; text-transform: capitalize; }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile .value.info { color: var(--info); }
.tile .value.neg { color: var(--bad); }
.stats { display: flex; gap: 24px; font-size: 12px; color: var(--muted); }
.stats strong { display: block; font-size: 20px; letter-spacing: -0.02em; font-weight: 600; color: var(--ink); line-height: 1.1; }

/* -- progress: the page ----------------------------------------------------------------------------------------------- */
/* One column. The readiness row (status.js) sits above the job card as a full-width strip, so the job card and the reports list keep
   the whole page width; before plan 36.1 it was a 300px side column, most of it empty. */
.progress-grid { display: flex; flex-direction: column; gap: 14px; }
.progress-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; order: 1; }
.progress-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; order: 0; }
.progress-side:not(:has(#readiness-card:not([hidden]))) { display: none; }
.progress-side > .card { padding: 10px 18px; }
.progress-side > .card > p { margin: 0; }
.progress-side .st-card-body { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 14px; }
.progress-side .st-card-main { gap: 4px; }
.progress-side .st-card-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.progress-side .st-card-actions .ghost { border-color: var(--line); }
.progress-side .st-ring, .progress-side .st-ring svg { width: 48px; height: 48px; }
.progress-side .st-ring-num { font-size: 13px; }
.progress-side .st-card-title { font-size: 13.5px; }
.progress-side .st-counts { font-size: 13px; }

.start-card { display: flex; align-items: flex-end; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.start-card label { font-size: 12px; }
.start-card input { width: 96px; font-family: var(--mono); }
.start-hint { max-width: 260px; line-height: 1.4; padding-bottom: 2px; }
#run-tiles { display: none; }
.runs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.runs-head h2 { font-size: 15px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
body:not(.is-admin) .split { grid-template-columns: minmax(0, 1fr); }
.detail { display: flex; flex-direction: column; gap: 12px; }
.detail.placeholder { min-height: 160px; display: grid; place-items: center; text-align: center; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.detail-head h2 { font-size: 15px; }
.phase { display: flex; justify-content: space-between; gap: 12px; font-weight: 500; font-size: 13.5px; }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.4s ease; }
.bar.bad > span { background: var(--bad); }
.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: 12px; color: var(--muted); }
.counts strong { display: block; font-size: 16px; color: var(--ink); font-weight: 600; }
.counts .bad strong { color: var(--bad); }
.failures { display: flex; flex-direction: column; gap: 8px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.failure { border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; background: var(--surface-2); }
.failure-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.failure .filename { font-size: 13px; font-weight: 500; }
.failure .path { font-size: 12px; color: var(--muted); }
.failure pre { margin: 0; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; font-family: var(--sans); }
.bucket { padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--chip); color: var(--ink-2); }
.bucket.model_too_large, .bucket.too_large, .bucket.corrupted { background: var(--bad-soft); color: var(--bad); }
.bucket.held { background: var(--warn-soft); color: var(--warn-ink); }
.held-note { margin: 0; font-size: 13px; color: var(--muted); }
#detail-warnings ul { margin: 6px 0 0; padding-left: 18px; }
#failures-title { font-size: 13.5px; }

/* the job card */
.job-card { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 12px; }
.job-card .job-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.job-card h2 { margin: 0; font-size: 17px; letter-spacing: -0.015em; }
.job-body { display: flex; flex-direction: column; gap: 12px; }
.job-body:empty { display: none; }
.steps-track { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.steps-track.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .steps-track.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.steps-track li { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding-top: 10px; border-top: 3px solid var(--line-strong); color: var(--muted); min-width: 0; }
.track-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.track-sub { font-size: 12.5px; color: var(--ink-2); }
.steps-track .track-note { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.steps-track li.st-running { border-color: var(--info); } .steps-track li.st-running .track-name { color: var(--ink); } .steps-track li.st-running .track-sub { color: var(--info); font-weight: 600; }
.steps-track li.st-you { border-color: var(--warn); } .steps-track li.st-you .track-name { color: var(--ink); }
.steps-track li.st-you .track-sub { background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.steps-track li.st-done, .steps-track li.st-partial { border-color: var(--ok); } .steps-track li.st-done .track-name, .steps-track li.st-partial .track-name { color: var(--ok); }
.steps-track li.st-failed { border-color: var(--bad); } .steps-track li.st-failed .track-name, .steps-track li.st-failed .track-sub { color: var(--bad); }
.steps-track li.st-skipped { opacity: 0.55; }
/* plan 37: the "⋯" menu beside a step's name and its Redo lines. Tokens only, so light and dark both follow the system above. The pop
   opens under the step it belongs to (left edge; the last step's right edge), and app.js keeps it inside the window. */
.track-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 4px; align-self: stretch; min-width: 0; }
.track-head .track-name { min-width: 0; overflow-wrap: anywhere; }
.track-menu { position: static; flex-shrink: 0; }
.track-menu > summary { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; margin: -5px -6px -5px 0; border-radius: var(--r-sm); color: var(--muted); opacity: 0; }
.steps-track li:hover .track-menu > summary, .steps-track li:focus-within .track-menu > summary, .track-menu[open] > summary { opacity: 1; }
.track-menu > summary:hover, .track-menu[open] > summary { background: var(--chip); color: var(--ink); }
@media (hover: none) { .track-menu > summary.icon-btn { opacity: 1; min-width: 36px; min-height: 36px; margin: -8px -10px -8px 0; } }
.track-menu > .track-pop { left: 0; right: auto; top: calc(100% + 4px); width: min(320px, calc(100vw - 48px)); min-width: 0; }
.steps-track li:last-child .track-menu > .track-pop { left: auto; right: 0; }
.track-pop-title { padding: 6px 10px 2px; }
.track-pop .redo-line { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; height: auto; min-height: 0; padding: 8px 10px; white-space: normal; text-align: left; }
.track-pop .redo-line:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.track-pop .redo-line:disabled { opacity: 1; cursor: not-allowed; }
.redo-label { font-size: 13.5px; font-weight: 500; line-height: 1.3; color: var(--ink); }
.redo-hint { font-size: 12px; font-weight: 400; line-height: 1.4; color: var(--muted); }
.track-pop .redo-line:disabled .redo-label { color: var(--muted); }
/* the redo dialog is the purge dialog's pattern; its red button keeps readable text on the lighter red of the dark theme */
#redo-btn.danger { color: var(--on-accent); }
#redo-error { white-space: pre-line; }  /* the worker puts a reason on its own line ("the copy could not start" ...) */
.job-now { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.job-now.bad { color: var(--bad); } .job-now.ok { color: var(--ok); } .job-now.you { color: var(--warn-ink); }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.job-foot { display: flex; flex-wrap: wrap; gap: 6px 20px; border-top: 1px solid var(--line-2); padding-top: 6px; }
.job-foot > div:empty { display: none; }
.import-box > summary { cursor: pointer; font-weight: 600; }
.job-foot summary:focus:not(:focus-visible) { outline: none; }
.job-foot details > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-ink); min-height: 28px; display: flex; align-items: center; }
.job-foot details[open] { flex-basis: 100%; display: flex; flex-direction: column; gap: 10px; }
.job-foot #job-foot-add:has(details[open]) { flex-basis: 100%; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.steps li { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.steps li.done { background: var(--ok-soft); color: var(--ok); }
.steps li.running { background: var(--info-soft); color: var(--info); font-weight: 600; }
.steps li.failed { background: var(--bad-soft); color: var(--bad); }
.steps li.skipped { text-decoration: line-through; }
.coverage { display: block; padding: 0 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); }
.coverage[hidden] { display: none; }
.coverage > summary { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; list-style: none; }
.coverage > summary::-webkit-details-marker { display: none; }
.coverage > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s ease; flex-shrink: 0; }
.coverage[open] > summary::before { transform: rotate(45deg); }
.coverage[open] .cov-verdict { display: none; }
.coverage h3 { margin: 0; font-size: 13px; }
.coverage .cov-verdict { font-size: 13px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coverage .cov-lines { display: flex; flex-direction: column; gap: 3px; padding: 0 0 10px 16px; }
.coverage p { margin: 0; line-height: 1.45; font-size: 13px; color: var(--ink-2); }
.coverage .bad-text, .coverage .cov-verdict.bad-text { color: var(--bad); }
.activity { display: flex; flex-direction: column; gap: 6px; }
.activity[hidden] { display: none; }
.activity-line { all: unset; box-sizing: border-box; display: flex; align-items: flex-start; gap: 10px; width: 100%; min-height: 24px; cursor: pointer; font-size: 13px; color: var(--muted); border-radius: var(--r-sm); }
.activity-line:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.activity-text { flex: 1 1 auto; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.4; }
.activity-text .what { color: var(--ink); }
.activity-time { flex: none; font-size: 12.5px; font-family: var(--mono); }
.activity .chev { flex: none; font-size: 16px; line-height: 1; transition: transform 0.15s ease; }
.activity-line[aria-expanded="true"] .chev { transform: rotate(90deg); }
.spinner { flex: none; display: grid; grid-template-columns: repeat(2, 4px); gap: 3px; width: 11px; margin-top: 5px; }
.spinner i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.spinner i:nth-child(2) { animation-delay: 0.15s; } .spinner i:nth-child(4) { animation-delay: 0.3s; } .spinner i:nth-child(3) { animation-delay: 0.45s; }
.activity.idle .spinner i { animation: none; opacity: 0.35; }
.activity-calls { margin: 0; padding: 8px 0 0 22px; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line-2); max-height: 200px; overflow-y: auto; }
.activity-calls li { display: flex; justify-content: space-between; gap: 12px; }
.activity-calls li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.activity-calls li > .mono { flex: none; white-space: nowrap; }
.activity-calls li.running > span:first-child { color: var(--ink); }
.activity-calls li.failed { color: var(--bad); }
.activity-calls .sent { font-size: 12px; color: var(--muted); }
/* Plan 38 (item 71): while the project waits for its uploaded files. The drop zone is quiet while the folder is empty and
   confident once files are in; this visit's uploads list under it; then the one button, with "No files yet" under it. */
.receive { display: flex; flex-direction: column; gap: 10px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 26px 20px 22px; text-align: center; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease; }
.dropzone > svg { width: 28px; height: 28px; color: var(--accent-ink); margin-bottom: 3px; stroke-width: 1.8; }
.dropzone strong { color: var(--ink); font-size: 15px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.dropzone .row { margin-top: 8px; justify-content: center; }
.dropzone:hover { border-color: var(--faint); }
.dropzone.over { border-color: var(--accent); border-style: solid; background: var(--accent-soft); transform: scale(1.01); }
.dropzone.over > * { pointer-events: none; }
.dropzone.has-files { border-style: solid; border-color: var(--accent-soft-2); background: var(--accent-soft); }
.dropzone.has-files > svg { color: var(--accent); }
.receive-sum { margin: 0; font-variant-numeric: tabular-nums; }
.receive-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.receive-up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.receive-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ink); }
.receive-btns { grid-column: 2; grid-row: 1 / span 3; display: flex; }
.receive-up .bar { grid-column: 1; height: 4px; }
.receive-status { grid-column: 1; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.receive-status.bad { color: var(--bad); } .receive-status.ok { color: var(--ok); }
.receive-actions { display: flex; flex-direction: column; gap: 4px; }
.receive-hint { margin: 0 0 0 2px; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .dropzone { padding: 20px 14px 18px; } .receive-actions .job-actions > .primary { width: 100%; } }

/* -- the upload link panel (plan 38 F3; upload-link.js): a card-less block under the buttons, or inside the Files dialog ---- */
.share-link { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.share-link-lede { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.share-link-body { display: flex; gap: 22px; align-items: flex-start; }
.share-link-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.share-link-field { display: flex; gap: 8px; align-items: center; }
.share-link-field input[readonly] { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); cursor: text; text-overflow: ellipsis; }
.share-link-field .secondary { flex-shrink: 0; min-width: 88px; }
.share-link-field .secondary.copied { color: var(--ok); border-color: var(--accent-soft-2); background: var(--ok-soft); }
.share-link-meta { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.share-link-meta .link-btn { min-height: 24px; }
.share-link-dot { color: var(--faint); padding: 0 2px; }
.share-link-counts { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.share-link-over { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.share-link-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.share-link-notices { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.share-link-notices li { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.share-link-notices svg { width: 15px; height: 15px; color: var(--ok); }
.qr { margin: 0; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.qr img { width: 160px; height: 160px; display: block; border-radius: var(--r); background: #fff; border: 1px solid var(--line-2); }
@media (max-width: 600px) {
  .share-link-body { flex-direction: column; align-items: stretch; }
  .qr { align-items: center; }
  .qr img { width: 180px; height: 180px; }
}
.job-times { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.timeline { max-height: 220px; overflow-y: auto; border-top: 1px solid var(--line-2); padding-top: 8px; font-size: 12.5px; list-style: none; margin: 0; padding-left: 0; }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 2px 0; }
.timeline .k { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.preflight { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.preflight ul { margin: 0; padding: 0; }
.preflight li { list-style: none; }
.preflight .bad { color: var(--bad); }
.preflight .soft { color: var(--warn-ink); }
.rp-callout { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13.5px; }
.rp-callout.ready { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.job-links { display: flex; gap: 8px; flex-wrap: wrap; }
.job-links a { color: var(--ink); }
.job-links .upp-link { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.redraft-box { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
#redraft-fresh-label { display: block; margin: 4px 0; }
#redraft-fresh-label .note { display: block; }
.case { margin: 12px 0; }
.case h3 { display: flex; gap: 8px; align-items: center; }
.case h4 { margin: 10px 0 4px; }
.case-grid { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 6px 0 10px; }
.case-grid dt { color: var(--muted); }
.case-grid dd { margin: 0; }
.detail-actions { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; flex-wrap: wrap; }
#nbo-box { gap: 8px; align-items: center; flex-wrap: wrap; }
#nbo-msg { flex: 1 1 100%; }
.nbo-terms-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; margin: 6px 0; }
.nbo-terms-body label { font-size: 12px; display: flex; flex-direction: column; }
#steps-plant { margin: 0 0 8px; max-width: 320px; }

/* reports */
.report-list { list-style: none; margin: 0; padding: 0; }
.report-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 12px; align-items: center; padding: 5px 20px; border-top: 1px solid var(--line-2); font-size: 13.5px; min-height: 40px; }
.report-row:first-child { border-top: 0; }
.report-status { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.report-status svg { width: 12px; height: 12px; stroke-width: 2.4; }
.report-status.done { background: var(--ok-soft); color: var(--ok); } .report-status.running { background: var(--info-soft); color: var(--info); }
.report-status.failed { background: var(--bad-soft); color: var(--bad); } .report-status.skipped { color: var(--muted); background: transparent; }
.report-status.draft { background: var(--warn-soft); color: var(--warn-ink); } .report-status.waiting { background: var(--chip); color: var(--muted); }
.report-chat { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); } .report-chat svg { width: 13px; height: 13px; stroke-width: 2; }
.report-act { min-height: 26px; padding: 0 6px; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.report-act:hover:not(:disabled) { color: var(--ink); }
.report-row.has-file:hover { background: var(--surface-2); }
a.report-name { color: var(--ink); font-weight: 500; text-decoration: none; } a.report-name:hover { text-decoration: underline; text-underline-offset: 3px; }
span.report-name { color: var(--ink-2); }
.report-open { min-height: 28px; padding: 0 10px; font-size: 12.5px; font-weight: 500; border-radius: var(--r-sm); } .report-open svg { width: 14px; height: 14px; }
.report-note { grid-column: 1 / -1; font-size: 12.5px; color: var(--bad); }
#job-reports-plant { margin: 10px 20px 0; max-width: 320px; }
.job-files > summary { cursor: pointer; font-weight: 600; min-height: 28px; display: flex; align-items: center; font-size: 14px; }
.job-files[open] > summary { margin-bottom: 10px; }

/* questions */
.questions { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 0; }
.q { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.q.open.required { border-color: var(--warn); box-shadow: inset 3px 0 0 var(--warn); }
.q h3 { margin: 0 0 6px; font-size: 14px; }
.q .q-meta { font-size: 12px; color: var(--ink-2); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.q .q-redraft { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.q .tag { padding: 0 7px; border-radius: 5px; background: var(--chip); font-size: 11.5px; }
.q[hidden] { display: none; }
.q-audience { margin: 0 0 10px; }
.q .tag.req { background: var(--warn-soft); color: var(--warn-ink); }
.q p { margin: 4px 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.q form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.q .fields { display: flex; flex-wrap: wrap; gap: 12px; }
.q .fields label { font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.q .fields input { width: 160px; font-family: var(--mono); font-size: 13px; }
.q .fields .opt { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; font-weight: 400; padding: 0; }
.q .fields .opt input[type="checkbox"] { width: 14px; height: 14px; margin: 0; }
.q .note { font-size: 11.5px; color: var(--muted); max-width: 260px; overflow-wrap: anywhere; }
.q .note a { color: var(--accent-ink); text-decoration: underline; }
.q .opt { display: flex; flex-direction: row; gap: 8px; align-items: flex-start; font-size: 13.5px; font-weight: 400; color: var(--ink); padding: 6px 8px; border-radius: var(--r-sm); }
.q .opt:hover { background: var(--surface-2); }
.q .opt input[type="radio"] { margin-top: 2px; }
.q .opt small { display: block; color: var(--muted); font-size: 12px; }
.q .opt.small { padding: 2px 0; font-size: 12.5px; align-items: center; }
.q textarea { width: 100%; font-family: inherit; }
.q table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.q td, .q th { padding: 6px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.q td input { width: 100%; box-sizing: border-box; }
.q table.members { table-layout: fixed; }
.q table.members th:nth-child(1) { width: 42%; }
.q table.members th:nth-child(2) { width: 150px; }
.q .assign { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.q .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 2px; }
.q .answer { font-size: 13.5px; }
.members label.opt { display: flex; flex-direction: row; gap: 6px; align-items: center; }
.q td input[type="checkbox"] { width: 16px; height: 16px; flex: none; margin: 0; }
.q .members label.opt { padding: 0; }
.q .members label.opt input:not([type="checkbox"]) { flex: 1; min-width: 0; }
.q table.members td.mono { font-family: var(--mono); white-space: nowrap; }
#detail-waiting, .detail > .waiting { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn-ink); font-size: 13.5px; margin: 12px 0; flex-wrap: wrap; }

/* step timeline (admins) */
.steps-scroll { overflow-x: auto; max-width: 100%; }
.steps-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.steps-table th, .steps-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.steps-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; vertical-align: bottom; }
.steps-table td.num { text-align: right; }
/* Billing & usage (2026-10-22) */
.msg-fee { align-self: flex-end; margin-top: -8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.billing-total { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.billing-big { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }
#view-billing .card + .card { margin-top: 16px; }
#view-billing th.num, #view-billing td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#view-billing tr.bill-reports td { background: var(--bg-2, transparent); padding-top: 4px; padding-bottom: 10px; }
#view-billing .bill-rep { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; max-width: 520px; font-size: 13px; }
#view-billing .bill-rep .num { text-align: right; font-variant-numeric: tabular-nums; }
#view-billing .billing-due { margin: 4px 0 0; font-variant-numeric: tabular-nums; }
#view-billing .credit-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; padding: 12px 16px 0; }
#view-billing .credit-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
#view-billing .credit-form label.grow { flex: 1 1 220px; }
#view-billing #credit-error { padding: 0 16px; margin: 6px 0 0; }
#view-billing .pay-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; padding: 12px 16px 12px; }
#view-billing .pay-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; flex: 1 1 320px; }
#view-billing .balance-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; }
.side-balance { margin: 0 12px 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--chip); display: flex; flex-direction: column; gap: 8px; }
.side-balance .balance-open { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.side-balance .balance-open strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.side-balance .balance-open strong.owed { color: var(--bad); }
.side-balance .balance-pay { text-align: center; text-decoration: none; }
html.side-collapsed .side-balance { display: none; }
.side-balance .balance-pay { padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.step-actions { display: flex; flex-direction: column; gap: 4px; }
.step-actions button { min-height: 26px; padding: 0 8px; font-size: 12px; }
.steps .packet-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.step-status { white-space: nowrap; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--ink-2); font-weight: 600; }
.step-status.built { background: var(--ok-soft); color: var(--ok); }
.step-status.waiting { background: var(--warn-soft); color: var(--warn-ink); }
.step-status.failed { background: var(--bad-soft); color: var(--bad); }
.step-status.draft { background: var(--warn-soft); color: var(--warn-ink); }
.step-status.not_run, .step-status.skipped { background: var(--chip); color: var(--muted); }
.step-reason { margin-top: 2px; max-width: 280px; white-space: normal; }
.step-panel { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.step-panel h4 { margin: 10px 0 4px; font-size: 13px; }
.step-panel pre { white-space: pre-wrap; font-size: 12px; }
.step-panel table { border-collapse: collapse; font-size: 12px; margin: 4px 0; }
.step-panel table td, .step-panel table th { border: 1px solid var(--line); padding: 3px 6px; }
.renders { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.renders img { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 4px; }
@media (max-width: 1100px) { .steps-table .col-spec { display: none; } }

/* report picker and run settings */
.start-options { display: flex; flex-direction: column; gap: 6px; align-self: center; }
.start-card .check input, label.check input { width: auto; }
.report-pick { position: relative; font-size: 13px; }
.report-pick > summary { cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--accent-ink); list-style: none; min-height: 26px; display: inline-flex; align-items: center; }
.report-pick > summary::-webkit-details-marker { display: none; }
.report-pick > summary::after { content: " ▾"; margin-left: 4px; }
.report-pick[open] > summary::after { content: " ▴"; }
.report-pick-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin-top: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 260px; }
.start-card .report-pick-body, .detail-actions .report-pick-body { position: absolute; z-index: 20; right: 0; box-shadow: var(--shadow-pop); }
.report-pick-body label { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; cursor: pointer; }
.report-pick-body input[type="checkbox"] { width: 15px; height: 15px; }
.report-pick-body .all { border-bottom: 1px solid var(--line-2); padding-bottom: 6px; margin-bottom: 2px; font-weight: 600; }
.report-pick-body .note { font-size: 12px; color: var(--muted); margin: 4px 0 0; max-width: 300px; }
.report-pick-body .note:empty { display: none; }
.run-settings { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

/* -- start -------------------------------------------------------------------------------------------------------------- */
body:not(.is-admin) [data-admin-only] { display: none !important; }
.sp-form { max-width: 820px; }
.sp-steps { gap: 0; position: relative; }
.sp-step { display: flex; flex-direction: column; gap: 12px; position: relative; padding: 0 0 26px 40px; }
.sp-step::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.sp-step:last-of-type::before, .sp-steps > .sp-step:last-child::before { display: none; }
.sp-step.card { background: transparent; border: none; box-shadow: none; padding: 0 0 26px 40px; border-radius: 0; }
.sp-step-head { display: flex; align-items: flex-start; gap: 12px; }
.sp-step-head h2 { font-size: 16px; margin: 0; }
.sp-step-head p { margin: 2px 0 0; }
.sp-step-head > div { display: flex; flex-direction: column; }
.sp-step-n { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); color: var(--ink-2); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.sp-step.done .sp-step-n, .sp-step:has(input:checked) .sp-step-n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sp-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-card); }
.sp-tiles { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sp-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 400; cursor: pointer; box-shadow: var(--shadow-card); }
.sp-tile:hover { border-color: var(--line-strong); }
.sp-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sp-tile:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-tile.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-card); }
.sp-tile.selected::after { content: ""; position: absolute; top: 14px; right: 14px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 12px no-repeat, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.sp-tile-ic { width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.sp-tile-ic svg { width: 19px; height: 19px; }
.sp-tile-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.sp-tile-text { color: var(--muted); line-height: 1.5; font-size: 13px; }
.share-callout { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--r); background: var(--info-soft); color: var(--info-ink); font-size: 13.5px; }
.share-callout p { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.share-callout ul { margin: 0; padding-left: 18px; }
.share-email { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.sp-more > summary { cursor: pointer; display: inline-flex; align-items: center; min-height: 30px; font-size: 13px; font-weight: 600; color: var(--accent-ink); list-style: none; }
.sp-more > summary::-webkit-details-marker { display: none; }
.sp-more > summary::after { content: " ▾"; margin-left: 4px; }
.sp-more[open] > summary::after { content: " ▴"; }
.sp-more > .stack { padding-top: 12px; }
.check-lines { display: flex; flex-direction: column; gap: 4px; }
.sp-hint { margin: -4px 0 4px 24px; }
.sp-note { margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--info-soft); color: var(--info-ink); font-size: 13px; line-height: 1.5; }
.sp-admin-tag { margin-left: 8px; }
.sp-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; padding: 16px 0 0; margin-top: 4px; border-top: 1px solid var(--line); }
.sp-form .intake-summary { margin-left: 40px; }
.sp-form #intake-error:not(:empty) { margin: 0 0 0 40px; }
.sp-actions .primary { min-height: 40px; padding: 0 22px; }
/* Plan 38 (item 71): section 3's pair of source tiles on our storage (upload the files, or a Google Drive link): the same tile,
   one size down, the chosen one with the accent ring. */
.sp-source .sp-tile { padding: 14px 16px 12px; gap: 6px; transition: transform 0.15s ease; }
.sp-source .sp-tile:active { transform: scale(0.995); }
.sp-source .sp-tile-ic { width: 32px; height: 32px; border-radius: 8px; }
.sp-source .sp-tile-ic svg { width: 17px; height: 17px; }
.sp-source .sp-tile-title { font-size: 14.5px; }
.sp-source .sp-tile-text { font-size: 12.5px; padding-right: 20px; }
.sp-tile-foot { width: 100%; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 12px; line-height: 1.4; }
.intake-mode { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.intake-mode label.radio { flex-direction: row; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; padding: 6px 8px; border-radius: var(--r-sm); }
.intake-mode label.radio:hover { background: var(--surface-2); }
.intake-mode .radio input[type="radio"] { width: 16px; height: 16px; }
.intake-mode input.inline-num { width: 72px; display: inline-block; padding: 2px 8px; margin: 0 4px; min-height: 28px; }
.intake-mode label.radio.budget { flex-wrap: wrap; }
.intake-code { width: 150px; }
.intake-summary { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; background: var(--surface); }
.intake-summary .stats { flex-wrap: wrap; gap: 20px; }
.intake-summary ul { margin: 0; padding-left: 18px; }
.intake-summary .kinds { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; }
.intake-abs summary { cursor: pointer; font-size: 13px; font-weight: 600; min-height: 28px; display: flex; align-items: center; }
#intake-number, #codes-number, #own-number { width: 7em; }
@media (max-width: 900px) { .sp-tiles { grid-template-columns: minmax(0, 1fr); } .sp-tile { padding: 14px; } }

/* -- knowledge ---------------------------------------------------------------------------------------------------------- */
.add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.add-card { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border: none; border-radius: 0; box-shadow: none; }
.add-card + .add-card { border-left: 1px solid var(--line-2); }
.add-head { display: flex; align-items: center; gap: 10px; }
.add-head h2 { font-size: 14px; }
.accent-ic { color: var(--accent); width: 20px; height: 20px; }
.push { margin-top: auto; }
.narrow { width: 110px; }
.drop { align-items: center; justify-content: center; text-align: center; background: var(--surface-2); }
.drop.over { background: var(--accent-soft); }
.drop-ic { width: 26px; height: 26px; color: var(--muted); }
.drop-title { font-weight: 600; }
.file-pick { flex-direction: row; font-weight: 500; color: var(--accent-ink); cursor: pointer; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.upload-results { display: flex; flex-direction: column; gap: 6px; }
.upload-row { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; flex-wrap: wrap; }
.verdict { font-weight: 600; }
.verdict.ok { color: var(--ok); }
.verdict.no { color: var(--bad); }
.upload-row .why { color: var(--muted); font-size: 13px; }
.job { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--r); background: var(--info-soft); color: var(--info-ink); font-size: 13.5px; }
.job-message { font-weight: 600; }
.job-counts { color: inherit; opacity: 0.85; }
.job-errors { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; }
.job-errors:empty { display: none; }

/* -- skills ------------------------------------------------------------------------------------------------------------- */
.skills-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.skill-list-col { display: flex; flex-direction: column; gap: 10px; }
.skill-list { display: flex; flex-direction: column; gap: 6px; }
.skill-card { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 12px 14px; min-height: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); text-align: left; white-space: normal; font-weight: 400; }
.skill-card:hover { border-color: var(--line-strong); }
.skill-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.skill-card.off { background: var(--surface-2); }
.skill-card-top { display: flex; justify-content: space-between; gap: 8px; }
.skill-card-name { font-size: 14px; font-weight: 600; }
.skill-state { font-size: 11.5px; font-weight: 600; color: var(--ok); }
.skill-card.off .skill-state { color: var(--muted); }
.skill-cmd { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); }
.skill-desc { font-size: 12.5px; color: var(--muted); }
.skill-editor { padding: 0; display: flex; flex-direction: column; }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.editor-head h2 { font-size: 17px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding: 18px 20px; }
.span-2 { grid-column: span 2; }
.can-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.can-list li { display: flex; align-items: center; gap: 8px; }
.can-list svg { width: 15px; height: 15px; stroke-width: 2.2; }
.can-list .yes svg { color: var(--ok); }
.can-list .no { color: var(--muted); }
.scope { border: none; margin: 0; padding: 0; }
.scope label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 13.5px; color: var(--ink); min-height: 30px; }
.scope input { width: 16px; height: 16px; }
.editor-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
label.as-btn { flex-direction: row; font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; }
label.as-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -- settings and codes ------------------------------------------------------------------------------------------------- */
.acct-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.acct-row:first-child { border-top: none; padding-top: 0; }
.acct-row:last-child { padding-bottom: 0; }
.acct-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.acct-main h2 { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.acct-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.user-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.user-add .toggle { white-space: nowrap; }
.user-add #admin-msg { grid-column: 1 / -1; }
#view-codes .card-head input[type="search"] { max-width: 320px; }
.codes-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; align-items: end; }
.codes-form .span-2 { grid-column: span 2; }
.codes-form .codes-submit { grid-column: 1 / -1; display: flex; justify-content: flex-start; }
.fold { padding: 0; }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 20px; font-weight: 600; font-size: 14.5px; min-height: 50px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary svg { width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s ease; }
.fold[open] > summary svg { transform: rotate(90deg); }
.fold > summary .muted { font-weight: 400; font-size: 13px; }
.fold-body { padding: 4px 20px 20px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.fold-body > p:first-child { padding-top: 12px; }

/* -- chat (plan 36): the Ask G3O surface ---------------------------------------------------------------------------- */
.chat-view { display: grid; grid-template-columns: minmax(0, 1fr) 360px; overflow: hidden; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: radial-gradient(900px 420px at 50% -160px, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg); }
.chat-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px 8px 32px; min-height: 54px; }
.chat-head-text { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.chat-head h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 56vw; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip.proj { display: none; }
.chat-head .row { gap: 2px; }
#chat-new { gap: 6px; border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
#chat-new:hover:not(:disabled) { background: var(--chip); color: var(--ink); }
.chat-view .banner-error { margin: 14px 32px 0; }

.messages { flex: 1 1 auto; overflow-y: auto; padding: 14px max(32px, calc((100% - 760px) / 2)) 12px; display: flex; flex-direction: column; gap: 26px; }
.chat-view.chat-empty .messages { flex: 0 0 auto; margin-top: auto; overflow: visible; padding-bottom: 4px; }
.chat-view.chat-empty .composer { margin-bottom: auto; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* the person */
.msg-user { align-self: flex-end; max-width: min(560px, 85%); padding: 11px 16px; border-radius: 20px 20px 6px 20px; background: var(--chip); color: var(--ink); font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; animation: msg-in 0.22s ease both; }
.msg-user .file-chip { border-color: var(--line-strong); color: inherit; background: var(--surface); }
.cmd { display: inline-flex; margin-right: 6px; padding: 0 7px; border-radius: 5px; background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: 11.5px; vertical-align: 1px; }

/* the answer */
.msg-ai { display: flex; flex-direction: column; gap: 10px; align-self: flex-start; width: 100%; animation: msg-in 0.22s ease both; }
.ai-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-mark { width: 24px; height: 24px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 9.5px; font-weight: 600; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.ai-name { font-size: 13px; font-weight: 600; }
.answer { font-size: 15.5px; line-height: 1.7; max-width: 72ch; }
.answer > * + * { margin-top: 12px; }
.answer > p:first-child { font-size: 16.5px; line-height: 1.6; color: var(--ink); }
.answer > p:first-child strong { font-weight: 600; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.facts .fact { background: var(--surface); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; outline: 1px solid var(--line); }
.answer li:has(> .check-box) { list-style: none; margin-left: -20px; }
.facts dt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-size: 14.5px; font-weight: 500; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.facts dd .cite { vertical-align: 2px; }
.callout { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.callout > svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; color: var(--muted); }
.callout > div { min-width: 0; }
.callout > div > * + * { margin-top: 6px; }
.callout-k { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.callout.note, .callout.tip, .callout.why, .callout.info { background: var(--info-soft); border-color: transparent; color: var(--info-ink); }
.callout.note > svg, .callout.tip > svg, .callout.why > svg, .callout.info > svg, .callout.note .callout-k, .callout.tip .callout-k, .callout.why .callout-k { color: var(--info); }
.callout.warning, .callout.caveat, .callout.important { background: var(--warn-soft); border-color: transparent; color: var(--warn-ink); }
.callout.warning > svg, .callout.caveat > svg, .callout.important > svg, .callout.warning .callout-k, .callout.caveat .callout-k, .callout.important .callout-k { color: var(--warn); }
.callout.notes p { font-size: 13.5px; }
.check-box { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin: 0 6px 0 -2px; border-radius: 4px; border: 1.5px solid var(--line-strong); vertical-align: -3px; background: var(--surface); }
.check-box.done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check-box svg { width: 11px; height: 11px; stroke-width: 3; }
.answer h1, .answer h2, .answer h3, .answer h4 { font-size: 15.5px; margin-top: 18px; }
.answer ul, .answer ol { padding-left: 22px; margin: 8px 0; }
.answer li + li { margin-top: 4px; }
.answer blockquote { margin: 8px 0; padding: 8px 14px; background: var(--surface-2); border-left: 3px solid var(--accent-soft-2); border-radius: 4px; color: var(--ink-2); }
.answer code { font-size: 13px; background: var(--chip); padding: 1px 5px; border-radius: 4px; }
.answer hr { border: none; border-top: 1px solid var(--line); }
.answer a { color: var(--accent-ink); }
.answer li > ul, .answer li > ol { margin: 4px 0; }
.answer strong { font-weight: 600; }
.cite { display: inline-flex; align-items: center; min-height: 0; padding: 0 4px; margin: 0 1px; border: none; border-radius: 5px; background: none; color: var(--muted); font-size: 10.5px; font-weight: 600; line-height: 16px; vertical-align: 4px; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.cite:hover, .cite:focus-visible { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.msg-ai .warn { border-radius: var(--r-lg); padding: 10px 14px; }
.msg-error { display: flex; gap: 10px; padding: 10px 14px; border-radius: var(--r-lg); background: var(--bad-soft); color: var(--bad); font-size: 13.5px; }
.artifact, .file-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); max-width: 72ch; }
.artifact-ic, .file-ic { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--accent-soft), var(--accent-soft-2)); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.artifact-ic svg { width: 20px; height: 20px; }
.artifact-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.artifact .name, .file-card .name { font-size: 14px; font-weight: 600; word-break: break-word; }
.artifact .open-items { margin-top: 6px; }
.nf-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card); max-width: 72ch; }
.nf-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nf-ic svg { width: 18px; height: 18px; }
.nf-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 220px; font-size: 13.5px; color: var(--ink-2); }
.nf-text strong { color: var(--ink); font-size: 14px; }
.nf-card .small-btn { margin-left: auto; }
.src-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 72ch; }
.src-strip .eyebrow { margin-right: 4px; }
.src-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; max-width: 320px; padding: 0 10px 0 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-card); }
.src-chip svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }
.src-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.src-chip-p { color: var(--muted); font-size: 12px; white-space: nowrap; }
.src-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.src-chip.more { color: var(--muted); }
/* an archived chat (plan 37): sources, chips and links are plain text, the rail stays shut, one line takes the composer's place */
.cite-plain { display: inline-flex; align-items: center; padding: 0 5px; margin: 0 1px; border-radius: 6px; background: var(--chip); color: var(--ink-2); font-size: 11px; font-weight: 600; line-height: 18px; vertical-align: 3px; }
.src-chip-plain { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; max-width: 320px; padding: 0 10px 0 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.src-chip-plain svg { width: 14px; height: 14px; color: var(--muted); }
.src-chip-plain.more { color: var(--muted); }
.sources-plain { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; color: var(--muted); font-size: 13px; }
.sources-plain svg { width: 15px; height: 15px; }
.archived-note { flex-shrink: 0; display: flex; align-items: flex-start; gap: 10px; width: calc(100% - 64px); max-width: 760px; margin: 8px auto 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.archived-note svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.chat-view.is-archived { grid-template-columns: minmax(0, 1fr); }
.chat-view.is-archived .rail, .chat-view.is-archived .rail-reports-toggle { display: none; }
.open-items { font-size: 13.5px; }
.open-items summary { cursor: pointer; font-weight: 600; min-height: 26px; display: flex; align-items: center; color: var(--accent-ink); font-size: 13px; }
.open-items ul { margin: 6px 0 0; padding-left: 22px; }

/* what the answer did: a trace line that folds open */
.steps-done { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.steps-done summary { cursor: pointer; min-height: 24px; display: inline-flex; align-items: center; gap: 7px; list-style: none; padding: 2px 9px 2px 7px; border-radius: 999px; }
.steps-done summary::-webkit-details-marker { display: none; }
.steps-done summary::before, div.steps-done::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.steps-done summary:hover { background: var(--chip); color: var(--ink); }
.steps-done ol { margin: 6px 0 2px 9px; padding-left: 18px; line-height: 1.7; border-left: 2px solid var(--line); list-style: none; }
.steps-done ol li { position: relative; }
.steps-done ol li::before { content: ""; position: absolute; left: -23px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
div.steps-done { display: inline-flex; align-items: center; gap: 7px; padding: 2px 7px; }

/* the quiet action row: shows on hover, and always under the last answer */
.ai-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-top: -2px; opacity: 0; transition: opacity 0.15s ease; }
.msg-ai:hover .ai-actions, .msg-ai:focus-within .ai-actions, .msg-ai:last-child .ai-actions, .ai-actions:has([aria-pressed="true"]), .ai-actions:has([data-request]) { opacity: 1; }
.ai-actions .ghost, .ai-actions .secondary { min-height: 28px; min-width: 28px; padding: 0 7px; font-size: 12.5px; color: var(--muted); border-color: transparent; background: transparent; box-shadow: none; font-weight: 500; border-radius: var(--r-sm); }
.ai-actions .ghost svg, .ai-actions .secondary svg { width: 15px; height: 15px; }
.ai-actions .ghost:hover:not(:disabled), .ai-actions .secondary:hover:not(:disabled) { background: var(--chip); color: var(--ink); }
.ai-actions .secondary[data-sources] { color: var(--accent-ink); background: var(--accent-soft); padding: 0 10px; margin-left: 4px; }
.ai-actions .secondary[data-sources]:hover:not(:disabled) { background: var(--accent-soft-2); color: var(--accent-ink); }
.ai-actions .secondary[data-request] { color: var(--ink); border-color: var(--line-strong); background: var(--surface); margin-left: 4px; padding: 0 10px; box-shadow: var(--shadow-card); }
.ai-actions .thumb { min-width: 28px; padding: 0 6px; }
.ai-actions .thumb[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.ai-actions .muted { font-size: 12px; padding: 0 6px; }
.ai-notes { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.working { margin: 0; padding: 10px 14px 10px 32px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--ink-2); }
.feedback-form { display: flex; flex-direction: column; gap: 6px; max-width: 520px; font-size: 13px; }
.feedback-form textarea { width: 100%; font-family: inherit; font-size: 13.5px; }
.feedback-actions { display: flex; gap: 8px; align-items: center; }

/* while the answer is being written */
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
.steps-live { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.step { display: flex; align-items: center; gap: 8px; }
.step svg { width: 13px; height: 13px; color: var(--ok); }
.step.now { color: var(--ink-2); font-weight: 500; }
.step.now .dots { order: -1; }
.steps-done ol, .steps-live { font-variant-numeric: tabular-nums; }
.msg-ai.live .answer:empty { display: none; }
.thinking { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.dots { display: inline-flex; gap: 3px; align-items: center; }
.dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }
.md-table { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-card); background: var(--surface); }
.md-table table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.45; }
.md-table th, .md-table td { padding: 9px 14px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); font-weight: 600; white-space: nowrap; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.md-table td:first-child { font-weight: 500; }
.md-table tbody tr:hover td { background: var(--surface-2); }
.md-table tr:last-child td { border-bottom: none; }
.md-table .al-right { text-align: right; }
.md-table .al-center { text-align: center; }
.md-table tr.md-total td { border-top: 2px solid var(--line-strong); font-weight: 600; background: var(--surface-2); }
.md-table td .cite { vertical-align: 1px; }
.md-code { margin: 0; padding: 12px 14px; border-radius: var(--r-lg); background: var(--chip); overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.md-code code { background: none; padding: 0; }
.cite-card { position: fixed; z-index: 60; max-width: min(360px, calc(100vw - 16px)); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 4px; font-size: 13px; pointer-events: none; }
.cite-card q { color: var(--ink-2); line-height: 1.5; quotes: "“" "”"; }

/* the empty chat: a greeting, then the composer right under it */
.welcome { margin: 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; max-width: 760px; width: 100%; padding: 8px 0 14px; }
.welcome-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 15px; font-weight: 600; box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 6px color-mix(in srgb, var(--accent) 10%, transparent); }
.welcome h2 { font-size: 30px; letter-spacing: -0.025em; line-height: 1.15; max-width: 640px; }
.welcome h2 em { font-style: normal; color: var(--accent-ink); }
.welcome > .muted { font-size: 15px; max-width: 560px; margin-top: -6px; }
.starter-asks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.starter-asks .eyebrow, .starter-skills .eyebrow { flex-basis: 100%; display: block; }
.starter-q { min-height: 36px; padding: 6px 14px 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 400; text-align: left; white-space: normal; gap: 8px; box-shadow: var(--shadow-card); }
.starter-q svg { width: 15px; height: 15px; color: var(--accent); }
.starter-q:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.starter-skills { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.starter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.starter { flex-direction: column; align-items: flex-start; gap: 3px; min-height: 0; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; white-space: normal; font-weight: 400; border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.starter:hover { border-color: var(--accent); transform: translateY(-1px); }
.starter .skill-cmd { font-size: 11.5px; }
.starter strong { font-size: 13.5px; }
.starter span.muted { font-size: 12.5px; line-height: 1.45; }

/* the composer: one rounded field that floats over the canvas */
.composer { flex-shrink: 0; position: relative; padding: 8px 32px 14px; }
.composer > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.composer-box { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); padding: 10px 10px 8px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 10px 30px -14px rgba(26, 25, 22, 0.28), 0 1px 2px rgba(26, 25, 22, 0.05); }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent), 0 10px 30px -14px rgba(26, 25, 22, 0.28); }
.composer-box textarea { border: none; box-shadow: none !important; background: transparent; resize: none; min-height: 44px; max-height: 240px; padding: 8px 2px 4px; font-size: 15.5px; line-height: 1.5; }
.composer-box textarea:disabled { opacity: 0.6; }
.composer-skill { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.skill-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.composer-files { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 4px 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; }
.file-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-chip.failed { border-color: var(--bad); color: var(--bad); }
.file-chip button, .skill-chip button { min-height: 24px; min-width: 24px; padding: 0; border-radius: 50%; background: transparent; color: inherit; }
.skill-chip button:hover { background: rgba(0, 0, 0, 0.08); }
.skill-chip svg { width: 13px; height: 13px; }
.composer.dragging .composer-box { outline: 2px dashed var(--accent); outline-offset: 2px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg-files .file-chip { padding: 2px 10px; }
.composer-run { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.composer-run label { flex-direction: row; white-space: nowrap; align-items: center; }
.composer-run select { min-height: 32px; max-width: 420px; }
.composer-actions { display: flex; align-items: center; gap: 2px; }
.composer-actions .secondary { min-height: 32px; min-width: 32px; padding: 0 9px; border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); font-size: 12.5px; border-radius: 999px; gap: 6px; }
.composer-actions .secondary:hover:not(:disabled) { background: var(--chip); color: var(--ink); }
.composer-actions .secondary svg { width: 17px; height: 17px; }
#chat-status { padding-left: 6px; }
.send { min-width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); transition: transform 0.12s ease, background-color 0.12s ease; }
.send:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.06); }
.send:disabled { background: var(--chip); color: var(--faint); opacity: 1; cursor: not-allowed; }
.send svg { width: 18px; height: 18px; stroke-width: 2.2; }
.stop { background: var(--ink); color: var(--bg); }
.stop:hover:not(:disabled) { background: var(--ink-2); }
.composer .error { margin-top: 8px; }
.composer-note { margin-top: 8px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.6; }
.composer-note kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); font: 500 10.5px/1.5 var(--mono); color: var(--ink-2); }
.skill-menu { position: absolute; left: 32px; right: 32px; bottom: calc(100% - 8px); max-width: 760px; margin: 0 auto; max-height: 340px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); z-index: 20; }
.menu-head { padding: 8px 14px; border-bottom: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 8px 14px; cursor: pointer; }
.menu-item[aria-selected="true"] { background: var(--accent-soft); }
.menu-item .skill-cmd { width: 120px; flex-shrink: 0; font-size: 12.5px; }
.menu-item .menu-text { display: flex; flex-direction: column; min-width: 0; }
.menu-item strong { font-size: 13.5px; }
.menu-item .muted { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }
.menu-empty { padding: 14px 16px; color: var(--muted); font-size: 13.5px; }

/* the rail: Sources and Reports as two tabs of one panel */
.rail { border-left: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; min-height: 0; }
.rail-tabs { display: flex; align-items: center; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--line-2); flex-shrink: 0; }
.rail-tab { min-height: 36px; padding: 0 10px; border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: -1px; }
.rail-tab:hover { color: var(--ink); }
.rail-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.rail-tab .muted { font-size: 12px; margin-left: 4px; }
.rail-close { display: none; margin-left: auto; }
.rail-part { display: none; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.rail[data-tab="sources"] .rail-sources, .rail[data-tab="reports"] .rail-reports { display: flex; }
.rail-head { display: none; }
.rail-report-list { list-style: none; margin: 0; padding: 8px 10px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.rail-report { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 8px; border-radius: var(--r); font-size: 13px; }
.rail-report.has-file:hover { background: var(--surface); box-shadow: var(--shadow-card); }
.rail-report-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.rail-report .report-name { font-size: 13px; word-break: break-word; }
.rail-report .report-status { font-size: 11px; padding: 0 7px; }
.rail-report-open, .rail-report-build { min-height: 26px; padding: 0 8px; font-size: 12px; font-weight: 500; gap: 4px; border-radius: var(--r-sm); } .rail-report-open svg { width: 13px; height: 13px; }
.rail-report .report-note { flex-basis: 100%; font-size: 12px; color: var(--bad); }
.rail-report-empty { padding: 8px 8px; line-height: 1.5; }
.rail-reports-toggle { display: none; }
.rail-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 10px; }
.rail-body > .muted.small { padding: 4px 2px; line-height: 1.5; }
.source { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); display: flex; flex-direction: column; gap: 6px; scroll-margin: 12px; box-shadow: var(--shadow-card); }
.source.hit { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.source-head { display: flex; align-items: center; gap: 9px; }
.source-ic { width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.source-ic svg { width: 14px; height: 14px; }
.source-n { padding: 0 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; line-height: 18px; }
.source-cite { display: flex; flex-direction: column; gap: 5px; padding-top: 8px; border-top: 1px solid var(--line-2); scroll-margin: 12px; }
.source-cite-head { display: flex; align-items: center; gap: 8px; }
.source-quote { margin: 0; padding: 8px 10px; border-left: 3px solid var(--accent-soft-2); border-radius: 0 8px 8px 0; background: var(--surface-2); font-size: 12.5px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow-y: auto; }
.source-cite.hit .source-quote { border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.source-path { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; display: flex; align-items: flex-start; gap: 4px; }
.source-path svg { width: 12px; height: 12px; margin-top: 3px; }
.source-name { font-size: 13px; font-weight: 600; word-break: break-word; }
.source-meta { font-size: 12px; color: var(--muted); }
.source-open { align-self: flex-start; font-size: 12.5px; font-weight: 600; }
.source-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.source pre { margin: 0; font-family: var(--sans); font-size: 13px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow-y: auto; }
.rail-skill .link-btn { align-self: flex-start; }
.rail-skill { margin-top: 6px; padding: 12px; border-radius: var(--r-lg); background: var(--chip); display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }

/* -- status page: the parts that app.css owns (status.css has the rest) ------------------------------------------------ */
.st-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }

/* -- dialog ------------------------------------------------------------------------------------------------------------- */
.dialog { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.dialog::backdrop { background: rgba(20, 19, 17, 0.45); backdrop-filter: blur(2px); }
.dialog h2 { font-size: 18px; }
.dialog.wide { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
/* A chat source on top of the chat: most of the screen, the document in a frame. Flex only while open (a closed dialog hides). */
.dialog.doc-viewer { width: min(1100px, calc(100vw - 32px)); height: calc(100vh - 32px); height: calc(100dvh - 32px); max-height: none; padding: 0; overflow: hidden; }
.dialog.doc-viewer[open] { display: flex; flex-direction: column; }
.doc-viewer-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.doc-viewer-ic { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.doc-viewer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-viewer-head .muted { white-space: nowrap; }
.doc-viewer-body { flex: 1 1 auto; min-height: 0; display: flex; background: var(--surface-2); }
.doc-viewer-body iframe { flex: 1 1 auto; width: 100%; height: 100%; border: 0; background: var(--surface); }
.doc-viewer-body img { display: block; max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; }
.doc-viewer-state { margin: auto; max-width: 420px; padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.doc-viewer-state p { margin: 0; }
.doc-viewer-state > svg { width: 28px; height: 28px; color: var(--muted); }
.doc-viewer-page { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; padding: 12px; }
.doc-viewer-page img { max-height: none; height: auto; margin: 0 auto auto; background: #fff; box-shadow: var(--shadow-card); }
.doc-viewer-foot { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px 12px; border-top: 1px solid var(--line); flex-shrink: 0; }
.doc-viewer-foot[hidden] { display: none; }
/* A phone: the whole screen, and buttons big enough for a thumb */
@media (max-width: 640px) {
  .dialog.doc-viewer { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .doc-viewer-head { padding: 4px 4px 4px 12px; gap: 6px; }
  .doc-viewer-head #doc-viewer-where { display: none; }
  .doc-viewer-page { padding: 8px; }
  .doc-viewer-foot { padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) { .doc-viewer-head .icon-btn, .doc-viewer-foot .icon-btn { min-width: 44px; min-height: 44px; } }
.purge-box { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--r); background: var(--chip); }
.purge-box p { margin: 0; }
.purge-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }

/* -- room plan (plan 24 C5) -------------------------------------------------------------------------------------------- */
.rp-back { padding-left: 0; margin-bottom: 4px; }
.rp-head { display: flex; flex-direction: column; gap: 14px; }
.rp-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rp-banner { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-radius: var(--r); background: var(--chip); font-size: 13.5px; line-height: 1.5; }
.rp-banner.info { background: var(--info-soft); color: var(--info-ink); }
.rp-banner.ok { background: var(--ok-soft); color: var(--ok); }
.rp-msg { min-height: 1.5em; font-size: 13.5px; }
.rp-msg.ok { color: var(--ok); }
.rp-msg.bad { color: var(--bad); }
.rp-trees { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.rp-trees > .card[hidden] { display: none; }
.rp-trees.single { grid-template-columns: minmax(0, 1fr); }
.rp-tree { list-style: none; margin: 0; padding: 8px 12px; max-height: 440px; overflow: auto; }
.rp-node { display: flex; align-items: center; gap: 4px; min-height: 32px; padding: 1px 6px 1px calc(var(--d, 0) * 18px + 2px); border-radius: var(--r-sm); }
.rp-node.selected { background: var(--accent-soft); }
.rp-node.held .rp-name { font-style: italic; }
.rp-caret { min-height: 26px; min-width: 26px; padding: 0; background: none; border: none; color: var(--muted); font-size: 12px; }
.rp-caret.blank { display: inline-block; width: 26px; flex-shrink: 0; }
.rp-name { flex: 1 1 auto; min-width: 0; justify-content: flex-start; text-align: left; min-height: 28px; padding: 0 4px; background: none; border: none; color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 28px; }
.rp-name:hover:not(.plain) { text-decoration: underline; }
.rp-count { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.rp-rename { min-height: 24px; padding: 0 8px; background: none; border: none; color: var(--muted); font-size: 12px; font-weight: 500; }
.rp-rename:hover { color: var(--ink); text-decoration: underline; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 4px; }
.rp-chip { min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13px; }
.rp-chip strong { font-family: var(--mono); font-weight: 500; }
.rp-chip.on { background: var(--accent-soft); border-color: var(--accent); }
.rp-chip.attn:not(:disabled) strong { color: var(--accent); }
.rp-notfiled { padding: 14px 20px 16px; border-top: 1px solid var(--line-2); }
.rp-reasons { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.rp-reasons li { display: flex; justify-content: space-between; gap: 12px; }
.rp-folder-head { flex-wrap: wrap; }
.rp-find { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rp-find input[type="search"] { min-width: 240px; max-width: 320px; }
.rp-scope { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.rp-unit { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line-2); }
.rp-unit:first-child { border-top: none; }
.rp-unit.review { box-shadow: inset 3px 0 0 var(--warn); }
.rp-unit-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rp-unit-main { min-width: 0; }
.rp-raw { font-weight: 600; overflow-wrap: anywhere; }
.rp-dest { font-size: 13.5px; overflow-wrap: anywhere; }
.rp-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.rp-tags .pill { text-transform: none; }
.pill.rp-conf.ok { background: var(--ok-soft); color: var(--ok); }
.pill.rp-conf.low, .pill.rp-look { background: var(--warn-soft); color: var(--warn-ink); }
.pill.rp-edited { background: var(--info-soft); color: var(--info); }
.rp-why { font-size: 13.5px; line-height: 1.5; }
.rp-why.look { color: var(--warn-ink); background: var(--warn-soft); padding: 8px 12px; border-radius: var(--r); }
.rp-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rp-file { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 6px 0; border-top: 1px dashed var(--line-2); font-size: 13.5px; }
.rp-file:first-child { border-top: none; }
.rp-file.left_out .rp-fname, .rp-file.held .rp-fname { color: var(--muted); }
.rp-fname { overflow-wrap: anywhere; }
.rp-ftag { padding: 1px 8px; border-radius: 5px; background: var(--chip); font-size: 12px; color: var(--ink-2); }
.rp-ftag.left_out { background: var(--bad-soft); color: var(--bad); }
.rp-factions { margin-left: auto; display: flex; gap: 6px; }
.rp-parts { flex: 1 1 100%; margin: 2px 0 4px 18px; padding-left: 12px; border-left: 2px solid var(--line-2); }
.rp-parts > p { margin: 0 0 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-more { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); }
.rp-more h4 { margin: 0 0 4px; font-size: 13px; }
.rp-unit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rp-pager { padding: 12px 20px; margin-top: 0; border-top: 1px solid var(--line-2); }
.rp-history-sum { cursor: pointer; min-height: 30px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rp-dialog .stack { min-width: 0; }
.rp-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; max-width: min(640px, calc(100vw - 32px)); padding: 10px 12px 10px 16px; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-pop); font-size: 13.5px; line-height: 1.45; }
.rp-toast.ok { border-left: 4px solid var(--ok); }
.rp-toast.bad { border-left: 4px solid var(--bad); }
.rp-toast > span:first-child { min-width: 0; overflow-wrap: anywhere; }

/* the legacy four-stage boxes (stages), kept for the scripts that still draw them */
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stages.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); min-width: 0; }
.stage-head { display: flex; align-items: center; gap: 8px; }
.stage-n { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--ink-2); flex-shrink: 0; }
.stage-name { font-size: 13.5px; font-weight: 600; min-width: 0; }
.stage-status { margin-left: auto; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.stage-count { font-size: 13px; }
.stage-note { font-size: 12px; color: var(--muted); line-height: 1.4; }
.stage.done .stage-status, .stage.done .stage-n { background: var(--ok-soft); color: var(--ok); }
.stage.running { border-color: var(--info); } .stage.running .stage-status, .stage.running .stage-n { background: var(--info-soft); color: var(--info); }
.stage.failed { border-color: var(--bad); } .stage.failed .stage-status, .stage.failed .stage-n { background: var(--bad-soft); color: var(--bad); }
.stage.partial { border-color: var(--accent); } .stage.partial .stage-status, .stage.partial .stage-n { background: var(--accent-soft); color: var(--accent-ink); }
.stage.skipped { opacity: 0.7; }
.stage.you { border-color: var(--accent); background: var(--accent-soft); } .stage.you .stage-status, .stage.you .stage-n { background: var(--accent); color: var(--on-accent); }
.stage.you .stage-note { color: var(--warn-ink); font-weight: 600; }

/* -- responsive --------------------------------------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .chat-view { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 40; box-shadow: var(--shadow-pop); transform: translateX(105%); transition: transform 0.2s ease; }
  .rail.open { transform: none; }
  .rail-close { display: inline-flex; }
  .rail-reports-toggle { display: inline-flex; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .skills-layout { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .add-grid { grid-template-columns: minmax(0, 1fr); }
  .add-card + .add-card { border-left: none; border-top: 1px solid var(--line-2); }
  .skills-layout { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-add { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .codes-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .codes-form .span-2 { grid-column: span 1; }
}
@media (max-width: 900px) {
  .shell, html.side-collapsed .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--sidebar); min-height: 50px; }
  .topbar .brand-name { font-size: 15px; }
  .topbar #topbar-project { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50vw; }
  .sidebar, html.side-collapsed .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-105%); transition: transform 0.2s ease; padding: 14px 0 0; }
  html.side-collapsed .side-scroll { padding: 2px 12px 12px; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  html.side-collapsed .brand-text, html.side-collapsed .proj-head, html.side-collapsed .proj-state, html.side-collapsed .nav-item > span:not(.badge), html.side-collapsed .nav-group > .eyebrow,
  html.side-collapsed .recent, html.side-collapsed .req-block, html.side-collapsed .who-text, html.side-collapsed .who-chev { display: revert; }
  html.side-collapsed .nav-item { justify-content: flex-start; padding: 0 10px; min-height: 34px; }
  html.side-collapsed .proj-select select { padding: 0 30px 0 12px; text-align: left; font-family: var(--sans); font-size: 13.5px; }
  .side-collapse { display: none; }
  .scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(20, 19, 17, 0.4); z-index: 45; }
  .page { padding: 18px 16px 32px; gap: 14px; }
  h1 { font-size: 21px; }
  .page-head { align-items: flex-start; }
  .chat-head { padding: 8px 12px 8px 16px; min-height: 0; }
  .chat-head h1 { font-size: 15px; max-width: 50vw; }
  .chip.proj { display: inline-flex; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { white-space: nowrap; }
  #chat-new { min-width: 36px; padding: 0; }
  #chat-new .btn-label { display: none; }
  .messages { padding: 16px; gap: 18px; }
  .composer { padding: 8px 12px 12px; }
  .archived-note { width: calc(100% - 24px); margin: 8px auto 12px; }
  .skill-menu { left: 12px; right: 12px; }
  .chat-view .banner-error { margin: 12px 16px 0; }
  .starter-grid { grid-template-columns: minmax(0, 1fr); }
  .welcome h2 { font-size: 24px; }
  .welcome-mark { width: 36px; height: 36px; font-size: 12px; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .start-card { flex-wrap: wrap; width: 100%; }
  .start-hint { max-width: none; flex-basis: 100%; order: 3; }
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menu-item .skill-cmd { width: auto; }
  .menu-item { flex-direction: column; align-items: flex-start; gap: 2px; }
  .rp-trees { grid-template-columns: minmax(0, 1fr); }
  .rp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-unit-top { flex-direction: column; }
  .rp-tags { justify-content: flex-start; }
  .rp-factions { margin-left: 0; width: 100%; }
  .rp-node { align-items: flex-start; padding-top: 3px; padding-bottom: 3px; }
  .rp-name { white-space: normal; line-height: 1.3; padding: 5px 4px; overflow: visible; }
  .rp-count, .rp-rename { padding-top: 7px; }
  .rp-find { width: 100%; }
  .rp-find input[type="search"] { min-width: 0; max-width: none; flex: 1 1 100%; }
  .rp-actions button { flex: 1 1 auto; }
  .rp-chips, .rp-notfiled, .rp-unit, .rp-pager { padding-left: 16px; padding-right: 16px; }
  .report-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 16px; }
  #job-reports-plant { margin: 10px 16px 0; }
  .sp-step, .sp-step.card { padding-left: 34px; }
  .sp-actions { padding-left: 0; }
  .sp-form .intake-summary, .sp-form #intake-error:not(:empty) { margin-left: 0; }
  .user-add { grid-template-columns: minmax(0, 1fr); }
  .codes-form { grid-template-columns: minmax(0, 1fr); }
  .acct-row { flex-direction: column; }
  .acct-row .acct-main { flex-basis: auto; }  /* stacked, the 320px basis would be a height */
  .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .steps-track, .steps-track.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stages, .stages.two { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: minmax(0, 1fr); }
}
/* -- two-step sign-in (plan 39 T2): the code step, the gate, the setup dialog, the Security row -------------------------- */
.tf-gap { gap: 18px; }
.tf-back { align-self: flex-start; min-height: 0; padding: 0; gap: 6px; border: none; background: none; color: var(--muted); font-size: 13px; }
.tf-back:hover { color: var(--ink); }
.tf-shield { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.tf-shield svg { width: 24px; height: 24px; }
.tf-shield.round { width: 56px; height: 56px; border-radius: 50%; }
.tf-shield.round svg { width: 28px; height: 28px; }
.tf-who { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 10px; border-radius: var(--r); background: var(--surface-3); color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.tf-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; }
input.tf-otp { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: 0.42em; text-align: center; min-height: 56px; padding-left: 0.42em; }
input.tf-rcode { font-family: var(--mono); font-size: 17px; letter-spacing: 0.12em; text-align: center; min-height: 48px; }
input.tf-bad, input.tf-bad:focus { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.tf-error { display: flex; gap: 8px; align-items: flex-start; }
.tf-gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.tf-gate .login-card { max-width: 440px; }
.tf-gate .login-card .brand { display: flex; }
.tf-gate .lg-btn { min-height: 40px; }

.dialog.tf-dialog { width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0; }
.tf-steps { display: flex; gap: 6px; align-items: center; padding: 14px 22px 0; font-size: 12px; color: var(--muted); }
.tf-steps i { flex: 1; height: 4px; border-radius: 999px; background: var(--line); }
.tf-steps i.on { background: var(--accent); }
.tf-steps em { font-style: normal; margin-left: 6px; white-space: nowrap; }
.tf-dh { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 0; }
.tf-dh .icon-btn { margin: -4px -6px 0 0; color: var(--muted); }
.tf-db { display: flex; flex-direction: column; gap: 16px; padding: 16px 22px 4px; }
.tf-pad { padding: 8px 22px 0; }
.tf-pad:empty { display: none; }
.tf-df { display: flex; align-items: center; gap: 8px; padding: 16px 22px 18px; }
.tf-apps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tf-apps li { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); font-size: 13px; }
.tf-apps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.tf-banner { display: flex; gap: 10px; align-items: flex-start; }
.tf-banner svg { width: 16px; height: 16px; margin-top: 2px; }
.tf-scan { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
.tf-scan ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
/* the QR keeps its light box in dark mode too (--qr-bg is the same in both): some phone cameras do not read a light-on-dark code */
.tf-qr { padding: 10px; border-radius: var(--r-lg); background: var(--qr-bg); border: 1px solid var(--line); line-height: 0; }
.tf-qr svg { width: 176px; height: 176px; display: block; stroke-width: 1; }
.tf-key { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: var(--r); background: var(--surface-3); border: 1px dashed var(--line-strong); }
.tf-key code { flex: 1; min-width: 0; font-size: 13.5px; letter-spacing: 0.06em; color: var(--ink); overflow-wrap: anywhere; }
.tf-codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); counter-reset: tfcode; }
.tf-codes li { counter-increment: tfcode; display: flex; gap: 12px; padding: 9px 14px; font-family: var(--mono); font-size: 15px; letter-spacing: 0.05em; border-bottom: 1px solid var(--line-2); }
.tf-codes li::before { content: counter(tfcode); min-width: 16px; color: var(--faint); font-size: 12px; line-height: 22px; }
.tf-codes li:nth-child(odd) { border-right: 1px solid var(--line-2); }
.tf-codes li:nth-last-child(-n+2) { border-bottom: none; }
.tf-success { align-items: center; text-align: center; gap: 10px; padding-top: 26px; }
.tf-success p { max-width: 340px; }
.tf-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.tf-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tf-meta svg { width: 16px; height: 16px; color: var(--muted); }
#tf-row .warn { margin-top: 6px; }
body:not(.is-admin) #tf-row { border-top: none; padding-top: 0; }
#tf-codes-lede strong { color: var(--ink); }
.tf-df.center { justify-content: center; }
.tf-df.center .grow { display: none; }
.tf-state { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tf-state.on { color: var(--ok); }
.tf-state.off { color: var(--muted); }
@media (max-width: 600px) {
  .tf-scan { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .tf-apps { grid-template-columns: minmax(0, 1fr); }
  .tf-steps, .tf-dh, .tf-db, .tf-df, .tf-pad { padding-left: 16px; padding-right: 16px; }
  .tf-codes li { padding: 9px 10px; gap: 8px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .rail, .bar > span, .activity .chev, .fold > summary svg, .send, .ai-actions { transition: none; }
  .dots span, .spinner i, .msg-user, .msg-ai { animation: none; }
}

/* -- plan 39 T3: super admin (the row menu, the reset dialog, the banner, the security log) ----------------------- */
.tf-super-banner { margin: 0 0 14px; align-items: flex-start; }
.tf-super-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.badge.super { background: var(--accent-soft); color: var(--accent-ink); }
.badge.admin { background: var(--info-soft); color: var(--info); }
.tf-state.low { color: var(--warn-ink); }
.menu-pop.fixed { position: fixed; z-index: 80; visibility: hidden; }
.user-menu .menu-pop { min-width: 230px; }
.menu-label { padding: 6px 10px 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tf-person { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--surface-3); }
.tf-av.lg { width: 36px; height: 36px; font-size: 13px; }
.tf-conseq { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tf-conseq li { display: flex; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.tf-conseq svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--muted); }
.tf-log td { white-space: nowrap; }
.tf-log td.when { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.tf-ev { display: inline-flex; gap: 6px; align-items: center; }
.tf-ev svg { width: 14px; height: 14px; }
.tf-ev.reset { color: var(--bad); } .tf-ev.on { color: var(--ok); } .tf-ev.code { color: var(--warn-ink); } .tf-ev.super { color: var(--accent-ink); } .tf-ev.off { color: var(--muted); }

/* Plan 43 W2: country values proposed from public sources (Admin → Country tables): a short list of chips under a value, and the
   Start page line that points to them. */
.ac-propose { margin-top: 6px; }
.ac-props { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ac-prop { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); }
.ac-prop[data-agreement="recommended"] { border-color: var(--accent-soft-2); }
.ac-prop-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.ac-quote { margin-top: 4px; color: var(--ink-2); }
.ac-quote summary { cursor: pointer; color: var(--muted); }
.ac-quote q { display: block; margin-top: 2px; overflow-wrap: anywhere; }
.ac-prop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.ac-prop-actions a { color: var(--accent-ink); }
.ac-why { margin-top: 6px; }
#intake-country-missing a { color: var(--accent-ink); text-decoration: underline; }

/* Friendlier answers: a bar after "N of M" and the next-question buttons */
.pbar { display: inline-block; width: 56px; height: 6px; margin: 0 6px; border-radius: 999px; background: var(--chip); vertical-align: 1px; overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.ask-next { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ask-next-q { min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13px; text-align: left; cursor: pointer; }
.ask-next-q:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
@media (pointer: coarse) { .ask-next-q { min-height: 40px; } }
