*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ic-bg);
  color: var(--ic-text);
  font: 400 var(--ic-text-md)/1.55 var(--ic-font);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--ic-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
code, .mono { font-family: var(--ic-mono); font-size: 0.92em; }
::selection { background: var(--ic-accent-ring); }
:focus-visible { outline: 2px solid var(--ic-accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; border-right: 1px solid var(--ic-border); background: var(--ic-bg-raised);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-mark { width: 38px; height: 38px; flex: none; display: block; }
.brand-name { font-weight: 640; letter-spacing: -0.02em; font-size: 15px; line-height: 1.15; }
.brand-name small { display: block; font-weight: 450; font-size: var(--ic-text-xs); color: var(--ic-text-3); letter-spacing: 0; }
.ws-switch { margin: 0 4px 12px; position: relative; }
.ws-switch select {
  width: 100%; appearance: none; cursor: pointer; padding: 8px 32px 8px 10px; border-radius: 10px;
  background: var(--ic-surface); border: 1px solid var(--ic-border); font-weight: 520; font-size: var(--ic-text-sm);
}
.ws-switch::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.5px solid var(--ic-text-3); border-bottom: 1.5px solid var(--ic-text-3); transform: rotate(45deg); pointer-events: none;
}
.nav-label { padding: 12px 10px 4px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ic-text-3); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--ic-text-2);
  font-weight: 500; font-size: var(--ic-text-sm); text-decoration: none; transition: background var(--ic-fast), color var(--ic-fast);
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav a:hover { background: var(--ic-surface-2); color: var(--ic-text); }
.nav a.active { background: var(--ic-surface-2); color: var(--ic-text); box-shadow: inset 2px 0 0 var(--ic-accent); }
.nav a.active svg { color: var(--ic-accent); opacity: 1; }
.nav .count { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--ic-warn-soft); color: var(--ic-warn); font-weight: 600; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; border-top: 1px solid var(--ic-border); }
.me { flex: 1; min-width: 0; font-size: var(--ic-text-sm); line-height: 1.3; text-align: left; background: none; border: 0; color: inherit; font-family: inherit; padding: 6px 8px; margin: -6px 0 -6px -8px; border-radius: 9px; cursor: pointer; transition: background var(--ic-fast); }
.me:hover { background: var(--ic-surface-2); }
.me strong { display: block; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me span { color: var(--ic-text-3); font-size: var(--ic-text-xs); }
.kbd-hint { margin: 4px 6px 0; display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-radius: 9px; color: var(--ic-text-3); font-size: var(--ic-text-xs); border: 1px dashed var(--ic-border-strong); cursor: pointer; background: none; }
.kbd-hint:hover { color: var(--ic-text-2); border-color: var(--ic-text-3); }

.main { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 36px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head h1 { font-size: var(--ic-text-2xl); font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; }
.page-head p { margin-top: 6px; color: var(--ic-text-2); max-width: 680px; }
.page-actions { display: flex; gap: 8px; flex: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--ic-border-strong); background: var(--ic-surface); color: var(--ic-text);
  font-weight: 540; font-size: var(--ic-text-sm); cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background var(--ic-fast), border-color var(--ic-fast), transform var(--ic-fast), opacity var(--ic-fast);
}
.btn:hover { background: var(--ic-surface-2); border-color: var(--ic-text-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary { background: var(--ic-accent); border-color: transparent; color: var(--ic-on-accent); }
.btn.primary:hover { background: var(--ic-accent-strong); }
[data-theme="light"] .btn.primary:hover { color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ic-text-2); }
.btn.ghost:hover { background: var(--ic-surface-2); color: var(--ic-text); }
.btn.danger { color: var(--ic-danger); }
.btn.danger:hover { background: var(--ic-danger-soft); border-color: transparent; }
.btn.sm { height: 28px; padding: 0 10px; border-radius: 8px; font-size: var(--ic-text-xs); }
.btn.lg { height: 42px; padding: 0 20px; border-radius: 12px; font-size: var(--ic-text-md); }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn[disabled], .btn.loading { opacity: 0.55; pointer-events: none; }
.btn.loading::before { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }

/* Forms */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: var(--ic-text-sm); font-weight: 560; }
.hint { font-size: var(--ic-text-xs); color: var(--ic-text-3); line-height: 1.45; }
.input, .textarea, .select {
  width: 100%; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--ic-border-strong); background: var(--ic-bg-raised);
  color: var(--ic-text); outline: none; transition: border-color var(--ic-fast), box-shadow var(--ic-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--ic-text-3); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--ic-accent); box-shadow: 0 0 0 3px var(--ic-accent-soft); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--ic-text-3) 50%), linear-gradient(135deg, var(--ic-text-3) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.input.lg { height: 46px; font-size: var(--ic-text-lg); padding: 0 14px; border-radius: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 16px; }
.stack.tight { gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--ic-text-sm); padding: 6px 10px; border-radius: 9px; border: 1px solid var(--ic-border); background: var(--ic-surface); transition: border-color var(--ic-fast), background var(--ic-fast); }
.check:has(input:checked) { border-color: var(--ic-accent-ring); background: var(--ic-accent-soft); }
.check input { accent-color: var(--ic-accent); margin: 0; }
input[type="range"] { accent-color: var(--ic-accent); width: 100%; }
input[type="color"] { width: 42px; height: 34px; padding: 3px; border-radius: 9px; border: 1px solid var(--ic-border-strong); background: var(--ic-bg-raised); cursor: pointer; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--ic-surface-2); border: 1px solid var(--ic-border); }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: var(--ic-text-sm); font-weight: 520; color: var(--ic-text-2); cursor: pointer; transition: background var(--ic-fast), color var(--ic-fast); }
.seg button[aria-pressed="true"] { background: var(--ic-surface); color: var(--ic-text); box-shadow: 0 1px 2px rgba(0,0,0,.15), 0 0 0 1px var(--ic-border); }

