/* ================================================
   NimbleAI — dashboard.css
   Same design tokens as landing (styles.css)
   ================================================ */

:root {
  --bg:        #0a0908;
  --surface:   #131210;
  --surface-2: #1c1a17;
  --surface-3: #262320;

  --accent:        #D4A14A;
  --accent-hover:  #e0b05a;
  --accent-low:    rgba(212, 161, 74, 0.10);
  --accent-border: rgba(212, 161, 74, 0.22);
  --accent-glow:   0 0 32px rgba(212, 161, 74, 0.12);

  --text:   #f0ece6;
  --text-2: #9a9590;
  --text-3: #5a5752;
  --muted:  #9a9590; /* alias for --text-2, referenced in several inline spots */
  --neon:   #D4A14A; /* alias for --accent, referenced by app-core-teams-affiliate.js */
  --neon2:  #e0b05a; /* alias for --accent-hover, referenced by app-core-teams-affiliate.js */

  --viral:        #e2653c;
  --viral-low:    rgba(226, 101, 60, 0.12);
  --viral-border: rgba(226, 101, 60, 0.28);

  --border:   rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.12);

  --success: #4ade80;
  --danger:  #f87171;
  --warning: #fbbf24;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Figtree', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --sidebar-w:  240px;
  --topbar-h:   56px;

  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-full: 9999px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.6);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.7);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.8);

  --t-fast: 150ms ease-out;
  --t-base: 250ms ease-out;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }
ul { list-style: none; }
input, select, textarea { font-family: var(--font-body); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── LAYOUT ─── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: transform var(--t-base);
}

.dash-shell {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 49;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ─── SIDEBAR TOP (logo + collapse toggle) ─── */
.sidebar-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 12px 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.sidebar-collapse-btn {
  position: relative; /* for touch-halo pseudo-element */
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-3);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 16px;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-collapse-btn::before {
  content: '';
  position: absolute;
  inset: -8px; /* 28px + 16px = 44px invisible touch target, visual size unchanged */
}

.sidebar-collapse-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-logo-icon { flex-shrink: 0; }

.sidebar-logo-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo-accent { color: var(--accent); }

/* ─── SIDEBAR NAV ─── */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-group {
  margin-bottom: 4px;
}

.sidebar-group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 16px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 1px 8px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  min-height: 38px;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}

.sidebar-link i {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-link:hover i { opacity: 1; }

.sidebar-link.active {
  background: var(--accent-low);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-link.active i { opacity: 1; color: var(--accent); }

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-link-soon { opacity: 0.5; cursor: default; pointer-events: none; }
.sidebar-link:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.soon-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: var(--r-full);
  background: var(--accent-low);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

/* ─── SIDEBAR FOOTER ─── */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.token-meter {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
}

.token-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.token-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.token-val {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.token-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.token-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent), var(--accent-hover));
  border-radius: var(--r-full);
  transition: width 0.6s ease-out;
}

.token-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.sidebar-upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px;
  background: var(--accent-low);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}

.sidebar-lang-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 4px 0 10px;
}

.sidebar-upgrade-btn:hover {
  background: rgba(212, 161, 74, 0.18);
  box-shadow: var(--accent-glow);
}

/* ─── SIDEBAR ACCOUNT CHIP (opens upward) ─── */
.sidebar-account {
  position: relative;
}

.sidebar-account-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.sidebar-account-chip:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
}

.sidebar-account-chip[aria-expanded="true"] {
  border-color: var(--accent-border);
  background: var(--surface-3);
}

.sidebar-account-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-low);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-account-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-account-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-account-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-caret {
  font-size: 11px;
  color: var(--text-3);
  transition: transform var(--t-base);
  flex-shrink: 0;
}

.sidebar-account-chip[aria-expanded="true"] .sidebar-account-caret {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Dropdown — opens upward, ChatGPT-style */
.sidebar-account-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.97);
  transform-origin: bottom center;
  transition: opacity 200ms cubic-bezier(.16,1,.3,1),
              transform 200ms cubic-bezier(.16,1,.3,1),
              visibility 200ms;
}

.sidebar-account-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

.sidebar-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px);
  animation: sidebarMenuItemIn 220ms cubic-bezier(.16,1,.3,1) forwards;
  transition: background var(--t-fast), color var(--t-fast);
}

.sidebar-account-menu.open .sidebar-account-item:nth-child(1) { animation-delay: 40ms; }
.sidebar-account-menu.open .sidebar-account-item:nth-child(2) { animation-delay: 70ms; }
.sidebar-account-menu.open .sidebar-account-item:nth-child(3) { animation-delay: 100ms; }
.sidebar-account-menu.open .sidebar-account-item:nth-child(4) { animation-delay: 130ms; }
.sidebar-account-menu.open .sidebar-account-item-danger { animation-delay: 160ms; }

.sidebar-account-item i { font-size: 16px; color: var(--text-3); flex-shrink: 0; }
.sidebar-account-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar-account-item:hover i { color: var(--accent); }

.sidebar-account-item-danger { color: var(--danger); opacity: 0; transform: translateY(4px); animation: sidebarMenuItemIn 220ms cubic-bezier(.16,1,.3,1) forwards; }
.sidebar-account-item-danger i { color: var(--danger); }
.sidebar-account-item-danger:hover { background: rgba(248, 113, 113, 0.1); color: var(--danger); }
.sidebar-account-item-danger:hover i { color: var(--danger); }

.sidebar-account-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

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

/* ─── SIDEBAR COLLAPSED (icon-only rail, gain d'espace) ─── */
:root.sidebar-collapsed {
  --sidebar-w: 72px;
}

.sidebar-collapsed .sidebar {
  transition: width var(--t-base);
}

