/* ── Design System ─────────────────────── */
:root {
  /* Light theme (default — Tailwind-inspired) */
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --border: #cbd5e1;
  --border2: #e2e8f0;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,.1);
  --blue-dim2: rgba(59,130,246,.06);
  --green: #16a34a;
  --green-dim: rgba(22,163,74,.1);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,.08);
  --yellow: #ca8a04;
  --accent: #ff6b2c;
  --accent-strong: #ff7a2f;
  --accent-soft: rgba(255,107,44,.14);
  --accent-softer: rgba(255,107,44,.08);
  --accent-border: rgba(255,107,44,.22);
  --accent-gradient: linear-gradient(135deg, #ff7a2f 0%, #ff9a42 100%);
  --hero-gradient: radial-gradient(circle at top left, rgba(255,122,47,.20), transparent 34%), radial-gradient(circle at 85% 10%, rgba(255,196,112,.18), transparent 26%), linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,247,241,.98));
  --shell-wash: radial-gradient(circle at top, rgba(255,122,47,.10), transparent 28%), linear-gradient(180deg, #fffaf6 0%, #fff 18%, #fff8f3 100%);
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;
  --transition: 120ms ease;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.06);
  --shadow-md: 0 8px 32px rgba(0,0,0,.1);
}

/* Dark theme — respects OS preference or [data-theme="dark"] */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface2: #212121;
    --surface3: #2a2a2a;
    --border: #3f3f3f;
    --border2: #2d2d2d;
    --text: #f1f1f1;
    --text2: #aaaaaa;
    --text3: #717171;
    --blue: #3b82f6;
    --blue-dim: rgba(59,130,246,.12);
    --blue-dim2: rgba(59,130,246,.08);
    --green: #22c55e;
    --green-dim: rgba(34,197,94,.12);
    --red: #ef4444;
    --red-dim: rgba(239,68,68,.1);
    --yellow: #eab308;
    --accent: #ff8b4d;
    --accent-strong: #ffa25d;
    --accent-soft: rgba(255,139,77,.16);
    --accent-softer: rgba(255,139,77,.09);
    --accent-border: rgba(255,139,77,.25);
    --accent-gradient: linear-gradient(135deg, #ff7a2f 0%, #ffae57 100%);
    --hero-gradient: radial-gradient(circle at top left, rgba(255,122,47,.24), transparent 34%), radial-gradient(circle at 85% 10%, rgba(255,196,112,.14), transparent 26%), linear-gradient(180deg, rgba(31,21,17,.96), rgba(19,15,13,.98));
    --shell-wash: radial-gradient(circle at top, rgba(255,122,47,.12), transparent 28%), linear-gradient(180deg, #120f0d 0%, #0f0f0f 18%, #15110f 100%);
    --shadow: 0 4px 24px rgba(0,0,0,.6);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
    --shadow-md: 0 8px 32px rgba(0,0,0,.5);
  }
}

/* Manual dark override */
[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #212121;
  --surface3: #2a2a2a;
  --border: #3f3f3f;
  --border2: #2d2d2d;
  --text: #f1f1f1;
  --text2: #aaaaaa;
  --text3: #717171;
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,.12);
  --blue-dim2: rgba(59,130,246,.08);
  --green: #22c55e;
  --green-dim: rgba(34,197,94,.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,.1);
  --yellow: #eab308;
  --accent: #ff8b4d;
  --accent-strong: #ffa25d;
  --accent-soft: rgba(255,139,77,.16);
  --accent-softer: rgba(255,139,77,.09);
  --accent-border: rgba(255,139,77,.25);
  --accent-gradient: linear-gradient(135deg, #ff7a2f 0%, #ffae57 100%);
  --hero-gradient: radial-gradient(circle at top left, rgba(255,122,47,.24), transparent 34%), radial-gradient(circle at 85% 10%, rgba(255,196,112,.14), transparent 26%), linear-gradient(180deg, rgba(31,21,17,.96), rgba(19,15,13,.98));
  --shell-wash: radial-gradient(circle at top, rgba(255,122,47,.12), transparent 28%), linear-gradient(180deg, #120f0d 0%, #0f0f0f 18%, #15110f 100%);
  --shadow: 0 4px 24px rgba(0,0,0,.6);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 8px 32px rgba(0,0,0,.5);
}

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

body {
  font-family: var(--sans);
  background: var(--shell-wash);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ─────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Layout ────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* ── Top Bar ───────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  background: color-mix(in srgb, var(--bg) 82%, rgba(255,255,255,.18));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  padding: 6px 10px 6px 6px;
  border-radius: 16px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.topbar-logo:hover {
  background: var(--accent-softer);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(255,107,44,.12);
}

.nav-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  display: block;
}

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

.nav-link-action,
.tli-actions,
.hello-actions-row,
.card-img-btn,
.pc-fav-btn,
.pc-edit-btn,
.pc-delete-btn,
.hello-card-dismiss,
.hello-card-pin {
  position: relative;
  z-index: 2;
}

.topbar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 12px 30px rgba(255,107,44,.28);
}

.topbar-logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.topbar-logo-badge {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--blue-dim);
  color: var(--blue);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(59,130,246,.2);
}

.topbar-search {
  flex: 1;
  margin: 0;
  position: relative;
}

.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
  font-size: 13px;
}

.topbar-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px 8px 36px;
  border-radius: var(--radius-full);
  font-family: var(--sans);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.topbar-search input::placeholder { color: var(--text3); }

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

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 440px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: var(--shadow);
}
.search-dropdown.open { display: block; }

.search-cat {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--border2);
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,.02);
  text-decoration: none;
  color: inherit;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--surface2); }
.search-item img { width: 44px; height: 28px; object-fit: cover; border-radius: 4px; background: var(--surface2); flex-shrink: 0; }
.search-item .si-icon { width: 44px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--surface2); border-radius: 4px; font-size: 14px; flex-shrink: 0; }
.search-item .si-name { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item .si-type { font-size: 11px; color: var(--text3); flex-shrink: 0; background: var(--surface2); padding: 2px 7px; border-radius: var(--radius-full); }
.search-item .si-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.search-item .si-info .si-name { flex: none; }
.search-item .si-meta { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar-toggle {
  opacity: 0.5;
  transition: opacity var(--transition), background var(--transition);
}
.topbar-toggle.is-active {
  opacity: 1;
  color: var(--accent);
}

.topbar.has-danger {
  background: #c41c3b;
  border-bottom-color: #a01630;
}
.topbar.has-danger .topbar-logo-text,
.topbar.has-danger .topbar-right,
.topbar.has-danger #serverLabel {
  color: #fff;
}

.danger-alert {
  background: #ff6b2c;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: middle;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(255, 107, 44, 0.3);
}

#serverLabel {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--mono);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sidebar ───────────────────────── */
.layout {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 18px 18px 24px;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 24px;
  padding: 18px 10px;
  position: sticky;
  top: 74px;
  height: calc(100vh - 92px);
  overflow-y: auto;
  display: none;
  box-shadow: 0 24px 60px rgba(15,23,42,.08);
  backdrop-filter: blur(16px);
}

.sidebar.visible { display: block; }

.sidebar-section-title {
  padding: 0 14px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: color-mix(in srgb, var(--accent) 50%, var(--text3));
  margin-top: 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  border-radius: 16px;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
}

.sidebar-item:hover {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface2));
  border-color: var(--accent-border);
  color: var(--text);
}

.sidebar-item.active {
  background: linear-gradient(135deg, rgba(255,122,47,.18), rgba(255,154,66,.08));
  color: var(--text);
  border-color: var(--accent-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 10px 24px rgba(255,107,44,.10);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: var(--accent-gradient);
  border-radius: 999px;
}

.sidebar-item { position: relative; }

.sidebar-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 18%, var(--border2)), transparent);
  margin: 10px 10px;
}

/* Hidden sidebar items (via settings) */
.sidebar-item.nav-hidden,
.sidebar-section-title.nav-hidden,
.sidebar-divider.nav-hidden { display: none; }

/* Nav config button (gear icon in section title) */
.nav-config-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  float: right;
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}
.nav-config-btn:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.browse-folder-config-btn {
  float: none;
  font-size: 14px;
  align-self: center;
}

/* Nav config overlay + modal */
.nav-config-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.nav-config-overlay.open { display: flex; }

.nav-config-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  animation: navConfigIn .2s ease-out;
}
@keyframes navConfigIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}

.nav-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border2);
}
.nav-config-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.nav-config-close {
  appearance: none;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}
.nav-config-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-config-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.nav-config-footer {
  padding: 10px 22px 16px;
  border-top: 1px solid var(--border2);
}

/* Category group */
.nav-config-category {
  margin-bottom: 14px;
}
.nav-config-category-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
}
.nav-config-category-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: color-mix(in srgb, var(--accent) 50%, var(--text3));
  flex: 1;
  min-width: 0;
}
.nav-config-category-label input {
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: inherit;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  width: 100%;
  outline: none;
}
.nav-config-category-actions {
  display: flex;
  gap: 2px;
}
.nav-config-cat-btn {
  appearance: none;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}
.nav-config-cat-btn:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.nav-config-cat-btn.danger:hover {
  color: #ef4444;
  background: rgba(239,68,68,.1);
}

/* Item row */
.nav-config-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface2) 50%, transparent);
  margin-bottom: 3px;
  transition: background var(--transition), box-shadow var(--transition);
  user-select: none;
}
.nav-config-item:hover {
  background: var(--surface2);
}
.nav-config-item.dragging {
  opacity: .5;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface2));
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.nav-config-item-drag {
  cursor: grab;
  color: var(--text3);
  font-size: 14px;
  padding: 0 2px;
  flex-shrink: 0;
}
.nav-config-item-drag:active { cursor: grabbing; }
.nav-config-item-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.nav-config-item-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.nav-config-item-label input {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  width: 100%;
  outline: none;
}
.nav-config-item-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.nav-config-item-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.nav-config-item-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition);
}
.nav-config-item-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.nav-config-item-toggle input:checked + .nav-config-item-slider {
  background: var(--accent);
}
.nav-config-item-toggle input:checked + .nav-config-item-slider::after {
  transform: translateX(16px);
}
.nav-config-item-arrows {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
}
.nav-config-arrow {
  appearance: none;
  background: none;
  border: none;
  font-size: 10px;
  color: var(--text3);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1.1;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.nav-config-arrow:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.nav-config-arrow:disabled {
  opacity: .2;
  cursor: default;
}
.nav-config-drop-zone {
  height: 3px;
  border-radius: 2px;
  margin: 1px 10px;
  transition: background var(--transition), height var(--transition);
}
.nav-config-drop-zone.drag-over {
  height: 6px;
  background: var(--accent);
}

.browse-folder-config-modal {
  width: min(760px, 92vw);
}

.browse-folder-config-intro {
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.45;
}

.browse-folder-config-tree {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.browse-folder-config-row {
  margin-bottom: 0;
}

.browse-folder-config-row.is-loading {
  opacity: .7;
}

.browse-folder-config-indent {
  width: 0;
  height: 1px;
  margin-right: 0;
  flex-shrink: 0;
}

.browse-folder-config-expander {
  appearance: none;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text3);
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}

.browse-folder-config-expander:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.browse-folder-config-expander.is-leaf {
  visibility: hidden;
  pointer-events: none;
}

.browse-folder-config-path {
  font-size: 11px;
  color: var(--text3);
  margin-left: 4px;
}

.browse-folder-config-row.is-hidden .nav-config-item-label,
.browse-folder-config-row.is-hidden .browse-folder-config-path {
  opacity: .55;
}

.browse-folder-config-status {
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
  font-size: 12px;
  color: var(--text3);
}

.browse-folder-config-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.browse-folder-config-actions .btn {
  min-height: 32px;
}

/* ── Main Content ──────────────────── */
.main {
  flex: 1;
  min-width: 0;
  padding: 4px 0 24px;
}

/* ── Views ─────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Buttons ───────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface2);
  color: var(--text);
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { border-color: var(--text3); background: var(--surface3); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-primary:hover { opacity: .88; }

.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn-success:hover { opacity: .88; }

.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn-danger:hover { opacity: .88; }

.btn-sm { padding: 5px 10px; font-size: 12px; gap: 4px; }
.btn-xs { padding: 3px 8px; font-size: 11px; gap: 3px; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text2);
}
.btn-ghost:hover { background: var(--surface2); border-color: var(--border); color: var(--text); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 14px;
  transition: all var(--transition);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }
.btn-icon.del:hover { background: var(--red-dim); color: var(--red); }

/* ── Inputs ────────────────────────── */
input[type=text], input[type=password], input[type=number], select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input[type=text]:focus, input[type=password]:focus, input[type=number]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}
input[type=text]::placeholder, textarea::placeholder { color: var(--text3); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23717171'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

textarea { resize: vertical; line-height: 1.5; }

/* ── Connect / Loading ─────────────── */
.connect-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
}

.connect-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.connect-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 20px;
}

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

.connect-card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.connect-card p {
  font-size: 13px;
  color: var(--text3);
}

.err {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius);
}

/* ── Page Header ───────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: var(--hero-gradient);
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border2));
  border-radius: 24px;
  padding: 18px 20px;
  box-shadow: 0 18px 50px rgba(15,23,42,.08);
}

.page-header-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.page-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  font-weight: 800;
}

.page-subtitle {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
  max-width: 68ch;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  flex: 1;
}

.page-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.02em;
  flex: 1;
}

.view:not(#viewEditor) .btn-primary {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 28px rgba(255,107,44,.22);
}

.view:not(#viewEditor) .btn-primary:hover {
  opacity: 1;
  filter: saturate(1.06) brightness(1.02);
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.sidebar-item:focus-visible,
.card:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.view:not(#viewEditor) .btn:hover,
.topbar .btn:hover,
.topbar .btn-icon:hover {
  border-color: var(--accent-border);
}

/* ── Breadcrumb ────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--text3);
}
.breadcrumb a {
  color: var(--text2);
  cursor: pointer;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.breadcrumb a:hover { background: var(--accent-softer); border-color: var(--accent-border); color: var(--text); }
.breadcrumb .sep { color: var(--border); font-size: 16px; line-height: 1; }

.breadcrumb-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-weight: 700;
}

/* ── Browse Toolbar ────────────────── */
.browse-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  border-radius: 22px;
  padding: 10px 14px;
  box-shadow: 0 14px 38px rgba(15,23,42,.06);
}

.browse-toolbar select {
  padding: 5px 28px 5px 10px;
  font-size: 12px;
  background-color: var(--surface2);
}

.sort-dir {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
  line-height: 1;
}
.sort-dir:hover { border-color: var(--text3); }

.browse-count {
  font-family: var(--mono);
  font-size: 11px;
  color: color-mix(in srgb, var(--accent) 55%, var(--text2));
  background: var(--accent-softer);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-border);
}

.spacer { flex: 1; }

.filter-toggle { position: relative; }
.filter-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  pointer-events: none;
}

/* ── Filter & Settings Panels ──────── */
.filter-panel, .settings-panel {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 16px;
  display: none;
  animation: slideDown .15s ease;
  box-shadow: 0 18px 44px rgba(15,23,42,.07);
}
.filter-panel.open, .settings-panel.open { display: block; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.filter-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.filter-group label.fg-title {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.filter-group select { width: 100%; font-size: 12px; padding: 6px 28px 6px 10px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 100px; overflow-y: auto; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  font-weight: 500;
}
.filter-chip:hover { border-color: var(--text3); background: var(--surface3); }
.filter-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.filter-reset { margin-top: 12px; text-align: right; }

.browse-delete-status {
  display: none;
  margin: -6px 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border2));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.browse-delete-status.is-active {
  display: block;
}

.browse-delete-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 7px;
}

.browse-delete-status-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: color-mix(in srgb, var(--accent) 55%, var(--text3));
}

.browse-delete-status-text {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browse-delete-status-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface3) 70%, var(--surface2));
  overflow: hidden;
}

.browse-delete-status-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 68%, #ffffff), var(--accent));
  transition: width .26s ease;
}

.browse-delete-status.is-indeterminate .browse-delete-status-fill {
  width: 35%;
  animation: browseDeleteIndeterminate 1.05s ease-in-out infinite;
}

.browse-delete-status.is-ok {
  border-color: color-mix(in srgb, var(--green) 46%, var(--border2));
  background: color-mix(in srgb, var(--green) 8%, var(--surface));
}

.browse-delete-status.is-ok .browse-delete-status-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--green) 65%, #ffffff), var(--green));
}

.browse-delete-status.is-err {
  border-color: color-mix(in srgb, var(--red) 44%, var(--border2));
  background: color-mix(in srgb, var(--red) 8%, var(--surface));
}

.browse-delete-status.is-err .browse-delete-status-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--red) 62%, #ffffff), var(--red));
}

.browse-delete-status.is-warn {
  border-color: color-mix(in srgb, var(--yellow) 50%, var(--border2));
  background: color-mix(in srgb, var(--yellow) 11%, var(--surface));
}

.browse-delete-status.is-warn .browse-delete-status-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--yellow) 66%, #ffffff), var(--yellow));
}

@keyframes browseDeleteIndeterminate {
  0% { transform: translateX(-120%); }
  55% { transform: translateX(95%); }
  100% { transform: translateX(220%); }
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.settings-row label.sr-label { font-size: 12px; color: var(--text2); min-width: 120px; font-weight: 500; }
.settings-row input[type=range] { flex: 1; max-width: 200px; accent-color: var(--accent); }
.settings-row .size-val { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 3ch; }

.field-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.field-toggle { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; user-select: none; }
.field-toggle input { accent-color: var(--accent); cursor: pointer; }

.settings-row-depth {
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
}

.field-toggle-depth {
  font-weight: 600;
}

.settings-hint {
  color: var(--text3);
  font-size: 11px;
  line-height: 1.45;
}

/* ── Grid ──────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, #fff) 0%, color-mix(in srgb, var(--surface2) 92%, transparent) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border2));
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  contain: layout paint;
}
.card:hover {
  border-color: var(--accent-border);
  transform: translateY(-3px);
  box-shadow: 0 18px 42px rgba(15,23,42,.14);
}

.card-img-wrap { position: relative; }
.card.card-needs-transcode {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.45);
}
.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--surface2);
  display: block;
  transition: opacity .14s linear;
}

.card-img-poster {
  aspect-ratio: 2/3;
}

.grid.grid-films-posters .card-img.card-img-original {
  aspect-ratio: auto;
  object-fit: contain;
}
.card-icon {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--surface2);
  color: var(--text3);
  transition: opacity .14s linear;
}

.card-img-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,.75);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  z-index: 5;
  font-family: var(--sans);
  font-weight: 500;
}
.card:hover .card-img-btn { opacity: 1; }
.card-img-btn:hover { background: var(--blue); border-color: var(--blue); }

#browseMediaManageBtn.active {
  background: color-mix(in srgb, var(--red) 24%, var(--surface));
  border-color: color-mix(in srgb, var(--red) 50%, var(--border));
  color: color-mix(in srgb, var(--red) 74%, #fff);
}

.card-media-actions {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  gap: 6px;
  z-index: 6;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition), transform var(--transition);
}

.card:hover .card-media-actions,
.card:focus-within .card-media-actions {
  opacity: 1;
  transform: translateY(0);
}

.card-media-action-btn {
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  background: rgba(12,18,32,.78);
  color: #f6f8ff;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.card-media-action-btn:hover {
  transform: translateY(-1px);
}

.card-media-action-move:hover {
  background: rgba(3,105,161,.9);
  border-color: rgba(125,211,252,.65);
}

.card-media-action-delete:hover {
  background: rgba(185,28,28,.92);
  border-color: rgba(252,165,165,.75);
}

.card-favorite-badge {
  top: 8px;
  right: 8px;
  z-index: 4;
  border: 1px solid rgba(255,235,238,.45);
  background: rgba(220,38,38,.88);
  color: #fff;
  box-shadow: 0 8px 18px rgba(220,38,38,.24);
  pointer-events: none;
}

.card-review-decision-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(15,23,42,.22);
  pointer-events: none;
}

.card-review-decision-badge.is-keep {
  background: rgba(22,163,74,.92);
  border-color: rgba(187,247,208,.72);
  color: #f8fffb;
}

.card-review-decision-badge.is-remove {
  background: rgba(220,38,38,.9);
  border-color: rgba(254,202,202,.72);
  color: #fff6f6;
}

.main .view:not(#viewEditor) .card-img-btn:hover { background: var(--accent); border-color: var(--accent); }

.card-body { padding: 8px 10px 10px; }
.card-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.card-sub { font-size: 11px; color: var(--text3); line-height: 1.4; }
.card-extra { font-size: 11px; color: var(--text3); margin-top: 4px; line-height: 1.5; }
.card-extra span { display: inline-block; margin-right: 6px; }
.card-search-match { margin-top: 6px; padding: 5px 7px; background: color-mix(in srgb, var(--accent) 12%, transparent); border-left: 2px solid var(--accent); border-radius: 0 4px 4px 0; font-size: 10.5px; line-height: 1.45; }
.card-search-label { font-weight: 600; color: var(--accent); margin-right: 4px; }
.empty,
.dash-empty,
.dash-loading,
.no-results {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(15,23,42,.05);
}

.tag-list-wrap,
#statsContent,
#tasksContent,
#tagItemsPanel,
#studioItemsPanel,
#genreItemsPanel,
#personGrid,
#defisListContainer {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border2));
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(15,23,42,.06);
}

#statsContent {
  padding: 20px;
}

/* ── Hello Page ────────────────────── */
:root {
  --hello-radius-xl: 28px;
  --hello-radius-lg: 22px;
  --hello-radius-md: 18px;
  --hello-gap-xl: 22px;
  --hello-gap-lg: 16px;
  --hello-gap-md: 14px;
}

.hello-page-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hello-gap-xl);
}

.hello-page-shell > .hello-hero,
.hello-page-shell > .hello-section {
  grid-column: 1 / -1;
}

.hello-page-shell > .hello-section-half {
  grid-column: span 1;
}

.hello-page-shell > .hello-section-half.hello-section-half--full {
  grid-column: 1 / -1;
}

.hello-hero,
.hello-section {
  background: var(--hero-gradient);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  border-radius: var(--hello-radius-xl);
  box-shadow: 0 22px 60px rgba(15,23,42,.08);
  content-visibility: auto;
  contain-intrinsic-size: 600px;
}

.hello-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: 22px;
  padding: 24px;
  min-height: 0;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 58%),
    radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 62%),
    linear-gradient(165deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface2) 92%, transparent));
}

.hello-hero-tools {
  position: absolute;
  top: 22px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hello-hero-settings {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border2));
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15,23,42,.08);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.hello-hero-settings:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border2));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15,23,42,.13);
}

.hello-hero-settings-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border2));
  background: color-mix(in srgb, var(--surface2) 85%, transparent);
}

.hello-hero-settings-icon svg {
  width: 13px;
  height: 13px;
  display: block;
}

.hello-hero-copy {
  padding-right: 132px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.hello-hero-subline {
  margin: 0;
  color: var(--text2);
  max-width: 62ch;
  font-size: 13px;
  line-height: 1.5;
}

.hello-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hello-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border2));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
}

.hello-hero-pill strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.hello-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: end;
}

.hello-stat-card,
.hello-surprise-card {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border2));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface2) 90%, transparent));
  color: var(--text);
  border-radius: 18px;
  padding: 12px;
  width: 100%;
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.hello-stat-card:hover,
.hello-surprise-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border2));
  box-shadow: 0 14px 28px rgba(15,23,42,.12);
}

.hello-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border2));
  flex-shrink: 0;
}

.hello-stat-card strong,
.hello-surprise-card strong {
  display: block;
  font-size: 1.12rem;
  letter-spacing: -.03em;
  line-height: 1;
}

.hello-stat-card span,
.hello-surprise-card span {
  display: block;
  margin-top: 6px;
  color: var(--text2);
  font-size: 11px;
  line-height: 1.35;
}

.hello-surprise-card {
  border-color: color-mix(in srgb, #ff8f1f 62%, var(--border2));
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.18), transparent 44%),
    radial-gradient(circle at bottom right, rgba(255,209,120,.28), transparent 46%),
    linear-gradient(145deg, rgba(255,115,64,.2), rgba(255,186,80,.24));
}

.hello-surprise-card strong {
  font-size: 1rem;
}

.hello-hero-copy h1 {
  font-size: clamp(1.6rem, 3.1vw, 2.6rem);
  line-height: 1.02;
  max-width: 14ch;
  letter-spacing: -.05em;
  margin-top: 4px;
}

.hello-hero-copy p:last-child {
  margin-top: 10px;
  color: var(--text2);
  max-width: 58ch;
  font-size: 13px;
}

.hello-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  font-weight: 800;
}

.hello-hero-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: stretch;
}

.hello-quick-card {
  appearance: none;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-areas:
    'icon kicker'
    'icon metric'
    'icon caption';
  align-items: start;
  column-gap: 10px;
  row-gap: 2px;
  padding: 13px 14px;
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
    linear-gradient(155deg, color-mix(in srgb, var(--surface2) 92%, var(--surface)), color-mix(in srgb, var(--surface) 96%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border2));
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color var(--transition) 120ms, transform var(--transition) 140ms, box-shadow var(--transition) 160ms;
  overflow: hidden;
  position: relative;
  min-height: 110px;
}

.hello-quick-card:hover {
  border-color: color-mix(in srgb, var(--accent) 56%, var(--border2));
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(15,23,42,.14);
}

.hello-quick-icon {
  grid-area: icon;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 18px;
  flex-shrink: 0;
  transition: transform var(--transition);
  border: 1px solid color-mix(in srgb, #fff 32%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}

.hello-quick-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.hello-quick-card:hover .hello-quick-icon {
  transform: scale(1.08);
}

.hello-quick-kicker {
  grid-area: kicker;
  display: block;
  text-transform: uppercase;
  letter-spacing: .11em;
  font-size: 9px;
  font-weight: 800;
  color: color-mix(in srgb, var(--text2) 76%, var(--accent));
  line-height: 1.1;
}

.hello-quick-metric {
  grid-area: metric;
  display: block;
  font-size: 1.06rem;
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin-top: 2px;
}

.hello-quick-caption {
  grid-area: caption;
  display: block;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.25;
}

.hello-quick-card--browse .hello-quick-icon {
  background:
    radial-gradient(circle at top right, rgba(34,197,94,.38), transparent 42%),
    linear-gradient(135deg, rgba(22,163,74,.28), rgba(21,128,61,.24));
}

.hello-quick-card--films .hello-quick-icon {
  background:
    radial-gradient(circle at top right, rgba(245,158,11,.40), transparent 42%),
    linear-gradient(135deg, rgba(245,158,11,.28), rgba(217,119,6,.24));
}

.hello-quick-card--resume .hello-quick-icon {
  background:
    radial-gradient(circle at top right, rgba(14,165,233,.40), transparent 42%),
    linear-gradient(135deg, rgba(6,182,212,.30), rgba(14,116,144,.22));
}

.hello-quick-card--surprise {
  border-color: color-mix(in srgb, #ff8f1f 64%, var(--border2));
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.26), transparent 38%),
    radial-gradient(circle at bottom right, rgba(255,226,102,.32), transparent 44%),
    linear-gradient(145deg, rgba(255,112,43,.24), rgba(255,208,92,.28) 52%, rgba(255,138,0,.22));
  box-shadow: 0 12px 28px rgba(255,138,0,.14);
}

.hello-quick-card--surprise:hover {
  border-color: color-mix(in srgb, #ff8f1f 78%, var(--border2));
  box-shadow: 0 18px 38px rgba(255,138,0,.2);
}

.hello-quick-card--surprise .hello-quick-icon {
  background:
    radial-gradient(circle at top right, rgba(255,226,102,.42), transparent 46%),
    linear-gradient(135deg, rgba(255,166,0,.34), rgba(255,138,0,.28));
}

.hello-surprise-card span {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text2);
}

.hello-section {
  padding: var(--hello-gap-xl);
}

.hello-now-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hello-gap-lg);
}

.hello-smart-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.hello-smart-card {
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border2));
  border-radius: var(--hello-radius-lg);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 8%, transparent), transparent 58%),
    color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.hello-smart-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border2));
  box-shadow: 0 12px 24px rgba(15, 23, 42, .14);
}

.hello-smart-card-empty {
  grid-template-columns: 1fr;
  cursor: default;
}

.hello-smart-card-empty:hover {
  transform: none;
  box-shadow: none;
}

.hello-smart-media {
  width: 100%;
}

.hello-smart-art {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

.hello-smart-art-empty {
  display: grid;
  place-items: center;
  color: var(--text3);
  font-size: 20px;
  font-weight: 700;
}

.hello-smart-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.hello-smart-copy .hello-kicker { order: 1; }
.hello-smart-copy h3 { order: 2; }
.hello-smart-copy .hello-smart-desc { order: 3; }
.hello-smart-copy .hello-smart-item-title { order: 4; }
.hello-smart-copy .hello-smart-meta { order: 5; }
.hello-smart-copy .hello-actions-row { order: 6; }

.hello-smart-card h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.01em;
}

.hello-smart-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.hello-smart-meta {
  font-size: 11px;
  color: var(--text3);
}

.hello-smart-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text2);
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hello-section.is-dragging {
  opacity: .55;
}

.hello-section.is-drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

.hello-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.hello-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.hello-section-head > :first-child {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.hello-section-drag {
  cursor: grab;
  flex: 0 0 auto;
}

.hello-section-drag:active {
  cursor: grabbing;
}

.hello-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.hello-hotspots-sort {
  min-width: 178px;
  height: 32px;
  padding: 5px 28px 5px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border2));
  background-color: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}

.hello-section-head h2 {
  font-size: 1.5rem;
  letter-spacing: -.04em;
}

.hello-spotlight {
  display: grid;
  grid-template-columns: minmax(240px, .95fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: stretch;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: var(--hello-radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}

.hello-spotlight:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: 0 18px 42px rgba(15,23,42,.10);
}

.hello-spotlight-favorite {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border2));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 14%, transparent), transparent 52%),
    linear-gradient(170deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface2) 92%, transparent));
}

.hello-spotlight-art {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  display: block;
  border-radius: var(--hello-radius-md);
  background: var(--surface2);
}

.hello-spotlight-art-empty,
.hello-feature-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text3);
}

.hello-spotlight-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}

.hello-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.hello-spotlight-copy h3,
.hello-feature-body h3 {
  font-size: 1.4rem;
  letter-spacing: -.04em;
}

.hello-spotlight-copy p,
.hello-feature-body p {
  color: var(--text2);
  line-height: 1.55;
}

.hello-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hello-meta-row span {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface2) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border2));
  font-size: 11px;
  color: var(--text2);
}

.hello-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.hello-actions-row .btn {
  border-radius: 999px;
  min-height: 34px;
  font-weight: 650;
  letter-spacing: .01em;
  box-shadow: 0 10px 20px rgba(15,23,42,.08);
}

.hello-actions-row .btn.btn-primary {
  box-shadow: 0 12px 24px rgba(255,107,44,.24);
}

.hello-actions-row .btn.btn-ghost {
  border-color: color-mix(in srgb, var(--accent) 16%, var(--border2));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text2);
}

.hello-actions-row .btn.btn-ghost:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--text);
}

.hello-video-grid {
  gap: var(--hello-gap-lg);
}

.hello-video-grid:not(.hello-video-grid--single-row) {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.hello-video-grid--single-row {
  overflow: hidden;
}

.hello-video-grid .card {
  min-width: 0;
}

.hello-video-grid,
.hello-horizontal-rail {
  contain: layout paint;
}

.hello-video-grid .card-body,
.hello-horizontal-rail .card-body,
.hello-grid .card-body,
.hello-video-grid .card-title,
.hello-horizontal-rail .card-title,
.hello-grid .card-title,
.hello-video-grid .card-sub,
.hello-horizontal-rail .card-sub,
.hello-grid .card-sub {
  text-align: left;
}

.hello-rail-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.hello-horizontal-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 220px);
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding-bottom: 6px;
}

.hello-horizontal-rail .card,
.hello-horizontal-rail .hello-empty-state {
  scroll-snap-align: start;
}

.hello-rail-scroll {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  cursor: pointer;
}

.hello-rail-scroll:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.hello-quicknav-section {
  padding-top: 18px;
}

