/* ============================================================
   AutoTube Studio — Complete Design System
   Dark purple/orange gradient theme
   ============================================================ */

:root {
  --bg-base:        #0d0618;
  --bg-surface:     #130d22;
  --bg-card:        #1a1030;
  --bg-hover:       #221540;
  --bg-input:       #180e2a;
  --border:         #2d1f4e;
  --border-light:   #3d2a66;
  --purple-deep:    #1a0533;
  --purple-mid:     #4c1d95;
  --purple-bright:  #7c3aed;
  --purple-glow:    #a855f7;
  --orange:         #f97316;
  --orange-light:   #fb923c;
  --orange-dark:    #c2410c;
  --text-primary:   #f0e6ff;
  --text-secondary: #9d86c8;
  --text-muted:     #6b57a0;
  --text-dim:       #3d2a66;
  --green:          #10b981;
  --green-dark:     #065f46;
  --red:            #ef4444;
  --red-dark:       #7f1d1d;
  --yellow:         #f59e0b;
  --yellow-dark:    #78350f;
  --blue:           #3b82f6;
  --blue-dark:      #1e3a8a;
  --sidebar-w:      240px;
  --header-h:       60px;
  --radius:         10px;
  --radius-lg:      14px;
  --shadow:         0 4px 24px rgba(0,0,0,.45);
  --shadow-card:    0 2px 12px rgba(0,0,0,.35);
  --glow-purple:    0 0 20px rgba(124,58,237,.25);
  --glow-orange:    0 0 20px rgba(249,115,22,.25);
  --transition:     .18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 14px; }
body {
  height: 100%; font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base); color: var(--text-primary);
  overflow-x: hidden; line-height: 1.5;
}
a { color: var(--purple-glow); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-bright); }

/* ── BOOT SCREEN ── */
.boot-screen {
  position: fixed; inset: 0; background: var(--bg-base);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.boot-logo { text-align: center; }
.boot-icon {
  width: 80px; height: 80px; margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--purple-bright), var(--orange));
  border-radius: 20px; display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #fff; box-shadow: var(--glow-purple);
  animation: pulse-icon 1.5s ease-in-out infinite;
}
@keyframes pulse-icon {
  0%,100% { transform: scale(1); box-shadow: var(--glow-purple); }
  50% { transform: scale(1.06); box-shadow: 0 0 40px rgba(124,58,237,.5); }
}
.boot-logo h1 {
  font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700;
  background: linear-gradient(135deg, #c084fc, var(--orange-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.boot-logo p { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.boot-bar {
  width: 220px; height: 4px; background: var(--border); border-radius: 2px;
  margin: 0 auto; overflow: hidden;
}
.boot-fill {
  height: 100%; background: linear-gradient(90deg, var(--purple-bright), var(--orange));
  border-radius: 2px; animation: boot-progress 1.8s ease-in-out forwards;
}
@keyframes boot-progress { from { width: 0; } to { width: 100%; } }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 20% 50%, #1a0533 0%, var(--bg-base) 60%);
  padding: 20px;
}
.login-box { display: flex; gap: 60px; align-items: center; max-width: 900px; width: 100%; }
.login-logo { flex: 1; }
.login-logo-icon {
  width: 64px; height: 64px; background: linear-gradient(135deg, var(--purple-bright), var(--orange));
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; margin-bottom: 20px; box-shadow: var(--glow-purple);
}
.login-logo h1 {
  font-family: 'Space Grotesk', sans-serif; font-size: 36px; font-weight: 700; line-height: 1.2;
  background: linear-gradient(135deg, #c084fc, var(--orange-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 12px;
}
.login-logo p { color: var(--text-secondary); font-size: 15px; line-height: 1.6; margin-bottom: 28px; }
.login-features { display: flex; flex-direction: column; gap: 10px; }
.login-feat {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-secondary); font-size: 13px;
}
.login-feat i { color: var(--purple-glow); width: 16px; text-align: center; }
.login-card {
  flex: 0 0 380px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow);
}
.login-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-card .sub { color: var(--text-secondary); font-size: 13px; margin-bottom: 28px; }
.login-error {
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.login-hint {
  margin-top: 20px; padding: 14px; background: rgba(124,58,237,.1);
  border: 1px solid rgba(124,58,237,.2); border-radius: 8px;
}
.login-hint p { color: var(--text-secondary); font-size: 12px; margin-bottom: 8px; }
.login-hint .hint-row {
  display: flex; gap: 6px; align-items: center;
  padding: 6px 8px; background: var(--bg-surface); border-radius: 6px; margin-bottom: 6px;
  cursor: pointer; transition: background var(--transition);
}
.login-hint .hint-row:hover { background: var(--bg-hover); }
.login-hint .hint-role {
  font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600;
  background: rgba(124,58,237,.3); color: #c084fc;
}
.login-hint .hint-creds { font-size: 12px; color: var(--text-secondary); font-family: monospace; }

/* ── APP SHELL ── */
.app-shell {
  display: flex; height: 100vh; overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); background: var(--bg-surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  flex-shrink: 0; position: relative; z-index: 100; transition: transform .25s ease;
}
.sidebar-logo {
  padding: 18px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--purple-bright), var(--orange));
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff; flex-shrink: 0;
}
.sidebar-logo-text { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-logo-text span { display: block; font-size: 10px; font-weight: 400; color: var(--text-secondary); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-section { margin-bottom: 6px; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted); letter-spacing: .08em;
  text-transform: uppercase; padding: 8px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; color: var(--text-secondary);
  transition: all var(--transition); font-size: 13.5px; font-weight: 500;
  user-select: none; position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(249,115,22,.1));
  color: var(--text-primary); border: 1px solid rgba(124,58,237,.25);
}
.nav-item.active i { color: var(--purple-glow); }
.nav-item i { width: 18px; text-align: center; font-size: 14px; color: var(--text-muted); transition: color var(--transition); }
.nav-item .nav-badge {
  margin-left: auto; background: var(--orange); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; min-width: 18px; text-align: center;
}
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; background: var(--bg-hover);
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-bright), var(--orange));
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-secondary); }
.btn-logout {
  width: 28px; height: 28px; border-radius: 6px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  transition: all var(--transition); flex-shrink: 0;
}
.btn-logout:hover { background: rgba(239,68,68,.15); color: var(--red); }