.sidebar-collapsed .sidebar-top {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar-collapsed .sidebar-logo {
  flex: 0 0 auto;
}

.sidebar-collapsed .sidebar-logo-name,
.sidebar-collapsed .sidebar-group-label,
.sidebar-collapsed .sidebar-link span,
.sidebar-collapsed .soon-badge,
.sidebar-collapsed .token-meter,
.sidebar-collapsed .sidebar-upgrade-btn span,
.sidebar-collapsed .sidebar-lang-row,
.sidebar-collapsed .sidebar-account-info,
.sidebar-collapsed .sidebar-account-caret {
  display: none;
}

.sidebar-collapsed .sidebar-collapse-btn i {
  transform: rotate(180deg);
}

.sidebar-collapsed .sidebar-link {
  justify-content: center;
  margin: 1px 8px;
  padding: 8px;
}

.sidebar-collapsed .sidebar-link.active::before {
  left: 0;
}

.sidebar-collapsed .sidebar-upgrade-btn {
  justify-content: center;
  padding: 10px;
}

.sidebar-collapsed .sidebar-account-chip {
  justify-content: center;
  padding: 6px;
}

.sidebar-collapsed .sidebar-account-menu {
  left: 100%;
  bottom: 0;
  width: 220px;
  margin-left: 8px;
  transform-origin: bottom left;
}

@media (max-width: 900px) {
  :root.sidebar-collapsed {
    --sidebar-w: 240px;
  }
  .sidebar-collapsed .sidebar-logo-name,
  .sidebar-collapsed .sidebar-group-label,
  .sidebar-collapsed .sidebar-link span,
  .sidebar-collapsed .soon-badge,
  .sidebar-collapsed .token-meter,
  .sidebar-collapsed .sidebar-upgrade-btn span,
  .sidebar-collapsed .sidebar-lang-row,
  .sidebar-collapsed .sidebar-account-info,
  .sidebar-collapsed .sidebar-account-caret {
    display: revert;
  }
  .sidebar-collapsed .sidebar-top { justify-content: space-between; padding: 16px 12px 12px 16px; }
  .sidebar-collapsed .sidebar-collapse-btn i { transform: none; }
  .sidebar-collapsed .sidebar-link { justify-content: flex-start; padding: 8px 16px; }
  .sidebar-collapsed .sidebar-upgrade-btn { justify-content: flex-start; padding: 10px 14px; }
  .sidebar-collapsed .sidebar-account-chip { justify-content: flex-start; padding: 8px; }
  .sidebar-collapse-btn { display: none; } /* fix: mobile drawer is always expanded, collapse toggle has no purpose here */
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-account-menu, .sidebar-account-item, .sidebar-account-item-danger {
    animation: none !important;
    transition: opacity 120ms linear !important;
  }
  /* Sans animation, opacity:0 (état de départ du keyframe) ne repasse
     jamais à 1 → items invisibles mais toujours cliquables. Fix : forcer
     l'état final directement. */
  .sidebar-account-item, .sidebar-account-item-danger {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ─── TOPBAR ─── */
.topbar {
  height: var(--topbar-h);
  background: rgba(10, 9, 8, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; /* fix: was 36px, below 44px touch target minimum */
  height: 44px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: none;
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.topbar-hamburger:hover { background: var(--surface-2); color: var(--text); }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.topbar-breadcrumb-base {
  color: var(--text-3);
  font-weight: 500;
}

.topbar-breadcrumb-sep {
  color: var(--text-3);
  font-size: 11px;
}

.topbar-breadcrumb-panel {
  color: var(--text);
  font-weight: 600;
}

/* ─── TOPBAR RIGHT WRAPPER ─── */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── NOTIFICATION BELL ─── */
.notif-bell-wrap { position: relative; }

.notif-bell-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: none;
  color: var(--text-2);
  font-size: 17px;
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.notif-bell-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text);
}

.notif-badge-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  border: 2px solid var(--bg, #0a0908);
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}

.notif-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.notif-dropdown-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.notif-mark-all {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.notif-mark-all:hover { text-decoration: underline; }
.notif-mark-all:disabled { opacity: .4; cursor: default; text-decoration: none; }

.notif-list {
  max-height: 380px;
  overflow-y: auto;
}

.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--text-3);
  font-size: 12.5px;
}

.notif-empty i { font-size: 26px; opacity: .5; }

.notif-item {
  display: flex;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
  position: relative;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }

.notif-item.unread { background: rgba(212, 161, 74, 0.05); }
.notif-item.unread:hover { background: rgba(212, 161, 74, 0.09); }

.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.notif-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: var(--surface-3);
  color: var(--text-2);
}

.notif-item-icon.type-video_ready   { background: rgba(74, 222, 128, 0.12); color: var(--success); }
.notif-item-icon.type-low_credits   { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.notif-item-icon.type-credits_purchased { background: rgba(212, 161, 74, 0.15); color: var(--accent); }
.notif-item-icon.type-product_update { background: rgba(61, 155, 255, 0.12); color: #3d9bff; }
.notif-item-icon.type-mcp_connected { background: rgba(184, 148, 255, 0.14); color: #b894ff; }
.notif-item-icon.type-account_switch { background: rgba(61, 155, 255, 0.12); color: #3d9bff; }
.notif-item-icon.type-post_reminder { background: rgba(212, 161, 74, 0.15); color: var(--accent); }

.notif-item-body { flex: 1; min-width: 0; }

.notif-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.35;
}

.notif-item-text {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notif-item-time {
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 4px;
  opacity: .75;
}

.notif-dropdown-loading {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}

@media (max-width: 480px) {
  .notif-dropdown { position: fixed; top: var(--topbar-h); right: 8px; left: 8px; width: auto; }
}

/* ─── ACCOUNT CHIP ─── */
.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  cursor: pointer;
  position: relative;
  transition: border-color var(--t-fast), background var(--t-fast);
  user-select: none;
}

.account-chip:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-low);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-chip-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.account-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--r-full);
}

.account-chip-badge.free {
  background: var(--surface-3);
  color: var(--text-3);
}

.account-chip-badge.premium {
  background: var(--accent-low);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.account-chip-caret {
  font-size: 11px;
  color: var(--text-3);
}

/* Account dropdown */
.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}

.account-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.account-dropdown-profile {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.account-dropdown-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}

.account-dropdown-email {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown-tokens {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.acct-tok-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.acct-tok-val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text-2);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.account-dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.account-dropdown-item-danger:hover {
  background: rgba(248, 113, 113, 0.08);
  color: var(--danger);
}

/* ─── PANELS ─── */
.panels {
  flex: 1;
  padding: 32px 40px 48px;
  overflow-y: auto;
}

.panel {
  display: none;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.panel.active {
  display: block;
  animation: panelIn 250ms ease-out;
}

/* ─── DESKTOP WIDE LAYOUT (PC only — mobile/tablet keep the centered
   760px column via the existing max-width:900px breakpoint below) ─── */
@media (min-width: 1201px) {
  .panel {
    max-width: 1600px;
    margin: 0;
  }

  /* panel-upload gets a two-column layout so the extra width is used for
     a second column instead of stretching a single narrow block full-width */
  #panel-upload .panel-body {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
    align-items: start;
    gap: 24px 32px;
  }

  #panel-upload .panel-body > * {
    grid-column: 1;
  }

  /* Right column: subtitle styling + generated AI metadata */
  #panel-upload #subtitle-section,
  #panel-upload #ai-metadata-card {
    grid-column: 2;
  }

  #panel-upload .upload-zone {
    padding: 56px 24px;
  }
}

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

.panel-header {
  margin-bottom: 28px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.15;
}

.panel-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── UPLOAD ZONE ─── */
.upload-zone {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-xl);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
  -webkit-tap-highlight-color: transparent;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-low);
  box-shadow: var(--accent-glow);
}

.upload-zone:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-border);
}

.upload-zone-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-xl);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--text-2);
  margin-bottom: 4px;
  transition: background var(--t-fast), color var(--t-fast);
}

.upload-zone:hover .upload-zone-icon,
.upload-zone.dragover .upload-zone-icon {
  background: var(--accent-low);
  border-color: var(--accent-border);
  color: var(--accent);
}

.upload-zone-text strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.upload-zone-text span {
  font-size: 13px;
  color: var(--text-2);
}

.upload-zone-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* File info card */
.file-info-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-2);
  min-height: 44px;
}

.file-info-card i {
  font-size: 16px;
  flex-shrink: 0;
}

#file-name-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-thumb {
  position: relative;
  width: 64px;
  height: 36px;
  border-radius: 6px;
  background: var(--surface-3);
  flex-shrink: 0;
  cursor: pointer;
}
.file-preview-thumb::after {
  content: '';
  position: absolute;
  inset: -4px; /* 36px height + 8px = 44px invisible touch target */
}

.file-preview-thumb canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 6px; /* moved here from parent overflow:hidden, so the ::after halo isn't clipped */
}

.file-preview-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 14px;
  border-radius: 6px;
  transition: background var(--t-fast);
}

.file-preview-thumb:hover .file-preview-play { background: rgba(0,0,0,0.4); }

.modal-video-preview { max-width: 560px; }

.video-preview-player {
  width: 100%;
  max-height: 70vh;
  display: block;
  background: #000;
}

.file-info-speed {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

/* ─── TOKEN USAGE CARD (upload panel) ─── */
.token-usage-card {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0 0 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.token-usage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  gap: 12px;
}

.token-usage-head .acct-section-title { margin: 0; }

.token-usage-count {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}

.token-usage-count strong { color: var(--text); font-weight: 600; }

/* ─── INLINE NOTE ───
   For small contextual tips (not a key stat, not actionable):
   a colored left rule instead of a full bordered/filled card. */
.note-inline {
  padding: 10px 0 10px 14px;
  border-left: 2px solid var(--accent-border);
}

/* ─── PANEL SECTIONS ───
   Flow, not boxes: a section is just a region of the panel's
   continuous flow, set off from what came before it by a thin
   top rule instead of a full bordered/filled card. */
.panel-section {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.panel-body > .panel-section:first-child {
  padding-top: 0;
  border-top: none;
}

.panel-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 14px;
}

.panel-section-header i {
  color: var(--accent);
  font-size: 15px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 14px;
}

.section-label i { color: var(--accent); font-size: 15px; }

.optional-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-left: 2px;
}

/* ─── FORMS ─── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-size: max(16px, 14px); /* fix: iOS Safari auto-zoom under 16px */
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 44px; /* fix: was 40px, below 44px touch target minimum */
  appearance: none;
  -webkit-appearance: none;
}

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

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

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

.field-textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.6;
}

.field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a5752' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.field-hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  padding: 8px 12px;
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--r-md);
}

