:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-secondary: #f9f9f9;
  --text: #0d0d0d;
  --text-secondary: #6e6e6e;
  --text-tertiary: #999999;
  --border: #e5e5e5;
  --border-light: #efefef;
  --accent: #0d0d0d;
  --accent-hover: #333333;
  --accent-contrast: #ffffff;
  --danger: #ef4444;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --sidebar-w: 52px;
  --sidebar-w-expanded: 244px;
  --sidebar-active-w: var(--sidebar-w);
  --document-viewer-w: min(720px, 46vw);
  --content-max: 1040px;
  --composer-max: 1040px;
  --transition: 180ms ease;
  --code-bg: #f6f8fa;
  --code-header-bg: #eef1f4;
  --code-border: #e5e7eb;
  --code-text: #24292f;
  --code-inline-bg: #fce8ef;
  --code-inline-text: #9b2335;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  min-width: 0;
  min-height: 100dvh;
}

body[data-chat-theme="cyber"] {
  --ink: #101010;
  --paper: #fef9f0;
  --paper-2: #f2ede4;
  --panel: #eeeeee;
  --hi: #ffdad8;
  --cyber-stroke: 1px;
  --cyber-drop-sm: 1px 1px 0 var(--ink);
  --cyber-drop-md: 2px 2px 0 var(--ink);
  --cyber-drop-lg: 3px 3px 0 var(--ink);
  --bg: var(--paper);
  --bg-secondary: var(--paper-2);
  --text: var(--ink);
  --text-secondary: #5f6265;
  --text-tertiary: #8a8d91;
  --border: var(--ink);
  --border-light: #c5c6ca;
  --accent: var(--ink);
  --accent-hover: #2f3133;
  --danger: #ae2f34;
  --shadow-sm: var(--cyber-drop-sm);
  --shadow-md: var(--cyber-drop-md);
  --shadow-lg: var(--cyber-drop-lg);
  --radius: 0;
  --radius-lg: 0;
  --content-max: 1040px;
  --composer-max: 1040px;
  --code-bg: #ffffff;
  --code-header-bg: #e7e2d9;
  --code-border: var(--ink);
  --code-text: var(--ink);
  --code-inline-bg: var(--hi);
  --code-inline-text: #6d0010;
  background:
    radial-gradient(var(--ink) 0.7px, transparent 0.8px) 0 0 / 8px 8px,
    var(--paper);
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-chat-theme="doodle"] {
  --paper: #f9f9fc;
  --paper-2: #f3f3f6;
  --ink: #1a1c1e;
  --hi: #ecdeee;
  --plum: #655b68;
  --plum-d: #4d4450;
  --bdr: #e2e2e5;
  --dot: #cfc2d2;
  --glass: rgba(255, 255, 255, 0.84);
  --glass-2: rgba(255, 255, 255, 0.78);
  --bg: var(--paper);
  --bg-secondary: var(--paper-2);
  --text: var(--ink);
  --text-secondary: #424848;
  --text-tertiary: #727878;
  --border: #c2c8c7;
  --border-light: var(--bdr);
  --accent: var(--plum);
  --accent-hover: var(--plum-d);
  --danger: #ba1a1a;
  --shadow-sm: 0 8px 22px rgba(32, 25, 36, 0.08);
  --shadow-md: 0 14px 34px rgba(32, 25, 36, 0.12);
  --shadow-lg: 0 22px 52px rgba(32, 25, 36, 0.16);
  --radius: 18px;
  --radius-lg: 28px;
  --content-max: 1040px;
  --composer-max: 1040px;
  --code-bg: #ffffff;
  --code-header-bg: var(--hi);
  --code-border: #d8d1da;
  --code-text: var(--ink);
  --code-inline-bg: var(--hi);
  --code-inline-text: var(--plum-d);
  --doodle-clear-width: min(1520px, 100%);
  --doodle-dot-color: color-mix(in srgb, var(--dot) 38%, transparent);
  --doodle-dot-size: 52px;
  background: var(--paper);
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ─────────────────────────────────────────────────────────────────────────
   DARK MODE
   Each chat theme keeps its structural identity (radius, shadows, fonts,
   background patterns). Only the neutral palette flips. Placed AFTER the
   theme blocks so these overrides win on equal specificity.
   ───────────────────────────────────────────────────────────────────────── */
body[data-mode="dark"] {
  color-scheme: dark;
  --bg: #1f1f1f;
  --bg-secondary: #2b2b2b;
  --text: #ececec;
  --text-secondary: #b4b4b4;
  --text-tertiary: #8a8a8a;
  --border: #3a3a3a;
  --border-light: #2e2e2e;
  --accent: #ececec;
  --accent-hover: #ffffff;
  --accent-contrast: #1a1a1a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.6);
  --code-bg: #161616;
  --code-header-bg: #232323;
  --code-border: #333333;
  --code-text: #e6e6e6;
  --code-inline-bg: #3a2a30;
  --code-inline-text: #ff9bb3;
  background: #1f1f1f;
}

body[data-mode="dark"][data-chat-theme="cyber"] {
  --ink: #f4ecdd;
  --paper: #14120f;
  --paper-2: #211d17;
  --panel: #1b1813;
  --hi: #4a2f2c;
  --text: var(--ink);
  --text-secondary: #b8b1a3;
  --text-tertiary: #8a8478;
  --border: var(--ink);
  --border-light: #3a352c;
  --accent: var(--ink);
  --accent-hover: #ffffff;
  --accent-contrast: #14120f;
  --code-bg: #1b1813;
  --code-header-bg: #262118;
  --code-border: var(--ink);
  --code-text: var(--ink);
  --code-inline-bg: #3a2a22;
  --code-inline-text: #ffc9a8;
  background:
    radial-gradient(#3a352c 0.7px, transparent 0.8px) 0 0 / 8px 8px,
    var(--paper);
}

body[data-mode="dark"][data-chat-theme="doodle"] {
  --paper: #16161a;
  --paper-2: #20202a;
  --ink: #ece9f1;
  --hi: #2e2838;
  --plum: #cbb8d4;
  --plum-d: #e0d2e8;
  --bdr: #2a2734;
  --dot: #3a3548;
  --glass: rgba(36, 34, 46, 0.72);
  --glass-2: rgba(36, 34, 46, 0.6);
  --text: var(--ink);
  --text-secondary: #b6b2c2;
  --text-tertiary: #837e92;
  --border: #3a3548;
  --accent: var(--plum);
  --accent-contrast: #1f1a24;
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 52px rgba(0, 0, 0, 0.65);
  --code-bg: #1c1a22;
  --code-header-bg: #262232;
  --code-border: #3a3548;
  --code-text: var(--ink);
  --code-inline-text: #d8c2e2;
  --doodle-dot-color: rgba(110, 100, 125, 0.22);
  --doodle-dot-size: 64px;
  background: var(--paper);
}

/* ─────────────────────────────────────────────────────────────────────────
   ACCENT COLOR PRESETS
   Independent of theme + mode. "default" emits no override so each theme keeps
   its native accent. Saturated presets always pair with white text. Placed
   AFTER theme + dark blocks so the chosen preset wins.
   ───────────────────────────────────────────────────────────────────────── */
body[data-accent="indigo"] { --accent: #4f46e5; --accent-hover: #4338ca; --accent-contrast: #ffffff; }
body[data-accent="emerald"] { --accent: #059669; --accent-hover: #047857; --accent-contrast: #ffffff; }
body[data-accent="rose"] { --accent: #e11d48; --accent-hover: #be123c; --accent-contrast: #ffffff; }
body[data-accent="ocean"] { --accent: #0284c7; --accent-hover: #036aa0; --accent-contrast: #ffffff; }

/* Slightly brighter accents in dark mode for contrast against dark surfaces.
   --accent-contrast is restated so it wins over theme-specific dark blocks
   (which share specificity) and keeps text on colored accents legible. */
body[data-mode="dark"][data-accent="indigo"] { --accent: #6366f1; --accent-hover: #818cf8; --accent-contrast: #ffffff; }
body[data-mode="dark"][data-accent="emerald"] { --accent: #10b981; --accent-hover: #34d399; --accent-contrast: #ffffff; }
body[data-mode="dark"][data-accent="rose"] { --accent: #f43f5e; --accent-hover: #fb7185; --accent-contrast: #ffffff; }
body[data-mode="dark"][data-accent="ocean"] { --accent: #0ea5e9; --accent-hover: #38bdf8; --accent-contrast: #ffffff; }

/* Color preset swatches (settings) */
.color-preset-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}
.color-swatch:hover { transform: translateY(-1px); }
.color-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text);
}
.color-swatch-dot {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: block;
}
.color-swatch-dot[data-swatch="default"] {
  background: linear-gradient(135deg, #0d0d0d 0 50%, #c9c9c9 50% 100%);
}
.color-swatch-dot[data-swatch="indigo"] { background: #4f46e5; }
.color-swatch-dot[data-swatch="emerald"] { background: #059669; }
.color-swatch-dot[data-swatch="rose"] { background: #e11d48; }
.color-swatch-dot[data-swatch="ocean"] { background: #0284c7; }

button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ─── Fullscreen Auth / Setup / Paywall Views ─── */
.fullscreen-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 24px;
  background: var(--bg);
}

.auth-panel {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.auth-brand {
  display: inline-block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 32px;
}

.auth-panel h1 {
  font-size: 28px;
  font-weight: 650;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.auth-sub {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0 0 28px;
  line-height: 1.5;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-google {
  width: 100%;
  min-height: 44px;
}

.auth-notice {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 0;
  min-height: 20px;
}

.auth-email {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

#paywallView {
  align-items: flex-start;
  min-height: 100dvh;
  padding: clamp(36px, 6vw, 72px) 24px 44px;
  background-color: #fef9f0;
  background-image:
    linear-gradient(#e7e2d9 1px, transparent 1px),
    linear-gradient(90deg, #e7e2d9 1px, transparent 1px);
  background-size: 40px 40px;
  color: #1d1c16;
}

.paywall-panel {
  position: relative;
  width: min(100%, 1240px);
  margin: 0 auto;
}

.paywall-close {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 3px solid #000101;
  border-radius: 999px;
  background: #ffffff;
  color: #000101;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.08);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.paywall-close:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.08);
}

.paywall-close:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.paywall-hero {
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-bottom: clamp(56px, 8vw, 112px);
  text-align: center;
}

.paywall-brand {
  font-size: clamp(54px, 8vw, 92px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: #000101;
}

.paywall-sticker {
  display: inline-block;
  padding: 12px 44px;
  border: 3px solid #000101;
  border-radius: 2% 6% 5% 4% / 1% 1% 2% 4%;
  background: #ffdad8;
  color: #8c1520;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 850;
  transform: rotate(-1deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.06);
}

#paywallView .auth-email {
  margin: -40px 0 36px;
  text-align: center;
  color: #75777a;
}

.auth-back {
  margin-top: 20px;
  height: 40px;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  transition: background var(--transition);
}

.auth-back:hover {
  background: var(--bg);
}

.auth-signout {
  margin-top: 12px;
  height: 40px;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: background var(--transition);
}

.auth-signout:hover {
  background: var(--bg-secondary);
}

.service-list {
  text-align: left;
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.service-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-secondary);
  font-size: 14px;
}

.status-ok { color: #16a34a; font-weight: 600; }
.status-missing { color: var(--danger); font-weight: 600; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(20px, 4vw, 44px);
  margin-top: 12px;
}

.plan-card {
  position: relative;
  display: flex;
  min-height: 420px;
  flex-direction: column;
  text-align: left;
  padding: clamp(26px, 3vw, 38px);
  border: 3px solid #000101;
  border-radius: 2% 6% 5% 4% / 1% 1% 2% 4%;
  background: #ffffff;
  box-shadow: 10px 12px 0 rgba(0, 0, 0, 0.05);
}

.plan-card-lite {
  transform: rotate(0.9deg);
}

.plan-card-essential {
  background: #eee9e0;
  box-shadow: 14px 14px 0 rgba(174, 47, 52, 0.1);
  transform: rotate(0.35deg);
}

.plan-card-pro {
  background: #000101;
  color: #ffffff;
  box-shadow: 14px 14px 0 rgba(0, 0, 0, 0.08);
  transform: rotate(0.5deg);
}

.plan-pin {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ae2f34;
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
}

.plan-ribbon,
.plan-usage-badge {
  position: absolute;
  top: -22px;
  z-index: 1;
  padding: 8px 14px;
  border: 3px solid #000101;
  border-radius: 2% 6% 5% 4% / 1% 1% 2% 4%;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.06);
}

.plan-ribbon {
  left: 28px;
  background: #ae2f34;
  color: #ffffff;
  transform: rotate(-3deg);
}

.plan-ribbon::before {
  content: "★ ";
}

.plan-usage-badge {
  right: 28px;
  background: #ffffff;
  color: #44474a;
  transform: rotate(3deg);
}

.plan-card-pro .plan-usage-badge {
  background: #ffdad8;
  color: #8c1520;
}

.plan-head {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 2px dashed rgba(117, 119, 122, 0.28);
}

.plan-card h3 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 850;
  letter-spacing: -0.03em;
}

.plan-card .price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.plan-card .price strong {
  font-size: clamp(38px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: -0.05em;
}

.plan-card .price span {
  font-size: 22px;
  color: #44474a;
}

.plan-card-pro .price span {
  color: rgba(255, 255, 255, 0.72);
}

.plan-card p {
  margin: 0;
  color: #75777a;
  font-size: 18px;
  font-style: italic;
  font-weight: 650;
}

.plan-card-pro p {
  color: rgba(255, 255, 255, 0.64);
}

.plan-card ul {
  display: grid;
  gap: 22px;
  margin: 0 0 36px;
  padding: 0;
  color: #1d1c16;
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 650;
  list-style: none;
}

.plan-card-pro ul {
  color: #ffffff;
}

.plan-card li {
  display: flex;
  align-items: center;
  gap: 14px;
}

.plan-card li span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: #ae2f34;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

.plan-qr {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 14px auto 10px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: white;
}

.plan-pay-btn {
  width: 100%;
  min-height: 68px;
  margin-top: auto;
  border: 3px solid #000101;
  border-radius: 0;
  background: #000101;
  color: #ffffff;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.08);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 900;
  letter-spacing: 0.12em;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.plan-pay-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.08);
}

.plan-pay-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.plan-card-essential .plan-pay-btn {
  border-color: #ae2f34;
}

.plan-card-pro .plan-pay-btn {
  background: #ffffff;
  color: #000101;
  border-color: #ffffff;
}

.plan-pay-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.plan-payment-note {
  margin-top: 18px !important;
  text-align: center;
  color: #8a8a8a !important;
  font-size: 12px !important;
  font-style: normal !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  text-transform: uppercase;
}

.paywall-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 36px;
}

@media (max-width: 1100px) {
  .plan-grid {
    grid-template-columns: 1fr;
    max-width: 620px;
    margin-inline: auto;
  }

  .plan-card,
  .plan-card-lite,
  .plan-card-essential,
  .plan-card-pro {
    transform: none;
  }
}

@media (max-width: 640px) {
  #paywallView {
    padding: 28px 16px 32px;
    background-size: 28px 28px;
  }

  .paywall-hero {
    margin-bottom: 44px;
  }

  .paywall-sticker {
    width: min(100%, 340px);
    padding: 10px 18px;
  }

  .plan-card {
    min-height: auto;
    padding: 24px;
  }

  .plan-ribbon,
  .plan-usage-badge {
    position: static;
    display: inline-flex;
    width: max-content;
    margin: -8px 0 16px;
    transform: none;
  }
}

.payment-pending {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 2px dashed rgba(174, 47, 52, 0.45);
  border-radius: 10px;
  background: rgba(255, 218, 216, 0.55);
  color: #8c1520;
  font-size: 12px;
}

.payment-pending strong {
  color: #6d0010;
  font-size: 13px;
  letter-spacing: 0.02em;
}

/* ─── App Shell ─── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-active-w) minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns 220ms ease;
}

body.sidebar-expanded {
  --sidebar-active-w: var(--sidebar-w-expanded);
}

body.guest-mode {
  --sidebar-active-w: var(--sidebar-w-expanded);
}

body.document-viewer-open .app-shell {
  grid-template-columns: var(--sidebar-active-w) minmax(0, 1fr) minmax(300px, var(--document-viewer-w));
}

/* ─── Sidebar ─── */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border-light);
  padding: 8px 0;
  z-index: 20;
  overflow: visible;
  width: var(--sidebar-active-w);
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  transition: width 220ms ease;
}

body.sidebar-expanded .sidebar {
  width: var(--sidebar-active-w);
}

body.guest-mode .app-shell {
  grid-template-columns: var(--sidebar-active-w) minmax(0, 1fr);
}

body.guest-mode .sidebar {
  width: var(--sidebar-active-w);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 8px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 36px;
  margin-bottom: 2px;
}

body.sidebar-expanded .sidebar-header {
  justify-content: space-between;
  padding: 0 2px 0 4px;
}

.sidebar-brand {
  display: none;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
}

body.sidebar-expanded .sidebar-brand {
  display: block;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
}

.sidebar-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), width 220ms ease;
  flex-shrink: 0;
  overflow: hidden;
}

body.sidebar-expanded .sidebar-nav-item {
  width: 100%;
  padding-right: 8px;
}

.sidebar-nav-item:hover {
  background: var(--bg-secondary);
}

.sidebar-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-nav-label {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 180ms ease, width 220ms ease;
}

body.sidebar-expanded .sidebar-nav-label {
  opacity: 1;
  width: auto;
}

.sidebar-pin-wrap {
  position: relative;
  width: 100%;
}

body.sidebar-expanded .sidebar-pin-trigger {
  display: none;
}

.pinned-popup {
  position: absolute;
  left: calc(100% + 10px);
  top: 0;
  z-index: 45;
  width: min(280px, calc(100vw - 80px));
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}

.pinned-popup.hidden {
  display: none;
}

.pinned-popup-title {
  padding: 8px 10px 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.pinned-popup-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(320px, 50dvh);
  overflow-y: auto;
}

.pinned-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.pinned-popup-item:hover {
  background: var(--bg-secondary);
}

.pinned-popup-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinned-popup-empty {
  padding: 10px 12px 12px;
  color: var(--text-secondary);
  font-size: 13px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section + .sidebar-section {
  margin-top: 12px;
}

.sidebar-section-label {
  display: none;
  padding: 4px 10px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

body.sidebar-expanded .sidebar-section-label {
  display: block;
}

.pinned-section.hidden {
  display: none;
}

.sidebar-mid {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.sidebar-bottom {
  padding: 4px 8px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 6;
  overflow: visible;
}

.sidebar-profile-wrap {
  position: relative;
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

.sidebar-profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: transform var(--transition), width 220ms ease;
  min-width: 0;
}

body.sidebar-expanded .sidebar-profile-btn {
  width: 100%;
  justify-content: flex-start;
  border-radius: 10px;
  padding: 2px 0;
}

body.sidebar-expanded .sidebar-profile-btn:hover {
  background: var(--bg-secondary);
  transform: none;
}

.sidebar-profile-meta {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  flex: 1;
  text-align: left;
  line-height: 1.2;
}

body.sidebar-expanded .sidebar-profile-meta {
  display: flex;
}

.sidebar-profile-name {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-plan {
  width: 100%;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-btn:hover {
  transform: scale(1.04);
}

.sidebar-profile-btn[aria-expanded="true"] .sidebar-profile-avatar {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent);
}

.sidebar-profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.profile-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: -8px;
  z-index: 45;
  width: min(280px, calc(100vw - 24px));
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.profile-menu.hidden {
  display: none;
}

.profile-menu-email {
  padding: 10px 12px 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-menu .account-usage {
  margin-top: 0;
  padding: 8px 12px 10px;
  border-top: none;
}

.profile-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-top: 1px solid var(--border-light);
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.profile-menu-item svg {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.profile-menu-item:hover {
  background: var(--bg-secondary);
}

.profile-menu-item.profile-menu-danger {
  color: var(--danger);
}

.profile-menu-item.profile-menu-danger svg {
  color: var(--danger);
}

body.sidebar-expanded .profile-menu {
  left: -8px;
  bottom: calc(100% + 10px);
  width: calc(100% + 16px);
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text);
  transition: background var(--transition);
  flex-shrink: 0;
}

.sidebar-icon:hover {
  background: var(--bg-secondary);
}

.guest-login-panel {
  margin: auto 12px 8px;
  padding: 16px 14px;
  border-top: 1px solid var(--border-light);
}

body:not(.guest-mode) .guest-login-panel {
  display: none !important;
}

.guest-login-panel strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.guest-login-panel p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.guest-login-btn {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 650;
  transition: background var(--transition), transform var(--transition);
}

.guest-login-btn:hover {
  background: var(--accent-hover);
}

body.guest-mode .sidebar-bottom {
  display: none;
}

.conversation-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  border-radius: 8px;
  transition: background var(--transition), opacity 180ms ease;
  opacity: 0;
  pointer-events: none;
  position: relative;
}

body.sidebar-expanded .conversation-row {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 70ms;
}

body:not(.sidebar-expanded) .conversation-row {
  transition-delay: 0ms;
}

.conversation-row:hover,
.conversation-row.active {
  background: var(--bg-secondary);
}

.conversation-item {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  background: transparent;
  cursor: pointer;
}

.conversation-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.conversation-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-right: 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-tertiary);
  opacity: 0;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
}

.conversation-row:hover .conversation-menu-btn,
.conversation-row.active .conversation-menu-btn,
.conversation-menu-btn[aria-expanded="true"] {
  opacity: 1;
}

.conversation-menu-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.conversation-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 148px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.conversation-menu.conversation-menu--up {
  top: auto;
  bottom: calc(100% + 4px);
}

.conversation-menu.hidden {
  display: none;
}

.conversation-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.conversation-menu-item:hover {
  background: var(--bg-secondary);
}

.conversation-menu-item-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.conversation-menu-item.conversation-menu-danger {
  color: var(--danger);
}

/* ─── Chat Panel ─── */
.chat-panel {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  max-width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

.temporary-chat-bar {
  position: absolute;
  top: 18px;
  right: 18px;
  left: 18px;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.chat-panel > .temporary-chat-bar {
  position: absolute;
}

.temporary-chat-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

.temporary-chat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.temporary-chat-toggle:hover,
.temporary-chat-toggle.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.temporary-chat-toggle:active {
  transform: scale(0.96);
}

.document-viewer {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

.document-viewer-resizer {
  position: absolute;
  inset: 0 auto 0 -7px;
  width: 14px;
  cursor: col-resize;
  z-index: 3;
}

.document-viewer-resizer::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 4px;
  height: 42px;
  border-radius: 999px;
  background: #c9c9c9;
  transform: translateY(-50%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}

.document-viewer-resizer:hover::after,
body.document-viewer-resizing .document-viewer-resizer::after {
  background: #8c8c8c;
}

body.document-viewer-resizing {
  cursor: col-resize;
  user-select: none;
}

.document-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 16px 0 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.document-viewer-title-wrap {
  min-width: 0;
}

.document-viewer-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-viewer-meta {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
}

.document-viewer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.document-viewer-action,
.document-viewer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.document-viewer-close {
  width: 32px;
  padding: 0;
}

.document-viewer-action:hover,
.document-viewer-close:hover {
  background: var(--bg-secondary);
}

.document-viewer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: var(--bg-secondary);
}

.pdf-pages {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: 100%;
  min-height: 100%;
}

.pdf-page {
  width: fit-content;
  max-width: 100%;
  background: white;
  box-shadow: 0 1px 5px rgba(0,0,0,0.12);
}

.pdf-page canvas {
  display: block;
  max-width: 100%;
  height: auto !important;
  background: white;
}

.pdf-page-placeholder {
  width: min(100%, 720px);
  min-width: min(100%, 320px);
  min-height: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: white;
}

.document-viewer-empty {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}

/* ─── Top Bar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  height: 56px;
  padding: 0 24px;
  flex-shrink: 0;
}

.context-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
}

.context-meter-track {
  position: relative;
  width: 42px;
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.08);
}

.context-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--transition);
}

.context-meter.warn .context-meter-fill {
  background: #d97706;
}

.context-meter.over .context-meter-fill {
  background: #dc2626;
}

.context-meter.over {
  color: #dc2626;
}

.usage-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

.usage-pill:empty { display: none; }

/* ─── Messages ─── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 36px clamp(12px, 2vw, 24px) 160px;
  scroll-behavior: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 8px;
  padding-bottom: 80px;
}

.empty-state h1 {
  font-size: 38px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.02em;
}

.message {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto 48px;
  display: flex;
  gap: 0;
}

.message.user {
  flex-direction: row-reverse;
}

.message.user .message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: min(720px, 78%);
  margin-left: auto;
}

.message.assistant:not(.compare-message):not(.council-message) .message-body {
  max-width: 100%;
}

.message.user:not(.compare-message):not(.council-message) .message-content {
  width: fit-content;
  max-width: 100%;
  background: var(--bg-secondary);
  border: none;
  border-radius: 22px;
  padding: 14px 18px;
  box-shadow: none;
}

.message.assistant:not(.compare-message):not(.council-message) .message-content {
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.message-avatar {
  display: none;
}

.message-body {
  min-width: 0;
  flex: 1;
}

.message-meta {
  display: none;
}

.compare-message-label {
  margin-bottom: 12px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
}

.message-footer {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 10px;
}

.message-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  height: 32px;
}

.message-footer-sources {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  min-width: 0;
}

.message-footer-sources .sources-pill {
  margin: 0;
}

.message-footer-sources .sources-pill[open] .sources-pill-trigger {
  margin-bottom: 0;
}

.message-footer-sources .sources-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  top: auto;
  z-index: 12;
  min-width: min(100%, 320px);
  width: max-content;
  max-width: min(520px, calc(100vw - 48px));
  box-shadow: var(--shadow-md);
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.msg-action-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.msg-copy-btn--icon,
.msg-retry-btn {
  width: 32px;
  height: 32px;
  padding: 0;
}

.msg-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 0;
  padding: 6px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  opacity: 1;
  transition: background var(--transition), color var(--transition);
}

.msg-copy-btn--icon {
  width: 32px;
  height: 32px;
  justify-content: center;
  padding: 0;
}

.message:hover .msg-copy-btn,
.compare-response:hover .compare-copy-btn {
  opacity: 1;
}

.msg-copy-btn:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.compare-copy-btn {
  margin-left: auto;
}

.message-content {
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
  font-size: 16px;
}

.code-block-wrap {
  margin: 12px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--code-border);
  background: var(--code-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--code-header-bg);
  border-bottom: 1px solid var(--code-border);
  min-height: 34px;
}

.code-block-lang {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-transform: lowercase;
}

.code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  transition: background var(--transition), color var(--transition);
}

.code-copy-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.message-content pre {
  overflow-x: auto;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 14px;
  margin: 0;
  border-radius: 0;
}

.message-content pre:not(.code-block-wrap pre) {
  border: 1px solid var(--code-border);
  border-radius: 10px;
  margin: 12px 0;
}

.message-content code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  font-size: 0.9em;
}

.message-content :not(pre) > code {
  background: var(--code-inline-bg);
  color: var(--code-inline-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 20px 0 8px;
  line-height: 1.3;
  font-weight: 650;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.25em; }
.message-content h3 { font-size: 1.1em; }
.message-content h4,
.message-content h5,
.message-content h6 { font-size: 1em; }

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
  margin-top: 0;
}

.message-content ul,
.message-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.message-content li {
  margin-bottom: 4px;
}

.message-content li > ul,
.message-content li > ol {
  margin: 4px 0;
}

.message-content blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
}

.message-content blockquote p {
  margin: 0;
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 16px 0;
}

.message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 14px;
}

.message-content th,
.message-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.message-content th {
  background: var(--bg-secondary);
  font-weight: 650;
  font-size: 13px;
}

.message-content tr:nth-child(even) {
  background: var(--bg-secondary);
}

.message-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  opacity: 0.8;
}

.message-content p {
  margin: 8px 0;
}

.message-content > p:first-child {
  margin-top: 0;
}

.message-content > p:last-child {
  margin-bottom: 0;
}

.message-content .katex-display {
  margin: 14px 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.message-content .hljs {
  background: transparent;
}

.compare-message {
  max-width: min(1480px, calc(100vw - 40px));
  width: 100%;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compare-response {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}

.compare-response-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
  font-size: 13px;
}

.compare-response-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.compare-model-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 700;
}

.compare-model-mark img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
}

.compare-response-body {
  padding: 12px 14px 14px;
  font-size: 15px;
}

.message-image {
  display: block;
  max-width: min(180px, 100%);
  max-height: 150px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin: 10px 0;
}

.message-file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(320px, 100%);
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  box-shadow: none;
}

.message.user .message-file {
  align-self: flex-end;
}

.message.user .message-image {
  align-self: flex-end;
  margin-bottom: 8px;
}

.message-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.message-file-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.message-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.message-file-meta {
  color: var(--text-tertiary);
  font-size: 12px;
}

.reasoning,
.tool-call {
  margin-top: 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.thinking-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.thinking-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  opacity: 0.55;
}

.thinking-status.is-active::before {
  animation: thinking-status-pulse 1.2s ease-in-out infinite;
}

.thinking-status.is-active span {
  position: relative;
  display: inline-block;
  color: var(--text-tertiary);
}

.thinking-status.is-active span::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    transparent 40%,
    var(--text) 50%,
    transparent 60%,
    transparent 100%
  );
  background-size: 250% 100%;
  background-position: 100% center;
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
  animation: thinking-status-shimmer 1.2s linear infinite;
}

@keyframes thinking-status-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 0.9; transform: scale(1.15); }
}

@keyframes thinking-status-shimmer {
  from { background-position: 100% center; }
  to { background-position: 0% center; }
}

.reasoning summary,
.tool-call summary {
  padding: 10px 14px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}

.reasoning.is-done summary {
  color: var(--text-tertiary);
  font-weight: 500;
}

.reasoning div {
  padding: 0 14px 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
  min-height: 0;
}

.reasoning.is-streaming[open] div:empty {
  min-height: 1.25em;
}

.reasoning summary::-webkit-details-marker {
  display: none;
}

.reasoning summary::marker {
  content: "";
}

.reasoning summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--text-tertiary);
  transition: transform 0.15s ease;
  vertical-align: middle;
}

.reasoning[open] summary::before {
  transform: rotate(90deg);
}

.tool-call pre {
  margin: 0;
  padding: 10px 14px 14px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  border-radius: 0;
}

.message-error,
.message-note {
  margin-top: 10px;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
}

.message-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.message-retry-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #fca5a5;
  background: #fff;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.message-retry-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.message-retry-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.message-note {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

/* ─── Composer Area ─── */
.compare-context-banner {
  width: 100%;
  max-width: var(--composer-max);
  margin: 0 auto 10px;
  padding: 0 24px;
}

.compare-context-banner:not(.hidden) {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 132px;
  z-index: 4;
  margin: 0;
  pointer-events: auto;
}

.compare-context-banner.hidden {
  display: none;
}

.compare-context-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.compare-context-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 4px;
}

.compare-context-copy p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  max-width: 560px;
}

.compare-context-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.compare-context-primary,
.compare-context-secondary,
.compare-context-cancel {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.compare-context-primary {
  color: var(--accent-contrast);
  background: var(--accent);
}

.compare-context-primary:hover {
  background: var(--accent-hover);
}

.compare-context-secondary {
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.compare-context-secondary:hover {
  background: var(--bg-secondary);
}

.compare-context-cancel {
  color: var(--text-secondary);
  background: transparent;
}

.compare-context-cancel:hover {
  color: var(--text);
  background: var(--bg-secondary);
}

.composer-area {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 0 clamp(12px, 2vw, 24px) 18px;
  background: transparent;
  pointer-events: none;
  flex-shrink: 0;
  overflow: visible;
}

.composer-area .composer-wrap {
  pointer-events: auto;
}

.composer-area .app-footer {
  display: none;
}

.composer-wrap {
  width: 100%;
  max-width: var(--composer-max);
  margin: 0 auto;
  overflow: visible;
}

.followup-queue {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
}

.followup-queue.hidden {
  display: none;
}

.followup-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 92%, var(--surface));
  box-shadow: var(--shadow-sm);
}

.followup-pill.is-editing {
  flex-wrap: wrap;
}

.followup-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  flex: 0 0 auto;
}

.followup-text {
  min-width: 0;
  flex: 1;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.followup-media-count {
  flex: 0 0 auto;
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 650;
}

.followup-media-strip {
  display: flex;
  gap: 6px;
  width: 100%;
  padding-left: 29px;
}

.followup-media-strip img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.followup-input {
  min-width: 0;
  flex: 1;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
}

.followup-input:focus {
  border-color: var(--accent);
}

.followup-edit,
.followup-delete {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  flex: 0 0 auto;
}

.followup-edit:hover,
.followup-delete:hover {
  color: var(--text);
}

.followup-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
}

.followup-delete:hover {
  background: var(--surface);
}

.composer {
  position: relative;
  overflow: visible;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 12px;
  box-shadow: var(--shadow-md);
}

.composer textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  resize: none;
  outline: none;
  padding: 0;
  min-height: 30px;
  max-height: 260px;
  font-size: 17px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: var(--text-tertiary);
}

.composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.composer-action-menu-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 6;
}

.composer-action-menu-wrap.is-open {
  z-index: 55;
}

.composer-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.composer-plus-btn {
  border-radius: var(--radius-full);
  background: var(--bg);
  border: 1px solid var(--border-light);
}

.composer-plus-btn[aria-expanded="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.composer-tool:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.composer-plus-btn[aria-expanded="true"]:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.composer-action-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(280px, calc(100vw - 40px));
  padding: 8px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 55;
}

.composer-action-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  transition: background var(--transition);
}

.composer-action-menu-item:hover {
  background: var(--bg-secondary);
}

.composer-action-menu-item svg {
  flex: 0 0 19px;
  color: var(--text-secondary);
}

.web-search-toggle[aria-pressed="true"] {
  color: #2e86de;
}

.web-search-toggle[aria-pressed="true"]:hover {
  background: rgba(46, 134, 222, 0.2);
}

.web-search-toggle[aria-pressed="false"] {
  opacity: 0.55;
}

.web-search-toggle[aria-pressed="false"]:hover {
  opacity: 1;
}

.provider-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  width: auto;
  min-width: 32px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.provider-toggle-label {
  white-space: nowrap;
}

.provider-toggle[aria-pressed="true"] {
  background: rgba(108, 76, 219, 0.14);
  color: #6c4cdb;
  border-color: rgba(108, 76, 219, 0.35);
}

.provider-toggle[aria-pressed="true"]:hover {
  background: rgba(108, 76, 219, 0.22);
}

.provider-toggle[aria-pressed="false"] {
  opacity: 0.6;
}

.provider-toggle[aria-pressed="false"]:hover {
  opacity: 1;
}

/* ── Sources pill (web search citations) ── */

.artifact-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  max-width: 560px;
}

.artifact-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: none;
}

.artifact-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.artifact-info {
  min-width: 0;
}

.artifact-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-status {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
  text-transform: capitalize;
}

.artifact-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.artifact-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.artifact-download:hover {
  background: var(--bg-secondary);
}

.artifact-card.pending {
  opacity: 0.85;
}

.artifact-card.pending .artifact-badge {
  background: var(--text-secondary, #666);
}

.artifact-card.pending.failed {
  border-color: #d8a3a3;
  background: #fff5f5;
}

.artifact-card.pending.failed .artifact-badge {
  background: #b54848;
}

.artifact-download.is-disabled {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  color: var(--text-secondary, #666);
  background: transparent;
  border-style: dashed;
}

.artifact-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: artifact-spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes artifact-spin {
  to { transform: rotate(360deg); }
}

.sources-pill {
  margin: 0;
  max-width: 100%;
}

/* ── Inline citation pills (end of paragraph) ── */

.inline-source-pill {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  margin-left: 5px;
  max-width: 100%;
}

.inline-source-pill-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  cursor: pointer;
  padding: 3px 9px 3px 5px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.2;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.inline-source-pill-trigger::-webkit-details-marker {
  display: none;
}

.inline-source-pill-trigger::marker {
  content: "";
}

.inline-source-pill-trigger:hover {
  background: var(--border-light);
  border-color: var(--border);
}

.inline-source-favicon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border-light);
}

.inline-source-pill-label {
  color: var(--text);
  font-weight: 600;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-source-pill-more {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
}

.inline-source-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 220px;
  max-width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.inline-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}

.inline-source-row:hover {
  background: var(--bg-secondary);
}

.inline-source-row.is-static {
  cursor: default;
}

.inline-source-row img {
  flex: 0 0 14px;
  border-radius: 3px;
}

.inline-source-row-title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-source-row-host {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-secondary);
}

.sources-pill-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.sources-pill-trigger::-webkit-details-marker {
  display: none;
}

.sources-pill-trigger::marker {
  content: "";
}

.sources-pill-trigger:hover {
  background: var(--border-light);
  border-color: var(--border);
}

.sources-pill[open] .sources-pill-trigger {
  margin-bottom: 8px;
  border-radius: 14px;
}

.sources-favicons {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.sources-favicon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  background: var(--bg);
  object-fit: cover;
  margin-left: calc(var(--stack, 0) * -7px);
}

.sources-favicon:first-child {
  margin-left: 0;
}

.sources-pill-label {
  color: var(--text);
  font-weight: 600;
}

.sources-pill-count {
  display: none;
}

.sources-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  max-width: min(100%, 520px);
}

.sources-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}

.sources-row:hover {
  background: var(--bg-secondary);
}

.sources-row.is-static {
  cursor: default;
}

.sources-row-icon,
.sources-row-fallback {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.sources-row-fallback {
  background: var(--border);
}

.sources-row-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sources-row-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sources-row-host {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.composer-send {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  flex-shrink: 0;
}

.send-btn,
.stop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  transition: background var(--transition), opacity var(--transition);
}

.send-btn {
  background: var(--accent);
  color: var(--accent-contrast);
  opacity: 0.3;
}

.send-btn.active {
  opacity: 1;
}

.send-btn.active:hover {
  background: var(--accent-hover);
}

.send-btn:disabled {
  cursor: not-allowed;
}

.stop-btn {
  background: var(--accent);
  color: var(--accent-contrast);
}

.stop-btn:hover {
  background: var(--accent-hover);
}

/* ─── Model selector (inside composer) ─── */
.composer-model-wrap {
  position: relative;
  flex-shrink: 1;
  min-width: 0;
  max-width: min(320px, 42vw);
  z-index: 5;
}

.composer-model-wrap.is-open {
  z-index: 50;
}

.composer-model-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-light);
  transition: background var(--transition), border-color var(--transition);
}

