/* ═══════════════════════════════════════════════════════════════════════════
   TTS STUDIO — STYLES.CSS
   Premium AI design (Vercel × Cursor × Notion aesthetic)
   ═══════════════════════════════════════════════════════════════════════════ */


/* ─── Reset ──────────────────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

[hidden], .hidden {
  display: none !important;
}


/* ─── Design Tokens ──────────────────────────────────────────────────────── */

:root {
  /* Brand gradient */
  --brand-1: #7C6FF5;
  --brand-2: #06B6D4;
  --brand-gradient: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 100%);
  
  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* DARK theme (default) */
html[data-theme="dark"] {
  --bg-base: #0a0a0f;
  --bg-surface: #14141c;
  --bg-elevated: #1a1a24;
  --bg-input: #20202c;
  --bg-hover: #25253a;
  --bg-active: #2a2a40;
  
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-emphasis: rgba(124, 111, 245, 0.5);
  
  --text-primary: #f5f5fa;
  --text-secondary: #a0a0b8;
  --text-tertiary: #6c6c85;
  --text-disabled: #4a4a60;
  
  --accent: #7C6FF5;
  --accent-hover: #8b7df8;
  --accent-soft: rgba(124, 111, 245, 0.1);
  
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.1);
  
  --shadow-color: 0, 0, 0;
  
  color-scheme: dark;
}

/* LIGHT theme */
html[data-theme="light"] {
  --bg-base: #fafafa;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-input: #f4f4f7;
  --bg-hover: #ececf2;
  --bg-active: #e2e2ec;
  
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-default: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --border-emphasis: rgba(124, 111, 245, 0.5);
  
  --text-primary: #0a0a0f;
  --text-secondary: #4a4a60;
  --text-tertiary: #6c6c85;
  --text-disabled: #a0a0b8;
  
  --accent: #6356e5;
  --accent-hover: #5447dc;
  --accent-soft: rgba(99, 86, 229, 0.08);
  
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.1);
  
  --shadow-color: 0, 0, 0;
  
  color-scheme: light;
}


/* ─── Scrollbar ──────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-base);
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}


/* ─── Typography ─────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-mono { font-family: 'JetBrains Mono', monospace; }

.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }


/* ─── Login Screen ───────────────────────────────────────────────────────── */

.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-base);
  background-image: 
    radial-gradient(ellipse 1200px 600px at top, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(ellipse 800px 400px at bottom, rgba(6, 182, 212, 0.08) 0%, transparent 60%);
  z-index: 1000;
  padding: var(--space-6);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-xl);
}

.login-logo {
  display: grid;
  place-items: center;
  margin-bottom: var(--space-6);
}

.login-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-2);
  letter-spacing: -0.03em;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

.login-form {
  display: grid;
  gap: var(--space-3);
}

.login-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-top: var(--space-3);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-help {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-tertiary);
}


/* ─── App Layout ─────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
}

.header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-6);
  padding: 0 var(--space-6);
  background: rgba(20, 20, 28, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

html[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.8);
}

.header-left {
  display: flex;
  align-items: center;
}

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

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.main {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  min-height: calc(100vh - 64px);
}


/* ─── Top Navigation ─────────────────────────────────────────────────────── */

.nav-tabs {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  justify-content: center;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-tab .icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--accent-soft);
}

.nav-tab.active .icon {
  stroke: var(--accent);
}


/* ─── Mobile Navigation (bottom) ─────────────────────────────────────────── */

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-2) var(--space-2);
  background: rgba(20, 20, 28, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 90;
  padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
}

html[data-theme="light"] .mobile-nav {
  background: rgba(255, 255, 255, 0.9);
}

.mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  min-width: 0;
  flex: 1;
  transition: all var(--transition);
}

.mobile-tab .icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-tab.active {
  color: var(--accent);
}

.mobile-tab:active {
  background: var(--bg-hover);
}


/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: all var(--transition);
  cursor: pointer;
  user-select: none;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

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

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

