/* ============================================================
   SeaDoc — Design System
   ============================================================
   Tokens, composants, pages. Une seule source de vérité.
   ============================================================ */

/* ---- TOKENS ---- */
:root {
  /* Brand — violet-only (remplace l'indigo pour la dominance couleur) */
  --indigo-50:  #f5f3ff;   /* violet-50 */
  --indigo-100: #ede9fe;   /* violet-100 */
  --indigo-200: #ddd6fe;   /* violet-200 */
  --indigo-300: #c4b5fd;   /* violet-300 */
  --indigo-400: #a78bfa;   /* violet-400 */
  --indigo-500: #8b5cf6;   /* violet-500 (main) */
  --indigo-600: #7c3aed;   /* violet-600 */
  --indigo-700: #6d28d9;   /* violet-700 */

  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;

  /* Neon tokens */
  --neon-rgb: 139, 92, 246;
  --shadow-neon-xs:  0 0  8px rgba(var(--neon-rgb), 0.35);
  --shadow-neon-sm:  0 0 16px rgba(var(--neon-rgb), 0.45);
  --shadow-neon-md:  0 0 24px rgba(var(--neon-rgb), 0.55);
  --shadow-neon-lg:  0 0 40px rgba(var(--neon-rgb), 0.65);
  --ring-neon:       0 0 0 3px rgba(var(--neon-rgb), 0.28), var(--shadow-neon-sm);

  /* Grays (Tailwind-like, warm) */
  --gray-25:  #fcfcfd;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --success-50:  #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --warn-50:    #fffbeb;
  --warn-100:   #fef3c7;
  --warn-500:   #f59e0b;
  --warn-700:   #b45309;

  --danger-50:  #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  /* Surfaces */
  --bg:          var(--gray-50);
  --surface:     #ffffff;
  --surface-2:   var(--gray-50);
  --surface-3:   var(--gray-100);

  /* Text */
  --fg:          var(--gray-900);
  --fg-secondary: var(--gray-600);
  --fg-muted:    var(--gray-500);
  --fg-subtle:   var(--gray-400);
  --fg-inverse:  #ffffff;

  /* Borders */
  --border:        var(--gray-200);
  --border-strong: var(--gray-300);

  /* Shadows — très subtils, façon Stripe */
  --shadow-xs:   0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:   0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:   0 4px 8px  -1px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:   0 12px 20px -4px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-xl:   0 24px 48px -12px rgba(15, 23, 42, 0.18), 0 6px 12px rgba(15, 23, 42, 0.06);
  --shadow-primary:    0 4px 14px rgba(var(--neon-rgb), 0.30), 0 0 14px rgba(var(--neon-rgb), 0.18);
  --shadow-primary-lg: 0 12px 28px rgba(var(--neon-rgb), 0.40), 0 0 24px rgba(var(--neon-rgb), 0.25);

  /* Gradients — 100% violet néon */
  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  --gradient-hero:    linear-gradient(135deg, #6d28d9 0%, #8b5cf6 45%, #a855f7 100%);
  --gradient-title:   linear-gradient(100deg, #6d28d9 0%, #8b5cf6 30%, #a855f7 55%, #c084fc 80%, #e9d5ff 100%);

  /* Radius */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* 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;

  /* Transitions */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
  --t-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-sticky: 30;
  --z-overlay: 80;
  --z-modal: 100;
  --z-toast: 120;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, h5, h6, p, figure, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; padding: 0; }
[hidden], .hidden { display: none !important; }

html, body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Fond avec auras violettes diffuses */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(139, 92, 246, 0.14), transparent 60%),
    radial-gradient(ellipse 55% 40% at 85% 90%, rgba(168, 85, 247, 0.12), transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(109, 40, 217, 0.05), transparent 70%);
  pointer-events: none;
}

/* Typography */
h1 {
  font-size: clamp(32px, 5.5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  background: var(--gradient-title);
  background-size: 220% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 0 14px rgba(var(--neon-rgb), 0.45))
    drop-shadow(0 0 30px rgba(var(--neon-rgb), 0.25));
  transition: background-position 1.4s ease, filter var(--t-base);
  display: inline-block;
  padding-right: 4px;
}
h1:hover {
  background-position: 100% 50%;
  filter:
    drop-shadow(0 0 18px rgba(var(--neon-rgb), 0.65))
    drop-shadow(0 0 40px rgba(var(--neon-rgb), 0.35));
}
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; color: var(--fg); }
h3 { font-size: 14px; font-weight: 600; letter-spacing: 0.02em; line-height: 1.4; color: var(--fg-secondary); text-transform: uppercase; }

