/*
 * ClawPad Web Demo -- Component Stylesheet
 * Telegram-style 3-panel chat layout.
 * Depends on tokens.css for all CSS custom properties.
 *
 * Fonts: Inter (sans-serif), IBM Plex Mono (monospace)
 */

/* ── Google Fonts ────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&family=Noto+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&family=Noto+Sans+JP:wght@400;500;700&family=Noto+Sans+KR:wght@400;500;700&display=swap');

/* ── 1. Global / Reset ───────────────────────────────────── */

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

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

::selection {
  background: var(--selection-bg);
  color: var(--ink);
}
::-moz-selection {
  background: var(--selection-bg);
  color: var(--ink);
}

code, pre {
  font-family: var(--font-mono);
}

a {
  color: var(--brand);
  text-decoration: none;
}

button, a, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Utility ─────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── 2. Demo Shell ───────────────────────────────────────── */

#demo-shell {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px 1fr 220px;
  background: var(--gradient-body, var(--bg));
}

/* ── 3. Welcome Overlay ──────────────────────────────────── */

.demo-welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(11, 16, 32, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.demo-welcome-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px;
  max-width: 560px;
  width: 100%;
}

.welcome-logo {
  font-size: 64px;
  margin-bottom: 16px;
  line-height: 1;
}

.welcome-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-size: 16px;
  color: var(--ink-soft);
  text-shadow: var(--text-shadow-soft);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.welcome-prompts {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin: 32px 0;
  width: 100%;
  justify-content: center;
}

.welcome-prompt-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  flex: 1;
  max-width: 220px;
  text-align: left;
}

.welcome-prompt-card:hover {
  background: var(--hover-bg);
  border-color: var(--brand);
  transform: translateY(-2px);
}

.welcome-prompt-card:active {
  transform: scale(0.97);
}

.welcome-prompt-card .prompt-icon {
  font-size: 20px;
  margin-bottom: 8px;
  display: block;
}

.welcome-prompt-card .prompt-text {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.4;
}

.welcome-start-btn {
  background: var(--gradient-brand);
  color: var(--btn-primary-text);
  border: none;
  border-radius: var(--radius-full);
  padding: 14px 48px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-glow);
}

.welcome-start-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 32px rgba(242, 201, 76, 0.3), 0 0 12px rgba(242, 201, 76, 0.15);
}

.welcome-start-btn:active {
  transform: scale(0.97);
}

.welcome-download-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-muted);
  text-shadow: var(--text-shadow-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.welcome-download-link:hover {
  color: var(--ink-soft);
}

.welcome-ephemeral-note {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 16px;
  opacity: 0.85;
  text-shadow: var(--text-shadow-muted);
}

/* ── 4. Sidebar ──────────────────────────────────────────── */

.demo-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.new-topic-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--btn-primary);
  color: var(--btn-primary-text);
  font-size: 18px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.2s ease;
}

.new-topic-btn:hover {
  background: var(--btn-primary-hover);
}

.new-topic-btn:active {
  transform: scale(0.9);
}

.sidebar-search {
  padding: 8px 16px;
  flex-shrink: 0;
}

.sidebar-search .search-wrap {
  position: relative;
}

.sidebar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--input-placeholder);
  transform: translateY(-50%);
  pointer-events: none;
}

.sidebar-search .search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--input-text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-search .search-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(242, 201, 76, 0.1);
}

.sidebar-search .search-input::placeholder {
  color: var(--input-placeholder);
}

.topic-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface) transparent;
}

.topic-list::-webkit-scrollbar {
  width: 4px;
}
.topic-list::-webkit-scrollbar-track {
  background: transparent;
}
.topic-list::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 2px;
}

.topic-item {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s ease;
}

.topic-item:hover {
  background: var(--hover-bg);
}

.topic-item.active {
  background: var(--active-bg);
  border-left: 3px solid var(--brand);
}

.topic-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface) 0%, var(--hover-bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--brand);
  flex-shrink: 0;
}

.topic-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.topic-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.topic-preview {
  font-size: 12px;
  color: var(--ink-soft);
  text-shadow: var(--text-shadow-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  margin-top: 2px;
}

.topic-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  gap: 4px;
}

.topic-time {
  font-size: 11px;
  color: var(--ink-muted);
  text-shadow: var(--text-shadow-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.topic-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--brand);
  color: var(--ink-on-brand);
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-top: 4px;
}

.topic-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
}

.topic-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.topic-empty-text {
  font-size: 13px;
  color: var(--ink-muted);
  text-shadow: var(--text-shadow-muted);
}

