/* ====================================================================
   YouTube Channel Manager — Premium SaaS Dashboard
   Dark theme · Glassmorphism · Responsive grid
   ==================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0B0D17;
  --bg-card: #131626;
  --bg-surface: #181B30;
  --bg-input: #0F1120;
  --bg-sidebar: #080A12;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent: #6366F1;
  --accent-hover: #818CF8;
  --accent-subtle: rgba(99, 102, 241, 0.12);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #22C55E;
  --success-subtle: rgba(34, 197, 94, 0.12);
  --success-glow: rgba(34, 197, 94, 0.25);
  --error: #EF4444;
  --error-subtle: rgba(239, 68, 68, 0.12);
  --warning: #F59E0B;
  --warning-subtle: rgba(245, 158, 11, 0.12);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w: 270px;
}

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

/* ---- Light Mode ------------------------------------------------ */

.light-mode {
  --bg-primary: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-surface: #F1F5F9;
  --bg-input: #E2E8F0;
  --bg-sidebar: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.14);
  --accent: #4F46E5;
  --accent-hover: #6366F1;
  --accent-subtle: rgba(79, 70, 229, 0.08);
  --accent-glow: rgba(79, 70, 229, 0.15);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
}
body, .sidebar, .card, .task-card, .btn, input, select, textarea,
.channel-card, .channel-mosaic, .topbar, .preview-panel, .timeline-panel,
.queue-panel, .groups-panel, .logs-panel, .analytics-panel, .batch-bar {
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(99,102,241,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ---- Layout ---------------------------------------------------- */

.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ---- Sidebar --------------------------------------------------- */

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 14px;
  padding: 28px 22px 24px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.sidebar-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #A855F7);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.sidebar-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }

.sidebar-brand-accent {
  position: absolute; bottom: 0; left: 22px; right: 22px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #A855F7, transparent);
  border-radius: 1px;
  opacity: 0.5;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 22px 18px; }

.sidebar-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-muted);
  margin-bottom: 16px; padding: 0 8px;
}

.sidebar-channel-list { display: flex; flex-direction: column; gap: 3px; }

.sidebar-channel-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: all 0.15s; cursor: default;
}
.sidebar-channel-item:hover { background: rgba(255,255,255,0.03); color: var(--text-primary); }
.sidebar-channel-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.health-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  position: relative;
}
.health-dot.connected { background: var(--success); box-shadow: 0 0 8px var(--success); }
.health-dot.connected::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%; border: 2px solid var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
.health-dot.disconnected { background: var(--error); box-shadow: 0 0 8px var(--error); }
.health-dot.unknown { background: var(--text-muted); }

@keyframes pulse-dot {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 0; transform: scale(2); }
}

.sidebar-empty { padding: 0 12px; font-size: 12px; color: var(--text-muted); }

.sidebar-stats {
  padding: 0 12px; margin-top: 16px; font-size: 11px; color: var(--text-muted);
  display: flex; gap: 16px;
}
.sidebar-stats .stat { display: flex; align-items: center; gap: 5px; }
.sidebar-stats .stat .num { font-weight: 600; color: var(--text-secondary); }

.sidebar-footer { padding: 18px; border-top: 1px solid var(--border); }

.sidebar-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent; color: var(--text-primary);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; font-family: var(--font);
}
.sidebar-btn:hover {
  background: var(--accent-subtle); border-color: var(--accent);
  color: var(--accent-hover); transform: translateY(-1px);
}
.sidebar-btn i { font-size: 18px; }

.sidebar-toggle-group {
  display: flex; gap: 6px; margin-top: 8px;
}
.sidebar-toggle-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted);
  font-size: 12px; cursor: pointer; transition: all 0.2s; font-family: var(--font);
}
.sidebar-toggle-btn:hover { color: var(--text-primary); border-color: var(--border-hover); background: var(--accent-subtle); }
.sidebar-toggle-btn.active { color: var(--accent-hover); border-color: var(--accent); }
.sidebar-toggle-btn i { font-size: 16px; }

/* ---- Main Content ---------------------------------------------- */

.content {
  margin-left: var(--sidebar-w); flex: 1;
  min-width: 0; padding: 32px 40px; max-width: 1280px;
}

/* ---- Top Header ------------------------------------------------ */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; gap: 16px;
}

.topbar-welcome { display: flex; flex-direction: column; gap: 4px; }