/* ---- SIDEBAR ---- */
:root { --sidebar-w: 240px; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--indigo-100);
  box-shadow: 1px 0 0 rgba(var(--neon-rgb), 0.05), 6px 0 24px -8px rgba(var(--neon-rgb), 0.12);
  display: flex; flex-direction: column;
  padding: var(--space-5) var(--space-3) var(--space-3);
  z-index: var(--z-sticky);
  transition: transform var(--t-slow);
  overflow-y: auto;
}

.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.015em;
  padding: 4px 10px;
  margin-bottom: var(--space-5);
}
.sidebar .brand-logo {
  height: 48px;
  width: auto;
  max-width: 100%;
  flex-shrink: 0;
}
.brand-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--violet-500, #8b5cf6);
}

/* Nav links */
.side-nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1;
}
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.side-nav a svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--fg-muted);
  transition: color var(--t-fast);
}
.side-nav a:hover {
  background: var(--surface-3);
  color: var(--fg);
}
.side-nav a:hover svg { color: var(--indigo-500); }
.side-nav a.active {
  background: var(--indigo-50);
  color: var(--indigo-700);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--indigo-200), 0 0 12px rgba(var(--neon-rgb), 0.15);
}
.side-nav a.active svg { color: var(--indigo-600); filter: drop-shadow(0 0 4px rgba(var(--neon-rgb), 0.55)); }
.side-nav a.active::before {
  content: "";
  position: absolute;
  left: -11px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--indigo-600);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(var(--neon-rgb), 0.75);
}

/* Credit card */
.sidebar-credits {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin: var(--space-3) 0 var(--space-3);
  background: linear-gradient(135deg, rgba(139,92,246,0.10), rgba(168,85,247,0.10));
  border: 1px solid var(--indigo-200);
  border-radius: var(--radius-lg);
  color: var(--fg);
  transition: all var(--t-fast);
  position: relative;
  box-shadow: 0 0 18px rgba(var(--neon-rgb), 0.12);
}
.sidebar-credits:hover {
  background: linear-gradient(135deg, rgba(139,92,246,0.16), rgba(168,85,247,0.16));
  border-color: var(--indigo-400);
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(var(--neon-rgb), 0.30), 0 4px 12px rgba(var(--neon-rgb), 0.15);
}
.sidebar-credits .sc-icon { filter: drop-shadow(0 0 6px rgba(var(--neon-rgb), 0.55)); }
.sidebar-credits.is-empty {
  background: var(--warn-50);
  border-color: var(--warn-100);
}
.sidebar-credits .sc-icon { width: 28px; height: 28px; flex-shrink: 0; }
.sidebar-credits .sc-body { min-width: 0; flex: 1; }
.sidebar-credits .sc-value {
  font-size: 13px; font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.sidebar-credits .sc-value span { color: var(--indigo-700); }
.sidebar-credits.is-empty .sc-value span { color: var(--warn-700); }
.sidebar-credits .sc-sub {
  font-size: 11px; color: var(--fg-muted);
  margin-top: 1px;
}

/* Footer */
.sidebar-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.nav-user {
  color: var(--fg-muted);
  font-size: 12px;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-logout {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  color: var(--fg-muted);
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.nav-logout svg { width: 16px; height: 16px; }
.nav-logout:hover { background: var(--danger-50); color: var(--danger-600); }

/* Main shift for sidebar */
main { margin-left: var(--sidebar-w); }

/* Mobile header (hidden on desktop) */
.mobile-header { display: none; }

/* Hamburger */
.nav-toggle {
  width: 40px; height: 40px;
  display: none;
  align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  cursor: pointer;
  transition: background var(--t-fast);
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle .nt-close { display: none; }
.nav-toggle:hover { background: var(--surface-2); }

/* Backdrop */
.nav-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-base), visibility var(--t-base);
  z-index: var(--z-overlay);
}

/* MOBILE */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .mobile-header {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: var(--z-sticky);
    height: 56px;
    padding: 0 var(--space-4);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-header .brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 16px; font-weight: 700;
    color: var(--fg);
    letter-spacing: -0.015em;
  }
  .mobile-header .brand-logo {
    height: 36px;
    width: auto;
  }

  .nav-toggle { display: inline-flex; }

  .sidebar {
    width: min(280px, 88vw);
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
  body.nav-open .nav-toggle .nt-open { display: none; }
  body.nav-open .nav-toggle .nt-close { display: block; }
  body.nav-open { overflow: hidden; }
}

/* ---- MAIN LAYOUT ---- */
main {
  max-width: calc(1200px + var(--sidebar-w));
  padding: var(--space-10) var(--space-8) var(--space-16);
}
@media (max-width: 900px) {
  main {
    margin-left: 0;
    max-width: 100%;
    padding: var(--space-6) var(--space-4) var(--space-10);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
main > * { animation: fadeIn var(--t-slow); }

/* ---- BUTTONS ---- */
.primary, button.primary, a.primary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  color: var(--fg-inverse) !important;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
  box-shadow: var(--shadow-primary);
  text-decoration: none;
}
.primary:hover:not(:disabled), button.primary:hover:not(:disabled), a.primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-primary-lg);
  filter: brightness(1.05);
}
.primary:active:not(:disabled) { transform: translateY(0); }
.primary:disabled, button.primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.ctrl-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  height: 36px;
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--t-fast);
}
.ctrl-btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--gray-400);
  color: var(--fg);
}
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ctrl-btn.primary { background: var(--indigo-600); border-color: var(--indigo-600); color: var(--fg-inverse); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 12px;
  height: 32px;
  background: transparent;
  color: var(--indigo-600);
  font-size: 12px;
  font-weight: 600;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-ghost:hover {
  background: var(--indigo-50);
  border-style: solid;
  border-color: var(--indigo-200);
}

.btn-delete {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  height: 30px;
  background: transparent;
  color: var(--danger-600);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-delete:hover { background: var(--danger-50); border-color: var(--danger-100); }

.btn-remove-row {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 18px;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t-fast);
}
.btn-remove-row:hover { background: var(--danger-50); border-color: var(--danger-100); color: var(--danger-600); }

/* ---- INPUTS ---- */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  padding: 8px 12px;
  height: 36px;
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-family: inherit;
}
textarea {
  height: auto; min-height: 80px;
  padding: 10px 12px;
  resize: vertical; line-height: 1.5;
}
select { cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  appearance: none; -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--fg-subtle); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--violet-500);
  box-shadow: var(--ring-neon);
}

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover {
  border-color: var(--violet-300);
  box-shadow: var(--shadow-sm), var(--shadow-neon-xs);
}
.card h2 { margin-bottom: 6px; font-size: 16px; }
.card p, .card .hint { color: var(--fg-secondary); font-size: 13px; margin-bottom: 16px; }
.card code {
  background: var(--surface-3);
  color: var(--indigo-700);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 0.88em;
}
.card ul { color: var(--fg-secondary); font-size: 13px; padding-left: 18px; list-style: disc; }
.card ul ul { margin-top: 4px; list-style: circle; }
.card li { margin-bottom: 4px; }
.card form + .hint { margin-top: 8px; }