/* ── MAIN CONTENT ── */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: var(--header-h); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--bg-surface); flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; }
.topbar-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-status {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.2);
  font-size: 12px; color: var(--green);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.btn-menu {
  display: none; width: 36px; height: 36px; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--text-secondary); font-size: 16px;
  transition: all var(--transition);
}
.btn-menu:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  transition: all var(--transition); white-space: nowrap; cursor: pointer; border: none;
  font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--purple-bright), #6d28d9);
  color: #fff; box-shadow: 0 2px 10px rgba(124,58,237,.35);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--purple-glow), var(--purple-bright));
  box-shadow: 0 4px 20px rgba(124,58,237,.5); transform: translateY(-1px);
}
.btn-orange {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff; box-shadow: 0 2px 10px rgba(249,115,22,.35);
}
.btn-orange:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--orange-light), var(--orange));
  box-shadow: 0 4px 20px rgba(249,115,22,.5); transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-hover); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); color: var(--text-primary); }
.btn-ghost { color: var(--text-secondary); transition: color var(--transition); padding: 6px 10px; }
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--bg-hover); border-radius: 6px; }
.btn-danger { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.25); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,.25); }
.btn-success { background: rgba(16,185,129,.15); color: var(--green); border: 1px solid rgba(16,185,129,.25); }
.btn-success:hover:not(:disabled) { background: rgba(16,185,129,.25); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 7px; border-radius: 8px; }
.btn-icon-sm { padding: 5px; border-radius: 6px; font-size: 12px; }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-label .req { color: var(--orange); margin-left: 2px; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 9px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary);
  font-size: 13.5px; transition: border-color var(--transition); outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--purple-bright); box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-help { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.input-group { display: flex; gap: 8px; }
.input-group .form-input { flex: 1; }
.pwd-wrap { position: relative; }
.pwd-wrap .form-input { padding-right: 40px; }
.pwd-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer; padding: 4px;
  transition: color var(--transition);
}
.pwd-toggle:hover { color: var(--text-secondary); }