.btn-primary {
  background: var(--brand-gradient);
  border-color: transparent;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(124, 111, 245, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.1);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(124, 111, 245, 0.35);
}

.btn-success {
  background: var(--success);
  border-color: transparent;
  color: white;
}

.btn-danger {
  background: var(--danger);
  border-color: transparent;
  color: white;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
}

.btn-large {
  padding: 14px var(--space-6);
  font-size: 15px;
  border-radius: var(--radius-lg);
}

.btn-small {
  padding: 6px var(--space-3);
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-icon .icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Theme toggle SVGs */
#theme-toggle .icon-sun { display: none; }
#theme-toggle .icon-moon { display: block; }
html[data-theme="light"] #theme-toggle .icon-sun { display: block; }
html[data-theme="light"] #theme-toggle .icon-moon { display: none; }


/* ─── Inputs ─────────────────────────────────────────────────────────────── */

.input,
.textarea,
.select {
  width: 100%;
  padding: 10px var(--space-3);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--border-strong);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.input-large {
  padding: 14px var(--space-4);
  font-size: 15px;
  border-radius: var(--radius-lg);
}

.textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.6;
}

.select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 18px;
  padding-right: var(--space-10);
}


/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition);
}

.card-hover:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

.card-compact {
  padding: var(--space-4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-1);
}


/* ─── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.badge-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(59, 130, 246, 0.2);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(124, 111, 245, 0.2);
}


/* ─── Toast Notifications ────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  min-width: 280px;
  animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toast-slide-in {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-leaving {
  animation: toast-slide-out 0.2s ease-in forwards;
}

@keyframes toast-slide-out {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
}

.toast-success .toast-icon { stroke: var(--success); }
.toast-error .toast-icon { stroke: var(--danger); }
.toast-warning .toast-icon { stroke: var(--warning); }
.toast-info .toast-icon { stroke: var(--info); }


/* ─── Modal ──────────────────────────────────────────────────────────────── */

.modal-container {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 500;
  padding: var(--space-6);
}

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

.modal-content {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modal-pop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  justify-content: flex-end;
}


/* ─── Loading ────────────────────────────────────────────────────────────── */

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(4px);
  z-index: 800;
  gap: var(--space-4);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: var(--space-3);
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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


/* ─── Empty State ────────────────────────────────────────────────────────── */

.empty-state {
  display: grid;
  place-items: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
  gap: var(--space-4);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
}

.empty-state-message {
  color: var(--text-secondary);
  max-width: 360px;
  font-size: 14px;
}


/* ─── View transitions ───────────────────────────────────────────────────── */

.view-enter {
  animation: view-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes view-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.view-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-subtitle {
  color: var(--text-secondary);
  margin-top: var(--space-1);
}


/* ─── HOME view ──────────────────────────────────────────────────────────── */

.home-hero {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  background: 
    radial-gradient(ellipse 800px 400px at center top, var(--accent-soft) 0%, transparent 60%);
  margin-bottom: var(--space-8);
  border-radius: var(--radius-xl);
}

.home-hero-title {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-4);
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.home-hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--space-8);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.stat-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}

.quick-action {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}

.quick-action:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.quick-action-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  color: var(--accent);
  flex-shrink: 0;
}

.quick-action-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-action-label {
  font-size: 14px;
  font-weight: 600;
}

.quick-action-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}


/* ─── VOICES view ────────────────────────────────────────────────────────── */

.voices-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.voices-search {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.voices-search .input {
  padding-left: 40px;
}

.voices-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.voices-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.filter-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.voices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

.voice-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.voice-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.voice-card.is-favorite {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(245, 158, 11, 0.03) 100%);
}

.voice-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.voice-flag {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.voice-info {
  flex: 1;
  min-width: 0;
}

.voice-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  word-break: break-word;
}

.voice-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.voice-meta span:not(:last-child)::after {
  content: '·';
  margin-left: var(--space-2);
  color: var(--border-strong);
}