.sidebar-teasers {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.teasers-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-shadow: var(--text-shadow-soft);
  margin-bottom: 10px;
}

.teaser-card {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  opacity: 1;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  align-items: center;
}

.teaser-card:hover {
  border-color: var(--brand);
  background: var(--active-bg);
  transform: translateY(-1px);
}

.teaser-card .teaser-icon {
  font-size: 20px;
  color: var(--brand);
  text-shadow: var(--text-shadow-soft);
  flex-shrink: 0;
  line-height: 1;
}

.teaser-card .teaser-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-shadow: var(--text-shadow-soft);
  flex: 1;
  min-width: 0;
}

.teaser-card .teaser-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--ink-on-brand);
  text-shadow: none;
  flex-shrink: 0;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.theme-toggle-btn {
  width: 100%;
  padding: 10px;
  background: var(--btn-secondary);
  color: var(--btn-secondary-text);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--btn-secondary-hover);
}

.theme-toggle-btn:active {
  transform: scale(0.98);
}

/* ── 5. Main Chat Area ───────────────────────────────────── */

.demo-main {
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  overflow: hidden;
  min-width: 0;
}

.demo-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--glass-bg-heavy);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  min-height: 52px;
}

.mobile-menu-btn {
  display: none;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--icon-color);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.header-model-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink-soft);
  text-shadow: var(--text-shadow-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
}

.header-action-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.header-action-btn:hover {
  background: var(--hover-bg);
  color: var(--ink);
  border-color: var(--brand);
}

.header-action-btn:active {
  transform: scale(0.97);
}

.header-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.theme-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--icon-color);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.theme-btn:hover {
  color: var(--icon-hover);
}

/* ── 6. Messages Area ────────────────────────────────────── */

.demo-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--surface) transparent;
}

.demo-messages::-webkit-scrollbar {
  width: 6px;
}
.demo-messages::-webkit-scrollbar-track {
  background: transparent;
}
.demo-messages::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 3px;
}
.demo-messages::-webkit-scrollbar-thumb:hover {
  background: var(--hover-bg);
}

/* ── 7. Message Bubbles (PWA parity) ─────────────────────── */

.message-row {
  display: flex;
  padding: 2px 16px;
  animation: fadeIn 0.15s ease-out;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  cursor: pointer;
}

.message-bubble.copied-flash {
  outline: 2px solid var(--ok);
  outline-offset: -2px;
  transition: outline-color 0.6s ease;
}

.message-row.user .message-bubble {
  background: var(--gradient-user-bubble, var(--bubble-user));
  color: var(--bubble-user-text);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message-row.assistant .message-bubble {
  background: var(--bubble-ai);
  color: var(--bubble-ai-text);
  border-bottom-left-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.message-bubble .msg-time {
  display: block;
  font-size: 11px;
  color: var(--timestamp);
  margin-top: 4px;
  text-align: right;
  opacity: 0.92;
  text-shadow: var(--text-shadow-soft);
}

.msg-content .tts-word-highlight {
  background: rgba(242, 201, 76, 0.32);
  border-radius: 3px;
  padding: 0 1px;
}

/* ── Markdown inside bubbles ─────────────────────────────── */

.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble strong { font-weight: 600; }
.message-bubble em { font-style: italic; }
.message-bubble del { opacity: 0.6; }
.message-bubble h2 { font-size: 16px; font-weight: 600; margin: 12px 0 6px; }
.message-bubble h3 { font-size: 15px; font-weight: 600; margin: 10px 0 4px; }
.message-bubble h4 { font-size: 14px; font-weight: 600; margin: 8px 0 4px; }
.message-bubble hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.message-bubble a { color: var(--brand); text-decoration: underline; }
.message-bubble blockquote {
  border-left: 3px solid var(--brand);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--ink-soft);
  font-style: italic;
}

/* Inline code */
.message-bubble .inline-code,
.message-bubble code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font-mono);
}

/* Code blocks */
.code-block {
  position: relative;
  margin: 8px -4px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: none;
  border: none;
}

.code-block code {
  background: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
}

.code-lang {
  display: inline-block;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-copy-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  z-index: 1;
}

.code-copy-btn:hover,
.code-copy-btn:active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.code-copy-btn.copied {
  color: var(--ok);
}

.code-copy-btn svg {
  width: 12px;
  height: 12px;
}

