:root{
  --bg: #0a0a0f;
  --panel: #13131a;
  --panel-2: #1c1c28;
  --text: #f0f0ff;
  --muted: #8b8ba7;
  --brand: #7c3aed;
  --brand-2: #a855f7;
  --accent: #06b6d4;
  --border: #2a2a3c;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(168,85,247,.16) 0%, transparent 60%),
    radial-gradient(700px 520px at 0% 0%, rgba(6,182,212,.12) 0%, transparent 55%),
    var(--bg);
}

.restore-overlay{
  position:fixed;
  inset:0;
  background:rgba(11,13,18,.82);
  backdrop-filter: blur(10px);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 9;
  transition: opacity .2s ease;
}
.restore-overlay.is-hidden{
  opacity:0;
  pointer-events:none;
}
.restore-dialog{
  display:flex;
  align-items:center;
  gap:12px;
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding:16px 22px;
  box-shadow: var(--shadow);
}
.restore-dialog .spinner{ margin-right:0; }

/* Layout */
.container{
  width: min(1280px, 92vw);
  margin: 0 auto;
}

.app-header{
  position: sticky; top:0; z-index: 5;
  background: linear-gradient(180deg, rgba(11,13,18,.9), rgba(11,13,18,.6));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.app-header .container{
  display:flex; align-items:center; justify-content:space-between; padding:16px 0;
}
.brand{ display:flex; align-items:center; gap:14px; }
.logo{
  width:40px; height:40px; border-radius:12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display:grid; place-items:center; color:white; font-weight:700;
  box-shadow: var(--shadow);
}
.titles h1{ font-size: 1.25rem; margin:0; }
.subtitle{ margin:2px 0 0; color: var(--muted); font-size:.92rem; }

.actions{ display:flex; gap:10px; }
.btn{
  appearance:none; border:1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  padding:10px 14px; border-radius: 10px; cursor:pointer;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn:hover{ transform: translateY(-1px); }
.btn.primary{
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color:white;
  box-shadow: 0 12px 24px rgba(124,58,237,.28);
}
.btn.ghost{ background: transparent; }
.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; box-shadow:none; }
.input{
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background: rgba(255,255,255,.02);
  color:var(--text);
}
.eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  text-transform:uppercase;
  letter-spacing:.14em;
  font-size:.72rem;
  color:var(--accent);
}

main.container{ padding: 26px 0 60px; display:grid; gap:18px; }

/* Cards */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)), var(--panel);
  border:1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card--highlight{
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(6,182,212,.25), var(--shadow);
}
.card-header{ display:flex; justify-content:space-between; gap:14px; align-items:flex-start; flex-wrap:wrap; }
.card-header h2{ margin:0 0 6px; font-size:1.1rem; }
.muted{ color: var(--muted); }

.landing-shell{
  padding: 10px 0 4px;
}
.landing-hero{
  display:grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
  gap:24px;
  align-items:stretch;
}
.landing-copy{
  padding:36px 6px 18px 0;
}
.landing-copy h2{
  font-size: clamp(2.2rem, 4.4vw, 4rem);
  line-height:1.02;
  margin:16px 0;
  max-width:12ch;
}
.landing-steps{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:14px;
  margin-top:28px;
}
.landing-step{
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:18px;
  padding:16px;
}
.landing-step span{
  display:inline-grid;
  place-items:center;
  width:28px;
  height:28px;
  border-radius:999px;
  background: rgba(124,58,237,.18);
  color: #d8c4ff;
  font-size:.82rem;
  margin-bottom:12px;
}
.landing-step p{ margin:8px 0 0; color:var(--muted); font-size:.92rem; }
.landing-auth-card{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:14px;
  padding:26px;
}
.landing-auth-card h3{ margin:0; font-size:1.4rem; }
.landing-auth-actions{ display:flex; flex-direction:column; gap:12px; }
.landing-magic-link{ display:flex; gap:10px; }

.workspace-layout{
  display:grid;
  grid-template-columns:minmax(0, 1.2fr) minmax(360px, .92fr);
  gap:20px;
}
.workspace-left,
.workspace-right{
  display:grid;
  gap:18px;
  align-content:start;
  min-width:0;
}
.results-header-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.sequence-warning{
  min-height:1.2em;
  margin:12px 0 0;
}

