/* ===================================================================
   FrameFlow Design System — Dark Modern SaaS (Linear/Vercel-inspired)
   =================================================================== */

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

/* --- Design Tokens --- */
:root {
  /* Backgrounds */
  --bg-base: #09090b;
  --bg-surface: #111113;
  --bg-card: #18181b;
  --bg-card-hover: #1f1f23;
  --bg-input: #111113;
  --bg-elevated: #202023;

  /* Glass */
  --glass: rgba(255,255,255,0.03);
  --glass-hover: rgba(255,255,255,0.06);
  --glass-active: rgba(255,255,255,0.09);

  /* Borders */
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --border-focus: rgba(59,130,246,0.5);

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;

  /* Accent */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59,130,246,0.4);
  --accent-subtle: rgba(59,130,246,0.1);

  /* Status */
  --success: #22c55e;
  --success-subtle: rgba(34,197,94,0.1);
  --danger: #ef4444;
  --danger-subtle: rgba(239,68,68,0.1);
  --warning: #eab308;
  --warning-subtle: rgba(234,179,8,0.1);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Menlo, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.2s;
  --duration-slow: 0.3s;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --content-max: 720px;
  --header-height: 56px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.5;
  overflow: auto;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
::selection { background: var(--accent-subtle); color: var(--text-primary); }

/* --- Typography --- */
h1 { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); }
h2 { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
h3 { font-size: var(--text-base); font-weight: 600; color: var(--text-primary); }
.section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.mono { font-family: var(--font-mono); }

/* --- App Shell --- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--duration-slow) var(--ease-out);
  overflow: hidden;
  z-index: 50;
}
.sidebar[data-collapsed="true"] { width: var(--sidebar-collapsed); }
.sidebar[data-collapsed="true"] .sidebar-label,
.sidebar[data-collapsed="true"] .sidebar-section-title,
.sidebar[data-collapsed="true"] .sidebar-user-name,
.sidebar[data-collapsed="true"] .sidebar-user-tier { display: none; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4);
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-logo-icon {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-icon svg { width: 14px; height: 14px; color: #fff; }

.sidebar-collapse-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--duration-fast), background var(--duration-fast);
}
.sidebar-collapse-btn:hover { color: var(--text-secondary); background: var(--glass-hover); }

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-2);
  overflow-y: auto;
}
.sidebar-section-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: var(--space-4) var(--space-3) var(--space-2);
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.nav-item:hover { background: var(--glass-hover); color: var(--text-primary); }
.nav-item.active { background: var(--glass-active); color: var(--text-primary); }
.nav-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item-icon svg { width: 18px; height: 18px; }

/* Sidebar user profile at bottom */
.sidebar-user {
  padding: var(--space-3) var(--space-3);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-tier { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* --- Content Area --- */
.content-area {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-base);
  scroll-behavior: smooth;
}
.content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

/* Content header */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}
.content-header h1 { font-size: var(--text-2xl); }
.content-header-actions { display: flex; gap: var(--space-2); }

/* --- Mobile header with hamburger --- */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}
.mobile-hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-1);
  display: flex;
  align-items: center;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--duration-fast);
}
.card-hover:hover { border-color: var(--border-hover); }

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--duration-normal);
}
.glass-card:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

/* --- Forms --- */
label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  transition: border-color var(--duration-fast);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
input:focus, select:focus, textarea:focus { border-color: var(--border-focus); outline: none; box-shadow: 0 0 0 3px var(--accent-subtle); }
input:disabled, select:disabled { opacity: 0.35; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

textarea { resize: vertical; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border: none;
  border-radius: 2px;
  padding: 0;
  cursor: pointer;
  box-shadow: none;
}
input[type="range"]:focus { box-shadow: none; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-base);
  cursor: pointer;
  transition: box-shadow var(--duration-fast);
}
input[type="range"]::-webkit-slider-thumb:hover { box-shadow: 0 0 0 4px var(--accent-subtle); }
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-base);
  cursor: pointer;
}

input[type="color"] {
  padding: 2px;
  height: 36px;
  cursor: pointer;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  transition: all var(--duration-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--glass-hover); border-color: var(--border-hover); }
.btn:active:not(:disabled) { background: var(--glass-active); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-glow);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger-subtle);
}
.btn-danger:hover:not(:disabled) { background: var(--danger-subtle); border-color: var(--danger); }

