/* ---------- tokens ---------- */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --sunken: #eef0f3;
  --ink: #0d1321;
  --ink-2: #2b3445;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --accent: #4f5ff0;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --accent-line: #c9cefc;
  --good: #12925a;
  --good-soft: #e8f6ef;
  --warn: #c2700a;
  --warn-soft: #fdf3e3;
  --bad: #d23b3b;
  --bad-soft: #fdecec;
  /* chart series: validated categorical order (blue, orange, aqua, yellow, magenta) + a neutral for "other" */
  --c1: #2a78d6;
  --c2: #eb6834;
  --c3: #1baf7a;
  --c4: #eda100;
  --c5: #e87ba4;
  --c6: #9aa3b2;
  /* status marks: only ever mean good / warning / serious / critical, always shown with a label */
  --st-good: #0ca30c;
  --st-warn: #fab219;
  --st-serious: #ec835a;
  --st-crit: #d03b3b;
  --grid: rgba(13, 19, 33, 0.07);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.06);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --chat-w: 440px;
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d14;
    --panel: #11151f;
    --panel-2: #151a26;
    --sunken: #0d1119;
    --ink: #e8ebf1;
    --ink-2: #c7cdd9;
    --muted: #8d97aa;
    --faint: #5e6779;
    --line: #1f2533;
    --line-2: #2c3446;
    --accent: #7d8bff;
    --accent-ink: #0a0d14;
    --accent-soft: #1a1f3d;
    --accent-line: #333c7a;
    --good: #3cc98a;
    --good-soft: #0f2a1f;
    --warn: #f0b252;
    --warn-soft: #2b2112;
    --bad: #f07272;
    --bad-soft: #2d1517;
    --c1: #3987e5;
    --c2: #d95926;
    --c3: #199e70;
    --c4: #c98500;
    --c5: #d55181;
    --c6: #5d6577;
    --grid: rgba(232, 235, 241, 0.07);
    --shadow: none;
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0d14;
  --panel: #11151f;
  --panel-2: #151a26;
  --sunken: #0d1119;
  --ink: #e8ebf1;
  --ink-2: #c7cdd9;
  --muted: #8d97aa;
  --faint: #5e6779;
  --line: #1f2533;
  --line-2: #2c3446;
  --accent: #7d8bff;
  --accent-ink: #0a0d14;
  --accent-soft: #1a1f3d;
  --accent-line: #333c7a;
  --good: #3cc98a;
  --good-soft: #0f2a1f;
  --warn: #f0b252;
  --warn-soft: #2b2112;
  --bad: #f07272;
  --bad-soft: #2d1517;
  --c1: #3987e5;
  --c2: #d95926;
  --c3: #199e70;
  --c4: #c98500;
  --c5: #d55181;
  --c6: #5d6577;
  --grid: rgba(232, 235, 241, 0.07);
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd { font: 500 10.5px var(--mono); padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--panel); color: var(--muted); }
.lede { color: var(--muted); font-size: 12.5px; margin: 2px 0 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code, pre { font-family: var(--mono); font-size: 12px; }

/* buttons */
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius-sm); padding: 7px 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.primary:hover:not(:disabled) { filter: brightness(1.07); }
.ghost { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; }
.ghost:hover:not(:disabled) { border-color: var(--line-2); background: var(--panel-2); }
.ghost.small, .small { padding: 4px 9px; font-size: 12.5px; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid transparent; background: transparent; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar { height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; margin-right: 8px; }
.logo { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 700 11px var(--sans); letter-spacing: 0.02em; color: #fff; background: linear-gradient(135deg, #1b2240, #4f5ff0); }
.title { font-weight: 650; letter-spacing: -0.01em; font-size: 15px; white-space: nowrap; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 7px 11px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--ink); background: var(--sunken); }
.tab.active { color: var(--ink); background: var(--sunken); }
.count { font: 600 11px var(--mono); color: var(--muted); }
.count:empty { display: none; }
.count.warn { color: var(--accent-ink); background: var(--warn); border-radius: 999px; padding: 0 6px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status { display: flex; gap: 6px; }
.pill { font-size: 11.5px; padding: 3px 9px 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.pill.off::before { background: var(--bad); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--chat-w) 6px minmax(0, 1fr); height: calc(100vh - var(--top-h)); }
.shell.chat-hidden { grid-template-columns: 0 0 minmax(0, 1fr); }
.shell.chat-hidden .chat, .shell.chat-hidden .resizer { visibility: hidden; }
.resizer { cursor: col-resize; position: relative; background: transparent; }
.resizer::after { content: ""; position: absolute; inset: 0 2px; background: var(--line); transition: background 0.15s; }
.resizer:hover::after, .resizer.dragging::after { background: var(--accent); }
.main { overflow-y: auto; padding: 22px 28px 48px; scroll-behavior: smooth; container-type: inline-size; }
.only-mobile { display: none !important; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-width: 0; background: var(--panel); height: 100%; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.accent-ico { width: 22px; height: 22px; color: var(--accent); }
.chat-tools { display: flex; align-items: center; gap: 4px; }
.model-select { font: 500 12px var(--sans); color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; max-width: 170px; }
.messages { flex: 1; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 16px; }
.welcome { padding: 6px 2px; }
.welcome h3 { font-size: 17px; letter-spacing: -0.01em; }
.welcome > .lede { margin: 6px 0 16px; line-height: 1.5; }
.ex-group { margin-bottom: 12px; }
.ex-label { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.example { display: inline-flex; margin: 0 6px 6px 0; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); font-size: 12.5px; }
.example:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }

.msg-user { align-self: flex-end; max-width: 88%; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink); padding: 8px 12px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg-user .about { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg-bot { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.trace { font-size: 12.5px; color: var(--muted); }
.trace summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px; padding: 3px 0; }
.trace summary::-webkit-details-marker { display: none; }
.trace summary::after { content: "›"; font-size: 14px; transition: transform 0.15s; }
.trace[open] summary::after { transform: rotate(90deg); }
.trace .live { color: var(--ink-2); }
.trace ol { margin: 4px 0 0; padding: 0 0 0 4px; list-style: none; border-left: 2px solid var(--line); }
.trace li { padding: 2px 0 2px 12px; position: relative; }
.trace li::before { content: ""; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line-2); }
.trace li.warn { color: var(--warn); }
.answer { color: var(--ink); line-height: 1.6; overflow-wrap: anywhere; }
.answer:empty { display: none; }
.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer p { margin: 0 0 9px; }
.answer ul, .answer ol { margin: 0 0 9px; padding-left: 20px; }
.answer strong { font-weight: 650; }
.answer table { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 6px 0 10px; display: block; overflow-x: auto; }
.answer th, .answer td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; white-space: nowrap; }
.answer th { color: var(--muted); font-weight: 500; font-size: 11.5px; background: var(--panel-2); }
.answer td:not(:first-child) { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; }
.answer code { background: var(--sunken); padding: 1px 5px; border-radius: 5px; }
.visuals:empty, .approvals:empty { display: none; }
.visuals, .approvals { display: flex; flex-direction: column; gap: 10px; }
.evidence { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.evidence > summary { cursor: pointer; padding: 7px 11px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.evidence > summary:hover { color: var(--ink); }
.evidence[open] > summary { border-bottom: 1px solid var(--line); }
.evidence-body { padding: 10px; display: flex; flex-direction: column; gap: 12px; }
.result .src { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-weight: 500; }
.tag.unverified { background: var(--warn-soft); color: var(--warn); }
.result details summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-top: 6px; }
.result pre { background: var(--sunken); border-radius: 8px; padding: 10px; overflow-x: auto; margin: 6px 0 0; white-space: pre-wrap; }
.msg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.badge { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.badge.good { color: var(--good); border-color: transparent; background: var(--good-soft); }
.badge.warn { color: var(--warn); border-color: transparent; background: var(--warn-soft); }
.badge svg { width: 12px; height: 12px; }
.msg-actions { margin-left: auto; display: flex; gap: 2px; }
.msg-actions .icon-btn { width: 28px; height: 28px; }
.msg-actions .icon-btn svg { width: 15px; height: 15px; }
.followups { display: flex; flex-wrap: wrap; gap: 6px; }

.composer { padding: 10px 14px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.context-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 4px 2px 10px; margin-bottom: 7px; }
.context-chip button { border: 0; background: none; color: inherit; padding: 0 4px; line-height: 1; }
.composer-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line-2); border-radius: 12px; padding: 7px 7px 7px 12px; background: var(--panel); transition: border-color 0.15s, box-shadow 0.15s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: 14px/1.5 var(--sans); max-height: 180px; padding: 4px 0; }
.send { width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.send svg { width: 17px; height: 17px; stroke-width: 2.2; }
.composer-hint { font-size: 11px; color: var(--faint); margin-top: 6px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

/* ---------- dashboard ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; gap: 10px; }
.freshness { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.fresh { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.fresh b { color: var(--ink-2); font-weight: 600; }
.fresh .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.fresh .dot.live { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.free { font-size: 12px; color: var(--good); background: var(--good-soft); border-radius: 999px; padding: 3px 10px; font-weight: 500; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 13px; box-shadow: var(--shadow); text-align: left; display: flex; flex-direction: column; gap: 2px; position: relative; transition: border-color 0.15s, transform 0.15s; }
.kpi:hover { border-color: var(--accent-line); }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .label .src-dot { width: 6px; height: 6px; border-radius: 2px; background: var(--c1); }
.kpi .label .src-dot.maven { background: var(--c2); }
.kpi .value { font: 600 27px/1.15 var(--sans); letter-spacing: -0.03em; margin-top: 4px; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 1px; }
.kpi .hint { font-size: 12px; color: var(--muted); }
.kpi .bar { height: 5px; border-radius: 99px; background: var(--sunken); overflow: hidden; display: flex; margin-top: 8px; }
.kpi .bar span { display: block; height: 100%; }
.kpi .ask { position: absolute; top: 12px; right: 12px; opacity: 0; color: var(--accent); transition: opacity 0.15s; }
.kpi:hover .ask { opacity: 1; }

.attention { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
.attention:empty { display: none; }
.insight { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.insight:hover { border-color: var(--line-2); }
.insight .ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.insight .ico svg { width: 15px; height: 15px; }
.insight.bad .ico { background: var(--bad-soft); color: var(--bad); }
.insight.warn .ico { background: var(--warn-soft); color: var(--warn); }
.insight.info .ico { background: var(--accent-soft); color: var(--accent); }
.insight .t { font-weight: 600; font-size: 13px; line-height: 1.35; }
.insight .d { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.insight .go { font-size: 12px; color: var(--accent); margin-top: 4px; display: inline-flex; gap: 4px; align-items: center; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.chart-card { grid-column: span 12; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-head .lede { max-width: 56ch; }
.card-tools { display: flex; gap: 2px; flex: none; }
.card-tools .icon-btn { width: 28px; height: 28px; }
.card-tools .icon-btn svg { width: 15px; height: 15px; }
.card-tools .icon-btn.on { background: var(--sunken); color: var(--ink); }
.chart-area { position: relative; height: 300px; }
.chart-area.tall { height: 360px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend .line-i { height: 2px; width: 14px; border-radius: 0; border-top: 2px dashed var(--muted); }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 9px; margin-top: auto; }
.card-foot .verified { color: var(--good); display: inline-flex; align-items: center; gap: 4px; }
.card-foot .verified svg { width: 12px; height: 12px; stroke-width: 2.4; }
.chart-card { container-type: inline-size; }
.donut-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; }
@container (max-width: 440px) {
  .donut-wrap { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap .chart-area { height: 200px; }
}
.donut-wrap .chart-area { height: 230px; }
.stat-list { display: flex; flex-direction: column; gap: 9px; }
.stat-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 13px; border: 0; background: none; text-align: left; padding: 4px 6px; border-radius: 7px; }
.stat-row:hover { background: var(--sunken); }
.stat-row i { width: 10px; height: 10px; border-radius: 3px; }
.stat-row .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.stat-row .p { color: var(--muted); font-size: 11.5px; margin-left: 4px; }

.section-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; }
.qchips { display: flex; flex-wrap: wrap; gap: 8px; }
.qbtn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 13px; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; box-shadow: var(--shadow); color: var(--ink-2); }
.qbtn:hover { border-color: var(--accent-line); color: var(--ink); }
.qbtn svg { color: var(--good); width: 14px; height: 14px; stroke-width: 2.4; }

/* tables */
.table-wrap { overflow: auto; max-height: 420px; border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: 11.5px; text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
tr:last-child td { border-bottom: 0; }
th.n, td.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--panel-2); }
.inline-bar { display: inline-block; height: 6px; border-radius: 99px; background: var(--accent); vertical-align: middle; margin-left: 8px; opacity: 0.75; }
.chart-box { position: relative; height: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 10px 6px; }
.chart-wrap { display: flex; flex-direction: column; gap: 4px; }
.chart-wrap .chart-title { font-size: 13px; font-weight: 600; }
.chart-actions { display: flex; gap: 2px; justify-content: flex-end; }
.chart-actions .icon-btn { width: 26px; height: 26px; }
.chart-actions .icon-btn svg { width: 14px; height: 14px; }

/* ---------- states ---------- */
.skeleton { background: linear-gradient(90deg, var(--sunken), var(--panel-2), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-kpi { height: 104px; }
.sk-chart { height: 380px; grid-column: span 12; }
.notice { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px dashed var(--line-2); color: var(--muted); }
.error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-size: 13px; }
.spinner { width: 13px; height: 13px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 10px; z-index: 50; font-size: 13px; box-shadow: var(--shadow-lg); }

/* ---------- connections ---------- */
.callout { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; color: var(--ink-2); line-height: 1.55; }
.demo-tag { display: inline-block; margin-left: 6px; font-size: 12px; color: var(--warn); font-weight: 500; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card.app { display: flex; flex-direction: column; gap: 12px; }
.app-top { display: flex; gap: 12px; align-items: flex-start; }
.app-icon { width: 38px; height: 38px; border-radius: 10px; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.caps { display: flex; gap: 6px; flex-wrap: wrap; }
.cap { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.cap.w { background: var(--warn-soft); color: var(--warn); }
.card.app .actions { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.state { font-size: 12.5px; color: var(--muted); }
.state.on { color: var(--good); font-weight: 500; }

/* ---------- approvals ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.approval { border: 1px solid var(--warn); background: var(--panel); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 7px; box-shadow: var(--shadow); }
.approval.done { border-color: var(--line); }
.approval .head { font-weight: 600; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.approval .who { font-size: 12.5px; color: var(--ink-2); }
.approval label { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: 4px; }
.approval input, .approval textarea { font: 13px/1.5 var(--sans); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; }
.approval textarea { min-height: 120px; resize: vertical; }
.approval textarea.json { font-family: var(--mono); font-size: 12px; }
.approval .safety { font-size: 12px; color: var(--warn); }
.approval .row { display: flex; gap: 8px; margin-top: 4px; }
.result-line { font-size: 12.5px; color: var(--muted); }
.result-line:empty { display: none; }
.result-line.ok { color: var(--good); }
.result-line.bad { color: var(--bad); }

/* ---------- audit ---------- */
.audit td code { font-size: 11.5px; color: var(--muted); }
.kind { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--sunken); color: var(--ink-2); }

/* ---------- modal ---------- */
.modal { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 64px); background: var(--panel); color: var(--ink); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(10, 13, 20, 0.45); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px 18px; overflow: auto; max-height: calc(100vh - 160px); display: flex; flex-direction: column; gap: 12px; }

/* ---------- responsive (by the dashboard's own width, which changes with the chat panel) ---------- */
@container (min-width: 620px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attention { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 860px) {
  .chart-card { grid-column: span 6; }
  .chart-card.wide { grid-column: span 7; }
  .chart-card.narrow { grid-column: span 5; }
  .sk-chart { grid-column: span 6; }
}
@container (min-width: 1120px) {
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .attention { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .only-mobile { display: inline-grid !important; }
  .fab.only-mobile { display: inline-flex !important; }
  #toggle-chat { display: none; }
  .status { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }
  .brand .title { display: none; }
  .chat-title .lede { display: none; }
  .shell, .shell.chat-hidden { display: block; height: auto; }
  .resizer { display: none; }
  .main { padding: 16px 16px 90px; overflow: visible; }
  .chat { position: fixed; inset: 0; z-index: 40; transform: translateY(100%); transition: transform 0.25s ease; visibility: visible !important; }
  body.chat-open .chat { transform: none; }
  .fab { position: fixed; right: 16px; bottom: 16px; z-index: 30; gap: 7px; align-items: center; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 600; box-shadow: var(--shadow-lg); }
  .donut-wrap { grid-template-columns: 1fr; }
  .chart-area { height: 280px; }
  h1 { font-size: 19px; }
  .kpi .value { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- dashboard sections ---------- */
.dash-nav { position: sticky; top: -22px; z-index: 5; display: flex; gap: 6px; align-items: center; padding: 10px 0; margin: 4px 0 6px; background: linear-gradient(var(--bg) 80%, transparent); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--sunken); gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 13px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.dash-section { margin-bottom: 8px; }
.dash-section > .section-head { margin-top: 14px; }
.dash-section > .section-head h2 { font-size: 16px; }
.main.refreshing #kpis, .main.refreshing #attention, .main.refreshing #sections { opacity: 0.45; transition: opacity 0.2s; pointer-events: none; }
.list { display: flex; flex-direction: column; }
.list-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 13px; border-radius: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--panel-2); }
.list-row .main-t { font-weight: 500; color: var(--ink); }
.list-row .sub { font-size: 11.5px; color: var(--muted); }
.list-row .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); text-align: right; }
.list-row .meter { width: 70px; height: 5px; border-radius: 99px; background: var(--sunken); overflow: hidden; margin-left: auto; margin-top: 4px; }
.list-row .meter span { display: block; height: 100%; border-radius: 99px; }
@container (min-width: 860px) {
  .chart-card.half { grid-column: span 6; }
  .chart-card.full { grid-column: span 12; }
}

/* ---------- answer canvas (charts and data from chat land here) ---------- */
.answers-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.answers-empty svg { width: 28px; height: 28px; color: var(--accent); margin-bottom: 8px; }
.board { margin-bottom: 30px; scroll-margin-top: 12px; }
.board + .board { border-top: 1px solid var(--line); padding-top: 24px; }
.board-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.board-head .q { font-size: 18px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.35; }
.board-head .meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.board-summary { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px; color: var(--ink-2); line-height: 1.55; }
.board-summary:empty { display: none; }
.board-summary p { margin: 0; }
.board .grid { margin-bottom: 14px; }
.board .chart-card .chart-box { border: 0; padding: 0; background: none; }
.board .table-card .card-head { margin-bottom: 8px; }
.board .table-card .table-wrap { max-height: 380px; }
.answer-link { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; text-align: left; }
.answer-link:hover { border-color: var(--accent); }
.answer-link svg { color: var(--accent); }
.answer-link b { font-weight: 600; }
.tab .count.accent { color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 0 6px; }

/* ---------- account menu ---------- */
.user-menu { position: relative; }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--sans); color: #fff; background: linear-gradient(135deg, #2a78d6, #4f5ff0); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 30; overflow: hidden; }
.menu-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.menu-name { font-weight: 600; }
.menu-body { padding: 10px 16px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.menu-row { display: grid; grid-template-columns: 74px 1fr; gap: 8px; }
.menu-row .lede { margin: 0; }
.menu-access { margin: 4px 0 0; font-size: 12px; line-height: 1.45; }
.menu-item { width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 11px 16px; text-align: left; display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.menu-item:hover { background: var(--panel-2); }

/* ---------- shared building blocks ---------- */
.stack.wide { max-width: none; }
.status-badge { font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.status-badge.good { background: var(--good-soft); color: var(--good); }
.status-badge.warn { background: var(--warn-soft); color: var(--warn); }
.status-badge.bad { background: var(--bad-soft); color: var(--bad); }
.status-badge.accent { background: var(--accent-soft); color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label, .field > .label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea, select.inline { font: 13.5px var(--sans); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field .hint { font-size: 11.5px; color: var(--faint); }
.row-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; font-size: 13px; cursor: pointer; background: var(--panel); }
.radio-row label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-row input { accent-color: var(--accent); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle .t { font-weight: 500; font-size: 13.5px; }
.toggle .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background 0.15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:disabled + span { opacity: 0.5; cursor: default; }

/* chip picker (people, teams, programs) */
.picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; padding: 5px 6px; background: var(--panel-2); min-height: 36px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--accent-soft); color: var(--ink); border-radius: 999px; padding: 2px 4px 2px 9px; }
.chip button { border: 0; background: none; color: var(--muted); padding: 0 4px; font-size: 13px; line-height: 1; }
.chip button:hover { color: var(--bad); }
.picker select { border: 0; background: transparent; color: var(--muted); font: 12.5px var(--sans); padding: 3px; flex: 1; min-width: 120px; }

/* ---------- inbox ---------- */
.inbox-list { display: flex; flex-direction: column; gap: 8px; max-width: 860px; }
.inbox-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); width: 100%; }
.inbox-item:hover { border-color: var(--line-2); }
.inbox-item.unread { border-left: 3px solid var(--accent); }
.inbox-item .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--sunken); color: var(--muted); }
.inbox-item.kind-alert .ico { background: var(--bad-soft); color: var(--bad); }
.inbox-item.kind-report .ico { background: var(--accent-soft); color: var(--accent); }
.inbox-item.kind-approval .ico, .inbox-item.kind-task .ico { background: var(--warn-soft); color: var(--warn); }
.inbox-item .t { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.inbox-item .d { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.inbox-item .when { font-size: 11.5px; color: var(--faint); white-space: nowrap; }

/* ---------- tasks ---------- */
.playbooks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 20px; }
.playbook { text-align: left; border: 1px dashed var(--line-2); background: var(--panel); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.playbook:hover { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); }
.playbook .k { font-size: 12px; font-weight: 500; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.playbook .k svg { width: 13px; height: 13px; }
.playbook .t { font-weight: 600; font-size: 13.5px; }
.playbook .d { font-size: 12px; color: var(--muted); line-height: 1.4; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.task.awaiting { border-color: var(--warn); }
.task-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.task-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.task-title svg { color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.task-meta b { color: var(--ink-2); font-weight: 500; }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.task-prompt { font-size: 12.5px; color: var(--ink-2); background: var(--panel-2); border-radius: 8px; padding: 8px 10px; line-height: 1.5; }
.runs { font-size: 12.5px; }
.runs table td { padding: 5px 8px; }

/* ---------- connections ---------- */
.apps { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
.conn-section { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.conn-section h4 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.levels { width: 100%; font-size: 12.5px; }
.levels td { padding: 5px 4px; border-bottom: 1px solid var(--line); white-space: normal; }
.levels tr:last-child td { border-bottom: 0; }
.levels td:last-child { text-align: right; }
.levels .w { font-size: 10.5px; color: var(--warn); font-weight: 600; margin-left: 4px; }
.seg.small button { padding: 3px 8px; font-size: 11.5px; }
.seg.small button.on.off { color: var(--bad); }
.shared-from { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }

/* ---------- admin ---------- */
.admin-seg { margin-bottom: 16px; }
.admin-table td, .admin-table th { white-space: normal; vertical-align: top; }
.admin-table td { padding: 9px 10px; }
.admin-table .who b { display: block; font-weight: 600; }
.admin-table .who span { font-size: 12px; color: var(--muted); }
.admin-table .picker { min-width: 240px; }
.invite { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.invite .field { margin: 0; }
.team-card { display: flex; flex-direction: column; gap: 8px; }
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.member-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 4px 0; }
.lead-tag { font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }

/* ---------- pages ---------- */
.shared-pages:empty { display: none; }
.shared-pages { margin-bottom: 18px; }
.page-links { display: flex; flex-wrap: wrap; gap: 8px; }
.page-link { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 7px 12px; font-size: 13px; display: inline-flex; gap: 8px; align-items: center; color: var(--ink-2); }
.page-link:hover { border-color: var(--accent-line); }
.page-link small { color: var(--faint); }
.page-view .board-head .q { font-size: 21px; }
.access-note { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.answer-md { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; line-height: 1.6; }
.answer-md table { border-collapse: collapse; font-size: 12.5px; margin: 6px 0 10px; display: block; overflow-x: auto; }
.answer-md th, .answer-md td { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; white-space: nowrap; }
.table-tools { display: flex; gap: 4px; }
.scope-chip { font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 900px) {
  .user-menu .menu { position: fixed; right: 10px; left: 10px; width: auto; top: 60px; }
  .admin-table .picker { min-width: 0; }
}

/* more tabs since sign-in: keep the top bar on one line */
.topbar .tabs { min-width: 0; flex: 1; }
@media (max-width: 1360px) { .topbar .status { display: none; } }
@media (max-width: 1180px) { .brand .title { display: none; } .tab { padding: 7px 8px; } }
.board-head .page-actions { flex: none; flex-wrap: nowrap; }
.board-head .page-actions button { white-space: nowrap; }

/* Chat scrolls inside its panel: flex/grid children need min-height 0, or long answers push past the screen. */
.chat { min-height: 0; overflow: hidden; }
.messages { min-height: 0; }
.main { min-height: 0; }

/* ---------- motion and browser surfaces ---------- */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); }
::selection { background: color-mix(in oklab, var(--accent) 28%, transparent); color: var(--ink); }
input, textarea { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
button, .qbtn, .kpi, .insight, .example, .playbook, .page-row, .menu-item, .inbox-item, .stat-row {
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
:where(button, .qbtn, .kpi, .insight, .example, .playbook, .inbox-item, .page-row):active:not(:disabled) { transform: scale(0.97); }
.icon-btn:disabled { opacity: 0.35; }

/* ---------- answer canvas: one answer, nothing else ---------- */
.canvas-bar {
  position: sticky; top: -22px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
  margin: -22px -28px 20px; padding: 10px 18px 10px 14px;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.pager { display: inline-flex; align-items: center; }
.pager .pos { font: 500 12px var(--mono); color: var(--muted); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.canvas-q { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 8px; border-radius: 8px; text-align: left; font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; color: var(--ink); }
.canvas-q span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-q svg { width: 15px; height: 15px; color: var(--faint); }
.canvas-q:hover { background: var(--sunken); }
.canvas-meta { font-size: 12px; color: var(--faint); white-space: nowrap; }
.canvas-actions { display: flex; }
.menu.history { left: 14px; right: auto; top: calc(100% + 4px); width: min(540px, calc(100% - 28px)); max-height: 60vh; overflow: auto; padding: 6px; }
.menu-label { font-size: 12px; color: var(--faint); padding: 8px 10px 4px; }
.menu.history .menu-item { border-top: 0; border-radius: 8px; padding: 8px 10px; justify-content: space-between; gap: 14px; }
.mi-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.mi-sub { color: var(--faint); font-size: 12px; flex: none; }
.menu-item.current { background: var(--sunken); }
.menu-item.current .mi-text { color: var(--ink); font-weight: 600; }

.canvas-board { display: flex; flex-direction: column; gap: 22px; }
.canvas-charts { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.canvas-charts.multi { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.surface { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.chart-surface { padding: 14px 16px 10px; }
.chart-surface .chart-box { border: 0; padding: 0; background: none; }
.canvas-tables { display: flex; flex-direction: column; gap: 22px; }
.data-block { display: flex; flex-direction: column; gap: 8px; }
.data-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.data-head .src { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink-2); }
.data-head .src svg { width: 13px; height: 13px; stroke-width: 2.2; }
.data-head .src.ok svg { color: var(--good); }
.data-head .src.warn svg { color: var(--warn); }
.data-head .rows { color: var(--faint); }
.data-head .grow { flex: 1; }
.data-block .table-wrap.surface { max-height: 480px; }
.query summary { width: fit-content; cursor: pointer; font-size: 12px; color: var(--muted); }
.query summary:hover { color: var(--ink); }
.query pre { background: var(--sunken); border-radius: 8px; padding: 10px 12px; margin: 6px 0 0; white-space: pre-wrap; overflow-x: auto; }
.canvas-empty { min-height: 62vh; display: grid; place-content: center; justify-items: center; gap: 20px; color: var(--muted); text-align: center; }
.canvas-empty p { margin: 0; font-size: 14px; }
#canvas-pages { display: flex; flex-direction: column; gap: 2px; width: min(480px, 80vw); text-align: left; }
.page-row { display: flex; justify-content: space-between; gap: 14px; border: 0; background: none; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13px; text-align: left; }
.page-row:hover { background: var(--sunken); }
.page-row small { color: var(--faint); flex: none; }
.page-answer { max-width: 75ch; color: var(--ink-2); line-height: 1.6; margin-bottom: 20px; }

/* ---------- chat: the words, quietly ---------- */
.view-link { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--accent); font-size: 12.5px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.view-link svg { width: 14px; height: 14px; }
.view-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.view-link:active { transform: none; }
.msg-foot { gap: 10px; }
.msg-foot .badge { border: 0; padding: 0; background: none; font-size: 11.5px; color: var(--faint); }
.msg-foot .badge.good { color: var(--good); }
.msg-foot .badge.warn { color: var(--warn); }
.msg-bot { gap: 8px; }
.trace summary { font-size: 12px; }

.canvas-summary { max-width: 78ch; font-size: 15px; line-height: 1.6; color: var(--ink); }
.canvas-summary p { margin: 0 0 8px; }
.canvas-summary p:last-child { margin-bottom: 0; }
.canvas-summary .pending { display: inline-flex; gap: 8px; align-items: center; color: var(--faint); font-size: 13.5px; }

/* ---------- skeleton while an answer is being worked out ---------- */
.sk { display: block; border-radius: 6px; }
.shimmer {
  background: linear-gradient(90deg, var(--line) 0%, var(--line) 30%, var(--panel-2) 50%, var(--line) 70%, var(--line) 100%);
  background-size: 250% 100%;
  animation: shimmer 1.6s linear infinite;
}
.surface .shimmer { background-image: linear-gradient(90deg, var(--sunken) 0%, var(--sunken) 30%, var(--panel) 50%, var(--sunken) 70%, var(--sunken) 100%); }
.sk-lines { display: flex; flex-direction: column; gap: 11px; padding: 4px 0; }
.sk-lines .sk { height: 13px; }
.w92 { width: 92%; } .w80 { width: 80%; } .w46 { width: 46%; }
.sk-chart { padding: 18px 20px; display: flex; flex-direction: column; gap: 13px; }
.sk-title { height: 12px; width: 34%; margin-bottom: 6px; }
.sk-bar-row { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: center; }
.sk-label { height: 10px; width: 80%; justify-self: end; }
.sk-bar { height: 16px; border-radius: 4px; }
.sk-table { display: flex; flex-direction: column; gap: 8px; }
.sk-head { height: 12px; width: 26%; }
.sk-rows { padding: 6px 0; }
.sk-row { display: grid; grid-template-columns: 2fr 1.4fr 0.8fr; gap: 24px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: 0; }
.sk-row .sk { height: 10px; }
.sk-row .sk:last-child { justify-self: end; width: 60%; }
.canvas-board[aria-busy="true"] .canvas-summary { min-height: 72px; }