/* Upload row */
.upload-row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.filepicker{
  position:relative; display:inline-block;
  border:1px dashed var(--border); border-radius: 10px; padding: 10px 14px;
  background: var(--panel-2); color: var(--muted);
}
.filepicker input[type=file]{ position:absolute; inset:0; opacity:0; cursor:pointer; }
.filepicker-label{ pointer-events:none; }

/* Video list */
#videoContainer .video-item{
  border:1px solid var(--border); border-radius:12px; padding:12px; margin:12px 0;
  background: var(--panel-2);
}
#videoContainer .video-shell{
  position:relative;
  width:100%; max-width:600px;
}
#videoContainer .video-shell video{
  width:100%; height:auto;
}
#videoContainer .video-placeholder{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  border-radius:8px;
  background:rgba(11,13,18,.85);
  border:1px solid var(--border);
}
#videoContainer .video-placeholder .spinner{ margin:0; }
.video-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
}
#videoContainer video{ width:100%; max-width:600px; height:auto; border-radius:8px; border:1px solid var(--border); }

/* Tag controls, clean inline layout */
.tag-controls{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:10px;
}
.tag-controls label{ display:flex; align-items:center; gap:6px; margin:0; }
.tag-controls input[type=number]{ width:80px; padding:6px 8px; border-radius:8px; border:1px solid var(--border); background: var(--panel); color:var(--text); }
.tag-controls select{ padding:6px 8px; border-radius:8px; border:1px solid var(--border); background: var(--panel); color:var(--text); }
.tag-controls button{
  padding:8px 10px; border-radius:8px; border:1px solid var(--border);
  background: var(--panel); color: var(--text); cursor:pointer;
}
.tag-controls button:hover{ border-color: var(--brand); }