/* ---- FLASH ---- */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  animation: fadeIn var(--t-base);
}
.flash-ok     { background: var(--success-50);  color: var(--success-700);  border: 1px solid var(--success-100); }
.flash-error  { background: var(--danger-50);   color: var(--danger-700);   border: 1px solid var(--danger-100); }
.flash-warn   { background: var(--warn-50);     color: var(--warn-700);     border: 1px solid var(--warn-100); }

/* =============================================================
   PAGE HEAD (shared titre/subtitle)
   ============================================================= */
.page-head { margin-bottom: var(--space-6); }
.page-head h1 { margin-bottom: 8px; }
.page-head .subtitle { color: var(--fg-muted); font-size: 14px; max-width: 640px; }

/* =============================================================
   HOMEPAGE — Recorder
   ============================================================= */
.recorder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 960px) { .recorder { grid-template-columns: 1fr; } }

.recorder-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--space-10) var(--space-8) var(--space-8);
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 560px) {
  .recorder-main { padding: var(--space-8) var(--space-4) var(--space-6); }
  .mic-btn { --size: 140px; }
  .timer { font-size: 32px; }
}
.recorder-main::before {
  content: "";
  position: absolute;
  top: -40%; left: 50%;
  width: 700px; height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(var(--neon-rgb), 0.22), transparent 55%);
  pointer-events: none;
  z-index: 0;
  animation: pulseGlow 6s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;   transform: translateX(-50%) scale(1.12); }
}

/* Session setup */
.session-setup {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  width: 100%; max-width: 520px;
  margin-bottom: var(--space-8);
}
@media (max-width: 560px) { .session-setup { grid-template-columns: 1fr; } }
.ss-field { display: flex; flex-direction: column; gap: 6px; }
.ss-field > span {
  font-size: 11px; font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ss-create-hint {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--indigo-600);
  font-size: 12px;
  font-weight: 600;
}
.ss-create-hint:hover { text-decoration: underline; }

/* Credit info */
.credit-info {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  margin-bottom: var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  box-shadow: var(--shadow-xs);
}
.credit-info .ci-value { font-weight: 700; color: var(--indigo-600); }
.credit-info .ci-value.zero { color: var(--danger-600); }
.credit-info .ci-label { color: var(--fg-secondary); }
.credit-info .ci-minutes { color: var(--fg-muted); font-size: 12px; }
.credit-info .ci-action {
  margin-left: 4px;
  padding: 4px 10px;
  background: var(--indigo-600);
  color: var(--fg-inverse);
  font-weight: 600;
  font-size: 12px;
  border-radius: var(--radius-full);
  transition: background var(--t-fast);
}
.credit-info .ci-action:hover { background: var(--indigo-700); }