.composer-model-btn.has-brand-logo {
  padding-left: 8px;
}

.composer-model-logo {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 5px;
}

.composer-model-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
}

.composer-model-btn.pro-active,
.compare-btn.active,
.compare-btn.council-active {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-secondary));
  border-color: var(--text);
  color: var(--text);
}

.composer-model-btn.pro-active:hover,
.compare-btn.active:hover,
.compare-btn.council-active:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-secondary));
  border-color: var(--text);
  color: var(--text);
}

.composer-model-btn.pro-active .composer-model-chevron {
  color: var(--text-tertiary);
}

.composer-model-btn.pro-active .composer-model-price {
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.composer-model-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-model-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.18);
  color: currentColor;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.composer-model-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.composer-model-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: max-content;
  max-width: min(320px, calc(100vw - 48px));
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.composer-model-dropdown input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.composer-model-dropdown input:focus {
  border-color: #c8c8c8;
}

.model-catalog {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 0;
  max-height: min(420px, 46vh);
  overflow-y: auto;
}

.composer-model-dropdown .model-catalog {
  gap: 2px;
}

.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  transition: background var(--transition);
}

.model-option-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.model-option-logo {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 5px;
}

.model-option-logo-placeholder {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.mode-option {
  align-items: flex-start;
  padding: 8px 10px;
  gap: 8px;
}

.model-option-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.model-option-desc {
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.3;
}

.model-price-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}