/* Surfaces */
.card { background: var(--ic-surface); border: 1px solid var(--ic-border); border-radius: var(--ic-radius-lg); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ic-border); }
.card-head h2, .section-title { font-size: 15px; font-weight: 620; letter-spacing: -0.015em; }
.card-head p { color: var(--ic-text-3); font-size: var(--ic-text-xs); margin-top: 2px; }
.card-body { padding: 20px; }
.section { margin-top: 28px; }
.section + .split, .section + .card { margin-top: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.section-head p { color: var(--ic-text-3); font-size: var(--ic-text-sm); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.muted { color: var(--ic-text-2); }
.faint { color: var(--ic-text-3); }
.small { font-size: var(--ic-text-sm); }
.xs { font-size: var(--ic-text-xs); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--ic-border); margin: 16px 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--ic-border); border-radius: var(--ic-radius-lg); background: var(--ic-surface); overflow: hidden; }
.stat { padding: 16px 18px; border-right: 1px solid var(--ic-border); }
.stat:last-child { border-right: 0; }
.stat-label { font-size: var(--ic-text-xs); color: var(--ic-text-3); font-weight: 520; }
.stat-value { margin-top: 6px; font-size: 24px; font-weight: 640; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value small { font-size: 13px; color: var(--ic-text-3); font-weight: 500; margin-left: 3px; letter-spacing: 0; }
.stat-note { margin-top: 4px; font-size: var(--ic-text-xs); color: var(--ic-text-3); }

/* Summary hero */
.summary { padding: 22px 24px; border-radius: var(--ic-radius-lg); border: 1px solid var(--ic-border); background: var(--ic-surface); position: relative; overflow: hidden; }
.summary::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--ic-accent); }
.summary-eyebrow { font-size: var(--ic-text-xs); font-weight: 600; color: var(--ic-accent); text-transform: uppercase; letter-spacing: 0.08em; }
.summary-text { margin-top: 8px; font-size: 17px; line-height: 1.55; letter-spacing: -0.012em; max-width: 860px; }
.summary-text b { font-weight: 620; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 560; background: var(--ic-surface-3); color: var(--ic-text-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ic-accent-soft); color: var(--ic-accent); }
.pill.warn { background: var(--ic-warn-soft); color: var(--ic-warn); }
.pill.bad { background: var(--ic-danger-soft); color: var(--ic-danger); }
.pill.info { background: var(--ic-blue-soft); color: var(--ic-blue); }
.pill.live::before { animation: pulse 1.4s ease-in-out infinite; }

/* Tables */
.table-wrap { border: 1px solid var(--ic-border); border-radius: var(--ic-radius-lg); overflow-x: auto; background: var(--ic-surface); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--ic-text-sm); }
.table th { text-align: left; font-weight: 560; font-size: var(--ic-text-xs); color: var(--ic-text-3); padding: 10px 14px; border-bottom: 1px solid var(--ic-border); background: var(--ic-bg-raised); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--ic-border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--ic-fast); }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--ic-surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 540; max-width: 460px; }
.cell-sub { color: var(--ic-text-3); font-size: var(--ic-text-xs); max-width: 460px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--ic-border); margin-bottom: 20px; }
.tabs a { padding: 9px 12px; color: var(--ic-text-2); font-weight: 520; font-size: var(--ic-text-sm); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; display: inline-flex; gap: 7px; align-items: center; }
.tabs a:hover { color: var(--ic-text); }
.tabs a.active { color: var(--ic-text); border-bottom-color: var(--ic-accent); }
.tabs .count { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--ic-surface-3); color: var(--ic-text-2); }

/* Source cards */
.source { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; }
.source + .source { border-top: 1px solid var(--ic-border); }
.source-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--ic-surface-2); border: 1px solid var(--ic-border); color: var(--ic-text-2); }
.source-icon svg { width: 18px; height: 18px; }
.source-name { font-weight: 580; display: flex; align-items: center; gap: 8px; }
.source-meta { color: var(--ic-text-3); font-size: var(--ic-text-xs); margin-top: 2px; }
.source-actions { justify-content: flex-end; }
@media (max-width: 1180px) {
  .source { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .source-actions { grid-column: 2; justify-content: flex-start; }
}
.progress { height: 6px; border-radius: 99px; background: var(--ic-surface-3); overflow: hidden; margin-top: 10px; max-width: 420px; }
.progress span { display: block; height: 100%; background: var(--ic-accent); border-radius: inherit; transition: width 0.6s var(--ic-ease); }
.progress.indeterminate span { width: 35% !important; animation: slide 1.2s var(--ic-ease) infinite; }

/* Bars chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar span { width: 100%; min-height: 3px; border-radius: 6px 6px 3px 3px; background: var(--ic-accent); opacity: 0.85; transition: height 0.5s var(--ic-ease), opacity var(--ic-fast); }
.bar:hover span { opacity: 1; }
.bar small { font-size: 10px; color: var(--ic-text-3); }

/* Lists */
.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--ic-border); }
.list-item:first-child { border-top: 0; }
.gap-count { min-width: 34px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--ic-warn-soft); color: var(--ic-warn); font-weight: 640; font-size: var(--ic-text-sm); font-variant-numeric: tabular-nums; }