.voice-rating {
  display: flex;
  gap: 2px;
  align-items: center;
}

.star {
  width: 14px;
  height: 14px;
  fill: var(--border-default);
  cursor: pointer;
  transition: all var(--transition);
}

.star.filled {
  fill: #f59e0b;
}

.star:hover {
  transform: scale(1.2);
}

.voice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.voice-tag {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg-input);
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.voice-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.voice-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.voice-action svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.voice-action.fav-active {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.voice-action.fav-active svg {
  fill: currentColor;
}

.voice-action-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}


/* ─── STUDIO view ────────────────────────────────────────────────────────── */

.studio-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-6);
  align-items: start;
}

.studio-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.studio-side {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.studio-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.studio-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-text-counter {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

.studio-text-counter .est-time {
  color: var(--accent);
  font-weight: 600;
}


/* ─── Slider (range) ─────────────────────────────────────────────────────── */

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

.slider-row label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.slider-row input[type="range"] {
  flex: 1.5;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-input);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 0 0 0 var(--accent-soft);
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.slider-value {
  min-width: 38px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.help-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-tertiary);
  display: inline-grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  cursor: help;
}


/* ─── Switch / Checkbox ──────────────────────────────────────────────────── */

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  position: relative;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border-default);
}

.switch input::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: all var(--transition);
}

.switch input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked::after {
  left: 17px;
  background: white;
}

.switch label {
  font-size: 13px;
  cursor: pointer;
}


/* ─── Audio Player ───────────────────────────────────────────────────────── */

.audio-player {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

.audio-player-play {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.audio-player-play:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.audio-player-play svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.audio-player-progress {
  flex: 1;
  height: 4px;
  background: var(--border-default);
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: pointer;
}

.audio-player-progress-bar {
  height: 100%;
  background: var(--brand-gradient);
  width: 0%;
  transition: width 100ms linear;
}

.audio-player-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  min-width: 70px;
  text-align: right;
}


/* ─── Recently Used / Favorites side panel ───────────────────────────────── */

.voice-mini-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.voice-mini {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  color: var(--text-secondary);
}

.voice-mini:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.voice-mini.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.voice-mini-flag {
  font-size: 18px;
}


/* ─── Confirmation dialog text ───────────────────────────────────────────── */

.confirm-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.confirm-detail {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin: var(--space-3) 0;
  color: var(--text-primary);
}


/* ─── Responsive ─────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
  
  .studio-side {
    position: static;
  }
  
  .voices-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  
  .home-hero-title {
    font-size: 36px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .header {
    grid-template-columns: auto auto;
    gap: var(--space-3);
    padding: 0 var(--space-4);
  }
  
  .nav-tabs {
    display: none;
  }
  
  .mobile-nav {
    display: flex;
    gap: 2px;
  }
  
  .main {
    padding: var(--space-5) var(--space-4);
    padding-bottom: 100px;
  }
  
  .voices-grid {
    grid-template-columns: 1fr;
  }
  
  .voices-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .voices-search {
    width: 100%;
  }
  
  .home-hero {
    padding: var(--space-8) var(--space-4);
  }
  
  .home-hero-title {
    font-size: 28px;
  }
  
  .home-hero-subtitle {
    font-size: 15px;
  }
  
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }
  
  .toast {
    min-width: 0;
  }
  
  .modal-content {
    padding: var(--space-6);
  }
  
  .voice-card {
    padding: var(--space-4);
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .view-title {
    font-size: 22px;
  }
  
  /* Hide menu-toggle on mobile (use bottom nav instead) */
  #menu-toggle {
    display: none;
  }
  
  .logo-text {
    font-size: 14px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .header-right .btn-icon {
    width: 32px;
    height: 32px;
  }
  
  .filter-chip {
    font-size: 12px;
    padding: 4px 10px;
  }
  
  .mobile-tab span {
    font-size: 9px;
  }
}


/* ─── Reduce motion (accessibility) ──────────────────────────────────────── */

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