.topbar-title {
  font-size: 26px; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(to right, var(--text-primary), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-subtitle {
  font-size: 13px; color: var(--text-muted); font-weight: 400;
}

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

.topbar-divider {
  height: 1px; margin: 0 0 32px;
  background: linear-gradient(90deg, var(--accent), rgba(99,102,241,0.15), transparent);
  border: none; opacity: 0.6;
}

/* ---- Buttons --------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
  text-decoration: none; white-space: nowrap; font-family: var(--font);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn i { font-size: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #A855F7);
  color: #fff; box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 6px 28px var(--accent-glow); filter: brightness(1.1); }

.btn-secondary {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); backdrop-filter: blur(8px);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-surface); border-color: var(--border-hover); }

.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid transparent; padding: 10px 18px;
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); background: rgba(255,255,255,0.04); border-color: var(--border); }

.btn-danger {
  background: transparent; color: var(--error);
  border: 1px solid var(--error); padding: 6px 14px; font-size: 12px;
}
.btn-danger:hover:not(:disabled) { background: var(--error-subtle); }

.btn-sm { padding: 7px 16px; font-size: 13px; }

.btn-glow {
  background: linear-gradient(135deg, var(--accent), #A855F7, #EC4899);
  color: #fff; box-shadow: 0 4px 24px var(--accent-glow);
  animation: button-glow 3s ease-in-out infinite;
}
.btn-glow:hover:not(:disabled) { box-shadow: 0 6px 36px var(--accent-glow); filter: brightness(1.15); }
@keyframes button-glow {
  0%, 100% { box-shadow: 0 4px 20px rgba(99,102,241,0.3); }
  50% { box-shadow: 0 4px 32px rgba(99,102,241,0.5); }
}

.main-content { flex: 1; min-width: 0; }

/* ---- Cards ----------------------------------------------------- */

.card {
  position: relative;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; margin-bottom: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700; margin-bottom: 22px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px;
}
.card-header i { font-size: 16px; }

/* ---- Channel Mosaic Grid ---------------------------------------- */

.channel-mosaic {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px; padding: 4px 0;
}
.channel-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--bg-surface); border: 1px solid var(--border);
  transition: all 0.25s ease; min-width: 0; position: relative; overflow: hidden;
}
.channel-card:hover { background: var(--bg-card); border-color: var(--accent); box-shadow: 0 4px 16px var(--accent-glow); transform: translateY(-1px); }
.channel-card .avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: var(--bg-input); flex-shrink: 0;
}
.channel-card .info { flex: 1; min-width: 0; }
.channel-card .name {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.channel-card .email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.channel-card .health-badge { font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 500; }
.channel-card-right {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.health-ring { width: 38px; height: 38px; flex-shrink: 0; }
.health-ring svg { width: 100%; height: 100%; display: block; }
.health-ring-track { fill: none; stroke: var(--border); stroke-width: 3; }
.health-ring-fill {
  fill: none; stroke: var(--success); stroke-width: 3; stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease, stroke 0.4s ease;
  transform: rotate(-90deg); transform-origin: center;
}
.sparkline-wrap { width: 72px; height: 28px; flex-shrink: 0; }
.sparkline-wrap canvas { width: 100%; height: 100%; display: block; }
.channel-upload-time { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* ---- Channel List (main content) -------------------------------- */

.channel-list { display: flex; flex-direction: column; gap: 10px; }

.channel-list-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; background: var(--bg-input);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: all 0.15s;
}
.channel-list-item:hover { background: var(--bg-surface); border-color: var(--border); }

.channel-list-item .avatar {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--border);
}
.channel-list-item .info { flex: 1; min-width: 0; }
.channel-list-item .name {
  font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.channel-list-item .email { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.channel-empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.channel-empty-icon { font-size: 44px; margin-bottom: 14px; opacity: 0.25; }
.channel-empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.channel-empty-hint { font-size: 13px; }

/* ---- Health Badge ---------------------------------------------- */

.health-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 5px 16px;
  border-radius: 20px; flex-shrink: 0;
}
.health-badge.connected { color: var(--success); background: var(--success-subtle); }
.health-badge.disconnected { color: var(--error); background: var(--error-subtle); }
.health-badge.unknown { color: var(--text-muted); background: rgba(255,255,255,0.04); }

/* ---- Workspace -------------------------------------------------- */

.workspace { margin-bottom: 36px; }

.workspace-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px;
}

.workspace-title {
  display: flex; align-items: center; gap: 12px;
}
.workspace-title i { font-size: 24px; color: var(--accent-hover); }
.workspace-title h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

.workspace-empty {
  text-align: center; padding: 56px 20px; color: var(--text-muted);
}
.workspace-empty i { font-size: 52px; opacity: 0.15; margin-bottom: 14px; }
.workspace-empty p { font-size: 17px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.workspace-empty span { font-size: 13px; }

/* ---- Task Cards (Grid) ------------------------------------------ */

#taskContainer {
  display: grid; grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  #taskContainer { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1400px) {
  #taskContainer { grid-template-columns: repeat(3, 1fr); }
}

.task-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px;
  position: relative;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.task-card:hover { border-color: var(--border-hover); }

.task-card > :nth-child(1) { grid-column: 1 / -1; }
.task-card > :nth-child(2) { grid-column: 1 / -1; }
.task-card > :nth-child(3) { grid-column: 1 / 2; }
.task-card > :nth-child(4) { grid-column: 2 / 3; }
.task-card > :nth-child(5) { grid-column: 1 / -1; }
.task-card > :nth-child(6) { grid-column: 1 / -1; }
.task-card > :nth-child(7) { grid-column: 1 / 2; }
.task-card > :nth-child(8) { grid-column: 2 / 3; }
.task-card > :nth-child(9) { grid-column: 1 / -1; }
.task-card > :nth-child(10) { grid-column: 1 / -1; }
.task-card > :nth-child(11) { grid-column: 1 / -1; }
.task-card > :nth-child(12) { grid-column: 1 / -1; margin-top: 8px; }

.task-card.processing {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 32px var(--accent-glow);
}
.task-card.done {
  border-color: var(--success);
  box-shadow: var(--shadow), 0 0 24px rgba(34,197,94,0.15);
}
.task-card.failed {
  border-color: var(--error);
  box-shadow: var(--shadow), 0 0 24px rgba(239,68,68,0.15);
}

.task-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0;
}
.task-header .task-num {
  font-weight: 600; font-size: 14px; color: var(--text-secondary);
}
.task-header-right { display: flex; align-items: center; gap: 10px; }

/* ---- Form Elements ---------------------------------------------- */

.form-group { margin-bottom: 0; }

.form-group label {
  display: block; font-size: 11px; font-weight: 600; margin-bottom: 8px;
  color: var(--text-secondary); letter-spacing: 0.03em; text-transform: uppercase;
}
.form-group label i { font-size: 13px; margin-right: 5px; }

.form-group select,
.form-group input[type="text"],
.form-group textarea {
  width: 100%; padding: 12px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group select:focus,
.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle), 0 0 16px var(--accent-glow);
}
.form-group select option { background: var(--bg-surface); color: var(--text-primary); }
.form-group textarea { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

.template-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 5px; font-weight: 400;
  text-transform: none; letter-spacing: 0;
}
.template-hint code {
  background: var(--bg-input); padding: 2px 8px; border-radius: 4px;
  font-size: 10px; color: var(--accent-hover); font-family: 'SF Mono', monospace;
}