/* Empty states */
.empty { text-align: center; padding: 48px 24px; display: grid; justify-items: center; gap: 10px; }
.empty-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--ic-accent-soft); color: var(--ic-accent); }
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { font-size: 16px; font-weight: 620; letter-spacing: -0.015em; }
.empty p { color: var(--ic-text-2); max-width: 420px; font-size: var(--ic-text-sm); }
.empty .btn { margin-top: 6px; }

/* Onboarding */
.onboard { max-width: 760px; margin: 6vh auto 0; text-align: center; }
.onboard h1 { font-size: 38px; letter-spacing: -0.04em; line-height: 1.08; font-weight: 680; }
.onboard h1 em { font-style: normal; color: var(--ic-accent); }
.onboard > p { margin: 14px auto 0; color: var(--ic-text-2); font-size: 16.5px; max-width: 560px; }
.onboard form { margin: 28px auto 0; display: flex; gap: 8px; max-width: 560px; padding: 6px; border-radius: 16px; background: var(--ic-surface); border: 1px solid var(--ic-border-strong); }
.onboard form:focus-within { border-color: var(--ic-accent); box-shadow: 0 0 0 4px var(--ic-accent-soft); }
.onboard form input { flex: 1; border: 0; background: transparent; outline: 0; padding: 0 12px; font-size: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 40px; text-align: left; }
.step { padding: 16px; border-radius: 14px; border: 1px solid var(--ic-border); background: var(--ic-bg-raised); }
.step b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--ic-surface-3); font-size: 12px; margin-bottom: 10px; }
.step h3 { font-size: 14px; font-weight: 600; }
.step p { font-size: var(--ic-text-xs); color: var(--ic-text-3); margin-top: 3px; }

.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }
.phone {
  position: sticky; top: 24px; height: 640px; border-radius: 26px; border: 1px solid var(--ic-border-strong); background: var(--ic-bg-raised);
  overflow: hidden; display: flex; flex-direction: column;
}
.phone-bar { padding: 10px 16px; font-size: var(--ic-text-xs); color: var(--ic-text-3); border-bottom: 1px solid var(--ic-border); display: flex; align-items: center; gap: 8px; }
.phone-bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--ic-surface-3); display: inline-block; }
.phone-body { flex: 1; position: relative; overflow: hidden; }

/* Mini chat preview inside the console */
.mini { position: absolute; inset: 16px; display: flex; flex-direction: column; border-radius: calc(var(--r, 16px) + 4px); border: 1px solid var(--ic-border-strong); overflow: hidden; background: var(--ic-bg-raised); font-size: 13.5px; }
.mini-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--ic-surface); border-bottom: 1px solid var(--ic-border); }
.mini-avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 650; background: var(--pv-accent); color: var(--pv-on); }
.mini-body { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.mini-bubble { max-width: 88%; padding: 9px 12px; border-radius: var(--r, 16px); border-bottom-left-radius: 6px; background: var(--ic-surface-2); border: 1px solid var(--ic-border); }
.mini-bubble.user { align-self: flex-end; background: var(--pv-accent); color: var(--pv-on); border: 0; border-bottom-right-radius: 6px; border-bottom-left-radius: var(--r, 16px); }
.mini-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-chips span { padding: 6px 10px; border-radius: 99px; border: 1px solid var(--ic-border-strong); font-size: 12px; }
.mini-input { margin: 10px; padding: 10px 12px; border-radius: calc(var(--r, 16px) - 2px); border: 1px solid var(--ic-border-strong); color: var(--ic-text-3); display: flex; justify-content: space-between; align-items: center; }
.mini-input i { width: 28px; height: 28px; border-radius: 9px; background: var(--pv-accent); }
.mini-cite { display: inline-grid; place-items: center; min-width: 16px; height: 16px; border-radius: 5px; font-size: 10px; font-weight: 650; margin-left: 3px; vertical-align: 2px; background: color-mix(in srgb, var(--pv-accent) 18%, transparent); color: var(--pv-accent); }
.mini-launcher { position: absolute; right: 16px; bottom: 16px; height: 46px; padding: 0 18px; border-radius: 99px; display: flex; align-items: center; gap: 8px; font-weight: 600; background: var(--pv-accent); color: var(--pv-on); }

/* Test bench */
.bench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 16px; height: calc(100vh - 150px); min-height: 560px; }
.bench-chat, .bench-trace { display: flex; flex-direction: column; min-height: 0; }
.bench-chat .card-body, .bench-trace .card-body { flex: 1; overflow-y: auto; }
.chat-log { display: flex; flex-direction: column; gap: 14px; }
.cmsg { display: flex; flex-direction: column; gap: 6px; }
.cmsg.user { align-items: flex-end; }
.cmsg .bubble { max-width: 88%; padding: 10px 13px; border-radius: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.cmsg.user .bubble { background: var(--ic-accent); color: var(--ic-on-accent); border-bottom-right-radius: 5px; }
.cmsg.bot .bubble { background: var(--ic-surface-2); border: 1px solid var(--ic-border); border-bottom-left-radius: 5px; cursor: pointer; transition: border-color var(--ic-fast), box-shadow var(--ic-fast); }
.cmsg.bot .bubble:hover { border-color: var(--ic-border-strong); }
.cmsg.bot.selected .bubble { border-color: var(--ic-accent); box-shadow: 0 0 0 3px var(--ic-accent-soft); }
.cmsg .bubble p + p, .cmsg .bubble p + ul { margin-top: 8px; }
.cmsg .bubble ul { margin: 4px 0 0; padding-left: 18px; }
.cmsg .meta { display: flex; gap: 6px; align-items: center; font-size: var(--ic-text-xs); color: var(--ic-text-3); padding: 0 4px; flex-wrap: wrap; }
.cite { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: 3px; border-radius: 6px; vertical-align: 2px; font-size: 10.5px; font-weight: 650; background: var(--ic-accent-soft); color: var(--ic-accent); }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--ic-border); }
.composer .input { height: 40px; }
.typing { display: inline-flex; gap: 4px; align-items: center; color: var(--ic-text-2); font-size: var(--ic-text-sm); }
.typing::before { content: ""; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ic-accent-soft); border-top-color: var(--ic-accent); animation: spin 0.8s linear infinite; }

