/* ═══════════════════════════════════════════════════════════
   TOKENCRUSH — Stitch-Inspired Modern Design System
   Dark-first with Electric Violet accents, Emerald Green savings
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens (Stitch-Inspired) ── */
:root {
  /* Surface layers — Deep Space palette */
  --bg: #0b1326;
  --bg-secondary: #0f172a;
  --surface: #171f33;
  --surface-elevated: #1e2740;
  --surface-hover: #222a3d;
  --surface-active: #2d3449;
  
  /* Borders */
  --border: rgba(255,255,255,0.08);
  --border-subtle: rgba(255,255,255,0.04);
  --border-hover: rgba(255,255,255,0.14);
  --border-focus: rgba(139,92,246,0.5);
  
  /* Text */
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Primary — Electric Violet */
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-dim: rgba(139,92,246,0.12);
  --accent-glow: rgba(139,92,246,0.25);
  
  /* Secondary — Sky Blue */
  --secondary: #0ea5e9;
  --secondary-dim: rgba(14,165,233,0.1);
  
  /* Green — Token savings (Emerald) */
  --green: #10b981;
  --green-dim: rgba(16,185,129,0.1);
  --green-glow: rgba(16,185,129,0.25);
  
  /* Semantic */
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.1);
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.1);
  
  /* AI features */
  --ai: #a78bfa;
  --ai-dim: rgba(167,139,250,0.1);
  --ai-glow: rgba(167,139,250,0.25);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  
  /* Spacing scale (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Shadows — Tonal depth */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.45);
  --shadow-glow: 0 0 20px var(--accent-glow);
  
  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;
  
  /* Layout */
  --sidebar-width: 260px;
  --header-height: 56px;
  --output-width: 50%;
}

/* ── Light theme (Stitch-Inspired) ── */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-secondary: #f1f5f9;
  --surface: #ffffff;
  --surface-elevated: #f8fafc;
  --surface-hover: #f1f5f9;
  --surface-active: #e2e8f0;
  
  --border: rgba(0,0,0,0.08);
  --border-subtle: rgba(0,0,0,0.04);
  --border-hover: rgba(0,0,0,0.15);
  --border-focus: rgba(139,92,246,0.5);
  
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-dim: rgba(124,58,237,0.08);
  --accent-glow: rgba(124,58,237,0.15);
  
  --secondary: #0284c7;
  --secondary-dim: rgba(2,132,199,0.06);
  
  --green: #059669;
  --green-dim: rgba(5,150,105,0.06);
  --green-glow: rgba(5,150,105,0.12);
  
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.06);
  --amber: #d97706;
  --amber-dim: rgba(217,119,6,0.06);
  
  --ai: #7c3aed;
  --ai-dim: rgba(124,58,237,0.06);
  --ai-glow: rgba(124,58,237,0.12);
  
  --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 32px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 20px var(--accent-glow);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ═══════ ANIMATIONS ═══════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
  50% { box-shadow: 0 0 20px var(--accent-glow); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

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

@keyframes borderGlow {
  0%, 100% { border-color: var(--accent-dim); }
  50% { border-color: var(--accent); }
}

/* ═══════ HEADER ═══════ */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--ai));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 12px var(--accent-glow);
  transition: transform var(--duration-spring), box-shadow var(--duration-normal);
}

.logo:hover .logo-icon {
  transform: rotate(-8deg) scale(1.05);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo-badge {
  font-size: 9px;
  background: var(--ai-dim);
  color: var(--ai);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* ═══════ BUTTONS ═══════ */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.03) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:hover::before { opacity: 1; }

.btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--ai));
  border-color: rgba(167,139,250,0.4);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  border-color: rgba(167,139,250,0.6);
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--green-dim);
  border-color: rgba(16,185,129,0.25);
  color: var(--green);
}

.btn-success:hover {
  border-color: rgba(16,185,129,0.45);
  box-shadow: 0 4px 16px var(--green-glow);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
}

/* ═══════ THEME TOGGLE ═══════ */
.theme-toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  cursor: pointer;
  transition: all var(--duration-normal);
}

.theme-toggle:hover { border-color: var(--border-hover); }

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle .tt-track-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
  opacity: 0.35;
  transition: opacity var(--duration-fast);
  pointer-events: none;
}

.theme-toggle .tt-sun { left: 6px; }
.theme-toggle .tt-moon { right: 6px; }

.theme-toggle .tt-knob {
  position: absolute;
  z-index: 1;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--ai));
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: transform var(--duration-spring), background var(--duration-normal), box-shadow var(--duration-normal);
}