/* ── CARDS ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-card);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 10px;
}
.card-title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--purple-glow); }
.card-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover { border-color: var(--border-light); box-shadow: var(--glow-purple); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.stat-icon.purple { background: rgba(124,58,237,.2); color: var(--purple-glow); }
.stat-icon.orange { background: rgba(249,115,22,.2); color: var(--orange-light); }
.stat-icon.green  { background: rgba(16,185,129,.2);  color: var(--green); }
.stat-icon.blue   { background: rgba(59,130,246,.2);  color: var(--blue); }
.stat-icon.red    { background: rgba(239,68,68,.2);   color: var(--red); }
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-trend { font-size: 11px; margin-top: 4px; }
.stat-trend.up { color: var(--green); }
.stat-trend.down { color: var(--red); }

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.flex-row { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; line-height: 1.2; }
.page-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 10px; }

/* ── BADGES / TAGS ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-purple { background: rgba(124,58,237,.2); color: #c084fc; border: 1px solid rgba(124,58,237,.3); }
.badge-orange { background: rgba(249,115,22,.2); color: var(--orange-light); border: 1px solid rgba(249,115,22,.3); }
.badge-green  { background: rgba(16,185,129,.15); color: #34d399; border: 1px solid rgba(16,185,129,.3); }
.badge-red    { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.badge-yellow { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }
.badge-blue   { background: rgba(59,130,246,.15); color: #60a5fa; border: 1px solid rgba(59,130,246,.3); }
.badge-gray   { background: rgba(107,57,160,.15); color: var(--text-muted); border: 1px solid var(--border); }
.badge-dot::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor; margin-right: 4px;
}

/* ── STATUS HELPERS ── */
.status-active    { color: var(--green); }
.status-paused    { color: var(--yellow); }
.status-failed    { color: var(--red); }
.status-processing{ color: var(--blue); }
.status-published { color: var(--purple-glow); }
.status-queued    { color: var(--text-secondary); }
.status-completed { color: var(--green); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }
.td-actions { display: flex; gap: 6px; align-items: center; }

/* ── PROGRESS BAR ── */
.progress { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--purple-bright), var(--orange));
  transition: width .5s ease;
}

/* ── SERIES CARDS ── */
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 20px; }
.series-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; cursor: pointer;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.series-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--purple-bright), var(--orange));
}
.series-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.series-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.series-card-name { font-size: 15px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.series-card-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.series-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.series-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.series-card-actions .btn { flex: 1; min-width: 80px; }

/* ── EPISODE TABLE ── */
.ep-status { display: flex; align-items: center; gap: 6px; }
.ep-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ep-status-dot.queued    { background: var(--text-muted); }
.ep-status-dot.processing { background: var(--blue); animation: blink 1s ease-in-out infinite; }
.ep-status-dot.rendered  { background: var(--purple-glow); }
.ep-status-dot.uploading { background: var(--yellow); animation: blink .8s ease-in-out infinite; }
.ep-status-dot.published { background: var(--green); }
.ep-status-dot.failed    { background: var(--red); }
.ep-status-dot.paused    { background: var(--yellow); }

/* ── PIPELINE ── */
.pipeline-stages { display: flex; align-items: center; gap: 0; margin-bottom: 24px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-stage {
  flex: 1; min-width: 110px; text-align: center; position: relative; padding: 0 8px;
}
.pipeline-stage::after {
  content: ''; position: absolute; top: 20px; left: calc(50% + 28px); right: calc(-50% + 28px);
  height: 2px; background: var(--border); z-index: 0;
}
.pipeline-stage:last-child::after { display: none; }
.stage-icon {
  width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: var(--bg-hover); border: 2px solid var(--border);
  position: relative; z-index: 1; transition: all var(--transition);
}
.pipeline-stage.done .stage-icon { background: rgba(16,185,129,.2); border-color: var(--green); color: var(--green); }
.pipeline-stage.active .stage-icon {
  background: linear-gradient(135deg, var(--purple-bright), var(--orange));
  border-color: transparent; color: #fff;
  box-shadow: 0 0 15px rgba(124,58,237,.4); animation: stage-pulse 1.5s ease-in-out infinite;
}
@keyframes stage-pulse {
  0%,100% { box-shadow: 0 0 15px rgba(124,58,237,.4); }
  50% { box-shadow: 0 0 30px rgba(124,58,237,.7); }
}
.pipeline-stage.pending .stage-icon { color: var(--text-muted); }
.stage-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.pipeline-stage.done .stage-label { color: var(--green); }
.pipeline-stage.active .stage-label { color: var(--purple-glow); }

/* ── QUEUE TABLE ── */
.queue-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; padding: 14px; border-radius: 8px; background: var(--bg-surface); border: 1px solid var(--border); margin-bottom: 8px; }
.queue-row:hover { border-color: var(--border-light); }

/* ── CHANNEL CARD ── */
.channel-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: border-color var(--transition);
}
.channel-card:hover { border-color: var(--border-light); }
.channel-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.channel-avatar {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #ff0000, #cc0000);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.channel-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.channel-handle { font-size: 13px; color: var(--text-secondary); }
.channel-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.channel-stat { text-align: center; padding: 10px; background: var(--bg-surface); border-radius: 8px; }
.channel-stat-value { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.channel-stat-label { font-size: 11px; color: var(--text-muted); }
.channel-actions { display: flex; gap: 8px; }

/* ── LOG VIEWER ── */
.log-line {
  display: grid; grid-template-columns: 150px 60px 1fr; gap: 12px;
  padding: 7px 14px; font-size: 12.5px; font-family: monospace;
  border-bottom: 1px solid var(--border); transition: background var(--transition);
}
.log-line:hover { background: var(--bg-hover); }
.log-time { color: var(--text-muted); white-space: nowrap; }
.log-level { font-weight: 700; text-align: center; padding: 1px 6px; border-radius: 4px; font-size: 10px; }
.log-level.info  { color: var(--blue); background: rgba(59,130,246,.1); }
.log-level.success { color: var(--green); background: rgba(16,185,129,.1); }
.log-level.warn  { color: var(--yellow); background: rgba(245,158,11,.1); }
.log-level.error { color: var(--red); background: rgba(239,68,68,.1); }
.log-msg { color: var(--text-secondary); word-break: break-all; }

/* ── FILTER TABS ── */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

/* ── ANALYTICS ── */
.chart-wrap { position: relative; height: 240px; }
.analytics-table { width: 100%; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow), var(--glow-purple);
  animation: slide-up .2s ease;
}
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-sm  { max-width: 420px; }
.modal-md  { max-width: 580px; }
.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 900px; }
.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-hdr h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-hdr h3 i { color: var(--purple-glow); }
.modal-close {
  width: 30px; height: 30px; border-radius: 6px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  transition: all var(--transition); cursor: pointer;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { flex: 1; overflow-y: auto; padding: 22px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--border); flex-shrink: 0;
}