.hello-quicknav-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--hello-gap-md);
}

.hello-quicknav-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
  text-align: left;
}

.hello-quicknav-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: 0 18px 42px rgba(15,23,42,.10);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.hello-quicknav-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
}

.hello-quicknav-card strong {
  font-size: 15px;
  letter-spacing: -.02em;
}

.hello-quicknav-card span:last-child {
  color: var(--text2);
  line-height: 1.5;
  font-size: 12px;
}

.hello-feature-card {
  display: grid;
  grid-template-columns: minmax(186px, .92fr) minmax(0, 1fr);
  gap: 14px;
  min-height: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 92%, transparent) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 9%, var(--border2));
  border-radius: var(--hello-radius-lg);
  padding: 12px;
  overflow: visible;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}

.hello-feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: 0 18px 42px rgba(15,23,42,.10);
}

.hello-feature-media {
  position: relative;
  min-width: 0;
  border-radius: var(--hello-radius-md);
  overflow: hidden;
  align-self: center;
  background: var(--surface2);
}

.hello-feature-thumb {
  width: 100%;
  height: 100%;
  aspect-ratio: 16/9;
  min-height: 172px;
  object-fit: cover;
  display: block;
  background: var(--surface2);
  transition: opacity .14s linear;
}

.hello-feature-thumb-empty {
  width: 100%;
  aspect-ratio: 16/9;
  min-height: 172px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text3);
  transition: opacity .14s linear;
}

.hello-spotlight-media {
  position: relative;
  overflow: hidden;
}

.hello-spotlight-art,
.hello-spotlight-art-empty {
  transition: opacity .14s linear;
}

.hello-feature-chip {
  position: absolute;
  top: 14px;
  left: 14px;
}

.hello-feature-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px 16px;
}

.hello-feature-body h3 {
  font-size: 1.04rem;
  line-height: 1.35;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hello-feature-overview {
  font-size: 13px;
  display: -webkit-box;
  line-clamp: 5;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hello-movie-grid .card-img-wrap,
.hello-movie-grid .card-img,
.hello-movie-grid .card-icon {
  aspect-ratio: 2/3;
}

.hello-video-grid--two-rows {
  max-height: 520px;
  overflow: hidden;
}

.hello-special-section {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border2));
}

.hello-monthly-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hello-monthly-reasons span {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.hello-monthly-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.hello-monthly-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border-radius: var(--hello-radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}

.hello-monthly-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-border);
  box-shadow: 0 18px 42px rgba(15,23,42,.10);
}

.hello-monthly-card-empty {
  cursor: default;
}

.hello-monthly-card-empty:hover {
  transform: none;
  box-shadow: none;
  border-color: color-mix(in srgb, var(--accent) 10%, var(--border2));
}

.hello-monthly-card-media {
  position: relative;
  overflow: hidden;
}

.hello-monthly-card-art,
.hello-monthly-card-art-empty {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  object-fit: cover;
  background: var(--surface2);
}

.hello-monthly-card-art-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text3);
}

.hello-monthly-card-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px 16px;
  text-align: left;
}

.hello-monthly-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hello-monthly-summary-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.hello-monthly-summary-stats span {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border2));
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
}

.hello-monthly-card-copy h3 {
  font-size: 1.02rem;
  line-height: 1.35;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hello-monthly-card-copy p {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  line-clamp: 4;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hello-feature-overview br,
.hello-spotlight-copy p br {
  content: '';
}

.hello-card-dismiss {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15,23,42,.76);
  color: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), transform var(--transition);
}

.hello-card-pin {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15,23,42,.76);
  color: #fff;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

.hello-card-pin.is-active,
.hello-card-pin:hover {
  background: color-mix(in srgb, var(--accent) 80%, rgba(15,23,42,.76));
  border-color: var(--accent-border);
}

.card.is-pinned {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border2));
  box-shadow: 0 16px 36px rgba(15,23,42,.10);
}

.hello-resume-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 6;
  padding: 8px 9px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(15,23,42,.86), rgba(15,23,42,.68));
  border: 1px solid rgba(255,255,255,.14);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition), transform var(--transition);
  pointer-events: none;
}

.hello-resume-progress.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.hello-resume-progress-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  overflow: hidden;
}

.hello-resume-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #f59e0b);
  transition: width .25s ease;
}

.hello-resume-progress-label {
  margin-top: 5px;
  color: rgba(255,255,255,.96);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
}

.hello-resume-last-line {
  margin-top: 5px;
  font-size: 10px;
  color: color-mix(in srgb, var(--text2) 76%, var(--accent));
  letter-spacing: .01em;
}

.hello-customize-panel {
  display: grid;
  gap: 12px;
}

.hello-customize-dialog {
  display: grid;
  gap: 10px;
}

.hello-customize-dialog > p {
  color: var(--text2);
  font-size: 12px;
  line-height: 1.45;
}

.hello-customize-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 11%, var(--border2));
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  font-size: 12px;
  cursor: pointer;
}

.hello-customize-row:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border2));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.hello-customize-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.stats-day-customize-group {
  display:grid;
  gap:10px;
  padding:12px;
  border-radius:18px;
  border:1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface2) 94%, transparent));
}

.stats-day-customize-group-title {
  display:flex;
  align-items:center;
  min-height:24px;
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--accent);
}

.hello-customize-intro {
  color: var(--text2);
  line-height: 1.5;
  font-size: 12px;
}

.hello-customize-group {
  display: grid;
  gap: 9px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, transparent), color-mix(in srgb, var(--surface2) 94%, transparent));
}

.hello-customize-group--accent {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--surface2) 96%, transparent));
}

.hello-customize-group-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.hello-customize-group-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border2));
}

.hello-customize-group-head h4 {
  margin: 0;
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.hello-customize-group-head p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text3);
}

.hello-customize-switch-list {
  display: grid;
  gap: 8px;
}

.hello-customize-switch {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.hello-customize-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.hello-customize-switch-slider {
  position: relative;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--transition);
}

.hello-customize-switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform var(--transition);
}

.hello-customize-switch input:checked + .hello-customize-switch-slider {
  background: color-mix(in srgb, var(--accent) 85%, #f97316);
}

.hello-customize-switch input:checked + .hello-customize-switch-slider::after {
  transform: translateX(17px);
}

.hello-customize-switch-copy {
  display: grid;
  gap: 2px;
}

.hello-customize-switch-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.hello-customize-switch-icon {
  width: 16px;
  text-align: center;
  display: inline-block;
}

.hello-customize-switch-desc {
  font-size: 11px;
  color: var(--text3);
}

.hello-video-grid .card:hover .hello-card-dismiss,
.hello-video-grid .card:focus-within .hello-card-dismiss {
  opacity: 1;
}

.hello-horizontal-rail .card:hover .hello-card-dismiss,
.hello-horizontal-rail .card:focus-within .hello-card-dismiss {
  opacity: 1;
}

.hello-card-dismiss:hover {
  background: rgba(220,38,38,.92);
  transform: translateY(-1px);
}

.hello-grid {
  gap: 16px;
}

.hello-empty-state {
  padding: 22px;
  border-radius: var(--hello-radius-lg);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 22%, var(--border2));
  color: var(--text3);
  text-align: center;
}

.hello-log-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 6;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(15,23,42,.82);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .01em;
}

.hello-log-badge.is-warning {
  background: rgba(180,35,28,.86);
}

.hello-hotspot-video-thumb {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  width: 66px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.36);
  object-fit: cover;
  box-shadow: 0 6px 14px rgba(15,23,42,.35);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  pointer-events: none;
}

.card-img-wrap.hello-hotspot-main-framed {
  position: relative;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  overflow: hidden;
}

.card-img-wrap.hello-hotspot-main-framed::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid rgba(251,146,60,.95);
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(124,45,18,.30);
  pointer-events: none;
  z-index: 3;
}

.hello-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--hello-gap-lg);
}

.hello-insight-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hello-insight-card {
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border2));
  border-radius: var(--hello-radius-lg);
  background: linear-gradient(170deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface2) 94%, transparent));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 146px;
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}

.hello-insight-value {
  font-size: 1.7rem;
  line-height: 1;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.03em;
}

.hello-insight-card h3 {
  font-size: 1rem;
  letter-spacing: -.02em;
}

.hello-insight-card p {
  color: var(--text2);
  font-size: 12px;
  line-height: 1.45;
}

.hello-momentum-card {
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border2));
  border-radius: var(--hello-radius-lg);
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 95%, transparent), color-mix(in srgb, var(--accent) 8%, var(--surface2)));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hello-momentum-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hello-momentum-trend {
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border2));
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

.hello-momentum-trend.is-positive {
  color: #16a34a;
  border-color: color-mix(in srgb, #16a34a 38%, var(--border2));
  background: color-mix(in srgb, #16a34a 14%, var(--surface));
}

.hello-momentum-trend.is-negative {
  color: #dc2626;
  border-color: color-mix(in srgb, #dc2626 36%, var(--border2));
  background: color-mix(in srgb, #dc2626 12%, var(--surface));
}

@media (max-width: 1100px) {
  .hello-page-shell {
    grid-template-columns: 1fr;
  }

  .hello-quicknav-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hello-monthly-grid {
    grid-template-columns: 1fr;
  }

  .hello-now-grid,
  .hello-smart-grid,
  .hello-insight-grid,
  .hello-insight-grid--compact {
    grid-template-columns: 1fr;
  }

  .hello-hero,
  .hello-spotlight,
  .hello-feature-card {
    grid-template-columns: 1fr;
  }

  .hello-page-shell > .hello-section-half {
    grid-column: 1 / -1;
  }

  .hello-hero-stats,
  .hello-hero-mini-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .hello-hero-stats,
  .hello-hero-mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .layout {
    gap: 14px;
    padding: 12px 12px 18px;
  }

  .sidebar {
    border-radius: 18px;
  }

  .page-header,
  .browse-toolbar,
  .filter-panel,
  .settings-panel,
  .hello-section,
  .hello-hero {
    border-radius: 20px;
  }

  .hello-hero {
    padding: 18px;
  }

  .hello-hero-tools {
    top: 18px;
    right: 18px;
  }

  .hello-feature-body {
    padding: 12px 14px 14px;
  }

  .hello-feature-thumb {
    min-height: 0;
  }

  .hello-smart-card {
    gap: 10px;
  }

  .hello-smart-art {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 680px) {
  .hello-hero-copy {
    padding-right: 0;
  }

  .hello-hero-stats,
  .hello-hero-mini-grid {
    grid-template-columns: 1fr;
  }

  .hello-hero-tools {
    position: static;
    justify-content: flex-start;
    margin-bottom: 8px;
  }
}

@media (max-width: 640px) {
  .hello-quicknav-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    padding: 16px;
  }

  .page-subtitle {
    font-size: 12px;
  }
}
.card-search-excerpt { color: var(--text2); font-style: italic; }
.card-search-excerpt mark, .si-meta mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; font-style: normal; font-weight: 600; }
.ch-time { color: var(--accent); font-style: normal; font-size: 10px; margin-left: 4px; opacity: .85; }
.search-history-item { padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--text2); display: flex; align-items: center; gap: 8px; transition: background .1s; }
.search-history-item::before { content: '🕐'; font-size: 11px; opacity: .6; }
.search-history-item:hover { background: var(--hover); color: var(--text); }
.search-history-clear { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 13px; padding: 0 4px; line-height: 1; border-radius: 3px; flex-shrink: 0; }
.search-history-clear:hover { color: var(--accent); }

/* ── Editor ────────────────────────── */
.ed-head {
  margin-bottom: 16px;
}

.ed-head-line1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.ed-head-line2 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ed-head h2 {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  letter-spacing: -.01em;
}

#edTitle {
  flex: 0 1 auto;
  white-space: normal;
  overflow: visible;
  padding-right: 10px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.ed-file {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  background: var(--surface);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border2);
}

.ed-stats {
  font-size: 11px;
  color: var(--text3);
  background: var(--surface);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border2);
  display: none;
}

.ed-stats-btn {
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.ed-stats-btn:hover {
  background: var(--blue-dim2);
  border-color: var(--blue);
  color: var(--blue);
}

.watch-head-hidden-meta .ed-stats {
  display: none !important;
}

.btn-add-here-icon {
  min-width: 34px;
  padding: 5px 0;
  justify-content: center;
  border-color: rgba(255,107,44,.38);
  background: rgba(255,107,44,.14);
  color: var(--watch-accent);
  font-size: 15px;
  font-weight: 700;
}

.btn-add-here-icon:hover {
  border-color: var(--watch-accent);
  background: rgba(255,107,44,.22);
  color: #ff9a42;
}

.ed-video-col.is-fullscreen .pbar .btn-add-here-icon {
  color: var(--watch-accent);
  border-color: rgba(255,107,44,.42);
  background: rgba(255,107,44,.18);
}

.ed-video-col.is-fullscreen .pbar .btn-add-here-icon:hover {
  color: #ffb36b;
  border-color: #ff9a42;
  background: rgba(255,107,44,.28);
}

.ed-perf-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,107,44,.18);
  background: color-mix(in srgb, var(--surface2) 86%, transparent);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.ed-layout-label {
  font-size: 11px;
  color: var(--text3);
}

.ed-layout-select {
  min-width: 90px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
}

/* ── Play History Modal ───────────── */
.ph-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ph-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border2);
  background: var(--surface);
}
.ph-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border2);
  color: var(--text);
  vertical-align: middle;
}
.ph-table tr:last-child td { border-bottom: none; }
.ph-table tr:hover td { background: var(--surface); }
.ph-user {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--blue-dim2);
  color: var(--blue);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.ph-dur {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
}
.ph-empty {
  text-align: center;
  padding: 24px;
  color: var(--text3);
  font-size: 13px;
}
.ph-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ph-summary-card {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.ph-summary-card .ph-sc-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.ph-summary-card .ph-sc-lbl {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

/* View video — streaming layout */
#viewEditor {
  --watch-panel-width: 390px;
  --watch-accent: #ff6b2c;
  --watch-accent-soft: rgba(255,107,44,.16);
  --watch-ink-soft: color-mix(in srgb, var(--surface) 82%, transparent);
  padding-bottom: 28px;
}

.watch-head {
  position: sticky;
  top: 10px;
  z-index: 30;
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255,107,44,.16), transparent 34%),
    radial-gradient(circle at right center, rgba(59,130,246,.12), transparent 32%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 86%, transparent), color-mix(in srgb, var(--surface2) 92%, transparent));
  box-shadow: var(--shadow);
}

.watch-head-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.watch-head-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.watch-head-hidden-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.watch-head-line1 {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.watch-title-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  display: none;
}

.watch-head-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.watch-mode-cluster,
.watch-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface2) 92%, transparent));
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.watch-mode-cluster {
  min-width: 0;
  justify-content: flex-start;
  padding-right: 12px;
  border-color: rgba(255,107,44,.18);
  box-shadow: 0 8px 24px rgba(255,107,44,.08);
}

.watch-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
}

.watch-layout-auto-btn {
  min-width: 56px;
  border-radius: 999px;
  border: 1px solid rgba(255,107,44,.18);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  color: var(--text2);
  font-weight: 700;
}

.watch-layout-auto-btn.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--watch-accent), #ff9a42);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255,107,44,.18);
}

.watch-layout-auto-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.watch-layout-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,107,44,.32), rgba(255,107,44,.95));
  outline: none;
}

.watch-layout-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--watch-accent);
  box-shadow: 0 6px 16px rgba(255,107,44,.28);
  cursor: ew-resize;
}

.watch-layout-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--watch-accent);
  box-shadow: 0 6px 16px rgba(255,107,44,.28);
  cursor: ew-resize;
}

.watch-slider-value {
  min-width: 40px;
  margin-right: 4px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--watch-accent);
  text-align: right;
}

.watch-toggle-btn {
  min-width: 92px;
  border-radius: 999px;
  border-width: 1px;
  font-weight: 700;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
}

.watch-toggle-btn:hover {
  transform: translateY(-1px);
}

.watch-toggle-btn[data-toggle-kind="edit"] {
  border-color: rgba(255,107,44,.22);
  color: var(--watch-accent);
  background: rgba(255,107,44,.08);
}

.watch-toggle-btn[data-toggle-kind="edit"].is-active {
  background: linear-gradient(135deg, #ff7a2f, #ff9a42);
}

.watch-toggle-btn[data-toggle-kind="secret"] {
  border-color: rgba(168,85,247,.22);
  color: #8b5cf6;
  background: rgba(139,92,246,.09);
}

.watch-toggle-btn[data-toggle-kind="secret"].is-active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 10px 24px rgba(124,58,237,.25);
}

.watch-toggle-btn[data-toggle-kind="audio"] {
  border-color: rgba(34,197,94,.22);
  color: #16a34a;
  background: rgba(34,197,94,.08);
}

.watch-toggle-btn[data-toggle-kind="audio"].is-active {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  box-shadow: 0 10px 24px rgba(220,38,38,.24);
}

.watch-toggle-btn.is-active {
  background: linear-gradient(135deg, var(--watch-accent), #ff8e3c);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(255,107,44,.22);
}

.watch-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.ed-video-col {
  flex: 1 1 auto;
  min-width: 0;
}

.ed-meta-col {
  flex: 0 1 auto;
  width: auto;
  max-width: none;
  min-width: 0;
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

#viewEditor.player-priority-pending .ed-meta-col {
  opacity: .42;
  transform: translateY(8px);
  filter: saturate(.75);
  pointer-events: none;
}

#viewEditor.player-priority-pending .watch-side-overview,
#viewEditor.player-priority-pending .meta-section {
  visibility: hidden;
}

.watch-stage-card,
.watch-side-card,
.watch-hero-panel,
.watch-section-block,
.meta-section {
  border: 1px solid var(--border2);
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface2) 98%, transparent));
  box-shadow: var(--shadow-sm);
}

.watch-stage-card {
  padding: 16px;
}

#viewEditor.editor-edit-mode .ed-video-col:not(.is-fullscreen) {
  position: sticky !important;
  top: var(--editor-player-fixed-top, 88px) !important;
  z-index: 24;
  align-self: flex-start !important;
}

#viewEditor.editor-edit-mode .ed-video-col:not(.is-fullscreen) .watch-stage-card {
  position: static;
}

#viewEditor.editor-player-fixed-lock.editor-edit-mode .ed-video-col:not(.is-fullscreen) {
  padding-top: var(--editor-player-fixed-card-height, 320px);
}

#viewEditor.editor-player-fixed-lock.editor-edit-mode .ed-video-col:not(.is-fullscreen) .watch-stage-card {
  position: fixed !important;
  top: var(--editor-player-fixed-top, 88px) !important;
  left: var(--editor-player-fixed-left, 0px);
  width: var(--editor-player-fixed-width, 640px);
  max-width: var(--editor-player-fixed-width, 640px);
  z-index: 40;
}

#viewEditor.editor-edit-mode .ed-top-row.ed-top-row-stacked .ed-video-col:not(.is-fullscreen) {
  position: sticky !important;
  top: var(--editor-player-fixed-top, 88px) !important;
}

.watch-main-details {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

#viewEditor.editor-edit-mode .watch-main-details,
#viewEditor.editor-edit-mode .watch-side-overview {
  display: none;
}

#viewEditor.editor-secret-mode .watch-main-details,
#viewEditor.editor-secret-mode .watch-side-overview {
  display: none;
}

#viewEditor.editor-secret-mode .watch-head-hidden-meta h2 {
  letter-spacing: .18em;
}

#viewEditor.editor-consumption-mode .edit-only-control {
  display: none;
}

#viewEditor.editor-edit-mode .edit-only-control {
  display: inline-flex;
}

.watch-hero-panel,
.watch-section-block {
  padding: 18px 20px;
}

.watch-hero-topline,
.watch-section-head,
.watch-side-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.watch-display-title {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.04;
  letter-spacing: -.04em;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-display-tagline,
.watch-side-synopsis,
.watch-overview-text {
  color: var(--text2);
}

.watch-side-synopsis {
  text-align: justify;
  text-justify: inter-word;
}

.watch-side-title-card {
  font-size: clamp(17px, 1.45vw, 22px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -.03em;
}

#watchSidebarGenres {
  display: grid;
  gap: 0;
}

.watch-genre-group {
  display: grid;
  gap: 8px;
  width: 100%;
}

.watch-genre-group + .watch-genre-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border2) 85%, transparent);
}

.watch-genre-group-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
}

.watch-overview-text {
  font-size: 15px;
  line-height: 1.7;
}

.watch-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--watch-accent), #ff8e3c);
}

.watch-quick-pills,
.watch-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.watch-quick-pills:empty,
.watch-pill-row:empty {
  display: none;
}

.watch-pill,
.watch-fact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}

.watch-section-count,
.watch-side-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
}

.watch-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.watch-cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.watch-cast-card,
.watch-cast-mini-item {
  border: 1px solid var(--border2);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

.watch-cast-card {
  overflow: hidden;
}

.watch-cast-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.watch-cast-thumb {
  aspect-ratio: 4 / 5;
  background: var(--surface3);
  overflow: hidden;
}

.watch-cast-thumb img,
.watch-cast-mini-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.watch-cast-body {
  padding: 12px;
}

.watch-cast-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.watch-cast-meta {
  color: var(--text3);
  font-size: 12px;
}

.watch-side-overview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.watch-side-card {
  padding: 18px;
}

.watch-side-card-highlight {
  background:
    radial-gradient(circle at top right, rgba(255,107,44,.16), transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 86%, transparent), color-mix(in srgb, var(--surface2) 96%, transparent));
}

.watch-side-title {
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -.03em;
  margin: 8px 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-side-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.watch-side-tab {
  min-height: 42px;
  border: 1px solid rgba(255,107,44,.16);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  color: var(--text2);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.watch-side-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--watch-accent), #ff9a42);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(255,107,44,.18);
}

.watch-side-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}

.watch-side-pane.active {
  animation: editorPaneIn var(--transition);
  content-visibility: visible;
}

.watch-video-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.watch-video-stats .dash-card {
  margin-bottom: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface2) 98%, transparent));
  overflow: hidden;
}

.watch-video-stats .dash-kpi {
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

.watch-video-stats .dash-kpi-row {
  margin-bottom: 0;
}

.watch-video-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.watch-video-stats-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text2);
}

.watch-video-stats-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.watch-video-stats .dash-modal-summary-grid {
  margin-bottom: 0;
}

.watch-video-stats .dash-grid-2 {
  grid-template-columns: 1fr;
}

.watch-video-stats .dash-bar-row,
.watch-video-stats .dash-bar-row-wide {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.watch-video-stats .dash-bar-label,
.watch-video-stats .dash-bar-val {
  text-align: left;
}

.watch-video-stats .dash-bar-track {
  width: 100%;
}

.watch-video-stats-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.watch-video-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.watch-video-insight-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

.watch-video-insight-card-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.watch-video-insight-card-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.watch-video-insight-card-thumb-fallback {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: color-mix(in srgb, var(--surface2) 86%, transparent);
}

.watch-video-insight-card-pill {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(2px);
}

.watch-video-insight-card.is-hot {
  box-shadow: inset 0 0 0 1px rgba(249,115,22,.12);
}

.watch-video-insight-card.is-rewatch {
  box-shadow: inset 0 0 0 1px rgba(8,145,178,.12);
}

.watch-video-insight-card.is-skip {
  box-shadow: inset 0 0 0 1px rgba(124,58,237,.12);
}

.watch-video-insight-card.is-dropoff {
  box-shadow: inset 0 0 0 1px rgba(239,68,68,.12);
}

.watch-video-insight-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.watch-video-insight-card-title-wrap {
  min-width: 0;
}

.watch-video-insight-card-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
}

.watch-video-insight-card-time {
  font-size: .72rem;
  color: var(--text2);
}

.watch-video-insight-card-chapter {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
}

.watch-video-insight-card-meta {
  font-size: .76rem;
  color: var(--text2);
}

.watch-video-insight-card-btn {
  justify-self: start;
}

.watch-video-stats-story {
  display: grid;
  gap: 10px;
}

.watch-video-stats-story p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface2) 90%, transparent);
  color: var(--text);
  line-height: 1.45;
}

.watch-video-stats .video-history-days {
  grid-template-columns: 1fr;
}

.watch-video-stats .dash-table {
  font-size: .74rem;
}

.video-playback-modal {
  width: min(96vw, 1180px);
  max-width: 1180px;
}

.video-playback-modal .dash-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.video-playback-modal .dash-card,
.video-playback-modal .dash-grid-2,
.video-playback-modal .dash-modal-section,
.video-playback-modal .dash-mini-cal {
  margin-bottom: 0;
}

.video-playback-modal .dash-table {
  font-size: .76rem;
}

.video-playback-modal-table {
  overflow: auto;
  border: 1px solid var(--border2);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
}

.video-playback-modal-table .dash-table {
  min-width: 720px;
}

.watch-side-card-chapters {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.watch-side-section-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.watch-side-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255,107,44,.16);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

.watch-side-view-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.watch-pbar #btnJumpHotspot,
.watch-pbar #btnSkipFrequentZone {
  background: color-mix(in srgb, var(--surface2) 94%, transparent);
}

.watch-pbar #btnJumpHotspot:disabled,
.watch-pbar #btnSkipFrequentZone:disabled {
  opacity: .7;
}

.watch-pbar #btnJumpHotspot:not(:disabled) {
  border-color: rgba(249,115,22,.28);
  color: #c2410c;
}

.watch-pbar #btnSkipFrequentZone:not(:disabled) {
  border-color: rgba(124,58,237,.24);
  color: #6d28d9;
}

.watch-side-view-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--watch-accent), #ff9a42);
  box-shadow: 0 8px 18px rgba(255,107,44,.18);
}

.watch-sidebar-chapters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(68vh, 820px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.watch-sidebar-chapter {
  border: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.watch-sidebar-chapter:hover {
  transform: translateY(-1px);
  border-color: rgba(255,107,44,.28);
  box-shadow: var(--shadow-sm);
}

.watch-sidebar-chapter.active {
  border-color: var(--watch-accent);
  box-shadow: 0 10px 24px rgba(255,107,44,.16);
}

.watch-sidebar-chapter.is-placeholder {
  cursor: default;
  transform: none;
}

.watch-sidebar-chapter.is-placeholder:hover {
  transform: none;
  border-color: var(--border2);
  box-shadow: none;
}

.watch-sidebar-chapters.is-list {
  gap: 8px;
}

.watch-sidebar-chapters.is-list .watch-sidebar-chapter {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 8px;
  border-radius: 16px;
}

.watch-sidebar-chapters.is-list .watch-sidebar-chapter.is-favorite {
  border-color: #d4aa38;
  box-shadow: 0 0 0 1px rgba(212,170,56,.18);
}

.watch-sidebar-chapters.is-list .watch-sidebar-chapter.is-favorite.active {
  border-color: #d4aa38;
  box-shadow: 0 10px 28px rgba(212,170,56,.22);
}

.watch-sidebar-chapters.is-list .watch-sidebar-chapter-thumb {
  position: relative;
  width: 70px;
  min-width: 70px;
  border-radius: 12px;
  overflow: hidden;
}

.watch-sidebar-chapters.is-list .watch-sidebar-chapter-body {
  min-width: 0;
  padding: 0;
  gap: 4px;
}

.watch-sidebar-chapters.is-list .watch-sidebar-chapter-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.watch-sidebar-chapters.is-grid .watch-sidebar-chapter {
  display: block;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
}

.watch-sidebar-chapters.is-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.watch-sidebar-chapters.is-grid .watch-sidebar-chapter-thumb,
.watch-sidebar-chapters.is-grid .watch-sidebar-chapter-body {
  display: none;
}

.watch-sidebar-chapter-thumb {
  position: relative;
  overflow: hidden;
  background: var(--surface3);
  aspect-ratio: 16 / 9;
}

.watch-sidebar-chapter-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.watch-sidebar-chapter-body {
  padding: 10px 12px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.watch-sidebar-chapter-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
}

.watch-sidebar-chapter-index {
  color: var(--watch-accent);
}

.watch-sidebar-chapter.is-favorite .watch-sidebar-chapter-index {
  color: #d4aa38;
}

.watch-sidebar-chapter-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}

.watch-sidebar-chapter-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
}

.watch-sidebar-favorite-quick-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface2) 88%, transparent);
  box-shadow: 0 6px 16px rgba(15,23,42,.08);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px) scale(.96);
  transition: opacity var(--transition), transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition), filter var(--transition);
  filter: grayscale(1);
}

.watch-sidebar-chapter:hover .watch-sidebar-favorite-quick-btn,
.watch-sidebar-chapter:focus-within .watch-sidebar-favorite-quick-btn,
.watch-sidebar-favorite-quick-btn.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.watch-sidebar-favorite-quick-btn:hover {
  border-color: rgba(212,170,56,.34);
  background: rgba(212,170,56,.14);
  filter: none;
}

.watch-sidebar-favorite-quick-btn.is-active {
  border-color: rgba(212,170,56,.34);
  background: rgba(212,170,56,.18);
  box-shadow: 0 8px 18px rgba(212,170,56,.16);
  filter: none;
}

.watch-loading-copy {
  display: block;
  color: var(--text2);
  line-height: 1.6;
}

.watch-loading-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-skeleton-chip,
.watch-skeleton,
.watch-skeleton-inline {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface2) 88%, transparent);
}

.watch-skeleton-chip::after,
.watch-skeleton::after,
.watch-skeleton-inline::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: watchSkeletonPulse 1.3s ease-in-out infinite;
}

.watch-skeleton-chip {
  display: inline-flex;
  width: 84px;
  height: 28px;
  border-radius: 999px;
  margin-right: 8px;
}

.watch-skeleton-line {
  width: 100%;
  height: 14px;
  border-radius: 999px;
}

.watch-skeleton-line.short {
  width: 62%;
}

.watch-skeleton-inline {
  display: inline-flex;
  width: 100%;
  height: 12px;
  border-radius: 999px;
}

.watch-skeleton-inline.short {
  width: 44%;
}

.watch-skeleton-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: inherit;
}

.watch-skeleton-avatar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

@keyframes watchSkeletonPulse {
  100% {
    transform: translateX(100%);
  }
}

.watch-side-tagline {
  margin: 0 0 12px;
  color: var(--watch-accent);
  font-weight: 700;
  line-height: 1.45;
}

.watch-facts-list,
.watch-cast-mini-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-fact {
  justify-content: space-between;
  border-radius: 14px;
  padding: 10px 12px;
}

.watch-fact-label {
  color: var(--text3);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.watch-fact-value {
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.watch-cast-mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.watch-cast-mini-thumb {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  overflow: hidden;
  flex: 0 0 48px;
  background: var(--surface3);
}

.watch-cast-mini-name {
  font-weight: 700;
}

.watch-cast-mini-meta {
  font-size: 12px;
  color: var(--text3);
}

.watch-cast-mini-age {
  font-size: 11px;
  color: var(--watch-accent);
  font-weight: 600;
}

/* ── Chapter strip card (independent, below player) ── */
.chapter-strip-card {
  margin-top: 14px;
  border: 1px solid var(--border2);
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface2) 98%, transparent));
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.chapter-strip-card.is-loading {
  display: block;
}

.chapter-strip-card:has(.chapter-thumbs-strip:empty) {
  display: none;
}

/* Keep chapter strip visible in edit mode */
#viewEditor.editor-edit-mode .chapter-strip-card {
  display: block;
}

/* Hide chapter strip in secret mode */
#viewEditor.editor-secret-mode .chapter-strip-card {
  display: none;
}

.chapter-thumbs-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.chapter-thumbs-strip:empty {
  display: none;
}

.chapter-thumb {
  position: relative;
  cursor: pointer;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border2);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  max-width: 320px;
}

.chapter-thumb:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.chapter-thumb.active {
  border-color: var(--watch-accent);
  box-shadow: 0 10px 28px rgba(255,107,44,.18);
}

.chapter-thumb.is-favorite {
  border-color: #d4aa38;
  box-shadow: 0 0 0 1px rgba(212,170,56,.22);
}

.chapter-thumb.is-favorite.active {
  border-color: #d4aa38;
  box-shadow: 0 10px 28px rgba(212,170,56,.26);
}

.chapter-thumb.is-placeholder {
  cursor: default;
}

.chapter-thumb.is-placeholder:hover {
  transform: none;
  box-shadow: none;
}