.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 18px; }
.pipe { padding: 10px; border-radius: 11px; background: var(--ic-surface-2); border: 1px solid var(--ic-border); }
.pipe small { display: block; font-size: 10.5px; color: var(--ic-text-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.pipe b { display: block; margin-top: 3px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pipe.ok { border-color: var(--ic-accent-ring); }
.pipe.skip { opacity: 0.45; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; font-size: var(--ic-text-sm); }
.kv dt { color: var(--ic-text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.trace-section { margin-top: 20px; }
.trace-section h3 { font-size: var(--ic-text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ic-text-3); font-weight: 620; margin-bottom: 10px; display: flex; justify-content: space-between; }
.passage { padding: 10px 12px; border-radius: 11px; border: 1px solid var(--ic-border); background: var(--ic-bg-raised); font-size: var(--ic-text-sm); }
.passage + .passage { margin-top: 6px; }
.passage-head { display: flex; gap: 8px; align-items: center; font-weight: 560; }
.passage p { margin-top: 4px; color: var(--ic-text-2); font-size: 12.5px; line-height: 1.5; }
.grade { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 700; flex: none; }
.grade.g3 { background: var(--ic-accent); color: var(--ic-on-accent); }
.grade.g2 { background: var(--ic-accent-soft); color: var(--ic-accent); }
.grade.g1, .grade.g0 { background: var(--ic-surface-3); color: var(--ic-text-3); }
.seg-v { padding: 8px 10px 8px 12px; border-radius: 10px; border-left: 3px solid var(--ic-border-strong); background: var(--ic-bg-raised); font-size: var(--ic-text-sm); }
.seg-v + .seg-v { margin-top: 6px; }
.seg-v.supported { border-left-color: var(--ic-accent); }
.seg-v.unsupported { border-left-color: var(--ic-danger); background: var(--ic-danger-soft); text-decoration: line-through; text-decoration-color: var(--ic-danger); }
.seg-v.not_factual { border-left-color: var(--ic-text-3); }
.seg-v small { display: block; text-decoration: none; color: var(--ic-text-3); margin-top: 3px; font-size: 11.5px; }

/* Drawer, modal, palette */
.overlay { position: fixed; inset: 0; background: var(--ic-overlay); z-index: 50; animation: fade var(--ic-base) var(--ic-ease); backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 92vw); z-index: 51; display: flex; flex-direction: column;
  background: var(--ic-bg-raised); border-left: 1px solid var(--ic-border-strong); animation: slidein 0.26s var(--ic-ease);
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--ic-border); }
.drawer-head h2 { font-size: 17px; font-weight: 640; letter-spacing: -0.02em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.modal {
  position: fixed; z-index: 51; top: 12vh; left: 50%; transform: translateX(-50%); width: min(560px, 92vw);
  background: var(--ic-bg-raised); border: 1px solid var(--ic-border-strong); border-radius: 18px; animation: popin 0.22s var(--ic-ease);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.6);
}
.modal-head { padding: 18px 22px 0; }
.modal-head h2 { font-size: 17px; font-weight: 640; letter-spacing: -0.02em; }
.modal-head p { margin-top: 4px; color: var(--ic-text-2); font-size: var(--ic-text-sm); }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--ic-border); }
.palette { top: 14vh; width: min(600px, 92vw); padding: 0; overflow: hidden; }
.palette input { width: 100%; height: 54px; border: 0; outline: 0; padding: 0 20px; font-size: 16px; background: transparent; border-bottom: 1px solid var(--ic-border); }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto; }
.palette li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: var(--ic-text-sm); color: var(--ic-text-2); }
.palette li svg { width: 16px; height: 16px; }
.palette li.active { background: var(--ic-surface-2); color: var(--ic-text); }
.palette li kbd { margin-left: auto; }
kbd { font-family: var(--ic-mono); font-size: 10.5px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--ic-border-strong); background: var(--ic-surface); color: var(--ic-text-3); }