.model-option:hover,
.model-option.active {
  background: var(--bg-secondary);
}

.model-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-option-check {
  flex-shrink: 0;
  width: 1.1em;
  font-size: 13px;
  color: var(--text);
  text-align: right;
}

.model-empty {
  padding: 14px 10px;
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
}

/* ─── Compare selector ─── */
.composer-compare-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 5;
}

.composer-compare-wrap.is-open {
  z-index: 50;
}

.compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border-light);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.compare-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}

.compare-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(420px, calc(100vw - 48px));
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.compare-dropdown input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.compare-dropdown input:focus {
  border-color: #c8c8c8;
}

.compare-hint {
  padding: 8px 2px 2px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
}

.compare-mode-toggle {
  display: inline-flex;
  margin: 8px 0 6px;
  padding: 3px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  gap: 2px;
}

.compare-mode-seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.compare-mode-seg:hover {
  color: var(--text);
}

.compare-mode-seg.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.compare-mode-desc {
  padding: 0 2px 6px;
  color: var(--text-tertiary);
  font-size: 11.5px;
  line-height: 1.4;
}

.compare-option.disabled {
  opacity: 0.42;
}

.compare-clear {
  width: 100%;
  height: 34px;
  margin-top: 8px;
  border-radius: 8px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.compare-clear:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

/* ─── Council ─── */
.council-message {
  width: min(1480px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  margin: 0 auto 32px;
}

.council-shell {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
}

.council-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.council-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-contrast);
  flex-shrink: 0;
}