.translate-video-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.translate-video-card {
  flex-shrink: 0;
  width: 90px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: .2s;
  position: relative;
}
.translate-video-card.selected {
  border-color: var(--accent);
}
.translate-video-card video {
  width: 100%;
  aspect-ratio: 9/16;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.translate-video-card .translate-video-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: .65rem;
  text-align: center;
  padding: 2px;
}

.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ─── SEGMENTED CONTROL ─── */
.seg-control {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.seg-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 44px; /* fix: was ~35px */
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}

.seg-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.seg-opt:has(input:checked),
.seg-opt.selected {
  background: var(--accent-low);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.seg-opt:hover:not(:has(input:checked)) {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-2);
}

/* ─── RANGE INPUT ─── */
.range-input {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  border: none;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: grab;
  transition: transform var(--t-fast);
}

.range-input::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.2); }
.range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: grab;
}

/* ─── TRIM ─── */
.trim-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.trim-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  width: 32px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trim-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  min-width: 40px;
  text-align: right;
}

.trim-preview {
  width: 100%;
  border-radius: var(--r-md);
  margin-top: 12px;
  background: #000;
  display: none;
}

/* ─── SUBTITLE STYLE GRID ─── */
.sub-style-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.sub-style-item {
  aspect-ratio: 16/9;
  background: linear-gradient(145deg, #4b5563 0%, #374151 55%, #262d38 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  cursor: pointer;
  transition: border-color var(--t-fast);
  overflow: hidden;
}

.sub-style-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-border);
}

.sub-style-item:hover:not(.active) { border-color: var(--border-2); }

/* Utilitaire : masque visuellement un élément sans le retirer du flux
   accessible/clavier (contrairement à display:none). Utilisé pour les
   vrais <input type="radio"/checkbox"> natifs cachés derrière un <label>
   stylé (pattern Option B2, voir handoff P3.5). */
.visually-hidden {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  pointer-events: none;
}

/* Cards built by buildSubStyleGrid() use .sub-style-card, not .sub-style-item */
.sub-style-card {
  aspect-ratio: 16/9;
  background: linear-gradient(145deg, #4b5563 0%, #374151 55%, #262d38 100%);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px 8px;
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  overflow: hidden;
  position: relative;
}

/* Fonds thématiques pour les nouveaux styles ─ renforcent la distinction visuelle */
.sub-style-card[data-style-id="cinematic"]  { background: linear-gradient(145deg, #5a5142 0%, #453f34 55%, #2e2a22 100%); }
.sub-style-card[data-style-id="typewriter"] { background: linear-gradient(145deg, #4a5a49 0%, #37453a 55%, #232e26 100%); }
.sub-style-card[data-style-id="neon_glow"]  { background: linear-gradient(145deg, #3d5a4d 0%, #2c4539 55%, #1c2e26 100%); }
.sub-style-card[data-style-id="negative"]   { background: linear-gradient(145deg, #6b6b6b 0%, #52525a 55%, #3a3a40 100%); }
.sub-style-card[data-style-id="pop3d"]      { background: linear-gradient(145deg, #5a4652 0%, #453640 55%, #2e242c 100%); }
.sub-style-card[data-style-id="mrbeast"]    { background: linear-gradient(145deg, #5a5540 0%, #45412f 55%, #2e2b1e 100%); }

.sub-style-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-border);
}

.sub-style-card:hover:not(:has(input:checked)) {
  border-color: var(--border-2);
  background: linear-gradient(145deg, #565f6c 0%, #3f4855 55%, #2c333e 100%);
}

.sub-style-card:focus-within {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.sub-style-preview-text {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  overflow: hidden;
  padding: 0 4px;
  line-height: 1.2;
}

.card-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sub-style-name {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* Subtitle preview */
.sub-preview {
  background:
    radial-gradient(ellipse at 32% 22%, rgba(255,255,255,0.12), transparent 60%),
    linear-gradient(160deg, #4b5563 0%, #333b44 55%, #1f242a 100%);
  border-radius: var(--r-md);
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Simulated video scanlines for realism */
.sub-preview::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.07) 3px,
    rgba(0,0,0,0.07) 4px
  );
  pointer-events: none;
  border-radius: inherit;
}

#sub-preview {
  font-size: 1.7rem;
  font-weight: 900;
  color: #fff;
  text-align: center;
  word-break: break-word;
  position: relative;
  z-index: 1;
  max-width: 90%;
  -webkit-text-stroke: 1px rgba(0,0,0,0.4);
  text-shadow: 1px 2px 8px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.5);
  letter-spacing: 0.01em;
  line-height: 1.25;
  transition: opacity 0.35s ease;
}

.sub-preview-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.04em;
}

.btn-ai-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 8px;
  background: rgba(212, 161, 74, 0.06);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--t-fast);
  font-family: var(--font-body);
}

.btn-ai-preview:hover { background: var(--accent-low); }

/* Custom style editor */
.btn-custom-style {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px dashed var(--border-2);
  border-radius: var(--r-md);
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
  font-family: var(--font-body);
}

.btn-custom-style:hover { border-color: var(--accent); color: var(--accent); }

.custom-style-editor {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-style-preview {
  background: #000;
  border-radius: var(--r-md);
  padding: 12px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fields-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.field-color {
  padding: 4px;
  height: 40px;
  cursor: pointer;
  border-radius: var(--r-md);
}

/* ─── PRESETS BAR ─── */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}

.presets-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.presets-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

/* ─── PROGRESS ─── */
.estimate-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.progress-wrap {
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent), var(--accent-hover));
  border-radius: var(--r-full);
  width: 0%;
  transition: width 0.4s ease-out;
}

.progress-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}

.progress-pct {
  color: var(--accent);
  font-weight: 600;
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px; /* fix: was 38px, below 44px touch target minimum */
  padding: 8px 18px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.btn:active { transform: scale(0.97); }

/* Responsive fallback: white-space:nowrap above has no mobile fallback,
   so longer button labels (translations, modal CTAs like the trend
   "Create a clip inspired by this trend" button) overflow their
   container on narrow screens. Allow wrap + center below 640px. */
@media (max-width: 640px) {
  .btn { white-space: normal; text-align: center; }
}

.btn-accent {
  background: var(--accent);
  color: #0a0908;
  font-weight: 600;
}
.btn-accent:hover { background: var(--accent-hover); box-shadow: var(--accent-glow); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }

.btn-danger {
  background: rgba(248,113,113,0.1);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.25);
}
.btn-danger:hover { background: rgba(248,113,113,0.18); }

.btn-sm { min-height: 44px; padding: 6px 12px; font-size: 13px; } /* fix: was 32px, below 44px touch target minimum */

.btn-process,
.btn-generate {
  width: 100%;
  justify-content: center;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-lg);
}

.btn-share {
  width: 100%;
  justify-content: center;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(10, 9, 8, 0.3);
  border-top-color: #0a0908;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

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

/* ─── DOWNLOAD RESULT ─── */
.download-result {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.18);
  border-radius: var(--r-lg);
  flex-wrap: wrap;
}

.download-result-icon {
  font-size: 24px;
  color: var(--success);
  flex-shrink: 0;
}

.download-result-text {
  flex: 1;
  min-width: 0;
}

.download-result-text strong {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.download-result-text span {
  font-size: 13px;
  color: var(--text-2);
}

/* ─── STATUS / INFO CARDS ─── */
.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-2);
}

.status-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.info-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(74, 222, 128, 0.05);
  border: 1px solid rgba(74, 222, 128, 0.15);
  border-radius: var(--r-md);
}

.info-card-icon { font-size: 18px; color: var(--success); flex-shrink: 0; margin-top: 1px; }
.info-card-meta { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* ─── AI RESULTS ───
   Generated content reads as editorial flow, not a stacked card:
   a thin top rule separates it from the form/button above. */
.ai-result {
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-result-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Hooks list */
.hooks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hook-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
  transition: border-color var(--t-fast);
}

.hook-item:hover { border-color: var(--border-2); }

.hook-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  font-weight: 600;
}

.hook-copy {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  transition: color var(--t-fast);
}

.hook-copy:hover { color: var(--accent); }

/* Script blocks — sequential narration beats, styled as editorial
   flow with a colored rule to mark each beat, not stacked cards. */
.script-blocks { display: flex; flex-direction: column; gap: 16px; }

.script-block {
  padding-left: 14px;
  border-left: 2px solid var(--accent-border);
}

.script-block-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.script-block-text {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.65;
}

/* Description output — plain generated paragraph, no box */
.desc-output {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* AI result text (clickable copy fields) */
.ai-result-text {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text);
  min-height: 32px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.ai-result-text:hover { background: var(--surface-3); border-color: var(--border-2); }

/* Viral moments chips */
.viral-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.viral-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--viral-low);
  border: 1px solid var(--viral-border);
  border-radius: var(--r-full);
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.viral-chip:hover { background: rgba(226, 101, 60, 0.2); border-color: var(--viral); }
.viral-chip .score { color: var(--viral); font-weight: 700; margin-left: 2px; }

/* Hashtag grid */
.hashtag-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.hashtag-item {
  padding: 5px 12px;
  background: var(--accent-low);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--t-fast);
}

.hashtag-item:hover { background: rgba(212,161,74,0.18); }

/* Trend list */
.trend-list { display: flex; flex-direction: column; }

.trend-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.trend-item:last-child { border-bottom: none; padding-bottom: 0; }
.trend-item:first-child { padding-top: 0; }

.trend-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.trend-item-meta {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ─── TREND ANALYZER — hero + grid ─── */
.trend-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: var(--r-full);
}

.trend-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
}
.trend-badge.trend-hot     { color: var(--viral); background: var(--viral-low); border-color: var(--viral-border); }
.trend-badge.trend-rising  { color: var(--success); background: rgba(74,222,128,0.12); border-color: rgba(74,222,128,0.28); }
.trend-badge.trend-steady  { color: var(--text-3); background: var(--surface-3); border-color: var(--border); }

.trend-hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface-2);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-xl);
  padding: 22px 24px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.trend-hero:hover { border-color: var(--accent); transform: translateY(-1px); }
