/* ══════════════════════════════════════════════════
   ReelPilot · Design System
   ══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Theme variables ──────────────────────────────── */
:root {
  --bg:         #0a0a0a;
  --panel:      #141414;
  --panel-2:    #1c1c1c;
  --line:       #262626;
  --text:       #f5f5f5;
  --muted:      #8a8a8a;
  --accent:     #FF3B3B;
  --accent-2:   #FFB800;
  --accent-ink: #0a0a0a;
  --sidebar-w:  260px;
}

[data-theme="lime"] {
  --bg:         #0c0d0a;
  --panel:      #15181a;
  --panel-2:    #1c2122;
  --line:       #232622;
  --text:       #f0f1ea;
  --muted:      #8a8d80;
  --accent:     #C8FF3B;
  --accent-2:   #00D9FF;
  --accent-ink: #0a0a0a;
}

[data-theme="midnight"] {
  --bg:         #0c1117;
  --panel:      #161d28;
  --panel-2:    #1d2735;
  --line:       #1f2a3a;
  --text:       #f0f4fb;
  --muted:      #7e8a9d;
  --accent:     #FF7A5C;
  --accent-2:   #7B61FF;
  --accent-ink: #0c1117;
}

/* Theme SÁNG (trắng) */
[data-theme="light"] {
  --bg:         #f4f5f7;
  --panel:      #ffffff;
  --panel-2:    #eef0f3;
  --line:       #e0e2e8;
  --text:       #15181d;
  --muted:      #667085;
  --accent:     #FF3B3B;
  --accent-2:   #E08600;
  --accent-ink: #ffffff;
}
/* Một số chỗ template gán nền tối cứng → đổi nhẹ cho theme sáng dễ nhìn */
[data-theme="light"] body { color: var(--text); }
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select,
[data-theme="light"] .field-input,
[data-theme="light"] .field-textarea,
[data-theme="light"] .field-select {
  background: #ffffff !important; color: var(--text) !important; border-color: var(--line) !important;
}
[data-theme="light"] ::placeholder { color: #98a2b3 !important; }

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ── App shell ────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  flex-shrink: 0;
  position: relative;
}
.sidebar-logo-mark::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-40%, -50%);
  width: 0; height: 0;
  border-left: 9px solid var(--accent-ink);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.sidebar-logo-name {
  font-family: 'Archivo', sans-serif;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: none;
}
.sidebar-scroll::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.1s, color 0.1s;
  border-left: 2px solid transparent;
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: var(--panel);
  color: var(--text);
  border-left-color: var(--accent);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg { width: 14px; height: 14px; }
.nav-item.active .nav-icon svg { color: var(--accent); }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-ink);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  transition: color 0.1s;
}
.sidebar-logout:hover { color: var(--text); }

/* ── Main content ─────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 16px;
}

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

.page-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
/* Ngăn flex shrink co các children — để overflow-y:auto cuộn đúng */
.page-content > * {
  flex-shrink: 0;
}
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, opacity 0.1s;
}
.btn:hover { background: var(--panel); border-color: rgba(255,255,255,0.12); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--panel); color: var(--text); border-color: var(--line); }

.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 14px; border-radius: 10px; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
}

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}

.card-2 {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

/* ── KPI Row ──────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.kpi-value {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1;
  margin-top: 4px;
}

.kpi-delta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Tables ───────────────────────────────────────── */
.table-wrapper {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

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

.table-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.table-filter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 18px;
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }

tbody td {
  padding: 11px 18px;
  font-size: 13px;
  vertical-align: middle;
}

.td-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.td-name { font-weight: 500; color: var(--text); }
.td-sub {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.td-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
}

/* ── Progress bar ─────────────────────────────────── */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.6s ease;
}

.progress-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Status badges ────────────────────────────────── */
.status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.status.up     { color: var(--accent-2); }
.status.run    { color: var(--accent); }
.status.wait   { color: var(--muted); }
.status.error  { color: #ff6b6b; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-up      { background: rgba(255,184,0,0.12);   color: var(--accent-2); }
.badge-run     { background: rgba(255,59,59,0.12);   color: var(--accent); }
.badge-wait    { background: rgba(138,138,138,0.1);  color: var(--muted); }
.badge-success { background: rgba(52,199,89,0.12);   color: #34c759; }

/* ── Eyebrow / mono label ─────────────────────────── */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
}

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

.field-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.field-input::placeholder { color: var(--muted); }
.field-input:focus,
.field-select:focus,
.field-textarea:focus { border-color: var(--accent); }

.field-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.field-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
}

/* ── Section divider ──────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 15px;
}

/* ── Misc utils ───────────────────────────────────── */
.text-accent { color: var(--accent); }
.text-muted  { color: var(--muted); }
.text-accent2 { color: var(--accent-2); }

.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

.flex { display: flex; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.3;
  pointer-events: none;
}

.login-accent-bar {
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--accent);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Archivo', sans-serif;
  font-weight: 900;
  font-size: 18px;
}