/* Syntax highlighting */
.hl-kw  { color: #c678dd; }
.hl-str { color: #98c379; }
.hl-cmt { color: #5c6370; font-style: italic; }
.hl-num { color: #d19a66; }
.hl-key { color: #61afef; }

/* Tables inside bubbles */
.md-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0;
}

.message-bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.message-bubble th,
.message-bubble td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}

.message-bubble th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.message-bubble pre {
  margin: 8px 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  overflow-x: auto;
}

.message-bubble ul, .message-bubble ol {
  padding-left: 20px;
  margin: 6px 0;
}

.message-bubble li { margin-bottom: 2px; }

/* Streaming cursor */
.streaming-cursor::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--brand);
  margin-left: 2px;
  animation: blink 1s infinite;
  vertical-align: text-bottom;
  border-radius: 1px;
}

/* Typing indicator bubble */
.typing-bubble {
  background: var(--bubble-ai) !important;
  padding: 6px 14px !important;
}

/* Thinking indicator */
.thinking-bubble {
  background: var(--bubble-ai) !important;
  opacity: 0.7;
  padding: 16px 18px !important;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thinking-label {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
}

.thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-muted);
  animation: thinkPulse 1.5s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.3s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.6s; }

/* Message bottom row (badges + timestamp) */
.msg-bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.msg-bottom-row .msg-time {
  margin-top: 0;
  margin-left: auto;
}

.tts-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.tts-btn:hover {
  opacity: 1;
  background: var(--hover-bg);
}

.tts-btn:active {
  transform: scale(0.95);
}

.tts-btn.tts-playing,
.tts-btn.tts-paused {
  color: var(--brand);
  opacity: 1;
}

.tts-btn.tts-loading {
  color: var(--brand);
  opacity: 0.9;
}

/* Share / model badges */
.share-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.model-badge b {
  font-weight: 700;
  font-size: 11px;
}

.badge-sep {
  opacity: 0.4;
  font-size: 11px;
  margin: 0 1px;
}

.model-badge.local {
  background: rgba(60, 207, 122, 0.15);
  color: var(--ok);
}

.model-badge.cloud {
  background: rgba(242, 201, 76, 0.12);
  color: var(--brand);
}

.model-badge .badge-icon {
  font-size: 12px;
  margin-right: 2px;
}

/* TTS teaser button on assistant messages */
.tts-teaser-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.35;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s ease, background 0.2s ease;
  color: var(--ink-soft);
}

.tts-teaser-btn:hover {
  opacity: 0.6;
  background: var(--hover-bg);
}

/* ── 8. Input Area ───────────────────────────────────────── */

.demo-input {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  background: var(--glass-bg-heavy);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.demo-input .attach-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s ease;
  font-size: 16px;
}

.demo-input .attach-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.demo-input .chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 8px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-xl);
  color: var(--input-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  outline: none;
  overflow-y: auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.demo-input .chat-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(242, 201, 76, 0.12);
}

.demo-input .chat-input::placeholder {
  color: var(--input-placeholder);
}

.demo-input .mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.demo-input .mic-btn:hover {
  color: var(--ink);
  background: var(--hover-bg);
}

.demo-input .mic-btn:active {
  transform: scale(0.92);
}

.demo-input .mic-btn svg {
  width: 18px;
  height: 18px;
}

.demo-input .mic-btn.listening {
  color: var(--btn-danger);
  background: rgba(239, 68, 68, 0.15);
}

.demo-input .mic-btn.transcribing {
  color: var(--ink);
  background: var(--hover-bg);
}

.demo-input .mic-btn.disabled,
.demo-input .mic-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
}

.demo-input .send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-brand, var(--btn-primary));
  color: var(--btn-primary-text);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.demo-input .send-btn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

.demo-input .send-btn:active {
  transform: scale(0.9);
}

.demo-input .send-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.demo-input .stop-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--btn-danger);
  color: var(--btn-danger-text);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
  animation: fadeIn 0.15s ease-out;
}
.demo-input .stop-btn:hover { background: var(--btn-danger-hover); }
.demo-input .stop-btn:active { transform: scale(0.9); }

/* ── 9. CTA Rail ─────────────────────────────────────────── */

.demo-cta-rail {
  background: var(--sidebar-bg);
  border-left: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.cta-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.cta-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.cta-card-text {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 16px;
}

.cta-download-btn {
  width: 100%;
  padding: 12px;
  background: var(--gradient-brand);
  color: var(--btn-primary-text);
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.cta-download-btn:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-glow);
}

.cta-download-btn:active {
  transform: scale(0.97);
}

.msg-counter {
  text-align: center;
}

.msg-counter-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
  display: block;
}

.msg-counter-label {
  font-size: 12px;
  color: var(--ink-muted);
  text-shadow: var(--text-shadow-muted);
}

.youtube-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.youtube-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.youtube-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.youtube-more-link {
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}