.trend-hero-top { position: absolute; top: 20px; left: 24px; right: 24px; display: flex; justify-content: space-between; align-items: center; }
.trend-hero-body { margin-top: 30px; flex: 1; min-width: 0; }
.trend-hero-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  margin-bottom: 6px;
}
.trend-hero-idea { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.trend-why { font-size: 12.5px; color: var(--text-3); margin-top: 8px; font-style: italic; }

.trend-score {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border: 2px solid var(--border-2);
  margin-top: 30px;
}
.trend-score span { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--text); line-height: 1; }
.trend-score small { font-size: 8px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; margin-top: 2px; }
.trend-score.trend-hot    { border-color: var(--viral-border); box-shadow: 0 0 20px rgba(226,101,60,0.18); }
.trend-score.trend-rising { border-color: rgba(74,222,128,0.3); }
.trend-score.trend-steady { border-color: var(--border-2); }

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

.trend-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.trend-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.trend-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.trend-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.trend-card-idea { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }

@media (max-width: 640px) {
  .trend-hero { flex-direction: column; }
  .trend-hero-top { position: static; margin-bottom: 4px; }
  .trend-hero-body { margin-top: 0; }
  .trend-hero-media { margin-top: 0; }
  .trend-score { margin-top: 12px; align-self: flex-start; }
}

/* ─── TREND ANALYZER v2 — search row, video previews, detail modal ───
   Réutilise les tokens existants (--surface, --border, --accent, --viral…)
   et les classes .trend-hero/.trend-grid/.trend-card/.trend-badge déjà
   présentes ci-dessus mais jusque-là jamais branchées au HTML/JS. */
.trend-search-row {
  display: grid;
  grid-template-columns: 1fr 1fr 160px;
  gap: 14px;
}
@media (max-width: 760px) {
  .trend-search-row { grid-template-columns: 1fr; }
}

/* Hero : vidéo à gauche, infos à droite (desktop) — empilé sur mobile via
   le flex-direction:column déjà défini au breakpoint 640px ci-dessus. */
.trend-hero { flex-wrap: wrap; }
.trend-hero-media {
  flex-shrink: 0;
  width: 180px;
  margin-top: 30px; /* clear the absolutely-positioned .trend-hero-top row */
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-3);
  aspect-ratio: 9 / 16;
}
.trend-hero-media img,
.trend-hero-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.trend-hero-body { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 640px) {
  .trend-hero-media { width: 100%; aspect-ratio: 16 / 9; }
}

/* Grille : chaque card garde une mini-preview vidéo au-dessus du texte */
.trend-card-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-3);
  margin-bottom: 10px;
}
.trend-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trend-card-top { align-items: flex-start; }

/* Barres de mesure qualitative (hot/rising/steady) affichées dans le détail —
   pas de faux chiffres d'audience, juste une lecture visuelle du niveau. */
.trend-metric { margin-top: 10px; }
.trend-metric-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 4px;
}
.trend-metric-bar {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
.trend-metric-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent);
}
.trend-metric-bar-fill.trend-hot    { background: var(--viral); }
.trend-metric-bar-fill.trend-rising { background: var(--success); }
.trend-metric-bar-fill.trend-steady { background: var(--text-3); }

/* ─── Trend detail modal ─── */
/* Base .modal n'a pas de limite de hauteur (overflow:hidden coupe tout
   contenu qui dépasse) — cette modale a beaucoup de contenu (vidéo +
   plusieurs sections), donc on la rend scrollable au lieu de couper. */
.trend-detail-modal {
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.trend-detail-modal .modal-header { flex-shrink: 0; }
.trend-detail-modal .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0; /* nécessaire pour que overflow-y fonctionne dans un flex column */
}
.trend-detail-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 380px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-3);
  margin-bottom: 8px;
  flex-shrink: 0; /* évite que le layout flex column de .modal-body écrase
                     cette boîte en aspect-ratio à hauteur 0 dans un
                     conteneur overflow-y:auto (bug connu flex+aspect-ratio) */
}
.trend-detail-video video,
.trend-detail-video img,
.trend-detail-video iframe { width: 100%; height: 100%; max-height: 380px; object-fit: cover; display: block; border: none; }
.trend-detail-section { margin-top: 18px; }
.trend-detail-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.trend-detail-text { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.trend-makework-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.trend-makework-list li { font-size: 13px; color: var(--text-2); }
.trend-makework-list li strong { color: var(--text); font-weight: 600; }
@media (max-width: 480px) {
  .trend-makework-list { grid-template-columns: 1fr; }
}
.trend-video-credit { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.trend-video-credit a { color: var(--text-3); }

/* ─── SEARCH BAR ─── */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

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

.search-bar-icon { color: var(--text-3); font-size: 16px; flex-shrink: 0; }

.search-bar-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
}

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

/* ─── TAGS / CHIPS ─── */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-chip {
  padding: 5px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: var(--font-body);
}

.tag-chip:hover {
  background: var(--accent-low);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ─── BROLLS GRID ───
   2 colonnes fixes sur PC comme sur mobile. La vignette utilise une hauteur
   fixe en pixels (au lieu d'aspect-ratio) : plus fiable avec le lazy-loading
   des <img> (aspect-ratio pouvait "s'aplatir" avant que l'image ne charge),
   et ça évite les cartes géantes sur les grands écrans puisque la hauteur
   ne dépend plus de la largeur de la colonne. */
.brolls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.broll-card {
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
}

.broll-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

@media (max-width: 640px) {
  .broll-thumb { height: 120px; }
}

.broll-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--t-fast);
}

.broll-card:hover .broll-overlay { opacity: 1; }

.broll-dl-btn {
  background: var(--accent);
  color: #0a0908;
  border: none;
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  transition: background var(--t-fast);
}

.broll-dl-btn:hover { background: var(--accent-hover); }

/* ─── ADVANCED SETTINGS ACCORDION (Create Clips, P1) ───
   Reuses the existing .panel-section / .field-hint look — same border,
   radius and surface colors as the rest of the panel, no new design system. */
.accordion { margin-top: 4px; }

.accordion-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  font-family: var(--font-h);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast);
}

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

.accordion-toggle .accordion-caret {
  margin-left: auto;
  transition: transform var(--t-fast);
}

.accordion-toggle[aria-expanded="true"] .accordion-caret {
  transform: rotate(180deg);
}

.accordion-body {
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── MEDIA LIST (History) — visual grid, per P1 Content Library refactor ───
   .media-list was a flex-column of dense rows; it's now a responsive card
   grid (auto-fill, min 220px per card) per blueprint §28. renderMediaList()
   in dashboard.js still generates the same #media-list innerHTML and reads
   the same item fields — only the CSS layout changed here. */
.media-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.media-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.media-card:hover { border-color: var(--border-2); }

.media-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-3);
  overflow: hidden;
}