/* Mic button — hero */
.mic-btn {
  --size: 168px;
  position: relative; z-index: 1;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  border: none;
  background: var(--gradient-hero);
  color: var(--fg-inverse);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow:
    0 0 60px rgba(var(--neon-rgb), 0.55),
    0 18px 40px -10px rgba(var(--neon-rgb), 0.70),
    0 6px 14px -2px rgba(var(--neon-rgb), 0.40),
    inset 0 2px 6px rgba(255, 255, 255, 0.30),
    inset 0 -8px 16px rgba(109, 40, 217, 0.35);
  transition: transform var(--t-spring), box-shadow var(--t-base);
}
.mic-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 0 80px rgba(var(--neon-rgb), 0.75),
    0 24px 52px -10px rgba(var(--neon-rgb), 0.85),
    0 8px 18px -2px rgba(var(--neon-rgb), 0.55),
    inset 0 2px 6px rgba(255, 255, 255, 0.35),
    inset 0 -8px 16px rgba(109, 40, 217, 0.35);
}
.mic-btn:active:not(:disabled) { transform: translateY(-1px) scale(0.99); }
.mic-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.3); }
.mic-btn .mic-icon {
  width: 48%; height: 48%;
  stroke-width: 2.2;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.20));
  transition: transform var(--t-base);
}
.mic-btn:hover:not(:disabled) .mic-icon { transform: scale(1.05); }

.mic-btn[data-state="recording"] {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #f43f5e 100%);
  animation: micRecord 2s ease-in-out infinite;
}
.mic-btn[data-state="recording"]::before,
.mic-btn[data-state="recording"]::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(244, 63, 94, 0.45);
  animation: ripple 2s ease-out infinite;
  pointer-events: none;
}
.mic-btn[data-state="recording"]::after { animation-delay: 1s; }
@keyframes micRecord {
  0%, 100% { box-shadow: 0 18px 36px -10px rgba(220, 38, 38, 0.55), 0 6px 12px -2px rgba(239, 68, 68, 0.30), inset 0 2px 6px rgba(255,255,255,0.25), inset 0 -8px 16px rgba(185, 28, 28, 0.30); }
  50%      { box-shadow: 0 24px 52px -10px rgba(220, 38, 38, 0.80), 0 8px 16px -2px rgba(239, 68, 68, 0.50), inset 0 2px 6px rgba(255,255,255,0.25), inset 0 -8px 16px rgba(185, 28, 28, 0.30); }
}
@keyframes ripple {
  0%   { transform: scale(1);   opacity: 0.9; }
  100% { transform: scale(1.55); opacity: 0; }
}
.mic-btn[data-state="paused"] {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  animation: none;
}

/* Status + timer */
.recorder-status {
  position: relative; z-index: 1;
  text-align: center; margin-top: var(--space-6);
}
#status-label {
  font-size: 11px; font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.timer {
  margin-top: 6px;
  font-size: 40px; font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  line-height: 1;
}
.recorder-controls {
  position: relative; z-index: 1;
  display: flex; gap: 10px;
  margin-top: var(--space-8);
}

/* Dashboard (checklist live) */
.dashboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.dashboard h2 { margin-bottom: 2px; }
.dashboard .hint {
  color: var(--fg-muted); font-size: 12px;
  display: flex; align-items: center; gap: 6px;
  margin-bottom: var(--space-5);
}
.dashboard .hint::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.20);
  animation: dot 1.8s ease-in-out infinite;
}
@keyframes dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.35); }
  70%      { box-shadow: 0 0 0 10px rgba(99,102,241,0); }
}