:root[data-theme="light"] .theme-toggle .tt-knob {
  transform: translateX(20px);
  background: linear-gradient(135deg, var(--amber), #f59e0b);
  box-shadow: 0 2px 8px rgba(245,158,11,0.4);
}

:root[data-theme="dark"] .theme-toggle .tt-moon { opacity: 1; }
:root[data-theme="light"] .theme-toggle .tt-sun { opacity: 1; }

/* ═══════ LAYOUT ═══════ */
.workspace {
  display: flex;
  height: calc(100vh - var(--header-height));
}

/* ═══════ SIDEBAR ═══════ */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  transition: width var(--duration-normal);
}

.sidebar-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  flex: 1;
}

.sidebar-add-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: all var(--duration-fast);
}

.sidebar-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ═══════ SEARCH BAR ═══════ */
.search-bar {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  padding: 8px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

/* ═══════ DROP ZONE ═══════ */
.drop-zone {
  margin: var(--space-3);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--accent-dim) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--duration-normal);
  pointer-events: none;
  z-index: 0;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before { opacity: 1; }

.drop-zone-icon {
  font-size: 28px;
  margin-bottom: var(--space-2);
  opacity: 0.5;
  position: relative;
  z-index: 1;
  transition: transform var(--duration-spring);
}

.drop-zone:hover .drop-zone-icon {
  transform: scale(1.15) translateY(-2px);
}

.drop-zone-title {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  position: relative;
  z-index: 1;
}

.drop-zone-sub {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* ═══════ FILE LIST ═══════ */
.file-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-1) var(--space-2);
}

.file-list::-webkit-scrollbar { width: 4px; }
.file-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.file-list::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: 2px;
  position: relative;
  border: 1px solid transparent;
}

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

.file-item.active {
  background: var(--accent-dim);
  border-color: rgba(139,92,246,0.15);
  box-shadow: inset 3px 0 0 var(--accent);
}

.file-item .fi-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.file-item .fi-name {
  flex: 1;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.file-item .fi-size { font-size: 9px; color: var(--text-muted); flex-shrink: 0; }

.file-item .fi-del {
  opacity: 0;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  flex-shrink: 0;
  background: none;
  border: none;
  transition: all var(--duration-fast);
}

.file-item:hover .fi-del { opacity: 1; }
.file-item .fi-del:hover { color: var(--red); background: var(--red-dim); }

.fi-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}

.fi-status.done { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.fi-status.pending { background: var(--text-muted); }
.fi-status.processing { background: var(--amber); animation: pulse 1s infinite; }
.fi-status.error { background: var(--red); }

/* ═══════ SIDEBAR FOOTER ═══════ */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  flex-shrink: 0;
}

.compress-all-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--ai));
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  letter-spacing: 0.2px;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.compress-all-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.compress-all-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.compress-all-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: saturate(0.4);
}

.file-count-badge {
  margin-top: var(--space-2);
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}

/* ═══════ STAT CHIPS ═══════ */
.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--duration-normal);
  position: relative;
  overflow: hidden;
}

.stat-chip::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.02) 100%);
  pointer-events: none;
}

.stat-chip:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stat-chip-icon { font-size: 12px; line-height: 1; }
.stat-chip-value { font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.stat-chip-value.green { color: var(--green); }
.stat-chip-label { color: var(--text-muted); font-weight: 400; font-size: 9px; }

.global-stats, .stats-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

/* ═══════ AUTHOR CHIP ═══════ */
.author-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  transition: all var(--duration-normal);
  flex-shrink: 0;
}

.author-chip:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.author-chip:hover .author-avatar {
  background: linear-gradient(135deg, var(--accent), var(--ai));
}

.author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--ai));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all var(--duration-normal);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 8px var(--accent-glow);
}

.author-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.author-name { line-height: 1; font-weight: 600; color: var(--text); }
.author-gh { font-size: 9px; opacity: 0.55; display: flex; align-items: center; gap: 3px; }

/* ═══════ KEYBOARD HINTS ═══════ */
.kbd-hints {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.kbd kbd {
  background: var(--surface-active);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* ═══════ SIDEBAR AUTHOR CARD ═══════ */
.sidebar-author {
  margin: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.sidebar-author::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.02) 100%);
  pointer-events: none;
}

.author-top { display: flex; align-items: center; gap: var(--space-3); }

.author-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--ai));
  border: 2px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 16px var(--accent-glow);
  animation: glow 3s ease-in-out infinite;
}

.author-avatar-lg img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.author-details { flex: 1; min-width: 0; }
.author-display-name { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author-handle { font-size: 9px; color: var(--text-muted); font-family: var(--font-mono); }
.author-bio { font-size: 10px; color: var(--text-secondary); line-height: 1.6; border-top: 1px solid var(--border); padding-top: var(--space-3); }

.author-links { display: flex; gap: var(--space-2); }

.author-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--duration-fast);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.author-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.author-link svg { flex-shrink: 0; }

/* ═══════ EDITOR PANEL ═══════ */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.editor-header {
  height: 44px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  flex-shrink: 0;
  background: var(--surface);
}