/* ─── Focus visible (keyboard navigation) ────────────────────────────────── */

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

button:focus-visible,
a:focus-visible {
  outline-offset: 4px;
}


/* ─── Utilities ──────────────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.w-full { width: 100%; }


/* === ETAP 3 ADDITIONS === */

/* ─── Mobile safe area fixes ───────────────────────────────────────────── */

@supports (padding: max(0px)) {
  .header {
    padding-left: max(var(--space-6), env(safe-area-inset-left));
    padding-right: max(var(--space-6), env(safe-area-inset-right));
  }
  
  .main {
    padding-left: max(var(--space-6), env(safe-area-inset-left));
    padding-right: max(var(--space-6), env(safe-area-inset-right));
  }
  
  .mobile-nav {
    padding-left: max(var(--space-2), env(safe-area-inset-left));
    padding-right: max(var(--space-2), env(safe-area-inset-right));
  }
}

@media (max-width: 768px) {
  .main {
    padding-left: max(var(--space-4), env(safe-area-inset-left));
    padding-right: max(var(--space-4), env(safe-area-inset-right));
  }
}

/* ─── Voice picker modal ──────────────────────────────────────────────── */

.voice-picker-modal {
  max-height: 70vh;
  overflow-y: auto;
}

.picker-section {
  margin-bottom: 16px;
}

.picker-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.picker-voices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.picker-voice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  cursor: pointer;
  transition: all 150ms;
}

.picker-voice-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.picker-langs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.voice-selected-card {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
}


/* ─── Recent jobs in Studio ───────────────────────────────────────────── */

.recent-job {
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: all 150ms;
}

.recent-job:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}


/* ─── Upload dropzone ─────────────────────────────────────────────────── */

.upload-dropzone {
  border: 2px dashed var(--border-default);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 200ms;
  background: var(--bg-input);
}

.upload-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.02);
}


/* ─── Studio result + audio player ────────────────────────────────────── */

#studio-result audio {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-input);
}

audio::-webkit-media-controls-panel {
  background-color: var(--bg-input);
}


/* ─── Better switch ───────────────────────────────────────────────────── */

.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.switch input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 9999px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  position: relative;
  cursor: pointer;
  transition: all 150ms;
  flex-shrink: 0;
}

.switch input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: all 150ms;
}

.switch input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input[type="checkbox"]:checked::after {
  left: 17px;
  background: white;
}

.switch label {
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
}


/* ─── Mobile fixes for Studio ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .picker-voices {
    grid-template-columns: 1fr;
  }
  
  .grid-2 {
    grid-template-columns: 1fr !important;
  }
}


/* === ETAP 3 BTN ICON FIX === */

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-large svg {
  width: 20px;
  height: 20px;
}

.btn-small svg {
  width: 14px;
  height: 14px;
}

/* Icon size in studio buttons */
#studio-generate-btn svg,
#studio-download-btn svg,
#studio-regenerate-btn svg {
  width: 20px !important;
  height: 20px !important;
}

#studio-generate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Studio section title icons */
.studio-section-title svg {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
}

/* Quick action icon — keep larger but bounded */
.quick-action-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-action-icon svg {
  width: 24px;
  height: 24px;
}

/* Recent jobs clock icon */
.studio-section-title:has(svg) {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Voice picker card */
.picker-voice-card svg {
  width: 16px;
  height: 16px;
}

/* Picker modal scroll */
.modal-body .voice-picker-modal {
  padding-right: 8px;
}


/* === ETAP 4 — Engine Selector === */

.engine-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.engine-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  cursor: pointer;
  transition: all 150ms;
  font-family: inherit;
  color: var(--text-primary);
}

.engine-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.engine-card.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: 0 0 0 1px var(--accent);
}

.engine-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.engine-name {
  font-size: 13px;
  font-weight: 600;
}

.engine-desc {
  font-size: 11px;
  color: var(--text-tertiary);
}

@media (max-width: 768px) {
  .engine-picker {
    grid-template-columns: 1fr 1fr;
  }
}