.council-header-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.council-header-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.council-progress {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
}

.council-progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.council-progress-copy small {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.council-progress-track {
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  overflow: hidden;
}

.council-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 260ms ease;
}

.council-stages {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}

.council-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.council-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: background var(--transition), box-shadow var(--transition);
}

.council-stage.active {
  color: var(--text);
}

.council-stage.active .council-stage-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 13, 13, 0.12);
  animation: council-pulse 1.5s ease-in-out infinite;
}

.council-stage.done {
  color: var(--text-secondary);
}

.council-stage.done .council-stage-dot {
  background: #16a34a;
}

.council-stage-sep {
  flex: 1;
  height: 1px;
  background: var(--border-light);
  min-width: 16px;
  max-width: 40px;
}

@keyframes council-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.18); }
}

.council-section-label {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.council-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.council-panelist {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.council-panelist.rank-1 {
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.25);
}

.council-panelist-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
  font-size: 13px;
}

.council-panelist-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.council-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: #f1f1f1;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}

.council-rank-badge.rank-1 {
  background: linear-gradient(135deg, #fff4c5 0%, #ffe88a 100%);
  color: #5b4400;
}

.council-rank-badge.rank-2 {
  background: #ececec;
  color: #444;
}

.council-rank-badge.rank-3 {
  background: #f5e1c8;
  color: #6b4a26;
}

.council-rank-pending {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-left: auto;
}

.council-panelist-body {
  padding: 12px 14px 12px;
  font-size: 14.5px;
  flex: 1;
  min-height: 0;
}

.council-justifications {
  border-top: 1px dashed var(--border-light);
  padding: 8px 14px 12px;
  background: var(--bg-secondary);
}

.council-justifications-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 5px;
}