.youtube-more-link:hover {
  text-decoration: underline;
}

.youtube-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.youtube-card {
  display: flex;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
}

.youtube-thumb-link {
  flex: 0 0 108px;
  height: 61px;
  border-radius: 8px;
  overflow: hidden;
  display: block;
  background: rgba(0, 0, 0, 0.18);
}

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

.youtube-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.youtube-video-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.youtube-video-title:hover {
  color: var(--brand);
}

.youtube-video-desc {
  margin: 0;
  font-size: 11px;
  color: var(--ink-muted);
  text-shadow: var(--text-shadow-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.youtube-video-meta {
  font-size: 10px;
  color: var(--ink-muted);
  text-shadow: var(--text-shadow-muted);
}

.youtube-loading,
.youtube-error {
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
}

.youtube-error {
  color: var(--danger);
}

/* ── 10. Theme Picker Modal ──────────────────────────────── */

.theme-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.theme-picker-modal.hidden {
  display: none;
}

.theme-picker {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.theme-picker-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}

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

.theme-option {
  cursor: pointer;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-option:hover {
  background: var(--hover-bg);
}

.theme-option.active {
  border-color: var(--brand);
  background: var(--active-bg);
}

.theme-option.desktop-only {
  border-style: dashed;
}

.theme-option.desktop-only .theme-option-name::after {
  content: " Desktop";
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  margin-left: 6px;
}

.theme-option-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.theme-option-desc {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ── 11. Limit Modal ─────────────────────────────────────── */

.limit-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.limit-modal-overlay.hidden {
  display: none;
}

.limit-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.limit-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.limit-text {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 16px;
}

.limit-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.limit-option {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.limit-option:hover {
  background: var(--hover-bg);
  border-color: var(--brand);
}

.limit-option-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.limit-option-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* BYOK input section */
.byok-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.byok-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.byok-provider-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--input-text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
  margin-bottom: 8px;
}

.byok-provider-select:focus {
  border-color: var(--input-focus);
}

.byok-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--input-text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

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

.byok-input::placeholder {
  color: var(--input-placeholder);
}

/* ── 12. Teaser Modal ────────────────────────────────────── */

.teaser-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.teaser-modal-overlay.hidden {
  display: none;
}

.teaser-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.teaser-modal-icon {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.teaser-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.teaser-modal-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 20px;
}

.teaser-modal-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: var(--gradient-brand);
  color: var(--btn-primary-text);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.teaser-modal-cta:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-glow);
}

.teaser-modal-cta:active {
  transform: scale(0.97);
}

/* ── 13. Toast ───────────────────────────────────────────── */

.demo-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg-heavy);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  z-index: 500;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}

.demo-toast.hidden {
  display: none;
}

.demo-toast.success {
  border-color: rgba(60, 207, 122, 0.25);
}

.demo-toast.error {
  border-color: rgba(228, 92, 92, 0.25);
}

/* ── 14. Model Picker (Welcome Overlay) ──────────────────── */

.model-picker-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.model-picker-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 520px;
}

.model-picker-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.model-picker-card:hover {
  background: var(--hover-bg);
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.model-picker-card:active {
  transform: scale(0.97);
}

.model-picker-card.recommended {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), var(--shadow-glow);
}

.model-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.model-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.model-card-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: var(--ink-on-brand);
}

.model-card-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.model-card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: auto;
}

.model-card-size {
  font-weight: 600;
  color: var(--brand);
}

.model-picker-note {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.5;
  margin-top: 16px;
  max-width: 440px;
}

/* ── 15. Model Loading UI ────────────────────────────────── */

.model-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 48px 24px;
  animation: fadeIn 0.3s ease-out;
}

.model-loading-icon {
  font-size: 48px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.model-loading-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.model-loading-subtitle {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 32px;
}

.model-loading-bar-wrap {
  width: 100%;
  max-width: 360px;
  height: 6px;
  background: var(--surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--line);
}

.model-loading-bar {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  min-width: 2%;
}

.model-loading-text {
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 12px;
  font-family: var(--font-mono);
}

.model-loading-note {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 24px;
  max-width: 340px;
  line-height: 1.5;
}

.model-loading-cta {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 32px;
  background: var(--gradient-brand);
  color: var(--btn-primary-text);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-glow);
}

.model-loading-cta:hover {
  transform: scale(1.03);
}

/* model-dot local indicator (green) */
.model-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
  margin-right: 4px;
  vertical-align: middle;
}