.checklist-live { display: flex; flex-direction: column; gap: 6px; }
.cl-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--t-base);
  animation: fadeIn var(--t-base);
}
.cl-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  transition: all var(--t-base);
  flex-shrink: 0;
}
.cl-body { min-width: 0; }
.cl-key {
  font-size: 13px; font-weight: 600; color: var(--fg);
  word-break: break-word;
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.cl-desc {
  font-size: 12px; color: var(--fg-muted);
  margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cl-status {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  opacity: 0; transform: scale(0.5);
  transition: all var(--t-spring);
  color: var(--success-600);
  font-weight: 700;
}
.cl-status::before { content: "✓"; font-size: 14px; }

.cl-item.cl-done {
  background: var(--success-50);
  border-color: var(--success-100);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.18);
}
.cl-item.cl-done .cl-dot {
  background: var(--success-500); border-color: var(--success-500);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.cl-item.cl-done .cl-status { opacity: 1; transform: scale(1); }

.cl-progress {
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.cl-progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full); overflow: hidden;
}
.cl-progress-bar span {
  display: block; height: 100%; width: 0%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--t-slow);
}
.cl-progress-text {
  margin-top: 8px;
  font-size: 12px; color: var(--fg-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cl-progress-text span { color: var(--indigo-600); font-weight: 700; }

.dashboard-empty {
  text-align: center; padding: var(--space-10) var(--space-4);
  color: var(--fg-muted);
}
.dashboard-empty p { font-size: 13px; margin-bottom: 10px; }

/* ---- OVERLAY / MODAL ---- */
.overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  animation: fadeIn var(--t-base);
}
.overlay-inner { text-align: center; color: var(--fg-inverse); }
.spinner {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.20);
  border-top-color: var(--fg-inverse);
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--space-4);
}
@keyframes spin { to { transform: rotate(360deg); } }
#overlay-msg { font-size: 14px; font-weight: 500; }

.modal-inner {
  background: var(--surface);
  color: var(--fg);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-8) var(--space-6);
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: fadeIn var(--t-spring);
}
.modal-icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--space-4);
  display: grid; place-items: center;
  background: var(--warn-50);
  color: var(--warn-700);
  border-radius: 50%;
  font-size: 24px;
}
.modal-inner h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.modal-inner p { color: var(--fg-secondary); font-size: 13px; margin-bottom: 4px; }
.modal-inner .hint { color: var(--fg-muted); margin-bottom: var(--space-5); }
.modal-actions {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}

/* =============================================================
   REVIEW PAGE
   ============================================================= */
.review {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr);
  gap: var(--space-6);
}
@media (max-width: 1024px) { .review { grid-template-columns: 1fr; } }
.review-left, .review-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.review-right h2 {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin: var(--space-5) 0 var(--space-3);
}
.review-right h2:first-child { margin-top: 0; }

.pdf-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pdf-tabs .tab {
  background: var(--surface-2);
  color: var(--fg-secondary);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px; font-weight: 500;
  transition: all var(--t-fast);
}
.pdf-tabs .tab:hover { background: var(--surface); color: var(--fg); }
.pdf-tabs .tab.active {
  background: var(--gradient-primary);
  color: var(--fg-inverse);
  border-color: transparent;
  box-shadow: 0 0 14px rgba(var(--neon-rgb), 0.40);
}
#pdf-viewer {
  width: 100%; height: 72vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.no-preview {
  min-height: 72vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--space-4);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  text-align: center;
}
.no-preview .np-name { font-weight: 600; font-size: 14px; color: var(--fg); word-break: break-all; }
.no-preview .hint { color: var(--fg-muted); font-size: 12px; max-width: 360px; }

/* Checklist (review) */
.checklist { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-5); }
.checklist li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px; align-items: start;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--t-fast);
}
.checklist li:hover { background: var(--surface); }
.checklist .dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.check-ok .dot        { background: var(--success-500); box-shadow: 0 0 0 3px var(--success-100); }
.check-missing .dot   { background: var(--danger-500);  box-shadow: 0 0 0 3px var(--danger-100); }
.check-uncertain .dot { background: var(--warn-500);    box-shadow: 0 0 0 3px var(--warn-100); }
.checklist .cl-body { display: flex; flex-direction: column; gap: 3px; }
.checklist strong { font-size: 13px; font-weight: 600; color: var(--fg); font-family: "JetBrains Mono", "SF Mono", Menlo, monospace; font-size: 12px; }
.checklist .cl-note { color: var(--fg-secondary); font-size: 12px; }
.checklist .cl-quote {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--indigo-50);
  color: var(--indigo-700);
  font-size: 12px;
  font-style: italic;
  border-left: 2px solid var(--indigo-500);
  border-radius: 4px;
}

.fields-form { display: grid; gap: 6px; margin-bottom: var(--space-5); }
.fields-form label {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px; align-items: center;
  font-size: 12px; color: var(--fg-secondary);
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-weight: 500;
}
.fields-form input { height: 32px; padding: 6px 10px; font-size: 12px; }
.fields-form .actions { grid-column: 1 / -1; margin-top: 8px; }

.export-actions { display: flex; flex-direction: column; gap: 10px; }
.download-list { display: flex; flex-direction: column; gap: 4px; }
.download-list a {
  display: block;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--fg);
  font-size: 12px; font-weight: 500;
  transition: all var(--t-fast);
}
.download-list a:hover { background: var(--indigo-50); border-color: var(--indigo-100); color: var(--indigo-700); transform: translateX(2px); }

