/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --sidebar-w: 220px;
  --bg:        #f5f0eb;
  --surface:   #ffffff;
  --surface2:  #fdf9f6;
  --border:    #e8e0d8;
  --sidebar:   #1e140c;
  --sidebar2:  #2c1f14;
  --accent:    #c96a38;
  --accent2:   #b85e2e;
  --accentBg:  #fdf0e8;
  --text:      #2c1a0e;
  --textMid:   #6b4f3a;
  --textLight: #a08878;
  --green:     #2d8c5e;
  --greenBg:   #e6f5ee;
  --blue:      #2d6cb0;
  --blueBg:    #e6eef8;
  --yellow:    #c4882a;
  --yellowBg:  #fdf4e0;
  --red:       #b0432e;
  --redBg:     #fbeae6;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --shadowMd:  0 4px 24px rgba(0,0,0,.10);
  --trans:     0.2s ease;
}
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Layout ────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 0 20px;
  overflow: hidden;
}
.sidebar-logo { padding: 0 20px 28px; display: flex; align-items: center; gap: 10px; color: #fff; }
.sidebar-logo .logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: grid; place-items: center; font-size: 16px; flex-shrink: 0; }
.sidebar-logo .logo-text { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.sidebar-logo .logo-badge { font-size: 10px; background: rgba(255,255,255,.12); color: rgba(255,255,255,.6); padding: 2px 6px; border-radius: 99px; margin-left: auto; }
.sidebar-new-btn {
  margin: 0 16px 24px; background: var(--accent); color: #fff; border-radius: var(--radius-sm);
  padding: 10px 14px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px;
  transition: background var(--trans);
}
.sidebar-new-btn:hover { background: var(--accent2); }
.sidebar-new-btn .plus { font-size: 18px; line-height: 1; }
.sidebar-new-btn:disabled { opacity: .6; cursor: default; }
.sidebar-nav { flex: 1; padding: 0 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55); font-size: 14px; font-weight: 500; transition: all var(--trans);
}
.nav-item:hover { background: var(--sidebar2); color: rgba(255,255,255,.85); }
.nav-item.active { background: rgba(201,106,56,.2); color: var(--accent); }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-divider { border: none; border-top: 1px solid rgba(255,255,255,.06); margin: 12px 8px; }
.sidebar-bottom { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-plan { background: rgba(255,255,255,.06); border-radius: var(--radius-sm); padding: 10px 12px; color: rgba(255,255,255,.55); font-size: 12px; }
.sidebar-plan strong { color: rgba(255,255,255,.85); display: block; margin-bottom: 2px; font-size: 13px; }
.sidebar-plan .plan-bar-track { height: 3px; background: rgba(255,255,255,.12); border-radius: 99px; margin-top: 6px; }
.sidebar-plan .plan-bar-fill { height: 3px; background: var(--accent); border-radius: 99px; width: 35%; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: var(--radius-sm); color: rgba(255,255,255,.55); font-size: 13px; cursor: pointer; transition: all var(--trans); }
.sidebar-user:hover { color: rgba(255,255,255,.85); }
.sidebar-user .avatar { width: 28px; height: 28px; background: var(--accent); border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* ── Main ──────────────────────────────────────────── */
#main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* ── Screens ───────────────────────────────────────── */
.screen { display: none; flex: 1; }
.screen.active { display: flex; flex-direction: column; }

/* ── Screen: Home ──────────────────────────────────── */
#screen-home { padding: 40px 48px; gap: 28px; }
.home-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.home-header h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.home-header p { color: var(--textMid); margin-top: 4px; font-size: 14px; }
.home-cta-card {
  background: linear-gradient(135deg, #2c1a0e 0%, #3d2614 100%); border-radius: var(--radius);
  padding: 32px 36px; display: flex; align-items: center; gap: 32px; position: relative; overflow: hidden;
}
.home-cta-card::before {
  content: ''; position: absolute; top: -60px; right: -60px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(201,106,56,.3) 0%, transparent 70%); border-radius: 50%;
}
.home-cta-card .cta-text h2 { font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.home-cta-card .cta-text p { color: rgba(255,255,255,.6); margin-top: 6px; font-size: 14px; max-width: 380px; }
.home-cta-card .cta-btn {
  flex-shrink: 0; background: var(--accent); color: #fff; padding: 12px 24px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 15px; transition: background var(--trans); white-space: nowrap;
}
.home-cta-card .cta-btn:hover { background: var(--accent2); }
.section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--textLight); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.empty-state { grid-column: 1 / -1; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--textLight); font-size: 14px; }
.project-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden;
  cursor: pointer; transition: box-shadow var(--trans), transform var(--trans); box-shadow: var(--shadow);
}
.project-card:hover { box-shadow: var(--shadowMd); transform: translateY(-1px); }
.project-card .card-thumb { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 36px; position: relative; }
.project-card .card-thumb .format-badges { position: absolute; bottom: 8px; right: 8px; display: flex; gap: 4px; }
.project-card .card-thumb .fb { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.5); color: #fff; }
.project-card .card-body { padding: 14px 16px 16px; }
.project-card .card-body h3 { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.project-card .card-meta { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.project-card .card-date { font-size: 12px; color: var(--textLight); }
.card-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.card-status-dot.ready { background: var(--green); }
.card-status-dot.draft { background: var(--yellow); }
.card-status-dot.failed { background: var(--red); }
.project-card .card-stats { margin-top: 10px; display: flex; gap: 12px; }
.project-card .stat-chip { font-size: 11px; color: var(--textMid); background: var(--surface2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 99px; }

/* ── Screen: Add Article ──────────────────────────── */
#screen-add { padding: 0; align-items: stretch; }
.add-topbar { padding: 20px 48px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 20px; }
.back-btn { display: flex; align-items: center; gap: 6px; color: var(--textMid); font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: var(--radius-sm); transition: all var(--trans); }
.back-btn:hover { background: var(--bg); color: var(--text); }
.add-topbar h2 { font-size: 17px; font-weight: 700; }
.add-topbar .step-label { margin-left: auto; font-size: 13px; color: var(--textLight); }
.add-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 48px 48px 32px; gap: 32px; }
.add-card { width: 100%; max-width: 680px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.add-tabs { display: flex; border-bottom: 1px solid var(--border); }
.add-tab { flex: 1; padding: 14px 20px; font-size: 14px; font-weight: 500; color: var(--textMid); border-bottom: 2px solid transparent; transition: all var(--trans); text-align: center; }
.add-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--accentBg); }
.add-tab:hover:not(.active) { background: var(--surface2); color: var(--text); }
.add-tab-panel { display: none; padding: 28px; }
.add-tab-panel.active { display: block; }
.url-input-wrap { position: relative; }
.url-input-wrap input {
  width: 100%; padding: 13px 48px 13px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; background: var(--surface2); transition: border-color var(--trans), box-shadow var(--trans); color: var(--text);
}
.url-input-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,106,56,.12); }
.url-input-wrap input::placeholder { color: var(--textLight); }
.url-check-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; }
.paste-area {
  width: 100%; min-height: 180px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--surface2); resize: vertical; transition: border-color var(--trans), box-shadow var(--trans); color: var(--text);
}
.paste-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,106,56,.12); }
.paste-area::placeholder { color: var(--textLight); }
.paste-hint { margin-top: 8px; font-size: 12px; color: var(--textLight); }
.analyze-footer { padding: 20px 28px; background: var(--surface2); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.analyze-btn { background: var(--accent); color: #fff; padding: 11px 24px; border-radius: var(--radius-sm); font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; transition: background var(--trans); }
.analyze-btn:hover { background: var(--accent2); }
.analyze-btn:disabled { opacity: .6; cursor: default; }
.analyze-btn .btn-icon { font-size: 16px; }
.review-link { font-size: 13px; color: var(--textMid); padding: 6px 10px; border-radius: var(--radius-sm); transition: all var(--trans); order: -1; }
.review-link:hover { background: var(--bg); color: var(--accent); }
.review-link:disabled { opacity: .5; cursor: default; }

/* ── Screen: Analyzing ────────────────────────────── */
#screen-analyzing { align-items: center; justify-content: center; gap: 32px; background: var(--bg); }
.analyzing-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 48px; text-align: center; width: 100%; max-width: 480px; box-shadow: var(--shadow); }
.analyzing-spinner { width: 64px; height: 64px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 24px; }
@keyframes spin { to { transform: rotate(360deg); } }
.analyzing-card h2 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.analyzing-card p { font-size: 14px; color: var(--textMid); }
.analyzing-steps { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.analyzing-step { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--textLight); transition: color var(--trans); }
.analyzing-step.done { color: var(--green); }
.analyzing-step.current { color: var(--text); font-weight: 500; }
.step-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display: grid; place-items: center; font-size: 10px; transition: all var(--trans); }
.analyzing-step.done .step-check { background: var(--green); border-color: var(--green); color: #fff; }
.analyzing-step.current .step-check { border-color: var(--accent); animation: pulse-border 1s ease infinite; }
@keyframes pulse-border { 0%,100% { box-shadow: 0 0 0 0 rgba(201,106,56,.4); } 50% { box-shadow: 0 0 0 4px rgba(201,106,56,.0); } }

/* ── Screen: Storyboard ───────────────────────────── */
#screen-storyboard { flex-direction: column; overflow: hidden; }
.storyboard-topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 32px; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.storyboard-topbar h2 { font-size: 17px; font-weight: 700; flex: 1; }
.article-pill { background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; font-size: 12px; color: var(--textMid); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-badge { display: flex; align-items: center; gap: 6px; background: var(--greenBg); border: 1px solid rgba(45,140,94,.2); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--green); }
.qa-badge.warn { background: var(--yellowBg); border-color: rgba(196,136,42,.3); color: var(--yellow); }
.qa-badge.bad { background: var(--redBg); border-color: rgba(176,67,46,.3); color: var(--red); }
.qa-badge .qa-num { font-size: 16px; font-weight: 700; }
.storyboard-layout { flex: 1; display: flex; overflow: hidden; }
.storyboard-scenes { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.scene-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow var(--trans); box-shadow: var(--shadow); }
.scene-card:hover { box-shadow: var(--shadowMd); }
.scene-card.expanded .scene-body { display: block; }
.scene-header { padding: 14px 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; }
.scene-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accentBg); border: 1px solid rgba(201,106,56,.25); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.scene-type-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }
.scene-type-hook  { background: var(--yellowBg); color: var(--yellow); }
.scene-type-stat  { background: var(--blueBg);   color: var(--blue);   }
.scene-type-tip   { background: var(--accentBg); color: var(--accent); }
.scene-type-quote { background: var(--greenBg);  color: var(--green);  }
.scene-type-cta   { background: rgba(100,60,150,.1); color: #6b3caa; }
.scene-type-insight { background: var(--surface2); color: var(--textMid); border: 1px solid var(--border); }
.scene-preview { flex: 1; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-duration { font-size: 12px; color: var(--textLight); flex-shrink: 0; }
.scene-chevron { color: var(--textLight); font-size: 14px; flex-shrink: 0; transition: transform var(--trans); }
.scene-card.expanded .scene-chevron { transform: rotate(180deg); }
.scene-body { display: none; padding: 0 18px 18px; border-top: 1px solid var(--border); }
.scene-section { margin-top: 14px; }
.scene-section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--textLight); margin-bottom: 6px; }
.scene-narration { font-size: 14px; color: var(--text); line-height: 1.6; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; white-space: pre-wrap; }
.scene-narration-editor { width: 100%; min-height: 90px; font-size: 14px; line-height: 1.6; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; resize: vertical; color: var(--text); }
.scene-visual-row { display: flex; gap: 10px; margin-top: 4px; align-items: flex-start; }
.scene-visual-preview { width: 80px; height: 50px; border-radius: 6px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.scene-visual-desc { font-size: 13px; color: var(--textMid); line-height: 1.5; }
.scene-query-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; font-size: 12px; color: var(--textMid); margin-top: 6px; }
.scene-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.scene-btn { padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: all var(--trans); }
.scene-btn-regen { background: var(--accentBg); color: var(--accent); border: 1px solid rgba(201,106,56,.3); }
.scene-btn-regen:hover { background: var(--accent); color: #fff; }
.scene-btn-edit { background: var(--surface2); color: var(--textMid); border: 1px solid var(--border); }
.scene-btn-edit:hover { background: var(--bg); color: var(--text); }
.scene-btn-save { background: var(--green); color: #fff; }
.scene-btn-cancel { background: var(--surface2); color: var(--textMid); border: 1px solid var(--border); }
.scene-btn:disabled { opacity: .6; cursor: default; }

/* Storyboard sidebar */
.storyboard-sidebar { width: 288px; min-width: 288px; background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; padding: 20px; gap: 20px; }
.panel-section { display: flex; flex-direction: column; gap: 10px; }
.panel-section h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--textLight); }
.insights-toggle-row { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.insights-toggle-row h4 { margin: 0; }
.insights-summary { font-size: 12px; color: var(--textMid); font-weight: 400; text-transform: none; letter-spacing: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insights-chevron { font-size: 10px; color: var(--textLight); flex-shrink: 0; transition: transform var(--trans); }
.insights-chevron.open { transform: rotate(180deg); }
.insight-chip { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.insight-chip .ic-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.insight-chip .ic-text { font-size: 13px; color: var(--textMid); line-height: 1.4; }
.insight-chip .ic-text strong { color: var(--text); display: block; margin-bottom: 2px; font-size: 13px; }

/* Outputs — compact chips + change toggle */
.format-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.format-chip {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px;
  background: var(--accentBg); color: var(--accent); border: 1px solid rgba(201,106,56,.3);
}
.format-toggle { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; transition: all var(--trans); background: var(--surface2); }
.format-toggle.selected { background: var(--accentBg); border-color: rgba(201,106,56,.4); }
.format-toggle .ft-icon { font-size: 16px; flex-shrink: 0; }
.format-toggle .ft-info { flex: 1; }
.format-toggle .ft-name { font-size: 13px; font-weight: 600; color: var(--text); }
.format-toggle .ft-dims { font-size: 11px; color: var(--textLight); }
.format-toggle .ft-check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display: grid; place-items: center; font-size: 10px; transition: all var(--trans); }
.format-toggle.selected .ft-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.bk-change-link { font-size: 12px; color: var(--textMid); padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface2); transition: all var(--trans); align-self: flex-start; }
.bk-change-link:hover { color: var(--accent); border-color: rgba(201,106,56,.4); }

/* Brand kit */
.bk-active-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.bk-color-dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.bk-active-name { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.brand-kit-select { display: flex; flex-direction: column; gap: 6px; }
.bk-option { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; transition: all var(--trans); background: var(--surface2); }
.bk-option.selected { border-color: var(--accent); background: var(--accentBg); }
.bk-name { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; }
.bk-check { font-size: 12px; color: var(--accent); }

/* Advanced (hidden by default) */
.advanced-box { font-size: 13px; color: var(--textLight); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.advanced-panel { display: flex; flex-direction: column; gap: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.config-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--textMid); }
.config-row strong { color: var(--text); font-weight: 600; }

.generate-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 16px 28px; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.gen-footer-left { flex: 1; }
.gen-footer-left .gfl-label { font-size: 12px; color: var(--textLight); font-weight: 500; text-transform: uppercase; letter-spacing: 0.6px; }
.gen-footer-left .gfl-detail { font-size: 14px; color: var(--textMid); margin-top: 2px; }
.gen-footer-left strong { color: var(--text); }
.gen-btn { background: linear-gradient(135deg, var(--accent), #a85228); color: #fff; padding: 13px 28px; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 10px; transition: opacity var(--trans), transform var(--trans); box-shadow: 0 4px 16px rgba(201,106,56,.35); }
.gen-btn:hover { opacity: .92; transform: translateY(-1px); }
.gen-btn:disabled { opacity: .6; transform: none; cursor: default; }
.footer-qa-badge { display: flex; align-items: center; gap: 5px; background: var(--greenBg); border: 1px solid rgba(45,140,94,.2); border-radius: 99px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--green); white-space: nowrap; }
.footer-qa-badge.warn { background: var(--yellowBg); border-color: rgba(196,136,42,.3); color: var(--yellow); }
.footer-qa-badge.bad { background: var(--redBg); border-color: rgba(176,67,46,.3); color: var(--red); }

/* ── Screen: Generating ───────────────────────────── */
#screen-generating { align-items: center; justify-content: center; padding: 40px; }
.generating-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 48px; width: 100%; max-width: 560px; box-shadow: var(--shadow); }
.generating-card h2 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.generating-card > p { font-size: 14px; color: var(--textMid); margin-bottom: 32px; }
.gen-progress-list { display: flex; flex-direction: column; gap: 18px; }
.gen-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.gen-item-icon { font-size: 16px; }
.gen-item-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.gen-item-status { font-size: 12px; color: var(--textMid); }
.gen-item-status.done { color: var(--green); font-weight: 600; }
.gen-item-status.processing { color: var(--accent); }
.gen-item-status.failed { color: var(--red); }
.progress-track { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #e88a52); transition: width 0.4s ease; }
.progress-fill.done { background: var(--green); }
.progress-fill.failed { background: var(--red); }
.gen-stage-note { margin-top: 24px; text-align: center; font-size: 13px; color: var(--textLight); }

/* ── Screen: Ready ────────────────────────────────── */
#screen-ready { padding: 40px 48px; gap: 24px; }
.ready-header { display: flex; align-items: flex-start; gap: 16px; }
.ready-header .success-icon { width: 48px; height: 48px; background: var(--greenBg); border: 2px solid rgba(45,140,94,.2); border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.ready-header .rh-text h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.ready-header .rh-text p { font-size: 14px; color: var(--textMid); margin-top: 4px; }
.ready-stats-row { display: flex; gap: 16px; flex-wrap: wrap; }
.ready-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 20px; text-align: center; flex: 1; min-width: 120px; }
.ready-stat .rs-num { font-size: 22px; font-weight: 700; color: var(--text); }
.ready-stat .rs-label { font-size: 12px; color: var(--textLight); margin-top: 2px; }
.video-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.video-result-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.vrc-thumb { height: 140px; display: flex; align-items: center; justify-content: center; font-size: 40px; position: relative; cursor: pointer; background: var(--text); color: #fff; }
.vrc-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vrc-format-tag { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; backdrop-filter: blur(4px); }
.vrc-duration-tag { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 4px; }
.vrc-body { padding: 14px 16px 16px; }
.vrc-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.vrc-meta { font-size: 12px; color: var(--textLight); margin-bottom: 12px; }
.vrc-actions { display: flex; gap: 8px; }
.vrc-qa-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vrc-creative { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px; }
.vrc-creative.ok { color: #6fcf97; background: rgba(111,207,151,.12); }
.vrc-creative.warn { color: #f2c94c; background: rgba(242,201,76,.12); }
.vrc-cost { font-size: 11px; font-weight: 600; color: #7ed6a5; }
.vrc-dl-btn { flex: 1; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; text-align: center; transition: background var(--trans); display: flex; align-items: center; justify-content: center; gap: 6px; border: none; cursor: pointer; }
.vrc-dl-btn:hover { background: var(--accent2); }
.vrc-more-btn { padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; background: var(--surface2); border: 1px solid var(--border); color: var(--textMid); transition: all var(--trans); }
.vrc-more-btn:hover { background: var(--bg); color: var(--text); }
.ready-action-row { display: flex; gap: 12px; padding-top: 8px; flex-wrap: wrap; }
.ready-action-btn { padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; transition: all var(--trans); display: flex; align-items: center; gap: 8px; }
.ready-action-btn.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(201,106,56,.25); }
.ready-action-btn.primary:hover { background: var(--accent2); }
.ready-action-btn.secondary { background: var(--surface); border: 1px solid var(--border); color: var(--textMid); }
.ready-action-btn.secondary:hover { background: var(--bg); color: var(--text); }

/* ── Modal ─────────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(20,12,6,.6); display: flex; align-items: center; justify-content: center; z-index: 9998; padding: 24px; }
.modal.hidden { display: none; }
.modal-card { background: var(--surface); border-radius: var(--radius); max-width: 640px; width: 100%; overflow: hidden; box-shadow: var(--shadowMd); }
.modal-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-close { font-size: 16px; color: var(--textMid); padding: 4px 8px; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--bg); }
.modal-card video { width: 100%; max-height: 70vh; background: #000; display: block; }
.modal-actions { padding: 14px 20px; display: flex; gap: 10px; }
.modal-actions a { text-decoration: none; }

/* ── Toast ─────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; box-shadow: var(--shadowMd); opacity: 0; transform: translateY(8px); transition: all .25s ease; pointer-events: none; z-index: 9999; max-width: 340px; }
#toast.visible { opacity: 1; transform: translateY(0); }
#toast.error { background: var(--red); }

/* ── Non-blocking quality warning ───────────────────── */
.quality-warning {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 32px 18px;
  padding: 10px 16px;
  background: var(--yellowBg); border: 1px solid rgba(196,136,42,.35); border-radius: var(--radius-sm);
  color: var(--yellow); font-size: 13.5px; font-weight: 500;
}
.quality-warning .qw-score { font-weight: 700; font-size: 15px; }
.quality-warning .qw-btn {
  margin-left: auto; padding: 6px 14px; border: 1px solid rgba(196,136,42,.45);
  background: transparent; color: var(--yellow); border-radius: 99px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.quality-warning .qw-btn:hover { background: rgba(196,136,42,.12); }

/* ── Reference Video QA (advisory) ───────────────────── */
.ref-badge {
  margin: 0 32px 18px;
  padding: 9px 16px;
  background: rgba(58, 108, 176, 0.08);
  border: 1px solid rgba(58, 108, 176, 0.28);
  border-radius: var(--radius-sm);
  color: #6a9fd4;
  font-size: 13px;
  font-weight: 500;
}
.ref-adjust { color: var(--green); font-weight: 600; }

.ref-panel {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 18px;
  background: rgba(58, 108, 176, 0.07);
  border: 1px solid rgba(58, 108, 176, 0.3);
  border-radius: var(--radius-sm);
}
.ref-panel.warn {
  background: var(--yellowBg); border-color: rgba(196,136,42,.35);
}
.ref-panel-head { font-size: 14px; font-weight: 700; color: var(--text); }
.ref-panel-head #ref-match-score { font-size: 18px; color: #6a9fd4; }
.ref-panel.warn #ref-match-score { color: var(--yellow); }
.ref-panel-head #ref-match-title { font-weight: 500; color: var(--textMid); font-size: 13px; }
.ref-recs { display: flex; flex-direction: column; gap: 6px; }
.ref-rec { font-size: 13px; color: var(--textMid); line-height: 1.45; }
.ref-rec.ok { color: var(--green); }

/* ── Multi-brand production operations ─────────────── */
.ops-shell { padding: 38px 48px 64px; width: 100%; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.ops-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; }
.ops-header h1 { font-size: 28px; letter-spacing: -.6px; margin: 2px 0 4px; }
.ops-header p { color: var(--textMid); max-width: 720px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 800; }
.ops-actions, .form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stage-strip { display: grid; grid-template-columns: repeat(8, minmax(78px, 1fr)); gap: 8px; }
.stage-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; min-width: 0; }
.stage-cell strong { display: block; font-size: 20px; }
.stage-cell span { display: block; margin-top: 2px; color: var(--textLight); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ops-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.ops-form.hidden { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label { color: var(--textMid); font-size: 12px; font-weight: 700; display: flex; flex-direction: column; gap: 6px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); padding: 10px 12px; outline: none; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,106,56,.09); }
.form-grid textarea { min-height: 86px; resize: vertical; }
.form-grid input[type="color"] { min-height: 42px; padding: 4px; }
.form-grid .check-label { flex-direction: row; align-items: center; font-size: 13px; align-self: end; min-height: 42px; }
.form-grid .check-label input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { justify-content: flex-end; margin-top: 18px; }
.ops-list { display: flex; flex-direction: column; gap: 10px; }
.production-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(180px, .8fr) auto; gap: 18px; align-items: center; }
.production-card h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.production-meta { color: var(--textLight); font-size: 12px; margin-top: 4px; }
.status-pill { display: inline-flex; width: fit-content; padding: 4px 9px; border-radius: 99px; background: var(--blueBg); color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .35px; }
.status-pill.ready { background: var(--greenBg); color: var(--green); }
.status-pill.failed { background: var(--redBg); color: var(--red); }
.production-actions { display: flex; gap: 7px; justify-content: flex-end; flex-wrap: wrap; }
.mini-action { border: 1px solid var(--border); background: var(--surface2); padding: 7px 10px; border-radius: 7px; color: var(--textMid); font-size: 12px; font-weight: 600; }
.mini-action:hover { border-color: var(--accent); color: var(--accent); }
.presenter-file { display: none; }
.production-detail { color: var(--red); }
/* ── Operator batch dashboard ──────────────────────── */
.ops-toolbar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.ops-toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; color: var(--textMid); text-transform: uppercase; letter-spacing: .4px; }
.ops-toolbar select, .ops-toolbar input { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: 7px 9px; font-size: 13px; outline: none; min-width: 130px; }
.ops-toolbar .toolbar-search input { min-width: 200px; }
.ops-toolbar select:focus, .ops-toolbar input:focus { border-color: var(--accent); }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.selection-count { font-size: 12px; color: var(--textLight); font-weight: 600; }
.job-table { display: flex; flex-direction: column; gap: 8px; }
.job-table-head { display: grid; grid-template-columns: 26px minmax(180px, 1.6fr) minmax(130px, 1fr) minmax(140px, 1fr) 130px minmax(150px, auto); gap: 10px; padding: 0 14px; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--textLight); font-weight: 800; }
.job-row { display: grid; grid-template-columns: 26px minmax(180px, 1.6fr) minmax(130px, 1fr) minmax(140px, 1fr) 130px minmax(150px, auto); gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.job-row.selected { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(201,106,56,.15); }
.job-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.job-cell { min-width: 0; }
.job-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.job-brand { font-size: 11px; color: var(--textMid); font-weight: 600; }
.job-meta { color: var(--textLight); font-size: 11px; margin-top: 3px; }
.job-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.mini-pill { display: inline-flex; width: fit-content; margin-top: 4px; padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; background: var(--surface2); color: var(--textMid); border: 1px solid var(--border); }
.mini-pill.ok { background: var(--greenBg); color: var(--green); border-color: transparent; }
.mini-pill.warn { background: var(--blueBg); color: var(--blue); border-color: transparent; }
.mini-pill.bad { background: var(--redBg); color: var(--red); border-color: transparent; }
.modal-wide { width: min(1080px, 94vw); max-height: 88vh; overflow-y: auto; }
.modal-top-actions { display: flex; align-items: center; gap: 8px; }
.modal-note, .modal-copy { font-size: 12px; color: var(--textMid); line-height: 1.5; }
.modal-note { margin-top: 4px; }
.file-input { width: 100%; background: var(--surface2); border: 1px dashed var(--border); border-radius: 10px; padding: 14px; color: var(--textMid); font-size: 13px; margin: 10px 0 14px; }
.mode-tabs { display: flex; gap: 6px; margin-top: 6px; }
.mode-tab { flex: 1; border: 1px solid var(--border); background: var(--surface2); color: var(--textMid); border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.mode-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(201,106,56,.08); }
.plan-head { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.plan-head .form-grid { gap: 12px; }
.plan-scenes { display: flex; flex-direction: column; gap: 10px; }
.scene-card { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.scene-thumb { width: 140px; height: 100%; min-height: 120px; border-radius: 9px; background: linear-gradient(135deg, var(--surface), var(--border)); display: grid; place-items: center; overflow: hidden; color: var(--textLight); font-size: 11px; text-align: center; }
.scene-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scene-thumb-body { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.scene-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scene-index { font-weight: 800; font-size: 13px; }
.scene-time { color: var(--textLight); font-size: 11px; }
.type-badge { padding: 2px 8px; border-radius: 99px; font-size: 9px; font-weight: 800; letter-spacing: .4px; background: var(--blueBg); color: var(--blue); }
.type-badge.wan { background: rgba(116,86,255,.16); color: #a996ff; }
.type-badge.graphic { background: var(--surface); color: var(--textLight); }
.scene-source { font-size: 11px; color: var(--textMid); margin-top: 4px; }
.scene-fields { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin-top: 8px; }
.scene-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--textLight); font-weight: 700; }
.scene-fields input { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: 7px 9px; font-size: 12px; outline: none; }
.scene-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wan-box { margin-top: 8px; border: 1px solid rgba(116,86,255,.4); background: rgba(116,86,255,.08); border-radius: 9px; padding: 9px 11px; font-size: 11px; color: var(--textMid); }
.wan-box strong { color: var(--text); }
.asset-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding-top: 12px; }
.asset-option { background: var(--surface2); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.asset-option:hover { border-color: var(--accent); }
.asset-option.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(201,106,56,.18); }
.asset-option img { width: 100%; height: 120px; object-fit: cover; background: var(--surface); }
.asset-option-body { padding: 9px 11px; display: flex; flex-direction: column; gap: 3px; }
.asset-option-body strong { font-size: 12px; line-height: 1.3; }
.asset-option-actions { padding: 0 11px 11px; }
.match-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 90px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); font-size: 12px; }
.match-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.match-select select { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); padding: 7px 9px; font-size: 12px; }
.match-status { font-size: 11px; font-weight: 700; text-align: right; }
.match-status.ok { color: var(--green); }
.match-status.warn { color: #c47824; }
.match-status.bad { color: var(--red); }
/* ── HeyGen Batch Assistant ────────────────────────── */
.primary-action { border-color: var(--accent) !important; color: var(--accent) !important; font-weight: 700; }
.boundary-note { background: rgba(196,120,36,.10); border: 1px solid rgba(196,120,36,.35); border-radius: 10px; padding: 10px 14px; font-size: 12px; color: var(--textMid); line-height: 1.5; }
.boundary-note.in-modal { margin-bottom: 12px; }
.boundary-note strong { color: var(--text); }
.assistant-progress { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.assistant-progress .progress-pill { padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--surface2); border: 1px solid var(--border); color: var(--textMid); }
.assistant-progress .progress-pill.ok { background: var(--greenBg); color: var(--green); border-color: transparent; }
.assistant-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 14px; align-items: start; }
.assistant-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.assistant-item { display: flex; align-items: center; gap: 9px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; cursor: pointer; }
.assistant-item:hover { border-color: var(--accent); }
.assistant-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(201,106,56,.2); }
.assistant-ordinal { font-size: 11px; font-weight: 800; color: var(--textLight); flex-shrink: 0; }
.assistant-item-title { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-state { width: 9px; height: 9px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-left: auto; }
.assistant-state.SCRIPT_COPIED { background: #c47824; }
.assistant-state.SUBMITTED_TO_HEYGEN { background: var(--blue); }
.assistant-state.DOWNLOADED { background: var(--green); }
.assistant-detail { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.assistant-detail h3 { font-size: 16px; margin-bottom: 2px; }
.assistant-detail .job-meta { margin-top: 2px; }
.assistant-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.assistant-field { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.assistant-field span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--textLight); font-weight: 700; }
.assistant-field strong { display: block; font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.copy-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filename-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; font-size: 12px; flex-wrap: wrap; }
.filename-row > span:first-child { flex-shrink: 0; }
.filename-row code { color: var(--accent); font-size: 12px; }
.assistant-script { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; max-height: 140px; overflow-y: auto; color: var(--text); }
.assistant-script-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 6px; }
.assistant-script-head span { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--textLight); font-weight: 700; }
.state-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.state-btn { border: 1px solid var(--border); background: var(--surface); color: var(--textMid); border-radius: 8px; padding: 7px 10px; font-size: 11px; font-weight: 700; cursor: pointer; }
.state-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(201,106,56,.08); }
.assistant-warning { background: var(--redBg); color: var(--red); border-radius: 8px; padding: 8px 10px; font-size: 11.5px; font-weight: 600; margin-bottom: 10px; }
.assistant-actions { justify-content: flex-start; flex-wrap: wrap; }
.asset-brain { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.asset-brain-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 10px; }
.asset-brain-head h2 { font-size: 16px; margin-top: 2px; }
.asset-note { color: var(--textLight); font-size: 11px; max-width: 420px; text-align: right; }
.asset-list { display: flex; flex-direction: column; }
.asset-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); min-width: 0; }
.asset-main { min-width: 0; }
.asset-main strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-meta { color: var(--textLight); font-size: 11px; }
.asset-side { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.scope-badge { padding: 3px 8px; border-radius: 99px; font-size: 9px; font-weight: 800; letter-spacing: .4px; }
.scope-badge.global { background: var(--blueBg); color: var(--blue); }
.scope-badge.brand { background: var(--greenBg); color: var(--green); }
.brand-profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.brand-profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.brand-profile-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.brand-swatch { height: 8px; border-radius: 99px; margin-bottom: 14px; }
.brand-profile-card h3 { font-size: 16px; }
.brand-profile-card p { color: var(--textMid); font-size: 12px; margin-top: 5px; min-height: 36px; }
.brand-profile-card .brand-cta { margin-top: 13px; color: var(--accent); font-size: 12px; font-weight: 700; }

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--textLight); }