.login-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
}
.login-logo-mark::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-40%, -50%);
  width: 0; height: 0;
  border-left: 11px solid var(--accent-ink);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.login-heading {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.login-sub { font-size: 13.5px; color: var(--muted); }

.login-error {
  background: rgba(255,59,59,0.1);
  border: 1px solid rgba(255,59,59,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.login-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  color: var(--text);
  background: transparent;
  transition: background 0.1s, border-color 0.1s;
  width: 100%;
}
.login-google:hover { background: var(--panel-2); border-color: rgba(255,255,255,0.12); }

.g-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: conic-gradient(#4285F4 0 25%, #34A853 25% 50%, #FBBC04 50% 75%, #EA4335 75%);
  flex-shrink: 0;
}

.login-footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.login-footer a { color: var(--accent); }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.checkbox-row input { accent-color: var(--accent); }

/* ═══════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════ */
.step-pills {
  display: flex;
  gap: 6px;
}
.step-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.step-pill.active {
  background: rgba(255,59,59,0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════
   SCRIPTS PAGE
   ═══════════════════════════════════════════════════ */
.drop-zone {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 36px 24px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  background: var(--panel-2);
  box-sizing: border-box;
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(255,59,59,0.04);
}

.drop-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.drop-title {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.drop-sub { font-size: 12.5px; color: var(--muted); }

.tab-row {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.1s;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ═══════════════════════════════════════════════════
   QUEUE PAGE
   ═══════════════════════════════════════════════════ */
.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.queue-folder {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--muted);
}
.queue-folder span { color: var(--accent); }

.queue-row {
  display: grid;
  grid-template-columns: 56px 1fr 160px 90px;
  gap: 14px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
}
.queue-row:last-child { border-bottom: none; }
.queue-row:hover { background: rgba(255,255,255,0.02); }

.queue-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════
   LIBRARY PAGE
   ═══════════════════════════════════════════════════ */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.video-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
}

.video-thumb {
  height: 140px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.video-thumb-pattern {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 12px);
}

.video-play-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.video-play-btn::after {
  content: '';
  width: 0; height: 0;
  border-left: 12px solid #fff;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  margin-left: 2px;
}

.video-duration {
  position: absolute;
  bottom: 8px; right: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 4px;
}

.video-meta {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.video-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
}

.video-actions {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* ═══════════════════════════════════════════════════
   YOUTUBE PAGE
   ═══════════════════════════════════════════════════ */
.yt-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

.yt-preview-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.yt-thumb {
  height: 190px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-thumb-label {
  position: absolute;
  bottom: 10px; left: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  padding: 3px 8px;
  border-radius: 4px;
}

.yt-channel-info {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.yt-channel-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #34c759;
  flex-shrink: 0;
}

.yt-form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.yt-form-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

.yt-form-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.yt-schedule-row {
  display: flex;
  gap: 8px;
}

.schedule-option {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.schedule-option:hover { border-color: rgba(255,255,255,0.15); }
.schedule-option.active {
  border-color: var(--accent);
  background: rgba(255,59,59,0.06);
}
.schedule-option-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.schedule-option-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
}
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
}

.settings-nav {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
}

.settings-nav-item {
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border-left: 2px solid transparent;
}
.settings-nav-item:hover { background: var(--panel-2); color: var(--text); }
.settings-nav-item.active {
  background: var(--panel-2);
  color: var(--text);
  border-left-color: var(--accent);
}

.settings-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.settings-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.settings-panel-header h2 {
  font-family: 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}
.settings-panel-header p {
  font-size: 12.5px;
  color: var(--muted);
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.1s;
}
.setting-row:last-child { border-bottom: none; }
.setting-row:hover { background: rgba(255,255,255,0.02); }

.setting-name { font-size: 13.5px; font-weight: 600; }
.setting-sub {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.setting-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.setting-value.path  { color: var(--accent); }
.setting-value.key   { letter-spacing: 0.04em; }

/* ── Theme switcher in topbar ─────────────────────── */
.theme-switcher {
  display: flex;
  gap: 6px;
  align-items: center;
}

.theme-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.theme-dot:hover { transform: scale(1.2); }
.theme-dot.active { border-color: var(--text); }

/* ═══════════════════════════════════════════════════
   RATIO SELECTOR
   ═══════════════════════════════════════════════════ */
.ratio-selector {
  display: flex;
  gap: 12px;
}

/* ── New ratio option cards ───────────────────────── */
.ratio-opt {
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.ratio-opt:hover {
  border-color: rgba(255,255,255,0.2);
}
.ratio-opt-active,
.ratio-opt.active {
  border-color: var(--accent) !important;
  background: rgba(255,59,59,0.07) !important;
}
[data-theme="lime"]     .ratio-opt-active,
[data-theme="lime"]     .ratio-opt.active { background: rgba(200,255,59,0.07) !important; }
[data-theme="midnight"] .ratio-opt-active,
[data-theme="midnight"] .ratio-opt.active { background: rgba(255,122,92,0.07) !important; }

.ratio-vis-wide {
  width: 38px;
  height: 22px;
  border: 2px solid var(--muted);
  border-radius: 3px;
  flex-shrink: 0;
}
.ratio-vis-tall {
  width: 22px;
  height: 38px;
  border: 2px solid var(--muted);
  border-radius: 3px;
  flex-shrink: 0;
}
.ratio-opt-active .ratio-vis-wide,
.ratio-opt-active .ratio-vis-tall,
.ratio-opt.active  .ratio-vis-wide,
.ratio-opt.active  .ratio-vis-tall {
  border-color: var(--accent);
}

.ratio-btn {
  flex: 1;
  display: flex !important;
  flex-direction: column !important;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--muted);
  user-select: none;
  min-height: 130px;
  box-sizing: border-box;
}
.ratio-btn:hover {
  border-color: rgba(255,255,255,0.18);
  color: var(--text);
}
.ratio-btn.active {
  border-color: var(--accent);
  background: rgba(255,59,59,0.06);
  color: var(--text);
}
[data-theme="lime"]     .ratio-btn.active { background: rgba(200,255,59,0.06); }
[data-theme="midnight"] .ratio-btn.active { background: rgba(255,122,92,0.06); }

.ratio-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 52px;
  flex-shrink: 0;
}

/* 16:9 box — wide */
.ratio-box-wide {
  width: 58px;
  height: 33px;
  border: 2px solid currentColor;
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 9:16 box — tall */
.ratio-box-tall {
  width: 30px;
  height: 52px;
  border: 2px solid currentColor;
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ratio-box-wide::after,
.ratio-box-tall::after {
  content: '';
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
}

.ratio-btn.active .ratio-box-wide,
.ratio-btn.active .ratio-box-tall {
  border-color: var(--accent);
  color: var(--accent);
}

.ratio-label {
  font-family: 'Archivo', sans-serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.ratio-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}
.ratio-btn.active .ratio-sub { color: var(--accent); }

/* ── Folder picker row ────────────────────────────── */
.folder-picker-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.folder-picker-row .field-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--accent);
}
.folder-picker-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s;
}
.folder-picker-btn:hover {
  background: var(--panel);
  border-color: rgba(255,255,255,0.14);
}
.folder-picker-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Run config panel (scripts page) ─────────────── */
.run-config-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.run-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.run-config-body {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .run-config-body { grid-template-columns: 1fr; }
}

/* ── Settings nav item with badge ─────────────────── */
.settings-nav-item {
  display: flex;
  align-items: center;
}

/* ── Transition cards (Auto Edit) ─────────────────── */
.tr-card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  background: var(--panel-2);
}
.tr-card:hover {
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.tr-card.active {
  border-color: var(--accent);
  background: rgba(255,59,59,0.06);
}
.tr-preview {
  height: 52px;
  position: relative;
  overflow: hidden;
  display: flex;
}
.tr-half {
  flex: 1;
  height: 100%;
}
.tr-left  { background: linear-gradient(135deg, #2a3a5c 0%, #1a2a4c 100%); }
.tr-right { background: linear-gradient(135deg, #3a2a1a 0%, #2a1a0a 100%); }
.tr-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 8px 2px;
}
.tr-sub {
  font-size: 10px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  padding: 0 8px 7px;
}

/* ── Modal overlay ────────────────────────────────── */
[id$="-modal"] {
  /* All modals use display:flex when shown */
  align-items: center;
  justify-content: center;
}

/* ── Auto Edit ────────────────────────────────────── */
.ae-video-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  color: var(--text);
  transition: border-color .15s;
  flex-shrink: 0;
}
.ae-video-chip:hover { border-color: rgba(255,255,255,0.15); }

.ae-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.ae-chip-name {
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ae-chip-dur {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.ae-chip-src {
  font-size: 9.5px;
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.ae-chip-move {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ae-chip-move button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  cursor: pointer;
  transition: color .1s;
}
.ae-chip-move button:hover { color: var(--text); }

.ae-chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
  transition: color .1s;
  flex-shrink: 0;
}
.ae-chip-remove:hover { color: #ff6b6b; }

/* Voice gender toggle */
.ae-voice-pills {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.ae-voice-pill {
  padding: 7px 22px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ae-voice-pill.active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Compact transition buttons */
.ae-tr-mini {
  padding: 6px 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  background: var(--panel-2);
  transition: all .15s;
  user-select: none;
}
.ae-tr-mini:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.ae-tr-mini.active {
  background: rgba(255,59,59,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* Music mood buttons */
.ae-mood-btn {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  background: var(--panel-2);
  transition: all .15s;
  user-select: none;
}
.ae-mood-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.ae-mood-btn.active {
  background: rgba(255,59,59,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* Progress log terminal */
.ae-log-terminal {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  background: #050505;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 80px;
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.85;
  white-space: pre-wrap;
}
.ae-log-terminal .log-ok  { color: #34c759; }
.ae-log-terminal .log-err { color: #ff6b6b; }
.ae-log-terminal .log-run { color: var(--accent-2); }
.ae-log-terminal .log-dim { color: var(--muted); }

/* ── Responsive tweaks ────────────────────────────── */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .yt-layout { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .ae-mid-grid { grid-template-columns: 1fr !important; }
}