.media-thumb img { width: 100%; height: 100%; object-fit: cover; }

.media-info { flex: 1; min-width: 0; padding: 12px 14px 4px; }

.media-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}

.media-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.media-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 14px 14px;
  margin-top: auto;
}

/* Secondary actions (project reassignment) collapse into a small icon-button
   menu instead of sitting exposed on every card (blueprint §29: "éviter de
   mettre 4 gros boutons sur chaque carte"). The <select> itself (generated
   by mediaProjectSelectHtml()) is unchanged — only made narrower/quieter. */
.media-actions-secondary {
  position: relative;
  margin-left: auto;
}

.media-project-select {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  max-width: 110px;
}

/* ─── CONTENT LIBRARY SEARCH BAR ───
   Front-end only text filter over the already-loaded list — no new API
   call, see window._nimbleLastMediaItems in dashboard.js. Reuses the
   existing .field-input look. */
.media-search-bar {
  position: relative;
  margin-bottom: 16px;
  max-width: 360px;
}

.media-search-bar .ph-magnifying-glass {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 15px;
  pointer-events: none;
}

.media-search-bar input.field-input {
  width: 100%;
  padding-left: 34px;
}

/* ─── PROJECT FILTER BAR (My Videos) ─── */
.project-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.project-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}

.project-pill:hover { border-color: var(--border-2); color: var(--text); }

.project-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0e14;
}

.project-pill-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  border-style: dashed;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px;
  gap: 12px;
}

.empty-icon {
  width: 56px;
  height: 56px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.empty-state p {
  font-size: 13px;
  color: var(--text-2);
  max-width: 280px;
}

/* ─── LOADING STATE ─── */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  font-size: 13px;
  color: var(--text-2);
}

.loading-ring {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ─── COMING SOON ─── */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 24px;
  gap: 14px;
}

.coming-soon-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-low);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 6px;
}

.coming-soon h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.coming-soon p {
  font-size: 14px;
  color: var(--text-2);
  max-width: 340px;
  line-height: 1.7;
}

/* ─── VIDEO EDITOR: WORKSPACE LAYOUT ───
   Two-pane CapCut-style workspace: preview stays put, tools live in a
   sticky rail on wide screens and stack below the preview on mobile/
   tablet (the existing max-width:900px .panel breakpoint already forces
   a single column, so we only need to opt IN to the 2-col grid at the
   same 1201px breakpoint panel-upload already uses). */
.editor-workspace {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

@media (min-width: 1201px) {
  .editor-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(380px, 440px);
    align-items: start;
    gap: 30px;
  }
  .editor-workspace-tools {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    padding-right: 4px;
  }
  .editor-workspace-tools::-webkit-scrollbar { width: 6px; }
  .editor-workspace-tools::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }
}

.editor-workspace-preview { min-width: 0; }

/* ─── VIDEO EDITOR: PLAYER + OVERLAY ───
   Player respects the clip's real aspect ratio instead of a fixed 320px
   box: #editor-video-wrap is inline-block so it shrinks to the video's
   actual rendered size, and its parent centers it. That means the
   overlay's percentage-based positions always line up with the real
   video frame, portrait or landscape, with no JS geometry needed. */
.editor-clip-selector {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin-bottom: 4px;
  scroll-snap-type: x proximity;
}
.editor-clip-selector::-webkit-scrollbar { height: 5px; }
.editor-clip-selector::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }

.editor-clip-chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 6px 16px 6px 6px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.editor-clip-chip:hover { border-color: var(--border-2); transform: translateY(-1px); }
.editor-clip-chip.active {
  background: var(--accent-low);
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border) inset;
}

.editor-player-stage {
  display: flex;
  justify-content: center;
  width: 100%;
  position: relative;
}

.editor-video-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-2);
  background: #000;
}

#editor-video {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  width: auto;
  height: auto;
  min-width: 220px;
  background: #000;
}

@media (min-width: 1201px) {
  #editor-video { max-height: calc(100vh - 260px); }
}

.editor-player-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.editor-history-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Version-history strip: one dot per autosaved step, current step called
   out in accent, steps ahead of the current index (available via redo)
   shown dimmed so the row reads like an actual timeline, not decoration. */
.editor-history-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 4px;
  max-width: 180px;
  overflow-x: auto;
  scrollbar-width: none;
}
.editor-history-dots::-webkit-scrollbar { display: none; }
.editor-history-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  border: none;
  padding: 0;
  background: var(--border-2);
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast);
}
.editor-history-dot:hover { transform: scale(1.3); }
.editor-history-dot.is-past { background: var(--text-3); }
.editor-history-dot.is-current {
  background: var(--accent);
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 3px var(--accent-low);
}

.editor-autosave-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-3);
  font-family: var(--font-mono);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.editor-autosave-indicator.is-visible { opacity: 1; transform: translateY(0); }
.editor-autosave-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--success);
  box-shadow: 0 0 6px rgba(74, 222, 128, .6);
}

/* Fork B: nudge controls, mobile-only complement to drag (desktop keeps precise mouse drag) */
.editor-overlay-nudge {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
}
.editor-overlay-nudge-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
}
.editor-overlay-nudge-group {
  display: flex;
  gap: 6px;
}
@media (max-width: 900px) {
  .editor-overlay-nudge { display: flex; }
}

/* Overlay: sits exactly over the rendered video box (see wrap comment above). */
.editor-overlay {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.editor-overlay.visible { display: block; }

.editor-overlay-text {
  position: absolute;
  left: 50%;
  top: 78%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  padding: 6px 14px;
  pointer-events: auto;
  cursor: move;
  user-select: none;
  white-space: nowrap;
  text-align: center;
  color: #fff;
  font-family: 'Rajdhani', var(--font-body);
  font-size: 22px;
  font-weight: 600;
  text-shadow: 0 2px 10px rgba(0,0,0,.85), 0 0 2px rgba(0,0,0,.6);
  border-radius: var(--r-sm);
  outline: 1.5px dashed transparent;
  transition: outline-color var(--t-fast);
}
.editor-overlay-text:hover,
.editor-overlay-text.dragging {
  outline-color: var(--accent-border);
}

.overlay-reset-btn {
  position: absolute;
  top: -26px;
  right: -8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--r-full);
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.editor-overlay-text:hover .overlay-reset-btn,
.editor-overlay-text.dragging .overlay-reset-btn {
  opacity: 1;
}

.overlay-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: var(--r-full);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.editor-overlay-text:hover .overlay-handle,
.editor-overlay-text.dragging .overlay-handle,
.overlay-handle.active {
  opacity: 1;
}
.overlay-handle.tl { top: -7px; left: -7px; cursor: nwse-resize; }
.overlay-handle.tr { top: -7px; right: -7px; cursor: nesw-resize; }
.overlay-handle.bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.overlay-handle.br { bottom: -7px; right: -7px; cursor: nwse-resize; }

/* Indicateur de chargement pendant le fetch authentifié (blob) du clip —
   avant, rien n'indiquait qu'une vidéo était en train de charger. */
.editor-video-loading #editor-video { opacity: .25; transition: opacity var(--t-fast); }
.editor-video-loading .editor-video-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: var(--accent);
  animation: editorSpin .7s linear infinite;
}
@keyframes editorSpin { to { transform: rotate(360deg); } }

/* Miniature dans le sélecteur de clips (générée côté client via canvas,
   voir buildClipThumbnail) — avant : chips texte uniquement ("Clip 1"),
   impossible de distinguer les clips sans cliquer dessus. */
.editor-clip-chip-thumb {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--border);
}

/* ─── VIDEO EDITOR: TOOL RAIL SHELL ─── */
.editor-tools-tabbar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  padding-top: 2px;
}
.editor-tools-tabbar::-webkit-scrollbar { display: none; }
.editor-tools-tabbar .tab {
  flex-shrink: 0;
  white-space: nowrap;
}
.editor-tools-panels { padding-top: 4px; }

.editor-tab-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 16px;
}
.editor-tab-hint i { color: var(--accent); font-size: 14px; margin-top: 1px; flex-shrink: 0; }