.btn-ghost {
  border: none;
  color: var(--text-secondary);
  padding: var(--space-2);
}
.btn-ghost:hover:not(:disabled) { background: var(--glass-hover); color: var(--text-primary); border: none; }

.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-lg); }

.btn-icon {
  padding: var(--space-2);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}
.btn-icon:hover { color: var(--text-primary); background: var(--glass-hover); }

/* --- Grid --- */
.grid { display: grid; gap: var(--space-3); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Dropzone --- */
.dropzone {
  position: relative;
  padding: var(--space-12) var(--space-6);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal);
  background: var(--glass);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-icon { margin-bottom: var(--space-3); color: var(--text-muted); }
.dropzone-icon svg { width: 40px; height: 40px; }
.dropzone-text { font-size: var(--text-sm); color: var(--text-secondary); }
.dropzone-text strong { color: var(--accent); font-weight: 500; }
.dropzone-hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-2); }
.dropzone.has-file { border-style: solid; border-color: var(--success); background: var(--success-subtle); }
.dropzone.has-file .dropzone-text { color: var(--success); }
.dropzone.has-file .dropzone-icon { color: var(--success); }

/* --- Steps / Progress Indicator --- */
.steps {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal);
}
.step-number {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.step.active { color: var(--accent); border-color: var(--accent); }
.step.active .step-number { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.step.done { color: var(--success); border-color: var(--success); }
.step.done .step-number { background: var(--success); border-color: var(--success); color: #fff; }

/* --- Toggle Switch --- */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  transition: background var(--duration-normal);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--duration-normal) var(--ease-out);
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { left: 18px; background: #fff; }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Accordion / Collapsible --- */
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: none; }
.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) 0;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 500;
  font-family: var(--font-sans);
  text-align: left;
}
.accordion-trigger:hover { color: var(--accent); }
.accordion-summary { font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; margin-left: var(--space-3); }
.accordion-chevron {
  transition: transform var(--duration-normal) var(--ease-out);
  color: var(--text-muted);
  flex-shrink: 0;
}
.accordion-item.open .accordion-chevron { transform: rotate(180deg); }
.accordion-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--duration-slow) var(--ease-out);
}
.accordion-item.open .accordion-content { max-height: 1000px; }
.accordion-body { padding-bottom: var(--space-5); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-default { background: var(--glass); color: var(--text-muted); }
.badge-accent { background: var(--accent-subtle); color: var(--accent); }
.badge-success { background: var(--success-subtle); color: var(--success); }
.badge-danger { background: var(--danger-subtle); color: var(--danger); }
.badge-starter { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-pro { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-enterprise { background: rgba(234,179,8,0.15); color: #facc15; }

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow);
  width: 0%;
}
.progress-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

/* --- Status Text --- */
.status { margin-top: var(--space-3); font-size: var(--text-sm); font-weight: 500; }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }

/* --- Note --- */
.note { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-1); line-height: 1.5; }
.note code { background: var(--glass); padding: 1px 5px; border-radius: var(--radius-sm); font-size: 11px; font-family: var(--font-mono); }

/* --- Divider --- */
.divider { border: none; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

/* --- Preview Strip --- */
.preview-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--space-2); }
.preview-strip img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); }
.preview-meta { display: flex; gap: var(--space-4); margin-top: var(--space-2); font-size: var(--text-xs); color: var(--text-secondary); }

/* --- Overlay rows (reused for snaps, transitions, hotspots) --- */
.config-row {
  display: grid;
  gap: var(--space-2);
  align-items: end;
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.config-row-6 { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; }
.config-row-5 { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
.config-row-4 { grid-template-columns: 1fr 1fr 1fr auto; }
.config-row-3 { grid-template-columns: 1fr 1fr auto; }
.config-row input, .config-row select { font-size: var(--text-xs); padding: var(--space-1) var(--space-2); }
.config-row label { margin: 0 0 2px; font-size: 11px; }

.add-btn {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border-style: dashed;
  color: var(--text-muted);
  width: 100%;
  text-align: center;
}
.add-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); }

/* --- Preset Bar --- */
.preset-bar {
  display: flex;
  gap: var(--space-2);
  align-items: end;
}
.preset-bar select { flex: 1; }