.council-justification {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin: 3px 0;
  padding-left: 14px;
  position: relative;
}

.council-justification::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--text-tertiary);
}

.council-synthesis {
  margin: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.council-synthesis-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg-secondary);
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 650;
}

.council-synthesis-head svg {
  flex-shrink: 0;
}

.council-synthesis-head .council-synthesis-model {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.council-synthesis-body {
  padding: 16px 18px 18px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
}

.council-synthesis-pending {
  padding: 18px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
}

.council-peer-status {
  padding: 8px 16px 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
}

.council-peer-status:empty {
  display: none;
}

.council-details {
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}

.council-details > summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.council-details > summary::-webkit-details-marker {
  display: none;
}

.council-details > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg);
  margin-left: auto;
  transition: transform var(--transition);
  opacity: 0.55;
}

.council-details[open] > summary::after {
  transform: rotate(225deg);
}

.council-details > summary small {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.council-details-body {
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.council-details-body .council-stages {
  background: var(--bg);
}

@media (max-width: 768px) {
  .council-message {
    max-width: 100%;
  }
  .council-panel-grid {
    grid-template-columns: 1fr;
  }
  .council-synthesis-body {
    padding: 14px 14px 16px;
    font-size: 15px;
  }
  .council-progress-copy,
  .council-details > summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .council-details > summary::after {
    position: absolute;
    right: 18px;
  }
}

/* ─── Composer Image Previews ─── */
.composer-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-previews:empty {
  display: none;
}

.composer-previews:not(:empty) + textarea {
  margin-top: 8px;
}

.preview-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition);
}

.preview-thumb:hover {
  border-color: var(--border);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-file {
  width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 30px 8px 10px;
  background: var(--bg-secondary);
}

.preview-file span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.preview-file-icon {
  display: inline-flex;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.preview-progress {
  position: absolute;
  right: 24px;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translateY(-50%);
  background:
    radial-gradient(circle at center, var(--bg-secondary) 0 48%, transparent 50%),
    conic-gradient(var(--accent) calc(var(--progress, 0) * 1%), var(--border) 0);
}

.preview-uploading .preview-progress,
.preview-queued .preview-progress {
  animation: preview-spin 1s linear infinite;
  background:
    radial-gradient(circle at center, var(--bg-secondary) 0 48%, transparent 50%),
    conic-gradient(var(--accent) 0 25%, var(--border) 0);
}

.preview-failed {
  border-color: rgba(220, 38, 38, 0.45);
}

.preview-failed .preview-progress {
  background:
    radial-gradient(circle at center, var(--bg-secondary) 0 48%, transparent 50%),
    conic-gradient(#dc2626 0 100%, #dc2626 0);
}

/* ─── Chat Themes: Cyber Mind ─── */
body[data-chat-theme="cyber"] .app-shell {
  background:
    radial-gradient(var(--ink) 0.7px, transparent 0.8px) 0 0 / 8px 8px,
    var(--paper);
}

body[data-chat-theme="cyber"] .sidebar {
  margin: 14px 0 14px 14px;
  height: calc(100dvh - 28px);
  background: var(--paper);
  border: var(--cyber-stroke) solid var(--ink);
  box-shadow: var(--cyber-drop-md);
  padding: 10px 0;
}

body[data-chat-theme="cyber"] .sidebar-top,
body[data-chat-theme="cyber"] .sidebar-bottom {
  padding: 4px 8px;
  align-items: flex-start;
}

body[data-chat-theme="cyber"] .sidebar-icon,
body[data-chat-theme="cyber"] .conversation-row,
body[data-chat-theme="cyber"] .conversation-menu-btn {
  border-radius: 0;
}

body[data-chat-theme="cyber"] .sidebar-icon:hover,
body[data-chat-theme="cyber"] .conversation-row:hover,
body[data-chat-theme="cyber"] .conversation-row.active {
  background: var(--hi);
  box-shadow: var(--cyber-drop-sm);
}

body[data-chat-theme="cyber"] .sidebar-bottom {
  border-top: none;
}

body[data-chat-theme="cyber"] .guest-login-panel {
  border-top: var(--cyber-stroke) solid var(--ink);
}

body[data-chat-theme="cyber"] .sidebar-profile-avatar {
  border: var(--cyber-stroke) solid var(--ink);
  border-radius: 0;
  box-shadow: var(--cyber-drop-sm);
  background: var(--ink);
  color: var(--paper);
}

body[data-chat-theme="cyber"].sidebar-expanded .sidebar-profile-btn {
  border-radius: 0;
}

body[data-chat-theme="cyber"].sidebar-expanded .sidebar-profile-btn:hover {
  background: var(--hi);
  box-shadow: var(--cyber-drop-sm);
}

body[data-chat-theme="cyber"] .profile-menu {
  border: var(--cyber-stroke) solid var(--ink);
  border-radius: 0;
  box-shadow: var(--cyber-drop-md);
}

body[data-chat-theme="cyber"] .profile-menu-item {
  border-radius: 0;
}

body[data-chat-theme="cyber"] .profile-menu-item:hover {
  background: var(--hi);
}

body[data-chat-theme="cyber"] .guest-login-btn,
body[data-chat-theme="cyber"] .auth-signout,
body[data-chat-theme="cyber"] .plan-pay-btn {
  border-radius: 0;
  border: var(--cyber-stroke) solid var(--ink);
  box-shadow: var(--cyber-drop-sm);
}

body[data-chat-theme="cyber"] .chat-panel {
  margin: 14px 20px 14px 22px;
  height: calc(100dvh - 28px);
  background: var(--panel);
  border: var(--cyber-stroke) solid var(--ink);
  box-shadow: var(--cyber-drop-lg);
  position: relative;
}

body[data-chat-theme="cyber"] .chat-panel::before {
  content: "";
  display: block;
  height: 0;
  border-bottom: var(--cyber-stroke) solid var(--ink);
  flex: 0 0 auto;
}

body[data-chat-theme="cyber"] .topbar {
  height: 42px;
  padding: 0 22px;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  background: var(--paper-2);
}

body[data-chat-theme="cyber"] .topbar::before {
  content: "BUFFER: READY   |   MODE: ARCHIVE_SYNT";
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

body[data-chat-theme="cyber"] .context-meter,
body[data-chat-theme="cyber"] .usage-pill {
  border-radius: 0;
  background: var(--code-bg);
  border: 1px solid var(--ink);
  color: var(--ink);
}

body[data-chat-theme="cyber"] .messages {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 12px 20px 150px;
  background: transparent;
  border: none;
  box-shadow: none;
}

body[data-chat-theme="cyber"] .empty-state h1 {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body[data-chat-theme="cyber"] .message {
  max-width: var(--content-max);
  width: 100%;
}

body[data-chat-theme="cyber"] .compare-message,
body[data-chat-theme="cyber"] .council-message {
  max-width: min(1480px, calc(100vw - 80px));
  width: 100%;
}

body[data-chat-theme="cyber"] .message.user {
  flex-direction: row-reverse;
}

body[data-chat-theme="cyber"] .message.user .message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: min(720px, 78%);
  margin-left: auto;
}

body[data-chat-theme="cyber"] .message-meta {
  display: none;
}

body[data-chat-theme="cyber"] .message-avatar {
  display: none;
}

body[data-chat-theme="cyber"] .message:not(.compare-message):not(.council-message) .message-content {
  max-width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

body[data-chat-theme="cyber"] .message.assistant:not(.compare-message):not(.council-message) .message-content {
  width: 100%;
}

body[data-chat-theme="cyber"] .message.user:not(.compare-message):not(.council-message) .message-content {
  width: fit-content;
  max-width: 100%;
  padding: 14px 18px;
  border: var(--cyber-stroke) solid var(--ink);
  background: var(--hi);
  border-radius: 0;
  box-shadow: var(--cyber-drop-sm);
}

body[data-chat-theme="cyber"] .message-content table,
body[data-chat-theme="cyber"] .message-content th,
body[data-chat-theme="cyber"] .message-content td,
body[data-chat-theme="cyber"] .reasoning,
body[data-chat-theme="cyber"] .tool-call,
body[data-chat-theme="cyber"] .message-file,
body[data-chat-theme="cyber"] .attachment-card,
body[data-chat-theme="cyber"] .code-block-wrap {
  border-color: var(--ink);
  border-radius: 0;
}

body[data-chat-theme="cyber"] .message-content th,
body[data-chat-theme="cyber"] .code-block-header {
  background: var(--code-header-bg);
}

body[data-chat-theme="cyber"] .message-image {
  border: var(--cyber-stroke) solid var(--ink);
  border-radius: 0;
  box-shadow: var(--cyber-drop-sm);
}

body[data-chat-theme="cyber"] .composer-area {
  padding: 28px 20px 8px;
  background: transparent;
}

body[data-chat-theme="cyber"] .compare-context-banner:not(.hidden) {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 118px;
  z-index: 4;
  margin: 0;
  padding: 0 20px;
  pointer-events: auto;
}

body[data-chat-theme="cyber"] .composer {
  background: var(--code-bg);
  border: var(--cyber-stroke) solid var(--ink);
  border-radius: 0;
  box-shadow: var(--cyber-drop-md);
}

body[data-chat-theme="cyber"] .composer:focus-within {
  border-color: var(--ink);
  box-shadow: var(--cyber-drop-md);
}

body[data-chat-theme="cyber"] .composer textarea::placeholder {
  color: var(--text-tertiary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
}

body[data-chat-theme="cyber"] .composer-tool,
body[data-chat-theme="cyber"] .composer-model-btn,
body[data-chat-theme="cyber"] .compare-btn,
body[data-chat-theme="cyber"] .send-btn,
body[data-chat-theme="cyber"] .stop-btn,
body[data-chat-theme="cyber"] .preview-thumb,
body[data-chat-theme="cyber"] .preview-file {
  border-radius: 0;
  border: var(--cyber-stroke) solid var(--ink);
  box-shadow: var(--cyber-drop-sm);
}

body[data-chat-theme="cyber"] .composer-tool {
  width: 32px;
  height: 32px;
}

body[data-chat-theme="cyber"] .composer-model-btn,
body[data-chat-theme="cyber"] .compare-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

body[data-chat-theme="cyber"] .send-btn,
body[data-chat-theme="cyber"] .stop-btn {
  width: 34px;
  height: 34px;
}

body[data-chat-theme="cyber"] .composer-actions {
  gap: 6px;
}

body[data-chat-theme="cyber"] .composer-tool:hover,
body[data-chat-theme="cyber"] .composer-model-btn:hover:not(.pro-active),
body[data-chat-theme="cyber"] .compare-btn:hover:not(.active):not(.council-active) {
  background: var(--hi);
  transform: translate(1px, 1px);
  box-shadow: none;
}

body[data-chat-theme="cyber"] .composer-model-btn.pro-active,
body[data-chat-theme="cyber"] .compare-btn.active,
body[data-chat-theme="cyber"] .compare-btn.council-active {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-secondary));
}

body[data-chat-theme="cyber"] .composer-model-btn.pro-active:hover,
body[data-chat-theme="cyber"] .compare-btn.active:hover,
body[data-chat-theme="cyber"] .compare-btn.council-active:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-secondary));
  transform: translate(1px, 1px);
  box-shadow: none;
}

body[data-chat-theme="cyber"] .composer-plus-btn[aria-expanded="true"],
body[data-chat-theme="cyber"] .send-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

body[data-chat-theme="cyber"] .composer-action-menu,
body[data-chat-theme="cyber"] .composer-model-dropdown,
body[data-chat-theme="cyber"] .compare-dropdown,
body[data-chat-theme="cyber"] .settings-drawer,
body[data-chat-theme="cyber"] .account-drawer,
body[data-chat-theme="cyber"] .auth-dialog,
body[data-chat-theme="cyber"] .confirm-dialog,
body[data-chat-theme="cyber"] .rename-dialog {
  border: var(--cyber-stroke) solid var(--ink);
  border-radius: 0;
  box-shadow: var(--cyber-drop-md);
}

body[data-chat-theme="cyber"] .composer-action-menu-item,
body[data-chat-theme="cyber"] .model-option,
body[data-chat-theme="cyber"] .compare-mode-seg,
body[data-chat-theme="cyber"] .drawer-close,
body[data-chat-theme="cyber"] .document-viewer-action,
body[data-chat-theme="cyber"] .document-viewer-close {
  border-radius: 0;
}

body[data-chat-theme="cyber"] .composer-action-menu-item:hover,
body[data-chat-theme="cyber"] .model-option:hover,
body[data-chat-theme="cyber"] .model-option.active {
  background: var(--hi);
}

body[data-chat-theme="cyber"] .field-group input,
body[data-chat-theme="cyber"] .field-group textarea,
body[data-chat-theme="cyber"] .field-group select,
body[data-chat-theme="cyber"] .field-grid input {
  border: var(--cyber-stroke) solid var(--ink);
  border-radius: 0;
  background: var(--code-bg);
}

body[data-chat-theme="cyber"] .document-viewer,
body[data-chat-theme="cyber"] .document-viewer-header,
body[data-chat-theme="cyber"] .document-viewer-body {
  background: var(--paper-2);
}

/* ─── Chat Themes: Doodle Luxe ─── */
body[data-chat-theme="doodle"] .app-shell {
  position: relative;
  isolation: isolate;
  background: var(--paper);
}

body[data-mode="light"][data-chat-theme="doodle"] .app-shell::before {
  display: none;
}

body[data-chat-theme="doodle"] .app-shell > .chat-panel {
  position: relative;
  z-index: 1;
}

body[data-chat-theme="doodle"] .app-shell > .sidebar {
  z-index: 20;
}

body[data-chat-theme="doodle"] .chat-panel {
  background: var(--paper);
  isolation: isolate;
}

body[data-chat-theme="doodle"] .chat-panel::before {
  display: none;
}

body[data-mode="light"][data-chat-theme="doodle"] .chat-panel::before {
  display: none;
}

body[data-mode="dark"][data-chat-theme="doodle"] .chat-panel::before {
  display: none;
}

body[data-chat-theme="doodle"] .chat-panel::after {
  display: none;
}

body[data-mode="light"][data-chat-theme="doodle"] .chat-panel::after {
  display: none;
}

body[data-mode="dark"][data-chat-theme="doodle"] .chat-panel::after {
  display: none;
}

body[data-chat-theme="doodle"] .chat-panel > * {
  position: relative;
  z-index: 1;
}

body[data-chat-theme="doodle"] .chat-panel > .temporary-chat-bar {
  position: absolute;
  top: 28px;
  right: 34px;
  left: 34px;
  z-index: 9;
}

body[data-chat-theme="doodle"] .sidebar {
  margin: 18px 0 18px 18px;
  height: calc(100dvh - 36px);
  padding: 14px 0;
  background: var(--glass);
  border: 2px solid var(--ink);
  border-radius: 28px;
  box-shadow: 8px 8px 0 rgba(29, 27, 24, 0.18);
  backdrop-filter: blur(10px);
}

body[data-chat-theme="doodle"] .sidebar-top,
body[data-chat-theme="doodle"] .sidebar-bottom {
  padding: 4px 8px;
  align-items: flex-start;
}

body[data-chat-theme="doodle"] .sidebar-bottom {
  border-top: none;
}

body[data-chat-theme="doodle"] .sidebar-mid {
  padding: 8px 10px;
}

body[data-chat-theme="doodle"] .sidebar-icon,
body[data-chat-theme="doodle"] .conversation-row,
body[data-chat-theme="doodle"] .conversation-menu-btn {
  border-radius: 999px;
}

body[data-chat-theme="doodle"] .sidebar-icon:hover,
body[data-chat-theme="doodle"] .conversation-row:hover,
body[data-chat-theme="doodle"] .conversation-row.active {
  background: var(--hi);
  color: var(--plum-d);
  box-shadow: 3px 3px 0 rgba(29, 27, 24, 0.12);
}

body[data-chat-theme="doodle"] .guest-login-panel {
  border-top: 2px dashed var(--dot);
}

body[data-chat-theme="doodle"] .topbar {
  background: transparent;
  border-bottom: 0;
}

body[data-chat-theme="doodle"] .context-meter,
body[data-chat-theme="doodle"] .usage-pill {
  background: var(--glass-2);
  border: 1px solid var(--bdr);
  border-radius: 999px;
  color: var(--text-secondary);
}

body[data-chat-theme="doodle"] .messages {
  padding: 24px 24px 160px;
}

body[data-chat-theme="doodle"] .composer-area {
  padding: 0 24px 24px;
  background: transparent;
}

body[data-chat-theme="doodle"] .empty-state h1 {
  color: var(--ink);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0;
}

body[data-chat-theme="doodle"] .empty-state h1::after {
  content: "";
  display: block;
  width: min(260px, 70%);
  height: 10px;
  margin: 10px auto 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 6px 5px, var(--dot) 3px, transparent 4px) 0 0 / 18px 10px,
    var(--hi);
}