.model-dot.local {
  background: var(--ok, #3ccf7a);
  box-shadow: 0 0 6px rgba(60, 207, 122, 0.4);
}

/* ── 16. Responsive Design ───────────────────────────────── */

/* Tablet: hide right rail, show compact bottom CTA */
@media (max-width: 1024px) {
  .demo-cta-rail {
    display: none;
  }

  #demo-shell {
    grid-template-columns: 280px 1fr;
  }

  .demo-bottom-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 100;
    padding: 0 16px;
  }

  .demo-bottom-cta .cta-compact-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
  }

  .demo-bottom-cta .cta-compact-btn {
    padding: 6px 16px;
    background: var(--gradient-brand);
    color: var(--btn-primary-text);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }

  /* Adjust demo-input padding for bottom CTA */
  .demo-input {
    padding-bottom: 12px;
  }
}

/* Mobile: collapsible sidebar, hamburger menu */
@media (max-width: 768px) {
  #demo-shell {
    grid-template-columns: 1fr;
  }

  .demo-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .demo-sidebar.open {
    transform: translateX(280px);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    animation: fadeIn 0.2s ease-out;
  }

  .sidebar-overlay.hidden {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .demo-header {
    padding: 10px 12px;
  }
}

/* Small phone */
@media (max-width: 480px) {
  .message-bubble {
    max-width: 90%;
  }

  .welcome-title {
    font-size: 24px;
  }

  .welcome-prompts {
    flex-direction: column;
    align-items: center;
  }

  .welcome-prompt-card {
    max-width: 100%;
  }

  .model-picker-cards {
    grid-template-columns: 1fr;
    max-width: 320px;
  }

  .demo-header {
    padding: 8px 12px;
  }

  .demo-header .header-model-badge {
    font-size: 10px;
    padding: 3px 8px;
  }

  .header-action-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 10px;
  }
}

/* ── Topic Context Menu & Inline Rename ──────────────────── */

.topic-context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 600;
  min-width: 140px;
  overflow: hidden;
  animation: fadeIn 0.1s ease-out;
}
.ctx-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease;
}
.ctx-item:hover { background: var(--hover-bg); }
.ctx-delete { color: var(--danger); }
.ctx-delete:hover { background: rgba(228, 92, 92, 0.1); }
.topic-rename-input {
  width: 100%;
  padding: 2px 6px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-focus);
  border-radius: var(--radius-sm);
  color: var(--input-text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

/* ── 17. Animations ──────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px) translateX(-50%); opacity: 0; }
  to { transform: translateY(0) translateX(-50%); opacity: 1; }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes thinkPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* ── 18. Custom Scrollbar (global) ───────────────────────── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--hover-bg);
}

/* ── 19. Phase 2 — Header Icon Buttons (Export, etc.) ──── */

.header-icon-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--icon-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background 0.2s ease;
}
.header-icon-btn:hover {
  color: var(--icon-hover);
  background: var(--hover-bg);
}

/* ── 20. Phase 2 — Model Dropdown (mid-conversation switch) */

.header-model-badge { cursor: pointer; }
.header-model-badge:hover { opacity: 0.8; }

.model-dropdown {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  min-width: 220px;
  max-width: 300px;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}
.model-dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.model-dropdown-item:hover { background: var(--hover-bg); }
.model-dropdown-item.active {
  background: var(--active-bg);
  border-left: 3px solid var(--brand);
}
.model-dropdown-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.model-dropdown-meta {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ── 21. Phase 2 — Chat Search Bar (Cmd/Ctrl+F) ────────── */

.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--glass-bg-heavy);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
  animation: fadeIn 0.15s ease-out;
}
.chat-search-input {
  flex: 1;
  padding: 6px 12px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--input-text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
}
.chat-search-input:focus { border-color: var(--input-focus); }
.chat-search-count {
  font-size: 12px;
  color: var(--ink-muted);
  min-width: 40px;
  text-align: center;
}
.chat-search-nav, .chat-search-close {
  width: 28px;
  height: 28px;
  background: var(--btn-secondary);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.chat-search-nav:hover, .chat-search-close:hover {
  background: var(--btn-secondary-hover);
  color: var(--ink);
}

mark.search-highlight {
  background: rgba(242, 201, 76, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
mark.search-highlight.search-active {
  background: var(--brand);
  color: var(--ink-on-brand);
}

/* ── 22. Phase 3 — Date Separators ─────────────────────── */

.date-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 4px;
}
.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
  opacity: 0.5;
}
.date-separator-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ── 23. Phase 3 — System Prompt Editor ────────────────── */

.system-prompt-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--input-text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.system-prompt-textarea:focus {
  border-color: var(--input-focus);
}
.system-prompt-textarea::placeholder {
  color: var(--ink-muted);
  opacity: 0.7;
}
