/* base reset */
:root { color-scheme: light; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: steel-tinted three-pane workbench — sources & dashboards left, the board centre, the analyst right. */
:root {
  --bg: #e9edf1;
  --surface: #fbfcfd;
  --surface-2: #f2f4f7;
  --surface-3: #e3e8ee;
  --ink: #141a22;
  --ink-2: #44505e;
  --muted: #6f7b89;
  --line: #d5dbe3;
  --line-2: #c3cbd5;
  --accent: #2f64b0;
  --accent-soft: #e2eaf6;
  --accent-ink: #ffffff;
  --temper: #b4692a;           /* bronze temper tint: used for the analyst */
  --temper-soft: #f6eadf;
  --good: #0b8a0b;
  --warn: #a86a00;
  --warn-soft: #fbf0d9;
  --bad: #c2312f;
  --bad-soft: #f8e1e0;
  --c1: #2f64b0; --c2: #c2702e; --c3: #7b4fa8; --c4: #16968a; --c5: #b8434f; --c6: #3b8ed0; --c7: #8c8a2e; --c-other: #9aa3ae;
  --div-pos: #2f64b0; --div-neg: #c2702e;
  --shadow: 0 1px 2px rgba(20, 30, 45, .06), 0 4px 14px rgba(20, 30, 45, .05);
  --f-display: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 6px;
  --r-sm: 5px;
  --r-pill: 14px;
  --r-mark: 4px;
  --gap: 14px;
  --h-s: 220px; --h-m: 320px; --h-l: 480px;
  --side: 236px;
  --ai: 384px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1217; --surface: #151a21; --surface-2: #1b2129; --surface-3: #232b35; --ink: #e5e9ef; --ink-2: #b0b9c4; --muted: #7f8a97; --line: #262e38; --line-2: #343e4a;
    --accent: #5b8ddb; --accent-soft: #1b2a40; --accent-ink: #0b1220; --temper: #d08648; --temper-soft: #2c2117;
    --good: #3cbc3c; --warn: #f0b23a; --warn-soft: #2e2512; --bad: #e46462; --bad-soft: #321a1a;
    --c1: #4a7dd0; --c2: #c9773a; --c3: #9670c4; --c4: #1fa597; --c5: #d0606c; --c6: #4f98d2; --c7: #97953a; --c-other: #6b7580;
    --div-pos: #4a7dd0; --div-neg: #c9773a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1217; --surface: #151a21; --surface-2: #1b2129; --surface-3: #232b35; --ink: #e5e9ef; --ink-2: #b0b9c4; --muted: #7f8a97; --line: #262e38; --line-2: #343e4a;
  --accent: #5b8ddb; --accent-soft: #1b2a40; --accent-ink: #0b1220; --temper: #d08648; --temper-soft: #2c2117;
  --good: #3cbc3c; --warn: #f0b23a; --warn-soft: #2e2512; --bad: #e46462; --bad-soft: #321a1a;
  --c1: #4a7dd0; --c2: #c9773a; --c3: #9670c4; --c4: #1fa597; --c5: #d0606c; --c6: #4f98d2; --c7: #97953a; --c-other: #6b7580;
  --div-pos: #4a7dd0; --div-neg: #c9773a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.45; overflow: hidden; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100%; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding-left: env(safe-area-inset-left, 0px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand-mark { width: 26px; height: 26px; border-radius: 4px; background: var(--ink); display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 5px; }
.brand-mark i { background: var(--surface); border-radius: 1px; }
.brand-mark i:nth-child(2) { background: var(--temper); }
.brand-mark i:nth-child(4), .brand-mark i:nth-child(9) { background: var(--accent); }
.brand b { font-family: var(--f-display); font-size: 20px; letter-spacing: .01em; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 8px 10px; border-bottom: 1px solid var(--line); }
.nav button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; background: none; border-radius: var(--r-sm); color: var(--ink-2); text-align: left; font-weight: 500; }
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav .badge { margin-left: auto; font-size: 11px; font-family: var(--f-mono); background: var(--warn-soft); color: var(--warn); padding: 0 6px; border-radius: 9px; }
.side-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.dash-list { overflow: auto; flex: 1; padding: 0 8px 12px; min-height: 0; }
.dash-item { width: 100%; display: block; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); }
.dash-item:hover { background: var(--surface-2); }
.dash-item[aria-current="true"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.dash-item b { display: block; font-weight: 600; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-item small { color: var(--muted); font-size: 12px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 6px; align-items: center; }
.side-foot .store { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.scroller { overflow: auto; flex: 1; min-height: 0; }
.wrap { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); padding-block: 0 40px; max-width: 1480px; margin: 0 auto; }

/* top bar for narrow screens */
.topbar { display: none; align-items: center; gap: 8px; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar b { font-family: var(--f-display); font-size: 18px; flex: 1; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 28px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ai { border-color: color-mix(in srgb, var(--temper) 45%, var(--line-2)); color: var(--temper); }
.btn.ai:hover { background: var(--temper-soft); }
.btn.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
input[type="text"], input[type="search"], input[type="date"], input[type="number"], input[type="password"], select, textarea { height: 32px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); padding: 0 9px; min-width: 0; }
textarea { height: auto; padding: 8px 10px; resize: none; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }

/* ---------- header ---------- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 0 14px; }
.head-l { min-width: 0; flex: 1 1 380px; }
.title-in { font-family: var(--f-display); font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: .005em; border: 0; background: none; padding: 2px 4px; margin-left: -4px; border-radius: 4px; width: 100%; max-width: 640px; text-overflow: ellipsis; }
.title-in:hover { background: var(--surface-2); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.vchip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 12px; padding: 2px 8px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok { background: var(--good); } .dot.busy { background: var(--warn); } .dot.err { background: var(--bad); }
.head-r { display: flex; gap: 6px; flex-wrap: wrap; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; font-size: 13.5px; }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.banner.ai { background: var(--temper-soft); border-color: color-mix(in srgb, var(--temper) 35%, transparent); }
.banner.err { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.banner .grow { flex: 1; min-width: 0; }
.banner b { font-weight: 600; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0 16px; border-top: 1px solid var(--line); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: calc(var(--r-sm) - 1px); font-size: 13px; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.range-txt { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; max-width: 340px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; color: inherit; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.chip button:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.custom-dates { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.w { grid-column: span var(--w, 6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; position: relative; }
.w.kpi { padding: 14px 16px 12px; }
.w.dragging { opacity: .4; }
.w.drop-before { box-shadow: -3px 0 0 var(--accent); }
.w.drop-after { box-shadow: 3px 0 0 var(--accent); }
.w-h { display: flex; align-items: flex-start; gap: 6px; padding: 12px 10px 4px 14px; }
.w.kpi .w-h { padding: 0; }
.w-t { flex: 1; min-width: 0; }
.w-t h3 { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.w-t p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.w-tools { display: flex; gap: 0; opacity: .0; transition: opacity .12s; }
.w:hover .w-tools, .w:focus-within .w-tools, .touch .w-tools { opacity: 1; }
.grip { cursor: grab; }
.w-b { flex: 1 0 auto; min-height: 0; position: relative; }
.w-b.s { height: var(--h-s); } .w-b.m { height: var(--h-m); } .w-b.l { height: var(--h-l); }
.dense .w.kpi { padding: 10px 12px 8px; }
.dense .w-h { padding: 8px 8px 2px 10px; }
.dense .kpi-v { font-size: clamp(22px, 1.9vw, 30px); margin-top: 4px; }
.dense .ins { padding: 9px 11px; }
.dense .head { padding-block: 14px 10px; }
.dense .filters { padding-block: 8px 10px; }
.w-err { padding: 16px; color: var(--bad); font-size: 13px; }
.w-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }
.resize { position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; cursor: nwse-resize; opacity: 0; color: var(--muted); }
.w:hover .resize { opacity: .8; }
.kpi-v { font-family: var(--f-display); font-weight: 600; font-size: clamp(26px, 2.3vw, 36px); white-space: nowrap; line-height: 1.05; margin-top: 8px; letter-spacing: .005em; font-variant-numeric: tabular-nums; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; }
.kpi-d { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.kpi-d .dv { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.kpi-d small { font-weight: 400; color: var(--muted); }
.kpi-d.up { color: var(--good); } .kpi-d.down { color: var(--bad); } .kpi-d.flat { color: var(--muted); }
.spark { width: 96px; height: 34px; flex: none; }

/* table */
.tbl-wrap { overflow: auto; height: 100%; }
table.t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.t th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-2); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
table.t th.n, table.t td.n { text-align: right; }
table.t td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
table.t td.n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
table.t tr:hover td { background: var(--surface-2); }
.tbl-bar { display: flex; gap: 8px; align-items: center; padding: 0 14px 10px; flex-wrap: wrap; }
.tbl-bar .grow { flex: 1; }
.pager { display: flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }

/* insights */
.ins-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.ins { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 12px 14px; display: flex; gap: 10px; min-width: 0; }
.ins .mk { width: 22px; height: 22px; border-radius: 4px; flex: none; display: grid; place-items: center; margin-top: 1px; }
.ins .mk svg { width: 14px; height: 14px; }
.ins.up .mk { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.ins.down .mk { background: var(--bad-soft); color: var(--bad); }
.ins.warn .mk { background: var(--warn-soft); color: var(--warn); }
.ins.info .mk { background: var(--surface-3); color: var(--ink-2); }
.ins h4 { margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.35; text-wrap: balance; }
.ins p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.ins .tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 3px; background: var(--surface-3); color: var(--ink-2); font-weight: 500; }
.linkbtn { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 500; font-size: 12.5px; }
.linkbtn:hover { text-decoration: underline; }
.ins-list { display: flex; flex-direction: column; gap: 10px; }

/* sections (views) */
.sec { margin-top: 18px; }
.sec h2 { font-family: var(--f-display); font-size: 21px; font-weight: 600; margin: 0 0 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.role-sel { height: 26px; font-size: 12px; padding: 0 4px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 3px; }
.pill.measure { background: var(--accent-soft); color: var(--accent); }
.pill.dimension { background: var(--temper-soft); color: var(--temper); }
.pill.time { background: color-mix(in srgb, var(--c4) 15%, transparent); color: var(--c4); }
.pill.id, .pill.text, .pill.ignore { background: var(--surface-3); color: var(--ink-2); }

/* look panel */
.look { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); z-index: 65; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; padding-right: env(safe-area-inset-right, 0px); }
.look-h { display: flex; align-items: center; gap: 8px; padding: calc(14px + env(safe-area-inset-top, 0px)) 12px 12px 18px; border-bottom: 1px solid var(--line); }
.look-h b { font-family: var(--f-display); font-size: 20px; font-weight: 600; flex: 1; }
.look-b { overflow: auto; padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 20px; }
.look-sec h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.look-sec p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tcard { border: 1.5px solid var(--line); border-radius: var(--r); padding: 0; background: none; text-align: left; overflow: hidden; display: flex; flex-direction: column; }
.tcard:hover { border-color: var(--line-2); }
.tcard[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.tprev { height: 64px; padding: 8px; display: flex; }
.tprev .tsurf { flex: 1; border-radius: 3px; padding: 7px 8px; display: flex; align-items: flex-end; gap: 4px; }
.tprev .tbar { flex: 1; border-radius: 2px 2px 0 0; }
.tname { padding: 7px 9px 8px; font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 1px; }
.tname small { font-weight: 400; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.accent-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.accent-row input[type="color"] { width: 40px; height: 32px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.accent-row input[type="text"] { width: 110px; font-family: var(--f-mono); }
.accent-row[hidden] { display: none !important; }
/* lock screen */
.lockscreen { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.lockbox { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) + 2px); padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.lockbox h2 { font-family: var(--f-display); font-size: 26px; margin: 4px 0 0; }
.lockbox p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.lockbox input { width: 100%; height: 38px; }
.lockerr { color: var(--bad); font-size: 13px; min-height: 18px; }
.lockforgot { font-size: 13px; color: var(--muted); }
.lockforgot summary { cursor: pointer; }
.lockforgot p { margin: 8px 0; }
/* privacy box */
.privacy { display: flex; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: var(--r); background: color-mix(in srgb, var(--good) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--good) 30%, var(--line)); }
.privacy .mk { width: 28px; height: 28px; border-radius: 6px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.privacy b { font-size: 14.5px; }
.privacy p { margin: 4px 0 6px; font-size: 13.5px; color: var(--ink-2); max-width: 70ch; }
.privacy .row { display: flex; gap: 16px; flex-wrap: wrap; }
/* empty / drop */
.empty { max-width: 860px; margin: 0 auto; padding: 56px 0 40px; }
.empty h1 { font-family: var(--f-display); font-size: 40px; line-height: 1.05; margin: 0 0 10px; font-weight: 700; text-wrap: balance; }
.empty .lede { font-size: 16px; color: var(--ink-2); max-width: 60ch; margin: 0 0 26px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: calc(var(--r) + 4px); background: var(--surface); padding: 34px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-family: var(--f-display); font-size: 22px; font-weight: 600; }
.drop small { color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.steps div { border-top: 2px solid var(--line-2); padding-top: 10px; font-size: 13px; color: var(--ink-2); }
.steps b { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 2px; }
.drop-overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 3px dashed var(--accent); z-index: 60; display: grid; place-items: center; pointer-events: none; }
.drop-overlay div { background: var(--surface); padding: 16px 22px; border-radius: 8px; font-weight: 600; box-shadow: var(--shadow); }

/* ---------- AI panel ---------- */
.aip { width: var(--ai); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding-right: env(safe-area-inset-right, 0px); }
.aip[hidden] { display: none !important; }
.ai-h { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.ai-h b { font-family: var(--f-display); font-size: 18px; font-weight: 600; flex: 1; }
.ai-mark { width: 22px; height: 22px; border-radius: 4px; background: var(--temper); color: #fff; display: grid; place-items: center; }
.ai-mark svg { width: 14px; height: 14px; }
.ai-log { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.msg.user { align-self: flex-end; background: var(--surface-3); padding: 8px 12px; border-radius: 10px 10px 2px 10px; max-width: 88%; }
.msg.bot { font-size: 13.5px; }
.msg.bot .md > *:first-child { margin-top: 0; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 18px; }
.md li { margin: 2px 0; }
.md h3, .md h4 { font-size: 13.5px; margin: 10px 0 4px; }
.md table { border-collapse: collapse; font-size: 12.5px; margin: 6px 0 10px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; }
.md code { font-family: var(--f-mono); font-size: 12px; background: var(--surface-3); padding: 0 4px; border-radius: 3px; }
.tool { font-size: 12px; color: var(--muted); border-left: 2px solid var(--line-2); padding: 2px 0 2px 8px; margin: 0 0 8px; }
.tool summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; }
.tool summary::-webkit-details-marker { display: none; }
.tool .tool-body { margin-top: 6px; overflow-x: auto; }
.tool pre { font-family: var(--f-mono); font-size: 11px; white-space: pre-wrap; margin: 0 0 6px; color: var(--ink-2); }
.thinking { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--temper); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.ai-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.ai-sugg button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 14px; padding: 4px 10px; font-size: 12.5px; color: var(--ink-2); text-align: left; }
.ai-sugg button:hover { border-color: var(--temper); color: var(--temper); }
.ai-in { border-top: 1px solid var(--line); padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; align-items: flex-end; }
.ai-in textarea { flex: 1; max-height: 140px; }
.ai-note { font-size: 11.5px; color: var(--muted); padding: 0 16px 8px; }
.ai-intro { font-size: 13px; color: var(--ink-2); }
.ai-intro p { margin: 0 0 8px; }

/* menus & modal */
.menu { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow); padding: 4px; min-width: 200px; max-width: calc(100vw - 24px); max-height: 70vh; overflow: auto; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 10px; border-radius: 4px; text-align: left; font-size: 13px; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .mh { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.menu .danger { color: var(--bad); }
.menu .opt { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; border-radius: 4px; }
.menu .opt:hover { background: var(--surface-2); }
.menu .opt span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .opt small { color: var(--muted); font-family: var(--f-mono); }
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: calc(var(--r) + 2px); box-shadow: var(--shadow); width: min(640px, 100%); max-height: calc(100% - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(900px, 100%); }
.modal-h { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); gap: 8px; }
.modal-h h3 { margin: 0; font-family: var(--f-display); font-size: 20px; font-weight: 600; flex: 1; }
.modal-b { padding: 16px; overflow: auto; }
.modal-f { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: 6px; z-index: 90; font-size: 13px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-act { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: 0; }
.loading { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.loading .prog { flex-direction: column; align-items: stretch; width: min(440px, 88vw); gap: 8px; }
.loading .prog b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loading .prog small { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pbar { display: block; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.loading div { background: var(--surface); padding: 16px 22px; border-radius: 8px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-weight: 500; }

/* presentation */
.present .side, .present .aip, .present .topbar, .present .filters .seg-extra, .present .w-tools, .present .resize, .present .head-r .hide-present { display: none !important; }
.present .app { grid-template-columns: minmax(0, 1fr); }
.present .wrap { max-width: none; }
.present .kpi-v { font-size: 44px; }
.present .exit-present { display: inline-flex !important; }
.exit-present { display: none !important; }

/* responsive */
@media (max-width: 1180px) {
  .app { grid-template-columns: var(--side) minmax(0, 1fr); }
  .aip { position: fixed; right: 0; top: 0; bottom: 0; z-index: 50; box-shadow: var(--shadow); max-width: 100%; }
  .ins-strip { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 55; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .topbar { display: flex; }
  .wrap { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .w { grid-column: span 2 !important; }
  .w.kpi { grid-column: span 1 !important; }
  .kpi-v { font-size: 26px; }
  .spark { display: none; }
  .resize { display: none; }
  .cols2, .form-grid, .steps { grid-template-columns: minmax(0, 1fr); }
  .title-in { font-size: 24px; }
  .empty h1 { font-size: 30px; }
  .aip { width: 100%; }
  .w-b.l { height: 420px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