.prose-preview { white-space: pre-wrap; font-size: 13px; line-height: 1.6; color: var(--ic-text-2); background: var(--ic-surface); border: 1px solid var(--ic-border); border-radius: 12px; padding: 14px 16px; max-height: 420px; overflow-y: auto; }
.chunk { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ic-border); background: var(--ic-surface); font-size: 13px; }
.chunk + .chunk { margin-top: 8px; }
.chunk-head { display: flex; gap: 8px; color: var(--ic-text-3); font-size: var(--ic-text-xs); margin-bottom: 6px; }
.chunk p { white-space: pre-wrap; color: var(--ic-text-2); line-height: 1.55; }

.dropzone { display: grid; place-items: center; gap: 8px; padding: 32px; border-radius: 14px; border: 1.5px dashed var(--ic-border-strong); text-align: center; color: var(--ic-text-2); cursor: pointer; transition: border-color var(--ic-fast), background var(--ic-fast); }
.dropzone.over, .dropzone:hover { border-color: var(--ic-accent); background: var(--ic-accent-soft); }
.dropzone svg { width: 26px; height: 26px; color: var(--ic-accent); }

.snippet { position: relative; font-family: var(--ic-mono); font-size: 12.5px; line-height: 1.6; padding: 16px 18px; border-radius: 12px; background: var(--ic-bg); border: 1px solid var(--ic-border-strong); overflow-x: auto; white-space: pre; color: var(--ic-text-2); }
.snippet.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.snippet .tag { color: var(--ic-blue); }
.snippet .attr { color: var(--ic-warn); }
.snippet .val { color: var(--ic-accent); }

.diff { display: grid; gap: 8px; }
.diff-row { display: grid; grid-template-columns: 160px 1fr 1fr; gap: 10px; font-size: var(--ic-text-sm); padding: 10px 12px; border-radius: 10px; background: var(--ic-surface); border: 1px solid var(--ic-border); }
.diff-row .old { color: var(--ic-danger); text-decoration: line-through; opacity: 0.8; overflow-wrap: anywhere; }
.diff-row .new { color: var(--ic-accent); overflow-wrap: anywhere; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, var(--ic-accent-soft), transparent 60%), var(--ic-bg); }
.auth-card { width: min(400px, 100%); padding: 32px; border-radius: 22px; background: var(--ic-surface); border: 1px solid var(--ic-border-strong); box-shadow: var(--ic-shadow); }
.auth-card .brand { padding: 0 0 22px; }
.auth-card h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; }
.auth-card > p { color: var(--ic-text-2); margin: 6px 0 22px; font-size: var(--ic-text-sm); }
.form-error { color: var(--ic-danger); font-size: var(--ic-text-sm); min-height: 20px; }

/* Site map review */
.drawer.wide { width: min(940px, 96vw); }
.drawer-head .source-icon { flex: none; }
.drawer-foot { display: flex; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--ic-border); background: var(--ic-bg-raised); flex-wrap: wrap; }
.linkish { border: 0; background: none; padding: 0; color: var(--ic-accent); font: inherit; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.linkish + .linkish { margin-left: 12px; }
.input.sm { height: 28px; padding: 0 8px; border-radius: 8px; font-size: var(--ic-text-xs); width: 76px; }
.seg.sm button { padding: 3px 9px; font-size: var(--ic-text-xs); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ic-text-3); flex: none; }
.dot.ok { background: var(--ic-accent); box-shadow: 0 0 0 3px var(--ic-accent-soft); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; font-size: var(--ic-text-sm); margin-bottom: 14px; border: 1px solid var(--ic-border); background: var(--ic-surface); }
.callout svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.callout.warn { background: var(--ic-warn-soft); border-color: transparent; }
.callout.warn svg { color: var(--ic-warn); }
.callout .btn { margin-left: auto; flex: none; }
.callout.ok { background: var(--ic-accent-soft); border-color: transparent; }
.callout.ok svg { color: var(--ic-accent); }

/* Install */
.guide { display: grid; gap: 10px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--ic-border); }
.seg.wrap { flex-wrap: wrap; }
.guide .seg { justify-self: start; }
.guide-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: var(--ic-text-sm); color: var(--ic-text-2); line-height: 1.55; }
.guide-steps li::marker { color: var(--ic-text-3); font-variant-numeric: tabular-nums; }
.guide-steps code { font-size: 12px; }
.install-seen { display: flex; align-items: center; gap: 10px; font-size: var(--ic-text-sm); }
.install-results { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--ic-border); border-radius: 12px; overflow: hidden; }
.install-results li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 14px; font-size: var(--ic-text-sm); }
.install-results li + li { border-top: 1px solid var(--ic-border); }
.install-note { grid-column: 1 / -1; }
.install-note:empty { display: none; }