/* Sequence builder */
.sequence-wrapper{
  display:flex; gap:12px; overflow-x:auto; padding:8px; border:1px dashed var(--border);
  border-radius:12px; background: var(--panel-2);
  min-width:0; max-width:100%;
  scroll-snap-type: x mandatory;
}
.sequence-tag{
  display:flex; flex-direction:column; gap:8px;
  border:1px solid var(--border); border-radius:12px; padding:8px;
  min-width:200px; max-width:200px; flex-shrink:0;
  background: var(--panel);
  scroll-snap-align: start;
}
.sequence-tag video{ width: 200px; height: 112px; object-fit: cover; border-radius:8px; border:1px solid var(--border); }
.sequence-tag strong{ font-weight:600; }
.sequence-top{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
}
.sequence-handle{
  cursor:grab;
  user-select:none;
  font-size:1.1rem;
  padding:4px 6px;
  border-radius:8px;
  border:1px solid transparent;
  background:rgba(255,255,255,0.04);
  transition:border-color .2s ease, background .2s ease;
}
.sequence-handle:focus-visible{
  outline:none;
  border-color: var(--brand);
  background: rgba(106,168,255,0.18);
}
.sequence-controls{
  display:flex;
  gap:6px;
}
.sequence-move,
.sequence-remove{
  border:1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius:8px;
  padding:4px 6px;
  cursor:pointer;
}
.sequence-remove{
  font-size:.9rem;
  line-height:1;
}
.sequence-move:disabled{
  opacity:.35;
  cursor:default;
}
.sequence-remove:hover{
  background: rgba(255, 90, 106, 0.15);
  border-color: var(--danger);
}
.sequence-info{
  display:flex;
  flex-direction:column;
  gap:2px;
  font-size:.9rem;
}
.sequence-info span{
  color: var(--muted);
  font-size:.8rem;
}
.sequence-content{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.actions-row{ display:flex; gap:10px; margin-top:12px; }

/* Output */
.output video{
  width:100%; max-width:720px; display:block; margin:0 auto;
  border-radius:12px; border:1px solid var(--border); box-shadow: var(--shadow);
}
.manual-preview-video {
  width: 100%;
  max-width: 360px;
  max-height: 480px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.generated-video-item{
  margin-bottom:24px;
}

.generated-video-item:last-child{
  margin-bottom:0;
}
.status{ min-height: 22px; }
.spinner {
  display:inline-block; width:16px; height:16px; border:2px solid rgba(255,255,255,.25);
  border-top:2px solid white; border-radius:50%; animation: spin .8s linear infinite; margin-right:8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth */
#authContainer{ display:flex; align-items:center; }
.auth-login{ display:flex; flex-direction:column; gap:8px; min-width:240px; }
.auth-magic-link{ display:flex; gap:6px; }
.auth-magic-link .input{ flex:1; padding:6px 10px; border:1px solid var(--border); border-radius:6px; background:var(--surface); color:var(--text); font-size:13px; }
.auth-divider{ text-align:center; color:var(--muted); font-size:12px; }
.auth-user{ display:flex; align-items:center; gap:8px; }
.auth-email{ font-size:13px; color:var(--muted); max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.btn.small{ padding:4px 10px; font-size:12px; }

/* Footer */
.app-footer{
  border-top:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
  padding: 18px 0; color: var(--muted);
}
.app-footer .container{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }

@media (max-width: 780px){
  .actions{ display:none; }
}

/* Upload status badges */
.upload-badge{
  display:inline-block; font-size:12px; padding:2px 8px;
  border-radius:20px; border:1px solid var(--border); color:var(--muted); margin-left:6px;
}
.upload-badge--pending{ color:var(--muted); border-color:var(--border); }
.upload-badge--uploading{ color:var(--warn); border-color:var(--warn); }
.upload-badge--ready{ color:var(--ok); border-color:var(--ok); }
.upload-badge--failed{ color:var(--danger); border-color:var(--danger); }

/* Results gallery */
.results-grid{
  display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px; margin-top:14px;
}
.previous-batch-archive{
  margin-bottom:16px; border:1px solid var(--border); border-radius:8px; padding:10px 14px;
  background:rgba(255,255,255,.02);
}
.previous-batch-archive summary{
  cursor:pointer; font-size:.88rem; color:var(--muted); user-select:none;
}
#cancelBatchBtn{ display:block; margin:12px 0 0; }
.results-filter-bar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:14px;
}
.filter-btn{
  border:1px solid var(--border);
  background:transparent;
  color:var(--muted);
  border-radius:999px;
  padding:7px 12px;
  cursor:pointer;
}
.filter-btn--active{
  color:var(--text);
  border-color:var(--accent);
  background:rgba(6,182,212,.08);
}
.result-tile{
  background:var(--panel-2); border:1px solid var(--border); border-radius:var(--radius);
  padding:14px; display:flex; flex-direction:column; gap:8px;
  position:relative;
  overflow:hidden;
}
.result-tile--enter{ animation: tile-enter .24s ease both; }
.tile-key{ font-size:11px; color:var(--muted); word-break:break-all; }
.tile-status{ font-size:13px; }
.tile-status--pending{ color:var(--muted); }
.tile-status--rendering{ color:var(--brand); display:flex; align-items:center; }
.tile-status--complete{ color:var(--ok); }
.tile-status--failed{ color:var(--danger); }
.tile-status--cancelled{ color:var(--muted); text-decoration:line-through; }
.tile-actions{ display:flex; gap:6px; flex-wrap:wrap; }
.tile-progress-bar{
  width:100%;
  height:8px;
  border-radius:999px;
  background: rgba(255,255,255,.06);
  overflow:hidden;
}
.tile-progress-fill{
  height:100%;
  background: linear-gradient(90deg, var(--accent), var(--brand));
  transition: width .2s ease;
}
@keyframes rendering-progress {
  from { width: 2%; }
  to   { width: 85%; }
}
.tile-progress-fill--animating {
  animation: rendering-progress 90s ease-in forwards;
}
.results-empty-state{
  margin:6px 0 0;
}

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

/* Modal */
.modal-overlay{
  position:fixed; inset:0; background:rgba(11,13,18,.7); backdrop-filter:blur(8px);
  display:flex; align-items:center; justify-content:center; z-index:100;
}
.modal-dialog{
  background:var(--panel); border:1px solid var(--border); border-radius:var(--radius);
  width:min(600px,92vw); max-height:80vh; display:flex; flex-direction:column;
  box-shadow:var(--shadow);
}
.modal-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.modal-header h3{ margin:0; font-size:1rem; }
.modal-close{ background:none; border:none; color:var(--muted); cursor:pointer; font-size:18px; }
.modal-body{ flex:1; overflow-y:auto; padding:16px 20px; }
.modal-footer{ padding:12px 20px; border-top:1px solid var(--border); display:flex; gap:8px; justify-content:flex-end; }
.combo-list{ display:flex; flex-direction:column; gap:8px; }
.combo-row{
  display:flex; align-items:center; gap:10px; padding:8px 12px;
  background:var(--panel-2); border-radius:8px; cursor:pointer;
}
.combo-row--not-ready{ opacity:.5; cursor:default; }
.combo-label{ flex:1; font-size:13px; }
.badge{ font-size:11px; padding:2px 8px; border-radius:20px; border:1px solid; }
.badge--ok{ color:var(--ok); border-color:var(--ok); }
.badge--warn{ color:var(--warn); border-color:var(--warn); }
.error-text{ color:var(--danger); font-size:13px; margin:8px 20px; }

/* ── Auto-generate modal ────────────────────────────────────────────────────── */
.modal-dialog--wide{ width:min(720px,94vw); }
.link-btn{ background:none; border:none; color:var(--brand); cursor:pointer; font-size:12px; padding:0; text-decoration:underline; }
.link-btn:hover{ opacity:.75; }
.btn--warn{ background:var(--warn) !important; border-color:transparent !important; color:#000 !important; }

.ag-section{ padding:16px 0; border-bottom:1px solid var(--border); }
.ag-section:last-child{ border-bottom:none; }
.ag-section-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.ag-section-title{ margin:0 0 10px; font-size:.85rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.ag-section-header .ag-section-title{ margin:0; }
.ag-top-actions{ display:flex; gap:8px; }

.ag-clip-groups{ display:flex; flex-direction:column; gap:10px; }
.ag-date-group{ background:var(--panel-2); border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.ag-group-header{ display:flex; align-items:center; justify-content:space-between; padding:8px 12px; border-bottom:1px solid var(--border); }
.ag-group-label{ display:flex; align-items:center; gap:8px; cursor:pointer; font-size:13px; }
.ag-group-count{ color:var(--muted); font-size:12px; }
.ag-group-actions{ display:flex; gap:8px; }
.ag-clip-list{ display:flex; flex-direction:column; }
.ag-clip-row{
  display:flex; align-items:center; gap:10px; padding:7px 12px;
  cursor:pointer; font-size:13px; border-bottom:1px solid var(--border);
}
.ag-clip-row:last-child{ border-bottom:none; }
.ag-clip-row:hover{ background:rgba(255,255,255,.03); }
.ag-clip-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ag-tag-badge{ font-size:11px; color:var(--muted); font-family:monospace; flex-shrink:0; }

.ag-mode-options{ display:flex; flex-direction:column; gap:8px; }
.ag-mode-option{
  display:flex; align-items:flex-start; gap:10px; padding:10px 12px;
  background:var(--panel-2); border:1px solid var(--border); border-radius:8px; cursor:pointer;
}
.ag-mode-option:has(input:checked){ border-color:var(--brand); }
.ag-mode-option input[type=radio]{ margin-top:2px; flex-shrink:0; }
.ag-mode-body{ display:flex; flex-direction:column; gap:3px; }
.ag-mode-title{ font-size:13px; font-weight:600; display:flex; align-items:center; gap:6px; }
.ag-mode-desc{ font-size:12px; color:var(--muted); }
.ag-custom-n{ width:60px; padding:2px 6px; border-radius:6px; border:1px solid var(--border); background:var(--panel); color:var(--text); font-size:12px; }

.ag-review-stats{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); margin-bottom:8px; }
.ag-dot{ color:var(--border); }
.ag-review-counts{ display:flex; flex-direction:column; gap:4px; }
.ag-count-row--primary{ font-size:14px; }
.ag-count-row--secondary{ font-size:12px; color:var(--muted); }
.ag-fallback-warning{
  background:rgba(255,176,32,.1); border:1px solid rgba(255,176,32,.3);
  border-radius:8px; padding:8px 12px; font-size:12px; color:var(--warn);
  margin-bottom:10px;
}

/* ── Campaigns page ─────────────────────────────────────────────────────────── */
.campaigns-header{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px;
}
.campaigns-hero{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:flex-end;
  padding:8px 2px 4px;
}
.campaigns-hero h2{
  margin:10px 0 8px;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  max-width:14ch;
}
.campaign-zero-state{
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(280px, .9fr);
  gap:18px;
  align-items:end;
  padding:8px 0 22px;
  border-bottom:1px solid var(--border);
  margin-bottom:18px;
}
.campaign-zero-state h3{ margin:.5rem 0; font-size:1.5rem; }
.new-campaign-form{
  display:flex; gap:8px; align-items:center; margin:12px 0; flex-wrap:wrap;
}
.new-campaign-form--hero{
  justify-content:flex-end;
  margin:0;
}
.new-campaign-form .input{
  padding:8px 12px; border:1px solid var(--border); border-radius:10px;
  background:var(--panel-2); color:var(--text); font-size:14px; min-width:220px;
}
.campaign-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(260px, 1fr));
  gap:14px;
  margin-top:16px;
}
.campaign-card{
  background:var(--panel-2); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px; cursor:pointer;
  transition:border-color .18s ease, transform .18s ease, box-shadow .18s ease;
  min-height:190px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.campaign-card:hover{
  border-color:var(--brand); transform:translateY(-4px);
  box-shadow: 0 18px 34px rgba(124,58,237,.16);
}
.campaign-card-name{
  font-weight:600; font-size:1rem; margin-bottom:8px;
}
.campaign-card-meta{
  display:flex; flex-direction:column; gap:4px; font-size:.85rem;
}
.campaign-card-stats{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:8px;
  margin:14px 0 16px;
}
.campaign-card-stat{
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px;
}
.campaign-card-stat strong{
  display:block;
  font-size:1.05rem;
  margin-bottom:2px;
}
.campaign-card-open{
  display:flex;
  justify-content:space-between;
  align-items:center;
  color:#dac6ff;
  font-weight:600;
}
.campaign-card--new{
  border-style:dashed;
  align-items:flex-start;
  justify-content:center;
  gap:12px;
}
.campaign-card--new .campaign-card-open{
  margin-top:auto;
}

/* ── Workspace header additions ─────────────────────────────────────────────── */
.workspace-header{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.workspace-header-shell{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  width:100%;
}
.workspace-brand-block{
  display:flex;
  align-items:center;
  gap:14px;
}
.workspace-meta{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.workspace-toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.campaign-switcher{
  min-width:220px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--panel-2);
  color:var(--text);
}
.workspace-back-link{
  color:var(--muted); text-decoration:none; font-size:.9rem;
  display:flex; align-items:center; gap:4px;
}
.workspace-back-link:hover{ color:var(--text); }
.campaign-name-editable{
  font-size:1.1rem; font-weight:600; background:none; border:none;
  border-bottom:1px solid transparent; color:var(--text); cursor:text;
  padding:2px 4px; border-radius:4px; min-width:80px;
  transition:border-color .2s ease;
}
.campaign-name-editable:hover,
.campaign-name-editable:focus{
  outline:none; border-bottom-color:var(--brand);
}

/* ── Move-to-campaign control ───────────────────────────────────────────────── */
.move-campaign-row{
  display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:0 0 10px;
}
#moveCampaignSelect{
  padding:6px 10px; border:1px solid var(--border); border-radius:8px;
  background:var(--panel-2); color:var(--text); font-size:13px;
}

/* ── Previous clips accordion ───────────────────────────────────────────────── */
.accordion-toggle{
  display:flex; align-items:center; gap:8px; cursor:pointer;
  background:none; border:none; color:var(--text); font-size:.95rem;
  padding:6px 0; margin:14px 0 0;
}
.accordion-toggle .accordion-arrow{ transition:transform .2s ease; display:inline-block; }
.accordion-toggle[aria-expanded="true"] .accordion-arrow{ transform:rotate(90deg); }
.accordion-body[hidden]{ display:none; }

/* ── Upload action buttons ──────────────────────────────────────────────────── */
.upload-actions{
  display:flex; gap:10px; margin-top:12px; flex-wrap:wrap;
}
.btn.small{ padding:5px 12px; font-size:13px; }

/* ── Clip upload status badge ────────────────────────────────────────────────── */
.upload-status-badge{ font-size:0.75rem; color:#888; align-self:center; }
.upload-status-badge--uploading{ color:#f59e0b; }
.upload-status-badge--done{ color:#10b981; }
.upload-status-badge--delayed{ color:var(--warn); }
.upload-status-badge--failed{ color:var(--danger); }

/* ── Library modal ───────────────────────────────────────────────────────────── */
.library-modal-body{ max-height:55vh; overflow-y:auto; padding:16px 20px; }
.library-modal-footer{
  padding:12px 20px; border-top:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:8px;
}
.library-group{ margin-bottom:20px; }
.library-group h3{ font-size:0.8rem; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin:0 0 10px; }
.library-clip-grid{ display:flex; flex-direction:column; gap:6px; }
.library-clip-card{
  padding:10px 14px; background:var(--panel-2); border:1px solid var(--border);
  border-radius:8px; cursor:pointer; transition:border-color .15s;
}
.library-clip-card:hover{ border-color:var(--brand); }
.library-clip-card.selected{ border-color:var(--brand); background:rgba(106,168,255,.08); }
.library-clip-card--imported{ opacity:.55; cursor:default; }
.library-clip-card--imported:hover{ border-color:var(--border); }
.library-clip-imported-badge{ font-size:11px; color:var(--muted); flex-shrink:0; font-style:italic; }
.library-clip-label{ display:flex; align-items:center; gap:10px; cursor:pointer; width:100%; }
.library-clip-checkbox{ flex-shrink:0; accent-color:var(--brand); width:16px; height:16px; }
.library-clip-filename{ flex:1; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.library-clip-duration{ font-size:12px; color:var(--muted); flex-shrink:0; }
.library-clip-tags{ display:flex; gap:4px; flex-shrink:0; }
.tag-badge{ font-size:11px; padding:2px 7px; border-radius:20px; border:1px solid var(--border); color:var(--muted); }
.tag-badge--hook{ color:#6aa8ff; border-color:#6aa8ff44; }
.tag-badge--body{ color:#a78bfa; border-color:#a78bfa44; }
.tag-badge--call-to-action{ color:#34d399; border-color:#34d39944; }

#toastContainer{
  position:fixed;
  top:18px;
  right:18px;
  display:flex;
  flex-direction:column;
  gap:10px;
  z-index:120;
}
.toast{
  min-width:280px;
  max-width:360px;
  background:var(--panel);
  border:1px solid var(--border);
  border-left-width:4px;
  border-radius:14px;
  box-shadow:var(--shadow);
  padding:14px 14px 12px;
  position:relative;
  overflow:hidden;
  transform:translateY(-8px);
  opacity:0;
  transition:transform .2s ease, opacity .2s ease;
}
.toast--visible{ transform:translateY(0); opacity:1; }
.toast--out{ opacity:0; transform:translateY(-6px); }
.toast--success{ border-left-color:var(--ok); }
.toast--warning{ border-left-color:var(--warn); }
.toast--error{ border-left-color:var(--danger); }
.toast-message{ display:block; padding-right:28px; }
.toast-actions{ display:flex; gap:8px; margin-top:10px; }
.toast-close{
  position:absolute;
  top:10px;
  right:10px;
  border:none;
  background:none;
  color:var(--muted);
  cursor:pointer;
}
.toast-progress{
  position:absolute;
  left:0;
  bottom:0;
  height:3px;
  width:100%;
  background:linear-gradient(90deg, var(--accent), var(--brand));
  transform-origin:left;
  animation: toast-progress linear forwards;
}
@keyframes toast-progress {
  from { transform:scaleX(1); }
  to { transform:scaleX(0); }
}

/* ── Section pulse (used by "Add Missing Tags" scroll) ──────────────────────── */
@keyframes section-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(139, 92, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}
.section-pulse {
  animation: section-pulse 1s ease-out 2;
}

/* ── Generate button shimmer on hover ───────────────────────────────────────── */
@keyframes btn-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.btn.primary {
  background-size: 200% auto;
}
.btn.primary:hover {
  background-image: linear-gradient(90deg, var(--brand-2), var(--brand), var(--brand-2));
  animation: btn-shimmer 1.2s linear infinite;
}

/* ── Campaign card hover ─────────────────────────────────────────────────────── */
.campaign-card {
  position: relative;
}

@media (max-width: 1040px){
  .workspace-layout,
  .landing-hero,
  .campaign-zero-state{
    grid-template-columns:1fr;
  }
}

@media (max-width: 780px){
  .actions{ display:none; }
  .landing-steps,
  .campaign-card-stats{
    grid-template-columns:1fr;
  }
  .results-header-actions,
  .workspace-toolbar{
    width:100%;
  }
  .campaign-switcher{
    min-width:0;
    width:100%;
  }
}