.chapter-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.chapter-thumb .ct-label {
  font-size: 11px;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 10px 12px 3px;
  color: var(--accent);
  line-height: 1.3;
}

.chapter-thumb.is-favorite .ct-label {
  color: #d4aa38;
}

.chapter-thumb .ct-time {
  font-size: 12px;
  color: var(--text3);
  padding: 0 12px 10px;
}

.chapter-local-fallback-badge {
  top: 10px;
  right: 10px;
  left: auto;
  bottom: auto;
  z-index: 4;
  background: rgba(220,38,38,.88);
  border-color: rgba(255,235,238,.45);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(220,38,38,.24);
  pointer-events: none;
}

.watch-sidebar-chapter-thumb .chapter-local-fallback-badge,
.pbar-ch-thumb .chapter-local-fallback-badge {
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.chapter-insight-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chapter-thumb > .chapter-insight-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  box-shadow: 0 8px 18px rgba(15,23,42,.18);
}

.watch-sidebar-chapter-meta > .chapter-insight-badge {
  flex: 0 0 auto;
}

.chapter-insight-badge.is-hot {
  background: rgba(249,115,22,.16);
  border-color: rgba(249,115,22,.34);
  color: #c2410c;
}

.chapter-insight-badge.is-rewatch {
  background: rgba(217,70,239,.14);
  border-color: rgba(217,70,239,.28);
  color: #a21caf;
}

.chapter-insight-badge.is-skip {
  background: rgba(124,58,237,.14);
  border-color: rgba(124,58,237,.28);
  color: #6d28d9;
}

.chapter-insight-badge.is-dropoff {
  background: rgba(239,68,68,.14);
  border-color: rgba(239,68,68,.28);
  color: #b91c1c;
}

.chapter-thumb.has-insight.is-hot,
.watch-sidebar-chapter.has-insight.is-hot {
  border-color: rgba(249,115,22,.42);
  box-shadow: 0 0 0 1px rgba(249,115,22,.16);
}

.chapter-thumb.has-insight.is-rewatch,
.watch-sidebar-chapter.has-insight.is-rewatch {
  border-color: rgba(217,70,239,.34);
  box-shadow: 0 0 0 1px rgba(217,70,239,.12);
}

.chapter-thumb.has-insight.is-skip,
.watch-sidebar-chapter.has-insight.is-skip {
  border-color: rgba(124,58,237,.34);
  box-shadow: 0 0 0 1px rgba(124,58,237,.12);
}

.chapter-thumb.has-insight.is-dropoff,
.watch-sidebar-chapter.has-insight.is-dropoff {
  border-color: rgba(239,68,68,.34);
  box-shadow: 0 0 0 1px rgba(239,68,68,.12);
}

.ct-favorite-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15,23,42,.54);
  box-shadow: 0 6px 16px rgba(15,23,42,.22);
  font-size: 16px;
  line-height: 1;
  z-index: 2;
}

.ct-favorite-badge.chapter-local-fallback-badge {
  background: rgba(220,38,38,.9);
  border-color: rgba(255,235,238,.45);
  color: #fff;
  box-shadow: 0 8px 18px rgba(220,38,38,.24);
}

.ct-favorite-quick-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(15,23,42,.62);
  box-shadow: 0 10px 24px rgba(15,23,42,.26);
  font-size: 16px;
  line-height: 1;
  z-index: 3;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px) scale(.96);
  transition: opacity var(--transition), transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition), filter var(--transition);
  filter: grayscale(1);
}

.chapter-thumb:hover .ct-favorite-quick-btn,
.chapter-thumb:focus-within .ct-favorite-quick-btn,
.ct-favorite-quick-btn.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ct-favorite-quick-btn:hover {
  background: rgba(15,23,42,.78);
  border-color: rgba(255,255,255,.34);
  filter: none;
}

.ct-favorite-quick-btn.is-active {
  background: rgba(212,170,56,.92);
  border-color: rgba(255,242,204,.52);
  box-shadow: 0 10px 24px rgba(212,170,56,.28);
  filter: none;
}

/* Avoid overlap when local fallback badge (🔗) is also visible on the thumb */
.chapter-thumb:has(.chapter-local-fallback-badge) .ct-favorite-quick-btn {
  right: 48px;
}

.ed-top-row.ed-top-row-stacked {
  flex-direction: column;
}

.ed-top-row.ed-top-row-stacked .ed-video-col,
.ed-top-row.ed-top-row-stacked .ed-meta-col {
  flex: 1 1 100%;
  max-width: 100%;
  width: 100%;
}

#viewEditor .meta-section {
  display: none;
  margin-top: 0;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  padding: 14px;
}

#viewEditor.editor-edit-mode .meta-section {
  display: block;
  max-height: none;
  overflow-y: visible;
}

.meta-mode-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
  padding: 8px 6px 4px;
}

.meta-mode-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--watch-accent);
  margin-bottom: 6px;
}

.meta-mode-title {
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -.03em;
}

.meta-mode-copy {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.55;
}

.meta-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface) 82%, transparent));
  padding-bottom: 10px;
}

.meta-tab-btn {
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  background: color-mix(in srgb, var(--surface2) 90%, transparent);
  cursor: pointer;
  transition: all .15s;
}

.meta-tab-btn:hover {
  border-color: var(--watch-accent);
  color: var(--text);
}

.meta-tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--watch-accent), #ff8e3c);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(255,107,44,.18);
}

.meta-tab-pane {
  display: none;
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

.meta-tab-pane.active {
  display: block;
  content-visibility: visible;
}

#viewEditor.editor-edit-mode .meta-tab-pane.active {
  animation: editorPaneIn var(--transition);
}

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

.local-jobs-panel {
  border: 1px solid var(--border2);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  padding: 10px;
  margin-bottom: 12px;
}

.local-jobs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.local-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.local-job-row {
  font-size: 12px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.local-job-row.running { border-color: var(--watch-accent); }
.local-job-row.done { border-color: var(--green); }
.local-job-row.error { border-color: var(--red); }
.local-job-row.queued { border-color: var(--yellow); }

.local-job-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.local-job-title b {
  color: var(--text);
}

.local-job-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.local-job-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  color: var(--text2);
}

.local-job-badge--running {
  color: var(--watch-accent);
  border-color: color-mix(in srgb, var(--watch-accent) 55%, var(--border2));
  background: color-mix(in srgb, var(--watch-accent) 10%, var(--surface));
}

.local-job-badge--done {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 55%, var(--border2));
  background: color-mix(in srgb, var(--green) 10%, var(--surface));
}

.local-job-badge--error {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 55%, var(--border2));
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
}

.local-job-progress {
  margin-top: 8px;
}

.local-job-progress .task-progress-track {
  margin-bottom: 6px;
}

.local-job-progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
}

.local-job-progress-step {
  color: var(--text2);
}

.local-job-progress-eta {
  margin-left: auto;
}

.local-job-details {
  color: var(--text3);
  margin-top: 4px;
  line-height: 1.45;
}

.local-job-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
  flex-wrap: wrap;
}

.local-job-meta-row span:last-child {
  margin-left: auto;
}

.local-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ai-content-card {
  position: relative;
  overflow: hidden;
}

/* =====================================================
   IA CONTENU — nouvelle charte graphique
   Inspirée du volet droit : orange #ff6b2c, cards
   border-radius 24px, surface gradient subtil.
   ===================================================== */

.iac-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Barre de sources */
.iac-source-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface2) 98%, transparent));
  box-shadow: var(--shadow-sm);
}

.iac-source-bar-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  flex-shrink: 0;
}


/* Cards principales */
.iac-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border2);
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface2) 98%, transparent));
  box-shadow: var(--shadow-sm);
}

/* Accent couleur sur le bord gauche de chaque card */
.iac-card--synopsis  { border-left: 3px solid rgba(255,107,44,.55); }
.iac-card--taxonomy  { border-left: 3px solid rgba(16,185,129,.45); }
.iac-card--studios   { border-left: 3px solid rgba(245,158,11,.55); }
.iac-card--titles    { border-left: 3px solid rgba(99,102,241,.45); }

.iac-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.iac-card-title-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

/* Badge catégorie (pill orange-gris) */
.iac-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--watch-accent);
  background: color-mix(in srgb, var(--watch-accent) 10%, var(--surface2));
  border: 1px solid color-mix(in srgb, var(--watch-accent) 22%, var(--border2));
  width: fit-content;
}

.iac-card-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0;
}

/* Boutons dans les cards */
.iac-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.iac-card-actions .btn,
.iac-card-footer .btn {
  min-height: 36px;
  border-radius: 999px;
  padding-inline: 16px;
  font-size: 13px;
}

.iac-card-actions .btn:not(.btn-primary):not(.btn-success),
.iac-card-footer .btn:not(.btn-primary):not(.btn-success) {
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  border-color: var(--border2);
  color: var(--text2);
}

.iac-card-actions .btn:not(.btn-primary):not(.btn-success):hover,
.iac-card-footer .btn:not(.btn-primary):not(.btn-success):hover {
  border-color: rgba(255,107,44,.28);
  color: var(--text);
}

.iac-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

/* Textarea synopsis */
.iac-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface2) 88%, transparent);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition);
  box-sizing: border-box;
}

.iac-textarea:focus {
  outline: none;
  border-color: rgba(255,107,44,.4);
  box-shadow: 0 0 0 3px rgba(255,107,44,.08);
}

/* Label fusion / consensus */
.iac-fusion-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

.iac-fusion-label::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--watch-accent), #ff9a42);
}

/* Sous-sections (genres / tags) */
.iac-subsection {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface2) 70%, transparent);
}

.iac-subsection + .iac-subsection {
  margin-top: 2px;
}

.iac-subsection--alt {
  background: color-mix(in srgb, var(--surface2) 55%, transparent);
}

.iac-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.iac-subsection-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}

/* Filtres genres */
.iac-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.iac-filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 100px;
}

.iac-filter-field span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
}

.iac-filter-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.45;
  align-self: center;
}

/* Grille 2 colonnes (studios + titre) */
.iac-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

/* Family header genres hiérarchiques */
.local-ai-genre-family-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--watch-accent);
  opacity: .75;
  margin-top: 10px;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(255,107,44,.15);
}
.local-ai-genre-family-header:first-of-type { margin-top: 4px; }

/* Status vides cachés */
.iac-card .subtitle-status:empty { display: none; }

/* Résultats conteneurs */
#localAiGenreResults,
#localAiTagResults,
#localAiStudioResults,
#localAiTitleResults,
#synopsisFusionResults,
#genresFusionResults {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Panels par modèle — harmonisés avec l'orange */
.local-ai-suggestion-panel {
  box-shadow: 0 8px 24px rgba(15,23,42,.05);
}

.local-ai-suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Pills de suggestion */
.local-ai-suggestion-pill {
  gap: 8px;
  min-height: 34px;
  padding: 5px 8px 5px 12px;
  background: color-mix(in srgb, var(--surface2) 90%, #fff 10%);
  border-color: var(--border2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(15,23,42,.05);
}

button.local-ai-suggestion-pill { cursor: pointer; }

button.local-ai-suggestion-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
  border-color: rgba(255,107,44,.28);
}

/* Pill existant (vert doux) */
.local-ai-suggestion-pill.chip-existing {
  background: color-mix(in srgb, #10b981 10%, var(--surface));
  border-color: color-mix(in srgb, #10b981 24%, var(--border2));
  color: #047857;
  box-shadow: none;
}

/* Pill sélectionné — orange unifié pour tous les contextes */
.local-ai-genre-pill.chip-selected,
.local-ai-consensus-pill.chip-selected,
#localAiTagResults .local-ai-suggestion-pill.chip-selected,
#localAiStudioResults .local-ai-suggestion-pill.chip-selected {
  border-color: rgba(255,107,44,.5);
  background: color-mix(in srgb, var(--watch-accent) 12%, var(--surface));
  color: var(--watch-accent);
}

/* Panels modèles colorés par contexte */
#localAiGenreResults .genre-model-panel {
  border-color: color-mix(in srgb, #10b981 24%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, #10b981 6%, var(--surface)) 0%, color-mix(in srgb, var(--surface) 96%, transparent) 100%);
}

#genresFusionResults .genre-model-panel {
  border-color: color-mix(in srgb, #10b981 30%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, #10b981 8%, var(--surface)) 0%, color-mix(in srgb, var(--surface) 96%, transparent) 100%);
}

#localAiTagResults .genre-model-panel {
  border-color: color-mix(in srgb, var(--watch-accent) 20%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--watch-accent) 5%, var(--surface)) 0%, color-mix(in srgb, var(--surface) 96%, transparent) 100%);
}

#localAiStudioResults .genre-model-panel {
  border-color: color-mix(in srgb, #f59e0b 22%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, #f59e0b 6%, var(--surface)) 0%, color-mix(in srgb, var(--surface) 96%, transparent) 100%);
}

#localAiTitleResults .genre-model-panel {
  border-color: color-mix(in srgb, #6366f1 22%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, #6366f1 6%, var(--surface)) 0%, color-mix(in srgb, var(--surface) 96%, transparent) 100%);
}

.local-ai-consensus-tag {
  --tag-bg: rgba(16,185,129,.1);
  --tag-border: rgba(16,185,129,.2);
  --tag-text: #047857;
}

.local-ai-consensus-panel .meta-inline-section-title {
  color: #047857;
}

/* Compat alias — classes legacy conservées mais redirigées */
.local-ai-feature-card { display: contents; }
.ai-content-card::before { display: none; }

/* Override des pills de source dans la barre IAC pour utiliser l'orange */
.iac-source-bar .analysis-source-native-select {
  display: none;
}

.iac-source-bar .analysis-source-pillbox {
  min-width: 0;
  gap: 8px;
}

.iac-source-bar .analysis-source-pill {
  height: 34px;
  padding: 0 14px 0 10px;
}

.iac-source-bar .analysis-source-pill.is-active {
  background: color-mix(in srgb, var(--watch-accent) 10%, var(--surface));
  border-color: rgba(255,107,44,.32);
  color: var(--text);
  box-shadow: 0 4px 14px rgba(255,107,44,.1);
}

.iac-source-bar .analysis-source-pill.is-active .analysis-source-pill-dot {
  background: var(--watch-accent);
  box-shadow: 0 0 0 3px rgba(255,107,44,.18);
}

.iac-source-bar .analysis-source-pill:hover:not(.is-disabled) {
  border-color: rgba(255,107,44,.24);
  color: var(--text);
}

.local-ai-title-panel + #btnLocalAiPickTopTitle {
  margin-right: 4px;
}

.local-ai-suggestion-pill-label {
  line-height: 1.3;
  white-space: normal;
}

.local-ai-suggestion-pill-score,
.local-ai-suggestion-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .01em;
  background: rgba(255,255,255,.72);
  color: inherit;
}

.local-ai-suggestion-pill-score {
  margin-left: auto;
  border: 1px solid rgba(15,23,42,.08);
}

.local-ai-suggestion-pill-score-label {
  opacity: .6;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .08em;
}

.local-ai-suggestion-pill-score-value {
  font-family: var(--mono);
}

.local-ai-suggestion-state {
  background: rgba(4,120,87,.12);
  color: #047857;
}

.local-ai-detection-empty {
  color: var(--text3);
  font-size: 13px;
  line-height: 1.5;
  padding: 2px 2px 4px;
}

.local-ai-title-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.local-ai-title-current {
  background: linear-gradient(180deg, color-mix(in srgb, #dc2626 6%, var(--surface2)), color-mix(in srgb, var(--surface2) 96%, transparent));
}

.local-ai-title-current-value {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.local-ai-title-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.local-ai-title-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  text-align: left;
  min-height: 144px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, #dc2626 16%, var(--border2));
  background: linear-gradient(180deg, rgba(255,255,255,.95), color-mix(in srgb, #dc2626 5%, var(--surface)));
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(15,23,42,.07);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.local-ai-title-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 42px rgba(15,23,42,.12);
}

.local-ai-title-card.is-selected {
  border-color: #dc2626;
  box-shadow: 0 20px 46px rgba(220,38,38,.16);
  background: linear-gradient(180deg, color-mix(in srgb, #dc2626 10%, #fff), color-mix(in srgb, #dc2626 4%, var(--surface)));
}

.local-ai-title-card.is-current {
  border-color: color-mix(in srgb, #f59e0b 48%, var(--border2));
}

.local-ai-title-card-top,
.local-ai-title-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.local-ai-title-rank,
.local-ai-title-state,
.local-ai-title-origin,
.local-ai-title-picked {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.local-ai-title-rank {
  background: rgba(220,38,38,.1);
  color: #b91c1c;
}

.local-ai-title-state {
  background: rgba(15,23,42,.06);
  color: var(--text2);
}

.local-ai-title-card.is-current .local-ai-title-state {
  background: rgba(245,158,11,.14);
  color: #b45309;
}

.local-ai-title-card-text {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: -.01em;
}

.local-ai-title-origin {
  background: rgba(15,23,42,.05);
  color: var(--text2);
}

.local-ai-title-picked {
  background: rgba(220,38,38,.1);
  color: #b91c1c;
}

.local-ai-title-card.is-selected .local-ai-title-picked {
  background: #dc2626;
  color: #fff;
}

.local-ai-feature-card .synopsis-model-tabs {
  gap: 8px;
  margin-bottom: 2px;
}

.local-ai-feature-card .synopsis-model-tab {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border-bottom: 1px solid var(--tab-border, #4a9eff);
  background: color-mix(in srgb, var(--surface2) 88%, transparent);
  font-family: var(--sans);
  font-weight: 700;
}

.local-ai-feature-card .synopsis-model-tab.active {
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}

.local-ai-feature-card .local-ai-synopsis-textarea {
  min-height: 160px;
  border-radius: 18px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--surface) 92%, #fff 8%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  overflow: hidden;
}

.local-ai-title-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.local-ai-title-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--title-tab-border, var(--border2));
  background: color-mix(in srgb, var(--surface2) 90%, transparent);
  color: var(--title-tab-color, var(--text2));
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}

.local-ai-title-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}

.local-ai-title-tab.active {
  background: var(--title-tab-bg, color-mix(in srgb, var(--surface2) 94%, transparent));
  box-shadow: 0 12px 26px rgba(15,23,42,.1);
}

.local-ai-title-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: inherit;
  font-size: 11px;
  font-family: var(--mono);
}

@media (max-width: 640px) {
  .local-ai-title-grid {
    grid-template-columns: 1fr;
  }

  .local-ai-suggestion-pill {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 980px) {
  .local-ai-detection-hero,
  .local-ai-content-grid {
    grid-template-columns: 1fr;
  }

  .local-ai-feature-card--wide {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .local-ai-detection-hero {
    padding: 18px;
    border-radius: 22px;
  }

  .local-ai-feature-card {
    padding: 16px;
  }

  .local-ai-card-head,
  .local-ai-card-actions,
  .local-ai-card-footer {
    align-items: stretch;
  }

  .local-ai-card-actions {
    width: 100%;
  }

  .local-ai-card-actions .btn,
  .local-ai-card-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .local-ai-detection-hero-actions {
    padding: 14px;
  }

  .local-ai-genre-filter-bar {
    align-items: stretch;
  }

  .local-ai-genre-filter-field,
  .local-ai-genre-filter-field .subtitle-select {
    width: 100%;
  }

  .local-ai-genre-filter-hint {
    margin-left: 0;
    width: 100%;
  }
}

.meta-inline-section {
  border: 1px solid var(--border2);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.meta-inline-section-title {
  font-size: 12px;
  color: var(--text3);
  font-weight: 600;
  margin-bottom: 6px;
}

.ed-meta-col .meta-grid {
  grid-template-columns: 1fr;
}

#viewEditor.editor-edit-mode .meta-section-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
}

#viewEditor.editor-edit-mode .meta-field label,
#viewEditor.editor-edit-mode .subtitle-actions-row > label {
  color: var(--text3);
  font-weight: 700;
}

.meta-context-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.meta-context-pill {
  display: none;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,107,44,.18);
  background: rgba(255,107,44,.08);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
}

.meta-context-pill.is-visible {
  display: inline-flex;
}

.meta-context-pill-action {
  cursor: pointer;
}

.meta-context-pill-action:hover {
  color: var(--watch-accent);
  border-color: rgba(255,107,44,.3);
}

.meta-context-pill-prewarm.is-running {
  display: inline-flex;
  border-color: rgba(44, 170, 120, .32);
  background: rgba(44, 170, 120, .12);
  color: color-mix(in srgb, var(--text) 85%, #2caa78);
}

.meta-context-pill-prewarm.is-done {
  display: inline-flex;
  border-color: rgba(75, 126, 255, .26);
  background: rgba(75, 126, 255, .12);
  color: color-mix(in srgb, var(--text) 88%, #4b7eff);
}

.meta-context-pill-prewarm.is-error {
  display: inline-flex;
  border-color: rgba(255, 94, 94, .3);
  background: rgba(255, 94, 94, .1);
  color: color-mix(in srgb, var(--text) 86%, #ff5e5e);
}

/* ── Meta page ── */
.mta-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Barre d'actions Méta — même base que .ch-action-bar */
.mta-action-bar {
  align-items: flex-end;
}

/* Bouton avec icône + label court */
.mta-action-btn {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 58px;
  min-height: 52px !important;
  height: 52px !important;
  padding: 6px 10px !important;
  border-radius: 14px !important;
  border-color: rgba(255,107,44,.16) !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, white 6%), color-mix(in srgb, var(--watch-accent) 7%, var(--surface))) !important;
  color: color-mix(in srgb, var(--watch-accent) 65%, var(--text) 35%) !important;
  transition: all var(--transition);
}

.mta-action-btn:hover {
  border-color: rgba(255,107,44,.32) !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--watch-accent) 12%, var(--surface)), color-mix(in srgb, var(--watch-accent) 18%, var(--surface2))) !important;
  color: var(--text) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255,107,44,.12);
}

.mta-btn-icon {
  font-size: 17px;
  line-height: 1;
}

.mta-btn-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
  color: inherit;
}

/* Variantes de couleur */
.mta-btn--compress {
  border-color: rgba(99,102,241,.2) !important;
  background: color-mix(in srgb, #6366f1 7%, var(--surface)) !important;
  color: color-mix(in srgb, #6366f1 75%, var(--text) 25%) !important;
}

.mta-btn--open {
  border-color: rgba(16,185,129,.2) !important;
  background: color-mix(in srgb, #10b981 7%, var(--surface)) !important;
  color: color-mix(in srgb, #10b981 75%, var(--text) 25%) !important;
}

.mta-btn--keep {
  border-color: rgba(16,185,129,.2) !important;
  background: color-mix(in srgb, #10b981 8%, var(--surface)) !important;
  color: color-mix(in srgb, #10b981 75%, var(--text) 25%) !important;
}

.mta-btn--keep.is-active,
#btnPcloudReviewKeep.is-active {
  border-color: rgba(16,185,129,.4) !important;
  background: color-mix(in srgb, #10b981 16%, var(--surface)) !important;
  color: #10b981 !important;
  box-shadow: 0 4px 14px rgba(16,185,129,.14);
}

.mta-btn--remove {
  border-color: rgba(239,68,68,.18) !important;
  background: color-mix(in srgb, var(--red) 7%, var(--surface)) !important;
  color: color-mix(in srgb, var(--red) 72%, var(--text) 28%) !important;
}

.mta-btn--remove.is-active,
#btnPcloudReviewRemove.is-active {
  border-color: rgba(239,68,68,.38) !important;
  background: color-mix(in srgb, var(--red) 14%, var(--surface)) !important;
  color: var(--red) !important;
  box-shadow: 0 4px 14px rgba(239,68,68,.14);
}

/* Favori actif — cœur rouge vif */
#btnFavorite.mta-btn--fav-active {
  border-color: rgba(239,68,68,.38) !important;
  background: color-mix(in srgb, #ef4444 12%, var(--surface)) !important;
  color: #ef4444 !important;
  box-shadow: 0 4px 16px rgba(239,68,68,.18);
}

#btnFavorite.mta-btn--fav-active .mta-btn-icon {
  animation: fav-pop .25s ease;
}

@keyframes fav-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Groupe pCloud aligné à droite */
.mta-pcloud-group {
  margin-left: auto;
}

/* Ligne de contexte (pills + badge type) */
.mta-context-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 18px;
}

.mta-review-status {
  font-size: 12px;
  color: var(--text3);
  margin-left: auto;
}

.mta-type-badge {
  margin-left: auto;
}

/* Card métadonnées */
.mta-card--meta {
  border-left: 3px solid rgba(255,107,44,.55);
}

/* Save bar dans la card */
.mta-save-bar {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border2);
}

/* Compat — ancien .btn-icon-action conservé pour éventuelles utilisations externes */
.btn-icon-action {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  color: var(--text2);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all var(--transition);
}

.btn-icon-action:hover {
  border-color: var(--watch-accent);
  color: var(--watch-accent);
  background: rgba(255,107,44,.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255,107,44,.12);
}

.meta-pcloud-review {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  padding:10px 12px;
  margin-bottom:12px;
  border:1px solid var(--border2);
  border-radius:14px;
  background:color-mix(in srgb, var(--surface2) 92%, transparent);
}

.meta-pcloud-review-label {
  font-size:12px;
  font-weight:700;
  color:var(--text2);
}

.meta-pcloud-review-actions {
  display:flex;
  align-items:center;
  gap:8px;
}

.meta-pcloud-review-actions .btn {
  min-width:44px;
  border-radius:10px;
}

.meta-pcloud-review-actions .btn.is-active {
  border-color:var(--watch-accent);
  color:var(--watch-accent);
  background:rgba(255,107,44,.14);
  box-shadow:0 6px 16px rgba(255,107,44,.12);
}

.meta-pcloud-review-status {
  font-size:12px;
  color:var(--text3);
}

#viewEditor.editor-edit-mode .meta-field input,
#viewEditor.editor-edit-mode .meta-field select,
#viewEditor.editor-edit-mode .meta-field textarea,
#viewEditor.editor-edit-mode .subtitle-select {
  border-radius: 14px;
}

#viewEditor.editor-edit-mode .save-bar,
#viewEditor.editor-edit-mode .meta-save-bar {
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface2) 94%, transparent), color-mix(in srgb, var(--surface) 96%, transparent));
}

#viewEditor.editor-edit-mode .subtitle-actions-row,
#viewEditor.editor-edit-mode .toolbar {
  padding: 12px 14px;
  border: 1px solid var(--border2);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

/* =====================================================
   CHAPITRES — barre d'actions redessinée
   ===================================================== */

#viewEditor.editor-edit-mode .ch-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Barre d'actions principale */
#viewEditor.editor-edit-mode .ch-action-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--watch-accent) 18%, var(--border2));
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(255,107,44,.12), transparent 38%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface2) 96%, transparent), color-mix(in srgb, var(--surface) 98%, transparent));
  box-shadow: 0 12px 32px rgba(15,23,42,.07);
}

/* Séparateur vertical entre groupes */
.ch-btn-separator {
  width: 1px;
  align-self: stretch;
  min-height: 36px;
  background: color-mix(in srgb, var(--border2) 70%, transparent);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Groupe de boutons */
#viewEditor.editor-edit-mode .ch-btn-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#viewEditor.editor-edit-mode .ch-btn-group--end {
  margin-left: auto;
}

#viewEditor.editor-edit-mode .ch-btn-group-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  padding-left: 2px;
}

#viewEditor.editor-edit-mode .ch-btn-group-row {
  display: flex;
  align-items: stretch;
  gap: 5px;
}

/* Boutons dans la barre */
#viewEditor.editor-edit-mode .chapters-tab-action-btn,
#viewEditor.editor-edit-mode .chapters-tab-action-bar .imp-label {
  min-height: 36px;
  height: 36px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 12px;
  padding: 0 13px;
  justify-content: center;
  border-color: rgba(255,107,44,.16);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, white 6%), color-mix(in srgb, var(--watch-accent) 7%, var(--surface)));
  color: color-mix(in srgb, var(--watch-accent) 65%, var(--text) 35%);
  transition: all var(--transition);
}

#viewEditor.editor-edit-mode .chapters-tab-action-btn:hover,
#viewEditor.editor-edit-mode .chapters-tab-action-bar .imp-label:hover {
  border-color: rgba(255,107,44,.32);
  background: linear-gradient(180deg, color-mix(in srgb, var(--watch-accent) 12%, var(--surface)), color-mix(in srgb, var(--watch-accent) 16%, var(--surface2)));
  color: var(--text);
  transform: translateY(-1px);
}

/* Bouton Emby (action principale orange plein) */
#viewEditor.editor-edit-mode .ch-btn--primary {
  background: linear-gradient(135deg, var(--watch-accent), #ff9a42) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(255,107,44,.22);
}

#viewEditor.editor-edit-mode .ch-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(255,107,44,.3) !important;
}

/* Bouton Local (secondaire teinté) */
#viewEditor.editor-edit-mode .ch-btn--secondary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--watch-accent) 16%, var(--surface)), color-mix(in srgb, #ffb26b 14%, var(--surface2))) !important;
  border-color: rgba(255,150,73,.3) !important;
  color: color-mix(in srgb, var(--watch-accent) 80%, var(--text) 20%) !important;
}

/* Bouton Ajouter (léger vert-orange) */
#viewEditor.editor-edit-mode .ch-btn--add {
  background: linear-gradient(135deg, color-mix(in srgb, var(--watch-accent) 14%, var(--surface)), color-mix(in srgb, #ffb26b 12%, var(--surface2))) !important;
  border-color: rgba(255,150,73,.28) !important;
  color: color-mix(in srgb, var(--watch-accent) 75%, var(--text) 25%) !important;
}

/* Bouton Importer */
#viewEditor.editor-edit-mode .ch-btn--import {
  background: linear-gradient(135deg, color-mix(in srgb, var(--watch-accent) 12%, var(--surface)), color-mix(in srgb, #ffb26b 10%, var(--surface2))) !important;
  border-color: rgba(255,150,73,.22) !important;
  color: color-mix(in srgb, var(--watch-accent) 70%, var(--text) 30%) !important;
}

/* Bouton Effacer (rouge) */
#viewEditor.editor-edit-mode .ch-btn--clear {
  border-color: rgba(239,68,68,.22) !important;
  background: color-mix(in srgb, var(--red) 8%, var(--surface)) !important;
  color: color-mix(in srgb, var(--red) 72%, var(--text) 28%) !important;
}

#viewEditor.editor-edit-mode .ch-btn--clear:hover {
  background: color-mix(in srgb, var(--red) 14%, var(--surface)) !important;
  border-color: rgba(239,68,68,.38) !important;
}

/* Bouton Remux */
#viewEditor.editor-edit-mode .ch-btn--remux {
  border-color: rgba(99,102,241,.22) !important;
  background: color-mix(in srgb, #6366f1 8%, var(--surface)) !important;
  color: color-mix(in srgb, #6366f1 80%, var(--text) 20%) !important;
}

/* Select miniature dans la barre */
#viewEditor.editor-edit-mode .ch-thumb-select {
  min-width: 110px;
  height: 36px;
  border-radius: 12px;
  border-color: rgba(255,150,73,.2);
  background: color-mix(in srgb, var(--surface) 96%, white 4%);
  font-size: 12px;
  padding: 0 10px;
}

/* Ligne de statut sous la barre */
#viewEditor.editor-edit-mode .ch-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 18px;
}

#viewEditor.editor-edit-mode .ch-hint {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.45;
}

#viewEditor.editor-edit-mode .ch-hint:empty { display: none; }

#viewEditor.editor-edit-mode .ch-save-st {
  font-size: 12px;
  color: var(--text3);
}

#viewEditor.editor-edit-mode .ch-save-st--main {
  margin-left: auto;
  font-weight: 600;
}

/* Card IA Propositions */
#viewEditor.editor-edit-mode .ch-card--ia {
  border-left: 3px solid rgba(255,107,44,.55);
}

#viewEditor.editor-edit-mode .ch-ia-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#viewEditor.editor-edit-mode .ch-visibility-filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}



#viewEditor.editor-edit-mode .chapters-tab-secondary-btn {
  min-height: 36px;
  border-radius: 999px;
  padding-inline: 16px;
}

#viewEditor.editor-edit-mode .chapters-tab-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255,107,44,.10);
  border: 1px solid rgba(255,107,44,.18);
  color: #ffb181;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
}