/* Billing */
.billing-plan { display: grid; gap: 10px; }
.billing-plan h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; }
.billing-price { display: flex; align-items: baseline; gap: 6px; }
.billing-price strong { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.billing-price span { color: var(--ic-text-2); font-size: var(--ic-text-sm); }
.meter { display: grid; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; gap: 12px; font-size: var(--ic-text-sm); color: var(--ic-text-2); }
.meter-top strong { color: var(--ic-text); font-variant-numeric: tabular-nums; }
.meter .progress { margin: 0; max-width: none; }
.meter.warn .progress span { background: var(--ic-warn); }
.meter.bad .progress span { background: var(--ic-danger); }
.modal.wide-modal { width: min(640px, 94vw); }
.plan-pick { display: grid; gap: 8px; }
.plan-option { display: grid; gap: 3px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ic-border-strong); background: var(--ic-surface); color: var(--ic-text); cursor: pointer; font: inherit; transition: border-color var(--ic-fast), background var(--ic-fast); }
.plan-option:hover { border-color: var(--ic-text-3); }
.plan-option[aria-pressed="true"] { border-color: var(--ic-accent); background: var(--ic-accent-soft); box-shadow: 0 0 0 1px var(--ic-accent) inset; }
.plan-option-price { font-size: 18px; font-weight: 640; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-option-price small { font-size: 12.5px; font-weight: 500; color: var(--ic-text-2); letter-spacing: 0; }
.plan-banner { display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin: -8px 0 18px; border-radius: 12px; background: var(--ic-warn-soft); font-size: var(--ic-text-sm); }
.plan-banner svg { width: 17px; height: 17px; color: var(--ic-warn); flex: none; }
.plan-banner .btn { margin-left: auto; flex: none; }

.mapping { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 12vh 24px; }
.mapping h3 { font-size: 17px; font-weight: 640; letter-spacing: -0.02em; }
.mapping p { color: var(--ic-text-2); font-size: var(--ic-text-sm); max-width: 420px; }
.mapping-orb { position: relative; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--ic-accent-soft); color: var(--ic-accent); margin-bottom: 8px; }
.mapping-orb svg { width: 26px; height: 26px; }
.mapping-orb span { position: absolute; inset: -6px; border-radius: 24px; border: 1.5px solid var(--ic-accent-ring); animation: pulse 1.6s var(--ic-ease) infinite; }

.map-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ic-border); border-radius: 14px; background: var(--ic-surface); overflow: hidden; }
.map-summary > div { padding: 14px 18px; display: grid; gap: 2px; }
.map-summary > div + div { border-left: 1px solid var(--ic-border); }
.map-summary strong { font-size: 24px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.map-summary span { color: var(--ic-text-3); font-size: var(--ic-text-xs); }
.map-summary .accent { background: var(--ic-accent-soft); }
.map-summary .accent strong { color: var(--ic-accent); }
.map-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.map-tools .input { min-width: 220px; }
.map-group + .map-group { margin-top: 22px; }
.map-group-head { display: flex; align-items: baseline; gap: 10px; padding: 0 4px 8px; font-weight: 600; font-size: var(--ic-text-sm); }
.map-row { border: 1px solid var(--ic-border); border-radius: 12px; background: var(--ic-surface); transition: border-color var(--ic-fast), background var(--ic-fast); }
.map-row + .map-row { margin-top: 6px; }
.map-row.on { border-color: var(--ic-accent-ring); background: linear-gradient(90deg, var(--ic-accent-soft), transparent 55%), var(--ic-surface); }
.map-main { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; }
.map-main > input, .map-page > input { width: 16px; height: 16px; accent-color: var(--ic-accent); margin: 0; flex: none; cursor: pointer; }
.map-title { display: flex; align-items: center; gap: 8px; font-weight: 560; font-size: var(--ic-text-sm); min-width: 0; }
.map-sub { display: flex; gap: 6px; color: var(--ic-text-3); font-size: var(--ic-text-xs); margin-top: 2px; min-width: 0; }
.map-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-sub .mono { color: var(--ic-text-2); flex: none; }
.map-samples { color: var(--ic-text-3); font-size: var(--ic-text-xs); margin-top: 3px; }
.map-count { font-size: var(--ic-text-xs); color: var(--ic-text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.map-count b { color: var(--ic-accent); font-weight: 620; }
.map-expand svg { transition: transform var(--ic-base) var(--ic-ease); }
.map-expand[aria-expanded="true"] svg { transform: rotate(90deg); }
.map-expand-spacer { width: 28px; flex: none; }
.map-pages { border-top: 1px solid var(--ic-border); padding: 6px 10px 10px 14px; max-height: 360px; overflow-y: auto; }
.map-page { display: flex; align-items: center; gap: 12px; padding: 6px 4px; border-radius: 8px; font-size: var(--ic-text-sm); cursor: pointer; min-width: 0; }
.map-page:hover { background: var(--ic-surface-2); }
.map-path { max-width: 40%; }
.map-warn { color: var(--ic-warn); max-width: 280px; text-align: right; }
.map-settings { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mono { font-family: var(--ic-mono); font-size: 0.92em; }

.bulkbar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--ic-text); color: var(--ic-bg); box-shadow: 0 18px 40px -14px rgba(0,0,0,.55); animation: rise 0.2s var(--ic-ease); font-size: var(--ic-text-sm); font-weight: 540; }
.bulkbar .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--ic-bg) 25%, transparent); }
.bulkbar .btn.danger { background: var(--ic-danger); border-color: var(--ic-danger); color: #fff; }
.table td.pick, .table th.pick { width: 36px; padding-right: 0; }
.table .pick input { width: 15px; height: 15px; accent-color: var(--ic-accent); margin: 0; cursor: pointer; vertical-align: middle; }
.table tr.picked td { background: var(--ic-accent-soft); }
.steps-mini { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: s; }
.steps-mini li { display: grid; grid-template-columns: 26px 64px 1fr; align-items: baseline; gap: 8px; font-size: var(--ic-text-sm); counter-increment: s; }
.steps-mini li::before { content: counter(s); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ic-accent-soft); color: var(--ic-accent); font-size: 11.5px; font-weight: 650; align-self: center; }
.steps-mini b { font-weight: 600; }
.steps-mini span { color: var(--ic-text-2); }
.source-alert { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: var(--ic-text-xs); color: var(--ic-warn); }
.source-alert svg { width: 14px; height: 14px; }