.editor-filename {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-badge {
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.lang-js { background: rgba(245,158,11,0.1); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.lang-html { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.lang-css { background: rgba(16,185,129,0.1); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.lang-py { background: rgba(139,92,246,0.1); color: var(--accent); border: 1px solid rgba(139,92,246,0.2); }
.lang-other { background: var(--surface-active); color: var(--text-muted); border: 1px solid var(--border); }
.lang-shell { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.lang-ps1 { background: rgba(99,102,241,0.1); color: #818cf8; border: 1px solid rgba(99,102,241,0.2); }

.token-pill {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-active);
  border-radius: 5px;
  padding: 3px 10px;
  white-space: nowrap;
  transition: color var(--duration-fast), background var(--duration-fast);
}

.token-pill.warn { color: var(--amber); background: var(--amber-dim); }
.token-pill.danger { color: var(--red); background: var(--red-dim); }

/* ═══════ CONTROLS BAR ═══════ */
.controls-bar {
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  flex-shrink: 0;
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
}

.toggle {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface-active);
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--duration-fast);
}

.toggle-track::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 3px;
  top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--duration-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

input:checked + .toggle-track::before {
  transform: translateX(14px);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.ctrl-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.ai-row {
  margin-top: var(--space-2);
}

.ai-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pill {
  font-size: 10px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  background: none;
  font-family: inherit;
}

.pill:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.pill .pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.pill[data-s="deep"] { color: var(--green); border-color: rgba(16,185,129,0.25); }
.pill[data-s="deep"]:not(.active) { opacity: 0.4; }
.pill[data-s="deep"].active { background: var(--green-dim); border-color: rgba(16,185,129,0.4); }

/* ═══════ BUDGET BAR ═══════ */
.budget-bar-wrap {
  height: 3px;
  background: var(--surface-active);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.budget-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--accent));
  transition: width 0.4s ease, background 0.4s;
  box-shadow: 0 0 8px var(--green-glow);
}

.budget-bar-fill.warn {
  background: linear-gradient(90deg, var(--amber), var(--red));
}

/* ═══════ CODE EDITOR ═══════ */
.code-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.code-wrap.drag-over {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
}

textarea.code-editor {
  position: absolute;
  inset: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  padding: var(--space-4);
  resize: none;
  outline: none;
  tab-size: 2;
  width: 100%;
  height: 100%;
}

textarea.code-editor:focus {
  box-shadow: inset 0 0 0 1px rgba(139,92,246,0.2), 0 0 30px rgba(139,92,246,0.03);
}

textarea.code-editor::placeholder { color: var(--text-muted); }

.empty-drop {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  pointer-events: none;
}

.empty-drop-icon {
  font-size: 48px;
  opacity: 0.1;
  animation: float 4s ease-in-out infinite;
}

.empty-drop p {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.8;
}

/* ═══════ EDITOR META ═══════ */
.editor-meta-row {
  border-top: 1px solid var(--border);
  padding: 6px var(--space-4);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.meta-stat { font-size: 10px; color: var(--text-muted); }
.meta-stat span { color: var(--text-secondary); }

/* ═══════ OUTPUT PANEL ═══════ */
.output-panel {
  width: var(--output-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.output-header {
  height: 44px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  flex-shrink: 0;
  background: var(--surface);
}

.output-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  flex: 1;
}

.output-filename {
  font-size: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 10px;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════ TAB BAR ═══════ */
.output-tabs {
  display: flex;
  gap: 3px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
  overflow-x: auto;
}

.output-tabs::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: 0.2px;
}

.tab:hover:not(.active) {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(139,92,246,0.15);
  position: relative;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  box-shadow: 0 0 10px var(--accent-glow);
}

.tab .tab-icon { font-size: 11px; line-height: 1; }

/* ═══════ PROGRESS ═══════ */
.progress-strip {
  height: 2px;
  background: transparent;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.3s;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ═══════ OUTPUT CONTENT ═══════ */
.output-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  animation: fadeIn 0.3s ease;
}

.output-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-muted);
  background: var(--bg);
  z-index: 10;
}

.output-empty-icon {
  font-size: 40px;
  opacity: 0.12;
  filter: grayscale(1);
  animation: float 4s ease-in-out infinite;
}

.output-empty p { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1.7; }

.output-empty-hint {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.5;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  margin-top: 6px;
}

/* ═══════ CODE OUTPUT ═══════ */
textarea.output-code {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.8;
  padding: var(--space-4);
  resize: none;
  outline: none;
  width: 100%;
  height: 100%;
  caret-color: var(--accent);
}

/* ═══════ DIFF VIEW ═══════ */
.diff-view, .prompt-view, .context-view, .bundle-view, .history-view {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: none;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.75;
}

.diff-view.show, .prompt-view.show, .context-view.show, .bundle-view.show, .history-view.show {
  display: block;
}

.diff-line {
  padding: 2px 10px;
  border-radius: 3px;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-line.rem { background: rgba(248,113,113,0.04); color: var(--red); border-left: 2px solid rgba(248,113,113,0.25); }
.diff-line.add { background: rgba(52,211,153,0.04); color: var(--green); border-left: 2px solid rgba(52,211,153,0.25); }
.diff-line.ctx { color: var(--text-muted); }

/* ═══════ DIFF VIEW LAYOUT ═══════ */
.diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.diff-col {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.diff-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.diff-line {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.diff-num {
  font-size: 9px;
  color: var(--text-muted);
  min-width: 24px;
  text-align: right;
  user-select: none;
  flex-shrink: 0;
  opacity: 0.5;
}

.diff-empty {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ═══════ BUNDLE VIEW ═══════ */
.bundle-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bundle-file {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--duration-fast);
}

.bundle-file:hover { border-color: var(--border-hover); }

.bundle-file-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.4px;
  padding: 8px 12px;
  background: var(--accent-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bundle-fname {
  font-family: var(--font-mono);
}

.bundle-stats {
  color: var(--text-muted);
  font-weight: 500;
}

.bundle-code {
  font-size: 11px;
  color: var(--green);
  line-height: 1.7;
  padding: 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.bundle-summary {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  padding: var(--space-3) var(--space-4);
  background: var(--accent-dim);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: var(--radius-md);
  text-align: center;
  font-family: var(--font-mono);
}

.bundle-empty, .history-empty, .prompt-empty {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ═══════ HISTORY VIEW ═══════ */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.history-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--duration-fast);
}

.history-entry:hover { border-color: var(--border-hover); }

.history-header {
  padding: 10px 14px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
}

.history-name {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: 10px;
}

.history-time {
  color: var(--text-muted);
  font-size: 9px;
  margin-left: auto;
  font-family: var(--font-mono);
}

.history-stats {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--green);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ═══════ PROMPT VIEW ═══════ */
.prompt-content {
  padding: var(--space-4);
}

.prompt-content pre {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ═══════ ALL STATS VIEW ═══════ */
.allstats-view {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: none;
}

.allstats-view.show {
  display: block;
}

.allstats-content { padding: 4px; }

.allstats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.as-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  text-align: center;
}

.as-card.as-accent { border-color: var(--accent); }

.as-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.as-card.as-accent .as-val { color: var(--green); }

.as-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.allstats-table { font-size: 12px; }

.at-header, .at-row {
  display: grid;
  grid-template-columns: 1.5fr 0.6fr 1fr 1fr 1.2fr;
  gap: var(--space-2);
  padding: 8px 12px;
  align-items: center;
}

.at-header {
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.at-row {
  border-bottom: 1px solid var(--border-faint);
  transition: background 0.15s;
}

.at-row:hover { background: var(--surface-1); }

.at-saved { color: var(--green); font-family: var(--font-mono); font-weight: 600; }

.allstats-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══════ FOLDER ITEMS ═══════ */
.folder-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  padding-left: calc(10px + var(--depth, 0) * 16px);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: 2px;
  position: relative;
  border: 1px solid transparent;
}

.folder-item:hover {
  background: var(--surface-hover);
}

.folder-icon { font-size: 14px; flex-shrink: 0; }
.folder-name { flex: 1; font-size: 11px; font-weight: 600; color: var(--text-secondary); }

.folder-count {
  font-size: 9px;
  color: var(--text-muted);
  background: var(--surface-active);
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.folder-del {
  opacity: 0;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  background: none;
  border: none;
  transition: all var(--duration-fast);
  line-height: 1;
}

.folder-item:hover .folder-del { opacity: 1; }
.folder-del:hover { color: var(--red); background: var(--red-dim); }

/* ═══════ FILE ITEM ENHANCED ═══════ */
.file-item .fi-lines,
.file-item .fi-tok {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.file-item.compressed .fi-status { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }

/* ═══════ SIDEBAR FOOTER ═══════ */

/* ═══════ STATS BAR ═══════ */
.stats-bar {
  border-top: 1px solid var(--border);
  padding: var(--space-4);
  background: var(--surface);
  display: none;
  flex-shrink: 0;
  animation: fadeIn 0.3s ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.stat-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
  animation: scaleIn 0.3s ease backwards;
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.16s; }

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1;
  transition: color 0.3s, opacity 0.4s, transform 0.4s;
  font-family: var(--font-mono);
}

.stat-value.green { color: var(--green); }
.stat-value.accent { color: var(--accent); }
.stat-value.neutral { color: var(--text-secondary); }

.stat-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 700;
}

.stats-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.gauge-wrap { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.gauge-header { display: flex; justify-content: space-between; align-items: center; }
.gauge-label { font-size: 9px; color: var(--text-muted); }
.gauge-pct { font-size: 9px; font-weight: 700; font-family: var(--font-mono); color: var(--text-secondary); }

.gauge-track {
  height: 8px;
  background: var(--surface-active);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1), background 0.5s;
  position: relative;
}

.gauge-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  border-radius: inherit;
  filter: blur(4px);
  opacity: 0.5;
}

.gauge-fill.low { background: linear-gradient(90deg, #059669, var(--green)); box-shadow: 0 0 10px var(--green-glow); }
.gauge-fill.mid { background: linear-gradient(90deg, #d97706, var(--amber)); box-shadow: 0 0 10px rgba(245,158,11,0.3); }
.gauge-fill.high { background: linear-gradient(90deg, #dc2626, var(--red)); box-shadow: 0 0 10px rgba(239,68,68,0.3); }

.savings-badge {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  font-family: var(--font-mono);
  box-shadow: 0 0 12px var(--green-glow);
}

.copy-btn {
  padding: 10px 20px;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
  letter-spacing: 0.1px;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.copy-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.copy-btn:active { transform: translateY(0); }

.copy-btn.ok {
  background: var(--green);
  box-shadow: 0 4px 16px var(--green-glow);
}

/* ═══════ CONTEXT MAP ═══════ */
.ctx-drawer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  transition: max-height 0.3s var(--ease-out);
  overflow: hidden;
  max-height: 0;
  flex-shrink: 0;
}

.ctx-drawer.open { max-height: 220px; }

.ctx-drawer-header {
  padding: 8px var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.ctx-drawer-header:hover { background: var(--surface-hover); }

.ctx-drawer-title {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ctx-badge {
  font-size: 9px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 20px;
  padding: 2px 10px;
  border: 1px solid rgba(139,92,246,0.15);
  font-weight: 700;
}

.ctx-chevron { margin-left: auto; color: var(--text-muted); font-size: 10px; }

.ctx-body {
  padding: 8px var(--space-4) var(--space-3);
  overflow-y: auto;
  max-height: 170px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 5px;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 4px 8px;
  background: var(--surface-elevated);
  border-radius: 5px;
  border: 1px solid var(--border);
  transition: all var(--duration-fast);
}

.ctx-item:hover { border-color: var(--border-hover); background: var(--surface-active); }
.ctx-from { color: var(--text-muted); text-decoration: line-through; font-size: 9px; }
.ctx-arrow { color: var(--border-hover); font-size: 9px; }
.ctx-to { color: var(--accent); font-weight: 700; }
.ctx-count { color: var(--text-muted); font-size: 8px; margin-left: auto; }

/* ═══════ AI SUMMARY ═══════ */
.ai-summary {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
  display: none;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.ai-summary::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--ai));
}

.ai-summary.show { display: block; }

.ai-summary-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ai);
  font-weight: 800;
  margin-bottom: 6px;
}

.ai-summary-text {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.7;
  max-height: 90px;
  overflow-y: auto;
}

/* ═══════ PREFIX ROW ═══════ */
.prefix-row {
  border-top: 1px solid var(--border);
  padding: 10px var(--space-4);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.prefix-label { font-size: 10px; color: var(--text-muted); white-space: nowrap; font-weight: 600; }

.prefix-input {
  flex: 1;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 10px;
  padding: 6px 10px;
  outline: none;
  font-family: var(--font-mono);
  min-width: 0;
  transition: border-color var(--duration-fast);
}

.prefix-input:focus { border-color: var(--accent); background: var(--surface-active); }

/* ═══════ AI OVERLAY ═══════ */
.ai-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(12px);
}

.ai-overlay.show { display: flex; }

.ai-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-8);
  width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.3s var(--ease-spring);
}

.ai-spinner {
  position: relative;
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
}

.ai-spinner-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.ai-spinner-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  animation: pulse 2s infinite;
}

.ai-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.ai-desc { color: var(--text-muted); font-size: 12px; line-height: 1.6; }

.ai-progress-wrap { margin-top: var(--space-4); }

.ai-progress-track {
  height: 4px;
  background: var(--surface-active);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.ai-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 2px;
  transition: width 0.4s;
}

.ai-stage { font-size: 11px; color: var(--accent); font-family: var(--font-mono); }

.ai-file-list {
  margin-top: var(--space-3);
  text-align: left;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  max-height: 90px;
  overflow-y: auto;
}

.ai-file-item { padding: 3px 0; display: flex; align-items: center; gap: 7px; }
.ai-file-item.done { color: var(--green); }
.ai-file-item.active { color: var(--accent); }

/* ═══════ TOAST ═══════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transition: all var(--duration-normal) var(--ease-spring);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

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

.toast.ok { border-color: rgba(16,185,129,0.3); color: var(--green); box-shadow: 0 0 24px var(--green-glow); }
.toast.err { border-color: rgba(239,68,68,0.3); color: var(--red); box-shadow: 0 0 24px var(--red-dim); }

/* ═══════ SCROLLBARS ═══════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ═══════ RESIZE HANDLES ═══════ */
.resize-handle {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  transition: background var(--duration-fast);
  position: relative;
  z-index: 10;
}

.resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 24px;
  border-radius: 2px;
  background: var(--border);
  transition: all var(--duration-fast);
  opacity: 0;
}

.resize-handle:hover { background: rgba(139,92,246,0.06); }
.resize-handle:hover::after { opacity: 1; background: var(--accent); }
.resize-handle.dragging { background: rgba(139,92,246,0.12); }

.resize-handle.dragging::after {
  opacity: 1;
  background: var(--accent);
  height: 40px;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ═══════ DRAG OVERLAY ═══════ */
.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(11, 19, 38, 0.9);
  backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drag-overlay.show { display: flex; }

.drag-overlay-inner { text-align: center; }

.drag-overlay-icon {
  font-size: 64px;
  margin-bottom: var(--space-4);
  animation: float 1s ease-in-out infinite;
}

.drag-overlay-text { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: var(--space-2); }
.drag-overlay-sub { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* ═══════ FIND BAR ═══════ */
.find-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s var(--ease-spring);
}

.find-bar.show { display: flex; }

.find-bar input {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
  font-family: var(--font-mono);
  transition: border-color var(--duration-fast);
}

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

.find-row { display: flex; gap: 6px; align-items: center; }
.find-info { font-size: 9px; color: var(--text-muted); white-space: nowrap; }

/* ═══════ BUNDLE VIEW ═══════ */
.bundle-file-block {
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.bundle-file-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.4px;
  padding: 8px 12px;
  background: var(--accent-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bundle-file-code {
  font-size: 11px;
  color: var(--green);
  line-height: 1.7;
  padding: 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

/* ═══════ HISTORY VIEW ═══════ */
.hist-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  overflow: hidden;
  transition: border-color var(--duration-fast);
}

.hist-entry:hover { border-color: var(--border-hover); }

.hist-header {
  padding: 10px 14px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 10px;
}

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

.hist-name { font-family: var(--font-mono); color: var(--text-secondary); font-size: 10px; }
.hist-timestamp { color: var(--text-muted); font-size: 9px; margin-left: auto; font-family: var(--font-mono); }

.hist-badge {
  font-size: 9px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.15);
  font-weight: 700;
}

/* ═══════ CHAT PANEL ═══════ */
.chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.chat-panel.hidden { display: none !important; }

.chat-status {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-model-info { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.chat-model-icon { font-size: 28px; flex-shrink: 0; }
.chat-model-details { flex: 1; min-width: 0; }
.chat-model-name { font-size: 13px; font-weight: 700; color: var(--text); }
.chat-model-size { font-size: 10px; color: var(--text-muted); }
.chat-download-btn { width: 100%; padding: 10px; font-size: 12px; font-weight: 700; }

.chat-requirements {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: var(--space-2) 0;
  padding: var(--space-2);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.chat-req-item { display: flex; align-items: center; gap: 7px; font-size: 10px; }
.chat-req-icon { font-size: 12px; flex-shrink: 0; }
.chat-req-label { color: var(--text-secondary); font-weight: 600; min-width: 65px; }
.chat-req-status { color: var(--text-muted); font-family: var(--font-mono); }
.chat-req-item.ok .chat-req-status { color: var(--green); }
.chat-req-item.warn .chat-req-status { color: var(--amber); }
.chat-req-item.fail .chat-req-status { color: var(--red); }

.chat-progress { margin-top: var(--space-2); }
.chat-progress-track { height: 5px; background: var(--surface-active); border-radius: 3px; overflow: hidden; margin-bottom: 5px; }
.chat-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--ai)); border-radius: 3px; transition: width 0.3s; width: 0; box-shadow: 0 0 8px var(--accent-glow); }
.chat-progress-text { font-size: 10px; color: var(--accent); font-family: var(--font-mono); text-align: center; }

.chat-context-bar {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 7px var(--space-4);
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  flex-shrink: 0;
}

.chat-context-bar.show { display: flex; }
.chat-ctx-label { color: var(--text-muted); white-space: nowrap; }
.chat-ctx-file { flex: 1; font-family: var(--font-mono); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
}

.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--space-2);
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-6);
}

.chat-welcome-icon { font-size: 32px; opacity: 0.3; }
.chat-welcome p { font-size: 12px; line-height: 1.6; }
.chat-welcome-sub { font-size: 10px; opacity: 0.6; }

.chat-msg {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.6;
  max-width: 85%;
  animation: fadeIn 0.2s ease;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-msg.system {
  align-self: center;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  border: 1px solid rgba(139,92,246,0.15);
}

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: var(--space-2);
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 12px;
  padding: 10px 14px;
  outline: none;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color var(--duration-fast);
}

.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.05);
}

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

.chat-input-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* ═══════ SIDEBAR OVERLAY ═══════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}

.sidebar-overlay.show { display: block; }

/* ═══════ GLOBAL TOKEN PANEL ═══════ */
.global-tok-panel {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

.gtp-title {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: var(--space-2);
}

.gtp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.gtp-lbl {
  font-size: 10px;
  color: var(--text-muted);
}

.gtp-val {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.gtp-val.accent { color: var(--accent); }
.gtp-val.green { color: var(--green); }

.gtp-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ═══════ REDUCED MOTION ═══════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1280px) {
  .kbd-hints { display: none; }
}

@media (max-width: 1024px) {
  .stats-display { display: none; }
  .author-chip .author-info { display: none; }
  .global-stats { display: none !important; }
  :root { --output-width: 45%; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: var(--header-height);
    bottom: 0;
    width: 280px;
    z-index: 45;
    transition: left 0.3s var(--ease-out);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .output-panel {
    width: 100% !important;
  }
  
  .editor-panel {
    display: none;
  }
  
  .resize-handle {
    display: none;
  }

  .header {
    padding: 0 var(--space-2);
    gap: var(--space-2);
  }

  .logo-text { font-size: 15px; }
  .logo-badge { display: none; }

  .btn { padding: 6px 10px; font-size: 11px; }

  .diff-container {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .chat-msg { max-width: 95%; }
}

/* ═══════════════════════════════════════════════════════════
   21ST.DEV INSPIRED ELEMENTS
   Glassmorphism, Liquid-Glass, Animated Gradients, Micro-interactions
   ═══════════════════════════════════════════════════════════ */

/* ── 21st.dev: Glassmorphism Card Component ── */
.glass-card {
  background: rgba(23, 31, 51, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

:root[data-theme="light"] .glass-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

:root[data-theme="light"] .glass-card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ── 21st.dev: Liquid Glass Effect ── */
.liquid-glass {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.1) 0%,
    rgba(167, 139, 250, 0.05) 50%,
    rgba(16, 185, 129, 0.1) 100%
  );
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  box-shadow: 
    0 8px 32px rgba(139, 92, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.liquid-glass::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%
  );
  pointer-events: none;
  animation: liquidShine 8s ease-in-out infinite;
}

@keyframes liquidShine {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10%, 10%); }
}

/* ── 21st.dev: Animated Gradient Background ── */
.animated-gradient {
  background: linear-gradient(
    -45deg,
    #0b1326,
    #1a1040,
    #0d2137,
    #0b1326
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

:root[data-theme="light"] .animated-gradient {
  background: linear-gradient(
    -45deg,
    #f8fafc,
    #e8e0f5,
    #dce8f5,
    #f8fafc
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

/* ── 21st.dev: Floating Orb Background ── */
.orb-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--accent);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
  opacity: 0.15;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--green);
  bottom: -50px;
  left: -50px;
  animation-delay: -5s;
  opacity: 0.12;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: var(--secondary);
  top: 50%;
  left: 50%;
  animation-delay: -10s;
  opacity: 0.1;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(10px, -10px) scale(1.02); }
}

/* ── 21st.dev: Noise Texture Overlay ── */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ── 21st.dev: Glow Button ── */
.btn-glow {
  position: relative;
  background: linear-gradient(135deg, var(--accent), var(--ai));
  border: none;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 4px 20px var(--accent-glow),
    0 0 40px var(--accent-glow);
}

.btn-glow:hover::before {
  left: 100%;
}

.btn-glow:active {
  transform: translateY(0) scale(0.98);
}

/* ── 21st.dev: Stat Card with Glow ── */
.stat-card-glow {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card-glow:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 
    0 8px 32px rgba(139, 92, 246, 0.15),
    0 0 0 1px rgba(139, 92, 246, 0.1);
}

.stat-card-glow:hover::before {
  opacity: 1;
}

/* ── 21st.dev: Animated Counter ── */
.counter-animate {
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.counter-animate.updating {
  transform: translateY(-4px);
  opacity: 0;
}

/* ── 21st.dev: Floating Label Input ── */
.input-floating {
  position: relative;
  margin-top: var(--space-4);
}

.input-floating input {
  width: 100%;
  padding: 16px 16px 8px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s ease;
}

.input-floating input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.input-floating label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  transition: all 0.2s ease;
}

.input-floating input:focus + label,
.input-floating input:not(:placeholder-shown) + label {
  top: 8px;
  transform: translateY(0);
  font-size: 10px;
  color: var(--accent);
}

/* ── 21st.dev: Shimmer Loading ── */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface-elevated) 0%,
    var(--surface-hover) 50%,
    var(--surface-elevated) 100%
  );
  background-size: 200% 100%;
  animation: shimmerLoad 1.5s ease-in-out infinite;
}