/* ---- Drag & Drop Zone ------------------------------------------- */

.drop-zone {
  position: relative; border: 2px dashed var(--border);
  border-radius: var(--radius); padding: 32px 24px;
  text-align: center; cursor: pointer;
  transition: all 0.25s ease; background: rgba(255,255,255,0.01);
}
.drop-zone:hover {
  border-color: var(--border-hover); background: rgba(255,255,255,0.02);
  transform: translateY(-1px);
}
.drop-zone.drag-over {
  border-color: var(--accent); background: var(--accent-subtle);
  box-shadow: 0 0 32px var(--accent-glow);
}
.drop-zone.has-file { border-color: var(--success); border-style: solid; background: var(--success-subtle); }

.drop-zone input[type="file"] {
  position: absolute; opacity: 0; width: 100%; height: 100%;
  cursor: pointer; top: 0; left: 0;
}

.drop-zone-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-zone-content i { font-size: 36px; color: var(--text-muted); transition: color 0.25s; }
.drop-zone.drag-over .drop-zone-content i { color: var(--accent-hover); }
.drop-zone-content p { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.drop-zone-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.drop-zone-file { display: none; align-items: center; gap: 12px; padding: 6px 0; }
.drop-zone-file i { font-size: 22px; color: var(--success); }
.drop-zone-file .file-name { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.drop-zone.has-file .drop-zone-content { display: none; }
.drop-zone.has-file .drop-zone-file { display: flex; }

/* ---- Thumbnail Drop Zone ---------------------------------------- */

.drop-zone-thumb {
  padding: 16px 18px; display: flex; align-items: center; justify-content: center;
  flex-direction: row; gap: 18px; border-radius: var(--radius-sm);
  min-height: 72px;
}
.drop-zone-thumb .drop-zone-content { flex-direction: row; gap: 12px; }
.drop-zone-thumb .drop-zone-content i { font-size: 26px; }
.drop-zone-thumb .drop-zone-content p { font-size: 13px; }
.drop-zone-thumb .drop-zone-hint { font-size: 10px; }
.drop-zone-thumb .drop-zone-file { flex-direction: row; gap: 12px; }

.thumb-preview {
  display: none; width: 56px; height: 40px; object-fit: cover;
  border-radius: 6px; border: 2px solid var(--success); flex-shrink: 0;
}

/* ---- AI Auto-Fill Button ---------------------------------------- */

.btn-ai {
  background: linear-gradient(135deg, #A855F7, #EC4899);
  color: #fff; font-size: 12px; padding: 6px 14px; border: none;
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.25s;
  font-family: var(--font); font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.25);
  animation: ai-glow 3s ease-in-out infinite;
}
.btn-ai:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); box-shadow: 0 0 24px rgba(168, 85, 247, 0.5); }
.btn-ai:disabled { opacity: 0.4; cursor: not-allowed; animation: none; }
.btn-ai i { font-size: 14px; }

@keyframes ai-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(168, 85, 247, 0.2); }
  50% { box-shadow: 0 0 22px rgba(168, 85, 247, 0.5); }
}

/* ---- AI Modal --------------------------------------------------- */

.ai-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; animation: fadeIn 0.2s ease;
}
.ai-modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); max-width: 440px; width: 90%;
  box-shadow: var(--shadow-lg);
}
.ai-modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 28px 0; font-size: 17px; font-weight: 700;
}
.ai-modal-header i { font-size: 24px; color: #A855F7; }
.ai-modal-body { padding: 20px 28px; }
.ai-modal-body p { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.6; }
.ai-modal-body input {
  width: 100%; padding: 12px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 14px; font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-modal-body input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.ai-modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 28px 24px; }

/* ---- Preset Select ---------------------------------------------- */

.preset-select {
  padding: 5px 12px; font-size: 12px; font-family: var(--font);
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  cursor: pointer; transition: border-color 0.2s;
}
.preset-select:focus { outline: none; border-color: var(--accent); }
.preset-select option { background: var(--bg-surface); color: var(--text-primary); }
.preset-select:hover { border-color: var(--border-hover); }

/* ---- Toggle Switch ---------------------------------------------- */

.toggle-group { margin-bottom: 0; }

.toggle-label {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 12px 0; user-select: none;
}
.toggle-text {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px; text-transform: uppercase;
  letter-spacing: 0.02em;
}
.toggle-text i { font-size: 14px; color: var(--text-muted); }

.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 12px; transition: all 0.25s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 2px; bottom: 2px; background: var(--text-muted);
  border-radius: 50%; transition: all 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--success-subtle); border-color: var(--success);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px); background: var(--success);
}

/* ---- Schedule Group --------------------------------------------- */

