/* ================================================================ Geeni design tokens */
:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --surface-3: #e7eaf2;
  --border: #e2e5ee;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8590a3;
  --primary: #5b4cf0;
  --primary-hover: #4a3bd9;
  --primary-soft: #eeecff;
  --primary-text: #ffffff;
  --success: #138a4b; --success-soft: #e3f6ec;
  --warning: #b86e00; --warning-soft: #fff3dc;
  --danger: #d12f2f;  --danger-soft: #fde8e8;
  --info: #1f6fc5;    --info-soft: #e5f0fc;
  --sidebar: #0f1222;
  --sidebar-2: #1a1e33;
  --sidebar-text: #aab2c8;
  --sidebar-active: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 18px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  /* chart palette (validated categorical order, light) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --chart-grid: #e6e8ee; --chart-text: #52514e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --_auto-dark: 1; }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f1a;
  --surface: #151827;
  --surface-2: #1c2033;
  --surface-3: #262b42;
  --border: #2a2f47;
  --text: #e8ebf5;
  --text-2: #b4bbd0;
  --muted: #7d859e;
  --primary: #7b6dff;
  --primary-hover: #8f83ff;
  --primary-soft: #26234a;
  --success: #3ccf7f; --success-soft: #133325;
  --warning: #f0a93a; --warning-soft: #3a2a10;
  --danger: #ff6b6b;  --danger-soft: #3d1a1d;
  --info: #5aa7ff;    --info-soft: #14284a;
  --sidebar: #090b14;
  --sidebar-2: #151827;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 18px rgba(0, 0, 0, .25);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --chart-grid: #2a2f47; --chart-text: #c3c2b7;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ================================================================ layout */
.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: #fff; font-weight: 700; font-size: 17px; }
.brand-logo { width: 32px; height: 32px; border-radius: 10px; background: conic-gradient(from 210deg, #5b4cf0, #2a78d6, #1baf7a, #e87ba4, #5b4cf0); display: grid; place-items: center; font-size: 16px; box-shadow: 0 0 18px rgba(91, 76, 240, .55); }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-text); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5f6783; padding: 14px 10px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; }
.nav-link:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, rgba(91, 76, 240, .35), rgba(91, 76, 240, .08)); color: var(--sidebar-active); }
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--sidebar-2); }
.ai-status { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.on { background: #3ccf7f; box-shadow: 0 0 8px #3ccf7f; } .dot.off { background: #ff6b6b; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { height: 58px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .title { font-weight: 650; font-size: 16px; }
.topbar .spacer { flex: 1; }
.content { flex: 1; overflow-y: auto; padding: 24px; }
.content.flush { padding: 0; overflow: hidden; display: flex; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ================================================================ components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn svg { width: 16px; height: 16px; }

.input, .select, .textarea { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; outline: none; transition: border-color .12s, box-shadow .12s; }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: 13px; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.bot { background: conic-gradient(from 210deg, #5b4cf0, #2a78d6, #1baf7a, #e87ba4, #5b4cf0); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; color: var(--text-2); font: inherit; font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--surface-2); font-weight: 600; color: var(--text-2); position: sticky; top: 0; z-index: 1; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 6px; }

/* stat tiles */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--text-2); font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--muted); }

/* list items */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.list-item { color: inherit; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; border-radius: 6px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 10, 20, .5); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; animation: pop .15s; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* toast */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); box-shadow: var(--shadow-lg); padding: 10px 14px; border-radius: 10px; min-width: 240px; max-width: 380px; animation: pop .15s; }
.toast.error { border-left-color: var(--danger); } .toast.success { border-left-color: var(--success); }

/* dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px; z-index: 80; padding: 6px; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.notif-panel { width: 360px; max-height: 440px; overflow-y: auto; }
.notif { padding: 10px; border-radius: 8px; font-size: 13px; display: block; color: var(--text); }
.notif.unread { background: var(--primary-soft); }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.count-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

/* ================================================================ auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(circle at 30% 30%, #3a2fb8 0, #0f1222 60%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.auth-hero h1 { font-size: 40px; }
.auth-hero p { color: #c7cbe0; font-size: 16px; max-width: 480px; }
.auth-hero ul { color: #c7cbe0; padding-left: 18px; }
.auth-form { display: grid; place-items: center; padding: 32px 16px; background: var(--bg); }
.auth-card { width: min(400px, 100%); }
.error-box { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ================================================================ kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; height: 100%; min-height: 0; overflow-x: auto; padding-bottom: 6px; }
.column { background: var(--surface-2); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); }
.column-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; font-weight: 650; }
.column-body { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; transition: background .12s; border-radius: 0 0 var(--radius) var(--radius); }
.column-body.drag-over { background: var(--primary-soft); }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); transition: box-shadow .12s, transform .12s; }
.task-card:hover { box-shadow: var(--shadow); }
.task-card.dragging { opacity: .45; transform: rotate(1deg); }
.task-card .t-title { font-weight: 550; margin: 4px 0 8px; word-break: break-word; }
.task-card .t-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.prio { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.prio.low { background: #8590a3; } .prio.medium { background: var(--info); } .prio.high { background: var(--warning); } .prio.urgent { background: var(--danger); }
.type-ico { font-size: 12px; }
.board-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.board-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.project-card { display: flex; flex-direction: column; gap: 10px; color: inherit; }
.project-card:hover { text-decoration: none; border-color: var(--primary); }
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.project-key { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; }

/* ================================================================ docs */
.docs-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); width: 100%; height: 100%; }
.docs-tree { border-right: 1px solid var(--border); background: var(--surface); padding: 14px 10px; overflow-y: auto; }
.tree-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; color: var(--text); cursor: pointer; font-size: 13.5px; }
.tree-item:hover { background: var(--surface-2); }
.tree-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tree-children { margin-left: 14px; border-left: 1px solid var(--border); padding-left: 4px; }
.tree-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item .add { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 16px; }
.tree-item:hover .add { opacity: 1; }
.doc-pane { overflow-y: auto; padding: 32px clamp(16px, 5vw, 72px); }
.doc-title { font-size: 34px; font-weight: 750; border: 0; outline: 0; background: transparent; color: var(--text); width: 100%; font-family: inherit; letter-spacing: -.02em; }
.doc-icon { font-size: 40px; background: none; border: 0; cursor: pointer; padding: 0; }
.doc-editor { width: 100%; min-height: 60vh; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: 15px/1.7 var(--mono); }
.markdown { font-size: 15px; line-height: 1.7; max-width: 860px; word-wrap: break-word; }
.markdown h1 { font-size: 26px; margin-top: 1.2em; } .markdown h2 { font-size: 21px; margin-top: 1.2em; } .markdown h3 { font-size: 17px; margin-top: 1em; }
.markdown pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.markdown code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { border-left: 3px solid var(--primary); margin: 0; padding: 4px 14px; color: var(--text-2); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.markdown table { border-collapse: collapse; margin: 10px 0; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 6px 10px; }
.markdown th { background: var(--surface-2); }
.markdown img { max-width: 100%; }
.markdown p:first-child { margin-top: 0; } .markdown p:last-child { margin-bottom: 0; }
.markdown ul, .markdown ol { padding-left: 22px; }
.save-state { font-size: 12px; color: var(--muted); }

/* ================================================================ chat */
.chat-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); width: 100%; height: 100%; }
.channel-list { border-right: 1px solid var(--border); background: var(--surface); padding: 14px 10px; overflow-y: auto; }
.channel { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 6px; color: var(--text-2); font-weight: 500; }
.channel:hover { background: var(--surface-2); text-decoration: none; }
.channel.active { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 10px; }
.messages { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.msg { display: flex; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.msg:hover { background: var(--surface-2); }
.msg .body { min-width: 0; flex: 1; }
.msg .who { font-weight: 650; }
.msg .when { color: var(--muted); font-size: 11px; margin-left: 6px; font-weight: 400; }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg.compact .avatar { visibility: hidden; height: 0; }
.msg.bot .body { background: linear-gradient(90deg, var(--primary-soft), transparent); border-radius: 8px; padding: 4px 8px; }
.composer { padding: 12px 20px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.composer-box { display: flex; gap: 8px; align-items: flex-end; border: 1px solid var(--border); border-radius: 12px; padding: 6px 6px 6px 12px; background: var(--surface); }
.composer-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.composer-box textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; max-height: 160px; padding: 7px 0; min-height: 22px; }
.typing { font-size: 12px; color: var(--muted); height: 18px; padding: 0 20px; }
@media (max-width: 760px) { .chat-layout, .docs-layout { grid-template-columns: 1fr; } .channel-list, .docs-tree { display: none; } }

/* ================================================================ Geeni AI page */
.ai-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); width: 100%; height: 100%; }
.conv-list { border-right: 1px solid var(--border); background: var(--surface); padding: 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conv { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); cursor: pointer; font-size: 13px; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.conv .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .del { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); }
.conv:hover .del { opacity: 1; }
.ai-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ai-head { padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mode-pills { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 10px; flex-wrap: wrap; }
.mode-pill { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 550; color: var(--text-2); cursor: pointer; }
.mode-pill.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.ai-thread { flex: 1; overflow-y: auto; padding: 24px clamp(16px, 4vw, 56px); display: flex; flex-direction: column; gap: 18px; }
.bubble-row { display: flex; gap: 12px; max-width: 920px; width: 100%; margin: 0 auto; }
.bubble-row.user { flex-direction: row-reverse; }
.bubble { padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); min-width: 0; max-width: 100%; }
.bubble-row.user .bubble { background: var(--primary); color: var(--primary-text); border-color: var(--primary); white-space: pre-wrap; }
.bubble-row.assistant .bubble { flex: 1; }
.tool-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; margin: 0 6px 8px 0; }
.chart-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 10px 0; background: var(--surface); }
.chart-card h4 { margin: 0 0 8px; font-size: 14px; }
.chart-box { position: relative; height: 320px; }
.sql-block { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 6px 0; white-space: pre-wrap; color: var(--text-2); }
details.sql summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.ai-input { padding: 12px clamp(16px, 4vw, 56px) 18px; background: var(--bg); }
.ai-input .composer-box { max-width: 920px; margin: 0 auto; box-shadow: var(--shadow); }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 760px; margin: 0 auto; width: 100%; }
.suggestion { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.suggestion:hover { border-color: var(--primary); background: var(--primary-soft); }
.ai-hero { text-align: center; margin: 4vh auto 10px; }
.ai-hero .orb-big { width: 84px; height: 84px; margin: 0 auto 14px; }
.cursor::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--primary); }
@keyframes blink { 50% { opacity: 0; } }
@media (max-width: 760px) { .ai-layout { grid-template-columns: 1fr; } .conv-list { display: none; } .suggestions { grid-template-columns: 1fr; } }