/* --- Key management --- */
.key-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  transition: border-color var(--duration-fast);
}
.key-card:hover { border-color: var(--border-hover); }
.key-info { display: flex; align-items: center; gap: var(--space-3); }
.key-info strong { font-size: var(--text-sm); font-weight: 600; }
.key-status { font-size: 11px; padding: 2px var(--space-2); border-radius: var(--radius-full); }
.key-valid { background: var(--success-subtle); color: var(--success); }
.key-invalid { background: var(--danger-subtle); color: var(--danger); }
.key-none { color: var(--text-muted); font-size: 11px; }
.key-actions { display: flex; gap: var(--space-1); }
.key-input-form {
  width: 100%;
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-card);
  border-radius: var(--radius-md);
}
.key-input-form input { flex: 1; font-size: var(--text-xs); }

/* --- Auth Modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}
.modal-header h2 { font-size: var(--text-xl); color: var(--text-primary); text-transform: none; letter-spacing: -0.01em; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}
.modal-close:hover { color: var(--text-primary); background: var(--glass-hover); }
.auth-error { color: var(--danger); font-size: var(--text-xs); margin-top: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--danger-subtle); border-radius: var(--radius-md); }
.auth-switch { margin-top: var(--space-3); text-align: center; font-size: var(--text-xs); color: var(--text-secondary); }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* --- Embed Code --- */
.embed-row { display: flex; gap: var(--space-2); align-items: stretch; }
.embed-row textarea {
  flex: 1;
  font-size: 11px;
  font-family: var(--font-mono);
  resize: none;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

/* --- Generate panel inline --- */
.gen-inline {
  padding: var(--space-4);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
}
.gen-status { font-size: var(--text-xs); color: var(--text-secondary); }
.gen-status.success { color: var(--success); }
.gen-status.error { color: var(--danger); }

/* --- Exports Gallery --- */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}
.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--duration-normal);
}
.export-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.export-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.export-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.export-card-body { padding: var(--space-3); }
.export-card-title { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); margin-bottom: var(--space-1); }
.export-card-meta { font-size: var(--text-xs); color: var(--text-muted); }
.export-card-share { display: flex; gap: var(--space-1); margin-top: var(--space-2); }
.share-url-input { font-size: 11px; padding: 4px 8px; flex: 1; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); }
.export-card-actions { display: flex; gap: var(--space-1); padding: 0 var(--space-3) var(--space-3); flex-wrap: wrap; }

/* --- Billing --- */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  transition: all var(--duration-normal);
}
.plan-card.current { border-color: var(--accent); }
.plan-card:hover { border-color: var(--border-hover); }
.plan-price { font-size: var(--text-3xl); font-weight: 700; color: var(--text-primary); margin: var(--space-2) 0; }
.plan-price span { font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); }
.plan-features { list-style: none; text-align: left; margin: var(--space-4) 0; }
.plan-features li { font-size: var(--text-sm); color: var(--text-secondary); padding: var(--space-1) 0; display: flex; align-items: center; gap: var(--space-2); }
.plan-features li::before { content: '✓'; color: var(--success); font-weight: 600; }

/* Usage meters */
.usage-meter { margin-bottom: var(--space-4); }
.usage-meter-header { display: flex; justify-content: space-between; margin-bottom: var(--space-1); }
.usage-meter-label { font-size: var(--text-sm); color: var(--text-secondary); }
.usage-meter-value { font-size: var(--text-sm); color: var(--text-primary); font-weight: 500; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--text-muted);
}
.empty-state-icon { margin-bottom: var(--space-4); }
.empty-state-icon svg { width: 48px; height: 48px; opacity: 0.5; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state p { font-size: var(--text-sm); max-width: 320px; margin: 0 auto; }

/* --- Skeleton Loading --- */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}
.skeleton {
  background: var(--glass);
  border-radius: var(--radius-md);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-text-sm { height: 12px; width: 60%; margin-bottom: var(--space-2); }
.skeleton-card { height: 200px; border-radius: var(--radius-lg); }

/* --- Utility --- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.w-full { width: 100%; }

/* --- Exports filter bar --- */
.exports-filter-bar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
}
.exports-search {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
}
.exports-search:focus { border-color: var(--accent); outline: none; }
.exports-filter-bar select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
}
.exports-filter-bar select:focus { border-color: var(--accent); outline: none; }
.exports-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* --- Analytics --- */
.analytics-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.analytics-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}
.analytics-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.analytics-stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.analytics-breakdowns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.analytics-bar-chart {
  height: 120px;
}
.bar-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 100px;
}
.bar-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.bar-chart-fill {
  width: 100%;
  background: var(--border);
  border-radius: 2px 2px 0 0;
  transition: height var(--duration-normal);
  min-height: 2px;
}
.bar-chart-fill.active { background: var(--accent); }
.bar-chart-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
  height: 14px;
  white-space: nowrap;
}
.breakdown-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.breakdown-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-primary);
  width: 50px;
  flex-shrink: 0;
}
.breakdown-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.breakdown-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow);
}
.breakdown-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  width: 70px;
  text-align: right;
  flex-shrink: 0;
}