@keyframes shimmerLoad {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 21st.dev: Magnetic Button Effect ── */
.btn-magnetic {
  position: relative;
  transition: transform 0.2s ease;
}

.btn-magnetic:hover {
  transform: scale(1.02);
}

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

/* ── 21st.dev: Gradient Border ── */
.gradient-border {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--green), var(--secondary));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gradient-border:hover::before {
  opacity: 1;
}

/* ── 21st.dev: Typing Indicator ── */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* ── 21st.dev: Animated Progress Ring ── */
.progress-ring {
  position: relative;
  width: 80px;
  height: 80px;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}

.progress-ring .track {
  stroke: var(--border);
}

.progress-ring .fill {
  stroke: var(--accent);
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  transition: stroke-dashoffset 1s ease;
}

/* ── 21st.dev: Hover Scale Card ── */
.hover-scale {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* ── 21st.dev: Spotlight Effect ── */
.spotlight {
  position: relative;
  overflow: hidden;
}

.spotlight::after {
  content: '';
  position: absolute;
  top: var(--mouse-y, 50%);
  left: var(--mouse-x, 50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.15) 0%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.spotlight:hover::after {
  opacity: 1;
}

/* ── 21st.dev: Staggered Animation ── */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  animation: staggerFadeIn 0.5s ease forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes staggerFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── 21st.dev: Glassmorphism Sidebar Enhancement ── */
.sidebar.glassmorphism {
  background: rgba(23, 31, 51, 0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .sidebar.glassmorphism {
  background: rgba(255, 255, 255, 0.8);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── 21st.dev: Header Glass Effect ── */
.header.glassmorphism {
  background: rgba(23, 31, 51, 0.85);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .header.glassmorphism {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ── 21st.dev: Drop Zone Enhancement ── */
.drop-zone.enhanced {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.05) 0%,
    rgba(167, 139, 250, 0.02) 100%
  );
  border: 2px dashed rgba(139, 92, 246, 0.3);
  transition: all 0.3s ease;
}

.drop-zone.enhanced:hover {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.1) 0%,
    rgba(167, 139, 250, 0.05) 100%
  );
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.1);
}

/* ── 21st.dev: Tab Animation Enhancement ── */
.tab.animated {
  position: relative;
  overflow: hidden;
}

.tab.animated::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.tab.animated:hover::before {
  width: 100%;
}

.tab.animated.active::before {
  width: 100%;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ── 21st.dev: Code Editor Glow ── */
textarea.code-editor:focus {
  box-shadow: 
    inset 0 0 0 1px rgba(139, 92, 246, 0.3),
    0 0 40px rgba(139, 92, 246, 0.05);
}

/* ── 21st.dev: Compress All Button Enhancement ── */
.compress-all-btn.enhanced {
  background: linear-gradient(135deg, var(--accent), var(--ai));
  position: relative;
  overflow: hidden;
}

.compress-all-btn.enhanced::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.compress-all-btn.enhanced:hover::before {
  opacity: 1;
}

.compress-all-btn.enhanced:hover {
  box-shadow: 
    0 6px 24px var(--accent-glow),
    0 0 60px rgba(139, 92, 246, 0.2);
}

/* ── 21st.dev: Output Panel Glass ── */
.output-panel.glassmorphism {
  background: rgba(11, 19, 38, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

:root[data-theme="light"] .output-panel.glassmorphism {
  background: rgba(248, 250, 252, 0.9);
}

/* ── 21st.dev: AI Overlay Enhancement ── */
.ai-overlay.glassmorphism {
  background: rgba(11, 19, 38, 0.9);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
}

.ai-card.glassmorphism {
  background: rgba(23, 31, 51, 0.9);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 24px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ── 21st.dev: Toast Enhancement ── */
.toast.enhanced {
  background: rgba(23, 31, 51, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ── 21st.dev: Find Bar Enhancement ── */
.find-bar.enhanced {
  background: rgba(23, 31, 51, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── 21st.dev: Stats Bar Enhancement ── */
.stats-bar.glassmorphism {
  background: rgba(23, 31, 51, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── 21st.dev: Author Card Enhancement ── */
.sidebar-author.glassmorphism {
  background: rgba(23, 31, 51, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ── 21st.dev: Focus Ring Enhancement ── */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── 21st.dev: Smooth Scroll ── */
* {
  scroll-behavior: smooth;
}

/* ── 21st.dev: Selection Color ── */
::selection {
  background: rgba(139, 92, 246, 0.3);
  color: var(--text);
}

/* ── 21st.dev: Placeholder Style ── */
::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── 21st.dev: Scrollbar Enhancement ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

:root[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}