/* Toasts */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: var(--ic-text); color: var(--ic-bg); font-weight: 520; font-size: var(--ic-text-sm); box-shadow: 0 16px 40px -12px rgba(0,0,0,.5); animation: popin 0.22s var(--ic-ease); }
.toast.error { background: var(--ic-danger); color: #fff; }

/* Skeletons */
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--ic-surface-2) 0%, var(--ic-surface-3) 50%, var(--ic-surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel.line { height: 12px; margin: 8px 0; }
.skel.block { height: 92px; }

.eval-filter { padding-top: 0; padding-bottom: 12px; }
.eval-filter .seg { width: 100%; }
.eval-filter .seg button { flex: 1; }
/* Gaps and conflicts */
.tabs .count.warn { background: var(--ic-warn-soft); color: var(--ic-warn); }
.gap-item { align-items: flex-start; }
.gap-item .gap-count { margin-top: 1px; }
.gap-item .btn { margin-top: 2px; }
.gap-item a { color: inherit; text-decoration: underline; text-decoration-color: var(--ic-border-strong, var(--ic-border)); text-underline-offset: 2px; }
.pill svg { width: 12px; height: 12px; }
.conflict { padding: 16px 20px; border-top: 1px solid var(--ic-border); display: grid; gap: 12px; }
.conflict:first-child { border-top: 0; }
.conflict-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conflict-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.conflict-side { padding: 12px 14px; border-radius: 12px; background: var(--ic-surface-2, var(--ic-surface)); border: 1px solid var(--ic-border); display: grid; gap: 6px; align-content: start; min-width: 0; }
.conflict-side q { font-size: var(--ic-text-sm); line-height: 1.5; quotes: "“" "”"; overflow-wrap: anywhere; }
.conflict-side a { color: inherit; }
.conflict-vs { align-self: center; font-size: 11px; font-weight: 640; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ic-text-3); }
.conflict-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conflict-pair.compact .conflict-side { padding: 10px 12px; }
@media (max-width: 720px) { .conflict-pair { grid-template-columns: 1fr; } .conflict-vs { justify-self: center; } }
.draft-wrap { position: relative; }
.draft-loading { position: absolute; inset: 1px; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: var(--ic-text-sm); color: var(--ic-text-2); background: color-mix(in srgb, var(--ic-surface) 82%, transparent); backdrop-filter: blur(2px); animation: fade 0.2s; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ic-border); border-top-color: var(--ic-accent); animation: spin 0.8s linear infinite; }
.hint.warn { color: var(--ic-warn); font-weight: 560; }
.draft-missing { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
@keyframes popin { from { opacity: 0; transform: translate(-50%, 8px) scale(0.98); } }
.toast { animation-name: toastin; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.fade-in { animation: rise 0.3s var(--ic-ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(n+4) { border-top: 1px solid var(--ic-border); }
  .split, .wizard, .bench { grid-template-columns: minmax(0, 1fr); }
  .bench { height: auto; }
  .bench-chat .card-body { min-height: 380px; max-height: 70vh; }
  .stat:nth-child(3n) { border-right: 0; }
  .phone { position: static; height: 560px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; }
  .nav-label, .side-foot, .kbd-hint { display: none; }
  .page { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .grid-2, .grid-3, .form-grid, .steps { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(n) { border-right: 1px solid var(--ic-border); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--ic-border); }
  .stat:last-child:nth-child(odd) { grid-column: span 2; border-right: 0; }
  .list-item { padding: 12px 16px; }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .map-summary strong { font-size: 19px; }
  .map-summary > div { padding: 12px; }
  .map-path, .map-samples { display: none; }
  .map-warn { text-align: left; max-width: none; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.drawer-head a svg, a.xs svg { width: 12px; height: 12px; vertical-align: -1px; margin-left: 3px; }

/* Leads */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.section-label { color: var(--ic-text-3); font-weight: 560; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; margin-bottom: 8px; }
.stat-value.lead-hot { color: var(--ic-danger); }
.stat-value.lead-warm { color: var(--ic-warn); }
.lead-status { align-self: flex-start; flex-wrap: wrap; }
.lead-score { display: grid; gap: 16px; padding: 18px; }
.lead-score-top { display: flex; gap: 14px; align-items: center; }
.lead-score-top p { margin-top: 2px; }
.lead-score-num { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; background: var(--ic-surface-2); color: var(--ic-text-2); box-shadow: inset 0 0 0 2px var(--ic-border-strong); }
.lead-score-num.hot { background: var(--ic-danger-soft); color: var(--ic-danger); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ic-danger) 45%, transparent); }
.lead-score-num.warm { background: var(--ic-warn-soft); color: var(--ic-warn); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ic-warn) 45%, transparent); }
.score-bar { display: grid; gap: 6px; align-content: start; }
.score-bar .progress { margin: 0; max-width: none; }
.criteria { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--ic-border); display: grid; gap: 10px; }
.criteria li { display: flex; gap: 10px; align-items: flex-start; }
.crit { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--ic-surface-2); color: var(--ic-text-3); }
.crit.ok { background: var(--ic-accent-soft); color: var(--ic-accent); }
.crit.bad { background: var(--ic-danger-soft); color: var(--ic-danger); }
.consent-text { margin-top: 4px; font-style: italic; }
.quote-block { padding: 10px 14px; border-left: 3px solid var(--ic-border-strong); background: var(--ic-surface-2); border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.mini-chat { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: var(--ic-surface-2); border: 1px solid var(--ic-border); }
.mini-msg { display: flex; }
.mini-msg span { max-width: 85%; padding: 7px 11px; border-radius: 12px; font-size: var(--ic-text-xs); line-height: 1.5; background: var(--ic-surface); border: 1px solid var(--ic-border); white-space: pre-wrap; }
.mini-msg.user { justify-content: flex-end; }
.mini-msg.user span { background: var(--ic-accent-soft); border-color: transparent; }

/* Behaviour: list editors */
.rows { display: grid; gap: 8px; margin-top: 4px; }
.edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto 28px; gap: 8px; align-items: center; animation: fade .2s ease both; }
.edit-row.crit-row { grid-template-columns: minmax(0, 1fr) 150px 28px; }
.edit-row .span-all { grid-column: 1 / -2; }
.check.sm { padding: 0 10px; height: 36px; font-size: var(--ic-text-xs); white-space: nowrap; }
.add-row { justify-self: start; color: var(--ic-text-2); }
.add-row svg { width: 13px; height: 13px; }
.page-prompt { display: grid; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--ic-border); background: var(--ic-surface-2); animation: fade .2s ease both; }
.page-empty { padding: 4px 0 6px; }
.card-head > .seg, .card-head > .btn { flex: none; }
[data-leads] { transition: opacity var(--ic-fast); }
[data-leads].is-off { opacity: .45; pointer-events: none; }
@media (max-width: 640px) { .edit-row { grid-template-columns: minmax(0, 1fr) 28px; } .edit-row > select, .edit-row > .check { grid-column: 1 / 2; } }