.warn {
  color: var(--warn-700);
  background: var(--warn-50);
  border: 1px solid var(--warn-100);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

/* =============================================================
   ENTRETIENS (list + search)
   ============================================================= */
.entretiens, .entretiens-head + .entretiens-list { max-width: 1000px; }
.entretiens-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-6); flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.subtitle { color: var(--fg-muted); font-size: 13px; margin-top: 4px; }

.search-box { position: relative; flex: 1; max-width: 360px; min-width: 240px; }
.search-box .search-icon {
  position: absolute; top: 50%; left: 12px;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--fg-muted);
  pointer-events: none;
}
.search-box input { padding-left: 36px; }

.entretiens-list { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 640px) {
  .entretiens-head { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }
  .card-stats { display: none !important; }
}

.entretien-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-5);
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--fg);
  transition: all var(--t-fast);
  box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
}
.entretien-card::before {
  content: ""; position: absolute;
  top: 0; left: 0; bottom: 0; width: 3px;
  background: var(--gradient-primary);
  opacity: 0; transition: opacity var(--t-fast);
}
.entretien-card:hover {
  border-color: var(--indigo-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-neon-xs);
}
.entretien-card:hover::before { opacity: 1; box-shadow: 0 0 12px rgba(var(--neon-rgb), 0.7); }

.card-main { min-width: 0; }
.card-title {
  font-size: 14px; font-weight: 600;
  color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-others { color: var(--fg-muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.card-type, .card-persons { color: var(--fg-muted); font-size: 12px; }
.card-persons { font-style: italic; }
.card-meta {
  display: flex; gap: 10px; align-items: center;
  margin-top: 4px;
  font-size: 12px;
}
.card-meta .date { color: var(--fg-muted); font-variant-numeric: tabular-nums; }

.status {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.status-recording  { background: var(--danger-50);  color: var(--danger-700); }
.status-reviewing  { background: var(--indigo-50);  color: var(--indigo-700); }
.status-completed  { background: var(--success-50); color: var(--success-700); }
.status-unknown    { background: var(--surface-3);  color: var(--fg-muted); }

.card-stats { display: flex; gap: var(--space-5); }
.card-stats .stat { text-align: center; min-width: 44px; }
.card-stats .stat strong {
  display: block;
  font-size: 16px; font-weight: 700;
  color: var(--indigo-600);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.card-stats .stat span {
  display: block; margin-top: 3px;
  font-size: 10px; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.card-arrow {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  color: var(--fg-subtle);
  transition: all var(--t-fast);
}
.card-arrow svg { width: 16px; height: 16px; }
.entretien-card:hover .card-arrow { color: var(--indigo-500); transform: translateX(3px); }

.empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  color: var(--fg-muted);
}
.empty p { font-size: 13px; }
.empty p + p { margin-top: 6px; }
.primary-link {
  display: inline-block;
  margin-top: var(--space-4);
  color: var(--indigo-600);
  font-weight: 600;
  font-size: 13px;
}
.primary-link:hover { color: var(--indigo-700); }

/* =============================================================
   TYPES D'ENTRETIEN
   ============================================================= */
.types-list { max-width: 1000px; }
.inline-new { display: flex; gap: 8px; align-items: center; }
.inline-new input { width: 240px; }

.types-head {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
@media (max-width: 640px) {
  .types-head { flex-direction: column; align-items: stretch; }
  .rename-form { flex-wrap: wrap; }
  .inline-delete { margin-left: 0; }
}
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--fg-muted);
  font-size: 13px; font-weight: 500;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--indigo-600); }
.rename-form { display: flex; gap: 8px; align-items: center; flex: 1; }
.rename-input { width: auto; max-width: 400px; flex: 1; font-weight: 600; }
.inline-delete { margin-left: auto; }

/* =============================================================
   SETTINGS
   ============================================================= */
.settings { max-width: 720px; }

/* Upload zone */
.upload-zone { position: relative; margin-bottom: var(--space-3); }
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.upload-label {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  padding: var(--space-8) var(--space-6);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--fg-secondary);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all var(--t-base);
  text-align: center;
}
.upload-label svg {
  width: 28px; height: 28px;
  color: var(--indigo-500);
  transition: transform var(--t-base);
}
.upload-zone:hover .upload-label,
.upload-zone.dragover .upload-label {
  border-color: var(--indigo-400);
  background: var(--indigo-50);
  color: var(--indigo-700);
}
.upload-zone:hover .upload-label svg,
.upload-zone.dragover .upload-label svg {
  transform: translateY(-2px) scale(1.05);
}

/* Templates list */
.templates-list { margin-top: var(--space-5); }
.templates-list h3 { margin-bottom: var(--space-3); }
.template-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 6px;
  transition: all var(--t-fast);
}
.template-item:hover { border-color: var(--border-strong); }
.template-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.template-name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px;
  min-width: 0; flex: 1;
}
.template-name svg {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--indigo-500);
}
.fields-count {
  background: var(--indigo-50);
  color: var(--indigo-700);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em;
}

