:root {
  --bg: #0a0f1a;
  --bg-subtle: #111827;
  --surface: #1e293b;
  --surface-elevated: #1e293b;
  --surface-hover: #334155;
  --surface-active: #1e3a5f;
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --accent: #38bdf8;
  --accent-soft: #7dd3fc;
  --accent-subtle: rgba(56,189,248,0.08);
  --accent-glow: rgba(56,189,248,0.25);
  --accent-gradient: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(56,189,248,0.05));
  --border: #1e293b;
  --border-subtle: #334155;
  --success: #4ade80;
  --success-subtle: rgba(74,222,128,0.1);
  --warning: #facc15;
  --warning-subtle: rgba(250,204,21,0.1);
  --error: #f87171;
  --error-subtle: rgba(248,113,113,0.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.15);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -2px rgba(0,0,0,0.15);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.3), 0 10px 10px -5px rgba(0,0,0,0.1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
  --sidebar-width: 280px;
  --file-sidebar-width: 260px;
  --topbar-height: 56px;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-active: #e0f2fe;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #0284c7;
  --accent-soft: #0369a1;
  --accent-subtle: rgba(2,132,199,0.06);
  --accent-glow: rgba(2,132,199,0.2);
  --accent-gradient: linear-gradient(135deg, rgba(2,132,199,0.08), rgba(2,132,199,0.02));
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  --success: #16a34a;
  --success-subtle: rgba(22,163,74,0.08);
  --warning: #ca8a04;
  --warning-subtle: rgba(202,138,4,0.08);
  --error: #dc2626;
  --error-subtle: rgba(220,38,38,0.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.app {
  display: flex;
  height: 100%;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-elevated) 0%, transparent 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--accent-glow);
  box-shadow: 0 0 12px var(--accent-subtle);
}

.brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  text-transform: uppercase;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  padding-left: 42px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle), 0 0 20px var(--accent-subtle);
  transform: translateY(-1px);
}

.search-icon {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-sans);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-kbd {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-sans);
  flex-shrink: 0;
}

.section-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.section-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  font-weight: 500;
}

.section-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}

.section-item.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 600;
}

.section-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