.schedule-group {
  margin-top: 0; padding: 16px; background: var(--accent-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.schedule-group label { font-size: 11px; font-weight: 600; color: var(--accent-hover); text-transform: uppercase; letter-spacing: 0.02em; }
.schedule-group input[type="datetime-local"] {
  width: 100%; padding: 12px 16px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 13px; font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  color-scheme: dark;
}
.schedule-group input[type="datetime-local"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ---- Progress Bars ---------------------------------------------- */

.task-progress { display: none; margin-top: 0; padding-top: 16px; border-top: 1px solid var(--border); }
.task-progress.active { display: block; }

.task-progress-track {
  width: 100%; height: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 5px; overflow: hidden; margin: 10px 0;
}

.task-progress-fill {
  height: 100%; border-radius: 5px; width: 0%;
  transition: width 0.4s ease, background 0.4s ease;
}

.task-progress-fill.active {
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0px,
    #818CF8 8px,
    var(--accent) 16px,
    #4F46E5 24px
  );
  background-size: 32px 100%;
  animation: stripe-move 0.8s linear infinite;
}
@keyframes stripe-move {
  0% { background-position: 0 0; }
  100% { background-position: 32px 0; }
}

.task-progress-fill.done {
  background: linear-gradient(90deg, var(--success), #16A34A);
  box-shadow: 0 0 10px var(--success-glow);
}

.task-progress-fill.fail {
  background: var(--error);
  box-shadow: 0 0 10px rgba(239,68,68,0.3);
}

.task-progress-info { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }

.task-progress-status {
  font-size: 12px; margin-top: 8px; padding: 5px 12px; border-radius: 6px;
  display: inline-block; font-weight: 600;
}
.task-progress-status.uploading { background: var(--accent-subtle); color: var(--accent-hover); }
.task-progress-status.completed { background: var(--success-subtle); color: var(--success); }
.task-progress-status.error { background: var(--error-subtle); color: var(--error); }

.task-progress-result { margin-top: 10px; font-size: 13px; }
.task-progress-result a { color: var(--success); text-decoration: none; font-weight: 600; }
.task-progress-result a:hover { text-decoration: underline; }
.task-progress-result .err-msg { color: var(--error); }

/* ---- Toast Notifications ---------------------------------------- */

.toast-container {
  position: fixed; bottom: 28px; right: 28px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999; max-width: 420px;
}

.toast {
  padding: 16px 20px; border-radius: var(--radius);
  font-size: 13px; animation: toastIn 0.35s ease;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  line-height: 1.4; font-weight: 500;
}

.toast i { font-size: 20px; flex-shrink: 0; }

.toast-success {
  background: rgba(6, 78, 59, 0.35);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ADE80;
}
.toast-error {
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
}
.toast-info {
  background: rgba(30, 58, 138, 0.35);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #818CF8;
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}
.toast.removing { animation: toastOut 0.3s ease forwards; }

/* ---- Custom Confirm Overlay ------------------------------------- */

.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.confirm-box {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; max-width: 400px; width: 90%;
  box-shadow: var(--shadow-lg);
}
.confirm-box p { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions .btn { padding: 10px 20px; font-size: 13px; }

/* ---- Automation Logs Panel ---------------------------------------- */

.logs-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; animation: fadeIn 0.2s ease;
}

.logs-panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 90%; max-width: 680px;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.logs-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 28px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700;
}
.logs-header i { font-size: 20px; color: var(--accent-hover); }

.logs-body {
  flex: 1; overflow-y: auto; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 200px;
  background: #0A0C14;
  font-family: 'SF Mono', 'Consolas', 'Fira Code', monospace;
}

.logs-entry {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px; border-radius: 6px;
  font-size: 12px; line-height: 1.5;
  font-family: inherit;
  background: rgba(255,255,255,0.02);
}
.logs-entry .logs-time { color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }
.logs-entry .logs-icon { flex-shrink: 0; font-size: 14px; }
.logs-entry .logs-msg { color: var(--text-secondary); word-break: break-word; }
.logs-entry.logs-info { border-left: 3px solid var(--accent); }
.logs-entry.logs-success { border-left: 3px solid var(--success); }
.logs-entry.logs-success .logs-icon { color: var(--success); }
.logs-entry.logs-error { border-left: 3px solid var(--error); }
.logs-entry.logs-error .logs-icon { color: var(--error); }

.logs-empty {
  text-align: center; padding: 36px 20px; color: var(--text-muted);
  font-size: 13px;
}
.logs-empty code {
  background: var(--bg-input); padding: 2px 8px; border-radius: 4px;
  font-size: 12px; color: var(--accent-hover);
}

.logs-footer {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; border-top: 1px solid var(--border);
}
.logs-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* ---- Utilities -------------------------------------------------- */

.hidden { display: none !important; }
.mt-16 { margin-top: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }

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

/* ---- Responsive ------------------------------------------------- */

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-title, .sidebar-section-label, .sidebar-channel-item .name,
  .sidebar-empty, .sidebar-stats, .sidebar-btn span,
  .sidebar-brand-accent { display: none; }
  .sidebar-logo { margin: 0 auto; }
  .sidebar-brand { padding: 18px 12px; justify-content: center; }
  .sidebar-nav { padding: 14px 8px; }
  .sidebar-channel-item { justify-content: center; padding: 10px; }
  .sidebar-channel-item .health-dot { margin: 0; }
  .sidebar-footer { padding: 10px; }
  .sidebar-btn { justify-content: center; padding: 10px; }

  .content { margin-left: 60px; padding: 24px 18px; }

  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-right { width: 100%; }

  .form-row { flex-direction: column; gap: 0; }

  .toast-container { left: 18px; right: 18px; max-width: none; }

  .task-card {
    grid-template-columns: 1fr;
  }
  .task-card > :nth-child(3) { grid-column: 1 / -1; }
  .task-card > :nth-child(4) { grid-column: 1 / -1; }
  .task-card > :nth-child(7) { grid-column: 1 / -1; }
  .task-card > :nth-child(8) { grid-column: 1 / -1; }
  .task-card > :nth-child(9) { grid-column: 1 / -1; }
}

/* ---- Analytics Panel (Slide-In) ---------------------------------- */

.analytics-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 9000; display: flex; justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}

