:root {
  color-scheme: dark;
  /* Playwright note block */
  --pw-note-bg: #1e3a5f;
  --pw-note-border: #3b82f6;
  --pw-note-text: #93c5fd;
  --bg-base: #08111f;
  --bg-surface: rgba(15, 23, 42, 0.86);
  --bg-elevated: rgba(30, 41, 59, 0.76);
  --bg-hover: rgba(51, 65, 85, 0.78);
  --bg-panel: rgba(15, 23, 42, 0.68);
  --bg-soft: rgba(212, 160, 18, 0.08);
  --border-subtle: rgba(148, 163, 184, 0.16);
  --border-default: rgba(148, 163, 184, 0.28);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #7b8da7;
  --accent: #d4a012;
  --accent-hover: #f0bd2e;
  --accent-muted: rgba(212, 160, 18, 0.16);
  --status-success: #22a06b;
  --status-warning: #cf9f02;
  --status-danger: #e34935;
  --status-info: #388bfd;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar-width: 240px;
  --shadow-sm: 0 1px 2px rgba(8, 15, 30, 0.4);
  --shadow-md: 0 18px 48px rgba(2, 6, 23, 0.34);
  --ring: rgba(212, 160, 18, 0.38);
}

:root[data-theme="light"] {
  color-scheme: light;
  /* Playwright note block — light mode */
  --pw-note-bg: #eff6ff;
  --pw-note-border: #3b82f6;
  --pw-note-text: #1d4ed8;
  --bg-base: #f5f7fb;
  --bg-surface: rgba(255, 255, 255, 0.88);
  --bg-elevated: rgba(255, 255, 255, 0.96);
  --bg-hover: #eef3f9;
  --bg-panel: rgba(255, 255, 255, 0.78);
  --bg-soft: rgba(180, 126, 16, 0.09);
  --border-subtle: rgba(15, 23, 42, 0.09);
  --border-default: rgba(15, 23, 42, 0.15);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #748094;
  --accent: #b47e10;
  --accent-hover: #96670a;
  --accent-muted: rgba(180, 126, 16, 0.14);
  --status-success: #15803d;
  --status-warning: #a16207;
  --status-danger: #dc2626;
  --status-info: #2563eb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 50px rgba(15, 23, 42, 0.12);
  --ring: rgba(180, 126, 16, 0.32);
}

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

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34rem),
    radial-gradient(circle at 80% 0%, rgba(56, 139, 253, 0.16), transparent 32rem),
    var(--bg-base);
  color: var(--text-primary);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

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

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

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--bg-elevated); }
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-base);
  font-weight: 500;
  transition: background-color 150ms ease, transform 150ms ease;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 4px rgba(212, 160, 18, 0.5);
}

.surface-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}


.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: transform 150ms ease, background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--ring); }
.btn-icon:active { transform: translateY(1px) scale(0.98); }

.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after { content: ''; position: absolute; inset: auto -18% -42% auto; width: 7rem; height: 7rem; border-radius: 999px; background: var(--accent-muted); filter: blur(2px); }

.hero-panel {
  background: linear-gradient(135deg, var(--bg-panel), var(--bg-elevated));
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}
.hero-panel::before { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent, var(--accent-muted), transparent); opacity: .55; pointer-events: none; }

/* Theme compatibility layer for legacy Tailwind utility colors used across modals/dynamic HTML. */
:root[data-theme="light"] .text-white,
:root[data-theme="light"] .text-slate-50,
:root[data-theme="light"] .text-slate-100,
:root[data-theme="light"] .text-slate-200 { color: var(--text-primary) !important; }
:root[data-theme="light"] .text-slate-300,
:root[data-theme="light"] .text-slate-400,
:root[data-theme="light"] .text-slate-500 { color: var(--text-secondary) !important; }
:root[data-theme="light"] .text-slate-600,
:root[data-theme="light"] .text-slate-700 { color: var(--text-muted) !important; }
:root[data-theme="light"] .text-amber-200,
:root[data-theme="light"] .text-amber-300,
:root[data-theme="light"] .text-amber-300\/95,
:root[data-theme="light"] .text-amber-400,
:root[data-theme="light"] .text-amber-500 { color: var(--accent) !important; }
:root[data-theme="light"] .text-emerald-300,
:root[data-theme="light"] .text-emerald-400,
:root[data-theme="light"] .text-green-400 { color: var(--status-success) !important; }
:root[data-theme="light"] .text-red-300,
:root[data-theme="light"] .text-red-400,
:root[data-theme="light"] .text-rose-400 { color: var(--status-danger) !important; }
:root[data-theme="light"] .text-blue-300,
:root[data-theme="light"] .text-blue-400,
:root[data-theme="light"] .text-sky-400,
:root[data-theme="light"] .text-purple-400,
:root[data-theme="light"] .text-purple-500,
:root[data-theme="light"] .text-pink-300\/90 { color: var(--status-info) !important; }

:root[data-theme="light"] .bg-slate-950,
:root[data-theme="light"] .bg-slate-950\/60,
:root[data-theme="light"] .bg-slate-900,
:root[data-theme="light"] .bg-slate-900\/80,
:root[data-theme="light"] .bg-slate-900\/70,
:root[data-theme="light"] .bg-slate-900\/60,
:root[data-theme="light"] .bg-slate-800,
:root[data-theme="light"] .bg-slate-800\/80,
:root[data-theme="light"] .bg-slate-800\/60,
:root[data-theme="light"] .bg-slate-800\/50,
:root[data-theme="light"] .bg-slate-700,
:root[data-theme="light"] .bg-black\/60,
:root[data-theme="light"] .bg-black\/70 { background-color: var(--bg-elevated) !important; }
:root[data-theme="light"] .hover\:bg-slate-700:hover,
:root[data-theme="light"] .hover\:bg-slate-600:hover,
:root[data-theme="light"] .hover\:bg-slate-800:hover { background-color: var(--bg-hover) !important; }
:root[data-theme="light"] .border-slate-950,
:root[data-theme="light"] .border-slate-900,
:root[data-theme="light"] .border-slate-800,
:root[data-theme="light"] .border-slate-700,
:root[data-theme="light"] .border-slate-600 { border-color: var(--border-default) !important; }
:root[data-theme="light"] .divide-slate-800 > :not([hidden]) ~ :not([hidden]),
:root[data-theme="light"] .divide-slate-700 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border-subtle) !important; }
/* ==========================================================
   Select / Option — dark mode default (solid, native popup)
   ========================================================== */
select {
  background-color: #1e293b;
  color: #f8fafc;
  color-scheme: dark;
}
select option {
  background-color: #1e293b;
  color: #f8fafc;
}

/* Light mode override */
:root[data-theme="light"] select {
  background-color: #ffffff !important;
  color: #0f172a !important;
  color-scheme: light !important;
}
:root[data-theme="light"] select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea { color: var(--text-primary) !important; caret-color: var(--accent); }
:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder { color: var(--text-muted) !important; }
:root[data-theme="light"] .slide-over-backdrop,
:root[data-theme="light"] #create-video-modal,
:root[data-theme="light"] .fixed.inset-0.bg-black\/60 { background: rgba(15, 23, 42, 0.22) !important; }
:root[data-theme="light"] .shadow-2xl,
:root[data-theme="light"] .shadow-xl,
:root[data-theme="light"] .shadow { box-shadow: var(--shadow-md) !important; }