.editor-panel-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.editor-status-msg {
  font-size: 13px;
  font-weight: 500;
}
.editor-status-msg:empty { display: none; }

.editor-field-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.editor-field-row .form-group { flex: 1; min-width: 0; margin-bottom: 0; }
.editor-field-row .editor-field-grow { flex: 2; }
.editor-field-row + .form-group { margin-top: 16px; }

/* ─── VIDEO EDITOR: FORM CONTROLS ───
   Subtitles/Style/Watermark/Voiceover tabs used the legacy .form-group
   (defined inline in dashboard.html) which only styles <input type=text>.
   <select>, <input type=color> and <input type=range> had zero rules and
   rendered as raw browser defaults — visibly out of place next to the
   rest of the dashboard. Scoped to #panel-editor to avoid touching any
   other .form-group usage (auth modal, etc). */
#panel-editor .form-group { margin-bottom: 16px; }
#panel-editor .form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 8px;
}
.editor-range-value {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
#panel-editor .form-group select,
#panel-editor .form-group input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 44px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}
#panel-editor .form-group select {
  background-image: url("data:image/svg+xml,%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='%239a9590' 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;
  padding-right: 32px;
  cursor: pointer;
}
#panel-editor .form-group select:hover,
#panel-editor .form-group input[type="text"]:hover { border-color: var(--border-2); }
#panel-editor .form-group select:focus,
#panel-editor .form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-low);
}
#panel-editor .editor-hidden-native {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0; padding: 0; margin: -1px;
}

#panel-editor input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast);
}
#panel-editor input[type="color"]:hover { border-color: var(--border-2); }
#panel-editor input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
#panel-editor input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

#panel-editor input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  cursor: pointer;
}
#panel-editor input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: var(--r-full);
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent-border), var(--shadow-sm);
  cursor: pointer;
  margin-top: -7px;
}
#panel-editor input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: var(--r-full);
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent-border), var(--shadow-sm);
  cursor: pointer;
}

#panel-editor textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
#panel-editor textarea:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-low);
}

/* ─── VIDEO EDITOR: SEGMENTED CONTROL (subtitle size / position) ───
   Replaces plain <select> for short, mutually-exclusive option sets with
   a tactile pill group. The underlying <select id="..."> stays in the DOM
   (visually hidden, .editor-hidden-native) and is kept in sync by JS so
   every existing listener (onSubPositionDropdownChange, getCurrentSettings,
   applyPreset, etc.) keeps working unmodified. */
.editor-segmented {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.editor-segment {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  min-height: 38px;
  border: none;
  border-radius: calc(var(--r-md) - 3px);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.editor-segment i { font-size: 15px; }
.editor-segment:hover { color: var(--text); }
.editor-segment.is-active {
  background: var(--surface-3);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border);
}

/* ─── VIDEO EDITOR: CORNER PICKER (watermark starting position) ─── */
.editor-corner-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 180px;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px;
}
.editor-corner {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.editor-corner:hover { border-color: var(--accent-border); }
.editor-corner-dot {
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--text-3);
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.editor-corner.is-active {
  border-style: solid;
  border-color: var(--accent-border);
  background: var(--accent-low);
}
.editor-corner.is-active .editor-corner-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-border);
}
.editor-corner[data-value="top-left"] { grid-column: 1; grid-row: 1; }
.editor-corner[data-value="top-right"] { grid-column: 3; grid-row: 1; }
.editor-corner[data-value="bottom-left"] { grid-column: 1; grid-row: 3; }
.editor-corner[data-value="bottom-right"] { grid-column: 3; grid-row: 3; }
.editor-corner-frame {
  grid-column: 2; grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ─── VIDEO EDITOR: STYLE GRID (real preview cards, not text buttons) ─── */
.editor-style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 460px) {
  .editor-style-grid { grid-template-columns: repeat(2, 1fr); }
}
.editor-style-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.editor-style-card:hover { transform: translateY(-2px); border-color: var(--border-2); }
.editor-style-card.is-active {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px var(--accent-border), var(--accent-glow);
}
.editor-style-preview {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.35)),
    repeating-linear-gradient(135deg, #232019 0 10px, #1c1a17 10px 20px);
  position: relative;
}
.editor-style-preview span {
  font-family: 'Rajdhani', var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.editor-style-card-label {
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  padding: 7px 4px;
  color: var(--text-2);
  background: var(--surface-3);
  transition: color var(--t-fast);
}
.editor-style-card.is-active .editor-style-card-label { color: var(--accent); }

/* Per-preset visual approximations of the server-side burned-in styles */
.editor-style-preview.style-classic span { text-shadow: 0 2px 6px rgba(0,0,0,.9); }
.editor-style-preview.style-neon span { color: #7ef7ff; text-shadow: 0 0 6px #7ef7ff, 0 0 16px rgba(126,247,255,.7); }
.editor-style-preview.style-outline span { -webkit-text-stroke: 1.5px #000; text-shadow: none; }
.editor-style-preview.style-boxed span { background: rgba(0,0,0,.75); padding: 3px 9px; border-radius: 4px; }
.editor-style-preview.style-highlight span { background: #ffe94d; color: #171310; padding: 2px 8px; border-radius: 3px; text-shadow: none; }
.editor-style-preview.style-fire span { background: linear-gradient(180deg,#ffd23d,#ff5722 60%,#b0270e); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 0 10px rgba(255,87,34,.5); }
.editor-style-preview.style-gradient span { background: linear-gradient(90deg,#ff5fa2,#7ef7ff,#ffe94d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.editor-style-preview.style-shadow span { text-shadow: 3px 4px 0 rgba(0,0,0,.65); }
.editor-style-preview.style-karaoke span { position: relative; }
.editor-style-preview.style-karaoke::after {
  content: '';
  position: absolute; left: 12%; right: 55%; bottom: 14px; height: 3px;
  background: var(--accent); border-radius: var(--r-full);
}

/* Message de statut à côté des boutons Apply (succès/erreur) */
#panel-editor .editor-tab-panel > span[id$="-msg"] {
  display: inline-block;
  font-weight: 500;
}

/* ─── VIDEO EDITOR: TRIM TAB ───
   Replaces the fully inline-styled markup (no CSS classes at all, no
   design tokens) with a scoped set of classes consistent with the rest
   of the app. Matching class names are wired up in dashboard.html. */
.editor-trim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
}
.editor-trim-timeline {
  position: relative;
  height: 56px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: 4px 0 14px;
  cursor: pointer;
  overflow: hidden;
}
.editor-trim-timeline canvas { width: 100%; height: 100%; display: block; }
.editor-trim-range-fill {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--accent-low);
  border-left: 2px solid var(--accent-border);
  border-right: 2px solid var(--accent-border);
  pointer-events: none;
}
.editor-trim-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 16px;
  margin-left: -8px;
  background: var(--accent);
  cursor: ew-resize;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
}
.editor-trim-handle::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 2px; height: 14px;
  background: rgba(0,0,0,.35);
  transform: translate(-50%,-50%);
  box-shadow: 4px 0 0 rgba(0,0,0,.35), -4px 0 0 rgba(0,0,0,.35);
}
.editor-trim-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,.6);
  pointer-events: none;
}
.editor-trim-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
  flex-wrap: wrap;
  justify-content: center;
}
.editor-trim-nudge-btn {
  width: 34px;
  height: 34px;
  min-height: unset;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.editor-trim-time-input {
  width: 66px;
  min-height: 38px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
}
.editor-trim-time-input:focus { outline: none; border-color: var(--accent-border); }
.editor-trim-overlay-time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
  min-width: 84px;
  text-align: center;
}
.editor-trim-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.editor-trim-apply-msg { font-size: 13px; margin-top: 8px; color: var(--text-3); text-align: center; }

/* ─── VIDEO EDITOR: MOBILE TUNING ─── */
@media (max-width: 640px) {
  .editor-video-wrap { border-radius: var(--r-md); }
  .editor-corner-picker { max-width: 100%; }
  .editor-field-row { flex-direction: column; }
  .editor-field-row .editor-field-grow { flex: 1; }
  .editor-style-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── TABS ─── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
  margin-bottom: -1px;
}

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

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

/* ─── BATCH LIST ─── */
.batch-list { display: flex; flex-direction: column; }