#viewEditor.editor-edit-mode .chapters-tab-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

#viewEditor.editor-edit-mode .chapters-tab-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--border2) 92%, transparent);
  border-radius: 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface2) 90%, transparent), color-mix(in srgb, var(--surface) 98%, transparent));
  box-shadow: 0 14px 34px rgba(15,23,42,.06);
}

#viewEditor.editor-edit-mode #chList.ch-list,
#viewEditor.editor-edit-mode .local-ai-chapter-results {
  flex: 0 0 auto;
}

#viewEditor.editor-edit-mode .chapters-tab-column-generated {
  border-color: rgba(255,107,44,.16);
  background:
    radial-gradient(circle at top right, rgba(255,107,44,.10), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface2) 92%, transparent), color-mix(in srgb, var(--surface) 98%, transparent));
}

#viewEditor.editor-edit-mode .chapters-tab-column-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#viewEditor.editor-edit-mode .chapters-tab-column-tools {
  display: grid;
  justify-items: end;
  gap: 10px;
}

#viewEditor.editor-edit-mode .chapters-tab-column-head > div {
  display: grid;
  gap: 6px;
}

#viewEditor.editor-edit-mode .chapters-tab-column-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -.02em;
}

#viewEditor.editor-edit-mode .chapters-tab-column-head p {
  margin: 0;
  font-size: 12px;
  color: var(--text3);
  text-align: right;
}

#viewEditor.editor-edit-mode #chList.empty,
#viewEditor.editor-edit-mode #saveLog,
#viewEditor.editor-edit-mode .genre-detect-panel,
#viewEditor.editor-edit-mode .subtitle-runtime-log,
#viewEditor.editor-edit-mode .subtitle-list,
#viewEditor.editor-edit-mode .local-ai-chapter-results {
  border-radius: 18px;
}

/* =====================================================
   ANALYSE — charte graphique cohérente avec IAC
   ===================================================== */

.an-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Accents de bord gauche */
.an-card--nudenet  { border-left: 3px solid rgba(255,107,44,.55); }
.an-card--llava    { border-left: 3px solid rgba(99,102,241,.45); }
.an-card--bench    { border-left: 3px solid rgba(245,158,11,.45); }
.an-card--fusion   { border-left: 3px solid rgba(16,185,129,.45); }

/* Ligne de champs horizontale */
.an-fields-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.an-fields-row .sub-field {
  min-width: 120px;
  flex: 1 1 120px;
}

.an-field--model {
  flex: 2 1 220px !important;
}

.an-field--threshold {
  min-width: 160px;
  flex: 1 1 160px !important;
}

/* Slider seuil */
.an-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.an-slider-val {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--watch-accent);
  min-width: 36px;
}

/* Bouton arrêt */
.an-btn--stop {
  color: var(--red) !important;
  border-color: color-mix(in srgb, var(--red) 28%, var(--border2)) !important;
}

/* Titre de section résultats */
.an-results-header {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border2);
}

.an-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: .02em;
}

/* Hint fusion */
.an-fusion-hint {
  font-size: 12px;
  color: var(--text3);
  align-self: center;
}

/* =====================================================
   CHAPITRES — colonnes (inchangées structurellement)
   ===================================================== */

.watch-stage-card {
  position: relative;
}

.watch-stage-card .player-wrap {
  background: #000;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  position: relative;
  will-change: transform;
  contain: layout style;
}

.player-gradient-mask {
  position: absolute;
  inset: auto 0 0 0;
  height: 28%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.58));
  z-index: 2;
}

.player-wrap video {
  width: 100%;
  display: block;
  will-change: contents;
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.pbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface2) 94%, transparent));
  border: 1px solid var(--border2);
  overflow: visible;
  scrollbar-width: none;
}

.pbar::-webkit-scrollbar { display: none; }

.pbar .btn,
.pbar .speed-select,
.pbar .pbar-select {
  flex-shrink: 0;
}

.pbar .spacer {
  flex: 1 1 0;
  min-width: 0;
}

.timecode {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--watch-accent);
  min-width: 7ch;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

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

.tl-wrap {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 10;
  will-change: transform;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tl {
  position: relative;
  background: rgba(255,255,255,.22);
  border-radius: 999px;
  cursor: pointer;
  overflow: visible;
  transform: translateZ(0);
  backdrop-filter: blur(4px);
}

/* ── Progress bar (top) ── */
.tl.tl-progress {
  height: 6px;
  transition: height .14s cubic-bezier(0.4, 0, 0.2, 1);
}

.tl.tl-progress:hover,
.tl.tl-progress.is-hovering {
  height: 10px;
}

/* ── Chapters / heatmap bar (bottom) ── */
.tl.tl-chapters {
  height: 14px;
  transition: height .14s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255,255,255,.12);
}

.tl.tl-chapters:hover,
.tl.tl-chapters.is-hovering {
  height: 24px;
}

.tl.tl-chapters.is-hovering {
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 14px 36px rgba(255,107,44,.18);
}

.tl::before {
  content: '';
  position: absolute;
  inset: -10px 0;
  z-index: -1;
}

.tl-buffer-bar,
.tl-played,
.tl-heatmap,
.tl-mk,
.tl-ph {
  top: 0;
  bottom: 0;
}

.tl-buffer-bar {
  position: absolute;
  left: 0;
  width: 0%;
  background: rgba(255,255,255,.34);
  border-radius: 999px;
  pointer-events: none;
  z-index: 1;
  will-change: width;
}

.tl-heatmap {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 3;
  border-radius: 999px;
  overflow: hidden;
}

.tl-heatmap-svg {
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: center bottom;
  transition: transform .14s ease, filter .14s ease;
}

.tl-heatmap-empty {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.16), rgba(255,255,255,.08));
  opacity: .5;
}

.tl-heatmap-fill {
  fill: rgba(255,255,255,.22);
}

.tl-heatmap-ridge {
  fill: none;
  stroke: rgba(255,255,255,.9);
  stroke-width: 1.65;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tl:hover .tl-heatmap-fill {
  fill: rgba(255,107,44,.38);
}

.tl:hover .tl-heatmap-ridge {
  stroke: rgba(255,214,193,.98);
}

.tl.is-hovering .tl-heatmap-svg {
  transform: scaleY(1.12);
  filter: drop-shadow(0 3px 10px rgba(255,107,44,.22));
}

.tl-hover-glow {
  position: absolute;
  top: -10px;
  bottom: -10px;
  width: 96px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transform: translateX(-50%);
  background: radial-gradient(circle at center, rgba(255,107,44,.26), rgba(255,107,44,.12) 38%, transparent 72%);
  transition: opacity .12s ease;
}

.tl-hover-needle {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,107,44,.9));
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.15), 0 0 18px rgba(255,107,44,.3);
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity .12s ease;
}

.tl.is-hovering .tl-hover-glow,
.tl.is-hovering .tl-hover-needle {
  opacity: 1;
}

.tl-played {
  position: absolute;
  left: 0;
  width: 0%;
  background: linear-gradient(90deg, #ff5c32, var(--watch-accent));
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
  will-change: width;
}

.tl-mk {
  position: absolute;
  margin-block: auto;
  width: 4px;
  min-height: 100%;
  background: rgba(255,255,255,.72);
  border-radius: 999px;
  cursor: pointer;
  z-index: 4;
  transition: background var(--transition), width var(--transition), transform var(--transition);
}

.tl-mk.is-favorite {
  background: #d4aa38;
}

.tl-mk.is-hot {
  background: #f97316;
}

.tl-mk.is-rewatch {
  background: #d946ef;
}

.tl-mk.is-skip {
  background: #7c3aed;
}

.tl-mk.is-dropoff {
  background: #ef4444;
}

.tl-mk:hover {
  background: #fff;
  width: 6px;
  transform: scaleY(1.08);
}

.tl-mk.is-favorite:hover {
  background: #f1cd68;
}

.tl-mk::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-family: var(--mono);
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  box-shadow: var(--shadow-sm);
}

.tl-mk:hover::after {
  opacity: 1;
}

.tl-ph {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,92,50,.55);
  z-index: 5;
  pointer-events: none;
  transform: translateX(-50%) translateZ(0);
  opacity: 0;
  transition: opacity .12s ease;
  margin: auto 0;
  will-change: left, opacity;
}

.tl:hover .tl-ph {
  opacity: 1;
}

.tl-preview {
  position: absolute;
  bottom: calc(100% + 14px);
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 4px;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  transition: opacity 60ms linear;
  will-change: opacity, left;
  display: flex;
  flex-direction: column;
  align-items: center;
  contain: layout style;
}

.tl-preview.visible {
  opacity: 1;
}

.tl-preview canvas {
  display: block;
  border-radius: 10px;
  width: 320px;
  height: 180px;
  image-rendering: auto;
}

#tlTrickplayImg {
  display: none;
  width: 320px;
  height: 180px;
  border-radius: 10px;
  overflow: hidden;
  background-repeat: no-repeat;
  background-color: #000;
  flex-shrink: 0;
}

.tl-preview-chapter {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 8px 0;
  text-align: center;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-preview-time {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  padding: 5px 0 2px;
}

/* ── Volume slider ── */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  min-width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  flex-shrink: 1;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--watch-accent);
  cursor: pointer;
  border: none;
}
.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--watch-accent);
  cursor: pointer;
  border: none;
}

/* ── Chapter strip header ── */
.chapter-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chapter-strip-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chapter-strip-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.chapter-strip-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,107,44,.18);
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  cursor: pointer;
}

.chapter-strip-filter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
}

.chapter-strip-filter-toggle {
  width: 36px;
  height: 20px;
}

.chapter-strip-filter:hover {
  border-color: rgba(255,107,44,.28);
  background: color-mix(in srgb, var(--surface2) 86%, transparent);
}

.chapter-strip-filter-toggle input:focus-visible + .nav-config-item-slider {
  outline: 2px solid rgba(255,107,44,.28);
  outline-offset: 2px;
}

.chapter-strip-empty {
  grid-column: 1 / -1;
  padding: 18px 16px;
  border: 1px dashed rgba(255,107,44,.18);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface2) 90%, transparent);
  color: var(--text2);
  font-size: 13px;
  text-align: center;
}

/* ── Enlarged pbar controls ── */
.pbar .btn-sm {
  padding: 8px 14px;
  font-size: 15px;
}

/* ── Fullscreen toggle visibility ── */
.fs-only-control { display: none; }

/* Active state for chapter toggle in fullscreen */
.ed-video-col.is-fullscreen #btnFsChapters.active {
  background: var(--watch-accent);
  color: #fff;
  border-color: var(--watch-accent);
}

/* ── Fullscreen mode ── */
.ed-video-col.is-fullscreen {
  background: #000;
  padding: 0;
  position: relative;
  width: 100%;
  height: 100%;
}

.ed-video-col.is-fullscreen .watch-stage-card {
  border: none;
  border-radius: 0;
  background: #000;
  box-shadow: none;
  padding: 0;
  width: 100%;
  height: 100%;
  position: relative;
}

.ed-video-col.is-fullscreen .player-wrap {
  border: none;
  border-radius: 0;
  width: 100%;
  height: 100%;
  contain: unset;
}

.ed-video-col.is-fullscreen .player-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ed-video-col.is-fullscreen .player-gradient-mask {
  height: 40%;
}

.ed-video-col.is-fullscreen .tl-wrap {
  left: 24px;
  right: 24px;
  bottom: 110px;
  gap: 0;
}

.ed-video-col.is-fullscreen #timelineChapters {
  display: block;
}

/* Pbar: overlay at bottom of screen in fullscreen */
.ed-video-col.is-fullscreen .pbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  margin-top: 0;
  border: none;
  border-radius: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.88));
  color: #fff;
  padding: 14px 24px;
}

.ed-video-col.is-fullscreen .pbar .btn {
  color: #fff;
  border-color: rgba(255,255,255,.18);
  padding: 10px 16px;
  font-size: 16px;
}

.ed-video-col.is-fullscreen .pbar .btn:hover {
  background: rgba(255,255,255,.12);
}

.ed-video-col.is-fullscreen .pbar .btn-primary {
  color: #fff;
  border-color: transparent;
}

.ed-video-col.is-fullscreen .pbar-divider {
  background: rgba(255,255,255,.22);
}

.ed-video-col.is-fullscreen .speed-select,
.ed-video-col.is-fullscreen .pbar-select {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.18);
}

.ed-video-col.is-fullscreen .pbar-settings-dropdown {
  background: rgba(0,0,0,.92);
  border-color: rgba(255,255,255,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ed-video-col.is-fullscreen .pbar-settings-label {
  color: #fff;
}

.ed-video-col.is-fullscreen .pbar-chapter-select-dropdown {
  background: rgba(0,0,0,.92);
  border-color: rgba(255,255,255,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

html[data-theme="light"] .ed-video-col.is-fullscreen .pbar {
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.88));
  color: #0f172a;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html[data-theme="light"] .ed-video-col.is-fullscreen .pbar .btn {
  color: #0f172a;
  background: rgba(255,255,255,.78);
  border-color: rgba(15,23,42,.14);
  box-shadow: 0 8px 20px rgba(15,23,42,.12);
}

html[data-theme="light"] .ed-video-col.is-fullscreen .pbar .btn:hover {
  background: rgba(255,255,255,.96);
  border-color: rgba(255,107,44,.28);
  color: #0f172a;
}

html[data-theme="light"] .ed-video-col.is-fullscreen .pbar .btn-primary {
  color: #fff;
  background: var(--accent-gradient);
  border-color: transparent;
}

html[data-theme="light"] .ed-video-col.is-fullscreen .pbar-divider {
  background: rgba(15,23,42,.12);
}

html[data-theme="light"] .ed-video-col.is-fullscreen .speed-select,
html[data-theme="light"] .ed-video-col.is-fullscreen .pbar-select {
  color: #0f172a;
  background: rgba(255,255,255,.84);
  border-color: rgba(15,23,42,.14);
}

html[data-theme="light"] .ed-video-col.is-fullscreen .pbar-settings-dropdown,
html[data-theme="light"] .ed-video-col.is-fullscreen .pbar-chapter-select-dropdown {
  background: rgba(255,255,255,.96);
  border-color: rgba(15,23,42,.12);
}

html[data-theme="light"] .ed-video-col.is-fullscreen .pbar-settings-label,
html[data-theme="light"] .ed-video-col.is-fullscreen .pbar-ch-title {
  color: #0f172a;
}

html[data-theme="light"] .ed-video-col.is-fullscreen .timecode {
  color: #c75a1a;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(15,23,42,.14);
  box-shadow: 0 8px 20px rgba(15,23,42,.12);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar {
    background: linear-gradient(180deg, transparent, rgba(255,255,255,.88));
    color: #0f172a;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar .btn {
    color: #0f172a;
    background: rgba(255,255,255,.78);
    border-color: rgba(15,23,42,.14);
    box-shadow: 0 8px 20px rgba(15,23,42,.12);
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar .btn:hover {
    background: rgba(255,255,255,.96);
    border-color: rgba(255,107,44,.28);
    color: #0f172a;
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar .btn-primary {
    color: #fff;
    background: var(--accent-gradient);
    border-color: transparent;
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar-divider {
    background: rgba(15,23,42,.12);
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .speed-select,
  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar-select {
    color: #0f172a;
    background: rgba(255,255,255,.84);
    border-color: rgba(15,23,42,.14);
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar-settings-dropdown,
  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar-chapter-select-dropdown {
    background: rgba(255,255,255,.96);
    border-color: rgba(15,23,42,.12);
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar-settings-label,
  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .pbar-ch-title {
    color: #0f172a;
  }

  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .timecode {
    color: #c75a1a;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(15,23,42,.14);
    box-shadow: 0 8px 20px rgba(15,23,42,.12);
  }
}

.ed-video-col.is-fullscreen .pbar-ch-title {
  color: #fff;
}

.ed-video-col.is-fullscreen .timecode {
  color: var(--watch-accent);
  font-size: 20px;
}

.ed-video-col.is-fullscreen .volume-slider {
  background: rgba(255,255,255,.22);
}

html[data-theme="light"] .ed-video-col.is-fullscreen .volume-slider {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(15,23,42,.14);
  box-shadow: 0 8px 20px rgba(15,23,42,.12);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .ed-video-col.is-fullscreen .volume-slider {
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(15,23,42,.14);
    box-shadow: 0 8px 20px rgba(15,23,42,.12);
  }
}

#metaPersonsCardsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.meta-person-card {
  appearance: none;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface2) 95%, transparent));
  display: flex;
  flex-direction: column;
  text-align: left;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.meta-person-card:hover {
  box-shadow: 0 16px 34px rgba(15,23,42,.10);
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

.meta-person-card-thumb {
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: var(--surface2);
}

.meta-person-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.meta-person-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface3) 90%, transparent);
  color: var(--text3);
  font-size: 48px;
}

.meta-person-card-body {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-person-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-person-card-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}

.meta-person-card-genre {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
}

.ed-video-col.is-fullscreen .fs-only-control {
  display: none;
}

/* Chapter strip in fullscreen: hidden by default, overlay when toggled */
.ed-video-col.is-fullscreen .chapter-strip-card,
#viewEditor.editor-edit-mode .ed-video-col.is-fullscreen .chapter-strip-card {
  display: none;
  position: absolute;
  bottom: 60px;
  left: 0;
  right: 0;
  z-index: 19;
  border: none;
  border-radius: 0;
  margin-top: 0;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: none;
  padding: 12px 24px;
  max-height: 30vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.ed-video-col.is-fullscreen .chapter-strip-card.fs-chapters-visible,
#viewEditor.editor-edit-mode .ed-video-col.is-fullscreen .chapter-strip-card.fs-chapters-visible {
  display: block;
}

.ed-video-col.is-fullscreen .chapter-strip-card .chapter-strip-title {
  color: #fff;
}

.ed-video-col.is-fullscreen .chapter-strip-card .chapter-thumb {
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}

.ed-video-col.is-fullscreen .chapter-strip-card .ct-label {
  color: #fff;
}

.ed-video-col.is-fullscreen .chapter-strip-card .ct-time {
  color: rgba(255,255,255,.6);
}

/* ── Portrait (vertical) video layout ────────────────────────── */
.ed-top-row.is-portrait.watch-layout {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.ed-top-row.is-portrait .ed-video-col {
  display: contents;
}

.ed-top-row.is-portrait .ed-video-col .watch-stage-card {
  width: 100%;
  max-width: 100%;
  grid-column: 1;
  grid-row: 1;
}

.ed-top-row.is-portrait .ed-video-col .watch-stage-card .pbar {
  margin-top: 8px;
}

.ed-top-row.is-portrait .ed-video-col .player-wrap.is-portrait {
  height: calc(100vh - 280px);
  max-height: 74vh;
  width: 100%;
  display: flex;
  justify-content: center;
  overflow: visible;
}

.ed-top-row.is-portrait .ed-video-col .player-wrap.is-portrait video {
  width: auto;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Chapter strip as second block */
.ed-top-row.is-portrait .ed-video-col .chapter-strip-card {
  grid-column: 2;
  grid-row: 1;
  margin-top: 0;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Hide chapter strip in portrait edit mode */
#viewEditor.editor-edit-mode .ed-top-row.is-portrait .ed-video-col .chapter-strip-card {
  display: none !important;
}
#viewEditor.editor-edit-mode .ed-top-row.is-portrait .ed-meta-col {
  grid-column: 2;
}

/* Meta col as third block */
.ed-top-row.is-portrait .ed-meta-col {
  grid-column: 3;
  grid-row: 1;
  min-width: 260px;
  max-width: none;
  width: auto;
}

/* Responsive for portrait on smaller screens */
@media (max-width: 1100px) {
  .ed-top-row.is-portrait.watch-layout {
    grid-template-columns: auto 1fr;
  }
  .ed-top-row.is-portrait .ed-video-col .chapter-strip-card {
    grid-column: 2;
    grid-row: 1;
  }
  .ed-top-row.is-portrait .ed-meta-col {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 768px) {
  .ed-top-row.is-portrait.watch-layout {
    display: flex;
    flex-direction: column;
  }
  .ed-top-row.is-portrait .ed-video-col {
    display: block;
    width: 100%;
  }
  .ed-top-row.is-portrait .ed-video-col .watch-stage-card {
    width: 100%;
  }
  .ed-top-row.is-portrait .ed-video-col .player-wrap.is-portrait {
    height: 50vh;
    max-height: 50vh;
  }
  .ed-top-row.is-portrait .ed-video-col .player-wrap.is-portrait video {
    width: auto;
    height: 100%;
    margin: 0 auto;
  }
  .ed-top-row.is-portrait .ed-video-col .chapter-strip-card {
    max-height: none;
  }
  .ed-top-row.is-portrait .ed-meta-col {
    min-width: 0;
  }
}

/* ── Chapter selector dropdown (control bar) ─────────────────── */
.pbar-chapter-select-wrap {
  position: relative;
  flex-shrink: 0;
}

.pbar-chapter-select-wrap {
  position: relative;
}

.pbar-chapter-select-wrap #btnChapterSelect.active {
  color: var(--watch-accent);
  background: rgba(255,107,44,.12);
}

.pbar-chapter-select-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(420px, 90vw);
  max-height: min(50vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  padding: 8px;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.pbar-chapter-select-dropdown::-webkit-scrollbar { width: 5px; }
.pbar-chapter-select-dropdown::-webkit-scrollbar-track { background: transparent; }
.pbar-chapter-select-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.pbar-chapter-select-dropdown::-webkit-scrollbar-thumb:hover { background: var(--text3); }

.pbar-chapter-select-dropdown.is-open {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pbar-ch-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

.pbar-ch-item.is-favorite {
  border-color: rgba(212,170,56,.26);
  background: rgba(212,170,56,.05);
}

.pbar-ch-item.is-text-only {
  grid-template-columns: minmax(0, 1fr);
}

.pbar-ch-item:hover {
  background: color-mix(in srgb, var(--surface2) 80%, transparent);
  border-color: rgba(255,107,44,.16);
}

.pbar-ch-item.is-favorite:hover {
  background: rgba(212,170,56,.08);
  border-color: #d4aa38;
}

.pbar-ch-item.active {
  border-color: var(--watch-accent);
  background: rgba(255,107,44,.08);
}

.pbar-ch-item.is-favorite.active {
  border-color: #d4aa38;
  background: rgba(212,170,56,.1);
  box-shadow: 0 0 0 1px rgba(212,170,56,.14);
}

.pbar-ch-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface3);
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}

.pbar-ch-favorite-badge {
  top: 6px;
  right: 6px;
}

.pbar-ch-item.is-text-only .pbar-ch-thumb {
  display: none;
}

.pbar-ch-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pbar-ch-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pbar-ch-time {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--watch-accent);
  letter-spacing: -.01em;
}

.pbar-ch-item.is-favorite .pbar-ch-time,
.pbar-ch-item.is-favorite .pbar-ch-title {
  color: #d4aa38;
}

.pbar-ch-favorite-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  font-size: 11px;
  line-height: 1;
}

.pbar-ch-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* ── Pbar Settings dropdown (speed + subtitles) ──────────────── */
.pbar-settings-wrap {
  position: relative;
  flex-shrink: 0;
}

.pbar-settings-wrap #btnPbarSettings.active {
  color: var(--watch-accent);
  background: rgba(255,107,44,.12);
}

.pbar-settings-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  padding: 12px;
  z-index: 500;
}

.pbar-settings-dropdown.is-open {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pbar-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pbar-settings-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.pbar-settings-row .pbar-select {
  flex: 1;
  min-width: 0;
}

/* ── Fullscreen auto-hide ─────────────────────────────────────── */
.ed-video-col.is-fullscreen.fs-idle .pbar,
.ed-video-col.is-fullscreen.fs-idle .tl-wrap,
.ed-video-col.is-fullscreen.fs-idle .player-gradient-mask {
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}

.ed-video-col.is-fullscreen .pbar,
.ed-video-col.is-fullscreen .tl-wrap,
.ed-video-col.is-fullscreen .player-gradient-mask {
  transition: opacity .3s ease;
}

.ed-video-col.is-fullscreen.fs-idle {
  cursor: none;
}

@media (max-width: 1280px) {
  .watch-layout:not(.is-portrait) {
    flex-direction: column;
  }

  #viewEditor.editor-edit-mode .watch-layout:not(.is-portrait) {
    flex-direction: row;
    align-items: flex-start;
  }

  .watch-head-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .ed-top-row:not(.is-portrait) .ed-meta-col {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .watch-mode-cluster,
  .watch-toggle-group {
    width: auto;
    justify-content: flex-start;
  }

  .watch-side-card-chapters {
    min-height: 0;
  }

  .watch-sidebar-chapters {
    max-height: min(56vh, 720px);
  }
}

@media (max-width: 900px) {
  #viewEditor.editor-edit-mode .ed-video-col:not(.is-fullscreen) .watch-stage-card {
    position: sticky !important;
    top: 88px !important;
  }

  .watch-head {
    top: 8px;
    padding: 12px 14px;
    border-radius: 18px;
  }

  .watch-head-main {
    flex-direction: column;
    align-items: stretch;
  }

  .watch-section-grid {
    grid-template-columns: 1fr;
  }

  .watch-cast-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .watch-stage-card,
  .watch-hero-panel,
  .watch-section-block,
  .watch-side-card,
  .meta-section {
    border-radius: 18px;
  }

  .watch-head-actions {
    width: 100%;
  }

  .watch-slider-wrap {
    min-width: 140px;
    width: auto;
  }

  .watch-toggle-group {
    display: inline-flex;
    grid-template-columns: none;
  }

  .watch-toggle-btn {
    width: auto;
  }

  .watch-side-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .watch-side-section-tools {
    width: 100%;
    justify-content: space-between;
  }

  .meta-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-mode-head {
    grid-template-columns: 1fr;
  }

  .tl.tl-chapters:hover,
  .tl.tl-chapters.is-hovering {
    height: 18px;
  }

  .tl.tl-progress:hover,
  .tl.tl-progress.is-hovering {
    height: 8px;
  }
}

@media (max-width: 640px) {
  #viewEditor {
    --watch-panel-width: 100%;
    padding-bottom: 18px;
  }

  .watch-display-title,
  .watch-side-title {
    font-size: 24px;
  }

  .watch-head-line1 {
    gap: 10px;
  }

  .watch-stage-card {
    padding: 10px;
  }

  .pbar {
    padding: 10px;
    flex-wrap: wrap;
  }

  .meta-quick-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  .meta-pcloud-review {
    align-items:flex-start;
    gap:8px;
  }

  #playbackSpeed,
  #playerSubtitleSelect {
    min-width: 0;
    width: 100%;
  }

  .tl-preview {
    transform: translateX(-50%) scale(.8);
    transform-origin: bottom center;
  }

  .chapter-thumbs-strip {
    grid-template-columns: 1fr;
  }

  .watch-side-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .watch-side-tabs {
    grid-template-columns: 1fr;
  }

  .watch-side-section-tools {
    width: 100%;
  }

  .watch-side-view-switch {
    width: 100%;
  }

  .watch-side-view-btn {
    flex: 1 1 50%;
  }

  .watch-sidebar-chapters.is-list .watch-sidebar-chapter {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .watch-sidebar-chapter-body {
    padding: 9px 10px 11px;
  }

  .watch-sidebar-chapters.is-list .watch-sidebar-chapter-body {
    padding: 0;
  }

  .watch-sidebar-chapters {
    max-height: min(50vh, 560px);
  }

  .watch-video-stats .dash-kpi-row,
  .watch-video-stats-summary-grid {
    grid-template-columns: 1fr;
  }

  .video-playback-modal {
    width: 96vw;
  }
}

/* Chapter list toolbar */
.toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.imp-label { position: relative; overflow: hidden; }
.imp-label input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Chapter list */
.ch-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: none;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-right: 2px;
  scroll-padding-top: 4px;
}

.ch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 44px;
  box-sizing: border-box;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  transition: all var(--transition);
}
.ch-row:hover { border-color: var(--border); background: var(--surface2); }
.ch-row.ch-unsaved {
  border-color: #e8871e;
  background: rgba(232, 135, 30, 0.08);
}
.ch-row.ch-unsaved:hover {
  border-color: #f59e3b;
  background: rgba(232, 135, 30, 0.14);
}
.ch-row.act {
  border-color: var(--watch-accent);
  background: color-mix(in srgb, var(--watch-accent) 10%, var(--surface));
  box-shadow: 0 0 0 2px rgba(255,107,44,.28), 0 6px 14px rgba(255,107,44,.10);
}

.ch-row.act .ch-n {
  color: var(--watch-accent);
}

.ch-row-auto-reveal {
  border-color: #d96b5f;
  box-shadow: inset 4px 0 0 #d96b5f;
  background: linear-gradient(90deg, rgba(217,107,95,.10), rgba(217,107,95,.03) 18%, color-mix(in srgb, var(--surface) 98%, transparent) 55%);
}

.ch-row-auto-reveal:hover {
  border-color: #e78378;
  background: linear-gradient(90deg, rgba(231,131,120,.14), rgba(231,131,120,.04) 18%, color-mix(in srgb, var(--surface) 97%, transparent) 58%);
}

.ch-row-auto-reveal .ch-n {
  color: #b84e43;
}

.ch-row-auto-reveal .ch-time-edit {
  border-color: color-mix(in srgb, #d96b5f 56%, var(--border2));
  background: color-mix(in srgb, #d96b5f 8%, var(--surface));
  color: #b84e43;
}

.ch-row-auto-reveal .ch-time-edit:focus {
  border-color: #d96b5f;
  background: color-mix(in srgb, #d96b5f 12%, var(--surface));
}

.ch-row-auto-reveal.act {
  border-color: var(--watch-accent);
  background: linear-gradient(90deg, rgba(255,107,44,.14), rgba(255,107,44,.05) 18%, color-mix(in srgb, var(--surface) 97%, transparent) 58%);
  box-shadow: 0 0 0 2px rgba(255,107,44,.28), inset 4px 0 0 var(--watch-accent), 0 6px 14px rgba(255,107,44,.10);
}

.ch-row-auto-reveal.act .ch-n,
.ch-row-auto-reveal.act .ch-time-edit {
  color: var(--watch-accent);
  border-color: color-mix(in srgb, var(--watch-accent) 56%, var(--border2));
}

.ch-n {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--watch-accent);
  min-width: 28px;
  text-align: left;
  flex-shrink: 0;
}

.ch-name {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 4px;
  min-width: 0;
  transition: all var(--transition);
}
.ch-name:focus { outline: none; border-color: var(--border); background: var(--surface2); }

.ch-time-edit {
  width: 92px;
  min-width: 92px;
  text-align: center;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--border2) 88%, transparent);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.35;
  padding: 4px 6px;
  border-radius: 6px;
}
.ch-time-edit:focus { outline: none; border-color: var(--watch-accent); background: var(--surface2); }
.ch-time-edit.is-invalid {
  border-color: color-mix(in srgb, var(--red) 72%, var(--border2));
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
  color: color-mix(in srgb, var(--red) 78%, var(--text));
}

.ch-name-edit {
  flex: 1;
  min-width: 80px;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--border2) 88%, transparent);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  padding: 4px 6px;
  border-radius: 6px;
}

.ch-name-edit:focus {
  outline: none;
  border-color: var(--watch-accent);
  background: var(--surface2);
}

.empty {
  text-align: center;
  padding: 28px;
  color: var(--text3);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: var(--surface);
}

/* =====================================================
   SOUS-TITRES — nouvelle charte graphique
   Même ADN que .iac-* : cards orange, radius 24px.
   ===================================================== */

.sub-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Accents de bord gauche par card */
.sub-card--files     { border-left: 3px solid rgba(255,107,44,.55); }
.sub-card--generate  { border-left: 3px solid rgba(99,102,241,.45); }
.sub-card--translate { border-left: 3px solid rgba(16,185,129,.45); }

/* Badge info piste (petit, inline dans le titre) */
.sub-info-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  font-family: var(--mono);
  margin-left: 6px;
  vertical-align: middle;
}

/* Select fichier (pleine largeur) */
.sub-file-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* Bouton danger (supprimer) */
.sub-btn--danger {
  color: var(--red) !important;
  border-color: color-mix(in srgb, var(--red) 28%, var(--border2)) !important;
}
.sub-btn--danger:hover {
  background: color-mix(in srgb, var(--red) 8%, var(--surface2)) !important;
}