body[data-chat-theme="doodle"] .message {
  max-width: var(--content-max);
  width: 100%;
}

body[data-chat-theme="doodle"] .compare-message,
body[data-chat-theme="doodle"] .council-message {
  max-width: min(1480px, calc(100vw - 80px));
  width: 100%;
}

body[data-chat-theme="doodle"] .message.user {
  flex-direction: row-reverse;
}

body[data-chat-theme="doodle"] .message.user .message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: min(720px, 78%);
  margin-left: auto;
}

body[data-chat-theme="doodle"] .message-avatar {
  display: none;
}

body[data-chat-theme="doodle"] .message-meta {
  display: none;
}

body[data-chat-theme="doodle"] .message:not(.compare-message):not(.council-message) .message-content {
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

body[data-chat-theme="doodle"] .message.assistant:not(.compare-message):not(.council-message) .message-content {
  width: 100%;
}

body[data-chat-theme="doodle"] .message.user:not(.compare-message):not(.council-message) .message-content {
  width: fit-content;
  max-width: 100%;
  padding: 14px 18px;
  background: var(--paper-2);
  border: 1px solid var(--bdr);
  border-radius: 22px;
  box-shadow: none;
}

body[data-chat-theme="doodle"] .sidebar-profile-avatar {
  border: 2px solid var(--ink);
  background: var(--plum);
  box-shadow: 2px 2px 0 rgba(29, 27, 24, 0.15);
}

body[data-chat-theme="doodle"].sidebar-expanded .sidebar-profile-btn:hover {
  background: var(--hi);
  border-radius: 999px;
}

body[data-chat-theme="doodle"] .profile-menu {
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 8px 8px 0 rgba(29, 27, 24, 0.14);
}

body[data-chat-theme="doodle"] .profile-menu-item {
  border-radius: 999px;
}

body[data-chat-theme="doodle"] .profile-menu-item:hover {
  background: var(--hi);
}

body[data-chat-theme="doodle"] .message-content table,
body[data-chat-theme="doodle"] .message-file,
body[data-chat-theme="doodle"] .attachment-card,
body[data-chat-theme="doodle"] .reasoning,
body[data-chat-theme="doodle"] .tool-call,
body[data-chat-theme="doodle"] .code-block-wrap,
body[data-chat-theme="doodle"] .compare-card,
body[data-chat-theme="doodle"] .council-shell,
body[data-chat-theme="doodle"] .council-synthesis {
  border-color: var(--bdr);
  border-radius: 24px;
  box-shadow: 0 10px 24px rgba(32, 25, 36, 0.07);
}

body[data-chat-theme="doodle"] .message-content th,
body[data-chat-theme="doodle"] .code-block-header {
  background: var(--hi);
  color: var(--plum-d);
}

body[data-chat-theme="doodle"] .message-image {
  border: 2px solid #ffffff;
  border-radius: 24px;
  box-shadow: 0 12px 28px rgba(32, 25, 36, 0.12);
}

body[data-chat-theme="doodle"] .composer {
  background: var(--code-bg);
  border: 1.5px solid var(--ink);
  border-radius: 28px;
  padding: 18px 20px 14px;
  box-shadow: 0 16px 40px rgba(32, 25, 36, 0.12);
  backdrop-filter: blur(10px);
}

body[data-chat-theme="doodle"] .composer:focus-within {
  border-color: var(--ink);
  box-shadow: 0 16px 40px rgba(32, 25, 36, 0.12);
}

body[data-chat-theme="doodle"] .composer-tool,
body[data-chat-theme="doodle"] .composer-model-btn,
body[data-chat-theme="doodle"] .compare-btn,
body[data-chat-theme="doodle"] .send-btn,
body[data-chat-theme="doodle"] .stop-btn,
body[data-chat-theme="doodle"] .preview-thumb,
body[data-chat-theme="doodle"] .preview-file {
  border-radius: 999px;
}

body[data-chat-theme="doodle"] .composer-tool:hover,
body[data-chat-theme="doodle"] .composer-model-btn:hover:not(.pro-active),
body[data-chat-theme="doodle"] .compare-btn:hover:not(.active):not(.council-active),
body[data-chat-theme="doodle"] .composer-plus-btn[aria-expanded="true"] {
  background: var(--hi);
  color: var(--plum-d);
}

body[data-chat-theme="doodle"] .composer-model-btn.pro-active,
body[data-chat-theme="doodle"] .compare-btn.active,
body[data-chat-theme="doodle"] .compare-btn.council-active {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-secondary));
  color: var(--text);
}

body[data-chat-theme="doodle"] .composer-model-btn.pro-active:hover,
body[data-chat-theme="doodle"] .compare-btn.active:hover,
body[data-chat-theme="doodle"] .compare-btn.council-active:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-secondary));
  color: var(--text);
}