.batch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.batch-item:last-child { border-bottom: none; padding-bottom: 0; }
.batch-item:first-child { padding-top: 0; }

.batch-item i { font-size: 16px; color: var(--text-3); }
.batch-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-item-size { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

/* ─── AUDIO PREVIEW ─── */
.audio-preview {
  width: 100%;
  border-radius: var(--r-md);
  height: 40px;
  accent-color: var(--accent);
}

/* ─── ACCOUNT ───
   Generic settings sections read as editorial flow (thin top rule),
   not stacked boxes. Only a genuine key-stat/status banner
   (.acct-card-highlight) or alert callout (.acct-card-danger)
   keeps the full card treatment. */
.acct-card {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.panel-body > .acct-card:first-child {
  padding-top: 0;
  border-top: none;
}

.acct-card-highlight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}

.acct-card-danger {
  background: var(--surface);
  border: 1px solid rgba(248, 113, 113, 0.15);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}

.acct-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

.danger-title { color: rgba(248, 113, 113, 0.6); }

.acct-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 0;
}

.acct-avatar-wrap { position: relative; flex-shrink: 0; }

.acct-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-low);
  border: 2px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  cursor: pointer;
}

.acct-avatar img { width: 100%; height: 100%; object-fit: cover; }

.acct-avatar-edit {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #0a0908;
  cursor: pointer;
  transition: background var(--t-fast);
}
.acct-avatar-edit::before {
  content: '';
  position: absolute;
  inset: -12px; /* 20px + 24px = 44px invisible touch target */
}

.acct-avatar-edit:hover { background: var(--accent-hover); }

.acct-info { flex: 1; }

.acct-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.acct-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.acct-edit-btn {
  position: relative; /* for touch-halo pseudo-element */
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}
.acct-edit-btn::before {
  content: '';
  position: absolute;
  inset: -12px; /* invisible touch target, widens toward the edge of .acct-name-row */
}

.acct-edit-btn:hover { color: var(--accent); background: var(--accent-low); }

.acct-email {
  font-size: 12px;
  color: var(--text-2);
  display: block;
  margin-bottom: 6px;
}

.plan-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-3);
}

.plan-badge.premium {
  background: var(--accent-low);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.acct-edit-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.acct-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }

.acct-tokens {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.acct-tokens-big {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.03em;
}

.acct-tokens-label {
  font-size: 13px;
  color: var(--text-2);
}

.acct-token-bar { margin-bottom: 6px; }

/* Referral */
.referral-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.referral-row .field-input {
  min-width: 0; /* fix #18: prevents overflow when placeholder/value text is long on small screens */
}

.referral-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.referral-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  text-align: center;
}

.referral-stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 3px;
}

.referral-stat-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Password visibility toggle + strength meter */
.pw-input-wrap { position: relative; display: flex; align-items: center; }
.pw-input-wrap .field-input,
.pw-input-wrap input { padding-right: 42px !important; }

.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 6px;
  display: flex;
  border-radius: var(--r-sm);
}
.pw-toggle::before {
  content: '';
  position: absolute;
  inset: -8px; /* ~28px visual box + 16px = 44px invisible touch target */
}

.pw-toggle:hover { color: var(--text); background: var(--surface-3); }

.pw-strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  margin-top: 8px;
  overflow: hidden;
}

.pw-strength-fill { height: 100%; width: 0%; border-radius: 2px; transition: width var(--t-fast), background var(--t-fast); }
.pw-strength-fill.weak { background: #f87171; }
.pw-strength-fill.medium { background: #fbbf24; }
.pw-strength-fill.strong { background: #4ade80; }

/* Referral: share row, history list */
.referral-share-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.referral-list-wrap { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }

.referral-list-toggle {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-family: var(--font-body);
}

.referral-list-toggle .ph-caret-down { transition: transform var(--t-fast); }
.referral-list-toggle.open .ph-caret-down { transform: rotate(180deg); }

.referral-list { margin-top: 10px; }

.referral-list-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.referral-list-items li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

.referral-list-items .ref-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.referral-list-items .ref-status.pending { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }

.modal-danger .modal-title { color: #f87171; }
.modal-danger select.field-input { cursor: pointer; }

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 250ms ease-out;
}

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

.modal-premium {
  max-width: 460px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal-premium .modal-header { flex-shrink: 0; }
.modal-premium .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.modal-premium .modal-footer { flex-shrink: 0; }

/* Bug report wizard */
.modal-bug-report { max-width: 460px; }

.bug-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.bug-step-dot {
  flex: 1;
  height: 3px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  transition: background var(--t-base);
}

.bug-step-dot.done { background: var(--accent); }
.bug-step-dot.active { background: var(--accent-hover); }

.bug-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bug-choice-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  animation: sidebarMenuItemIn 200ms cubic-bezier(.16,1,.3,1) forwards;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.bug-choices .bug-choice-btn:nth-child(1) { animation-delay: 30ms; }
.bug-choices .bug-choice-btn:nth-child(2) { animation-delay: 60ms; }
.bug-choices .bug-choice-btn:nth-child(3) { animation-delay: 90ms; }
.bug-choices .bug-choice-btn:nth-child(4) { animation-delay: 120ms; }
.bug-choices .bug-choice-btn:nth-child(5) { animation-delay: 150ms; }

.bug-choice-btn:hover { background: var(--surface-3); border-color: var(--accent-border); }
.bug-choice-btn i { color: var(--text-3); font-size: 15px; }

.bug-textarea-wrap { margin-top: 4px; }
.bug-textarea-wrap textarea { resize: vertical; min-height: 90px; }

.bug-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}

.bug-summary strong { color: var(--text); }

/* Billing history modal */
.modal-billing-history {
  max-width: 620px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.modal-billing-history .modal-header { flex-shrink: 0; }
.modal-billing-history .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 14px 22px 22px;
}
.modal-billing-history .modal-footer { flex-shrink: 0; }

.billing-history-loading,
.billing-history-empty,
.billing-history-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-2);
  font-size: 13.5px;
  text-align: center;
}

.billing-history-loading i { animation: spin 900ms linear infinite; font-size: 18px; color: var(--accent); }

.billing-history-empty i { font-size: 28px; color: var(--text-3); }

.billing-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.billing-history-table thead th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-2);
}

.billing-history-table tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.billing-history-table tbody tr:last-child td { border-bottom: none; }
.billing-history-table tbody tr:hover td { background: var(--surface-2); }

.billing-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
}

.billing-status-success  { background: rgba(74, 222, 128, 0.12); color: var(--success); }
.billing-status-pending  { background: rgba(251, 191, 36, 0.12); color: var(--warning); }
.billing-status-failed   { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.billing-status-abandoned{ background: var(--surface-3); color: var(--text-2); }

.billing-invoice-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.billing-invoice-link:hover { background: var(--surface-3); color: var(--accent); }

@media (max-width: 640px) {
  .modal-billing-history { max-width: 94vw; }
  .billing-history-table thead { display: none; }
  .billing-history-table, .billing-history-table tbody, .billing-history-table tr, .billing-history-table td {
    display: block;
    width: 100%;
  }
  .billing-history-table tr {
    border-bottom: 1px solid var(--border-2);
    padding: 10px 0;
  }
  .billing-history-table td {
    border-bottom: none;
    padding: 3px 0;
    white-space: normal;
  }
  .billing-history-table td:first-child { color: var(--text-3); font-size: 12px; }
}

/* Subtitle style modal - fullscreen */
#subtitle-style-modal .modal {
  max-width: 90vw;
  max-height: 90vh;
  width: 90vw;
  height: auto;
}

#subtitle-style-modal .modal-body {
  max-height: calc(90vh - 120px);
  overflow-y: auto;
  padding: 24px;
}

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

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-title i { color: var(--accent); }

.modal-close {
  position: relative; /* for touch-halo pseudo-element */
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close::before {
  content: '';
  position: absolute;
  inset: -6px; /* 32px + 12px = 44px invisible touch target */
}

.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}

.premium-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.premium-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text);
}

.premium-feature-item i { color: var(--accent); font-size: 15px; }

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ─── PLAN PICKER (premium modal) ─── */
.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.plan-card input { position: absolute; opacity: 0; pointer-events: none; }

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

.plan-card.selected {
  border-color: var(--accent);
  background: rgba(61,155,255,.08);
}