.analytics-panel {
  width: 480px; max-width: 90vw; height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: -8px 0 48px rgba(0,0,0,0.5);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.analytics-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.analytics-header-info {
  display: flex; align-items: center; gap: 12px;
  font-size: 16px; font-weight: 700;
}

.analytics-header-info i { font-size: 22px; color: var(--accent-hover); }

.analytics-channel-label {
  font-size: 12px; font-weight: 500;
  color: var(--text-muted); background: var(--accent-subtle);
  padding: 3px 10px; border-radius: 20px;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.analytics-body {
  flex: 1; overflow-y: auto; padding: 24px 28px;
  display: flex; flex-direction: column;
}

.analytics-loading {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  color: var(--text-muted);
}

.analytics-loading p { font-size: 14px; }

.analytics-error {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--error); text-align: center;
}

.analytics-error i { font-size: 36px; opacity: 0.7; }
.analytics-error-msg { font-size: 14px; line-height: 1.5; max-width: 320px; }

.analytics-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--text-muted);
}

.analytics-empty i { font-size: 36px; opacity: 0.3; }
.analytics-empty p { font-size: 14px; }

.analytics-content {
  flex: 1; display: flex; flex-direction: column; gap: 24px;
}

/* ---- Analytics Metrics Grid -------------------------------------- */

.analytics-metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.analytics-stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}

.analytics-stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.analytics-stat-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--accent-subtle);
  color: var(--accent-hover);
  font-size: 20px;
}

.analytics-stat-card:nth-child(1) .analytics-stat-icon { background: rgba(99,102,241,0.12); color: var(--accent-hover); }
.analytics-stat-card:nth-child(2) .analytics-stat-icon { background: var(--success-subtle); color: var(--success); }
.analytics-stat-card:nth-child(3) .analytics-stat-icon { background: var(--warning-subtle); color: var(--warning); }
.analytics-stat-card:nth-child(4) .analytics-stat-icon { background: rgba(168,85,247,0.12); color: #A855F7; }

.analytics-stat-info {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}

.analytics-stat-value {
  font-size: 18px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--text-primary); font-variant-numeric: tabular-nums;
}

.analytics-stat-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
}

/* ---- Analytics Chart --------------------------------------------- */

.analytics-chart-wrapper {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}

.analytics-chart-header {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 16px;
}

.analytics-chart-container {
  position: relative; width: 100%; height: 200px;
}

/* ---- Analytics Responsive ---------------------------------------- */

@media (max-width: 768px) {
  .analytics-panel { width: 100vw; max-width: 100vw; }
  .analytics-metrics { grid-template-columns: 1fr; }
  .analytics-body { padding: 18px; }
  .analytics-header { padding: 18px; }
}

/* ====================================================================
   Enhanced Design System — Premium Visual Layer
   Ambient lighting, micro-interactions, terminal aesthetics
   ==================================================================== */

/* ---- Ambient Glow Orb --------------------------------------------- */

.ambient-orb {
  position: fixed;
  top: -30vh;
  right: -20vw;
  width: 80vw;
  height: 80vh;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle at 60% 50%, rgba(99,102,241,0.10), rgba(168,85,247,0.06) 40%, transparent 70%);
  animation: orb-drift 20s ease-in-out infinite alternate;
}

@keyframes orb-drift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-5%, 3%) scale(1.05); }
  66%  { transform: translate(3%, -2%) scale(0.95); }
  100% { transform: translate(-2%, 4%) scale(1.02); }
}

/* ---- Custom Scrollbar -------------------------------------------- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ---- Focus Ring -------------------------------------------------- */

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Card Hover Elevation ---------------------------------------- */

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(99,102,241,0.04), transparent 50%);
  transition: opacity 0.4s;
  pointer-events: none;
}
.card:hover::after { opacity: 1; }

.task-card {
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}
.task-card:hover { transform: translateY(-2px); }

/* ---- Brand Sidebar Pulse ----------------------------------------- */

.sidebar-logo {
  animation: logo-breathe 4s ease-in-out infinite;
}

@keyframes logo-breathe {
  0%, 100% { box-shadow: 0 4px 16px var(--accent-glow); }
  50% { box-shadow: 0 4px 24px var(--accent-glow), 0 0 40px rgba(99,102,241,0.15); }
}

/* ---- Enhanced Badge ---------------------------------------------- */

.health-badge {
  transition: all 0.25s;
  position: relative;
}
.health-badge::before {
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.25s;
}
.health-badge.connected::before { box-shadow: 0 0 12px var(--success-glow); }
.health-badge.connected:hover { transform: scale(1.04); }
.health-badge.connected:hover::before { opacity: 1; }

/* ---- Enhanced Empty States --------------------------------------- */

.channel-empty-icon i,
.workspace-empty i {
  animation: float-icon 4s ease-in-out infinite;
}

@keyframes float-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.workspace-empty span,
.channel-empty-hint {
  color: var(--text-muted);
  opacity: 0.7;
}

/* ---- Terminal Log Scanline Effect -------------------------------- */

.logs-body {
  position: relative;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,0.015) 2px,
      rgba(255,255,255,0.015) 4px
    ),
    #0A0C14;
}

.logs-body::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
  animation: scan-line 4s linear infinite;
  pointer-events: none;
}

@keyframes scan-line {
  0%   { top: 0; }
  100% { top: 100%; }
}

/* ---- Log Entry Animation ----------------------------------------- */

.logs-entry {
  animation: log-slide-in 0.25s ease-out both;
  transition: background 0.2s;
}
.logs-entry:hover { background: rgba(255,255,255,0.05); }

@keyframes log-slide-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.logs-entry .logs-time {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  font-weight: 500;
}

.logs-entry.logs-info .logs-msg { color: var(--accent-hover); }
.logs-entry.logs-success .logs-msg { color: var(--success); }
.logs-entry.logs-error .logs-msg { color: var(--error); font-weight: 500; }

/* ---- Log Panel Glassmorphism Enhancement ------------------------- */