body[data-chat-theme="doodle"] .send-btn.active {
  background: var(--plum);
  color: #ffffff;
}

body[data-chat-theme="doodle"] .composer-action-menu,
body[data-chat-theme="doodle"] .composer-model-dropdown,
body[data-chat-theme="doodle"] .compare-dropdown,
body[data-chat-theme="doodle"] .settings-drawer,
body[data-chat-theme="doodle"] .account-drawer,
body[data-chat-theme="doodle"] .auth-dialog,
body[data-chat-theme="doodle"] .confirm-dialog,
body[data-chat-theme="doodle"] .rename-dialog {
  border: 1px solid var(--bdr);
  border-radius: 28px;
  box-shadow: 0 22px 52px rgba(32, 25, 36, 0.16);
}

body[data-chat-theme="doodle"] .composer-action-menu-item,
body[data-chat-theme="doodle"] .model-option,
body[data-chat-theme="doodle"] .compare-mode-seg,
body[data-chat-theme="doodle"] .drawer-close,
body[data-chat-theme="doodle"] .document-viewer-action,
body[data-chat-theme="doodle"] .document-viewer-close {
  border-radius: 999px;
}

body[data-chat-theme="doodle"] .composer-action-menu-item:hover,
body[data-chat-theme="doodle"] .model-option:hover,
body[data-chat-theme="doodle"] .model-option.active {
  background: var(--hi);
}

body[data-chat-theme="doodle"] .field-group input,
body[data-chat-theme="doodle"] .field-group textarea,
body[data-chat-theme="doodle"] .field-group select,
body[data-chat-theme="doodle"] .field-grid input {
  border: 1px solid var(--code-border);
  border-radius: 18px;
  background: var(--code-bg);
}

body[data-chat-theme="doodle"] .document-viewer,
body[data-chat-theme="doodle"] .document-viewer-header,
body[data-chat-theme="doodle"] .document-viewer-body {
  background: var(--paper);
}

@keyframes preview-spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

.preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,0.55);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.preview-thumb:hover .preview-remove {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Lightbox ─── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.80);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: pointer;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.25);
}

/* ─── Footer ─── */
.app-footer {
  text-align: center;
  padding: 8px 0 2px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Settings Drawer ─── */
.settings-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: transparent;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.settings-drawer.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.settings-panel {
  width: min(640px, 100%);
  max-height: calc(100dvh - 64px);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.settings-section {
  margin-top: 24px;
}

.settings-section h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.theme-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.theme-preview {
  --tp-bg: #fff;
  --tp-panel: #f8f8f8;
  --tp-surface: #fff;
  --tp-muted: #f0f0f0;
  --tp-border: #e2e2e2;
  --tp-ink: #111;
  --tp-accent: #111;
  --tp-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
  font: inherit;
  color: inherit;
}

.theme-preview:hover {
  transform: translateY(-1px);
}

.theme-preview[aria-checked="true"] {
  border-color: var(--tp-accent, var(--accent));
}

.theme-preview-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.theme-preview[data-theme="classic"] {
  --tp-bg: #ffffff;
  --tp-panel: #f7f7f8;
  --tp-surface: #ffffff;
  --tp-muted: #f1f1f2;
  --tp-border: #dddddf;
  --tp-ink: #141414;
  --tp-accent: #111111;
  --tp-radius: 10px;
}

.theme-preview[data-theme="cyber"] {
  --tp-bg: #fef9f0;
  --tp-panel: #f2ede4;
  --tp-surface: #fffaf2;
  --tp-muted: #ebe4d9;
  --tp-border: #101010;
  --tp-ink: #101010;
  --tp-accent: #101010;
  --tp-radius: 0;
}

.theme-preview[data-theme="doodle"] {
  --tp-bg: #f9f9fc;
  --tp-panel: rgba(255, 255, 255, 0.76);
  --tp-surface: rgba(255, 255, 255, 0.9);
  --tp-muted: #ece7ef;
  --tp-border: #d5cfd8;
  --tp-ink: #1a1c1e;
  --tp-accent: #665b68;
  --tp-radius: 18px;
}

.theme-preview-mock {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--tp-radius);
  overflow: hidden;
  background: var(--tp-bg);
  border: 1px solid var(--tp-border);
  display: flex;
}

.tpm-sidebar {
  width: 14%;
  background: var(--tp-panel);
  border-right: 1px solid var(--tp-border);
  position: relative;
}

.tpm-sidebar::before,
.tpm-sidebar::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
}

.tpm-sidebar::before {
  top: 10px;
  width: 7px;
  height: 7px;
  background: var(--tp-ink);
  opacity: 0.86;
  box-shadow: 0 14px 0 color-mix(in srgb, var(--tp-ink) 56%, transparent),
    0 28px 0 color-mix(in srgb, var(--tp-ink) 38%, transparent);
}

.tpm-sidebar::after {
  bottom: 8px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
}

.tpm-main {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tpm-main::before {
  content: "";
  width: 54%;
  height: 6px;
  border-radius: 999px;
  background: var(--tp-muted);
}

.tpm-bubble {
  height: 8px;
  border-radius: 4px;
  position: relative;
}

.tpm-bubble.user {
  align-self: flex-end;
  width: 36%;
  background: var(--tp-accent);
}

.tpm-bubble.assistant {
  width: 68%;
  background: var(--tp-muted);
}

.tpm-bubble.assistant::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 0;
  width: 78%;
  height: 7px;
  border-radius: inherit;
  background: var(--tp-muted);
}

.tpm-composer {
  margin-top: auto;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--tp-border);
  background: var(--tp-surface);
  position: relative;
}

.tpm-composer::before,
.tpm-composer::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
}

.tpm-composer::before {
  left: 7px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--tp-border);
}

.tpm-composer::after {
  right: 5px;
  width: 9px;
  height: 9px;
  background: var(--tp-accent);
  opacity: 0.72;
}

.theme-preview[data-theme="cyber"] .theme-preview-mock {
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--tp-border);
}

.theme-preview[data-theme="cyber"] .tpm-bubble,
.theme-preview[data-theme="cyber"] .tpm-composer,
.theme-preview[data-theme="cyber"] .tpm-composer::before,
.theme-preview[data-theme="cyber"] .tpm-composer::after {
  border-radius: 0;
}

.theme-preview[data-theme="cyber"] .tpm-bubble.user {
  height: 7px;
}

.theme-preview[data-theme="cyber"] .tpm-composer {
  border-width: 1.5px;
}

.theme-preview[data-theme="doodle"] .theme-preview-mock {
  background:
    radial-gradient(color-mix(in srgb, var(--tp-accent) 22%, transparent) 0.7px, transparent 0.8px) 0 0 / 16px 16px,
    var(--tp-bg);
  box-shadow: 0 8px 18px rgba(102, 91, 104, 0.1);
}

.theme-preview[data-theme="doodle"] .tpm-composer {
  box-shadow: 0 4px 10px rgba(102, 91, 104, 0.1);
}

.appearance-pill {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
}

.appearance-pill button {
  flex: 1;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.appearance-pill button:hover {
  color: var(--text);
}

.appearance-pill button[aria-checked="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.account-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(420px, 100vw);
  padding: 20px 24px;
  background: var(--bg);
  border-left: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--transition);
  z-index: 40;
  overflow-y: auto;
}

.account-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 16px;
}

.drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background var(--transition);
}

.drawer-close:hover {
  background: var(--bg-secondary);
}

.field-group {
  margin-bottom: 20px;
}

.field-group label,
.field-grid span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  border-color: var(--accent);
}

.field-group textarea {
  resize: vertical;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.field-grid label {
  display: grid;
  gap: 6px;
}

.field-grid input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.field-grid input:focus {
  border-color: var(--accent);
}

.model-details {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: grid;
  gap: 8px;
}

.model-details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.model-details span {
  color: var(--text-tertiary);
}

.model-details strong {
  font-weight: 500;
}

/* ─── Account Drawer ─── */
.account-info {
  margin-bottom: 20px;
}

.account-info .account-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.account-info .account-detail {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0;
}

.account-usage {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.account-usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.account-usage-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.account-usage-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.account-usage-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

.account-usage-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--transition);
}

.account-usage-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

.signout-btn {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: background var(--transition);
}

.signout-btn:hover {
  background: var(--bg-secondary);
}

.admin-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.admin-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.admin-load {
  width: 100%;
  height: 36px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  transition: background var(--transition);
}

.admin-load:hover {
  background: var(--border-light);
}

.admin-output {
  margin-top: 10px;
  max-height: min(620px, calc(100dvh - 260px));
  overflow: auto;
  color: var(--text);
}

.admin-output:empty { display: none; }

.admin-meta {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-stat {
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.admin-stat-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.admin-stat-label {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.admin-subtitle {
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-plan-row,
.admin-user-row {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border-light);
}

.admin-plan-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border-light);
}

.admin-payment-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.admin-small-btn {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
}

.admin-small-btn.danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.admin-row-title {
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.admin-row-metric {
  align-self: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.admin-user-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.admin-status.active {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

/* ─── Confirm Dialog ─── */
.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 45;
}

.confirm-dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.confirm-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: #fef2f2;
  color: var(--danger);
}

.confirm-copy {
  min-width: 0;
}

.confirm-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
}

.confirm-copy p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.confirm-cancel,
.confirm-danger {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
}

.confirm-cancel {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
}

.confirm-cancel:hover {
  background: var(--bg-secondary);
}

.confirm-danger {
  color: white;
  background: var(--danger);
}

.confirm-danger:hover {
  background: #dc2626;
}

/* ─── Rename Dialog ─── */
.rename-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 14px;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 45;
}

.rename-dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.rename-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
}

.rename-field {
  margin: 0;
}

.rename-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rename-cancel,
.rename-save {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
}

.rename-cancel {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
}

.rename-cancel:hover {
  background: var(--bg-secondary);
}

.rename-save {
  color: white;
  background: var(--text);
  border: 1px solid var(--text);
}

.rename-save:hover {
  background: var(--accent-hover);
}

/* ─── Sign-in Dialog ─── */
.auth-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 32px));
  padding: 36px 26px 28px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 45;
}

.auth-dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.auth-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-secondary);
}