/* --- Export detail modal --- */
.export-detail-table { margin-bottom: var(--space-3); }
.export-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.export-detail-row:last-child { border-bottom: none; }
.export-detail-label { color: var(--text-muted); }
.export-detail-value { color: var(--text-primary); font-weight: 500; }
.export-detail-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
  margin-bottom: var(--space-3);
}
.export-detail-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Export rename button */
.export-rename-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  opacity: 0;
  transition: opacity var(--duration-fast);
  flex-shrink: 0;
}
.export-card:hover .export-rename-btn { opacity: 1; }
.export-rename-btn:hover { color: var(--accent); }

/* --- Activity feed --- */
.activity-list { display: flex; flex-direction: column; gap: 2px; }
.activity-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  align-items: flex-start;
}
.activity-row:hover { border-color: var(--border-hover); }
.activity-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}
.activity-info { flex: 1; min-width: 0; }
.activity-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}
.activity-type { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.activity-bottom { line-height: 1.4; }
.activity-error { color: var(--danger); margin-top: 2px; }
.activity-prompt { font-style: italic; margin-top: 2px; }

/* Badge variants */
.badge-sm { font-size: 10px; padding: 1px 6px; }
.badge-success { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-error { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-warning { background: rgba(234,179,8,0.15); color: #eab308; }
.badge-default { background: var(--bg-surface); color: var(--text-muted); }

/* --- Overview section --- */
.overview-quotas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.overview-quota-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}
.overview-quota-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.overview-quota-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.overview-recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.overview-export-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.overview-export-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.overview-activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: var(--space-2);
}
.overview-activity-row:last-child { border-bottom: none; }
.overview-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* --- Notification Bell --- */
.notif-bell-wrap {
  position: relative;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.notif-bell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all var(--duration-fast);
}
.notif-bell:hover { background: var(--glass-hover); color: var(--text-primary); border-color: var(--border-hover); }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
}
.notif-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 12px;
  width: 320px;
  max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  z-index: 100;
  overflow: hidden;
  margin-bottom: 8px;
}
.notif-dropdown.open { display: flex; flex-direction: column; }
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-dropdown-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.notif-mark-all {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
}
.notif-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-fast);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--glass-hover); }
.notif-item.unread { background: var(--accent-subtle); }
.notif-item.unread:hover { background: rgba(59,130,246,0.15); }
.notif-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.notif-icon-success { background: var(--success-subtle); color: var(--success); }
.notif-icon-error { background: var(--danger-subtle); color: var(--danger); }
.notif-icon-warning { background: var(--warning-subtle); color: var(--warning); }
.notif-icon-info { background: var(--accent-subtle); color: var(--accent); }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--text-primary); line-height: 1.3; }
.notif-body { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* --- Settings --- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}
.settings-field label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}
.settings-field input,
.settings-field select {
  width: 100%;
}
.settings-field-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: var(--space-1);
}
.settings-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  gap: var(--space-4);
}
.settings-toggle:last-child { border-bottom: none; }
.settings-toggle:hover { opacity: 0.9; }
.settings-toggle-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.settings-toggle-desc { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.settings-toggle input[type="checkbox"] {
  width: 36px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration-fast);
}
.settings-toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--duration-fast);
}
.settings-toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.settings-toggle input[type="checkbox"]:checked::after {
  left: 18px;
  background: #fff;
}