/* Grille de champs dans la card Génération */
.sub-fields-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-field-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
}

.sub-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sub-field-row--wrap {
  gap: 12px;
}

/* Label toggle (checkbox + texte) */
.sub-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sub-toggle-label input[type="checkbox"] {
  accent-color: var(--watch-accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Label inline (label + select côte à côte) */
.sub-field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sub-field-inline .sub-field-label {
  white-space: nowrap;
}

/* Select petit (chunk duration) */
.sub-select--sm {
  min-width: 80px;
}

/* Switch diarization (réutilise le toggle existant) */
.sub-diarization-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}

/* Statut moteur Whisper */
.sub-engine-status {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
}

/* Barre de sauvegarde */
.sub-save-bar {
  margin-top: 4px;
}

/* Compat — anciens sélecteurs non supprimés pour ne pas casser le JS */
.subtitle-panel {
  display: contents;
}
.subtitle-panel-head { display: none; }
.subtitle-actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.subtitle-actions-row > label {
  font-size: 12px;
  color: var(--text2);
}
.subtitle-info {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--mono);
}
.subtitle-select {
  min-width: 190px;
}

.analysis-source-native-select {
  display: none;
}

.analysis-source-pillbox {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 240px;
}

.analysis-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), color var(--transition), opacity var(--transition);
}

.analysis-source-pill:hover:not(.is-disabled) {
  transform: translateY(-1px);
  border-color: var(--accent-border);
  color: var(--text1);
}

.analysis-source-pill.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-color: var(--accent-border);
  color: var(--text1);
  box-shadow: 0 0 0 3px var(--accent-softer);
}

.analysis-source-pill.is-disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.15);
}

.analysis-source-pill-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--border2);
  flex: 0 0 auto;
}

.analysis-source-pill.is-active .analysis-source-pill-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

.analysis-source-pill-label {
  white-space: nowrap;
}

.local-ai-compare-modal-box {
  width: min(760px, calc(100vw - 32px));
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  box-shadow: 0 28px 72px rgba(0,0,0,.28);
}

.local-ai-compare-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--border2);
}

.local-ai-compare-model-list {
  display: grid;
  gap: 14px;
  padding: 16px 20px 8px;
  max-height: min(62vh, 680px);
  overflow-y: auto;
}

.local-ai-compare-group {
  border: 1px solid var(--border2);
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface2) 75%, transparent), var(--surface));
  overflow: hidden;
}

.local-ai-compare-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
}

.local-ai-compare-group-head h4 {
  margin: 0;
  font-size: 14px;
}

.local-ai-compare-group-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text3);
}

.local-ai-compare-group-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.local-ai-compare-model-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.local-ai-compare-model-option:hover {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  transform: translateY(-1px);
}

.local-ai-compare-model-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.local-ai-compare-model-copy {
  display: grid;
  gap: 3px;
}

.local-ai-compare-model-copy strong {
  font-size: 13px;
  color: var(--text1);
}

.local-ai-compare-model-copy span {
  font-size: 12px;
  color: var(--text3);
}

.local-ai-compare-model-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: color-mix(in srgb, var(--blue) 10%, var(--surface2));
  color: color-mix(in srgb, var(--blue) 70%, var(--text1));
}

.local-ai-compare-status {
  margin: 10px 20px 0;
}
.subtitle-file-select {
  min-width: 280px;
  max-width: 420px;
}
.subtitle-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
}
.subtitle-diarization-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.subtitle-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  min-height: 18px;
  margin-bottom: 8px;
}
.subtitle-status.ok { color: var(--green); }
.subtitle-status.err { color: var(--red); }
.whisper-diarization-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  font-family: var(--mono);
  background: var(--surface2);
  color: var(--text2);
}

.whisper-diarization-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text3);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text3) 15%, transparent);
}

.whisper-diarization-pill.is-ready {
  border-color: color-mix(in srgb, var(--green) 55%, var(--border2));
  color: color-mix(in srgb, var(--green) 70%, var(--text1));
  background: color-mix(in srgb, var(--green) 12%, var(--surface2));
}

.whisper-diarization-pill.is-ready::before {
  background: var(--green);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 22%, transparent);
}

.whisper-diarization-pill.is-warning {
  border-color: color-mix(in srgb, #d97706 50%, var(--border2));
  color: color-mix(in srgb, #d97706 75%, var(--text1));
  background: color-mix(in srgb, #d97706 10%, var(--surface2));
}

.whisper-diarization-pill.is-warning::before {
  background: #d97706;
  box-shadow: 0 0 0 2px color-mix(in srgb, #d97706 22%, transparent);
}

.whisper-diarization-pill.is-off {
  border-color: color-mix(in srgb, var(--text3) 45%, var(--border2));
  color: var(--text3);
  background: color-mix(in srgb, var(--surface2) 75%, var(--surface));
}

.whisper-diarization-pill.is-off::before {
  background: var(--text3);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text3) 20%, transparent);
}

.whisper-diarization-pill.is-checking {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--border2));
  color: color-mix(in srgb, var(--blue) 75%, var(--text1));
  background: color-mix(in srgb, var(--blue) 10%, var(--surface2));
}

.whisper-diarization-pill.is-checking::before {
  background: var(--blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 22%, transparent);
}

.subtitle-runtime-log {
  margin-bottom: 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  white-space: pre-wrap;
  max-height: 170px;
  overflow-y: auto;
  line-height: 1.45;
}

.process-progress {
  margin: 6px 0 8px;
}

.process-progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  overflow: hidden;
}

.process-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #17a2b8, #28c76f);
  transition: width .25s ease;
}

.process-progress-bar--subtitle {
  background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.process-progress-bar--llava {
  background: linear-gradient(90deg, #0f766e, #34d399);
}

.process-progress.is-indeterminate .process-progress-bar {
  width: 35% !important;
  animation: process-progress-indeterminate 1.1s ease-in-out infinite;
}

@keyframes process-progress-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(300%); }
}

.process-progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
}

.process-progress-pct {
  font-weight: 700;
  color: var(--text);
  min-width: 38px;
}

.process-progress-step {
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-progress-eta {
  margin-left: auto;
  white-space: nowrap;
}
.subtitle-list {
  max-height: 42vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}
.subtitle-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 12px;
  color: var(--text3);
  text-align: center;
}
.sub-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto auto;
  gap: 6px;
  align-items: start;
  border: 1px solid var(--border2);
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 8px;
}
.subtitle-speaker-editor {
  margin-top: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface2);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.subtitle-speaker-editor-title {
  font-size: 12px;
  color: var(--text2);
  font-weight: 600;
}
.subtitle-speaker-row {
  display: grid;
  grid-template-columns: 78px minmax(130px, 220px) auto;
  gap: 8px;
  align-items: center;
}
.subtitle-speaker-row-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
}
.subtitle-speaker-row-input {
  min-width: 120px;
  font-size: 12px;
  padding: 5px 7px;
}
.subtitle-speaker-row-meta {
  font-size: 11px;
  color: var(--text3);
}
.sub-speaker-chip {
  align-self: start;
  font-size: 11px;
  line-height: 1;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text2);
  padding: 6px 8px;
  white-space: nowrap;
}
.sub-time {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  color: var(--text2);
}
.sub-time input {
  width: 76px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 6px;
}
.sub-text {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.45;
}
.sub-play-btn {
  align-self: start;
  font-size: 14px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--text2);
  background: none;
  border: none;
}
.sub-play-btn:hover { color: var(--accent); }
.sub-delete-btn {
  align-self: start;
  font-size: 16px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--red, #e74c3c);
  background: none;
  border: none;
}
.sub-delete-btn:hover { opacity: .7; }
.subtitle-save-bar {
  margin-top: 10px;
}

.summary-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border2);
}

.summary-text {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.5;
  font-family: var(--mono);
}

.genre-detect-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border2);
}
.genre-detect-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}
.genre-detect-results .genre-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  transition: all .15s;
  user-select: none;
}
.genre-detect-results .genre-chip:hover {
  border-color: var(--accent);
}
.genre-detect-results .genre-chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.genre-detect-results .genre-chip.existing {
  opacity: .5;
  cursor: default;
  text-decoration: line-through;
}
.genre-section-label {
  font-size: 12px;
  color: var(--text3);
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: 600;
}
.genre-prompt-textarea {
  width: 100%;
  resize: vertical;
  font-size: 12px;
  line-height: 1.5;
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px;
}

/* ── Local AI chapter chips ── */
.local-ai-chapter-results {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-padding-top: 4px;
}

.local-ai-chapter-results.has-timeline {
  padding: 14px 0 14px 64px;
}

.generated-chapter-time-rail {
  position: absolute;
  left: 34px;
  top: 14px;
  width: 14px;
  bottom: 14px;
  pointer-events: none;
}

.generated-chapter-time-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .01em;
  color: color-mix(in srgb, var(--text) 72%, var(--text2));
  white-space: nowrap;
}

.generated-chapter-time-label.is-top {
  top: 2px;
}

.generated-chapter-time-label.is-bottom {
  bottom: 2px;
  top: auto;
}

.generated-chapter-time-rail::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.26), rgba(255,255,255,.08));
}

.generated-chapter-time-rail-progress {
  position: absolute;
  left: 50%;
  top: var(--chapter-playback-top-px, calc(var(--chapter-playback-progress, 0) * 100%));
  width: 24px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--watch-accent) 90%, white 10%);
  border: 1px solid color-mix(in srgb, white 38%, var(--watch-accent));
  box-shadow: 0 0 0 3px rgba(255,107,44,.28), 0 0 18px rgba(255,107,44,.5), 0 6px 16px rgba(255,107,44,.32);
}

.generated-chapter-time-debug {
  position: absolute;
  left: calc(100% + 10px);
  top: 0;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  white-space: nowrap;
  pointer-events: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
  color: #fff4ea;
  background: color-mix(in srgb, #1a1110 74%, var(--watch-accent) 26%);
  border: 1px solid rgba(255,107,44,.45);
  box-shadow: 0 2px 10px rgba(0,0,0,.26);
  z-index: 2;
}

.local-ai-chapter-results.timeline-debug .generated-chapter-time-debug {
  display: inline-flex;
}

.generated-chapter-time-marker {
  position: absolute;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: color-mix(in srgb, white 82%, var(--surface) 18%);
  border: 2px solid color-mix(in srgb, var(--watch-accent) 45%, var(--border2));
  box-shadow: 0 1px 4px rgba(15,23,42,.14);
}
.generated-chapter-time-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--chapter-marker-link-width, 0px);
  height: 2px;
  transform: translateY(-50%);
  transform-origin: left center;
  background: color-mix(in srgb, var(--watch-accent) 28%, var(--border2));
  opacity: .9;
}

.generated-chapter-time-marker.is-current {
  width: 10px;
  height: 10px;
  background: var(--watch-accent);
  border-color: color-mix(in srgb, white 18%, var(--watch-accent));
  box-shadow: 0 0 0 3px rgba(255,107,44,.16), 0 3px 10px rgba(255,107,44,.28);
}

.generated-chapter-time-marker.is-current::after {
  height: 3px;
  background: color-mix(in srgb, var(--watch-accent) 78%, white 22%);
}
.local-ai-chapter-results-empty {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.local-ai-chapter-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  min-height: 44px;
  box-sizing: border-box;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
  opacity: 1;
}
.local-ai-chapter-chip:hover {
  border-color: var(--border);
  background: var(--surface2);
}
.local-ai-chapter-chip.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
}
.local-ai-chapter-chip .ch-time {
  min-width: 92px;
}
.local-ai-chapter-chip .ch-name {
  flex: 1;
}

.local-ai-chapter-chip .ch-time-edit {
  width: 92px;
  min-width: 92px;
}

.local-ai-chapter-chip .ch-name-edit {
  min-width: 0;
}

.ch-source-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 16px;
  line-height: 1;
}

/* Currently playing chapter — same footprint as the editable list, only orange framed */
.local-ai-chapter-chip.ch-playing {
  opacity: 1;
  border-color: var(--watch-accent);
  box-shadow: 0 0 0 2px rgba(255,107,44,.28), 0 6px 14px rgba(255,107,44,.10);
  background: color-mix(in srgb, var(--watch-accent) 10%, var(--surface));
}
.local-ai-chapter-chip.ch-playing .ch-time {
  color: var(--watch-accent);
}
.local-ai-chapter-chip.ch-playing .ch-name {
  color: var(--text);
}
.local-ai-chapter-chip.ch-playing .ch-source-badge {
  border-color: color-mix(in srgb, var(--watch-accent) 35%, var(--border2));
}
.local-ai-chapter-chip.ch-playing button {
  border-color: color-mix(in srgb, var(--watch-accent) 35%, var(--border2));
}

/* Proposed chapters (Claude) — violet outline */
.local-ai-chapter-chip.chip-proposed {
  border-color: #9e6ac7;
  box-shadow: inset 4px 0 0 #9e6ac7;
  background: color-mix(in srgb, rgba(158,106,199,.10) 100%, var(--surface));
}
.local-ai-chapter-chip.chip-proposed:hover {
  border-color: #b17ad5;
  background: color-mix(in srgb, rgba(177,122,213,.08) 100%, var(--surface2));
}
.local-ai-chapter-chip.chip-proposed.selected {
  border-color: #b17ad5;
  background: color-mix(in srgb, rgba(177,122,213,.14) 100%, var(--surface));
}
.local-ai-chapter-chip.chip-proposed .ch-time { color: #7f4eb2; }

/* Explicit class to mark Claude-sourced chips (legacy) */
.local-ai-chapter-chip.chip-claude .ch-name { color: var(--text); }

/* Per-model AI chapter chips — colours driven by CSS variables set inline */
.local-ai-chapter-chip.chip-ai-model {
  border-color: color-mix(in srgb, var(--chip-border, #4a9eff) 72%, var(--border2));
  box-shadow: inset 4px 0 0 var(--chip-border, #4a9eff);
}
.local-ai-chapter-chip.chip-ai-model:hover { opacity: 1; }
.local-ai-chapter-chip.chip-ai-model.selected {
  background: color-mix(in srgb, var(--chip-border, #4a9eff) 12%, var(--surface));
}
.local-ai-chapter-chip.chip-ai-model .ch-time {
  color: var(--tag-text, var(--chip-border, #4a9eff));
}

.local-ai-chapter-chip.chip-ai-model .ch-name {
  color: var(--text);
}

/* Source badges row (who created this chapter) */
.ch-source-badges {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.ch-source-badge {
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 1;
}
.ch-source-badge--existing {
  color: var(--text3);
  border-color: var(--border2);
  background: var(--surface2);
}
.ch-source-badge--automatic {
  color: #8d6226;
  border-color: #e3bf72;
  background: rgba(227,191,114,.12);
}
.ch-source-badge--reveal {
  color: #b84e43;
  border-color: #d96b5f;
  background: rgba(217,107,95,.12);
}
.ch-source-badge--model {
  opacity: 1;
}

/* Legacy: keep .ch-model-badge in case any old code references it */
.ch-model-badge {
  font-size: 10px;
  font-family: var(--mono);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid currentColor;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Proposed chapter already linked to the video: no red highlight */
.local-ai-chapter-chip.chip-proposed-linked {
  border-color: var(--border2);
  background: var(--surface);
  box-shadow: inset 4px 0 0 var(--border2);
}
.local-ai-chapter-chip.chip-proposed-linked .ch-time {
  color: var(--text3);
}

/* Existing chapter chips (read-only display) */
.local-ai-chapter-chip.chip-existing-chapter {
  opacity: 0.85;
  cursor: default;
  border-style: dashed;
  pointer-events: none;
}
.local-ai-chapter-chip.chip-existing-chapter .ch-time { color: var(--text2); }
.local-ai-chapter-chip.chip-existing-chapter .ch-name { color: var(--text); }

/* Automatic reveal chapters use a single accent shared with the existing list */
.local-ai-chapter-chip.chip-auto-reveal {
  border-color: #d87497;
  box-shadow: inset 4px 0 0 #d87497;
  background: linear-gradient(90deg, rgba(216,116,151,.10), rgba(216,116,151,.03) 18%, color-mix(in srgb, var(--surface) 98%, transparent) 55%);
}
.local-ai-chapter-chip.chip-auto-reveal:hover {
  border-color: #e78378;
}
.local-ai-chapter-chip.chip-auto-reveal.selected {
  border-color: #e78378;
  background: linear-gradient(90deg, rgba(231,131,120,.14), rgba(231,131,120,.04) 18%, color-mix(in srgb, var(--surface) 97%, transparent) 58%);
}
.local-ai-chapter-chip.chip-auto-reveal .ch-time { color: #b84e43; }
.local-ai-chapter-chip.chip-auto-reveal .ch-name { color: var(--text); }

.local-ai-chapter-chip.ch-playing.chip-auto-reveal,
.local-ai-chapter-chip.ch-playing.chip-proposed,
.local-ai-chapter-chip.ch-playing.chip-ai-model,
.local-ai-chapter-chip.ch-playing.chip-proposed-linked {
  border-color: var(--watch-accent);
  background: color-mix(in srgb, var(--watch-accent) 10%, var(--surface));
  box-shadow: 0 0 0 2px rgba(255,107,44,.28), inset 4px 0 0 var(--watch-accent), 0 6px 14px rgba(255,107,44,.10);
}

.local-ai-chapter-chip.ch-playing .ch-time,
.local-ai-chapter-chip.ch-playing.chip-auto-reveal .ch-time {
  color: var(--watch-accent);
}

/* Model chapter tags row — one pill per AI model with toggle + delete */
.ai-model-chapter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 6px;
  min-height: 0;
}
.ai-model-chapter-tags:empty { display: none; }

.ai-model-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--tag-border, #4a9eff);
  background: var(--tag-bg, #1e3a5f);
  color: var(--tag-text, #4a9eff);
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s, filter 0.15s, transform 0.15s;
}
.ai-model-tag.hidden { opacity: 0.4; }
.ai-model-tag:hover { opacity: 1; filter: brightness(1.03); transform: translateY(-1px); }

.ai-model-tag-count {
  font-size: 10px;
  opacity: 0.7;
}
.ai-model-tag-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  flex-shrink: 0;
  transition: opacity 0.1s, background 0.1s;
}
.ai-model-tag-delete:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* Dynamic model filter checkboxes in the visibility bar */
.ai-model-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 1px 7px 1px 5px;
  border-radius: 10px;
  border: 1px solid currentColor;
  font-size: 11px;
}
.ai-model-filter-label input[type="checkbox"] {
  accent-color: currentColor;
}

/* Chapter visibility filters */
.chapter-visibility-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--text2);
}
.chapter-visibility-filters label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.chapter-visibility-filters input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Delete button on proposed chapters */
.ch-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 4px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 50%;
  color: var(--text3);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ch-delete-btn:hover { background: #e53; border-color: #e53; color: #fff; }

/* Play button on proposed chapters */
.ch-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 50%;
  color: var(--text3);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ch-play-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Add-one button for Claude-proposed chapter */
.ch-apply-one-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 50%;
  color: var(--green);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.ch-apply-one-btn:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.ch-apply-one-btn:disabled {
  opacity: .45;
  cursor: default;
  color: var(--text3);
}

#viewEditor.editor-edit-mode .ch-row .btn-icon {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border2);
  border-radius: 50%;
  font-size: 10px;
  color: var(--text3);
  background: transparent;
}

#viewEditor.editor-edit-mode .local-ai-chapter-chip .btn-icon {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border2);
  border-radius: 50%;
  font-size: 10px;
  color: var(--text3);
  background: transparent;
}

#viewEditor.editor-edit-mode .ch-row .btn-icon:hover {
  border-color: var(--watch-accent);
  background: rgba(255,107,44,.12);
  color: var(--watch-accent);
}

#viewEditor.editor-edit-mode .ch-row .btn-icon.ch-favorite-btn:hover,
#viewEditor.editor-edit-mode .ch-row .btn-icon.ch-favorite-btn.is-active {
  border-color: #d4aa38;
  background: rgba(212,170,56,.14);
  color: #d4aa38;
}

#viewEditor.editor-edit-mode .local-ai-chapter-chip .btn-icon:hover {
  border-color: var(--watch-accent);
  background: rgba(255,107,44,.12);
  color: var(--watch-accent);
}

#viewEditor.editor-edit-mode .ch-row .btn-icon.del:hover {
  background: #e53;
  border-color: #e53;
  color: #fff;
}

#viewEditor.editor-edit-mode .local-ai-chapter-chip .btn-icon.ch-delete-btn:hover {
  background: #e53;
  border-color: #e53;
  color: #fff;
}

.ch-row.is-favorite .ch-n {
  color: #d4aa38;
}

/* Group labels above existing/proposed chapters */
.local-ai-chapters-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  margin: 10px 0 4px;
}

@media(max-width:980px) {
  #viewEditor.editor-edit-mode .chapters-tab-status-row .save-bar-status {
    margin-left: 0;
  }

  #viewEditor.editor-edit-mode .chapters-generated-toolbar-head {
    flex-direction: column;
    align-items: flex-start;
  }

  #viewEditor.editor-edit-mode .chapters-tab-columns {
    grid-template-columns: 1fr;
  }

  #viewEditor.editor-edit-mode .chapters-tab-column-head {
    flex-direction: column;
    align-items: flex-start;
  }

  #viewEditor.editor-edit-mode .chapters-tab-column-head p {
    text-align: left;
  }

  #viewEditor.editor-edit-mode .chapters-tab-action-bar {
    padding: 10px;
  }

  #viewEditor.editor-edit-mode .chapters-tab-thumb-picker {
    width: 100%;
    justify-content: space-between;
  }
}

/* Synopsis textarea */
.local-ai-synopsis-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 10px;
  resize: vertical;
  font-family: inherit;
}
.local-ai-synopsis-textarea:focus { outline: none; border-color: var(--accent); }

/* genre chips: chip-selected / chip-existing */
.genre-detect-results .genre-chip.chip-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.genre-detect-results .genre-chip.chip-existing {
  opacity: .5;
  cursor: default;
  text-decoration: none;
}

/* ── Synopsis model tabs ─────────────────────────────────────── */
.synopsis-model-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.synopsis-model-tabs:empty { display: none; }

.synopsis-model-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--tab-border, #4a9eff);
  border-bottom: none;
  background: transparent;
  color: var(--tab-color, #4a9eff);
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}
.synopsis-model-tab:hover { opacity: 0.9; }
.synopsis-model-tab.active {
  opacity: 1;
  background: var(--tab-bg, #1e3a5f);
  font-weight: 600;
}
.synopsis-tab-delete {
  font-size: 10px;
  opacity: 0.6;
  cursor: pointer;
  border: 1px solid currentColor;
  border-radius: 50%;
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.synopsis-tab-delete:hover { opacity: 1; background: rgba(255,255,255,0.15); }

/* ── Genres multi-model panels ───────────────────────────────── */
.genre-model-panel {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.genre-model-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.genre-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.genre-chips-row .genre-chip.chip-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.genre-chips-row .genre-chip.chip-existing {
  opacity: 0.55;
  cursor: default;
}

/* Fusion section */
.genre-fusion-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 10px 0 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.genre-chip-fusion {
  border-color: var(--accent) !important;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)) !important;
}
.genre-chip-fusion.chip-selected {
  background: var(--accent) !important;
  color: #fff !important;
}
.genre-fusion-badge {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  margin-left: 3px;
  opacity: 0.85;
}

/* Save bar */
.save-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
}

.save-bar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  padding-top: 6px;
  border-top: 1px solid var(--border2);
  margin-top: 2px;
}
.save-bar-status:not(.has-content) {
  display: none;
}

.save-st {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  line-height: 1.4;
  word-break: break-word;
}
.save-st.ok { color: var(--green); }
.save-st.err { color: var(--red); }

/* ── Emby Sync Progress Banner ─────── */
.emby-sync-progress {
  margin-top: -4px;
  margin-bottom: 12px;
  padding: 14px 16px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--blue);
  background: var(--blue-dim);
  animation: emby-sync-fadein .25s ease;
}
.emby-sync-progress.is-success {
  border-color: var(--green);
  background: var(--green-dim);
}
.emby-sync-progress.is-error {
  border-color: var(--red);
  background: var(--red-dim);
}
.emby-sync-progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.emby-sync-progress-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}
.emby-sync-progress-text {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.emby-sync-progress-track {
  height: 6px;
  background: var(--surface3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.emby-sync-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  transition: width .35s ease;
}
.emby-sync-progress.is-indeterminate .emby-sync-progress-bar {
  width: 30% !important;
  animation: emby-sync-slide 1.2s ease-in-out infinite;
}
.emby-sync-progress.is-success .emby-sync-progress-bar {
  background: linear-gradient(90deg, var(--green), #4ade80);
  width: 100% !important;
}
.emby-sync-progress.is-error .emby-sync-progress-track { display: none; }
.emby-sync-progress-detail {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
}
.emby-sync-progress.is-success .emby-sync-progress-detail { color: var(--green); }
.emby-sync-progress.is-error .emby-sync-progress-detail { color: var(--red); }
@keyframes emby-sync-fadein {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes emby-sync-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(400%); }
}

#saveLog {
  margin-top: 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}

/* ── Chapter Backup Versions ──────── */
.chapter-backup-versions {
  margin-bottom: 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface2);
  max-height: 250px;
  overflow-y: auto;
}
.backup-versions-header {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 1px solid var(--border2);
  position: sticky;
  top: 0;
  background: var(--surface2);
}
.backup-version-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.backup-version-row:last-child { border-bottom: none; }
.backup-version-row:hover { background: var(--surface); }
.bv-info {
  font-family: var(--mono);
  color: var(--text3);
  white-space: nowrap;
  min-width: 200px;
}
.bv-names {
  flex: 1;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bv-restore, .bv-delete {
  padding: 2px 6px !important;
  font-size: 11px !important;
  line-height: 1 !important;
}
.bv-delete { color: var(--red) !important; }

/* ── Metadata Section ──────────────── */
.meta-section {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 0;
}

.meta-section-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border2);
}

.meta-section-header h3 {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.meta-thumb-source-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface2) 92%, transparent), color-mix(in srgb, var(--accent) 5%, var(--surface)));
}

.meta-thumb-source-copy {
  min-width: 0;
}

.meta-thumb-source-kicker {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text3);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.meta-thumb-source-copy strong {
  display: block;
  font-size: 14px;
  letter-spacing: -.02em;
}

.meta-thumb-source-copy p {
  margin-top: 4px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.5;
}

.meta-thumb-source-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.meta-thumb-source-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text2);
  min-width: 112px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.meta-thumb-source-btn:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.meta-thumb-source-btn.is-active {
  background: linear-gradient(135deg, var(--watch-accent), #ff9a42);
  color: #fff;
  box-shadow: 0 10px 22px rgba(255,107,44,.22);
}

.meta-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.badge {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--blue-dim);
  color: var(--blue);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(59,130,246,.2);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.meta-field { display: flex; flex-direction: column; gap: 5px; }
.meta-field.full { grid-column: 1 / -1; }
.meta-field label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.meta-field input, .meta-field select, .meta-field textarea { font-size: 13px; }
.meta-field textarea { min-height: 70px; }
.meta-field .meta-autogrow {
  min-height: 38px;
  resize: none;
  overflow: hidden;
  transition: height .16s ease;
}
#metaOverview.meta-autogrow {
  min-height: 110px;
}

@media (prefers-reduced-motion: reduce) {
  .meta-field .meta-autogrow {
    transition: none;
  }
}

/* Tag input */
.tag-container { position: relative; }

.tag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 38px;
  cursor: text;
  align-items: center;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tag-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,.25);
  color: var(--blue);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s;
}
.tag-pill.chip-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tag-pill .tag-x { cursor: pointer; opacity: .7; font-size: 13px; line-height: 1; margin-left: 2px; transition: all var(--transition); }
.tag-pill .tag-x:hover { opacity: 1; color: var(--red); }
.tag-pill .genre-fusion-badge { margin-left: 6px; }

.tag-input {
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 80px;
  padding: 3px 0;
}

.tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  box-shadow: var(--shadow);
  margin-top: 4px;
}
.tag-dropdown.open { display: block; }
.tag-dd-item { padding: 7px 12px; font-size: 13px; cursor: pointer; transition: background var(--transition); }
.tag-dd-item:hover, .tag-dd-item.hl { background: var(--blue-dim); color: var(--blue); }
.tag-dd-empty { padding: 8px 12px; font-size: 12px; color: var(--text3); font-style: italic; }

.meta-save-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border2);
}

/* ── Compress Compare ──────────────── */
.cmp-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.cmp-table th, .cmp-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border2); font-size: 13px; }
.cmp-table th { color: var(--text3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface2); }
.cmp-table td.size { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.cmp-table .smaller { color: var(--green); }
.cmp-table .bigger { color: var(--red); }
.cmp-savings {
  text-align: center;
  padding: 12px;
  border-radius: var(--radius);
  margin: 10px 0;
  font-weight: 600;
  font-size: 14px;
}
.cmp-savings.good { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,.2); }
.cmp-savings.bad { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.cmp-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.cmp-actions .btn { min-width: 140px; justify-content: center; }

/* ── Compress Progress Bar ─────────── */
.compress-progress { margin: 12px 0; }
.compress-progress-track { height: 6px; background: var(--surface2); border-radius: var(--radius-full); overflow: hidden; }
.compress-progress-bar { height: 100%; background: var(--blue); border-radius: var(--radius-full); width: 0%; transition: width .4s ease; }
.compress-progress-text { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--text3); }

/* ── Modal ─────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn .15s ease; }

#dialogModal {
  z-index: 350;
}

.modal-overlay.hello-customize-open {
  background: rgba(8,12,20,.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 860px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: scaleIn .15s ease;
}

.modal-overlay.hello-customize-open .modal-box {
  max-width: 760px;
  border-radius: 22px;
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border2));
  box-shadow: 0 30px 70px rgba(0,0,0,.34), 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 42%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface2) 97%, transparent));
}

.modal-overlay.hello-customize-open .modal-header {
  border-bottom-color: color-mix(in srgb, var(--accent) 20%, var(--border2));
}

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

.modal-box h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border2);
}

.modal-header h3 { flex: 1; margin: 0; }

.modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.modal-grid .img-choice {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}
.modal-grid .img-choice:hover { border-color: var(--blue); transform: scale(1.02); }
.modal-grid .img-choice img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.modal-grid .img-choice .ic-name { padding: 5px 8px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface2); }
.modal-close { margin-top: 16px; text-align: right; display: flex; align-items: center; }

.local-ai-json-modal-box {
  width: 70vw;
  max-width: 70vw;
  height: 70vh;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.local-ai-json-content {
  flex: 1;
  min-height: 0;
  margin: 0;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text2);
  padding: 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
  white-space: pre;
}

/* ── Local AI Chapters modal ─────────────────────── */
.local-ai-section {
  margin-bottom: 14px;
}
.local-ai-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.local-ai-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.local-ai-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.local-ai-check input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}
.local-ai-slider {
  width: 100%;
  margin-top: 4px;
  accent-color: var(--accent);
}
#localAiLog {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 10px;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: 160px;
  color: var(--text2);
}
#localAiStatus {
  min-height: 18px;
}

/* ── Local AI summary table ───────── */
.local-ai-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}
.local-ai-summary-table thead th {
  text-align: left;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text3);
  border-bottom: 1px solid var(--border2);
}
.local-ai-summary-table tbody tr:hover {
  background: var(--surface);
}
.local-ai-summary-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border2);
  color: var(--text);
  vertical-align: middle;
}
.local-ai-label-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.local-ai-label-btn {
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.local-ai-label-btn:hover {
  border-color: var(--border2);
  background: var(--surface2);
}
.local-ai-label-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}
.local-ai-score-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 120px;
}
.local-ai-score-fill {
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  min-width: 2px;
}
.local-ai-score-bar span {
  font-size: 11px;
  color: var(--text3);
  min-width: 30px;
}

