@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

/* Veliform Voice console. */
:root {
  color-scheme: light;
  --primary: oklch(0.52 0.22 275);
  --primary-fg: oklch(0.985 0 0);
  --voice: oklch(0.72 0.17 55);
  --ink: oklch(0.2 0.02 265);
  --muted: oklch(0.52 0.02 265);
  --line: oklch(0.91 0.008 260);
  --line-strong: oklch(0.86 0.01 260);
  --page: oklch(0.985 0.004 260);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.955 0.008 260);
  --hover: color-mix(in oklch, var(--ink) 4%, transparent);
  --accent-soft: color-mix(in oklch, var(--primary) 10%, transparent);
  --success: oklch(0.62 0.16 150);
  --success-soft: color-mix(in oklch, var(--success) 14%, transparent);
  --warn: oklch(0.5 0.13 75);
  --warn-soft: color-mix(in oklch, oklch(0.75 0.16 75) 16%, transparent);
  --danger: oklch(0.58 0.22 25);
  --danger-soft: color-mix(in oklch, var(--danger) 12%, transparent);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 0 0 1px var(--line), 0 1px 2px oklch(0 0 0 / 4%);
  --shadow-pop: 0 18px 50px oklch(0.2 0.02 265 / 0.18), 0 2px 8px oklch(0.2 0.02 265 / 0.06);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --side: 240px;
  --dock: 340px;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --primary: oklch(0.7 0.18 278);
  --primary-fg: oklch(0.14 0.03 275);
  --ink: oklch(0.94 0.008 260);
  --muted: oklch(0.66 0.02 262);
  --line: oklch(1 0 0 / 8%);
  --line-strong: oklch(1 0 0 / 14%);
  --page: oklch(0.15 0.015 265);
  --surface: oklch(0.19 0.016 265);
  --surface-2: oklch(0.24 0.016 265);
  --hover: oklch(1 0 0 / 4%);
  --accent-soft: color-mix(in oklch, var(--primary) 16%, transparent);
  --success: oklch(0.72 0.16 150);
  --warn: oklch(0.85 0.14 80);
  --danger: oklch(0.68 0.19 24);
  --shadow: 0 0 0 1px var(--line);
  --shadow-pop: 0 18px 50px oklch(0 0 0 / 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--page); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.velihub-pick { max-width: 11rem; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.right { text-align: right; }
.mono { font-family: var(--mono); font-size: 12.5px; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

.console { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 14px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.side-bar { display: flex; align-items: center; gap: 8px; }
.side-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: auto; }
.nav-toggle { display: none; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px; flex: 1; min-width: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary); color: var(--primary-fg); }
.brand-mark svg { width: 18px; height: 18px; }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.side-brand-text small { color: var(--muted); font-size: 11px; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 500; }
.side-link[hidden] { display: none !important; }
.side-link .ico { font-style: normal; width: 18px; text-align: center; color: var(--muted); }
.side-link:hover { background: var(--hover); }
.side-link.active { background: var(--accent-soft); color: var(--primary); }
.side-link.active .ico { color: var(--primary); }
.side-link.subtle { color: var(--muted); font-weight: 450; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.theme-toggle { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.theme-toggle svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-account { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; border-top: 1px solid var(--line); margin-top: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.side-account-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; flex: 1; }
.side-account-text strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account-text small { color: var(--muted); font-size: 11px; }

.main { min-width: 0; }
.view { padding: 28px 32px 48px; max-width: 1240px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.view-actions { display: flex; gap: 8px; align-items: center; }
.search input { width: 240px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn:disabled, .btn.is-disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-fg); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); background: var(--primary); }
.btn.danger { background: var(--danger); color: white; border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--hover); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); font-size: 16px; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pill-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 500; }
.pill-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--accent-soft); }
.pill-btn.outline { border-style: dashed; color: var(--muted); }
.pill-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.table-card { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--hover); }
.agent-cell { display: flex; align-items: center; gap: 12px; }
.agent-cell .avatar { background: var(--accent-soft); color: var(--primary); }
.agent-cell strong { display: block; font-weight: 600; }
.agent-cell small { color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { background: var(--success-soft); color: var(--success); }
.pill.draft { background: var(--warn-soft); color: var(--warn); }
.pill.archived { opacity: 0.7; }
.pill.importing { background: var(--accent-soft); color: var(--primary); }
.menu-wrap { position: relative; display: inline-block; }
/* Fixed and portaled to body: the table card clips overflow, so a menu on the last row was hiding Archive. */
.menu { position: fixed; min-width: 220px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: 6px; z-index: 40; display: flex; flex-direction: column; }
.menu button { text-align: left; padding: 8px 10px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.empty { padding: 48px 24px; text-align: center; }

/* Studio */
.studio { max-width: none; padding: 0; }
.studio-head { display: flex; align-items: center; gap: 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.back { color: var(--muted); font-weight: 500; }
.studio-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.title-input { font-size: 17px; font-weight: 650; border: 1px solid transparent; background: transparent; padding: 4px 8px; border-radius: 8px; min-width: 120px; max-width: 420px; width: 100%; }
.title-input:hover, .title-input:focus { border-color: var(--line-strong); background: var(--surface); outline: none; }
.studio-body { display: grid; grid-template-columns: 220px minmax(0, 1fr) var(--dock); min-height: calc(100vh - 61px); }
.tabs { display: flex; flex-direction: column; gap: 2px; padding: 18px 12px; border-right: 1px solid var(--line); }
.tabs a { padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; color: var(--muted); }
.tabs a:hover { background: var(--hover); color: var(--ink); }
.tabs a.active { background: var(--accent-soft); color: var(--primary); }
.panel { padding: 24px 28px 60px; min-width: 0; }
.panel h2 { margin-bottom: 4px; }
.panel .lead { color: var(--muted); margin-bottom: 20px; }
.section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field input, .field textarea, .field select { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); width: 100%; }
.field textarea { resize: vertical; min-height: 72px; }
.field.small input { padding: 6px 9px; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.switch:first-of-type { border-top: 0; }
.switch strong { display: block; font-weight: 600; }
.switch small { color: var(--muted); }
.toggle { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); border: 0; cursor: pointer; flex: none; transition: background 0.15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: left 0.15s; box-shadow: 0 1px 2px oklch(0 0 0 / 0.25); }
.toggle[aria-checked="true"] { background: var(--primary); }
.toggle[aria-checked="true"]::after { left: 19px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.cap { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.cap input { margin-top: 3px; }
.cap strong { display: block; font-weight: 600; font-size: 13px; }
.cap small { color: var(--muted); font-size: 12px; }
.cap.on { border-color: var(--primary); background: var(--accent-soft); }
.tool-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chip { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); }
.tool-chip.custom { background: var(--accent-soft); color: var(--primary); }
.action-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.action-card header { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 6px; }
.action-card .method { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); margin-right: 6px; }
.params-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.params-table td { padding: 4px 4px 4px 0; }
.params-table input, .params-table select { padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 7px; width: 100%; background: var(--surface); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row strong { font-weight: 600; }
.list-row small { color: var(--muted); display: block; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
pre.snippet { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-sm); margin: 8px 0; }
.flow { position: relative; overflow: auto; background: var(--surface-2); border-radius: var(--radius); padding: 24px; }
.flow-inner { position: relative; }
.flow svg { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.flow-node { position: absolute; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 12.5px; overflow: hidden; }
.flow-node strong { display: block; font-size: 13px; margin-bottom: 2px; }
.flow-node .detail { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.flow-node.start, .flow-node.end { border-left: 3px solid var(--voice); }
.flow-node.transfer { border-left: 3px solid var(--warn); }
.flow-node.agent, .flow-node.branch { border-left: 3px solid var(--primary); }
.flow-node .when { font-size: 11px; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.error { color: var(--danger); font-size: 13px; }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 13px; margin-bottom: 12px; }
.notice.info { background: var(--accent-soft); color: var(--primary); }
.notice.ok { background: var(--success-soft); color: var(--success); }

/* Dock */
.dock { border-left: 1px solid var(--line); padding: 18px 16px; background: var(--surface); position: sticky; top: 61px; height: calc(100vh - 61px); display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.dock-head { display: flex; align-items: center; gap: 10px; }
.office-scene { position: relative; flex: 0 0 auto; isolation: isolate; aspect-ratio: 6 / 5; overflow: hidden; border-radius: 14px; background: #d9e0d8; color: #273e37; }
.office-poster, .office-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.office-video { position: absolute; inset: 0; }
.office-video[hidden] { display: none; }
.office-scene-top, .office-scene-foot { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 12px; z-index: 1; }
.office-scene-top { top: 0; }
.office-eyebrow { font-size: 9px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.office-motion { border: 1px solid #273e3726; border-radius: 20px; padding: 4px 7px; background: #f6f5edeb; color: #273e37; cursor: pointer; font-size: 9px; }
.office-motion:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.office-scene-foot { bottom: 0; align-items: flex-end; background: linear-gradient(transparent, #20372b80); color: white; padding-top: 24px; }
.office-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; }
.office-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #c5e7c3; }
.office-scene[data-state="joining"] .office-state::before { background: #f4d496; }
.office-scene[data-state="error"] .office-state::before { background: #f2b4a7; }
.office-caption { font-size: 8px; opacity: .85; }
.voice-welcome { margin: 0 0 26px; }
.voice-welcome > p { margin: 6px 0 16px; max-width: 680px; }
.voice-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.voice-card { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.voice-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.voice-card-scene { aspect-ratio: 3 / 4; border-radius: 0; }
.voice-card-copy { padding: 12px; display: flex; flex: 1; flex-direction: column; gap: 8px; }
.voice-card-copy strong { font-size: 16px; }
.voice-card-copy p { min-height: 32px; }
.voice-card-copy .btn { margin-top: auto; font-size: 12px; padding: 8px; }
.voice-pending { font-size: 11px; color: var(--muted); }
.office-scene[data-person] { aspect-ratio: 3 / 4; }
.office-scene[data-person] .office-poster, .office-scene[data-person] .office-video { object-position: center 20%; }
@media (max-width: 600px) {
  .voice-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .voice-card-copy { padding: 9px; gap: 6px; }
  .voice-card-copy strong { font-size: 14px; }
  .voice-card-copy p { font-size: 11px; }
  .voice-card-copy .btn { min-height: 42px; font-size: 11px; }
  .voice-card-scene .office-scene-top, .voice-card-scene .office-scene-foot { padding: 6px; }
  .voice-card-scene .office-motion { font-size: 8px; }
  .voice-card-scene .office-state { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) { .office-scene { scroll-behavior: auto; } }
.dock-head strong { display: block; }
.dock-avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--voice)); color: white; font-weight: 700; }
.dock-status { font-size: 13px; color: var(--muted); min-height: 36px; }
.dock-actions { display: flex; gap: 8px; }
.dock-log { flex: 1; min-height: 160px; margin: 0; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; overflow: auto; }
.dock-prompt summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.dock-prompt pre { font-family: var(--mono); font-size: 11px; white-space: pre-wrap; max-height: 260px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 8px; }

/* Modals */
.modal { position: fixed; inset: 0; background: oklch(0.15 0.02 265 / 0.45); display: grid; place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(2px); }
.modal-card { width: min(720px, 100%); max-height: calc(100vh - 40px); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.modal-card.narrow { width: min(420px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-head-actions { display: flex; gap: 4px; align-items: center; }
.chat { flex: 1; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 260px; max-height: 50vh; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; }
.bubble.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.bubble.user { align-self: flex-end; background: var(--primary); color: var(--primary-fg); border-bottom-right-radius: 6px; }
.bubble.pending { color: var(--muted); font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 10px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 13px; }
.chip:hover, .chip.on { border-color: var(--primary); color: var(--primary); background: var(--accent-soft); }
.composer { display: flex; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); max-height: 160px; }
.modal-foot { padding: 12px 20px 18px; display: flex; justify-content: flex-end; border-top: 1px solid var(--line); }
.signin-body { padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0; }
#google-btn { display: flex; justify-content: center; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); z-index: 60; font-size: 13px; }
.toast.err { background: var(--danger); color: white; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .studio-body { grid-template-columns: 200px minmax(0, 1fr); }
  .dock { grid-column: 1 / -1; position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .console { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 30; height: auto; max-height: 100vh; overflow: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-brand { padding: 4px; }
  .nav-toggle { display: inline-flex; align-items: center; gap: 8px; flex: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); padding: 8px 12px; font-weight: 600; cursor: pointer; }
  .nav-toggle-bars { width: 16px; height: 12px; background: linear-gradient(currentColor, currentColor) 0 0 / 100% 2px, linear-gradient(currentColor, currentColor) 0 50% / 100% 2px, linear-gradient(currentColor, currentColor) 0 100% / 100% 2px; background-repeat: no-repeat; }
  .side-panel { display: none; flex: none; min-height: 0; margin-top: 8px; }
  .side.is-open .side-panel { display: flex; }
  .view { padding: 20px 16px 40px; }
  .view-head { flex-direction: column; align-items: stretch; }
  .view-head h1 { font-size: 22px; }
  .view-actions { flex-wrap: wrap; width: 100%; }
  .search { flex: 1 1 100%; }
  .search input, .catalog-search { width: 100%; }
  .agent-limit { white-space: normal; }
  .table-card { overflow-x: auto; }
  .table { min-width: 640px; }
  .studio-head { top: 57px; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .studio-head .view-actions { width: 100%; justify-content: flex-start; }
  .studio-body { grid-template-columns: 1fr; }
  .tabs { flex-direction: row; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .tabs a { white-space: nowrap; }
  .panel { padding: 16px 16px 48px; }
  .grid2, .kv { grid-template-columns: 1fr; }
  .composer { flex-wrap: wrap; }
  .composer textarea { flex: 1 1 100%; min-width: 0; }
  .source-head, .sheet-head, .sheet-head-side { flex-wrap: wrap; }
  .sheet-head-side { white-space: normal; }
}

/* Knowledge & Catalog: one block per source the agent knows. */
.source { padding: 16px 18px; }
.source-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.source-head + * { margin-top: 14px; }
.source-title { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.source-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--primary); font-size: 15px; }
.source-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.source-name h3 { margin: 0; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-chip.ready { background: var(--success-soft); color: var(--success); }
.status-chip.review { background: var(--warn-soft); color: var(--warn); }
.status-chip.processing { background: var(--accent-soft); color: var(--primary); }
.status-chip.failed { background: var(--danger-soft); color: var(--danger); }
.empty-source { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--page); }
.url-row { display: flex; gap: 8px; }
.url-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.fact-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin-top: 12px; }
.fact { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.fact strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact small { color: var(--muted); font-size: 11.5px; }
.fact:hover { border-color: var(--primary); }
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-chips:empty { display: none; }
.topic-chip { padding: 3px 9px; border-radius: 999px; background: var(--surface-2); font-size: 12px; color: var(--muted); }

/* Read-only catalog preview, grouped by category. */
.catalog-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.catalog-search { width: 240px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; }
.catalog-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.catalog-table { width: 100%; border-collapse: collapse; }
.catalog-table td { padding: 8px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.catalog-table tr:first-child td { border-top: 0; }
.catalog-table strong { font-weight: 550; display: block; }
.catalog-table small { color: var(--muted); display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.catalog-table td.price { text-align: right; white-space: nowrap; width: 110px; font-variant-numeric: tabular-nums; font-weight: 550; }
.catalog-table td.price .cur { color: var(--muted); font-weight: 400; margin-left: 4px; font-size: 11px; }
.catalog-table tr.catalog-group td { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 12px; }
.catalog-table td.catalog-empty { text-align: center; padding: 20px; }

/* Files the owner uploaded. */
.file-list { display: flex; flex-direction: column; margin-bottom: 12px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.file-icon { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 14px; }
.file-main { flex: 1; min-width: 0; }
.file-main strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-main small { color: var(--muted); display: block; font-size: 12px; }
.file-row.failed .file-main small { color: var(--danger); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 20px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--page); cursor: pointer; text-align: center; transition: border-color 0.15s, background 0.15s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--primary); background: var(--accent-soft); outline: none; }
.dropzone.over { border-color: var(--primary); background: var(--accent-soft); border-style: solid; }
.dropzone.pending { cursor: default; flex-direction: row; justify-content: space-between; text-align: left; gap: 12px; border-style: solid; background: var(--surface); flex-wrap: wrap; }
.pending-file { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1 1 100%; }
.pending-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-type { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex: 1; }
.pending-type select { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-size: 13px; flex: 1; min-width: 0; }

/* Editors share one modal chrome: header, optional example banner, body, footer. */
.example-banner { padding: 9px 18px; background: var(--warn-soft); color: var(--warn); font-size: 13px; border-bottom: 1px solid var(--line); }
.example-banner strong { margin-right: 2px; }
.link-btn { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.unsaved { font-size: 12px; color: var(--warn); font-weight: 500; }
.unsaved::before { content: "•"; margin-right: 4px; }
.modal-card.note-card { width: min(760px, 100%); }
.note-body { padding: 0; min-height: 0; display: flex; }
.note-body textarea { flex: 1; width: 100%; min-height: min(62vh, 620px); border: 0; resize: none; padding: 18px 20px; font: inherit; font-size: 14.5px; line-height: 1.6; background: var(--surface); outline: none; }
.confirm-card { padding: 20px; gap: 10px; }
.confirm-card h3 { margin: 0; font-size: 16px; }
.view-actions.end { justify-content: flex-end; margin-top: 6px; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-action { border: 0; background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 0; }

/* Price sheet: an editable table instead of raw CSV, in a wide modal. */
.modal-card.sheet-card { width: min(1040px, 100%); }
.sheet { background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.sheet-head strong { display: block; font-weight: 650; font-size: 16px; margin-bottom: 2px; }
.sheet-head-side { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.sheet-filter { width: 170px; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-size: 12.5px; }
.sheet-hints { display: inline-flex; align-items: center; gap: 6px; }
.sheet-hints kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); }
.sheet-hints .dot::before { content: "·"; margin: 0 2px; }
.sheet-scroll { overflow: auto; max-height: min(60vh, 640px); min-height: 180px; }
.sheet table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 620px; table-layout: fixed; }
.sheet th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.sheet th:last-child, .sheet td:last-child { border-right: 0; }
.sheet td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: middle; background: var(--surface); }
.sheet tbody tr:last-child td { border-bottom: 0; }
.sheet .idx { width: 36px; text-align: center; color: var(--muted); font-size: 12px; font-family: var(--mono); background: var(--surface-2); }
.sheet th.idx { background: var(--surface-2); }
.sheet .price { width: 104px; }
.sheet .category { width: 150px; }
.sheet .remove { width: 38px; text-align: center; }
.sheet td input { width: 100%; border: 0; background: transparent; padding: 8px 10px; font: inherit; color: inherit; outline: none; border-radius: 0; }
.sheet td input::placeholder { color: var(--muted); opacity: 0.7; }
.sheet td input:focus { box-shadow: inset 0 0 0 2px var(--primary); background: var(--accent-soft); position: relative; z-index: 1; }
.sheet td.price input { text-align: right; font-family: var(--mono); font-size: 13px; }
.sheet tr.invalid td { background: var(--danger-soft); }
.sheet tr.invalid td.idx { color: var(--danger); font-weight: 600; }
.sheet .remove .icon-btn { width: 26px; height: 26px; font-size: 15px; line-height: 1; }
.sheet-tools { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sheet-status { font-size: 12.5px; color: var(--muted); }
.sheet-status.warn { color: var(--danger); font-weight: 500; }
.agent-limit { font-size: 13px; white-space: nowrap; }
.agent-limit.full { color: var(--danger, #c0392b); font-weight: 600; }
.pill-btn:disabled, .pill-btn.is-disabled { opacity: .5; cursor: not-allowed; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg-btn { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; }
.seg-btn.on { background: var(--accent-soft); color: var(--primary); font-weight: 600; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.kpi b { font-size: 22px; letter-spacing: -0.02em; }
.delta { font-size: 12px; color: var(--muted); min-height: 16px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.chart-card { padding: 16px; margin-bottom: 14px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: 12px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.bar-stack { width: 100%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.bar { display: block; width: 100%; min-height: 0; }
.bar.order { background: var(--primary); }
.bar.booking { background: var(--success); }
.bar.lead, .bar.waitlist { background: var(--warn); }
.bar.handoff, .bar.failed, .bar.abandoned { background: var(--danger); }
.bar.info { background: var(--line-strong); }
.heat { display: grid; grid-template-columns: 32px repeat(24, 1fr); gap: 2px; margin-top: 12px; align-items: center; }
.heat i { display: block; height: 12px; border-radius: 2px; background: var(--primary); }
.results-split { display: grid; grid-template-columns: 280px 1fr; gap: 12px; }
.chip-outcome { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; background: var(--surface-2); margin-right: 4px; }
.chip-outcome.order, .chip-outcome.confirmed, .chip-outcome.fulfilled { background: var(--accent-soft); color: var(--primary); }
.chip-outcome.booking, .chip-outcome.seated { background: var(--success-soft); color: var(--success); }
.chip-outcome.handoff, .chip-outcome.failed, .chip-outcome.cancelled, .chip-outcome.no_show { background: var(--danger-soft); color: var(--danger); }
.drawer-back { position: fixed; inset: 0; background: oklch(0 0 0 / 0.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(440px, 100%); background: var(--surface); z-index: 41; overflow: auto; padding: 20px; box-shadow: var(--shadow-pop); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
@media (max-width: 820px) {
  .results-split { grid-template-columns: 1fr; }
}

.phone-onboarding.compact h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}
.phone-onboarding .switch {
  margin-top: 8px;
}