/* ── TOAST ── */
#toast-root { position: fixed; top: 20px; right: 20px; z-index: 9000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  min-width: 260px; max-width: 380px; box-shadow: var(--shadow);
  animation: toast-in .25s ease;
  border: 1px solid transparent;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast.info    { background: rgba(59,130,246,.2);  border-color: rgba(59,130,246,.3);  color: #93c5fd; }
.toast.success { background: rgba(16,185,129,.2);  border-color: rgba(16,185,129,.3);  color: #6ee7b7; }
.toast.error   { background: rgba(239,68,68,.2);   border-color: rgba(239,68,68,.3);   color: #fca5a5; }
.toast.warn    { background: rgba(245,158,11,.2);  border-color: rgba(245,158,11,.3);  color: #fcd34d; }
.toast i { font-size: 15px; flex-shrink: 0; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; margin-bottom: 20px; }

/* ── SECTION ── */
.section { margin-bottom: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.section-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-title i { color: var(--purple-glow); font-size: 14px; }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── SETTINGS ── */
.settings-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 20px; overflow: hidden; }
.settings-section-hdr {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 14px;
}
.settings-section-hdr i { color: var(--purple-glow); }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border); gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; min-width: 0; }
.settings-row-label { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.settings-row-desc { font-size: 12px; color: var(--text-secondary); }
.settings-row-action { flex-shrink: 0; }

/* ── TOGGLE ── */
.toggle { position: relative; width: 40px; height: 22px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 22px; transition: background var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-muted); transition: transform var(--transition), background var(--transition);
}
.toggle input:checked ~ .toggle-slider { background: var(--purple-bright); }
.toggle input:checked ~ .toggle-slider::before { transform: translateX(18px); background: #fff; }

/* ── NOTEBOOK / NOTEBOOKLM ── */
.nb-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; margin-bottom: 14px;
  transition: border-color var(--transition);
}
.nb-card:hover { border-color: var(--border-light); }
.nb-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.nb-card-title { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.nb-card-meta { font-size: 12px; color: var(--text-secondary); }
.nb-card-body { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nb-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── PIPELINE PANEL (ACCORDION / DROPDOWN SLIDE) ── */
.pipeline-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden;
}
.pipeline-panel-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; cursor: pointer; transition: background var(--transition);
  user-select: none;
}
.pipeline-panel-toggle:hover { background: var(--bg-hover); }
.pipeline-panel-toggle-left { display: flex; align-items: center; gap: 12px; }
.pipeline-panel-toggle-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.pipeline-panel-toggle-label { font-size: 14px; font-weight: 700; }
.pipeline-panel-toggle-desc { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.pipeline-panel-arrow {
  color: var(--text-muted); transition: transform .25s ease; font-size: 13px;
}
.pipeline-panel-toggle.open .pipeline-panel-arrow { transform: rotate(180deg); }
.pipeline-panel-body {
  max-height: 0; overflow: hidden; transition: max-height .35s ease, padding .25s ease;
  border-top: 0 solid var(--border);
}
.pipeline-panel-body.open {
  max-height: 2000px; padding: 0 18px 18px;
  border-top: 1px solid var(--border);
}

/* ── SCRIPT EDITOR ── */
.script-editor-wrap { display: flex; flex-direction: column; gap: 12px; }
.script-editor {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.script-editor-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); background: var(--bg-surface); flex-wrap: wrap;
}
.script-editor textarea {
  width: 100%; padding: 14px; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 13px; line-height: 1.6; resize: vertical; min-height: 220px;
}
.scene-block {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; margin-bottom: 10px;
}
.scene-block-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.scene-block-title { font-size: 13px; font-weight: 700; color: var(--purple-glow); }
.scene-block textarea { width: 100%; background: transparent; border: none; outline: none; color: var(--text-secondary); font-size: 13px; line-height: 1.6; resize: vertical; min-height: 70px; }

/* ── NOTIFICATION BANNER ── */
.notice {
  padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.notice-info  { background: rgba(59,130,246,.1);  border: 1px solid rgba(59,130,246,.2); color: #93c5fd; }
.notice-warn  { background: rgba(245,158,11,.1);  border: 1px solid rgba(245,158,11,.2); color: #fcd34d; }
.notice-success{ background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.2); color: #6ee7b7; }
.notice i { flex-shrink: 0; margin-top: 1px; }

/* ── DETAIL PANEL ── */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.detail-grid .main-col { min-width: 0; }
.detail-grid .side-col { min-width: 0; }

/* ── CHAR TABLE ── */
.char-row {
  display: grid; grid-template-columns: 1fr 80px 1fr; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 8px; background: var(--bg-surface);
  border: 1px solid var(--border); margin-bottom: 6px;
}
.char-row .char-name { font-weight: 600; font-size: 13.5px; }
.char-row .char-role { font-size: 12px; }
.char-row .char-desc { font-size: 12px; color: var(--text-secondary); }

/* ── AUTOMATION ── */
.cron-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; margin-bottom: 12px;
}
.cron-card-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cron-card-name { font-weight: 700; font-size: 14px; }
.cron-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.cron-meta span { display: flex; align-items: center; gap: 5px; }

/* ── INFO BOXES ── */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.info-box {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px;
}
.info-box-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.info-box-value { font-size: 16px; font-weight: 700; }
.info-box-value.small { font-size: 13px; font-weight: 500; color: var(--text-secondary); }

/* ── SEARCH ── */
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.search-input { padding-left: 34px !important; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); z-index: 200; }
  .sidebar.mobile-open { transform: none; box-shadow: 4px 0 40px rgba(0,0,0,.6); }
  .btn-menu { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .login-box { flex-direction: column; gap: 30px; }
  .login-logo { text-align: center; }
  .login-card { flex: none; width: 100%; }
  .page-content { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

/* ── MISC ── */
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mono { font-family: monospace; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--green); }
.text-danger  { color: var(--red); }
.text-warn    { color: var(--yellow); }
.text-purple  { color: var(--purple-glow); }
.text-orange  { color: var(--orange-light); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── GRADIENT TEXT ── */
.gradient-text {
  background: linear-gradient(135deg, #c084fc, var(--orange-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── HOVER ACTIONS ── */
.hover-actions { opacity: 0; transition: opacity var(--transition); }
tr:hover .hover-actions { opacity: 1; }

/* ── STEP INDICATOR ── */
.steps { display: flex; gap: 0; }
.step { flex: 1; text-align: center; padding: 10px 4px; position: relative; }
.step::before {
  content: ''; position: absolute; top: 16px; left: calc(-50% + 18px); right: calc(50% + 18px);
  height: 2px; background: var(--border);
}
.step:first-child::before { display: none; }
.step.done::before { background: var(--purple-bright); }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%; margin: 0 auto 6px;
  border: 2px solid var(--border); background: var(--bg-surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; position: relative; z-index: 1;
  transition: all var(--transition);
}
.step.done .step-circle { border-color: var(--green); background: rgba(16,185,129,.2); color: var(--green); }
.step.active .step-circle {
  border-color: var(--purple-bright);
  background: linear-gradient(135deg, var(--purple-bright), var(--orange));
  color: #fff; box-shadow: 0 0 12px rgba(124,58,237,.4);
}
.step-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.step.done .step-label { color: var(--green); }
.step.active .step-label { color: var(--purple-glow); }