.local-ai-detections-panel {
  margin-top: 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface);
}
.local-ai-detections-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border2);
  font-size: 12px;
}
.local-ai-detections-head span {
  color: var(--text3);
  font-family: var(--mono);
}
.local-ai-detections-list {
  max-height: 220px;
  overflow-y: auto;
}
.local-ai-detection-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border2);
}
.local-ai-detection-row:last-child {
  border-bottom: none;
}
.local-ai-detection-tc {
  font-family: var(--mono);
  font-size: 12px;
}
.local-ai-detection-score {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
  min-width: 40px;
  text-align: right;
}
.local-ai-seek-btn {
  min-width: 30px;
  padding: 2px 8px;
}
.local-ai-detection-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--text3);
}
.local-ai-meta-box {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--border, #555);
  border-radius: 8px;
  background: var(--bg2);
  font-size: 12px;
  line-height: 1.5;
}
.local-ai-inline-note {
  margin: 0 0 10px;
  color: var(--text2);
  font-size: 12px;
}
.local-ai-diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}
.local-ai-diag-cell {
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--bg);
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--text2);
}
.local-ai-diag-cell b {
  color: var(--text1);
  font-family: var(--mono);
  font-size: 12px;
}
.local-ai-fusion-recap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.local-ai-fusion-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
}
.local-ai-fusion-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}
.local-ai-fusion-badge.reliable {
  background: rgba(76, 175, 125, .16);
  border-color: rgba(76, 175, 125, .32);
  color: #4caf7d;
}
.local-ai-fusion-badge.medium {
  background: rgba(255, 159, 64, .14);
  border-color: rgba(255, 159, 64, .28);
  color: #ff9f40;
}
.local-ai-bench-output {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text2);
  font-size: 12px;
  line-height: 1.5;
}
.local-ai-bench-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.local-ai-bench-table th,
.local-ai-bench-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border2);
  text-align: left;
  vertical-align: top;
}
.local-ai-bench-table th {
  font-size: 11px;
  color: var(--text3);
  font-weight: 700;
}
.local-ai-bench-table td {
  color: var(--text2);
}

/* ── IA Page ───────────────────────────────────────────────── */
.ia-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.ia-card {
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 90%, var(--bg)), color-mix(in srgb, var(--surface2) 72%, var(--bg)));
  padding: 14px;
}
.ia-card-llava {
  border-color: color-mix(in srgb, var(--watch-accent) 38%, var(--border2));
}
.ia-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ia-card-head h2,
.ia-position-card-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}
.ia-card-kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
}
.ia-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--watch-accent) 35%, var(--border2));
  border-radius: 999px;
  font-size: 11px;
  color: var(--watch-accent);
}
.ia-card-desc {
  margin: 0 0 12px;
  color: var(--text2);
}
.ia-position-create {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ia-position-create #iaNewPositionName {
  min-width: 260px;
  flex: 1;
}
.ia-positions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.ia-position-card {
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ia-position-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ia-position-count {
  font-size: 11px;
  color: var(--text3);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 3px 8px;
}
.ia-position-preview {
  min-height: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ia-position-linked-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.ia-position-linked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--surface2) 70%, var(--surface));
}
.ia-position-linked-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ia-position-linked-text strong {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}
.ia-position-linked-text span {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.3;
  word-break: break-word;
}
.ia-position-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: var(--surface2);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text2);
}
.ia-position-empty {
  color: var(--text3);
  font-size: 12px;
}
.ia-position-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ia-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1200;
  background: rgba(0, 0, 0, .66);
  backdrop-filter: blur(4px);
}
.ia-modal-overlay.is-open {
  display: flex;
}
.ia-modal-box {
  width: min(1120px, 100%);
  max-height: min(90vh, 880px);
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.ia-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border2);
}
.ia-modal-head h3 {
  margin: 0;
  font-size: 20px;
}
.ia-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
}
.ia-modal-toolbar #iaChapterPickerSearch {
  min-width: 260px;
  flex: 1;
}
.ia-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
}
.ia-modal-stats {
  margin-left: auto;
  font-size: 12px;
  color: var(--text3);
}
.ia-modal-results {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ia-modal-results.watch-sidebar-chapters {
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0;
}

.ia-modal-results .ia-modal-chapter-row {
  outline: none;
}

.ia-modal-results .ia-modal-chapter-row:focus-visible {
  border-color: var(--watch-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--watch-accent) 24%, transparent);
}

.ia-modal-results .ia-modal-chapter-row.is-linked {
  border-color: color-mix(in srgb, var(--green) 55%, var(--border2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--green) 28%, transparent);
}

.ia-modal-linked-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #fff;
  background: color-mix(in srgb, var(--green) 75%, #0a120f);
}

.ia-modal-results.watch-sidebar-chapters.is-list .watch-sidebar-chapter {
  grid-template-columns: 92px minmax(0, 1fr);
}

.ia-modal-results.watch-sidebar-chapters.is-list .watch-sidebar-chapter-thumb {
  width: 92px;
  min-width: 92px;
}

.ia-modal-results .watch-sidebar-chapter-index {
  max-width: 56ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 780px) {
  .ia-modal-results.watch-sidebar-chapters.is-list .watch-sidebar-chapter {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .ia-modal-results.watch-sidebar-chapters.is-list .watch-sidebar-chapter-thumb {
    width: 78px;
    min-width: 78px;
  }
}

@media (max-width: 900px) {
  .ia-modal-toolbar {
    align-items: flex-start;
  }
  .ia-modal-stats {
    width: 100%;
    margin-left: 0;
  }
}
.local-ai-bench-table tr:last-child td {
  border-bottom: none;
}
.local-ai-bench-delta-good {
  color: #4caf7d;
  font-weight: 700;
}
.local-ai-bench-delta-bad {
  color: #ff9f40;
  font-weight: 700;
}
.local-ai-bench-raw {
  margin-top: 10px;
}
.local-ai-bench-raw summary {
  cursor: pointer;
  color: var(--text3);
  font-size: 11px;
}
.local-ai-bench-raw pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}

/* ── Tags Page ─────────────────────── */
.tag-list-wrap {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#viewTags .tag-list-wrap,
#viewStudios .tag-list-wrap {
  padding: 10px;
  border-radius: 26px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 22px 54px rgba(15,23,42,.07);
}

/* Genres page uses card-board layout — no inner border/bg */
#genreListWrap {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.tag-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border2));
  transition: background var(--transition), transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
  border-radius: 18px;
  margin-bottom: 8px;
  position: relative;
}
.tag-list-item:last-child { border-bottom: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border2)); }
.tag-list-item:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface2));
  transform: translateY(-1px);
  border-color: var(--accent-border);
  box-shadow: 0 12px 26px rgba(15,23,42,.07);
}
.tag-list-item .tli-name { flex: 1; font-size: 13px; font-weight: 700; }
.tag-list-item .tli-actions { display: flex; gap: 4px; }

.tag-inline-details {
  padding: 10px 14px 12px 24px;
  border-bottom: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface2) 35%, transparent);
}

.tag-inline-details .tag-items-panel {
  margin-top: 0;
}

.tag-items-panel {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 12px;
}
.tag-items-panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.tag-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }

.no-results { text-align: center; padding: 40px 20px; color: var(--text3); font-size: 13px; }

/* ── Persons Page ──────────────────── */
#viewPersons.active { display: flex; flex-direction: column; }

/* Contrôle de taille des cartes Personnes */
.persons-size-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
.persons-size-label {
  font-size: .88rem;
  color: var(--text2);
  font-weight: 500;
  white-space: nowrap;
}
.persons-size-slider {
  width: 120px;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border2);
  outline: none;
  border-radius: 5px;
  cursor: pointer;
}
.persons-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease;
}
.persons-size-slider::-webkit-slider-thumb:hover {
  background: color-mix(in srgb, var(--accent) 120%, var(--text));
  box-shadow: 0 0 8px rgba(210, 169, 102, 0.4);
}
.persons-size-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  transition: background .2s ease, box-shadow .2s ease;
}
.persons-size-slider::-moz-range-thumb:hover {
  background: color-mix(in srgb, var(--accent) 120%, var(--text));
  box-shadow: 0 0 8px rgba(210, 169, 102, 0.4);
}
.persons-size-value {
  font-size: .88rem;
  color: var(--text2);
  font-weight: 500;
  min-width: 45px;
  text-align: right;
  cursor: pointer;
  transition: color .2s ease;
}
.persons-size-value:hover {
  color: var(--accent);
}

/* Grid de cards — auto-fill basé sur taille des cartes */
.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--person-card-width, 240px), 1fr));
  gap: 16px;
  padding: 8px 14px 28px;
}

.person-grid-loading { padding: 40px; text-align: center; color: var(--text3); font-size: 13px; }

/* Card */
.person-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 95%, transparent) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  cursor: default;
}
.person-card:hover {
  box-shadow: 0 20px 42px rgba(15,23,42,.12);
  border-color: var(--accent-border);
  transform: translateY(-3px);
}

/* Photo */
.pc-photo-wrap {
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pc-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform .3s ease;
}
.person-card:hover .pc-photo-wrap img { transform: scale(1.03); }
.pc-avatar-placeholder {
  font-size: 3.5rem;
  color: var(--text3);
}

/* Body */
.pc-body {
  padding: 10px 12px 36px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.pc-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.pc-counts {
  display: flex;
  gap: 10px;
}
.pc-count-item {
  font-size: .75rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 3px;
}
.pc-count-val {
  font-weight: 600;
  color: var(--text2);
}
.pc-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 20px;
}
.pc-genre-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: .66rem;
  font-weight: 500;
  padding: 2px 7px;
  white-space: nowrap;
}

/* Bouton crayon */
.pc-edit-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  line-height: 1;
  padding: 0;
}
.person-card:hover .pc-edit-btn { opacity: 1; }
.pc-edit-btn:hover { background: var(--blue-dim); border-color: var(--blue); }
.pc-edit-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

.pc-delete-btn {
  position: absolute;
  bottom: 8px;
  right: 42px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  line-height: 1;
  padding: 0;
}
.person-card:hover .pc-delete-btn { opacity: 1; }
.pc-delete-btn:hover { background: var(--red-dim); border-color: var(--red); }

/* Bouton favori */
.pc-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.45);
  border: 1px solid transparent;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
  line-height: 1;
  padding: 0;
  filter: grayscale(1);
}
.person-card:hover .pc-fav-btn { opacity: 1; }
.pc-fav-btn.is-fav { opacity: 1; filter: none; }
.pc-fav-btn:hover { background: rgba(0,0,0,.7); filter: none; }

/* Bouton mode favoris (toolbar) */
.persons-fav-mode-btn,
.fav-mode-btn {
  border-color: var(--border2);
  color: var(--text2);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.persons-fav-mode-btn.active,
.fav-mode-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Sections favoris (grids vidéos) */
.grid-section-header {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 45%, var(--text3));
  padding: 6px 2px 4px;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid-section-header .badge {
  background: var(--surface2);
  border-radius: var(--radius-full);
  font-size: .7rem;
  padding: 1px 7px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0;
  text-transform: none;
}
.grid-section-empty {
  color: var(--text3);
  font-size: .82rem;
  font-style: italic;
  padding: 12px 2px;
}

/* Sections favoris (personnes) */
.persons-section-header {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 45%, var(--text3));
  padding: 6px 2px 4px;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.persons-section-header .badge {
  background: var(--surface2);
  border-radius: var(--radius-full);
  font-size: .7rem;
  padding: 1px 7px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0;
  text-transform: none;
}
.persons-section-empty {
  color: var(--text3);
  font-size: .82rem;
  font-style: italic;
  padding: 12px 2px;
}

/* Modal édition */
.person-edit-modal-box {
  max-width: 760px;
  width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}
.person-edit-layout {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}
.person-edit-fields {
  flex: 1;
  min-width: 0;
}

/* Detail panel (réutilisé dans modal) */
.person-detail-img {
  width: 130px;
  flex-shrink: 0;
  position: relative;
}
.person-detail-img img { width: 100%; border-radius: var(--radius); display: block; cursor: pointer; }
.person-detail-img .pdi-placeholder { width: 100%; aspect-ratio: 2/3; background: var(--surface2); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 3rem; cursor: pointer; }
.pdi-change-btn {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
}
.person-detail-img:hover .pdi-change-btn { opacity: 1; }

.person-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.person-media-item { display: block; background: var(--surface2); border: 1px solid var(--border2); border-radius: 6px; overflow: hidden; cursor: pointer; transition: all var(--transition); text-decoration: none; color: inherit; }
.person-media-item:hover { border-color: var(--blue); }
.person-media-item img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.person-media-item .pmi-name { padding: 5px 8px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.person-media-section-title { font-size: .85rem; font-weight: 600; margin: 16px 0 8px; color: var(--text2); border-bottom: 1px solid var(--border2); padding-bottom: 4px; }

/* ── Shortcuts Modal ───────────────── */
.shortcuts-table { width: 100%; border-collapse: collapse; }
.shortcuts-table td { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--border2); }
.shortcuts-table td:first-child {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  white-space: nowrap;
  width: 110px;
  background: var(--blue-dim2);
  border-radius: 4px;
  font-weight: 600;
}

/* ── Statistics Dashboard ───────────────── */

/* Loading */
.dash-loading { display:flex; align-items:center; justify-content:center; gap:12px; padding:60px 20px; color:var(--text2); font-size:.9rem; }
.dash-spinner { width:20px; height:20px; border:2.5px solid var(--border2); border-top-color:var(--blue); border-radius:50%; animation:spin .6s linear infinite; }
.dash-spinner { border-top-color: var(--accent); }
@keyframes spin { to { transform:rotate(360deg); } }

/* KPI Cards Row */
.dash-kpi-row {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
  gap:10px;
  margin-bottom:16px;
}
.dash-kpi {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 94%, transparent) 100%);
  border:1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius:20px;
  padding:14px 12px 10px;
  text-align:center;
  transition:box-shadow .15s, transform .15s;
}
.dash-kpi:hover { box-shadow:0 18px 40px rgba(15,23,42,.10); transform:translateY(-2px); }
.dash-kpi-icon { font-size:18px; margin-bottom:2px; }
.dash-kpi-value { font-size:1.3rem; font-weight:700; color:var(--text); line-height:1.2; }
.dash-kpi-label { font-size:.65rem; color:var(--text3); text-transform:uppercase; letter-spacing:.04em; font-weight:500; margin-top:2px; }
.dash-kpi-sub { font-size:.7rem; color:var(--accent); font-weight:600; }

/* Dashboard Cards */
.dash-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 94%, transparent) 100%);
  border:1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius:20px;
  padding:16px;
  margin-bottom:12px;
  box-shadow: 0 16px 38px rgba(15,23,42,.06);
}
.dash-card-full { grid-column:1 / -1; }
.dash-card-title {
  font-size:.8rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--text2);
  margin-bottom:12px;
  padding-bottom:8px;
  border-bottom:1px solid var(--border2);
}

/* Grid layouts */
.dash-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
@media(max-width:768px) { .dash-grid-2 { grid-template-columns:1fr; } }
.dash-stats-layout {
  display:grid;
  grid-template-columns:minmax(0, 1.1fr) minmax(320px, .9fr);
  gap:12px;
  margin-bottom:12px;
}
.dash-stats-main,
.dash-stats-side { min-width:0; }
.dash-stats-side .dash-card:last-child { margin-bottom:0; }
@media(max-width:980px) {
  .dash-stats-layout { grid-template-columns:1fr; }
}

/* Health bars */
.dash-health-row { margin-bottom:10px; }
.dash-health-info { display:flex; justify-content:space-between; font-size:.78rem; color:var(--text2); margin-bottom:4px; }
.dash-health-nums { font-weight:600; color:var(--text); }
.dash-health-note { font-size:.78rem; color:var(--text3); padding-top:8px; border-top:1px solid var(--border2); margin-top:8px; }
.dash-health-note.is-pending { color: var(--yellow); }
.dash-health-note.is-saved { color: var(--green); }
.dash-health-note.is-error { color: var(--red); }

.stats-range-card {
  margin-bottom: 14px;
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border2));
  background:
    radial-gradient(1200px 240px at 0% -40%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, transparent) 0%, color-mix(in srgb, var(--surface2) 95%, transparent) 100%);
}

.stats-range-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.stats-range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.stats-range-calendar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stats-range-month {
  border: 1px solid color-mix(in srgb, var(--accent) 13%, var(--border2));
  border-radius: 14px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface2) 85%, transparent);
}

.stats-range-month-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

.stats-range-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.stats-range-weekdays span {
  text-align: center;
  font-size: .62rem;
  color: var(--text3);
  font-weight: 700;
}

.stats-range-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.stats-range-day {
  width: 100%;
  min-width: 0;
  height: 32px;
  border-radius: 9px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  transition: transform .14s ease, border-color .14s ease, background .14s ease, color .14s ease;
}

.stats-range-day.is-empty {
  background: transparent;
  border-color: transparent;
}

.stats-range-day.is-disabled {
  opacity: .32;
  color: var(--text3);
  background: color-mix(in srgb, var(--surface2) 86%, transparent);
}

.stats-range-day.is-clickable {
  cursor: pointer;
}

.stats-range-day.is-clickable:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border2));
  color: var(--text);
}

.stats-range-day.lvl-1 { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.stats-range-day.lvl-2 { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); }
.stats-range-day.lvl-3 { background: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
.stats-range-day.lvl-4 { background: color-mix(in srgb, var(--accent) 42%, var(--surface)); color: #fff; }

.stats-range-day.is-in-range {
  background: color-mix(in srgb, var(--accent) 30%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 36%, var(--accent-border));
}

.stats-range-day.is-start,
.stats-range-day.is-end,
.stats-range-day.is-single {
  background: var(--accent-gradient);
  border-color: var(--accent-border);
  color: #fff;
  box-shadow: 0 8px 16px color-mix(in srgb, var(--accent) 28%, transparent);
}

.stats-range-day.is-today {
  outline: 1px dashed color-mix(in srgb, var(--accent) 42%, var(--text3));
  outline-offset: -3px;
}

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

.stats-range-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border2));
  background: color-mix(in srgb, var(--surface2) 90%, transparent);
  color: var(--text2);
  font-size: .72rem;
  font-weight: 700;
}

.stats-range-status.is-custom {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.stats-range-label {
  font-size: .8rem;
  color: var(--text2);
}

/* Bar charts */
.dash-bar-row { display:grid; grid-template-columns:80px 1fr 70px; align-items:center; gap:8px; margin-bottom:6px; text-decoration:none; color:inherit; }
.dash-bar-row-wide { grid-template-columns:minmax(90px, 140px) 1fr 90px; }
.dash-bar-label { font-size:.75rem; font-weight:500; color:var(--text2); text-align:right; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-bar-track { height:8px; background:var(--surface2); border-radius:4px; overflow:hidden; }
.dash-bar-fill { height:100%; border-radius:4px; transition:width .4s ease; }
.dash-bar-val { font-size:.72rem; color:var(--text2); font-weight:500; }

/* Top lists */
.dash-top-list { display:flex; flex-direction:column; gap:2px; }
.top-videos-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.top-videos-title {
  min-width:0;
}
.top-videos-toolbar {
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:8px;
}
.top-videos-filter-group {
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--accent) 16%, var(--border2));
  background:color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.top-videos-filter-btn {
  border:0;
  background:transparent;
  color:var(--text2);
  border-radius:999px;
  padding:7px 12px;
  font-size:.75rem;
  font-weight:700;
  letter-spacing:.01em;
  cursor:pointer;
  transition:background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.top-videos-filter-btn:hover {
  color:var(--text);
  background:color-mix(in srgb, var(--accent) 10%, transparent);
}
.top-videos-filter-btn.active {
  color:#fff;
  background:var(--accent-gradient);
  box-shadow:0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent);
}
.top-videos-filter-btn:focus-visible {
  outline:none;
  box-shadow:0 0 0 3px var(--accent-soft);
}
.dash-top-item {
  display:flex; align-items:center; gap:10px;
  padding:6px 8px; border-radius:6px; cursor:pointer;
  transition:background .12s;
}
.dash-top-item:hover { background:var(--surface2); }
.dash-top-item:hover { background: color-mix(in srgb, var(--accent) 6%, var(--surface2)); }
.dash-top-rank { font-size:.72rem; font-weight:700; color:var(--text3); min-width:24px; }
.dash-top-thumb { width:40px; height:40px; border-radius:6px; object-fit:cover; flex-shrink:0; background:var(--surface2); }
.dash-top-thumb-empty { display:flex; align-items:center; justify-content:center; font-size:16px; }
.stats-thumb-badge-wrap {
  position:relative;
  display:inline-block;
  line-height:0;
  flex-shrink:0;
}
.stats-thumb-provider-badge {
  position:absolute;
  top:4px;
  right:4px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 6px;
  border-radius:999px;
  background:rgba(13,18,32,.78);
  border:1px solid rgba(255,255,255,.28);
  color:#fff;
  font-size:9px;
  font-weight:800;
  letter-spacing:.04em;
  line-height:1;
  text-transform:uppercase;
  pointer-events:none;
}
.dash-top-info { flex:1; min-width:0; }
.dash-top-name { font-size:.78rem; font-weight:500; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dash-top-meta { font-size:.68rem; color:var(--text3); display:flex; flex-wrap:wrap; gap:4px 10px; }
.dash-top-date { color:var(--text3); }
.dash-top-missing {
  color:var(--yellow);
  font-weight:700;
}
.dash-top-views { font-size:1.15rem; font-weight:700; color:var(--accent); min-width:30px; text-align:center; flex-shrink:0; line-height:1; }
.dash-top-thumb-round { border-radius:50%; }
.view-count-btn {
  background:color-mix(in srgb, var(--accent) 8%, var(--surface));
  border:1px solid color-mix(in srgb, var(--accent) 16%, var(--border2));
  color:var(--accent);
  border-radius:999px;
  padding:5px 9px;
  font-size:11px;
  cursor:pointer;
  opacity:.88;
  transition:opacity .15s, transform .15s, border-color .15s, background .15s;
}
.view-count-btn:hover {
  opacity:1;
  transform:translateY(-1px);
  background:color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color:var(--accent-border);
}
.dash-empty { font-size:.8rem; color:var(--text3); padding:20px; text-align:center; }

/* Activity Calendar */
.cal-container { overflow-x:auto; padding:4px 0; }
.cal-months { display:grid; grid-template-columns:30px repeat(var(--cal-weeks, 53), 1fr); gap:2px; margin-bottom:4px; font-size:.6rem; color:var(--text3); }
.cal-day-spacer { width:30px; }
.cal-grid { display:grid; grid-template-columns:30px repeat(var(--cal-weeks, 53), 1fr); grid-template-rows:repeat(7, 1fr); gap:2px; }
.cal-day-label { font-size:.55rem; color:var(--text3); display:flex; align-items:center; justify-content:flex-end; padding-right:4px; }
.cal-cell { aspect-ratio:1; border-radius:4px; cursor:pointer; transition:outline .1s, transform .14s ease, box-shadow .14s ease; min-width:8px; min-height:8px; }
.cal-cell:hover { outline:1px solid color-mix(in srgb, var(--accent) 22%, var(--text3)); transform:translateY(-1px); box-shadow:0 4px 10px rgba(0,0,0,.18); }
.cal-0 { background:var(--surface2); cursor:default; }
.cal-0:hover { outline:none; }
.cal-1 { background:color-mix(in srgb, var(--accent) 24%, var(--surface2)); }
.cal-2 { background:color-mix(in srgb, var(--accent) 44%, var(--surface2)); }
.cal-3 { background:color-mix(in srgb, var(--accent) 68%, #2f1708); }
.cal-4 { background:var(--accent); }
.cal-future { background:transparent; cursor:default; }
.cal-future:hover { outline:none; }
.cal-legend { display:flex; align-items:center; gap:4px; margin-top:8px; font-size:.6rem; color:var(--text3); }
.cal-legend-cell { cursor:default; }
.cal-legend-cell:hover { outline:none; }

@media (max-width: 720px) {
  .stats-range-calendar {
    grid-template-columns: 1fr;
  }

  .stats-range-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .top-videos-toolbar {
    width:100%;
    justify-content:flex-start;
  }

  .top-videos-filter-group {
    width:100%;
    justify-content:flex-start;
    overflow-x:auto;
  }
}

/* Session History */
.session-block { border:1px solid var(--border2); border-radius:8px; overflow:hidden; margin-bottom:8px; }
.session-toggle {
  display:flex; align-items:flex-start; gap:10px;
  flex-wrap:wrap;
  padding:10px 14px; cursor:pointer;
  background:var(--surface2);
  transition:background .12s;
  user-select:none;
}
.session-toggle:hover { background:var(--border2); }
.toggle-arrow { font-size:.85rem; color:var(--text3); flex-shrink:0; width:14px; }
.session-date { font-size:1.05rem; font-weight:600; color:var(--text); white-space:normal; line-height:1.25; }
.session-badges {
  display:flex; flex-wrap:wrap; gap:6px; margin-left:auto;
}
.session-open-page-btn {
  margin-left:8px;
  flex-shrink:0;
}
.session-badge {
  font-size:.82rem; font-weight:500; color:var(--text2);
  background:var(--surface); border:1px solid var(--border2);
  padding:3px 10px; border-radius:10px; white-space:nowrap;
}
.session-body { display:none; padding:12px 14px; }
.session-body.open { display:block; }

.session-view-switch {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:12px;
}
.session-view-btn {
  border:1px solid var(--border2);
  background:var(--surface);
  color:var(--text2);
  border-radius:999px;
  padding:7px 12px;
  font-size:.78rem;
  font-weight:600;
  cursor:pointer;
  transition:background .12s, border-color .12s, color .12s;
}
.session-view-btn:hover {
  background:var(--surface2);
  color:var(--text);
}
.session-view-btn.active {
  background:var(--accent-gradient);
  border-color:transparent;
  color:#fff;
}
.session-order-btn {
  border:1px solid var(--border2);
  background:var(--surface);
  color:var(--text2);
  border-radius:999px;
  padding:7px 12px;
  font-size:.78rem;
  font-weight:600;
  cursor:pointer;
  transition:background .12s, border-color .12s, color .12s;
}
.session-order-btn:hover {
  background:var(--surface2);
  color:var(--text);
}
.session-order-btn.active {
  background:var(--accent-gradient);
  border-color:transparent;
  color:#fff;
}
.session-view-panel + .session-view-panel { margin-top:12px; }
.session-block[data-view="day"] .session-view-panel-split { display:none; }
.session-block[data-view="split"] .session-view-panel-day { display:none; }


.subsession-card {
  margin-top:12px;
  padding:14px;
  border:1px solid var(--border2);
  border-radius:10px;
  background:var(--surface);
}
.subsession-card:first-child { margin-top:0; }
.subsession-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  padding-bottom:10px;
  border-bottom:1px solid var(--border2);
}
.subsession-title {
  font-size:.92rem;
  font-weight:700;
  color:var(--text);
}
.subsession-range {
  font-size:.78rem;
  color:var(--text3);
  margin-top:2px;
}
.subsession-meta {
  font-size:.74rem;
  color:var(--text2);
  text-align:right;
}
@media(max-width:768px) {
  .subsession-head {
    flex-direction:column;
    align-items:flex-start;
  }
  .subsession-meta { text-align:left; }
}

.session-summary {
  margin-top:14px;
  border:1px solid var(--border2);
  border-radius:10px;
  background:linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  padding:14px;
}
.session-summary-title {
  font-size:.78rem;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--text2);
  margin-bottom:10px;
}
.session-summary-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:10px;
}
.session-summary-item {
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:10px 12px;
  min-width:0;
  border-radius:8px;
  border:1px solid var(--border2);
  background:rgba(255,255,255,.02);
}
.session-summary-item strong {
  font-size:.9rem;
  color:var(--text);
  line-height:1.35;
  overflow-wrap:anywhere;
}
.session-summary-label {
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--text3);
}
.session-summary-item-wide { grid-column:span 2; }
@media(max-width:768px) {
  .session-summary-item-wide { grid-column:span 1; }
}

/* Session video grid */
.session-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:10px;
  margin-bottom:10px;
}
.session-grid.session-grid-chronological { display:none; }
.session-block[data-order-mode="chrono"] .session-grid.session-grid-compact { display:none; }
.session-block[data-order-mode="chrono"] .session-grid.session-grid-chronological { display:grid; }
.session-vid {
  cursor:pointer;
  border-radius:8px;
  overflow:hidden;
  transition:box-shadow .12s, transform .12s;
  background:var(--surface2);
  text-decoration:none;
  color:inherit;
}
.session-vid:hover { box-shadow:0 2px 8px rgba(0,0,0,.1); transform:translateY(-1px); }
.session-thumb-wrap { position:relative; aspect-ratio:16/9; background:var(--border2); overflow:hidden; }
.session-thumb { width:100%; height:100%; object-fit:cover; }
.session-thumb-empty { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:24px; }
.session-vid-chronological {
  border:1px solid var(--border2);
  background:linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
}
.session-vid-order {
  position:absolute;
  top:6px;
  left:6px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  height:24px;
  padding:0 8px;
  border-radius:999px;
  background:rgba(0,0,0,.72);
  color:#fff;
  font-size:.72rem;
  font-weight:700;
}
.session-vid-dur {
  position:absolute; bottom:4px; right:4px;
  background:rgba(0,0,0,.75); color:#fff;
  font-size:.75rem; font-weight:600; padding:2px 6px;
  border-radius:3px; font-family:var(--mono);
}
.session-vid-name { font-size:.9rem; font-weight:500; color:var(--text); padding:6px 8px 4px; white-space:normal; word-wrap:break-word; overflow-wrap:break-word; line-height:1.3; }
.session-vid-time { font-size:.75rem; color:var(--text3); padding:0 8px 6px; }
.session-timeline-btn { margin-top:4px; font-size:.72rem; }

/* Cross-highlight: dim non-matching siblings */
.session-block.hl-active .session-vid:not(.hl-on) { opacity:.3; transition:opacity .15s; }
.session-block.hl-active .session-vid.hl-on { opacity:1; }
.session-block.hl-active .timeline-event:not(.hl-on) { opacity:.15; transition:opacity .15s; }
.session-block.hl-active .timeline-event.hl-on { filter:brightness(1.3); box-shadow:0 0 6px currentColor; }
.stats-focus-pulse { animation:statsFocusPulse 1.6s ease; }
@keyframes statsFocusPulse {
  0% { box-shadow:0 0 0 0 color-mix(in srgb, var(--accent) 28%, transparent); }
  50% { box-shadow:0 0 0 6px color-mix(in srgb, var(--accent) 10%, transparent); }
  100% { box-shadow:none; }
}

/* Modal overlay */
.dash-modal-overlay {
  position:fixed; inset:0; z-index:500;
  background:rgba(0,0,0,.5); backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center;
  animation:fadeIn .15s;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.dash-modal {
  background:var(--bg); border:1px solid var(--border);
  border-radius:12px; max-width:900px; width:92vw;
  max-height:85vh; overflow-y:auto;
  box-shadow:0 12px 40px rgba(0,0,0,.2);
}
.dash-modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border2);
  position:sticky; top:0; background:var(--bg); z-index:1;
}
.dash-modal-header h3 { font-size:.95rem; font-weight:600; color:var(--text); margin:0; }
.dash-modal-close {
  background:none; border:none; font-size:18px; cursor:pointer; color:var(--text3);
  padding:4px 8px; border-radius:4px; transition:background .12s;
}
.dash-modal-close:hover { background:var(--surface2); color:var(--text); }
.dash-modal-body { padding:20px; }
.dash-modal-summary {
  display:flex; flex-wrap:wrap; gap:16px;
  font-size:.82rem; color:var(--text2);
  padding:10px 14px; background:var(--surface2);
  border-radius:8px; margin-bottom:16px;
}
.dash-modal-summary-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(170px, 1fr));
  gap:10px;
  margin-bottom:16px;
}
.dash-modal-stat {
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:12px 14px;
  border:1px solid var(--border2);
  border-radius:10px;
  background:linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  min-width:0;
}
.dash-modal-stat strong {
  color:var(--text);
  font-size:.93rem;
  line-height:1.35;
  overflow-wrap:anywhere;
}
.dash-modal-stat-label {
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--text3);
}
.dash-modal-stat-wide { grid-column:span 2; }
.dash-modal-section { margin-bottom:18px; }
.dash-modal-section:last-child { margin-bottom:0; }
@media(max-width:768px) {
  .dash-modal-stat-wide { grid-column:span 1; }
}