/* ================================================================ voice orb */
.orb { width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; position: relative; background: conic-gradient(from 210deg, #5b4cf0, #2a78d6, #1baf7a, #e87ba4, #5b4cf0); box-shadow: 0 8px 30px rgba(91, 76, 240, .45); display: grid; place-items: center; color: #fff; transition: transform .15s; }
.orb::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .55), rgba(20, 16, 60, .55) 70%); }
.orb svg { position: relative; width: 24px; height: 24px; }
.orb:hover { transform: scale(1.05); }
.orb.listening { animation: orb-pulse 1.4s ease-in-out infinite; }
.orb.thinking { animation: orb-spin 1.2s linear infinite; }
.orb.speaking { animation: orb-pulse .6s ease-in-out infinite; }
.orb.armed::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid rgba(60, 207, 127, .8); }
@keyframes orb-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(91, 76, 240, .6), 0 8px 30px rgba(91, 76, 240, .45); } 50% { box-shadow: 0 0 0 16px rgba(91, 76, 240, 0), 0 8px 30px rgba(91, 76, 240, .45); } }
@keyframes orb-spin { to { filter: hue-rotate(360deg); transform: rotate(360deg); } }
.voice-dock { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.voice-panel { width: min(380px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 16px; animation: pop .15s; }
.voice-status { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.voice-heard { font-size: 15px; margin: 8px 0; color: var(--text-2); min-height: 22px; font-style: italic; }
.voice-reply { font-size: 14.5px; max-height: 240px; overflow-y: auto; }
.voice-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--primary); }
.wave { display: inline-flex; gap: 3px; align-items: center; height: 16px; margin-left: 8px; vertical-align: middle; }
.wave i { width: 3px; background: var(--primary); border-radius: 2px; animation: wave 1s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .1s; } .wave i:nth-child(3) { animation-delay: .2s; } .wave i:nth-child(4) { animation-delay: .3s; }
@keyframes wave { 0%, 100% { height: 4px; } 50% { height: 16px; } }

/* ================================================================ data studio */
.data-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); width: 100%; height: 100%; }
.ds-side { border-right: 1px solid var(--border); background: var(--surface); padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 18px 12px; text-align: center; cursor: pointer; color: var(--text-2); transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.ds-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.ds-item:hover { background: var(--surface-2); }
.ds-item.active { background: var(--primary-soft); border-color: var(--primary); }
.ds-ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; }
.ds-main { overflow-y: auto; padding: 20px 24px; min-width: 0; }
.upload-progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.upload-progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .15s; }
.chart-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.big-chart { position: relative; height: 420px; }
.sql-editor { font-family: var(--mono); font-size: 13px; min-height: 130px; }
.profile-bar { height: 6px; background: var(--surface-3); border-radius: 3px; width: 80px; overflow: hidden; display: inline-block; vertical-align: middle; }
.profile-bar span { display: block; height: 100%; background: var(--warning); }
.pdf-text { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 16px; border-radius: 10px; max-height: 60vh; overflow: auto; }
@media (max-width: 860px) { .data-layout { grid-template-columns: 1fr; } .ds-side { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--border); } }

/* misc */
.chart-holder { position: relative; height: 260px; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--surface-3); border-top-color: var(--primary); border-radius: 50%; animation: orb-spin .7s linear infinite; display: inline-block; }
.banner { padding: 10px 14px; border-radius: 10px; background: var(--warning-soft); color: var(--warning); margin-bottom: 16px; font-size: 13px; }