/* Assistant switcher */
.as-switch { position: relative; margin: 2px 0 10px; }
.as-current {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 10px; cursor: pointer;
  background: transparent; border: 1px dashed var(--ic-border-strong); color: var(--ic-text); font: inherit; font-size: var(--ic-text-sm); font-weight: 560; text-align: left;
  transition: background var(--ic-fast), border-color var(--ic-fast);
}
.as-current:hover, .as-current[aria-expanded="true"] { background: var(--ic-surface); border-style: solid; }
.as-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-count { font-size: 11px; color: var(--ic-text-3); font-variant-numeric: tabular-nums; }
.as-chev { width: 14px; height: 14px; color: var(--ic-text-3); flex: none; }
.as-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 22%, transparent); }
.as-menu {
  position: absolute; z-index: 40; left: 0; right: -24px; top: calc(100% + 6px); padding: 6px; border-radius: 12px;
  background: var(--ic-surface); border: 1px solid var(--ic-border); box-shadow: 0 12px 32px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.12);
  animation: rise .16s var(--ic-ease) both;
}
.as-menu-label { display: flex; justify-content: space-between; padding: 6px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ic-text-3); }
.as-menu-label span { text-transform: none; letter-spacing: 0; font-weight: 520; }
.as-item, .as-action {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--ic-text);
  font: inherit; font-size: var(--ic-text-sm); text-align: left; cursor: pointer;
}
.as-item:hover, .as-action:hover, .as-item:focus-visible, .as-action:focus-visible { background: var(--ic-surface-2); outline: none; }
.as-item-text { flex: 1; min-width: 0; display: grid; }
.as-item-text b { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-item-text span { font-size: var(--ic-text-xs); color: var(--ic-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-item svg { width: 15px; height: 15px; color: var(--ic-accent); flex: none; }
.as-action { color: var(--ic-text-2); }
.as-action span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-action svg { width: 15px; height: 15px; flex: none; }
.as-action.danger:hover { color: var(--ic-danger); }
.as-sep { height: 1px; margin: 6px 4px; background: var(--ic-border); }

.choice-cards { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--ic-border); cursor: pointer; transition: border-color var(--ic-fast), background var(--ic-fast); }
.choice:has(input:checked) { border-color: var(--ic-accent-ring); background: var(--ic-accent-soft); }
.choice input { margin: 3px 0 0; accent-color: var(--ic-accent); }
.choice > span { display: grid; gap: 2px; font-size: var(--ic-text-sm); }
.choice > span span { font-size: var(--ic-text-xs); color: var(--ic-text-2); }
.modal-body .form-error:empty { display: none; }
.as-tag { display: inline-flex; align-items: center; gap: 7px; vertical-align: middle; margin-left: 8px; padding: 3px 10px 3px 9px; border-radius: 99px; border: 1px solid var(--ic-border); background: var(--ic-surface); font-size: var(--ic-text-xs); font-weight: 560; letter-spacing: 0; color: var(--ic-text-2); }
.as-tag .as-dot { width: 7px; height: 7px; box-shadow: none; }