.template-fields { margin-top: 8px; }
.template-fields summary {
  cursor: pointer;
  font-size: 12px; color: var(--fg-muted);
  list-style: none; padding: 4px 0;
  transition: color var(--t-fast);
}
.template-fields summary::-webkit-details-marker { display: none; }
.template-fields summary::before {
  content: "▸"; margin-right: 4px; color: var(--indigo-500);
  display: inline-block; transition: transform var(--t-fast);
}
.template-fields[open] summary::before { transform: rotate(90deg); }
.template-fields summary:hover { color: var(--fg-secondary); }
.fields-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip {
  background: var(--surface-3);
  color: var(--fg-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
}

/* Dynamic field rows */
.fields-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 6px; align-items: center;
  animation: fadeIn var(--t-base);
}
.field-row input { height: 34px; padding: 6px 10px; font-size: 12px; }
.field-row input:first-child {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  color: var(--indigo-700);
}
.fields-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr auto; }
  .field-row input:first-child { grid-column: 1 / -1; }
}

/* =============================================================
   BOUTIQUE
   ============================================================= */
.boutique { max-width: 1100px; }
.boutique-head {
  display: grid; grid-template-columns: 1fr auto;
  gap: var(--space-6); align-items: end;
  margin-bottom: var(--space-8);
}
@media (max-width: 720px) {
  .boutique-head { grid-template-columns: 1fr; }
  .balance-card { padding: var(--space-4) var(--space-5); }
  .balance-value { font-size: 28px; }
}
@media (max-width: 560px) {
  .packs-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .pack-card { padding: var(--space-5) var(--space-3) var(--space-4); }
  .pack-credits { font-size: 28px; }
  .pack-price { font-size: 16px; }
}
@media (max-width: 380px) {
  .packs-grid { grid-template-columns: 1fr; }
}

.balance-card {
  background: var(--gradient-hero);
  color: var(--fg-inverse);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-xl);
  min-width: 220px;
  box-shadow:
    0 0 40px rgba(var(--neon-rgb), 0.40),
    0 12px 32px rgba(var(--neon-rgb), 0.35);
  text-align: center;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.balance-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 60px rgba(var(--neon-rgb), 0.55),
    0 16px 40px rgba(var(--neon-rgb), 0.45);
}
.balance-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  opacity: 0.85; font-weight: 600;
  margin-bottom: 4px;
}
.balance-value {
  font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.balance-value span { font-size: 13px; font-weight: 500; opacity: 0.9; }
.balance-sub { font-size: 12px; opacity: 0.85; margin-top: 4px; }

.section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin: var(--space-8) 0 var(--space-4);
}
.section-title:first-of-type { margin-top: 0; }

.packs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.pack-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-5) var(--space-5);
  text-align: center;
  transition: all var(--t-base);
  box-shadow: var(--shadow-xs);
}
.pack-card:hover {
  transform: translateY(-2px);
  border-color: var(--indigo-300);
  box-shadow: var(--shadow-md), var(--shadow-neon-xs);
}
.pack-card.selected {
  border-color: var(--indigo-500);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(var(--neon-rgb), 0.25), var(--shadow-neon-sm), var(--shadow-md);
}
.pack-badge {
  position: absolute; top: -10px; left: 50%;
  transform: translateX(-50%);
  background: var(--gradient-primary); color: var(--fg-inverse);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 0 14px rgba(var(--neon-rgb), 0.55), 0 4px 10px rgba(var(--neon-rgb), 0.35);
}
.pack-badge.best { background: var(--success-600); box-shadow: 0 4px 12px rgba(16,185,129,0.35); }