/* ── Color thumb backgrounds ───────────────────────── */
.bg-warm  { background: linear-gradient(135deg, #d4956a, #c27a52); }
.bg-cool  { background: linear-gradient(135deg, #6a9fd4, #5285b3); }
.bg-dark  { background: linear-gradient(135deg, #3a3a5c, #2a2a45); }
.bg-green { background: linear-gradient(135deg, #5aad7c, #3d9060); }
.bg-stat  { background: linear-gradient(135deg, #3d6cb0, #2d5090); }
.bg-quote { background: linear-gradient(135deg, #7a5c3d, #5c4028); }
.bg-hook  { background: linear-gradient(135deg, #c4882a, #a06820); }
.bg-cta   { background: linear-gradient(135deg, #7a3daa, #5c2d88); }

/* ── Regen animation ───────────────────────────────── */
@keyframes regen-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.regen-spinning { display: inline-block; animation: regen-spin 0.7s linear infinite; }

@media (max-width: 720px) {
  #app { padding-bottom: 64px; }
  #sidebar { position: fixed; z-index: 100; left: 0; right: 0; bottom: 0; width: 100%; min-width: 0; height: 64px; padding: 0; overflow: visible; }
  .sidebar-logo, .sidebar-new-btn, .sidebar-bottom, .nav-divider, #nav-settings { display: none; }
  .sidebar-nav { padding: 7px 8px; flex-direction: row; gap: 4px; }
  .nav-item { flex: 1; justify-content: center; flex-direction: column; gap: 1px; padding: 5px 3px; font-size: 10px; line-height: 1.1; }
  .nav-item .nav-icon { font-size: 14px; }
  #main { min-width: 0; }
  #screen-home, #screen-ready { padding: 0; }
  #screen-home > div, #screen-ready > div { padding: 22px 18px 46px !important; gap: 20px !important; }
  .home-header { flex-direction: column; }
  .home-header .analyze-btn { width: 100%; justify-content: center; }
  .home-cta-card { padding: 24px 22px; }
  .home-cta-card { flex-direction: column; align-items: flex-start; }
  .storyboard-layout { flex-direction: column; }
  .storyboard-sidebar { width: 100%; min-width: 0; border-left: none; border-top: 1px solid var(--border); }
  .ops-shell { padding: 22px 18px 48px; }
  .ops-header { align-items: flex-start; flex-direction: column; }
  .stage-strip { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .production-card { grid-template-columns: 1fr; }
  .production-actions { justify-content: flex-start; }
  .job-table-head { display: none; }
  .job-row { grid-template-columns: 1fr; gap: 6px; }
  .job-actions { justify-content: flex-start; }
  .ops-toolbar { flex-direction: column; align-items: stretch; }
  .ops-toolbar select, .ops-toolbar input { min-width: 0; width: 100%; }
  .toolbar-right { margin-left: 0; justify-content: flex-start; }
  .asset-picker { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .scene-card { grid-template-columns: 1fr; }
  .scene-fields { grid-template-columns: 1fr; }
  .match-row { grid-template-columns: 1fr; gap: 6px; }
  .match-status { text-align: left; }
  .modal-top { flex-wrap: wrap; }
  .modal-top-actions { flex-wrap: wrap; }
  .assistant-layout { grid-template-columns: 1fr; }
  .assistant-list { max-height: 28vh; }
  .assistant-grid { grid-template-columns: 1fr; }
  .assistant-actions { flex-direction: column; align-items: stretch; }
  .assistant-actions .ready-action-btn { width: 100%; justify-content: center; }
}