.plan-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.plan-card-price { font-size: 15px; font-weight: 700; color: var(--text); }
.plan-card-price small { font-size: 11px; font-weight: 500; color: var(--text-3); }

.plan-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #22C55E;
  background: rgba(34,197,94,.12);
  padding: 2px 6px;
  border-radius: var(--r-full);
}

/* ─── TOASTS ─── */
.toast-container {
  position: fixed;
  /* Was bottom:24px, same corner as the .nai-chat-bubble (app-core-chatbot.js),
     which sits at z-index:9998 and always covers toasts underneath it.
     Push the container above the bubble instead of sharing its spot. */
  bottom: 96px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text);
  animation: toastIn 250ms ease-out both;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

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

  .dash-shell {
    margin-left: 0;
  }

  .topbar-hamburger {
    display: flex;
  }

  .panels {
    padding: 20px 16px 40px;
  }

  .upload-zone-hint-desktop { display: none; } /* fix #19: Cmd/Ctrl multi-select hint is meaningless on touch */
}

@media (max-width: 760px) {
  .fields-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .brolls-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .account-chip-info { display: none; }

  .upload-zone { padding: 28px 16px; }

  .modal { max-width: 100%; margin: 0 8px; }
  
  /* Grille sous-titres : 2 colonnes sur mobile */
  .sub-style-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  #subtitle-style-modal .modal {
    max-width: 100vw;
    width: 100vw;
    margin: 0;
  }
}

/* ── Auto B-Roll toggle ─────────────────────────────────────────────── */
.broll-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 0;
}
.broll-toggle-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.broll-toggle-track {
  flex-shrink: 0;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--accent-border);
  position: relative;
  transition: background 0.2s ease;
}
.broll-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease, background 0.2s ease;
}
.broll-toggle-row input[type="checkbox"]:checked + .broll-toggle-track {
  background: var(--accent);
}
.broll-toggle-row input[type="checkbox"]:focus-visible + .broll-toggle-track {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.broll-toggle-row input[type="checkbox"]:checked + .broll-toggle-track .broll-toggle-thumb {
  transform: translateX(18px);
  background: #1a1a1a;
}
.broll-toggle-label {
  font-size: 13px;
  color: var(--text-secondary, #b8b8b8);
  line-height: 1.35;
}

/* ── B-Roll Review Banner ──────────────────────────────────────────── */
.broll-review-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 480;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--r-xl);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 250ms ease-out both;
}
.broll-review-banner[hidden] { display: none; }
.broll-review-banner i { color: var(--accent); font-size: 18px; }
.broll-review-banner span { font-size: 13.5px; color: var(--text); }

/* ── B-Roll Review Modal ────────────────────────────────────────────── */
.modal-lg {
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-lg .modal-header { flex-shrink: 0; }
.modal-lg .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.modal-lg .modal-footer { flex-shrink: 0; }
.broll-review-clip {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--accent-border);
}
.broll-review-clip:last-child { border-bottom: none; }
.broll-review-clip-title {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent);
}
.broll-review-moment { margin-bottom: 18px; }
.broll-review-moment-label {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin-bottom: 8px;
}
.broll-review-candidates {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.broll-candidate-option {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  height: 160px;
  background: rgba(255,255,255,0.05);
}
@media (max-width: 640px) {
  .broll-candidate-option { height: 130px; }
}
.broll-candidate-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.broll-candidate-option.selected { border-color: var(--accent); }
.broll-candidate-option input[type="radio"] {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
}
.broll-candidate-skip, .broll-candidate-custom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 4px;
}
.broll-candidate-custom input[type="file"] { display: none; }
.broll-review-error {
  color: #f87171;
  font-size: 13px;
  margin-right: auto;
}

/* ═══════════════════════════════════════════════════════════════════════
   PANEL: CREATE CLIPS — refonte UX (plan §1/§2/§3/§4/§10)
   ═══════════════════════════════════════════════════════════════════════ */

/* --- Input mode toggle (Upload Video / Upload from URL) --- */
.create-mode-toggle {
  display: flex;
  gap: 8px;
  padding: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 24px;
  max-width: 480px;
}
.create-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-h, inherit);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.create-mode-btn i { font-size: 1.05rem; }
.create-mode-btn:hover { color: var(--text); }
.create-mode-btn.active {
  background: var(--accent-low);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.create-mode-block { display: block; }

/* --- Processing checklist (replaces the old fake % progress bar) --- */
.processing-steps {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 14px 0;
}
/* [CANCEL-JOB] Bouton Annuler, espacé sous la checklist d'étapes. */
#processing-cancel-btn, #processing-cancel-btn-url {
  margin-top: 14px;
}
.processing-steps-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.steps-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-3);
  transition: color .2s ease;
}
.step-item i { font-size: 1.05rem; flex-shrink: 0; }
.step-item.step-completed { color: var(--text-2); }
.step-item.step-completed i { color: var(--accent); }
.step-item.step-processing { color: var(--text); font-weight: 600; }
.step-item.step-pending { color: var(--text-3); opacity: .6; }
.step-spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-border);
  border-top-color: var(--accent);
  animation: nimble-step-spin .7s linear infinite;
}
@keyframes nimble-step-spin { to { transform: rotate(360deg); } }

/* --- Result view: two-column layout (plan §2/§3) --- */
.result-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  margin-top: 28px;
  align-items: start;
}
.result-col-video {
  position: sticky;
  top: 16px;
}
.result-col-video .clips-preview-card,
.result-col-video #clips-preview-card,
.result-col-video #clips-preview-card-url {
  width: 100%;
}
.result-col-video video,
.result-col-video .clip-player {
  width: 100%;
  max-height: 78vh;
  border-radius: 14px;
}
.result-col-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.result-col-info #ai-title {
  font-size: 1.35rem;
  line-height: 1.3;
}
.result-col-info #ai-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.result-suggestions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Viral Moments card is secondary information — de-emphasized under the
   main Title/Description/Hashtags block, per plan §3 hierarchy. */
#viral-card { order: 5; opacity: .92; }

/* --- Responsive (plan §10): single stacked column on tablet/mobile --- */
@media (max-width: 900px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
  .result-col-video { position: static; }
  .result-col-video video,
  .result-col-video .clip-player {
    max-height: 60vh;
  }
}
@media (max-width: 640px) {
  .create-mode-toggle { max-width: 100%; }
  .create-mode-btn { font-size: 0.85rem; padding: 10px 10px; }
  .result-grid { gap: 18px; margin-top: 18px; }
}

/* --- "Clip N" badge on the AI Metadata card (per-clip metadata fix) --- */
.ai-metadata-clip-badge {
  margin-left: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-low);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 2px 10px;
  vertical-align: middle;
}

/* ================================================
   TOOLS HUB — refonte navigation (P0)
   Cartes cliquables qui réutilisent switchPanel()
   existant ; aucun panel outil n'est modifié.
   ================================================ */
.tool-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  position: relative;
}

.tool-card:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.tool-card > i {
  font-size: 20px;
  color: var(--accent);
  opacity: 0.9;
  flex-shrink: 0;
  margin-top: 2px;
}

.tool-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.tool-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.tool-card-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}

.tool-card .soon-badge {
  position: absolute;
  top: 12px;
  right: 14px;
}

/* Workspace tab (Account > Workspace) : mêmes éléments .sidebar-link que
   l'ancienne sidebar (id/data-panel/onclick inchangés — voir dashboard.html),
   juste réhabillés en cartes pleine largeur pour s'intégrer au contenu du
   panel Account plutôt qu'à la sidebar verticale. */
#panel-account .acct-workspace-card.sidebar-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin: 0 0 10px;
  padding: 16px 18px;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

#panel-account .acct-workspace-card.sidebar-link:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: inherit;
}

#panel-account .acct-workspace-card.sidebar-link > i {
  font-size: 20px;
  color: var(--accent);
  opacity: 0.9;
  margin-top: 2px;
}

#panel-account .acct-workspace-card.sidebar-link.active {
  border-color: var(--accent-border);
  background: var(--accent-low);
}

#panel-account .acct-workspace-card.sidebar-link.active::before { display: none; }

/* Breadcrumb — segment de groupe optionnel ("Dashboard / Tools / Viral Hooks") */
.topbar-breadcrumb-group {
  color: var(--text-2);
}