/* Mini calendar in modal */
.dash-mini-cal { margin-bottom:16px; }
.dash-mini-cal-title { font-size:.78rem; font-weight:600; color:var(--text2); margin-bottom:8px; }
.dash-mini-cal .cal-container { padding:0; }
.dash-mini-cal .cal-cell { cursor:default; }
.dash-mini-cal .cal-cell:hover { outline:none; }

.video-history-days {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
  gap:10px;
}
.video-history-day-card {
  border:1px solid var(--border2);
  border-radius:10px;
  padding:12px 14px;
  background:var(--surface);
}
.video-history-day-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.video-history-day-title {
  font-size:.82rem;
  font-weight:700;
  color:var(--text);
  line-height:1.35;
}
.video-history-day-range {
  font-size:.72rem;
  color:var(--text3);
  margin-top:3px;
}
.video-history-day-total {
  font-size:1rem;
  font-weight:700;
  color:var(--accent);
  white-space:nowrap;
}
.video-history-day-metrics {
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:.76rem;
  color:var(--text2);
}
.video-history-day-metrics b { color:var(--text); }

/* Timeline */
.timeline-container { position:relative; margin-bottom:16px; }
.timeline-zoom-toolbar {
  display:flex;
  align-items:center;
  gap:6px;
  margin:0 0 10px;
  flex-wrap:wrap;
  padding:4px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--accent) 22%, var(--border2));
  background:color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.timeline-zoom-label {
  font-size:.72rem;
  color:var(--text2);
  font-weight:700;
  padding:0 8px 0 6px;
  white-space:nowrap;
}
.timeline-zoom-range {
  width:min(220px, 42vw);
  accent-color:var(--accent);
}
.timeline-zoom-value {
  font-size:.72rem;
  color:var(--accent);
  min-width:52px;
  text-align:center;
  font-weight:800;
  border-radius:999px;
  padding:6px 10px;
  background:color-mix(in srgb, var(--accent) 10%, transparent);
}
.timeline-zoom-step {
  min-width:30px;
  padding:5px 8px;
}
.timeline-zoom-reset {
  padding:5px 10px;
}
.timeline-zoom-toolbar .timeline-zoom-step,
.timeline-zoom-toolbar .timeline-zoom-reset {
  border:0;
  background:transparent;
  color:var(--text2);
  border-radius:999px;
  font-size:.74rem;
  font-weight:800;
  transition:background .14s ease, color .14s ease, box-shadow .14s ease;
}
.timeline-zoom-toolbar .timeline-zoom-step:hover,
.timeline-zoom-toolbar .timeline-zoom-reset:hover {
  color:var(--text);
  background:color-mix(in srgb, var(--accent) 10%, transparent);
}
.timeline-zoom-toolbar .timeline-zoom-step:disabled,
.timeline-zoom-toolbar .timeline-zoom-reset:disabled {
  opacity:.45;
  cursor:not-allowed;
}
.timeline-zoom-toolbar--story {
  margin:2px 0 12px;
}
.timeline-health-summary-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin:0 0 8px;
}
.timeline-health-summary-row--story {
  margin:8px 0 10px;
}
.timeline-health-summary-chip {
  display:inline-flex;
  align-items:center;
  padding:4px 9px;
  border-radius:999px;
  font-size:.72rem;
  color:var(--text2);
  background:color-mix(in srgb, var(--surface) 90%, transparent);
  border:1px solid color-mix(in srgb, var(--border2) 90%, transparent);
}
.timeline-zoom-toolbar--inline {
  margin:0;
  margin-left:auto;
  border-color:color-mix(in srgb, var(--accent) 28%, var(--border2));
  background:color-mix(in srgb, var(--accent) 12%, var(--surface));
}

@media (max-width: 900px) {
  .timeline-health-summary-row--story {
    align-items:flex-start;
  }
  .timeline-zoom-toolbar--inline {
    margin-left:0;
    width:100%;
    justify-content:flex-start;
  }
  .timeline-zoom-range {
    width:min(260px, 62vw);
  }
}
.timeline-scroll {
  overflow-x:auto;
  overflow-y:hidden;
  padding-bottom:4px;
}
.timeline-stage {
  --timeline-zoom: 1;
  min-width:100%;
}
.timeline-hours { position:relative; height:24px; margin-bottom:4px; border-bottom:1px solid var(--border2); }
.timeline-stage .timeline-hours,
.timeline-stage .timeline-events {
  width:calc(100% * var(--timeline-zoom));
  min-width:100%;
}
.timeline-hour {
  position:absolute; top:0; font-size:.6rem; color:var(--text3);
  transform:translateX(-50%); white-space:nowrap;
}
.timeline-hour.is-edge-start {
  transform:none;
}
.timeline-hour.is-edge-end {
  transform:translateX(-100%);
}
.timeline-events {
  position:relative; height:46px; background:var(--surface2);
  border-radius:6px; overflow:hidden;
}
.timeline-hr-overlay {
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:1;
}
.timeline-hr-svg {
  width:100%;
  height:100%;
  display:block;
}
.timeline-hr-line {
  fill:none;
  stroke:#ef4444;
  stroke-width:2.2;
  stroke-linecap:round;
  stroke-linejoin:round;
  opacity:.95;
}
.timeline-hr-baseline {
  stroke:#fca5a5;
  stroke-width:1;
  stroke-dasharray:5 4;
  opacity:.9;
}
.timeline-event {
  position:absolute; top:16px; height:24px;
  border-radius:4px; opacity:.85;
  transition:opacity .12s;
  cursor:pointer;
  z-index:2;
}
.timeline-event:hover { opacity:1; z-index:2; box-shadow:0 0 0 2px var(--text); }
.timeline-hover-card {
  position:fixed;
  z-index:1200;
  width:min(320px, calc(100vw - 24px));
  display:none;
  grid-template-columns:112px minmax(0, 1fr);
  gap:12px;
  padding:10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(14,19,25,.96);
  box-shadow:0 18px 38px rgba(0,0,0,.35);
  pointer-events:none;
}
.timeline-hover-card.visible { display:grid; }
.timeline-hover-thumb-wrap {
  width:112px;
  height:63px;
  overflow:hidden;
  border-radius:8px;
  background:rgba(255,255,255,.06);
}
.timeline-hover-thumb {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.timeline-hover-thumb-hidden {
  opacity:0;
}
.timeline-hover-thumb-state {
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  padding:3px 6px;
  font-size:10px;
  line-height:1.2;
  color:rgba(255,255,255,.92);
  text-align:center;
  background:linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.72) 100%);
  pointer-events:none;
}
.timeline-hover-thumb-loading {
  background:
    linear-gradient(90deg, rgba(255,255,255,.06) 0%, rgba(255,255,255,.16) 48%, rgba(255,255,255,.06) 100%),
    linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.72) 100%);
  background-size:220% 100%, 100% 100%;
  animation: timelineHoverThumbShimmer 1.1s linear infinite;
}
.timeline-hover-thumb-error {
  color:rgba(255,235,235,.94);
}
.timeline-hover-thumb-empty {
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:24px;
  color:#fff;
}
@keyframes timelineHoverThumbShimmer {
  0% { background-position: 160% 0, 0 0; }
  100% { background-position: -60% 0, 0 0; }
}
.timeline-hover-body { min-width:0; align-self:center; }
.timeline-hover-title {
  font-size:.88rem;
  font-weight:700;
  color:#fff;
  line-height:1.3;
  overflow-wrap:anywhere;
}
.timeline-hover-subtitle {
  margin-top:4px;
  font-size:.74rem;
  color:rgba(255,255,255,.74);
  line-height:1.35;
}
@media(max-width:640px) {
  .session-badges { margin-left:0; width:100%; }
  .timeline-hover-card {
    grid-template-columns:88px minmax(0, 1fr);
    gap:10px;
  }
  .timeline-hover-thumb-wrap {
    width:88px;
    height:50px;
  }
}
.timeline-legend { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.timeline-legend-item { display:flex; align-items:center; gap:6px; font-size:.72rem; color:var(--text2); }
.timeline-legend-color { width:12px; height:12px; border-radius:3px; flex-shrink:0; }
.timeline-legend-health {
  margin-top:8px;
}
.timeline-legend-color-hr {
  background:linear-gradient(90deg, #ef4444 0%, #fb7185 100%);
}
.timeline-legend-color-baseline {
  background:repeating-linear-gradient(90deg, #fca5a5 0 4px, transparent 4px 8px);
  border:1px solid #fca5a5;
  box-sizing:border-box;
}
.timeline-legend-item small { color:var(--text3); }
/* Timeline video list */
.timeline-video-list { display:flex; flex-direction:column; gap:6px; }
.timeline-video-item {
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:8px; cursor:pointer;
  transition:background .12s;
}
.timeline-video-item:hover { background:var(--surface2); }
.timeline-video-color { width:4px; height:36px; border-radius:2px; flex-shrink:0; }
.timeline-video-thumb { width:56px; height:32px; border-radius:4px; object-fit:cover; flex-shrink:0; background:var(--surface2); }
.timeline-video-thumb-empty { display:flex; align-items:center; justify-content:center; font-size:16px; }
.timeline-video-info { flex:1; min-width:0; }
.timeline-video-name { font-size:.8rem; font-weight:500; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.timeline-video-meta { font-size:.68rem; color:var(--text3); }
.stats-metric-row {
  align-items:center;
}
.stats-metric-row.is-clickable {
  cursor:pointer;
}
.stats-metric-row.is-clickable:hover .dash-bar-label {
  color:var(--text);
}
.stats-metric-label-wrap {
  min-width:0;
  display:flex;
  align-items:center;
  gap:8px;
}
.stats-metric-thumb {
  width:34px;
  height:34px;
  object-fit:cover;
  border-radius:8px;
  flex:0 0 auto;
  background:var(--surface2);
}
.stats-metric-thumb.is-round {
  border-radius:50%;
}
.stats-metric-thumb-empty {
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
}
.stats-analysis-list {
  display:grid;
  gap:10px;
}
.stats-analysis-line {
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 82%, transparent), color-mix(in srgb, var(--surface2) 88%, transparent));
  color:var(--text2);
  font-size:.82rem;
  line-height:1.45;
}
.stats-health-ai-actions {
  margin-top:10px;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.stats-health-ai-status {
  font-size:.74rem;
  color:var(--text3);
}
.stats-health-ai-output {
  margin-top:10px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border2);
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 84%, transparent), color-mix(in srgb, var(--surface2) 90%, transparent));
  color:var(--text2);
  font-size:.8rem;
  line-height:1.5;
  white-space:pre-wrap;
  min-height:42px;
}

/* Data table */
.dash-table {
  width:100%; border-collapse:collapse; font-size:.78rem;
}
.dash-table th {
  text-align:left; font-weight:600; color:var(--text3);
  font-size:.68rem; text-transform:uppercase; letter-spacing:.04em;
  padding:8px 10px; border-bottom:2px solid var(--border2);
}
.dash-table td { padding:8px 10px; border-bottom:1px solid var(--border2); color:var(--text2); }
.dash-table tr:hover td { background:var(--surface2); }

/* Dedicated day stats page */
.stats-day-page {
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:20px;
}
.stats-day-header {
  position:relative;
  overflow:hidden;
  border-radius:24px;
  padding:22px 24px;
  background:
    radial-gradient(circle at top left, rgba(255,107,44,.28), transparent 38%),
    radial-gradient(circle at 85% 20%, rgba(59,130,246,.18), transparent 30%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, #190f0a) 0%, color-mix(in srgb, var(--surface2) 86%, #1e293b) 100%);
  border:1px solid color-mix(in srgb, var(--accent) 18%, var(--border2));
  box-shadow:0 22px 60px rgba(15,23,42,.12);
}
.stats-day-header::after {
  content:'';
  position:absolute;
  inset:auto -40px -70px auto;
  width:220px;
  height:220px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 70%);
  pointer-events:none;
}
.stats-day-eyebrow {
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.18em;
  color:var(--accent);
  font-weight:700;
  margin-bottom:6px;
}
.stats-day-header-actions {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.stats-day-hero-pill {
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  color:var(--text);
  font-size:.78rem;
  font-weight:600;
  max-width:320px;
}
.stats-day-layout {
  display:grid;
  grid-template-columns:minmax(0, 1.3fr) minmax(320px, .7fr);
  gap:14px;
  align-items:start;
}
.stats-day-card-grid {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
  align-items:start;
}
.stats-day-card-item {
  position:relative;
  min-width:0;
}
.stats-day-card-item .dash-card {
  margin-bottom:0;
  height:100%;
}
.stats-day-card-item.is-dragging {
  opacity:.58;
}
.stats-day-card-item.is-drop-target .dash-card {
  border-color:var(--accent);
  box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent), 0 20px 44px rgba(15,23,42,.12);
}
.stats-day-card-title-row {
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}
.stats-day-card-title-row .dash-card-title {
  margin-bottom:0;
}
.stats-day-card-drag {
  position:static;
  cursor:grab;
  min-width:40px;
  flex:0 0 auto;
  align-self:flex-start;
}
.stats-day-card-drag:active {
  cursor:grabbing;
}
.stats-day-main,
.stats-day-side { min-width:0; }
.stats-day-main {
  display:flex;
  flex-direction:column;
  gap:14px;
}
.stats-day-card-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.stats-day-card-head .stats-day-card-drag {
  order:-1;
}
.stats-day-story-toggle {
  margin-left:auto;
  flex:0 0 auto;
}
.stats-day-side {
  display:flex;
  flex-direction:column;
  gap:14px;
  position:sticky;
  top:14px;
}
.stats-day-page.is-story-expanded .stats-day-layout {
  grid-template-columns:1fr;
}
.stats-day-page.is-story-expanded .stats-day-card-grid {
  grid-template-columns:1fr;
}
.stats-day-page.is-story-expanded .stats-day-side {
  display:none;
}
.stats-day-page.is-story-expanded .stats-day-story-card {
  box-shadow:0 24px 60px rgba(15,23,42,.14);
}
.stats-day-story-card { overflow:hidden; }
.stats-day-spotlight {
  border:none;
  margin-bottom:0;
  background:transparent;
}
.stats-day-spotlight .session-view-switch { margin-bottom:16px; }
.stats-day-comment-input {
  width:100%;
  min-height:180px;
  resize:vertical;
  border-radius:16px;
  border:1px solid color-mix(in srgb, var(--accent) 16%, var(--border2));
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  color:var(--text);
  padding:14px 16px;
  line-height:1.5;
  font:inherit;
}
.stats-day-comment-input:focus {
  outline:none;
  border-color:color-mix(in srgb, var(--accent) 44%, var(--border2));
  box-shadow:0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}
.stats-day-comment-actions {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:12px;
  flex-wrap:wrap;
}
.stats-day-comment-status { font-size:.76rem; color:var(--text3); }
.stats-day-comment-status.is-pending { color:var(--yellow); }
.stats-day-comment-status.is-saved { color:var(--green); }
.stats-day-comment-status.is-error { color:var(--red); }
.stats-day-top-videos-grid {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}
.stats-day-top-video-tile {
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
}
.stats-day-top-video-label {
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--text3);
  font-weight:700;
}
.stats-day-top-video-body {
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:12px;
  border-radius:18px;
  border:1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  text-decoration:none;
  color:inherit;
}
.stats-day-top-video-body.is-clickable {
  cursor:pointer;
  transition:transform .15s, box-shadow .15s, border-color .15s;
}
.stats-day-top-video-body.is-clickable:hover {
  transform:translateY(-2px);
  box-shadow:0 16px 34px rgba(15,23,42,.10);
  border-color:color-mix(in srgb, var(--accent) 28%, var(--border2));
}
.stats-day-top-video-tile.is-repeated .stats-day-top-video-body {
  box-shadow:inset 0 0 0 1px rgba(239,68,68,.12);
}
.stats-day-top-video-tile.is-dominant .stats-day-top-video-body {
  box-shadow:inset 0 0 0 1px rgba(245,158,11,.14);
}
.stats-day-top-video-thumb {
  width:100%;
  aspect-ratio:16 / 10;
  object-fit:cover;
  border-radius:14px;
  background:var(--surface2);
}
.stats-day-top-video-thumb-empty {
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:2rem;
}
.stats-day-top-video-title {
  font-size:.92rem;
  font-weight:700;
  color:var(--text);
  line-height:1.35;
}
.stats-day-top-video-meta {
  font-size:.76rem;
  color:var(--text3);
  line-height:1.45;
}
.stats-day-top-video-empty {
  padding:18px 14px;
  border-radius:16px;
  border:1px dashed var(--border2);
  color:var(--text3);
  font-size:.82rem;
  text-align:center;
}
.stats-day-facts {
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
}
.stats-day-fact {
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border2);
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
}
.stats-day-fact span {
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--text3);
}
.stats-day-fact strong { color:var(--text); line-height:1.35; }
.stats-day-fact-sub {
  font-size:.74rem;
  color:var(--text3);
  line-height:1.4;
}
.stats-day-marked-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
  flex-wrap:wrap;
  color:var(--text2);
}
.stats-day-marked-help { font-size:.75rem; color:var(--text3); max-width:520px; line-height:1.45; }
.stats-day-marked-chips {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:14px;
}
.stats-day-marked-chip {
  display:inline-flex;
  align-items:center;
  padding:7px 11px;
  border-radius:999px;
  background:rgba(255,107,44,.12);
  border:1px solid rgba(255,107,44,.22);
  color:var(--text);
  font-size:.76rem;
  font-weight:600;
}
.stats-day-marked-empty { margin-bottom:14px; color:var(--text3); font-size:.82rem; }
.stats-day-selection-intro {
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin-bottom:12px;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), color-mix(in srgb, var(--accent) 3%, var(--surface2)));
  color:var(--text2);
  line-height:1.45;
  font-size:.8rem;
}
.stats-day-selection-intro strong {
  color:var(--accent);
  font-size:.74rem;
  letter-spacing:.05em;
  text-transform:uppercase;
  flex:0 0 auto;
  padding-top:1px;
}
.stats-day-selection-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  flex-wrap:wrap;
}
.stats-day-selection-summary {
  font-size:.76rem;
  color:var(--text3);
}
.stats-day-video-selection {
  display:flex;
  flex-direction:column;
  gap:10px;
}
.stats-day-quick-item {
  display:grid;
  grid-template-columns:72px minmax(0, 1fr) auto;
  gap:12px;
  padding:12px;
  align-items:center;
  border-radius:16px;
  border:1px solid var(--border2);
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 96%, transparent) 100%);
  transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.stats-day-quick-item:hover {
  transform:translateY(-1px);
  box-shadow:0 12px 28px rgba(15,23,42,.08);
}
.stats-day-quick-item.is-marked {
  border-color:rgba(255,107,44,.35);
  box-shadow:0 10px 26px rgba(255,107,44,.10);
}
.stats-day-quick-item.is-session-open {
  border-color:color-mix(in srgb, var(--accent) 26%, var(--border2));
  box-shadow:0 18px 34px rgba(255,107,44,.12);
}
.stats-day-quick-media {
  display:flex;
  align-items:center;
}
.stats-day-select-thumb {
  width:72px;
  height:72px;
  object-fit:cover;
  border-radius:12px;
  background:var(--surface2);
}
.stats-day-select-thumb-empty {
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:28px;
}
.stats-day-quick-main {
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.stats-day-quick-session-name {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px 10px;
  font-size:.72rem;
  font-weight:800;
  color:var(--accent);
  text-transform:uppercase;
  letter-spacing:.05em;
}
.stats-day-quick-session-name span {
  color:var(--text3);
  font-weight:700;
  text-transform:none;
  letter-spacing:0;
}
.stats-day-select-name {
  font-size:.92rem;
  font-weight:700;
  color:var(--text);
  line-height:1.35;
}
.stats-day-quick-flag {
  display:inline-flex;
  align-items:center;
  width:max-content;
  padding:5px 10px;
  border-radius:999px;
  background:var(--accent-gradient);
  color:#fff;
  font-size:.7rem;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.stats-day-select-meta {
  font-size:.76rem;
  color:var(--text3);
  line-height:1.45;
}
.stats-day-inline-log-strip {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:2px;
}
.stats-day-inline-log-chip {
  display:inline-flex;
  align-items:center;
  gap:8px;
  max-width:100%;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--accent) 18%, var(--border2));
  background:color-mix(in srgb, var(--accent) 8%, var(--surface));
  color:var(--text2);
  font-size:.72rem;
  font-weight:700;
  cursor:pointer;
  transition:background .14s ease, border-color .14s ease, transform .14s ease;
}
.stats-day-inline-log-chip:hover {
  background:color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color:var(--accent-border);
  transform:translateY(-1px);
}
.stats-day-inline-log-chip-label {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.stats-day-inline-log-chip-remove {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  border-radius:999px;
  background:rgba(255,255,255,.12);
  color:var(--text);
  font-size:.9rem;
  line-height:1;
}
.stats-day-scope-label {
  font-size:.7rem;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--text3);
  font-weight:700;
}
.stats-day-scope-select {
  width:min(100%, 340px);
  min-height:38px;
  border-radius:12px;
  border:1px solid color-mix(in srgb, var(--accent) 14%, var(--border2));
  background:color-mix(in srgb, var(--surface) 96%, transparent);
  color:var(--text);
  padding:0 12px;
}
.stats-day-quick-actions {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.stats-day-quick-count {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:34px;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,107,44,.12);
  border:1px solid rgba(255,107,44,.18);
  color:var(--accent);
  font-size:.72rem;
  font-weight:800;
}
.stats-day-quick-session-panel {
  grid-column:2 / -1;
  display:grid;
  grid-template-columns:minmax(180px, 1fr) auto minmax(220px, 340px) auto;
  align-items:center;
  gap:10px;
  margin-top:2px;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid color-mix(in srgb, var(--accent) 14%, var(--border2));
  background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface)), color-mix(in srgb, var(--accent) 3%, var(--surface2)));
  flex-wrap:wrap;
}
.stats-day-quick-session-panel[hidden] {
  display:none !important;
}
.stats-day-quick-session-copy {
  min-width:0;
}
.stats-day-quick-session-title {
  font-size:.8rem;
  font-weight:800;
  color:var(--text);
}
.stats-day-quick-session-help {
  font-size:.72rem;
  color:var(--text3);
  line-height:1.4;
}
.stats-day-scope-select:focus {
  outline:none;
  border-color:color-mix(in srgb, var(--accent) 42%, var(--border2));
  box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}
.stats-day-table-panel.is-collapsed .stats-day-table-row-extra {
  display:none;
}
.stats-day-table-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  flex-wrap:wrap;
}
.stats-day-table-summary {
  font-size:.76rem;
  color:var(--text3);
}
.stats-day-table-toggle {
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--accent) 14%, var(--border2));
  background:color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.stats-day-table-toggle-label {
  padding:0 8px 0 6px;
  font-size:.74rem;
  font-weight:700;
  color:var(--text2);
}
.stats-day-table-toggle-btn {
  border:0;
  background:transparent;
  color:var(--text2);
  border-radius:999px;
  padding:7px 12px;
  font-size:.74rem;
  font-weight:800;
  cursor:pointer;
  transition:background .14s ease, color .14s ease, box-shadow .14s ease;
}
.stats-day-table-toggle-btn:hover {
  color:var(--text);
  background:color-mix(in srgb, var(--accent) 10%, transparent);
}
.stats-day-table-toggle-btn.is-active {
  background:var(--accent-gradient);
  color:#fff;
  box-shadow:0 8px 16px rgba(255,107,44,.18);
}
.stats-day-log-list {
  display:flex;
  flex-direction:column;
  gap:10px;
}
.stats-day-log-item {
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid var(--border2);
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
}
.stats-day-log-rank {
  width:34px;
  height:34px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,107,44,.12);
  color:var(--accent);
  font-weight:800;
  font-size:.78rem;
  flex:0 0 auto;
}
.stats-day-log-main {
  min-width:0;
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.stats-day-log-title {
  font-size:.86rem;
  font-weight:700;
  color:var(--text);
  line-height:1.35;
}
.stats-day-log-meta {
  font-size:.74rem;
  color:var(--text3);
}
.stats-day-session-editor {
  display:flex;
  flex-direction:column;
  gap:12px;
}
.stats-day-session-editor-help {
  font-size:.75rem;
  color:var(--text3);
  line-height:1.45;
}
.stats-day-session-range-row {
  display:grid;
  grid-template-columns:36px minmax(140px, 1.1fr) minmax(0, 1fr) 18px minmax(0, 1fr) auto;
  gap:8px;
  align-items:center;
  margin-bottom:8px;
}
.stats-day-session-range-index {
  font-size:.74rem;
  color:var(--text3);
  font-weight:700;
}
.stats-day-session-name,
.stats-day-session-time {
  width:100%;
  min-height:36px;
  border-radius:10px;
  border:1px solid var(--border2);
  background:var(--surface);
  color:var(--text);
  padding:0 10px;
}
.stats-day-session-range-sep {
  color:var(--text3);
  text-align:center;
}
.stats-day-session-range-empty {
  font-size:.8rem;
  color:var(--text3);
}
.stats-day-session-editor-actions {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.stats-day-bar-meta {
  margin:-2px 0 8px 0;
  font-size:.7rem;
  color:var(--text3);
}
.stats-day-hour-strip {
  display:flex;
  flex-direction:column;
  gap:10px;
}
.stats-day-hour-strip-scale {
  position:relative;
  height:20px;
}
.stats-day-hour-marker {
  position:absolute;
  top:0;
  transform:translateX(-50%);
  font-size:.68rem;
  color:var(--text3);
  white-space:nowrap;
}
.stats-day-hour-strip-line {
  display:grid;
  grid-template-columns:repeat(24, minmax(0, 1fr));
  gap:4px;
  padding:4px;
  border-radius:12px;
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.05));
  border:1px solid var(--border2);
}
.stats-day-hour-segment {
  height:22px;
  border-radius:999px;
  background:linear-gradient(90deg, #ff9a62 0%, #ff6b2c 100%);
  box-shadow:0 8px 18px rgba(255,107,44,.18);
}
.stats-day-hour-strip-meta {
  font-size:.72rem;
  color:var(--text3);
}
@media(max-width:1040px) {
  .stats-day-layout { grid-template-columns:1fr; }
  .stats-day-card-grid { grid-template-columns:1fr; }
  .stats-day-side { position:static; }
}
@media(max-width:720px) {
  #statsContent { padding:14px; }
  .stats-day-page { padding:14px; }
  .stats-day-header { padding:18px; }
  .stats-day-top-videos-grid {
    grid-template-columns:1fr;
  }
  .stats-day-hour-marker {
    font-size:.62rem;
  }
  .stats-day-session-range-row {
    grid-template-columns:1fr;
  }
  .session-open-page-btn { margin-left:0; }
  .stats-day-selection-intro {
    flex-direction:column;
    gap:6px;
  }

  .stats-day-selection-toolbar {
    flex-direction:column;
    align-items:stretch;
  }

  .stats-day-quick-item {
    grid-template-columns:64px minmax(0, 1fr);
  }

  .stats-day-table-toolbar,
  .stats-day-quick-actions,
  .stats-day-quick-session-panel {
    grid-column:1 / -1;
    justify-content:flex-start;
  }

  .stats-day-quick-session-panel {
    grid-template-columns:1fr;
  }

  .stats-day-table-toggle {
    width:100%;
    justify-content:space-between;
  }

  .stats-day-select-thumb {
    width:64px;
    height:64px;
  }
}

/* ── Batch Selection ───────────────── */

/* Card in batch mode */
.card.batch-item {
  cursor: pointer;
  transition: outline var(--transition), box-shadow var(--transition), background var(--transition);
  position: relative;
}
.card.batch-item:hover {
  outline: 2px solid var(--blue);
  background: var(--blue-dim2);
}
.card.batch-selected {
  outline: 2px solid var(--blue) !important;
  background: var(--blue-dim) !important;
}

/* Checkmark overlay on card */
.batch-check {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  transition: background var(--transition), border-color var(--transition);
}
.card.batch-selected .batch-check {
  background: var(--blue);
  border-color: var(--blue);
}

/* Batch bar — floating bottom bar */
.batch-bar {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 18px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  transition: bottom .25s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  min-width: 420px;
}
.batch-bar.open {
  bottom: 24px;
}
#batchCount {
  font-size: .82rem;
  font-weight: 600;
  color: var(--blue);
}

/* Batch modal groups */
.batch-action-group {
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.batch-action-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text3);
  margin-bottom: 8px;
}
.batch-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Mode selector row */
.batch-mode-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.batch-mode-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .06em;
  flex-shrink: 0;
}
.batch-mode-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

/* Field rows */
.batch-field-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.batch-field-row--action { align-items: center; }
.batch-field-label {
  flex-shrink: 0;
  width: 80px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding-top: 9px;
}
.batch-field-row--action .batch-field-label { padding-top: 0; }
.batch-field-input {
  flex: 1;
  display: flex;
  gap: 8px;
  min-width: 0;
}
.batch-field-input .tag-container { flex: 1; min-width: 0; }

/* Apply button row */
.batch-apply-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 4px;
}
.batch-apply-hint {
  font-size: .8rem;
  color: var(--text3);
  font-style: italic;
}

/* Divider between metadata and actions */
.batch-divider {
  height: 1px;
  background: var(--border2);
  margin: 14px 0;
}

/* Batch result message */
.batch-running {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .83rem;
  color: var(--text2);
  padding: 8px 0;
}
.batch-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.batch-done {
  font-size: .84rem;
  color: var(--green);
  font-weight: 600;
  padding: 8px 0;
}
.batch-warn {
  color: var(--yellow);
}

/* ── Utility ───────────────────────── */
.divider { height: 1px; background: var(--border2); margin: 12px 0; }

/* ── Responsive ────────────────────── */
@media (max-width: 1024px) {
  .ed-top-row {
    flex-direction: column;
  }
  #viewEditor.editor-edit-mode .ed-top-row:not(.is-portrait) {
    flex-direction: row;
    align-items: flex-start;
  }
  .ed-meta-col .meta-section {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .topbar { padding: 0 14px; }
  .topbar-logo-text { display: none; }
  .topbar-logo-badge { display: none; }
  .meta-grid { grid-template-columns: 1fr; }
  .filter-groups { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .ch-row { flex-wrap: wrap; }
  .pbar { gap: 5px; }
  .sub-row { grid-template-columns: 1fr; }
  .sub-time { justify-content: flex-start; }
  .subtitle-speaker-row { grid-template-columns: 1fr; }
  .sub-speaker-chip { justify-self: start; }
}

@media (max-width: 480px) {
  .topbar-search { display: none; }
}

/* ── Move Video Modal ──────────────────────────────────────── */
.move-modal-box {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.move-modal-box .modal-header {
  padding: 20px 24px 16px;
  margin: 0;
}

.move-current-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
}
.move-current-label {
  font-size: 12px;
  color: var(--text3);
  flex-shrink: 0;
}
.move-current-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Breadcrumb inside move modal */
.move-breadcrumb {
  padding: 10px 24px 8px;
  border-bottom: 1px solid var(--border2);
  background: var(--bg);
}
.move-breadcrumb .bc-sep {
  color: var(--text3);
  margin: 0 2px;
  font-size: 14px;
}

/* Folder grid */
.move-folder-grid {
  flex: 1;
  overflow-y: auto;
  max-height: 340px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
}

.move-grid-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  color: var(--text3);
  font-size: 13px;
}
.move-grid-loading .connect-spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
}
.move-grid-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  line-height: 1.7;
}

/* Each folder row */
.move-folder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid transparent;
}
.move-folder-item:hover {
  background: var(--surface2);
  border-color: var(--border2);
}
.move-item-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.move-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.move-folder-icon-txt { font-size: 20px; line-height: 1; }
.move-item-info { flex: 1; min-width: 0; }
.move-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.move-item-path {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.move-item-path--virtual {
  font-style: italic;
  color: var(--text3);
}
.move-item-arrow {
  color: var(--text3);
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.move-folder-item:hover .move-item-arrow { color: var(--blue); }

/* Destination bar */
.move-dest-bar {
  padding: 12px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border2);
}
.move-dest-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.move-dest-label {
  font-weight: 600;
  color: var(--text2);
  flex-shrink: 0;
}
.move-dest-path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  font-weight: 500;
  word-break: break-all;
}
.move-dest-warn { color: var(--yellow); font-size: 12px; }
.move-dest-hint { color: var(--text3); font-size: 12px; }