.section-icon { font-size: 1rem; flex-shrink: 0; }
.section-name { font-weight: 500; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.menu-btn:hover { 
  background: var(--surface-hover); 
  transform: scale(1.05);
}

.topbar-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-btn.bookmarked {
  color: var(--warning);
  text-shadow: 0 0 8px var(--warning-subtle);
}

.content-area {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.file-sidebar {
  width: var(--file-sidebar-width);
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.file-count {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.file-list-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.file-list-search input {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.file-list-search input:focus {
  border-color: var(--accent);
}

.file-list-search input::placeholder {
  color: var(--text-muted);
}

.file-list {
  flex: 1;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.file-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}

.file-item.active {
  background: var(--surface-active);
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  box-shadow: inset 0 0 12px var(--accent-subtle);
}

.file-icon {
  font-size: 0.85rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.file-name {
  flex: 1;
  word-break: break-word;
  line-height: 1.4;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  opacity: 0;
  transition: opacity 0.3s ease;
  position: relative;
  line-height: 1.7;
}

.content.loaded { opacity: 1; }

.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
  margin: 1.8em 0 0.6em;
  color: var(--text);
  line-height: 1.25;
  scroll-margin-top: 20px;
  letter-spacing: -0.02em;
}

.content h1 {
  font-size: 2.25rem;
  font-weight: 800;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4em;
  margin-top: 0;
  background: linear-gradient(180deg, var(--text) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2.5em;
  color: var(--text);
}

.content h3 { 
  font-size: 1.3rem; 
  font-weight: 600;
  color: var(--text);
}

.content h4 { 
  font-size: 1.1rem; 
  font-weight: 600;
  color: var(--text);
}

.content p {
  margin: 0.8em 0;
  line-height: 1.8;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 75ch;
}

.content ul, .content ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
}

.content li {
  margin: 0.4em 0;
  line-height: 1.75;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.content li::marker {
  color: var(--accent);
  font-weight: 600;
}

.content strong { 
  color: var(--text); 
  font-weight: 600;
  letter-spacing: -0.01em;
}

.content em { 
  color: var(--accent); 
  font-style: italic;
}

.content code {
  background: var(--accent-subtle);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
  border: 1px solid var(--accent-glow);
}

.content pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 1.5em 0;
  position: relative;
  box-shadow: var(--shadow);
}

.content pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.content pre code {
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.7;
  font-family: var(--font-mono);
}

.content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 1.5em 0;
  color: var(--text-secondary);
  background: var(--accent-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  position: relative;
}

.content blockquote::before {
  content: '"';
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 3rem;
  color: var(--accent-glow);
  font-family: Georgia, serif;
  line-height: 1;
}

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3em 0;
  position: relative;
}

.content hr::after {
  content: '◆';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--accent);
  padding: 0 12px;
  font-size: 0.6rem;
}

.content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  position: relative;
}

.content a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.content a:hover::after {
  width: 100%;
}

.content a:hover {
  text-decoration: none;
  text-underline-offset: 3px;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.content th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.content td {
  color: var(--text-secondary);
}

.content tr:hover td {
  background: var(--surface-hover);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  box-shadow: 0 0 12px var(--accent-subtle);
}

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

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  gap: 12px;
}

.error-state h2 {
  color: var(--error);
  font-size: 1.25rem;
  margin-bottom: 4px;
  font-weight: 700;
}

.error-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
  line-height: 1.6;
}

.retry-btn {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.retry-btn:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.visible { 
  display: block; 
  opacity: 1;
}

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(20vh, 200px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.search-modal.open {
  pointer-events: auto;
  opacity: 1;
}

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.search-modal-content {
  position: relative;
  width: min(640px, 90vw);
  max-height: min(60vh, 500px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-20px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.search-modal.open .search-modal-content {
  transform: translateY(0) scale(1);
}

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

.search-modal-input-wrap .search-icon {
  font-size: 1.1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-modal-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-sans);
}

.search-modal-input-wrap input::placeholder {
  color: var(--text-muted);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text);
  font-family: var(--font-sans);
}

.search-result-item:hover, .search-result-item:focus {
  background: var(--surface-hover);
  outline: none;
  transform: translateX(2px);
}

.search-result-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.search-result-context {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  box-shadow: var(--shadow-xl);
  z-index: 300;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.offline-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px;
  background: var(--warning);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
}

.offline-bar.visible {
  display: flex;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

::selection {
  background: var(--accent-glow);
  color: var(--text);
}

.config-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.config-modal.open {
  pointer-events: auto;
  opacity: 1;
}

.config-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.config-modal-content {
  position: relative;
  width: min(720px, 95vw);
  max-height: min(85vh, 700px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.config-modal.open .config-modal-content {
  transform: translateY(0) scale(1);
}

.config-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.config-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.config-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.config-close:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: rotate(90deg);
}

.config-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.config-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 700;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.config-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.config-grid input {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.config-grid input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  transform: translateY(-1px);
}

.config-sections-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.config-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.config-checkbox:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.config-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.config-pricing-tier {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.config-pricing-tier input {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.config-pricing-tier input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.config-remove-tier {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.config-remove-tier:hover:not(:disabled) {
  background: var(--error-subtle);
  border-color: var(--error);
  color: var(--error);
  transform: scale(1.05);
}

.config-remove-tier:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.config-add-tier {
  margin-top: 8px;
  padding: 8px 14px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.config-add-tier:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.config-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.config-btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.config-btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.config-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.config-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.config-btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.config-btn-danger {
  background: transparent;
  color: var(--error);
  border-color: rgba(248,113,113,0.3);
}

.config-btn-danger:hover {
  background: var(--error-subtle);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .config-modal-content {
    width: 100%;
    max-height: 90vh;
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
  .config-pricing-tier {
    grid-template-columns: 1fr 1fr auto;
  }
  .config-pricing-tier .config-remove-tier {
    grid-row: span 1;
  }
}

.coach-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 150;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.coach-panel.open {
  transform: translateX(0);
}

.coach-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--surface-elevated) 0%, transparent 100%);
}

.coach-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.coach-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coach-scenario-select {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-scenario-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.coach-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-close:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: rotate(90deg);
}

.coach-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.coach-tab {
  flex: 1;
  padding: 12px 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}

.coach-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.coach-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.coach-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  box-shadow: 0 0 8px var(--accent-glow);
}

.coach-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.coach-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.coach-tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coach-step {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-step:hover {
  border-color: var(--border-subtle);
  box-shadow: var(--shadow);
}

.coach-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.coach-step-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--accent-glow);
}

.coach-step-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.coach-step-content {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.coach-step-content p {
  margin: 0.6em 0;
}

.coach-step-content ul {
  margin: 0.6em 0;
  padding-left: 1.5em;
}

.coach-step-content li {
  margin: 0.35em 0;
}

.coach-step-content strong {
  color: var(--text);
  font-weight: 600;
}

.coach-controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
}

.coach-btn {
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.coach-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.coach-btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.coach-btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.coach-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.coach-btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.coach-notes {
  width: 100%;
  min-height: 300px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-notes:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.coach-notes::placeholder {
  color: var(--text-muted);
}

.coach-tools {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.coach-tool-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.coach-quick-replies {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.coach-quick-reply {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-quick-reply:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.coach-objections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.coach-objection {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-objection:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.coach-moments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.coach-moment-btn {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.coach-moment-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.coach-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.coach-timer-display {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-shadow: 0 0 20px var(--accent-subtle);
}

.coach-timer-controls {
  display: flex;
  gap: 8px;
}

@media (max-width: 768px) {
  .coach-panel {
    width: 100%;
    max-width: 100%;
  }
}

/* Live Call Mode */
.live-call {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}

.live-status.listening .live-dot {
  background: var(--error);
  animation: pulse 1s infinite;
  box-shadow: 0 0 8px var(--error-subtle);
}

.live-status.processing .live-dot {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning-subtle);
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

.live-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.deal-context {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.deal-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.deal-context-header:hover {
  background: var(--surface-hover);
}

.deal-context-toggle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.deal-context-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: rotate(90deg);
}

.deal-context-body {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.deal-context.collapsed .deal-context-body {
  display: none;
}

.deal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deal-field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.deal-field input {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.deal-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.deal-field input::placeholder {
  color: var(--text-muted);
}

.live-moments {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.live-moments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

.live-moments-count {
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  border: 1px solid var(--accent-glow);
}

.live-moments-list {
  padding: 10px 14px;
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-moment {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.5;
  border-left: 2px solid var(--accent);
  transition: all 0.2s;
}

.live-moment:hover {
  background: var(--surface-hover);
}

.live-moment-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.live-moment-text {
  color: var(--text-secondary);
}

.live-moment-text strong {
  color: var(--accent);
  font-weight: 600;
}

.live-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
}

.live-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.live-message {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.live-message.user {
  background: var(--accent-subtle);
  border-left: 2px solid var(--accent);
  color: var(--text);
}

.live-message.system {
  background: var(--surface);
  border-left: 2px solid var(--text-muted);
  color: var(--text-secondary);
}

.live-message .live-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.live-message .live-text-content {
  color: var(--text);
}

.live-message .live-text-content interim {
  color: var(--text-muted);
  font-style: italic;
}

.live-highlight {
  background: rgba(56,189,248,0.2);
  color: var(--accent);
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 500;
}

.live-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-suggestion {
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.live-suggestion:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.live-suggestion-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 700;
}

.live-suggestion-content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.live-suggestion-response {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  padding: 10px 12px;
  background: var(--accent-subtle);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.live-suggestion-followup {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.live-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Floating Live Widget */
.live-widget {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 160;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(calc(100% + 40px));
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.live-widget.open {
  transform: translateY(0);
}

.live-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  cursor: grab;
  background: linear-gradient(180deg, var(--surface-elevated) 0%, transparent 100%);
}

.live-widget-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.live-widget-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.live-widget-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: rotate(90deg);
}

.live-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.live-widget.collapsed .live-widget-body {
  display: none;
}

.live-widget.collapsed {
  max-height: 48px;
}

.live-transcript-mini {
  flex: 1;
  overflow-y: auto;
  max-height: 150px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.live-transcript-mini .live-message {
  margin: 4px 0;
  padding: 4px 6px;
  font-size: 0.8rem;
}

.live-suggestions-mini {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-suggestion-mini {
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.live-suggestion-mini:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}

.live-widget-controls {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.live-btn {
  flex: 1;
  padding: 8px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.live-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.live-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.live-btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.live-btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.live-btn-secondary {
  background: transparent;
}

@media (max-width: 768px) {
  .live-widget {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-height: 50vh;
  }
}

/* Responsive sidebar */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
    z-index: 100;
  }

  .sidebar.open { 
    transform: translateX(0); 
  }
  
  .overlay.visible { 
    display: block; 
    opacity: 1;
  }

  .topbar { display: flex; }
  .file-sidebar { display: none; }
  .content { padding: 24px; }
  .content h1 { font-size: 1.6rem; }
  .content h2 { font-size: 1.3rem; }
}

@media (min-width: 769px) {
  .overlay { display: none !important; }
}

/* Subtle ambient background */
html::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 15% 85%, var(--accent-subtle) 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, var(--accent-subtle) 0%, transparent 45%);
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

/* Offline indicator */
.offline-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px;
  background: var(--warning);
  color: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
}

.offline-bar.visible {
  display: flex;
}