.logs-panel {
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.logs-header {
  background: rgba(255,255,255,0.02);
}

.logs-footer {
  background: rgba(255,255,255,0.015);
  font-size: 12px;
}

/* ---- Progress Bar Enhancement ------------------------------------ */

.task-progress-track {
  height: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
}

.task-progress-fill {
  position: relative;
  overflow: hidden;
}

.task-progress-fill.active::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 1.2s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---- Toast Enhancement ------------------------------------------- */

.toast {
  border: 1px solid rgba(255,255,255,0.08);
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-weight: 600;
}

.toast-success {
  background: rgba(6, 78, 59, 0.5);
  border-color: rgba(34, 197, 94, 0.25);
}

/* ---- Drop Zone Enhancement --------------------------------------- */

.drop-zone {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.drop-zone:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.02);
  transform: translateY(-2px);
}
.drop-zone.drag-over {
  transform: translateY(-2px) scale(1.01);
}
.drop-zone.has-file {
  border-color: var(--success);
}

/* ---- Modal Enhancement ------------------------------------------- */

.ai-modal,
.confirm-box,
.logs-panel {
  animation: modal-enter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ---- Channel List Item Enhancement ------------------------------- */

.channel-list-item {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.channel-list-item:hover {
  background: var(--bg-surface);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.channel-list-item .avatar {
  transition: border-color 0.2s, transform 0.2s;
}
.channel-list-item:hover .avatar {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* ---- Gradient Text Animation for Sidebar Title ------------------- */

.sidebar-title {
  background: linear-gradient(90deg, var(--text-primary), var(--accent-hover), var(--text-primary));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease-in-out infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

/* ---- Workspace Title Icon Enhancement ---------------------------- */

.workspace-title i {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.workspace-title:hover i {
  transform: rotate(-8deg) scale(1.1);
}

/* ---- AI Option Cards (Human-in-the-Loop) --------------------------- */

.ai-modal-options {
  max-width: 520px;
}

.ai-option-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-option-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.ai-option-card:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.02);
  transform: translateY(-1px);
}
.ai-option-card.ai-selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 20px var(--accent-glow);
}

.ai-option-card-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ai-option-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.ai-option-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-option-card-tags {
  font-size: 11px;
  color: var(--accent-hover);
  font-weight: 500;
}

.ai-option-confirm-bar {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.ai-option-confirm-bar.visible {
  display: block;
}

.ai-option-confirm-bar .btn {
  width: 100%;
  padding: 14px 22px;
  font-size: 14px;
}

/* ---- Bulk Dropzone (Drag-and-Drop Queue) ------------------------- */

.bulk-dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(255,255,255,0.01);
  margin-bottom: 24px;
}
.bulk-dropzone:hover {
  border-color: var(--border-hover);
  background: rgba(255,255,255,0.02);
  transform: translateY(-2px);
}
.bulk-dropzone.bulk-dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: 0 0 48px var(--accent-glow);
  transform: translateY(-2px) scale(1.01);
}
.bulk-dropzone.bulk-has-files {
  border-color: var(--success);
  border-style: solid;
  background: var(--success-subtle);
  padding: 24px 32px;
}

.bulk-dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.bulk-dropzone-content i {
  font-size: 48px;
  color: var(--text-muted);
  transition: color 0.25s;
}
.bulk-dropzone.bulk-dragover .bulk-dropzone-content i {
  color: var(--accent-hover);
}
.bulk-dropzone-content p {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-secondary);
}
.bulk-dropzone-hint {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 400px;
}

.bulk-dropzone-files {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--success);
}
.bulk-dropzone-files i {
  font-size: 24px;
}

.bulk-dropzone-files:hover {
  cursor: default;
}

/* ---- Queue Dashboard Panel ---------------------------------------- */

.queue-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
}

.queue-panel {
  background: var(--bg-card);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 16px;
  width: 520px;
  max-width: 94vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.queue-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.queue-header i { font-size: 22px; color: var(--accent); }

.queue-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

.queue-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
  color: var(--text-muted);
}

