/* DashClaw web shell. Dashmote brand, light theme. Self-contained: no external
   fonts, no CDN. Layout: fixed left sidebar, a tab strip, a scrolling main view. */

/* Inter and Space Grotesk are served from this app's own vendor directory, the
   same latin woff2 subsets the Dashmote developer portal ships. Without them the
   declared families silently fall back to system-ui on any machine that has not
   installed them locally, which is most client machines. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/app/vendor/fonts/inter-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/app/vendor/fonts/inter-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/app/vendor/fonts/inter-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/app/vendor/fonts/inter-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk Variable"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/app/vendor/fonts/space-grotesk-latin-wght.woff2") format("woff2");
}

:root {
  --navy: #040433;
  --blue: #0e49b5;
  --blue-soft: #e7eefc;
  --coral: #ff8473;
  --yellow: #ffbb29;
  --red: #ed0100;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --border: #e3e5ee;
  --muted: #6b7085;
  --green: #1f9d55;
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 66px;
  --tabbar-h: 42px;
  --font: Inter, -apple-system, "Segoe UI", system-ui, Roboto, sans-serif;
  --display: "Space Grotesk Variable", "Space Grotesk", Inter, -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--font);
  color: var(--navy);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { width: 20px; height: 20px; display: block; }

/* --- App shell ---------------------------------------------------------- */

.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.14s ease, flex-basis 0.14s ease;
}
.app.collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
.app.collapsed .sb-label, .app.collapsed .brand-text, .app.collapsed .newchat span,
.app.collapsed .nav-item span, .app.collapsed .account-id { display: none; }
.app.collapsed .newchat { justify-content: center; }
.app.collapsed .nav-item { justify-content: center; }