.pack-credits {
  font-size: 36px; font-weight: 800;
  color: var(--fg);
  line-height: 1; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.pack-label {
  font-size: 11px; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 4px;
}
.pack-minutes {
  font-size: 12px; color: var(--indigo-600); font-weight: 600;
  margin: 10px 0 var(--space-5);
}
.pack-price {
  font-size: 20px; font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.pack-unit-price {
  font-size: 11px; color: var(--fg-muted);
  margin-top: 2px;
}
.pack-qty {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: var(--space-5);
}
.qty-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg-secondary);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all var(--t-fast);
}
.qty-btn:hover { background: var(--surface-2); border-color: var(--indigo-400); color: var(--indigo-600); }
.pack-qty input {
  width: 52px; height: 30px;
  padding: 4px;
  text-align: center;
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pack-qty input::-webkit-outer-spin-button,
.pack-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.cart-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  font-size: 13px; color: var(--fg-secondary);
}
.cart-line strong { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.cart-line.big {
  margin-top: 8px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.cart-line.big strong { font-size: 22px; font-weight: 700; color: var(--indigo-600); }
.cart-summary button.primary { width: 100%; margin-top: var(--space-4); height: 44px; font-size: 14px; }

.recurring-card { }
.recurring-active { color: var(--fg); font-size: 13px; margin-bottom: var(--space-4); }

.tier-hint { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-4); padding: 0; list-style: none; }
.tier-hint li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  color: var(--fg-secondary);
}
.tier-hint li strong { color: var(--indigo-700); font-variant-numeric: tabular-nums; }

.recurring-form { display: grid; gap: var(--space-3); }
.recurring-form label { display: flex; flex-direction: column; gap: 4px; max-width: 260px; }
.recurring-form label > span {
  font-size: 11px; font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.recurring-form input { max-width: 200px; font-weight: 600; font-variant-numeric: tabular-nums; }

.recurring-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.rp-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0;
  font-size: 13px; color: var(--fg-secondary);
}
.rp-line strong { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.rp-line.big {
  margin-top: 6px; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.rp-line.big strong { font-size: 18px; font-weight: 700; color: var(--indigo-600); }

/* =============================================================
   LOGIN / REGISTER
   ============================================================= */
.login-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background: var(--bg);
  padding: var(--space-6);
}
.login-body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(139, 92, 246, 0.20), transparent 60%),
    radial-gradient(ellipse 50% 40% at 70% 80%, rgba(168, 85, 247, 0.18), transparent 60%);
}
.login-card { box-shadow: var(--shadow-lg), 0 0 40px rgba(var(--neon-rgb), 0.12); }
.login-main { width: 100%; max-width: 400px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6) var(--space-6);
  box-shadow: var(--shadow-lg);
}
.login-brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 20px; font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-logo {
  height: 80px;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}
.login-subtitle {
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
  margin-bottom: var(--space-5);
}
.login-form { display: flex; flex-direction: column; gap: var(--space-3); }
.login-form label { display: flex; flex-direction: column; gap: 5px; }
.login-form label > span {
  font-size: 11px; font-weight: 600;
  color: var(--fg-secondary);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.login-form input { height: 40px; }
.login-form button.primary { margin-top: 4px; height: 40px; font-size: 14px; }
.login-footer {
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--fg-secondary);
}
.login-footer a { color: var(--indigo-600); font-weight: 600; margin-left: 4px; }
.login-footer a:hover { text-decoration: underline; }
.login-bonus {
  margin-top: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--indigo-600);
}
.login-bonus.big {
  display: block;
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--indigo-700);
  margin: 0 0 var(--space-4);
  font-weight: 500;
}

/* =============================================================
   FLASH TOAST
   ============================================================= */
.flash-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--fg);
  color: var(--fg-inverse);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: var(--z-toast);
  animation: fadeIn var(--t-spring);
}

/* =============================================================
   SCROLLBARS
   ============================================================= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ---- Mode tabs (record / upload audio / upload text) ---- */
.mode-tabs {
  display: flex;
  gap: 6px;
  margin: 1.2rem 0 1rem;
  padding: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-md, 10px);
  flex-wrap: wrap;
}
.mode-tab {
  flex: 1;
  min-width: 120px;
  padding: 0.55rem 0.8rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md, 8px);
  transition: background 0.15s;
}
.mode-tab:hover { background: rgba(255,255,255,0.05); }
.mode-tab.active {
  background: var(--violet-500, #8b5cf6);
  color: white;
  font-weight: 600;
}
.mode-pane { display: none; }
.mode-pane.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mode-pane[data-pane="audio"],
.mode-pane[data-pane="text"] {
  align-items: stretch;
  width: 100%;
  gap: 0.6rem;
}
.mode-pane[data-pane="text"] textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md, 10px);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.2);
  color: inherit;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
}
.text-import-row {
  display: flex;
  align-items: center;
  margin: 0.4rem 0;
}

/* ---- Settings : paramètres avancés repliables ---- */
.ss-advanced {
  margin: 1rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md, 10px);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.ss-advanced summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.2rem 0;
  list-style: none;
  user-select: none;
  opacity: 0.85;
}
.ss-advanced summary::-webkit-details-marker { display: none; }
.ss-advanced summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s;
  margin-right: 0.3rem;
}
.ss-advanced[open] summary::before { transform: rotate(90deg); }
.ss-advanced summary:hover { opacity: 1; }
.ss-advanced .hint { margin: 0.5rem 0 0.8rem; }