/* Status message */
.move-status {
  min-height: 20px;
  font-size: 12.5px;
  padding: 0 24px 4px;
  font-family: var(--mono);
  line-height: 1.5;
  color: var(--text3);
}
.move-status--loading { color: var(--text2); }
.move-status--ok { color: var(--green); font-weight: 600; }
.move-status--error { color: var(--red); }
.move-status--warn { color: var(--yellow); }

.move-progress-wrap {
  padding: 0 24px 10px;
}

.move-progress-track {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface2) 88%, #000 12%);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border2) 82%, transparent);
}

.move-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--blue) 82%, #67e8f9 18%), color-mix(in srgb, var(--accent) 70%, #93c5fd 30%));
  transition: width .35s ease;
}

.move-progress-meta {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text2);
}

.move-log {
  margin: 0 24px 10px;
  max-height: 150px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--border2) 88%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface2) 94%, transparent);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text2);
}

.move-log-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.move-log-line--error { color: var(--red); }
.move-log-line--warn { color: var(--yellow); }
.move-log-line--ok { color: var(--green); }

.move-modal-box .modal-close {
  padding: 12px 24px 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border2);
}

/* ── Task Queue ──────────────────────────────────────────────── */
.tasks-badge-pill {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 1;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  margin-left: auto;
}
.tasks-summary {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .75rem 0 1rem;
}
.tasks-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 600; padding: .2rem .6rem;
  border-radius: 20px; border: 1px solid transparent;
}
.tasks-badge--running { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.tasks-badge--pending { background: rgba(234,179,8,.1); color: var(--yellow); border-color: var(--yellow); }
.tasks-badge--done    { background: var(--green-dim); color: var(--green); border-color: var(--green); }

.tasks-section-title {
  font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3); padding: .5rem 0 .4rem; border-bottom: 1px solid var(--border2);
  margin-bottom: .5rem;
}
.tasks-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.5rem; }

.task-item {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 94%, transparent) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 18px; padding: .9rem 1rem; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.task-item:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(15,23,42,.08); }
.task-item--running { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.task-item--done    { border-color: var(--border2); }
.task-item--error   { border-color: var(--red); background: rgba(239,68,68,.03); }
.task-item--skipped { opacity: .75; }
.task-item--cancelled { opacity: .55; }

.task-item-header {
  display: flex; align-items: center; gap: .6rem; min-height: 28px;
}
.task-status-icon {
  font-size: .95rem; min-width: 20px; text-align: center; line-height: 1;
}
.task-item--running .task-status-icon { color: var(--accent); animation: spin 2s linear infinite; }
.task-item--done .task-status-icon    { color: var(--green); }
.task-item--error .task-status-icon   { color: var(--red); }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.task-item-name {
  flex: 1; font-size: .875rem; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-item-actions {
  display: flex; align-items: center; gap: .4rem; flex-shrink: 0;
}
.task-speed {
  font-size: .75rem; font-family: var(--mono); color: var(--text3); min-width: 40px; text-align: right;
}

.task-progress-wrap { margin-top: .6rem; }
.task-progress-track {
  height: 6px; background: var(--border2); border-radius: 3px; overflow: hidden; margin-bottom: .4rem;
}
.task-progress-bar {
  height: 100%; background: var(--accent-gradient); border-radius: 3px;
  transition: width .8s ease; min-width: 2px;
}
.task-progress-info {
  display: flex; gap: 1rem; font-size: .75rem; font-family: var(--mono);
}
.task-pct    { color: var(--accent); font-weight: 600; }
.task-time   { color: var(--text2); }
.task-elapsed { color: var(--text3); margin-left: auto; }

.task-result {
  margin-top: .5rem; font-size: .8rem; color: var(--text2); font-family: var(--mono);
}
.task-result--good { color: var(--green); }
.task-result--bad  { color: var(--yellow); }
.task-meta { margin-top: .3rem; font-size: .75rem; color: var(--text3); }

.cache-warmup-card {
  margin-bottom: 1rem;
}

.cache-warmup-summary {
  padding: .6rem 0 .7rem;
}

.cache-warmup-controls {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin-top: .55rem;
}

.cache-warmup-controls label {
  font-size: .75rem;
  color: var(--text3);
  font-weight: 600;
}

.cache-warmup-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--text2);
  padding: 0 .2rem;
}

.cache-warmup-toggle input {
  transform: translateY(1px);
}

.cache-warmup-folder-input {
  min-width: 260px;
  max-width: 420px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: .8rem;
}

.cache-warmup-folder-input:disabled {
  opacity: .65;
}

.cache-warmup-picker {
  margin-top: .65rem;
  border: 1px solid var(--border2);
  background: var(--surface2);
  border-radius: 12px;
  padding: .55rem;
}

.cache-warmup-picker-head {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .45rem;
}

.cache-warmup-picker-breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: .45rem;
}

.cache-warmup-picker-sep {
  color: var(--text3);
  font-size: .8rem;
}

.cache-warmup-picker-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: 220px;
  overflow: auto;
}

.cache-warmup-picker-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--surface);
}

.cache-warmup-picker-name {
  font-size: .82rem;
  color: var(--text2);
}

.garmin-sync-card {
  margin-bottom: 1rem;
}

.perf-debug-card {
  margin-bottom: 1rem;
  border-color: color-mix(in srgb, var(--blue) 22%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 95%, transparent) 0%, color-mix(in srgb, var(--blue) 6%, var(--surface2)) 100%);
}

.perf-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: .45rem .8rem;
  margin-top: .6rem;
}

.perf-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  color: var(--text2);
  padding: .28rem .35rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 8%, var(--border2));
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
}

.perf-toggle-row input {
  transform: translateY(1px);
}

body.perf-layout-contain-disabled .card,
body.perf-layout-contain-disabled .hello-video-grid,
body.perf-layout-contain-disabled .hello-horizontal-rail {
  contain: none !important;
}

body.perf-layout-contain-disabled .hello-hero,
body.perf-layout-contain-disabled .hello-section {
  content-visibility: visible !important;
  contain-intrinsic-size: auto !important;
}

.garmin-sync-log {
  margin-top: .7rem;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  max-height: 220px;
  overflow: auto;
  padding: .55rem .65rem;
  display: flex;
  flex-direction: column;
  gap: .28rem;
}

.garmin-sync-log-line {
  display: grid;
  grid-template-columns: max-content max-content 1fr;
  gap: .45rem;
  align-items: start;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.35;
  color: var(--text2);
  text-align: left;
}

.garmin-sync-log-time {
  color: var(--text3);
}

.garmin-sync-log-level {
  font-weight: 700;
  letter-spacing: .02em;
}

.garmin-sync-log-level--warn {
  color: var(--yellow);
}

.garmin-sync-log-level--error {
  color: var(--red);
}

.garmin-sync-log-level--info {
  color: var(--accent);
}

.garmin-sync-log-msg {
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 760px) {
  .garmin-sync-log-line {
    grid-template-columns: 1fr;
    gap: .12rem;
  }
}

/* ── AI model selector ─────────────────────── */
.ai-model-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: .78rem;
  font-family: var(--sans);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.ai-model-select:hover, .ai-model-select:focus {
  border-color: var(--accent);
}

/* ── AI search bar ─────────────────────────── */
.ai-search-wrap {
  padding: .6rem 0 .25rem;
}
.ai-search-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border2));
  border-radius: 20px;
  padding: .45rem .75rem;
  box-shadow: 0 14px 34px rgba(15,23,42,.05);
}
.ai-search-label {
  font-size: .8rem;
  color: var(--text2);
  white-space: nowrap;
  font-weight: 500;
}
.ai-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .85rem;
  font-family: var(--sans);
}
.ai-search-input::placeholder { color: var(--text3); }
.ai-search-badge {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .4rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  padding: .2rem .75rem;
  font-size: .78rem;
  color: var(--accent);
  width: fit-content;
}
.ai-badge-clear {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: .85rem;
  padding: 0 2px;
  line-height: 1;
}
.ai-badge-clear:hover { color: var(--red); }

/* ── AI mode toggle button ─────────────────────── */
.ai-mode-toggle {
  background: var(--surface3);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: .76rem;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.ai-mode-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ai-mode-toggle.ai-mode-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Défis Modal ─────────────────────────────── */
.defis-modal-box {
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.defis-form-grid {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}

.defis-field label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 4px;
  letter-spacing: .02em;
}

.defis-hint {
  display: block;
  font-size: .70rem;
  color: var(--text3);
  font-style: italic;
  margin-top: 2px;
}

.defis-field textarea,
.defis-field input[type="number"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: .85rem;
  padding: .45rem .6rem;
  resize: vertical;
  transition: border-color var(--transition);
}

.defis-field textarea:focus,
.defis-field input[type="number"]:focus {
  outline: none;
  border-color: var(--blue);
}

.defis-field--row {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.defis-field--row label {
  margin-bottom: 0;
  white-space: nowrap;
}

.defis-options-row {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  margin-bottom: 1.1rem;
}

@media (min-width: 520px) {
  .defis-options-row { flex-direction: row; gap: 1.5rem; }
  .defis-option-group { flex: 1; }
}

.defis-option-group > label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: .4rem;
  letter-spacing: .02em;
}

.defis-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.defis-radio {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .82rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: .25rem .65rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  user-select: none;
}

.defis-radio:has(input:checked) {
  background: var(--blue-dim);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}

.defis-radio input { display: none; }

.defis-slider-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.defis-slider-label {
  font-size: .75rem;
  color: var(--text3);
  white-space: nowrap;
}

.defis-slider {
  flex: 1;
  accent-color: #e11d48;
}

.defis-slider-val {
  font-size: .78rem;
  font-weight: 700;
  color: #e11d48;
  min-width: 28px;
  text-align: right;
}

.defis-actions {
  display: flex;
  justify-content: center;
  padding-top: .25rem;
}

.defis-gen-btn {
  font-size: .9rem;
  padding: .6rem 1.8rem;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  box-shadow: 0 14px 34px rgba(255,107,44,.24);
}

.defis-gen-btn:hover { opacity: .9; transform: translateY(-1px); }
.defis-gen-btn:active { transform: translateY(0); }

/* Result panel */
.defis-result-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.defis-result-header > :not(.defis-result-badge) {
  flex-shrink: 0;
}

.defis-result-badge {
  flex: 1;
  min-width: 100%;
  order: -1;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text3);
}

.defis-text-wrap {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 22px;
  padding: 1.1rem 1.2rem;
  margin-top: .5rem;
}

.defis-text {
  font-size: .9rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Améliorations de lisibilité pour le coaching */
.defis-text-wrap {
  max-height: 60vh;
  overflow-y: auto;
}

.defis-view-meta {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  border-left: 3px solid var(--accent);
  padding-left: .75rem;
}

.defis-view-meta span {
  display: block;
  color: var(--text2);
}

.defis-view-meta strong {
  color: var(--text);
}

/* Défis List (Page) */
.defis-list-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.defis-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 94%, transparent) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 22px;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.defis-card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 18px 42px rgba(15,23,42,.10);
  transform: translateY(-2px);
}

.defis-card-header {
  padding: .9rem .95rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.defis-card-badge {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.defis-card-date {
  font-size: .72rem;
  color: var(--text3);
  white-space: nowrap;
}

.defis-card-meta {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .7rem .95rem;
  border-bottom: 1px solid var(--border2);
  font-size: .78rem;
  color: var(--text2);
}

.defis-card-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.defis-card-text {
  padding: .9rem .95rem;
  flex: 1;
  font-size: .85rem;
  line-height: 1.5;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.defis-card-actions {
  padding: .7rem .95rem;
  border-top: 1px solid var(--border2);
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: space-between;
}

.defis-checkbox-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  padding: .25rem .4rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.defis-checkbox-label:hover { background: var(--surface2); }

.defis-done-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--green);
}

.defis-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text3);
}

/* Défis Preferences Section */
.defis-preferences-section {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 10%, var(--border2));
  border-radius: 24px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(15,23,42,.06);
}

.defis-preferences-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}

.defis-preferences-header h3 {
  margin: 0;
  font-size: .9rem;
  color: var(--text);
}

.defis-preferences-header button {
  transition: transform var(--transition);
}

.defis-preferences-header button.collapsed {
  transform: rotate(-90deg);
}

.defis-preferences-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
}

.defis-pref-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.defis-pref-field label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text2);
}

.defis-pref-field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: .85rem;
  padding: .45rem .6rem;
  resize: vertical;
  transition: border-color var(--transition);
}

.defis-pref-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

#viewGenres .gc-card,
#viewGenres .gc-card-uncat {
  border-radius: 24px;
  border-color: color-mix(in srgb, var(--accent) 10%, var(--border2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent) 0%, color-mix(in srgb, var(--surface2) 94%, transparent) 100%);
  box-shadow: 0 18px 40px rgba(15,23,42,.06);
}

#viewGenres .gc-genre-pill,
#viewGenres .gc-genre-pill-uncat {
  background: var(--accent-softer);
  border-color: var(--accent-border);
}

#viewStats .dash-card-title,
#viewTasks .tasks-section-title,
#viewDefis .defis-preferences-header h3,
#viewPersons .pc-count-val {
  color: color-mix(in srgb, var(--accent) 55%, var(--text));
}

.defis-pref-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-top: .4rem;
}

.defis-pref-actions button {
  font-size: .78rem;
}

/* ── Notifications ──────────────────────────────────────────── */
.notif-bell { position: relative; font-size: 16px; padding: 6px 8px; background: none; border: none; color: var(--text2); cursor: pointer; border-radius: 6px; }
.notif-bell:hover { color: var(--text); background: var(--surface2); }
.notif-badge { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; line-height: 1; }

.panic-btn {
  position: relative;
  font-size: 16px;
  padding: 6px 8px;
  border-radius: 8px;
}

.panic-btn.is-active {
  color: #fff;
  background: linear-gradient(135deg, #ca8a04, #ef4444);
  box-shadow: 0 10px 26px rgba(239,68,68,.22);
}

.global-secret-btn.is-active {
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #0ea5e9);
  box-shadow: 0 10px 26px rgba(14,165,233,.24);
}

.panic-btn.is-redirected {
  animation: panicPulse 900ms ease-in-out infinite;
}

@keyframes panicPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.panic-neutral-screen {
  position: fixed;
  inset: 0;
  z-index: 11050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 12% 8%, rgba(56,189,248,.22), transparent 42%),
    radial-gradient(circle at 90% 16%, rgba(34,197,94,.18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(99,102,241,.16), transparent 48%),
    linear-gradient(150deg, #0b1120 0%, #0f172a 46%, #111827 100%);
}

.panic-neutral-screen.open {
  display: flex;
}

.panic-neutral-frame {
  width: min(900px, 96vw);
  position: relative;
}

.panic-neutral-card {
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.25);
  background: linear-gradient(180deg, rgba(15,23,42,.9), rgba(15,23,42,.78));
  backdrop-filter: blur(10px);
  box-shadow: 0 28px 80px rgba(2,6,23,.58), inset 0 1px 0 rgba(255,255,255,.04);
  padding: 24px;
  color: #e2e8f0;
}

.panic-neutral-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panic-neutral-kicker {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(148,163,184,.95);
}

.panic-neutral-chip {
  border-radius: 999px;
  border: 1px solid rgba(34,197,94,.45);
  padding: 3px 10px;
  font-size: 11px;
  color: #bbf7d0;
  background: rgba(22,163,74,.18);
}

.panic-neutral-title {
  margin: 10px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
  color: #f8fafc;
  letter-spacing: .01em;
}

.panic-neutral-text {
  margin: 10px 0 0;
  color: rgba(203,213,225,.94);
  font-size: 14px;
  max-width: 72ch;
}

.panic-neutral-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.panic-neutral-tile {
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(30,41,59,.62), rgba(15,23,42,.72));
  padding: 12px;
}

.panic-neutral-tile span {
  display: block;
  font-size: 11px;
  color: rgba(148,163,184,.95);
  text-transform: uppercase;
  letter-spacing: .09em;
}

.panic-neutral-tile strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  color: #f1f5f9;
}

.panic-neutral-tile em {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-style: normal;
  color: rgba(148,163,184,.95);
}

.panic-neutral-log {
  margin-top: 14px;
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 12px;
  background: rgba(2,6,23,.4);
  overflow: hidden;
}

.panic-neutral-log-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid rgba(148,163,184,.14);
}

.panic-neutral-log-row:first-child {
  border-top: 0;
}

.panic-neutral-log-row span {
  color: rgba(148,163,184,.95);
  font-size: 11px;
  font-family: var(--mono);
}

.panic-neutral-log-row b {
  color: #dbeafe;
  font-size: 13px;
  font-weight: 600;
}

.panic-config-panel {
  position: fixed;
  top: 62px;
  right: 14px;
  width: min(360px, calc(100vw - 24px));
  z-index: 11060;
  display: none;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, #000 4%), color-mix(in srgb, var(--surface2) 96%, #000 4%));
  box-shadow: 0 18px 46px rgba(2,6,23,.45);
  padding: 12px;
  gap: 10px;
}

.panic-config-panel.open {
  display: grid;
}

.panic-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
}

.panic-config-field {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--text2);
}

.panic-config-field input,
.panic-config-field select {
  width: 100%;
}

.panic-config-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.panic-config-actions-right {
  display: flex;
  gap: 8px;
}

@media (max-width: 760px) {
  .panic-neutral-card {
    padding: 16px;
  }

  .panic-neutral-grid {
    grid-template-columns: 1fr;
  }

  .panic-neutral-log-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

body.panic-mask img,
body.panic-mask picture,
body.panic-mask video,
body.panic-mask canvas,
body.panic-mask svg image,
body.global-secret-mode img,
body.global-secret-mode picture,
body.global-secret-mode video,
body.global-secret-mode canvas,
body.global-secret-mode svg image {
  opacity: 0 !important;
  visibility: hidden !important;
}

body.panic-mask [style*="background-image"],
body.global-secret-mode [style*="background-image"] {
  background-image: none !important;
}

body.panic-mask .card-img-wrap,
body.panic-mask .card-img,
body.panic-mask .card-img-poster,
body.panic-mask .watch-sidebar-chapter-thumb,
body.panic-mask .watch-side-poster,
body.panic-mask .player-wrap,
body.panic-mask .tl-preview,
body.panic-mask .hello-hero,
body.panic-mask .hello-card,
body.global-secret-mode .card-img-wrap,
body.global-secret-mode .card-img,
body.global-secret-mode .card-img-poster,
body.global-secret-mode .watch-sidebar-chapter-thumb,
body.global-secret-mode .watch-side-poster,
body.global-secret-mode .player-wrap,
body.global-secret-mode .tl-preview,
body.global-secret-mode .hello-hero,
body.global-secret-mode .hello-card {
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--surface2) 90%, #000), color-mix(in srgb, var(--surface2) 90%, #000) 10px, color-mix(in srgb, var(--surface) 92%, #000) 10px, color-mix(in srgb, var(--surface) 92%, #000) 20px) !important;
}

body.panic-mask h1,
body.panic-mask h2,
body.panic-mask h3,
body.panic-mask h4,
body.panic-mask h5,
body.panic-mask h6,
body.panic-mask [class*="title"],
body.panic-mask [id*="Title"],
body.panic-mask .card-sub,
body.panic-mask .card-extra,
body.panic-mask .card-search-excerpt,
body.panic-mask .watch-display-tagline,
body.panic-mask .watch-side-synopsis,
body.panic-mask .watch-overview-text,
body.panic-mask .watch-pill,
body.panic-mask .watch-fact,
body.panic-mask .si-meta,
body.global-secret-mode h1,
body.global-secret-mode h2,
body.global-secret-mode h3,
body.global-secret-mode h4,
body.global-secret-mode h5,
body.global-secret-mode h6,
body.global-secret-mode [class*="title"],
body.global-secret-mode [id*="Title"],
body.global-secret-mode .card-sub,
body.global-secret-mode .card-extra,
body.global-secret-mode .card-search-excerpt,
body.global-secret-mode .hello-feature-overview,
body.global-secret-mode .hello-customize-switch-desc,
body.global-secret-mode .watch-display-tagline,
body.global-secret-mode .watch-side-synopsis,
body.global-secret-mode .watch-overview-text,
body.global-secret-mode .watch-pill,
body.global-secret-mode .watch-fact,
body.global-secret-mode .si-meta {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none !important;
  user-select: none;
}

body.panic-mask h1::selection,
body.panic-mask h2::selection,
body.panic-mask h3::selection,
body.panic-mask h4::selection,
body.panic-mask h5::selection,
body.panic-mask h6::selection,
body.panic-mask [class*="title"]::selection,
body.panic-mask [id*="Title"]::selection,
body.panic-mask .card-sub::selection,
body.panic-mask .card-extra::selection,
body.panic-mask .watch-overview-text::selection,
body.global-secret-mode h1::selection,
body.global-secret-mode h2::selection,
body.global-secret-mode h3::selection,
body.global-secret-mode h4::selection,
body.global-secret-mode h5::selection,
body.global-secret-mode h6::selection,
body.global-secret-mode [class*="title"]::selection,
body.global-secret-mode [id*="Title"]::selection,
body.global-secret-mode .card-sub::selection,
body.global-secret-mode .card-extra::selection,
body.global-secret-mode .hello-feature-overview::selection,
body.global-secret-mode .hello-customize-switch-desc::selection,
body.global-secret-mode .watch-overview-text::selection {
  background: transparent;
}

body.global-secret-mode #tabNav .sidebar-item[data-tab="genres"],
body.global-secret-mode #tabNav .sidebar-item[data-tab="studios"],
body.global-secret-mode #tabNav .sidebar-item[data-tab="persons"],
body.global-secret-mode #tabNav .sidebar-item[data-tab="stats"],
body.global-secret-mode #tabNav .sidebar-item[data-tab="defis"],
body.global-secret-mode #tabNav .sidebar-item[data-tab="ia"] {
  display: none !important;
}
.notif-panel { position: fixed; top: 48px; right: 12px; width: 380px; max-height: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 10000; display: none; flex-direction: column; overflow: hidden; }
.notif-panel.open { display: flex; }
.notif-panel-header { display: flex; align-items: center; gap: .5rem; padding: 10px 14px; border-bottom: 1px solid var(--border2); font-size: .85rem; }
.notif-toggle-label { font-size: .75rem; color: var(--text3); display: flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; }
.notif-panel-body { overflow-y: auto; max-height: 400px; padding: 6px 0; }
.notif-empty { padding: 2rem; text-align: center; color: var(--text3); font-size: .85rem; }
.notif-item { display: flex; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border2); font-size: .82rem; }
.notif-item:last-child { border-bottom: none; }
.notif-item-icon { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.notif-item--success .notif-item-icon { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.notif-item--error .notif-item-icon { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.notif-item--warning .notif-item-icon { background: color-mix(in srgb, var(--yellow) 15%, transparent); color: var(--yellow); }
.notif-item--info .notif-item-icon { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.notif-item-body { flex: 1; min-width: 0; line-height: 1.4; }
.notif-item-body b { font-weight: 600; }
.notif-item-body span { color: var(--text2); }
.notif-item-time { font-size: .72rem; color: var(--text3); margin-top: 2px; }

/* Toast notifications */
.notif-toast { position: fixed; bottom: 24px; right: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; display: flex; align-items: flex-start; gap: 10px; z-index: 10001; max-width: 400px; font-size: .85rem; transform: translateY(20px); opacity: 0; transition: transform .3s, opacity .3s; }
.notif-toast--visible { transform: translateY(0); opacity: 1; }
.notif-toast-icon { font-weight: 700; font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.notif-toast-body { flex: 1; line-height: 1.4; }
.notif-toast-body b { font-weight: 600; }
.notif-toast-body span { color: var(--text2); font-size: .8rem; }
.notif-toast-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; padding: 0 0 0 8px; line-height: 1; }

/* ── Undo/Redo toolbar ─────────────────────────────────────── */
.undo-bar { display: flex; align-items: center; gap: 4px; margin-right: 8px; }
.undo-bar button { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 4px; line-height: 1; }
.undo-bar button:hover:not(:disabled) { color: var(--text); background: var(--surface2); }
.undo-bar button:disabled { opacity: .3; cursor: default; }

/* ── Enhanced Player Controls ──────────────────────────────── */
.player-controls-extra { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.player-controls-extra button, .player-controls-extra select { font-size: .78rem; }
.speed-select { background: var(--surface2); border: 1px solid var(--border2); color: var(--text); border-radius: 4px; padding: 2px 6px; font-size: .78rem; cursor: pointer; }
.speed-select:focus { outline: 1px solid var(--blue); }

.pbar-select {
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 10px;
  padding: 5px 28px 5px 10px;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 6px;
}
.pbar-select:hover {
  border-color: var(--watch-accent);
  box-shadow: 0 0 0 2px rgba(255,107,44,.12);
}
.pbar-select:focus {
  outline: none;
  border-color: var(--watch-accent);
  box-shadow: 0 0 0 2px rgba(255,107,44,.18);
}

.btn-icon-pip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.btn-icon-pip svg {
  display: block;
}

/* (Old Enhanced Stats Dashboard styles removed, now in Statistics Dashboard section above) */

/* ── Genre Categories Board ────────────────────────────────── */
.gc-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 24px;
}

.gc-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
  font-size: 13px;
}
.gc-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* Category card */
.gc-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  user-select: none;
}
.gc-card:hover { border-color: var(--border); }
.gc-card.gc-dragging { opacity: .5; border-color: var(--blue); }
.gc-card.gc-drag-over { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-dim); }
.gc-card-uncat { border-style: dashed; }
.gc-card-uncat:hover { border-color: var(--text3); }

/* Card header */
.gc-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: default;
}
.gc-drag-handle {
  color: var(--text3);
  cursor: grab;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}
.gc-drag-handle:hover { color: var(--text2); }
.gc-card-uncat .gc-drag-handle { display: none; }

.gc-cat-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}
.gc-cat-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text3);
  border: 1px solid var(--border2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.gc-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Small action buttons */
.gc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text3);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  padding: 0;
}
.gc-btn:hover { background: var(--surface2); color: var(--text2); border-color: var(--border2); }
.gc-btn-toggle { font-size: 10px; }
.gc-btn-edit:hover { color: var(--blue); border-color: var(--blue-dim); background: var(--blue-dim); }
.gc-btn-del:hover { color: var(--red); border-color: var(--red-dim); background: var(--red-dim); }

/* Card body (collapsed by default) */
.gc-card-body {
  display: none;
  padding: 0 14px 14px 14px;
  border-top: 1px solid var(--border2);
  background: color-mix(in srgb, var(--surface2) 30%, transparent);
}
.gc-card-body.open { display: block; }

/* Genres wrap inside card */
.gc-genres-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
  align-items: center;
}

/* Genre pill */
.gc-genre-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--border2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), border-color var(--transition), color var(--transition);
  cursor: grab;
}
.gc-genre-pill:hover { background: color-mix(in srgb, var(--accent) 7%, var(--surface2)); border-color: var(--accent-border); color: var(--text); box-shadow: 0 1px 4px rgba(255,107,44,.15); }
.gc-genre-pill:active { cursor: grabbing; }
.gc-genre-pill.gc-pill-dragging { opacity: .35; cursor: grabbing; }
.gc-genre-pill-uncat {
  background: color-mix(in srgb, var(--surface2) 92%, transparent);
  border-color: var(--border2);
  color: var(--text2);
  cursor: grab;
}
.gc-genre-pill-uncat:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface2)); border-color: var(--accent-border); box-shadow: var(--shadow-sm); }
.gc-genre-name { cursor: pointer; }
.gc-genre-name:hover { text-decoration: underline; }
.gc-genre-x {
  cursor: pointer;
  font-size: 12px;
  opacity: .65;
  line-height: 1;
  transition: opacity var(--transition), color var(--transition);
  padding: 1px 2px;
}
.gc-genre-x:hover { opacity: 1; color: var(--red); }
.gc-genre-x-assign { font-size: 14px; }
.gc-genre-x-assign:hover { opacity: 1; color: var(--blue); }
/* Drop target highlight on card body */
.gc-card.gc-drag-over .gc-card-body.open { background: color-mix(in srgb, var(--blue-dim) 40%, var(--surface2)); }

/* Add genre input inside card */
.gc-add-genre-wrap {
  position: relative;
  display: inline-block;
}
.gc-add-input {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  width: 140px;
  font-family: var(--sans);
  transition: border-color var(--transition), background var(--transition), width var(--transition);
  outline: none;
}
.gc-add-input:focus {
  border-color: var(--blue);
  background: var(--bg);
  width: 180px;
}
.gc-add-input::placeholder { color: var(--text3); }

.gc-add-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 100;
  display: none;
  max-height: 220px;
  overflow-y: auto;
}
.gc-add-dropdown.open { display: block; }
.gc-dd-item {
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  color: var(--text);
}
.gc-dd-item:hover, .gc-dd-item.hl { background: var(--blue-dim); color: var(--blue); }
.gc-dd-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
}

/* Genre items detail panel */
.gc-items-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.gc-items-header h3 { flex: 1; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.gc-items-actions { display: flex; gap: 6px; }
.gc-items-actions .gc-btn { width: auto; padding: 0 12px; font-size: 12px; }

/* Modal for category naming */
.gc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .12s ease;
}
.gc-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 420px;
  max-width: calc(100vw - 32px);
  overflow: hidden;
}
.gc-modal-header {
  display: flex;
  align-items: center;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border2);
}
.gc-modal-header h3 { flex: 1; font-size: 15px; font-weight: 600; }
.gc-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text3);
  padding: 4px;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}
.gc-modal-close:hover { background: var(--surface2); color: var(--text); }
.gc-modal-body { padding: 20px; }
.gc-modal-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.gc-modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.gc-modal-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
.gc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--border2);
}
.gc-modal-btn-cancel {
  padding: 8px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  font-family: var(--sans);
  transition: background var(--transition);
}
.gc-modal-btn-cancel:hover { background: var(--surface3); }
.gc-modal-btn-ok {
  padding: 8px 18px;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  font-family: var(--sans);
  transition: opacity var(--transition);
}
.gc-modal-btn-ok:hover { opacity: .85; }

/* Assign to category modal */
.gc-assign-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px !important;
}
.gc-assign-opt {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: var(--sans);
  transition: background var(--transition), border-color var(--transition);
}
.gc-assign-opt:hover { background: var(--blue-dim); border-color: rgba(59,130,246,.3); color: var(--blue); }

/* ── Genres field : focus orange au lieu de bleu ── */
.genres-tag-container .tag-wrap:focus-within {
  border-color: rgba(255,107,44,.45);
  box-shadow: 0 0 0 3px rgba(255,107,44,.1);
}

/* ── Dropdown genres groupé ── */
.genres-dropdown {
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  min-width: 260px;
  padding: 6px 0;
}

/* En-tête de catégorie */
.tag-dd-section {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--watch-accent);
  border-top: 1px solid var(--border2);
  margin-top: 2px;
}

.tag-dd-section::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--watch-accent);
  opacity: .7;
  flex-shrink: 0;
}

.tag-dd-section:first-child {
  border-top: none;
  margin-top: 0;
}

/* Items indentés sous une catégorie */
.tag-dd-item-indented {
  padding-left: 26px;
}

/* Hover / highlight orange pour les genres */
.genres-dropdown .tag-dd-item:hover,
.genres-dropdown .tag-dd-item.hl {
  background: rgba(255,107,44,.08);
  color: var(--watch-accent);
}

@keyframes fadeIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

/* ── AI Model Comparison ───────────────────────────────────── */
.ai-compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.ai-compare-card { background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 14px; }
.ai-compare-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; font-size: .88rem; }
.ai-compare-card-body { font-size: .84rem; line-height: 1.5; color: var(--text); }
.ai-compare-card-body textarea { width: 100%; min-height: 120px; background: var(--bg); border: 1px solid var(--border2); border-radius: 6px; color: var(--text); padding: 8px; font-size: .82rem; resize: vertical; }
.ai-compare-card-footer { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: .78rem; color: var(--text3); }
.ai-compare-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── Batch AI progress ─────────────────────────────────────── */
.batch-ai-progress { margin-top: 12px; }
.batch-ai-bar { height: 6px; border-radius: 3px; background: var(--border2); overflow: hidden; margin-bottom: 6px; }
.batch-ai-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width .2s; }
.batch-ai-status { font-size: .8rem; color: var(--text2); }