.queue-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.queue-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.queue-stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.queue-stat-icon.blue { background: rgba(59,130,246,0.15); color: #60A5FA; }
.queue-stat-icon.green { background: rgba(34,197,94,0.15); color: #4ADE80; }
.queue-stat-icon.indigo { background: rgba(99,102,241,0.15); color: #818CF8; }
.queue-stat-icon.red { background: rgba(239,68,68,0.15); color: #F87171; }
.queue-stat-icon.amber { background: rgba(245,158,11,0.15); color: #FBBF24; }

.queue-stat-info { display: flex; flex-direction: column; }
.queue-stat-value { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.queue-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.queue-extra {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.queue-extra-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.queue-extra-row + .queue-extra-row { border-top: 1px solid rgba(255,255,255,0.04); }

.queue-extra-label { font-size: 13px; color: var(--text-muted); }
.queue-extra-value { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.queue-actions { display: flex; gap: 10px; }

.queue-scheduled-header {
  font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}

.queue-scheduled-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
}

.queue-scheduled-item:last-child { border-bottom: none; }
.queue-scheduled-title { color: var(--text-primary); font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-scheduled-meta { color: var(--text-muted); font-size: 11px; }
.queue-scheduled-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 12px 0; }

/* ---- Groups Panel -------------------------------------------------- */

.groups-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65); z-index: 1200;
  display: none; align-items: center; justify-content: center;
}

.groups-panel {
  background: var(--bg-card); border: 1px solid rgba(99,102,241,0.2);
  border-radius: 16px; width: 480px; max-width: 94vw; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.groups-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  font-size: 17px; font-weight: 700; color: var(--text-primary);
}

.groups-header i { font-size: 22px; color: var(--accent); }

.groups-body { flex: 1; overflow-y: auto; padding: 20px 22px; }

.groups-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 0; color: var(--text-muted); }

.groups-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.groups-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-subtle); color: var(--accent-hover);
  padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  border: 1px solid rgba(99,102,241,0.2);
}

.groups-tag:hover { background: rgba(99,102,241,0.2); }
.groups-tag.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.groups-tag .remove {
  font-size: 14px; cursor: pointer; opacity: 0.6;
  display: inline-flex; align-items: center;
}

.groups-tag .remove:hover { opacity: 1; }

.groups-new { display: flex; gap: 8px; }

.groups-channel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.groups-channel-item:last-child { border-bottom: none; }
.groups-channel-name { flex: 1; color: var(--text-primary); font-weight: 500; }
.groups-channel-email { color: var(--text-muted); font-size: 11px; }

/* ---- AI Prompt Input (per task card) ------------------------------ */

.ai-prompt-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ai-prompt-row .task-ai-prompt {
  flex: 1;
}

/* ---- Preview Panel (Live YouTube Card) --------------------------- */

.preview-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.preview-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 520px; max-width: 94vw;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.preview-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  font-size: 17px; font-weight: 700;
}
.preview-header i { color: var(--accent); font-size: 22px; }
.preview-task-label { font-weight: 400; font-size: 13px; color: var(--text-muted); }
.preview-body { flex: 1; overflow-y: auto; padding: 22px; }

.yt-card-preview {
  background: var(--bg-surface); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  max-width: 400px; margin: 0 auto;
}
.yt-thumbnail {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: var(--bg-input); display: flex; align-items: center;
  justify-content: center; overflow: hidden;
}
.yt-thumb-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); }
.yt-thumb-duration {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.8); color: #fff;
  font-size: 12px; padding: 2px 5px; border-radius: 4px;
  font-weight: 500;
}
.yt-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.yt-card-body { padding: 14px; }
.yt-card-title {
  font-size: 16px; font-weight: 600; line-height: 1.3;
  color: var(--text-primary); display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 8px;
}
.yt-card-channel {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px; font-size: 13px; color: var(--text-secondary);
}
.yt-channel-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-subtle); display: flex;
  align-items: center; justify-content: center; font-size: 13px;
  flex-shrink: 0;
}
.yt-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.yt-card-desc {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- Batch Action Bar -------------------------------------------- */

.batch-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 12px 20px; box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
  animation: batchIn 0.25s ease-out;
}
@keyframes batchIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
.batch-bar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.batch-count { font-size: 13px; font-weight: 600; color: var(--accent-hover); white-space: nowrap; }
.batch-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.batch-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

/* ---- Task Card Selection Checkbox -------------------------------- */

.task-checkbox {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0;
}
.task-checkbox input {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--accent);
}
.task-card.selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent), 0 4px 20px var(--accent-glow);
}

/* ---- Timeline Panel ---------------------------------------------- */

.timeline-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.timeline-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 860px; max-width: 94vw;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.timeline-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  font-size: 17px; font-weight: 700;
}
.timeline-header i { color: var(--accent); font-size: 22px; }
.timeline-nav { display: flex; align-items: center; gap: 4px; margin-left: 20px; }
.timeline-range-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); min-width: 110px; text-align: center; }
.timeline-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.timeline-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 0; color: var(--text-muted); }
.timeline-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 0; color: var(--text-muted); }
.timeline-empty i { font-size: 48px; opacity: 0.15; }
.timeline-empty p { font-size: 15px; }

/* ---- Calendar Grid ----------------------------------------------- */

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.timeline-day-header {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  padding: 6px 0; letter-spacing: 0.05em;
}
.timeline-day {
  background: var(--bg-surface); border-radius: var(--radius-sm);
  min-height: 120px; padding: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
}
.timeline-day.today { border-color: var(--accent); border-style: solid; background: var(--accent-subtle); }
.timeline-day.other-month { opacity: 0.4; }
.timeline-day.drag-over { border-color: var(--accent-hover); background: rgba(99,102,241,0.1); }
.timeline-day-date {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px;
}
.timeline-job {
  background: var(--accent-subtle); border: 1px solid rgba(99,102,241,0.2);
  border-radius: 6px; padding: 4px 6px; margin-bottom: 4px;
  font-size: 11px; cursor: grab; transition: transform 0.1s;
  color: var(--text-primary);
}
.timeline-job:hover { transform: scale(1.02); border-color: var(--accent); }
.timeline-job:active { cursor: grabbing; }
.timeline-job-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-job-channel { font-size: 10px; color: var(--text-muted); }
.timeline-job.dragging { opacity: 0.5; }

/* ---- Responsive fixes for new panels ----------------------------- */