.auth-dialog-close:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.auth-dialog h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.auth-dialog p {
  margin: 0 auto 24px;
  max-width: 300px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

.auth-dialog .auth-google {
  display: flex;
  justify-content: center;
}

.auth-dialog .auth-notice {
  margin-top: 12px;
}

/* ─── Search dialog ─── */
.search-dialog {
  position: fixed;
  top: 12vh;
  left: 50%;
  z-index: 40;
  display: none;
  width: min(560px, calc(100vw - 32px));
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.search-dialog:not(.hidden) {
  display: block;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

.search-dialog-inner {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-dialog-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.search-dialog-icon {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.search-dialog-input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.search-dialog-input-wrap input::placeholder {
  color: var(--text-tertiary);
}

.search-dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.search-dialog-close:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.search-dialog-results {
  max-height: min(420px, 58vh);
  overflow-y: auto;
  padding: 6px;
}

.search-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-row:hover,
.search-result-row.active {
  background: var(--bg-secondary);
}

.search-result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.search-result-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.search-result-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-meta {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

.search-dialog-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ─── Overlay & Toast ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.24);
  z-index: 35;
  backdrop-filter: blur(2px);
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: var(--radius);
  color: var(--accent-contrast);
  background: var(--accent);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 70;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

body.chat-empty .messages {
  padding-bottom: 240px;
}

body.chat-empty .empty-state {
  justify-content: flex-start;
  height: auto;
  min-height: 100%;
  padding-top: calc(50dvh - 214px);
  padding-bottom: 0;
}

body.chat-empty .empty-state h1 {
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0;
}

body.chat-empty .composer-wrap {
  max-width: min(820px, calc(100vw - 48px));
}

body.chat-empty .composer {
  padding: 12px 14px 10px;
  border-radius: 28px;
}

body.chat-empty .composer textarea {
  min-height: 26px;
  font-size: 15px;
  line-height: 1.45;
}

body.chat-empty .composer-bottom {
  margin-top: 8px;
}

body.chat-empty .composer-area {
  top: calc(50dvh - 72px);
  bottom: auto;
  padding: 0 24px;
}

body.chat-empty[data-chat-theme="doodle"] .empty-state h1::after {
  display: none;
}

body.chat-empty[data-chat-theme="cyber"] .composer-area,
body.chat-empty[data-chat-theme="doodle"] .composer-area {
  top: calc(50dvh - 72px);
  bottom: auto;
  padding-inline: 24px;
}

/* ─── Responsive ─── */
@media (max-width: 1180px) {
  :root {
    --content-max: 860px;
    --composer-max: 860px;
    --document-viewer-w: min(520px, 44vw);
  }

  body.sidebar-expanded:not(.guest-mode) {
    --sidebar-active-w: 220px;
  }

  .message,
  .composer-wrap {
    max-width: min(var(--content-max), calc(100vw - var(--sidebar-active-w) - 32px));
  }

  .compare-message,
  .council-message {
    max-width: calc(100vw - var(--sidebar-active-w) - 32px);
  }

  .composer-actions {
    gap: 6px;
  }
}

@media (max-width: 980px) {
  :root {
    --content-max: 760px;
    --composer-max: 760px;
  }

  body.document-viewer-open .app-shell {
    grid-template-columns: var(--sidebar-active-w) minmax(0, 1fr);
  }

  body.document-viewer-open .document-viewer {
    position: fixed;
    inset: 0 0 0 var(--sidebar-active-w);
    z-index: 55;
    width: auto;
    max-width: none;
    box-shadow: var(--shadow-lg);
  }

  body.document-viewer-open .document-viewer-resizer {
    display: none;
  }

  .compare-grid,
  .council-panel-grid {
    grid-template-columns: 1fr;
  }

  .council-stages {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .council-stage-sep {
    display: none;
  }
}

@media (max-width: 860px) {
  body.sidebar-expanded:not(.guest-mode) {
    --sidebar-active-w: var(--sidebar-w);
  }

  .composer-bottom {
    align-items: flex-end;
    gap: 8px;
  }

  .composer-actions {
    flex-wrap: wrap;
  }

  .composer-model-wrap {
    max-width: min(220px, 58vw);
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-w-expanded: 211px;
    --content-max: 680px;
    --composer-max: 680px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  body.guest-mode .app-shell {
    grid-template-columns: 1fr;
  }

  body.document-viewer-open .app-shell {
    grid-template-columns: 1fr;
  }

  .document-viewer {
    position: fixed;
    inset: 0;
    z-index: 60;
    width: 100vw;
    height: 100dvh;
    border-left: 0;
  }

  body.document-viewer-open .document-viewer {
    inset: 0;
  }

  .document-viewer-resizer {
    display: none;
  }

  .document-viewer-header {
    height: 52px;
    padding: 0 12px;
  }

  .document-viewer-body {
    padding: 10px;
  }

  .pdf-pages {
    gap: 10px;
  }

  .pdf-page {
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 0;
    transform: translateX(-100%);
    border-right: none;
    box-shadow: var(--shadow-lg);
    transition: transform 220ms ease, width 220ms ease;
  }

  body.sidebar-open .sidebar {
    width: var(--sidebar-w-expanded);
    transform: translateX(0);
  }

  body.guest-mode .sidebar {
    width: 0;
    transform: translateX(-100%);
  }

  body.guest-mode.sidebar-open .sidebar {
    width: var(--sidebar-w-expanded);
    transform: translateX(0);
  }

  .topbar {
    height: 48px;
    padding: 0 12px;
  }

  .messages {
    padding: 16px 12px 140px;
  }

  .message,
  .composer-wrap {
    max-width: 100%;
  }

  body.chat-empty .messages {
    padding-bottom: 220px;
  }

  body.chat-empty .empty-state {
    padding-top: calc(50dvh - 198px);
  }

  .empty-state h1 {
    font-size: 28px;
  }

  body.chat-empty .empty-state h1 {
    font-size: 24px;
    font-weight: 400;
    line-height: 1.25;
  }

  .composer-area {
    padding: 0 12px 8px;
  }

  body.chat-empty .composer-area {
    top: calc(50dvh - 72px);
    padding: 0 12px;
  }

  .compare-context-banner {
    padding: 0 12px;
    margin-bottom: 8px;
  }

  .compare-context-card {
    flex-direction: column;
    align-items: stretch;
  }

  .compare-context-actions {
    justify-content: stretch;
  }

  .compare-context-primary,
  .compare-context-secondary,
  .compare-context-cancel {
    width: 100%;
  }

  .composer {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px 8px;
  }

  .composer textarea {
    min-height: 24px;
    max-height: 200px;
    font-size: 15px;
  }

  .composer-bottom {
    position: static;
    margin-top: 8px;
    gap: 8px;
    min-height: 32px;
    padding-right: 46px;
  }

  .composer-actions {
    flex: 1;
    overflow: hidden;
    max-width: 100%;
  }

  .composer-model-wrap {
    max-width: min(150px, 38vw);
  }

  .compare-btn {
    height: 32px;
    max-width: 116px;
    padding: 0 10px;
  }

  .compare-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-message {
    max-width: 100%;
  }

  .composer-tool,
  .composer-model-btn {
    height: 32px;
  }

  .composer-tool {
    width: 32px;
  }

  .send-btn,
  .stop-btn {
    width: 32px;
    height: 32px;
  }

  .composer-send {
    position: absolute;
    right: 16px;
    bottom: 8px;
    margin-left: 0;
    z-index: 2;
  }

  .message {
    gap: 10px;
    margin-bottom: 24px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .message-content {
    font-size: 15px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .auth-panel h1 {
    font-size: 22px;
  }

  body[data-chat-theme="cyber"] .sidebar-top,
  body[data-chat-theme="cyber"] .sidebar-bottom {
    padding: 4px 8px;
    align-items: flex-start;
  }

  body[data-chat-theme="cyber"] .sidebar {
    margin: 0;
    height: 100dvh;
    box-shadow: var(--cyber-drop-md);
  }

  body[data-chat-theme="cyber"] .chat-panel {
    margin: 0;
    height: 100dvh;
    border-width: 0;
    box-shadow: none;
  }

  body[data-chat-theme="cyber"] .chat-panel::before {
    height: 0;
    border-bottom-width: 1px;
  }

  body[data-chat-theme="cyber"] .topbar {
    height: 48px;
    padding: 0 12px;
  }

  body[data-chat-theme="cyber"] .topbar::before {
    content: "BUFFER: READY";
    font-size: 10px;
  }

  body[data-chat-theme="cyber"] .messages {
    margin: 0;
    padding: 10px 12px 140px;
  }

  body[data-chat-theme="cyber"] .compare-message,
  body[data-chat-theme="cyber"] .council-message {
    max-width: calc(100vw - 24px);
  }

  body[data-chat-theme="cyber"] .message:not(.compare-message):not(.council-message) .message-content {
    max-width: 100%;
  }

  body[data-chat-theme="cyber"] .composer-area {
    padding: 24px 12px 6px;
  }

  body[data-chat-theme="cyber"] .compare-context-banner:not(.hidden) {
    bottom: 108px;
    padding: 0 12px;
  }

  body[data-chat-theme="cyber"] .composer {
    box-shadow: var(--cyber-drop-md);
  }

  body[data-chat-theme="doodle"] .sidebar-top,
  body[data-chat-theme="doodle"] .sidebar-bottom {
    padding: 4px 8px;
    align-items: flex-start;
  }

  body[data-chat-theme="doodle"] .sidebar {
    margin: 0;
    height: 100dvh;
    border-radius: 0 28px 28px 0;
  }

  body[data-chat-theme="doodle"] .messages {
    padding: 18px 12px 140px;
  }

  body[data-chat-theme="doodle"] .compare-message,
  body[data-chat-theme="doodle"] .council-message {
    max-width: calc(100vw - 24px);
  }

  body[data-chat-theme="doodle"] .empty-state h1 {
    font-size: 28px;
  }

  body[data-chat-theme="doodle"] .message:not(.compare-message):not(.council-message) .message-content {
    max-width: 100%;
  }

  body[data-chat-theme="doodle"] .composer-area {
    padding: 0 12px 12px;
  }

  body[data-chat-theme="doodle"] .composer {
    border-radius: 24px;
    padding: 16px 16px 12px;
  }

}

body.chat-empty[data-chat-theme="doodle"] .app-shell,
body.chat-empty[data-chat-theme="doodle"] .chat-panel {
  background: var(--paper);
}

body.chat-empty[data-chat-theme="doodle"] .app-shell::before,
body.chat-empty[data-chat-theme="doodle"] .chat-panel::before,
body.chat-empty[data-chat-theme="doodle"] .chat-panel::after {
  display: none;
}

body.chat-empty[data-chat-theme="doodle"] .composer-area {
  position: absolute;
  top: calc(50dvh - 94px);
  right: 0;
  bottom: auto;
  left: 0;
  z-index: 8;
  display: block;
  visibility: visible;
  opacity: 1;
  padding: 0 24px;
  pointer-events: none;
}

body.chat-empty[data-chat-theme="doodle"] .composer-wrap {
  pointer-events: auto;
}

body.chat-empty[data-chat-theme="doodle"] .composer {
  background: var(--code-bg);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

body.chat-empty[data-chat-theme="cyber"] .empty-state h1,
body.chat-empty[data-chat-theme="doodle"] .empty-state h1 {
  font-family: var(--font-sans);
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
}

body.chat-empty[data-chat-theme="doodle"] .composer {
  border-radius: 28px;
  padding: 12px 14px 10px;
}

@media (max-width: 768px) {
  body.chat-empty[data-chat-theme="doodle"] .composer-area {
    top: calc(50dvh - 90px);
    padding: 0 12px;
  }
}