/* --- Quota Warning Colors --- */
.progress-fill.quota-warning { background: var(--warning) !important; }
.progress-fill.quota-critical { background: var(--danger) !important; }

/* --- Bulk Actions --- */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.export-select-checkbox {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  z-index: 2;
  cursor: pointer;
  accent-color: var(--accent);
}
.export-card { position: relative; }
.select-mode .export-select-checkbox { display: block; }
.export-card:hover .export-select-checkbox { display: block; }
.export-card.selected { border-color: var(--accent); background: var(--accent-subtle); }

/* --- Export Detail Thumbnail --- */
.export-detail-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
}
.export-detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Invoice History --- */
.invoice-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.invoice-row:last-child { border-bottom: none; }
.invoice-date { min-width: 90px; }
.invoice-number { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.invoice-amount { font-weight: 500; color: var(--text-primary); min-width: 60px; }
.invoice-actions { display: flex; gap: var(--space-1); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform var(--duration-slow) var(--ease-out); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .mobile-header { display: flex; }
  .content-inner { padding: var(--space-4); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .config-row-6, .config-row-5, .config-row-4, .config-row-3 { grid-template-columns: 1fr; }
  .steps { flex-direction: column; }
  .export-grid { grid-template-columns: 1fr; }
  .plan-cards { grid-template-columns: 1fr; }
  .analytics-overview { grid-template-columns: repeat(2, 1fr); }
  .analytics-breakdowns { grid-template-columns: 1fr; }
  .exports-filter-bar { flex-direction: column; }
  .exports-search { min-width: 100%; }
  .overview-quotas { grid-template-columns: 1fr; }
  .overview-recent-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .notif-dropdown { width: 280px; left: 8px; }
  .bulk-action-bar { flex-direction: column; align-items: stretch; }
  .invoice-row { flex-wrap: wrap; gap: var(--space-1); }
  .invoice-number { flex-basis: 100%; }
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .config-row-6 { grid-template-columns: repeat(3, 1fr); }
  .config-row-5 { grid-template-columns: repeat(3, 1fr); }
  .analytics-overview { grid-template-columns: repeat(2, 1fr); }
  .plan-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .content-inner { padding: var(--space-3); }
  .card { padding: var(--space-3); }
  .modal { width: 95%; padding: var(--space-4); }
  .analytics-overview { grid-template-columns: 1fr; }
  .exports-grid-item { padding: var(--space-3); }
  .btn { padding: 8px 12px; font-size: var(--text-sm); }
  .stats-grid { grid-template-columns: 1fr; }
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Input tabs (file / URL / stitch) */
.input-tabs { display: flex; gap: 2px; margin-bottom: var(--space-3); background: var(--bg-surface); border-radius: 8px; padding: 2px; }
.input-tab { flex: 1; padding: 8px 12px; border: none; background: transparent; color: var(--text-secondary); font-size: var(--text-sm); font-weight: 500; border-radius: 6px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.input-tab:hover { color: var(--text-primary); }
.input-tab.active { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

/* Trim slider */
.trim-panel { margin: var(--space-3) 0; }
.trim-filmstrip { display: flex; height: 48px; overflow: hidden; border-radius: 6px; background: var(--bg-surface); }
.trim-filmstrip img { flex: 1; object-fit: cover; min-width: 0; pointer-events: none; }
.trim-track { position: relative; height: 48px; margin-top: -48px; user-select: none; }
.trim-selection { position: absolute; top: 0; bottom: 0; background: rgba(59,130,246,0.15); border-top: 2px solid var(--accent); border-bottom: 2px solid var(--accent); pointer-events: none; }
.trim-handle { position: absolute; top: -2px; bottom: -2px; width: 12px; background: var(--accent); cursor: ew-resize; border-radius: 3px; z-index: 2; display: flex; align-items: center; justify-content: center; }
.trim-handle::after { content: ""; width: 2px; height: 16px; background: rgba(255,255,255,0.7); border-radius: 1px; }
.trim-handle:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.trim-dimmed-left, .trim-dimmed-right { position: absolute; top: 0; bottom: 0; background: rgba(0,0,0,0.5); pointer-events: none; }
.trim-times { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

/* Stitch clip list */
.stitch-clip-list { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.stitch-clip-row { display: flex; align-items: center; gap: var(--space-3); padding: 8px 12px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; cursor: grab; }
.stitch-clip-row.dragging { opacity: 0.5; }
.stitch-clip-row .stitch-grip { color: var(--text-muted); flex-shrink: 0; cursor: grab; }
.stitch-clip-row .stitch-clip-name { flex: 1; font-size: var(--text-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stitch-clip-row .stitch-clip-size { font-size: var(--text-xs); color: var(--text-muted); flex-shrink: 0; }

/* Image sequence / Ken Burns panel */
.images-mode-tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-3); }
.images-mode-tab { padding: 6px 14px; border-radius: 6px; font-size: var(--text-sm); font-weight: 500; background: transparent; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.images-mode-tab:hover { color: var(--text); border-color: var(--text-muted); }
.images-mode-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.image-seq-list { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-3) 0; max-height: 360px; overflow-y: auto; }
.image-seq-row { display: flex; align-items: center; gap: var(--space-3); padding: 8px 12px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; cursor: grab; }
.image-seq-row.dragging { opacity: 0.5; }
.image-seq-row .seq-grip { color: var(--text-muted); flex-shrink: 0; cursor: grab; }
.image-seq-row .seq-thumb { width: 48px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.image-seq-row .seq-name { flex: 1; font-size: var(--text-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-seq-row .seq-size { font-size: var(--text-xs); color: var(--text-muted); flex-shrink: 0; }
.image-seq-row .seq-effect { font-size: var(--text-xs); flex-shrink: 0; }
.image-seq-row .seq-effect select { font-size: var(--text-xs); padding: 2px 4px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.image-seq-row .seq-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; border-radius: 4px; flex-shrink: 0; }
.image-seq-row .seq-remove:hover { color: var(--danger, #ef4444); background: rgba(239,68,68,0.1); }

/* AI image upload in generation panel */
.gen-image-tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-2); }
.gen-image-tab { padding: 4px 10px; border-radius: 4px; font-size: var(--text-xs); font-weight: 500; background: transparent; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; }
.gen-image-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.gen-image-preview { margin-top: var(--space-2); position: relative; display: inline-block; }
.gen-image-preview img { max-width: 200px; max-height: 150px; border-radius: 6px; border: 1px solid var(--border); }
.gen-image-preview .gen-image-clear { position: absolute; top: 4px; right: 4px; padding: 2px 6px; font-size: var(--text-xs); background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 4px; cursor: pointer; }

/* Provider capability badge */
.provider-badge { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); padding: 2px 8px; border-radius: 10px; }
.provider-badge.supports-image { background: rgba(34,197,94,0.15); color: #22c55e; }
.provider-badge.text-only { background: rgba(234,179,8,0.15); color: #eab308; }

/* --- Template Picker --- */
.template-categories { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); overflow-x: auto; scrollbar-width: none; }
.template-categories::-webkit-scrollbar { display: none; }
.template-category-pill { padding: 4px 12px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 500; background: var(--glass); color: var(--text-secondary); border: 1px solid var(--border); cursor: pointer; white-space: nowrap; transition: border-color var(--duration-fast), color var(--duration-fast); }
.template-category-pill:hover { border-color: var(--border-hover); color: var(--text-primary); }
.template-category-pill.active { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.template-strip { display: flex; gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-2); scroll-snap-type: x mandatory; scrollbar-width: thin; }
.template-strip::-webkit-scrollbar { height: 6px; }
.template-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.template-mini-card { min-width: 190px; max-width: 210px; flex-shrink: 0; scroll-snap-align: start; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: border-color var(--duration-normal), transform var(--duration-normal); text-align: left; color: inherit; font: inherit; padding: 0; }
.template-mini-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.template-mini-card-thumb { width: 100%; height: 100px; display: flex; align-items: center; justify-content: center; }
.template-mini-card-initials { font-size: 1.25rem; font-weight: 700; color: rgba(255,255,255,0.85); text-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.template-mini-card-body { padding: var(--space-2) var(--space-3) var(--space-3); }
.template-mini-card-title { font-size: var(--text-sm); font-weight: 600; margin-bottom: 2px; }
.template-mini-card-desc { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- Deploy Panel --- */
.deploy-panel .deploy-status { margin-top: var(--space-3); }

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