@media (max-width: 768px) {
  .timeline-panel { width: 98vw; max-height: 96vh; }
  .timeline-grid { grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .timeline-day { min-height: 80px; padding: 4px; }
  .timeline-day-header { font-size: 9px; }
  .timeline-job { font-size: 10px; padding: 3px 4px; }
  .batch-actions { gap: 4px; }
  .batch-bar { padding: 8px 12px; }
  .preview-panel { width: 96vw; }
}

/* ---- Channel Loading Skeleton ----------------------------------- */

.channel-skeleton { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.skeleton-row {
  height: 52px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-card) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.channel-skeleton.hide { display: none; }

/* ---- Toast Slide-in Animation ----------------------------------- */

.toast { animation: toastIn 0.3s ease-out; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Progress Bar Glow Pulse ------------------------------------ */

.task-progress-fill.active {
  background: linear-gradient(90deg, var(--accent), #A855F7, var(--accent));
  background-size: 200% 100%;
  animation: progressPulse 2s ease-in-out infinite;
}
@keyframes progressPulse {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---- Retry Button ---------------------------------------------- */

.btn-retry { border-color: var(--warning); color: var(--warning); }
.btn-retry:hover { background: var(--warning-subtle); }

/* ---- Connection Status Indicator -------------------------------- */

.connection-status {
  position: fixed; bottom: 12px; left: 12px; z-index: 200;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 500; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text-muted);
  pointer-events: none; transition: opacity 0.3s;
}
.connection-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); transition: background 0.3s;
}
.connection-status.disconnected .dot { background: var(--error); }
.connection-status.hidden { opacity: 0; }

/* ====================================================================
   Custom Theme Palettes — data-theme attribute on <body>
   ==================================================================== */

[data-theme="forest"] {
  --accent: #10B981; --accent-hover: #34D399;
  --accent-subtle: rgba(16, 185, 129, 0.12);
  --accent-glow: rgba(16, 185, 129, 0.25);
}
[data-theme="forest"].light-mode {
  --accent: #059669; --accent-hover: #10B981;
  --accent-subtle: rgba(5, 150, 105, 0.08);
  --accent-glow: rgba(5, 150, 105, 0.15);
}

[data-theme="sunset"] {
  --accent: #F59E0B; --accent-hover: #FBBF24;
  --accent-subtle: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.25);
}
[data-theme="sunset"].light-mode {
  --accent: #D97706; --accent-hover: #F59E0B;
  --accent-subtle: rgba(217, 119, 6, 0.08);
  --accent-glow: rgba(217, 119, 6, 0.15);
}

[data-theme="ocean"] {
  --accent: #06B6D4; --accent-hover: #22D3EE;
  --accent-subtle: rgba(6, 182, 212, 0.12);
  --accent-glow: rgba(6, 182, 212, 0.25);
}
[data-theme="ocean"].light-mode {
  --accent: #0891B2; --accent-hover: #06B6D4;
  --accent-subtle: rgba(8, 145, 178, 0.08);
  --accent-glow: rgba(8, 145, 178, 0.15);
}

/* ---- Theme Panel ------------------------------------------------- */

.theme-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.theme-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 380px; max-width: 94vw;
  padding: 24px; box-shadow: var(--shadow-lg);
  animation: modal-enter 0.2s ease-out;
  max-height: 90vh; overflow-y: auto;
}
.theme-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; font-size: 17px; font-weight: 700;
}
.theme-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); cursor: pointer;
  transition: all 0.2s; background: var(--bg-surface);
}
.theme-swatch:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.theme-swatch.active { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.theme-swatch-circle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.1);
}
.theme-swatch-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.theme-custom-section { border-top: 1px solid var(--border); padding-top: 16px; }
.theme-custom-section summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.theme-custom-section summary i { margin-right: 6px; }
.theme-custom-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.theme-custom-field { flex: 1; min-width: 100px; }
.theme-custom-field label { display: block; font-size: 10px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.theme-custom-field input[type="color"] { width: 100%; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); cursor: pointer; padding: 2px; }

/* ---- Command Palette (Cmd+K) ------------------------------------ */

.palette-overlay {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(0,0,0,0.6);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
}
.palette-modal {
  width: 520px; max-width: 90vw;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: modal-enter 0.15s ease-out;
}
.palette-search-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.palette-search-wrap i { font-size: 20px; color: var(--text-muted); flex-shrink: 0; }
.palette-search {
  flex: 1; border: none; background: transparent;
  color: var(--text-primary); font-size: 16px; font-family: var(--font);
  outline: none;
}
.palette-search::placeholder { color: var(--text-muted); }
.palette-shortcut {
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  background: var(--bg-surface); color: var(--text-muted);
  border: 1px solid var(--border); font-weight: 500;
}
.palette-results { max-height: 360px; overflow-y: auto; padding: 8px; }
.palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.1s;
  color: var(--text-primary);
}
.palette-item:hover, .palette-item.highlighted {
  background: var(--accent-subtle); color: var(--accent-hover);
}
.palette-item i { font-size: 20px; color: var(--text-muted); width: 24px; text-align: center; flex-shrink: 0; }
.palette-item:hover i { color: var(--accent-hover); }
.palette-item-label { flex: 1; font-size: 14px; font-weight: 500; }
.palette-item-hint {
  font-size: 11px; color: var(--text-muted);
  padding: 2px 8px; border-radius: 4px;
  background: var(--bg-surface); border: 1px solid var(--border);
}
.palette-empty {
  text-align: center; padding: 32px 20px; color: var(--text-muted);
  font-size: 14px;
}

/* ---- Tutorial Overlay ------------------------------------------- */

.tutorial-overlay {
  position: fixed; inset: 0; z-index: 10002;
  background: rgba(0,0,0,0.6);
  display: none; pointer-events: none;
}
.tutorial-highlight {
  position: relative; z-index: 10003 !important;
  box-shadow: 0 0 0 4px var(--accent), 0 0 24px var(--accent-glow) !important;
  border-radius: var(--radius-sm);
  transition: box-shadow 0.3s ease;
}
.tutorial-tooltip {
  position: fixed; z-index: 10004;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  max-width: 340px; box-shadow: var(--shadow-lg);
  pointer-events: auto; animation: modal-enter 0.2s ease-out;
}
.tutorial-tooltip-title {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 8px;
}
.tutorial-tooltip-desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  margin-bottom: 16px;
}
.tutorial-tooltip-footer {
  display: flex; align-items: center; justify-content: space-between;
}
.tutorial-progress { display: flex; gap: 6px; }
.tutorial-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background 0.2s; }
.tutorial-dot.active { background: var(--accent); }
.tutorial-dot.done { background: var(--accent-subtle); }
.tutorial-actions { display: flex; gap: 8px; }
.tutorial-actions .btn { font-size: 12px; padding: 8px 16px; }

/* ---- Mobile Sidebar Hamburger ----------------------------------- */

.sidebar-toggle {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 110;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 20px;
  align-items: center; justify-content: center; cursor: pointer;
}
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0 !important; }
}