.sb-top { padding: 14px 14px 6px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700;
}
.brand-text { line-height: 1.1; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-by { font-size: 11px; color: var(--muted); }

.newchat {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: var(--blue); color: #fff; border: 0; border-radius: 10px;
  padding: 10px 12px; font-weight: 600; margin-bottom: 4px;
}
.newchat:hover { background: #0c3f9f; }

.sb-scroll { flex: 1; overflow-y: auto; padding: 6px 10px; }
.sb-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); padding: 12px 8px 4px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: 8px; padding: 8px 8px; color: var(--navy);
  position: relative;
}
.nav-item:hover { background: #f1f3f9; }
.nav-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav-item .icon svg { width: 18px; height: 18px; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; color: var(--navy);
  background: var(--yellow); border-radius: 6px; padding: 1px 6px;
}

.sb-bottom { border-top: 1px solid var(--border); padding: 8px 10px 12px; position: relative; }
.account-row {
  display: flex; align-items: center; gap: 10px; width: 100%; background: transparent;
  border: 0; border-radius: 8px; padding: 8px; color: var(--navy);
}
.account-row:hover:not(.static) { background: #f1f3f9; }
.account-row.static { cursor: default; }
.account-id { min-width: 0; }
.account-principal { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-workspace { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.account-name { flex: 1; text-align: left; font-weight: 600; font-size: 14px; }
.account-chevron { color: var(--muted); }
.account-menu {
  position: absolute; left: 10px; right: 10px; bottom: 58px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(4,4,51,0.12);
  padding: 6px; display: none; z-index: 30;
}
.account-menu.open { display: block; }
.menu-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 7px; padding: 8px 10px; color: var(--navy); }
.menu-item:hover:not(:disabled) { background: #f1f3f9; }
.menu-item:disabled { color: var(--muted); cursor: default; }

/* --- Main + tab strip --------------------------------------------------- */

.mainwrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tabbar {
  height: var(--tabbar-h); flex: 0 0 var(--tabbar-h); display: flex; align-items: stretch;
  background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 6px; gap: 2px; overflow-x: auto;
}
.tab {
  display: flex; align-items: center; gap: 8px; padding: 0 10px; max-width: 220px;
  border: 1px solid transparent; border-bottom: 0; background: transparent; color: var(--muted);
  border-radius: 8px 8px 0 0; margin-top: 6px; cursor: pointer; white-space: nowrap;
}
.tab .icon svg { width: 15px; height: 15px; }
.tab .tab-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.tab.active { background: var(--panel); color: var(--navy); border-color: var(--border); font-weight: 600; }
.tab-close { border: 0; background: transparent; color: var(--muted); border-radius: 5px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.tab-close:hover { background: #e2e5ee; color: var(--navy); }
.tab-close svg { width: 12px; height: 12px; }
.tab-new { align-self: center; margin-left: 4px; border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.tab-new:hover { background: #e2e5ee; color: var(--navy); }
.collapse-btn { margin-left: auto; align-self: center; border: 0; background: transparent; color: var(--muted); border-radius: 7px; padding: 6px 8px; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.collapse-btn:hover { background: #e2e5ee; color: var(--navy); }

.view { flex: 1; overflow-y: auto; background: var(--bg); }
.page { max-width: 960px; margin: 0 auto; padding: 28px 28px 80px; }
.page-wide { max-width: 1120px; }

/* --- Shared bits -------------------------------------------------------- */

h1.page-title { font-family: var(--display); font-size: 26px; margin: 0 0 4px; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); margin: 0 0 22px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.badge { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.badge-sample { background: var(--yellow); color: var(--navy); }
.badge-test { background: #ffe7e2; color: #c02b17; border: 1px solid var(--coral); }
.badge-cat { background: #eef1f7; color: var(--muted); }
.btn { border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #0c3f9f; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--navy); }
.btn-ghost:hover:not(:disabled) { background: #f1f3f9; }
.btn:disabled { opacity: 0.55; cursor: default; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* --- Composer ----------------------------------------------------------- */

.composer { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(4,4,51,0.04); }
.composer.focused { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(14,73,181,0.12); }
.composer textarea {
  width: 100%; border: 0; outline: none; resize: none; font: inherit; color: var(--navy);
  background: transparent; min-height: 46px; max-height: 200px; line-height: 1.5;
}
.composer-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.composer-tools { display: flex; align-items: center; gap: 6px; }
.tool-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.deck-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.composer-send { margin-left: auto; }
.send-btn { background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 8px 18px; font-weight: 600; }
.send-btn:disabled { opacity: 0.5; cursor: default; }

/* --- Home --------------------------------------------------------------- */

.home { max-width: 780px; margin: 0 auto; padding: 56px 24px 80px; }
.greeting { font-family: var(--display); font-size: 30px; text-align: center; letter-spacing: -0.02em; margin: 0 0 24px; }
.greeting .dim { color: var(--muted); }
.trust { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 4px 0; display: flex; align-items: center; justify-content: center; gap: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--navy); }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.setup-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 34px; }
.setup-card { padding: 18px; }
.setup-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.setup-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; }
.setup-tag { font-size: 11px; font-weight: 700; color: var(--blue); letter-spacing: 0.04em; text-transform: uppercase; }
.setup-card h3 { font-family: var(--display); font-size: 17px; margin: 2px 0 6px; }
.setup-card p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.kpi-band { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 14px; }
.kpi { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: #fbfcfe; }
.kpi .k-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .k-val { font-family: var(--display); font-size: 20px; font-weight: 700; }
.sample-caption { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* --- Chat thread -------------------------------------------------------- */

.chat { display: flex; flex-direction: column; min-height: 100%; }
.thread { flex: 1; max-width: 860px; width: 100%; margin: 0 auto; padding: 22px 24px 24px; }
.chat-composer-wrap { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(246,248,251,0) 0%, var(--bg) 34%); padding: 8px 24px 16px; }
.chat-composer-inner { max-width: 860px; margin: 0 auto; }
.msg { margin: 18px 0; }
.msg.user { display: flex; justify-content: flex-end; }
.bubble { background: var(--blue-soft); color: var(--navy); padding: 10px 14px; border-radius: 14px 14px 4px 14px; max-width: 72%; white-space: pre-wrap; }
.msg.assistant { max-width: 100%; }

.steps-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--muted); }
.steps-chip .spark { color: var(--coral); }
.steps-toggle { display: inline-flex; align-items: center; gap: 4px; background: transparent; border: 0; color: var(--blue); font-weight: 600; font-size: 13px; }
.steps-toggle .icon svg { width: 14px; height: 14px; }
.steps-list { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); margin: 8px 0 4px; overflow: hidden; }
.step-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 14px; }
.step-row:first-child { border-top: 0; }
.step-status { width: 18px; height: 18px; flex: 0 0 18px; display: flex; align-items: center; justify-content: center; }
.step-status.done { color: var(--green); }
.step-label { flex: 1; }
.step-dur { color: var(--muted); font-size: 12px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.answer { margin-top: 8px; }
.answer .md-h2 { font-family: var(--display); font-size: 20px; margin: 18px 0 8px; }
.answer .md-h3 { font-family: var(--display); font-size: 16px; margin: 16px 0 6px; }
.answer .md-p { margin: 8px 0; }
.answer .md-ul { margin: 8px 0; padding-left: 22px; }
.answer .md-table-wrap { overflow-x: auto; margin: 12px 0; }
.answer table.md-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.answer .md-table th, .answer .md-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.answer .md-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.answer .md-table tr:last-child td { border-bottom: 0; }
.provenance { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); white-space: pre-wrap; }

.refusal { border-left: 3px solid var(--coral); background: #fff5f3; border-radius: 8px; padding: 12px 14px; margin-top: 8px; color: #8a2c1c; white-space: pre-wrap; }
.refusal .refusal-title { font-weight: 700; display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }

.deck-card { border: 1px solid var(--blue); border-radius: 12px; padding: 14px; margin-top: 10px; background: #f7faff; }
.deck-card.clickable { cursor: pointer; }
.deck-card.clickable:hover { box-shadow: 0 2px 10px rgba(14,73,181,0.12); }
.deck-card h4 { font-family: var(--display); margin: 0 0 2px; }
.deck-card .deck-meta { color: var(--muted); font-size: 12px; }
.deck-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.deck-view-btn { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 7px 14px; }
.deck-view-btn .icon svg { width: 16px; height: 16px; }
.deck-preview { margin: 0; padding-left: 20px; color: var(--navy); }
.deck-preview li { margin: 3px 0; font-size: 13px; }
.deck-card .slide-kind { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 6px; }

/* --- Deck slide-over panel + 960x540 slide canvas (SFA visual parity) ---- */

.deck-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 62%; max-width: 1200px; z-index: 60;
  background: #eef1f6; border-left: 1px solid var(--border); box-shadow: -14px 0 40px rgba(4,4,51,0.18);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.25s ease;
}
.deck-panel.open { transform: translateX(0); }
.deck-panel.fullscreen { width: 100%; max-width: none; }

/* Docked split view (DashONE-style): chat column stays live on the left, the
   deck canvas fills the right. Active while a deck is open on a wide viewport
   (.app.deck-docked, toggled by updateDeckDock); fullscreen still overlays. */
/* The stored chat width is re-clamped by CSS on every window resize (min against
   55% of the app), so shrinking the window can never squeeze the canvas away. */
.app.deck-docked .mainwrap { flex: 0 0 min(var(--dock-chat-w, clamp(360px, 32%, 560px)), 55%); min-width: 360px; }
.app.deck-docked .deck-panel:not(.fullscreen) {
  position: relative; inset: auto; width: auto; max-width: none; flex: 1 1 auto; min-width: 0;
  transform: none; transition: none; box-shadow: none; z-index: 1;
}
/* Draggable seam between the chat column and the docked canvas (DashONE-style). */
.dock-divider { display: none; }
.app.deck-docked .dock-divider {
  display: block; flex: 0 0 6px; cursor: col-resize; position: relative; z-index: 2;
  touch-action: none;
  background: linear-gradient(to right, transparent 0, transparent 2px, var(--border) 2px, var(--border) 3px, transparent 3px);
}
.app.deck-docked .dock-divider:hover, .app.deck-docked .dock-divider.dragging {
  background: linear-gradient(to right, transparent 0, transparent 1px, var(--blue) 1px, var(--blue) 4px, transparent 4px);
}
.app.deck-docked .page { max-width: none; padding: 22px 18px 80px; }
/* Collapse the sidebar to icons while docked so the canvas gets the room. */
.app.deck-docked .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }
.app.deck-docked .sb-label, .app.deck-docked .brand-text, .app.deck-docked .newchat span,
.app.deck-docked .nav-item span, .app.deck-docked .account-id { display: none; }
.app.deck-docked .newchat { justify-content: center; }
.app.deck-docked .nav-item { justify-content: center; }
.deck-panel-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.dp-titlewrap { flex: 1; min-width: 0; }
.dp-title { font-family: var(--display); font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.dp-btn { width: 34px; height: 34px; border: 1px solid var(--border); background: var(--panel); color: var(--navy); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.dp-btn:hover { background: #f1f3f9; }
.dp-btn .icon svg { width: 18px; height: 18px; }
.deck-panel-body { flex: 1; overflow-y: auto; padding: 24px; }
.deck-slides { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.slide-wrap { overflow: hidden; position: relative; }

.slide-canvas {
  width: 960px; height: 540px; transform-origin: top left; position: relative;
  background: #f5f7fa; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 6px 24px rgba(4,4,51,0.10);
  font-family: var(--font); color: #1e293b;
}
.slide-canvas.cover { background: linear-gradient(135deg, #040433 0%, #0d1a4a 100%); color: #fff; padding: 48px 56px; justify-content: flex-end; }
.cover-brand { position: absolute; top: 40px; left: 56px; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: 0.02em; }
.cover-mid { margin-bottom: 44px; }
.cover-title { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1.1; margin: 0 0 14px; max-width: 800px; }
.cover-sub { font-size: 18px; color: rgba(255,255,255,0.8); }
.cover-foot { position: absolute; bottom: 22px; left: 56px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.5); }

.slide-band { min-height: 52px; padding: 10px 32px; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(135deg, #040433 0%, #0d1a4a 100%); flex: 0 0 auto; }
.band-title { font-family: var(--display); color: #fff; font-weight: 700; font-size: 15.2px; line-height: 1.2; }
.band-sub { font-size: 9px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 2px; }
.slide-body { flex: 1; min-height: 0; overflow: hidden; padding: 18px 32px; display: flex; flex-direction: column; gap: 14px; }
.slide-footnote { font-size: 10px; color: #64748b; margin-top: auto; }
.slide-footer { flex: 0 0 auto; border-top: 1px solid #e2e8f0; padding: 5px 32px; display: flex; align-items: center; justify-content: space-between; }
.foot-left, .foot-page { font-size: 10px; font-weight: 500; color: #0b1746; opacity: 0.7; }
.foot-right { display: flex; align-items: center; gap: 10px; }
.foot-brand { font-family: var(--display); font-size: 11px; font-weight: 700; color: #0b1746; opacity: 0.85; }

.kpi-row { display: grid; gap: 12px; flex: 0 0 auto; }
.kpi-tile { border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; background: #f8fafc; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; }
.kpi-value { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1; color: #040433; }
.kpi-delta { font-size: 10px; font-weight: 600; }
.tone-up { color: #16a34a; font-weight: 600; }
.tone-down { color: #dc2626; font-weight: 600; }
.tone-flat { color: #64748b; }

.callout { border-radius: 8px; padding: 14px; font-size: 13px; line-height: 1.35; border-left: 4px solid; flex: 0 0 auto; }
.callout-blue { background: #e8edfb; border-color: #1a3fb5; color: #143089; }
.callout-red { background: #fde8ea; border-color: #e63946; color: #a01a26; }
.callout-neutral { background: #f1f5f9; border-color: #e2e8f0; color: #1e293b; }

.slide-chart { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chart-title { font-size: 11px; font-weight: 500; color: #1e293b; margin-bottom: 6px; flex: 0 0 auto; }
.chart-empty { font-size: 11px; color: #64748b; }
.chart-canvas-wrap { flex: 1 1 auto; min-height: 130px; position: relative; }
.chart-canvas-wrap canvas { display: block; }
.chart-grid { display: flex; gap: 16px; min-height: 140px; flex: 1 1 auto; }
.chart-grid > * { flex: 1; min-width: 0; }

.hbar { display: flex; flex-direction: column; gap: 7px; }
.hbar-row { display: flex; align-items: center; gap: 10px; }
.hbar-label { flex: 0 0 92px; font-size: 9px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; height: 16px; background: #eef1f7; border-radius: 0 3px 3px 0; overflow: hidden; }
.hbar-bar { display: block; height: 100%; border-radius: 0 3px 3px 0; min-width: 2px; }
.hbar-value { flex: 0 0 auto; width: 74px; text-align: right; font-size: 9px; font-weight: 600; color: #1e293b; }

.vbar { flex: 1; min-height: 0; }
.vbar-plot { display: flex; align-items: flex-end; gap: 12px; height: 200px; }
.vbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; height: 100%; }
.vbar-value { font-size: 9px; font-weight: 600; color: #1e293b; margin-bottom: 3px; }
.vbar-barwrap { width: 60%; max-width: 46px; flex: 1; display: flex; align-items: flex-end; }
.vbar-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.vbar-label { font-size: 9px; color: #64748b; margin-top: 5px; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbar-label.rot { transform: rotate(-20deg); }

.svg-chart, .pie-chart { min-height: 0; }
.chart-svg { width: 100%; height: auto; max-height: 220px; }
.pie-chart { display: flex; align-items: center; gap: 14px; }
.pie-chart .chart-svg.pie { width: 200px; flex: 0 0 200px; }
.pie-legend { display: flex; flex-direction: column; gap: 5px; font-size: 10px; color: #1e293b; }
.pie-legend-item { display: flex; align-items: center; gap: 6px; }
.pie-sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.deck-bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: hidden; }
.deck-bullets li { display: flex; gap: 8px; }
.bullet-dot { width: 6px; height: 6px; border-radius: 50%; background: #1a3fb5; margin-top: 6px; flex: 0 0 6px; }
.deck-bullets.muted .bullet-dot { background: #e2e8f0; }
.bullet-text { font-size: 13px; line-height: 1.35; color: #1e293b; }
.deck-bullets.muted .bullet-text { color: #64748b; }

.deck-table-wrap { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #fff; }
.deck-table { border-collapse: collapse; width: 100%; font-size: 9px; }
.deck-table th { background: #040433; color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 12px; }
.deck-table th.col-first { text-align: left; }
.deck-table th.col-num { text-align: right; }
.deck-table td { padding: 6px 12px; color: #1e293b; border-top: 1px solid #e2e8f0; }
.deck-table tbody tr:nth-child(even) { background: #f8fafc; }
.deck-table td.col-first { text-align: left; font-weight: 500; }
.deck-table td.col-num { text-align: right; font-variant-numeric: tabular-nums; }
.table-note { font-size: 8px; color: #64748b; padding: 4px 12px; }

.deck-hint { max-width: 960px; font-size: 12px; color: var(--muted); padding: 4px 2px; }

/* --- deck editing (Wave B) --------------------------------------------- */
.dp-chip { font-size: 11px; font-weight: 700; color: var(--navy); background: var(--yellow); border-radius: 6px; padding: 2px 8px; align-self: center; margin-right: 4px; white-space: nowrap; }
/* Manual edits touched a figure: the deck no longer presents as fully verified. */
.dp-chip.chip-numbers { background: #fde8ea; color: #a01a26; }
.dp-save, .dp-cancel { padding: 7px 14px; font-size: 13px; }
.dp-error { background: #fff5f3; border-bottom: 1px solid var(--coral); color: #8a2c1c; font-size: 13px; padding: 8px 16px; }
.editable-field { outline: none; border-radius: 4px; cursor: text; transition: box-shadow 0.1s, background 0.1s; }
.editable-field:hover { box-shadow: inset 0 0 0 1px #c9cddb; }
.editable-field:focus { box-shadow: inset 0 0 0 1.5px var(--blue); background: rgba(14,73,181,0.05); }
.slide-band .editable-field:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4); }
.slide-band .editable-field:focus { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.7); background: rgba(255,255,255,0.08); }
.editable-empty::before { content: "Add text"; color: rgba(100,116,139,0.6); }
.slide-band .editable-empty::before, .cover-title.editable-empty::before { color: rgba(255,255,255,0.5); }
.deck-bullets li { align-items: flex-start; }
.bullet-del { border: 0; background: transparent; color: var(--muted); border-radius: 5px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px; margin-top: 2px; }
.bullet-del:hover { background: #fdecec; color: var(--red); }
.bullet-del svg { width: 12px; height: 12px; }
.bullet-add { border: 1px dashed var(--border); background: transparent; color: var(--blue); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; margin-top: 4px; align-self: flex-start; }
.bullet-add:hover { background: var(--blue-soft); }
.row-chip { font-size: 10px; font-weight: 700; color: var(--navy); background: var(--yellow); border-radius: 5px; padding: 1px 7px; flex: 0 0 auto; }

@media (max-width: 900px) {
  .deck-panel { width: 100%; max-width: none; }
}

.steps-running { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.steps-running-label { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps-running-clock { font-variant-numeric: tabular-nums; color: var(--blue); font-weight: 600; }
.deck-note { font-size: 12px; color: var(--muted); margin: 6px 0 2px; display: flex; align-items: center; gap: 6px; }

.msg-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; opacity: 0; transition: opacity 0.12s; }
.msg.assistant:hover .msg-actions, .msg-actions.pinned { opacity: 1; }
.act-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 8px; padding: 5px 10px; font-size: 12px; }
.act-btn:hover:not(:disabled) { color: var(--navy); border-color: #c9cddb; }
.act-btn:disabled { opacity: 0.7; cursor: default; }
.act-btn.act-good.on { color: var(--green); border-color: var(--green); }
.act-btn.act-bad.on { color: var(--red); border-color: var(--red); }
.act-flag { color: var(--coral); border-color: var(--coral); }
.act-flag:hover { background: #fff5f3; }
.flag-box { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.flag-box input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; }
.flag-box input:focus { outline: 2px solid var(--coral); border-color: var(--coral); }
.act-thanks { color: var(--green); font-size: 12px; margin-left: 4px; }

/* --- Connections -------------------------------------------------------- */

.conn-actions { display: flex; gap: 10px; margin: 0 0 22px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; gap: 8px; margin: 24px 0 12px; }
.section-head h2 { font-family: var(--display); font-size: 15px; margin: 0; }
.count-pill { background: #eef1f7; color: var(--muted); border-radius: 999px; font-size: 12px; padding: 1px 9px; }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.conn-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.conn-top { display: flex; align-items: center; gap: 10px; }
.conn-ico { width: 36px; height: 36px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; }
.conn-name { font-weight: 600; }
.conn-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.conn-desc { color: var(--muted); font-size: 13px; }
.empty-inline { color: var(--muted); font-size: 14px; padding: 14px; text-align: center; }
.loading { color: var(--muted); padding: 20px; }

/* --- Connections health (board X1-X3) ---------------------------------- */
.badge-tier { background: var(--blue-soft); color: var(--blue); }
.badge-premium { background: #efe6ff; color: #6b34c9; }
.conn-status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.conn-ok { color: var(--green); }
.conn-ok .conn-dot { background: var(--green); }
.conn-warn { color: #a9760a; }
.conn-warn .conn-dot { background: var(--yellow); }
.conn-err { color: #b3261e; }
.conn-err .conn-dot { background: var(--red); }
.conn-card-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
.conn-reconnect { padding: 6px 12px; font-size: 13px; }
.conn-connect { padding: 6px 14px; font-size: 13px; }
/* OAuth connect result banner (X4): a small inline notice at the top of the page. */
.conn-banner { padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 14px; border: 1px solid transparent; }
.conn-banner-ok { color: #146c43; background: #e5f5ec; border-color: #b7e2c8; }
.conn-banner-err { color: #b3261e; background: #fdecec; border-color: #f5c6c3; }
/* Reconnect-credential modal (vault-*) reuses the wf-overlay/wf-modal shell. */
.vault-modal { width: min(440px, 100%); }
.vault-field { padding: 12px 16px 0; }
.vault-input { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; color: var(--navy); background: #fbfcfe; }
.vault-input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

/* --- Chats list --------------------------------------------------------- */

.search { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; margin-bottom: 18px; background: var(--panel); }
.search:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.chat-group-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 18px 0 6px; }
.chat-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); margin-bottom: 8px; cursor: pointer; }
.chat-row:hover { border-color: #c9cddb; }
.chat-row .cr-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .cr-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chat-row .cr-actions { display: flex; gap: 4px; opacity: 0; }
.chat-row:hover .cr-actions { opacity: 1; }
.cr-act { border: 0; background: transparent; color: var(--muted); border-radius: 6px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.cr-act:disabled { cursor: not-allowed; }
.cr-act:hover:not(:disabled) { background: #f1f3f9; }
.cr-danger:hover:not(:disabled) { background: #fdecec; color: var(--coral); }
.chat-row .cr-main { flex: 1; min-width: 0; }
.chat-row .cr-main .cr-title { flex: none; }
.chat-row .cr-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Documents sections (Wave D) --------------------------------------- */
.doc-section-title { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--navy); margin: 20px 0 2px; }
.doc-section-note { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.doc-section { margin-bottom: 4px; }
.up-status { font-size: 12px; color: var(--muted); margin: -2px 0 10px; }

/* --- Workspace-file editor modal (Wave D) ------------------------------ */
.wf-overlay { position: fixed; inset: 0; background: rgba(4,4,51,0.34); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.wf-modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 60px rgba(4,4,51,0.28); width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.wf-modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.wf-modal-title { flex: 1; font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--navy); }
.wf-modal-x { border: 0; background: transparent; color: var(--muted); border-radius: 7px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.wf-modal-x:hover { background: #f1f3f9; color: var(--navy); }
.wf-modal-note { color: var(--muted); font-size: 12px; padding: 10px 16px 0; }
.wf-modal-body { margin: 12px 16px; flex: 1; min-height: 300px; resize: vertical; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-size: 13px; line-height: 1.5; color: var(--navy); background: #fbfcfe; }
.wf-modal-body:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.wf-modal-error { background: #fff5f3; border: 1px solid var(--coral); color: #8a2c1c; font-size: 13px; padding: 8px 12px; border-radius: 8px; margin: 0 16px; }
.wf-modal-count { color: var(--muted); font-size: 12px; text-align: right; padding: 0 16px 4px; }
.wf-modal-count.over { color: #b3261e; font-weight: 600; }
.wf-warnings { background: #fff9ec; border: 1px solid var(--yellow); border-radius: 8px; margin: 0 16px 4px; padding: 10px 12px; font-size: 13px; color: var(--navy); max-height: 180px; overflow-y: auto; }
.wf-warnings-title { font-weight: 700; margin-bottom: 6px; font-size: 13px; }
.wf-warning-item { margin: 4px 0; line-height: 1.45; }
.wf-warning-item .mono { font-size: 11.5px; color: var(--muted); display: block; }
.wf-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* --- Memory (board M1-M5) ---------------------------------------------- */
.mem-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mem-chip { flex: 0 0 auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #eef1f7; border-radius: 5px; padding: 1px 7px; }
.mem-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-pending { font-size: 10px; font-weight: 700; color: var(--navy); background: var(--yellow); border-radius: 5px; padding: 1px 7px; margin-left: 8px; }
.mem-add { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.mem-add-select { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--panel); color: var(--navy); font: inherit; }
.mem-add-input { flex: 1; min-width: 180px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font: inherit; color: var(--navy); background: var(--panel); }
.mem-add-input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.mem-add-error { color: #8a2c1c; font-size: 12px; margin: 0 0 8px; }
.mem-off { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; padding: 10px 0; }
.mem-settings { margin-top: 10px; font-size: 12px; color: var(--muted); }
.mem-settings-summary { cursor: pointer; color: var(--muted); font-size: 12px; user-select: none; }
.mem-settings-body { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; display: flex; flex-direction: column; gap: 6px; }
.mem-cat-row { display: flex; align-items: center; gap: 8px; color: var(--navy); font-size: 12px; cursor: pointer; }
.mem-cat-row input { margin: 0; }

/* --- Capabilities (board A6) ------------------------------------------- */
.cap-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cap-modal { overflow-y: auto; }
.cap-modal .wf-modal-body { min-height: 150px; }
.cap-field { display: flex; flex-direction: column; gap: 4px; margin: 12px 16px 0; }
.cap-label { font-size: 12px; font-weight: 700; color: var(--navy); }
.cap-hint { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.cap-slug-input { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-size: 13px; color: var(--navy); background: #fbfcfe; }
.cap-slug-input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.cap-slug-input:disabled { color: var(--muted); background: #f1f3f9; }
.cap-desc-input { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 62px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.5; color: var(--navy); background: #fbfcfe; }
.cap-desc-input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.cap-body-input { margin: 0; }
.cap-field .wf-modal-count { padding: 0 0 2px; }

/* --- Empty states + brief + prefs --------------------------------------- */

.empty-state { text-align: center; max-width: 460px; margin: 60px auto; }
.empty-ico { width: 56px; height: 56px; border-radius: 14px; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.empty-ico svg { width: 28px; height: 28px; }
.empty-state h2 { font-family: var(--display); font-size: 20px; margin: 0 0 6px; }
.empty-state p { color: var(--muted); margin: 0 0 16px; }

.brief-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.status-chip { background: #eef1f7; color: var(--muted); border-radius: 999px; font-size: 12px; padding: 4px 12px; }
.brief-hero { font-family: var(--display); font-size: 24px; letter-spacing: -0.02em; margin: 0 0 8px; }
.brief-hero .accent { color: var(--coral); }
.start-card { padding: 18px; margin: 16px 0 22px; display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.per-market { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.market-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fbfcfe; }
.market-card .m-name { font-weight: 600; font-size: 13px; }
.market-card .m-val { font-family: var(--display); font-size: 20px; font-weight: 700; margin: 2px 0 8px; }
.bar { height: 6px; border-radius: 4px; background: var(--blue-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); }
.delta { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.delta.up { background: #e5f5ec; color: var(--green); }
.delta.down { background: #fdecec; color: var(--red); }
.pref-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.pref-row .pref-k { color: var(--muted); }
.pref-row .pref-v { font-weight: 600; }

@media (max-width: 720px) {
  .setup-cards { grid-template-columns: 1fr; }
  .sidebar { position: absolute; z-index: 40; height: 100%; }
}

/* --- deck view controls (format-not-mutate) ------------------------------ */
.slide-chart { position: relative; }
.chart-tools {
  position: absolute; top: -4px; right: 0; z-index: 6;
  display: flex; gap: 4px; align-items: center;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 3px 5px; box-shadow: 0 4px 14px rgba(4, 4, 51, 0.10);
  opacity: 0; pointer-events: none; transition: opacity 0.12s ease;
}
.slide-chart:hover .chart-tools, .chart-tools:focus-within { opacity: 1; pointer-events: auto; }
.ct-select {
  font: 600 10px var(--font, Inter, sans-serif); color: #1e293b;
  border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; padding: 2px 4px; cursor: pointer;
}
.ct-btn {
  font: 700 9.5px var(--font, Inter, sans-serif); color: #64748b; letter-spacing: 0.02em;
  border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; padding: 3px 6px; cursor: pointer;
}
.ct-btn:hover { border-color: var(--blue); color: var(--blue); }
.ct-btn.on { background: #e8effb; color: var(--blue); border-color: #bcd0f0; }
.ct-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 8; min-width: 210px;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 10px; box-shadow: 0 10px 30px rgba(4, 4, 51, 0.18);
  display: flex; flex-direction: column; gap: 8px;
}
.ct-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ct-label { font-size: 11px; font-weight: 600; color: #64748b; white-space: nowrap; }
.ct-input {
  font: 600 12px var(--font, Inter, sans-serif); color: #1e293b;
  border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 7px; width: 110px; background: #f8fafc;
}
.ct-input.ct-wide { width: 100%; }
.ct-apply { font-size: 12px; padding: 5px 10px; align-self: flex-end; }
.ct-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* --- Edit-chart panel (tabbed: Graph / Axes / Visuals / Annotate) --------- */
.ct-panel { min-width: 292px; max-width: 320px; padding: 0; gap: 0; overflow: hidden; }
.ct-tabs { display: flex; align-items: center; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.ct-tab {
  flex: 1; font: 600 11px var(--font, Inter, sans-serif); color: #64748b;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  padding: 8px 4px 6px; cursor: pointer;
}
.ct-tab:hover { color: var(--blue); }
.ct-tab.on { color: var(--blue); border-bottom-color: var(--blue); background: #ffffff; }
.ct-tab-close { flex: 0 0 auto; width: 28px; font-size: 14px; line-height: 1; color: #94a3b8; }
.ct-panel-body {
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  max-height: 300px; overflow-y: auto;
}
.tp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.tp-tile {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px solid #e2e8f0; border-radius: 8px; background: #ffffff;
  padding: 7px 2px 5px; cursor: pointer;
}
.tp-tile:hover:not(.disabled) { border-color: var(--blue); }
.tp-tile.on { border-color: var(--blue); background: #e8effb; box-shadow: inset 0 0 0 1px var(--blue); }
.tp-tile.disabled { opacity: 0.38; cursor: not-allowed; }
.tp-ic { width: 26px; height: 18px; display: block; }
.tp-name { font: 600 8.5px var(--font, Inter, sans-serif); color: #475569; white-space: nowrap; }
.tp-tile.on .tp-name { color: var(--blue); }
.ct-check { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.ct-swatches { display: flex; flex-direction: column; gap: 4px; }
.sw-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid #e2e8f0; border-radius: 8px; background: #ffffff;
  padding: 5px 8px; cursor: pointer;
}
.sw-row:hover { border-color: var(--blue); }
.sw-row.on { border-color: var(--blue); background: #e8effb; box-shadow: inset 0 0 0 1px var(--blue); }
.sw-chips { display: flex; gap: 3px; }
.sw-chip { width: 16px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-name { font: 600 10.5px var(--font, Inter, sans-serif); color: #475569; }
.sw-row.on .sw-name { color: var(--blue); }
.ct-color-row .ct-label { overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.ct-color-ctl { display: flex; align-items: center; gap: 6px; }
.ct-color-ctl input[type="color"] {
  width: 30px; height: 20px; padding: 0; border: 1px solid #e2e8f0; border-radius: 5px;
  background: #ffffff; cursor: pointer;
}
.ct-note { font: 500 10.5px var(--font, Inter, sans-serif); color: #94a3b8; line-height: 1.4; }

/* Chart Data tab (Gamma-style data editor) */
.ct-data-serhead { margin: 8px 0 4px; }
.ct-sername { width: 100%; font-weight: 600; }
.ct-data-grid { display: grid; grid-template-columns: 1fr 92px 24px; gap: 4px; align-items: center; margin-bottom: 4px; }
.ct-num { text-align: right; }
.ct-num-bad { border-color: var(--red, #e63946); background: #fdecec; }
.ct-row-del { width: 24px; padding: 2px 0; color: var(--muted); }
.ct-row-del:hover { color: var(--red, #e63946); }
.ct-row-add { margin: 2px 0 8px; }
.ct-apply { margin-top: 8px; width: 100%; }
.ct-edit { color: var(--blue); border-color: #bcd0f0; }
.tp-tile { position: relative; }
.tp-suggest { position: absolute; top: 1px; right: 4px; font-size: 9px; color: var(--blue); }
.tp-tile.suggested:not(.on) { border-color: #bcd0f0; }

/* --- Gamma-parity chart resize: selection frame + 8 square handles --------- */
/* Click a chart to select it: a thin blue frame with white square handles at
   the corners and edge midpoints (matching gamma.app's moveable chrome). Sizes
   are in slide space, so they scale with the canvas like Gamma's do with zoom. */
.chart-resizable:hover { outline: 1px solid rgba(68, 170, 255, 0.35); outline-offset: 2px; }
.slide-chart.chart-selected { outline: 2px solid #44aaff; outline-offset: 2px; }
.slide-chart.chart-selected:hover { outline: 2px solid #44aaff; }
.chart-frame { position: absolute; inset: -2px; pointer-events: none; display: none; z-index: 7; }
.slide-chart.chart-selected .chart-frame { display: block; }
.chart-handle {
  position: absolute; width: 11px; height: 11px; box-sizing: border-box;
  background: #ffffff; border: 2px solid #84c1fa; pointer-events: auto; z-index: 8;
  touch-action: none;
}
.chart-handle::after { content: ""; position: absolute; inset: -7px; }
.chart-handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.chart-handle-n  { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.chart-handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.chart-handle-e  { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }
.chart-handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.chart-handle-s  { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.chart-handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.chart-handle-w  { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }

.kpi-tile { position: relative; }
.kpi-fmt {
  position: absolute; top: 6px; right: 6px; z-index: 5;
  font: 700 8.5px var(--font, Inter, sans-serif); color: #64748b;
  border: 1px solid #e2e8f0; border-radius: 5px; background: #ffffff; padding: 2px 4px; cursor: pointer;
  opacity: 0; transition: opacity 0.12s ease;
}
.kpi-tile:hover .kpi-fmt { opacity: 1; }
.kpi-fmt:hover { color: var(--blue); border-color: var(--blue); }

/* per-slide hover controls (view mode) */
.slide-ctl {
  position: absolute; top: 8px; right: 8px; z-index: 7;
  display: flex; flex-direction: column; gap: 4px;
  opacity: 0; transition: opacity 0.12s ease;
}
.slide-wrap:hover .slide-ctl, .slide-ctl:focus-within { opacity: 1; }
.sc-btn {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #e2e8f0; border-radius: 7px; background: #ffffff; color: #475569; cursor: pointer;
  box-shadow: 0 3px 10px rgba(4, 4, 51, 0.10);
}
.sc-btn .icon svg { width: 13px; height: 13px; }
.sc-btn:hover:not(:disabled) { color: var(--blue); border-color: var(--blue); }
.sc-btn:disabled { opacity: 0.35; cursor: default; }
.sc-btn.sc-danger:hover { color: var(--red); border-color: var(--red); }
.slide-ctl .ct-pop { top: 0; right: calc(100% + 8px); }

.deck-addcard { display: flex; justify-content: center; padding: 4px 0 2px; position: relative; }
.deck-addcard .ct-pop { top: calc(100% - 40px); right: auto; left: 50%; transform: translateX(-50%); min-width: 320px; }

/* quick-edits + share popover in the panel header */
.dp-actions { position: relative; }
.dp-pop { min-width: 250px; }
.qe-item {
  text-align: left; font: 600 12.5px var(--font, Inter, sans-serif); color: #1e293b;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.qe-item:hover { border-color: var(--blue); color: var(--blue); background: #eef3fc; }
.qe-note { font-size: 12px; font-weight: 600; color: var(--green, #0e9f6e); }
.dp-error.info { background: #eef6ff; border-bottom-color: var(--blue); color: #1e3a8a; }

/* present mode */
.present-overlay {
  position: fixed; inset: 0; z-index: 90; background: #05061c;
  display: flex; align-items: center; justify-content: center;
}
.present-stage { display: flex; align-items: center; justify-content: center; }
.present-slide { overflow: hidden; position: relative; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); border-radius: 4px; }
.present-slide .slide-canvas { transform-origin: top left; }
.present-exit {
  position: absolute; top: 16px; right: 18px; z-index: 92;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 9px; background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0; cursor: pointer;
}
.present-exit:hover { background: rgba(255, 255, 255, 0.18); }
.present-bar {
  position: absolute; bottom: 14px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  color: #94a3b8; font-size: 12.5px;
}
.present-counter { font-weight: 700; color: #e2e8f0; }

/* shared deck page */
.share-page .deck-slides { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.share-page .slide-wrap { overflow: hidden; position: relative; border: 1px solid var(--border); border-radius: 6px; }

/* --- sign-in, workspace chooser, no-access ------------------------------
   Styled to match the Dashmote developer portal login (platform.dashmote.com):
   a brand hero on a navy gradient beside a light panel holding the action card.
   Same tokens, spacing, type scale and button treatment; claw's own text. */
:root {
  --navy-2: #0b1055;
  --navy-3: #132a7a;
  --blue-dark: #0b3a92;
  --accent-dark: #e56650;
  --border-strong: #d3d7e3;
  --muted-2: #979cb3;
  --danger-bg: #fdeaec;
  --auth-page: #f7f8fb;
  --auth-muted: #6b7189;
  --auth-border: #e6e8ef;
  --gradient-brand: linear-gradient(160deg, #040433 0%, #0b1055 55%, #132a7a 100%);
  --shadow-xs: 0 1px 2px rgba(4, 4, 51, 0.05);
  --shadow-md: 0 6px 16px rgba(4, 4, 51, 0.1), 0 2px 6px rgba(4, 4, 51, 0.05);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-fast: 120ms var(--ease);
}

.app.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  min-height: 100vh;
  overflow-y: auto;
  background: var(--auth-page);
}

/* left: brand hero */
.auth-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  background: var(--gradient-brand);
  color: #fff;
  overflow: hidden;
}
.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(14, 73, 181, 0.45) 0%, transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(255, 132, 115, 0.22) 0%, transparent 42%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.035) 0px, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 64px);
  pointer-events: none;
}
.auth-hero-content { position: relative; z-index: 1; }
.auth-hero-brand { display: flex; align-items: center; gap: 10px; }
.auth-hero-mark {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700; font-size: 18px; letter-spacing: -1px; color: var(--coral);
}
.auth-hero-name {
  font-family: var(--display); font-weight: 600; font-size: 17px;
  letter-spacing: -0.01em; color: #fff;
}
.auth-hero-headline { margin-top: 88px; max-width: 420px; }
.auth-hero-headline h1 {
  font-family: var(--display); color: #fff; font-size: 32px; font-weight: 600;
  letter-spacing: -0.015em; line-height: 1.18; margin: 0 0 14px;
}
.auth-hero-headline p { color: #b9bde3; font-size: 15px; line-height: 1.6; margin: 0; }
.auth-hero-dots { position: relative; z-index: 1; display: flex; gap: 8px; margin-top: 40px; }
.auth-hero-dot {
  width: 6px; height: 6px; border-radius: 999px; background: var(--coral);
  opacity: 0.35; animation: auth-hero-pulse 2.6s var(--ease) infinite;
}
.auth-hero-dot:nth-child(2) { animation-delay: 0.25s; }
.auth-hero-dot:nth-child(3) { animation-delay: 0.5s; }
@keyframes auth-hero-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.35); }
}
.auth-hero-foot { position: relative; z-index: 1; color: #7d82b3; font-size: 12.5px; margin: 0; }

/* right: the action card */
.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--auth-page);
}
.auth-card {
  width: 100%; max-width: 384px;
  animation: auth-in 0.42s var(--ease) both;
}
@keyframes auth-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-body { display: flex; flex-direction: column; }
.auth-head { display: block; }
.auth-title {
  font-family: var(--display); font-size: 20px; font-weight: 600;
  letter-spacing: -0.01em; margin: 0 0 4px; color: var(--navy);
}
.auth-sub { margin: 0; color: var(--auth-muted); font-size: 14px; }
.auth-email {
  margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--navy);
  background: var(--blue-soft); border-radius: 6px; padding: 8px 11px;
  overflow-wrap: anywhere;
}
.auth-note { margin-top: 12px; font-size: 13px; color: var(--auth-muted); line-height: 1.55; }
.auth-mail { color: var(--blue); text-decoration: underline; overflow-wrap: anywhere; }
.auth-error {
  margin-top: 16px; background: var(--danger-bg); border: 1px solid #f3c6cc;
  color: #8f1f2c; padding: 9px 12px; border-radius: 6px; font-size: 13px; line-height: 1.5;
}
.auth-error-code {
  margin-top: 5px; font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #a8503f; overflow-wrap: anywhere; user-select: text;
}

/* buttons: the portal's SSO row, and a quiet variant for secondary actions */
.auth-sso { display: flex; flex-direction: column; gap: 10px; margin: 24px 0 4px; }
.auth-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 8px 15px; border-radius: 6px; border: 1px solid transparent;
  background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(4, 4, 51, 0.08);
  transition: background var(--transition-fast), border-color var(--transition-fast),
    box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}
.auth-btn:hover:not(:disabled) { background: var(--blue-dark); box-shadow: 0 4px 12px rgba(14, 73, 181, 0.28); }
.auth-btn:active:not(:disabled) { transform: translateY(1px); }
.auth-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-btn-sso {
  justify-content: flex-start; gap: 12px; padding: 11px 14px;
  background: var(--panel); border-color: var(--border-strong); color: var(--navy);
  font-weight: 600; box-shadow: var(--shadow-xs);
}
.auth-btn-sso:hover:not(:disabled) {
  background: #fff; border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.auth-btn-label { flex: 1; text-align: left; }
.auth-btn-chev { flex-shrink: 0; opacity: 0; transform: translateX(-3px); color: var(--auth-muted); transition: opacity var(--transition-fast), transform var(--transition-fast); }
.auth-btn-chev svg { width: 16px; height: 16px; }
.auth-btn-sso:hover:not(:disabled) .auth-btn-chev { opacity: 0.6; transform: translateX(0); }
.auth-glyph {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
}
.auth-glyph svg { width: 15px; height: 15px; display: block; }
.auth-glyph-dashone { background: linear-gradient(135deg, var(--blue) 0%, var(--navy-3) 100%); }
.auth-glyph-dashleads { background: linear-gradient(135deg, var(--coral) 0%, var(--accent-dark) 100%); }
.auth-glyph-default { background: var(--navy); }
.auth-glyph-mark {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700;
}
.auth-btn-quiet {
  margin-top: 12px; background: var(--panel); border-color: var(--border-strong);
  color: var(--navy); font-weight: 500; box-shadow: none;
}
.auth-btn-quiet:hover:not(:disabled) { background: #f1f3f9; border-color: var(--muted-2); box-shadow: none; }
.auth-role {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--auth-muted); background: #eef0f6; border-radius: 5px; padding: 1px 6px;
}
.auth-foot {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--auth-border);
  color: var(--auth-muted); font-size: 11px;
}
.auth-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

@media (max-width: 900px) {
  .app.auth-shell { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}

/* Account row actions (firebase mode only). */
.account-actions { display: flex; gap: 6px; padding: 2px 8px 0; }
.account-btn {
  flex: 1; background: transparent; border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 8px; font-size: 12px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.account-btn:hover { background: #f1f3f9; color: var(--navy); }
.app.collapsed .account-actions { display: none; }
.app.deck-docked .account-actions { display: none; }

/* A share link opens without sign-in: bare scrolling page, no shell. */
.app.public-share { display: block; overflow-y: auto; background: var(--bg); }
.app.public-share .view { overflow: visible; }
