:root {
  --bg: #0e0f12;
  --bg-2: #15171c;
  --bg-3: #1d1f26;
  --fg: #e7e9ec;
  --fg-dim: #8a8f99;
  --fg-mute: #5a5f6a;
  --border: #232730;
  --border-2: #2c313d;
  --accent: #7c8cff;
  --accent-2: #5063e8;
  --green: #4ec78a;
  --amber: #e3b34c;
  --red: #e3645c;
  --blue: #5cb6e3;
  --purple: #b07ce3;
  --ok-bg: #1a3327;
  --warn-bg: #2a261a;
  --fail-bg: #361b1b;
  --info-bg: #1a2933;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 14px; line-height: 1.45; min-height: 100vh; }

/* ── Header ────────────────────────────────────────────────────────────── */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--bg-2);
  position: sticky; top: 0; z-index: 50;
}
header .title h1 { margin: 0; font-size: 18px; font-weight: 600; }
header .title .sub { color: var(--fg-dim); font-size: 12px; display: block; }
header .topbar-actions { display: flex; align-items: center; gap: 14px; }
.auth { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); white-space: pre; text-align: right; }
.auth .ok { color: var(--green); } .auth .bad { color: var(--red); }

/* ── Banner ────────────────────────────────────────────────────────────── */
.banner {
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: var(--fail-bg); color: var(--red);
  display: flex; align-items: center; gap: 16px; font-size: 13px;
  position: sticky; top: 56px; z-index: 40;
}
.banner.warn  { background: var(--warn-bg); color: var(--amber); }
.banner.info  { background: var(--info-bg); color: var(--blue); }
.banner .banner-text { flex: 1; }
.banner .banner-actions { display: flex; gap: 8px; }
.banner.hidden { display: none; }

/* ── Layout ────────────────────────────────────────────────────────────── */
main {
  display: grid; grid-template-columns: 1fr; gap: 16px;
  padding: 16px 24px 80px; max-width: 1500px; margin: 0 auto;
}
section { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-header h2 { margin: 0; font-size: 14px; font-weight: 600; flex: 1; }
.section-actions { display: flex; gap: 8px; }
.muted { color: var(--fg-dim); font-weight: normal; font-size: 12px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
button, .btn {
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--border-2); border-radius: 6px;
  padding: 6px 12px; font-size: 12px; font-family: inherit; cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
button:hover:not(:disabled) { background: var(--border); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.btn-primary { background: var(--accent-2); border-color: var(--accent-2); color: white; }
button.btn-primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
button.btn-secondary { background: var(--bg-3); }
button.btn-warn { background: var(--warn-bg); color: var(--amber); border-color: #5a4a1f; }
button.btn-danger { background: var(--fail-bg); color: var(--red); border-color: #5a2828; }
button.tiny { padding: 3px 8px; font-size: 11px; }
.btn-close { background: transparent; border: none; font-size: 22px; padding: 0 8px; color: var(--fg-dim); }

/* ── Status pills ──────────────────────────────────────────────────────── */
.status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  text-transform: lowercase; letter-spacing: 0.02em;
}
.status-done       { background: var(--ok-bg);   color: var(--green); }
.status-pending    { background: var(--warn-bg); color: var(--amber); }
.status-failed     { background: var(--fail-bg); color: var(--red); }
.status-running    { background: rgba(124,140,255,0.12); color: var(--accent); }
.status-queued     { background: rgba(124,140,255,0.06); color: var(--accent); }
.status-cooldown   { background: rgba(176,124,227,0.12); color: var(--purple); }
.status-paused     { background: rgba(227,100,92,0.12); color: var(--red); }
.status-idle       { background: var(--bg-3); color: var(--fg-dim); }
.status-cancelled  { background: var(--bg-3); color: var(--fg-mute); }
.status-approved   { background: var(--ok-bg); color: var(--green); }
.status-rejected   { background: var(--bg-3); color: var(--fg-mute); }
.status-pending_review { background: var(--info-bg); color: var(--blue); }

/* Enhanced approved badge — checkmark + bolder green border to read at a glance. */
.status.approved-badge {
  border: 1px solid rgba(70, 200, 130, 0.45);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.check-icon {
  display: inline-block;
  width: 14px; height: 14px; line-height: 14px; text-align: center;
  background: var(--green); color: #0d1a12;
  border-radius: 50%; font-weight: 700; font-size: 10px;
}

/* Mirror of approved-badge for rejected — red ✗ instead of green ✓. */
.status.rejected-badge {
  border: 1px solid rgba(217, 83, 79, 0.45);
  font-weight: 600; color: var(--red);
  background: rgba(217, 83, 79, 0.10);
  display: inline-flex; align-items: center; gap: 4px;
}
.cross-icon {
  display: inline-block;
  width: 14px; height: 14px; line-height: 14px; text-align: center;
  background: var(--red); color: #1a0d0d;
  border-radius: 50%; font-weight: 700; font-size: 10px;
}

/* Approve / Undo-approve action buttons — colored variants of .tiny.
   Undo is only shown on already-approved items; it reverts the approval
   and clears the row's Drive_Path so the next Drive sync starts clean. */
button.tiny.btn-approve {
  border-color: rgba(70, 200, 130, 0.45); color: var(--green);
}
button.tiny.btn-approve:hover {
  background: rgba(70, 200, 130, 0.12);
  border-color: rgba(70, 200, 130, 0.65);
}
button.tiny.btn-undo {
  border-color: rgba(220, 170, 70, 0.45); color: var(--amber, #d4a14a);
}
button.tiny.btn-undo:hover {
  background: rgba(220, 170, 70, 0.12);
  border-color: rgba(220, 170, 70, 0.65);
}

/* ── 4-variant candidate grid ──────────────────────────────────────────── */
.output-row.variant-block {
  display: block;       /* override grid layout — variant block is full-width */
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  margin: 6px 0;
}
.variant-block-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.variant-block .out-label { display: block; }
.variant-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 1100px) {
  .variant-grid { grid-template-columns: repeat(2, 1fr); }
}
.variant-tile {
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg2, rgba(255,255,255,0.02));
  transition: border-color 120ms ease, background 120ms ease, opacity 180ms ease, filter 180ms ease;
}
.variant-tile-failed { opacity: 0.55; }
.variant-tile-running .variant-status,
.variant-tile-queued  .variant-status { font-style: italic; }
.variant-tile-picked {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(70,200,130,0.35);
  background: rgba(70,200,130,0.10);
}
/* Non-picked tiles dim+blur slightly when one is picked, so the picked
   variant is the visually unambiguous winner. */
.variant-tile-dimmed {
  opacity: 0.45;
  filter: blur(0.5px) saturate(0.7);
}
.variant-tile-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600;
}
.variant-tile-preview {
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.variant-tile-preview .preview-empty,
.variant-empty { color: var(--muted); font-size: 12px; }
.variant-tile-preview img,
.variant-tile-preview video { max-width: 100%; max-height: 140px; border-radius: 4px; }
.variant-status {
  font-size: 11px; padding: 1px 6px; border-radius: 3px;
  background: rgba(255,255,255,0.06);
}
/* Pick checkbox row — bigger hit area, label looks like a button */
.variant-pick {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; cursor: pointer;
  padding: 4px 6px; border-radius: 4px;
  background: rgba(255,255,255,0.04);
}
.variant-pick:hover { background: rgba(255,255,255,0.08); }
.variant-pick input[type=checkbox] { cursor: pointer; }
.variant-pick input[type=checkbox]:disabled,
.variant-pick input[type=checkbox]:disabled + span { cursor: not-allowed; opacity: 0.5; }
.variant-tile-picked .variant-pick { background: rgba(70,200,130,0.15); }
/* Per-tile action buttons (Regen / Edit / Log) */
.variant-tile-actions {
  display: flex; gap: 4px; justify-content: space-between;
}
.variant-tile-actions button.tiny {
  flex: 1;
  font-size: 11px; padding: 3px 6px;
}
.variant-actions {
  display: flex; gap: 8px;
}

/* ── Queue panel ───────────────────────────────────────────────────────── */
#queue-section .queue-active { padding: 8px 0; }
.queue-list, #queue-history-list { display: flex; flex-direction: column; gap: 4px; }
.queue-item {
  display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
.queue-item .position { color: var(--fg-dim); font-size: 11px; font-family: var(--mono); }
.queue-item .label { font-size: 13px; }
.queue-item .label small { color: var(--fg-dim); display: block; font-size: 11px; }
.queue-item .actions { display: flex; gap: 4px; }
.queue-history { margin-top: 12px; }
.queue-history summary { cursor: pointer; color: var(--fg-dim); font-size: 12px; padding: 4px 0; }
#queue-history-list .queue-item { background: transparent; opacity: 0.85; }

/* ── Bulk row ──────────────────────────────────────────────────────────── */
.bulk-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bulk-row select {
  background: var(--bg); color: var(--fg); border: 1px solid var(--border-2);
  border-radius: 6px; padding: 6px 8px; font-size: 12px;
}
.bulk-checkbox { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-dim); cursor: pointer; }

/* ── Trainer groups ────────────────────────────────────────────────────── */
.trainer-group { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; background: var(--bg-2); overflow: hidden; }
.trainer-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg-3); cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border);
}
.trainer-header:hover { background: var(--border); }
.trainer-header .caret { font-size: 12px; color: var(--fg-dim); width: 14px; }
.trainer-header .name { font-weight: 600; font-size: 14px; flex: 1; }
.trainer-header .progress { color: var(--fg-dim); font-size: 12px; }
.trainer-header .standing-status { display: flex; align-items: center; gap: 8px; }

.trainer-body { padding: 14px; display: none; }
.trainer-group.expanded .trainer-body { display: block; }

.subsection { margin-top: 14px; }
.subsection:first-child { margin-top: 0; }
.subsection h3 { margin: 0 0 8px 0; font-size: 12px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }

/* Output rows (reused across standing / greeting / asana cells) */
.output-row {
  display: grid; grid-template-columns: 24px 110px 90px 1fr auto;
  align-items: center; gap: 12px;
  padding: 8px 10px; border-bottom: 1px dashed var(--border);
}
.output-row:last-child { border-bottom: none; }
.output-row .out-label { color: var(--fg); font-size: 13px; }
.output-row .out-label small { display: block; color: var(--fg-dim); font-size: 11px; }
.output-row .out-actions { display: flex; gap: 4px; }
.output-row.is-running { background: rgba(124,140,255,0.04); }

/* Asana row card */
.asana-card { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; background: var(--bg); }
.asana-card-horizontal { border-left: 3px solid #4a90e2; }
.asana-card-vertical   { border-left: 3px solid #888; }
.asana-card-skipped    { opacity: 0.55; }
.asana-card .asana-header { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.asana-card .asana-header .asana-title { font-weight: 500; flex: 1; }
.asana-card .asana-meta { color: var(--fg-dim); font-size: 11px; display: inline-flex; align-items: center; gap: 8px; }
.asana-card .outputs { margin-top: 4px; }
.position-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.position-badge.position-horizontal { background: #1e3a5f; color: #cfe3ff; }
.position-badge.position-vertical   { background: #333;    color: #ccc; }
.side-direction { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.side-direction select { font-size: 11px; padding: 1px 4px; }
.side-hint { background: #1a1f2a; border-left: 2px solid #4a90e2; padding: 4px 8px; margin: 4px 0 8px; font-size: 11px; color: var(--fg-dim); border-radius: 2px; }
.output-row-skipped { opacity: 0.45; }
/* Tighter thumbnail for the queue history list — it's a one-line summary,
   not a primary review surface. */
/* History items add a 5th column for the preview thumbnail
   (position | label | preview | status | actions). Without this override
   the parent .queue-item's 4-col grid would squeeze status+actions. */
#queue-history-list .queue-item.history-item { grid-template-columns: 28px 1fr 64px auto auto; }
.history-preview { display: inline-flex; align-items: center; justify-content: center; }
.history-preview a { display: block; }
.history-preview a img, .history-preview a video { max-width: 56px; max-height: 36px; display: block; }
.history-preview .preview-empty { font-size: 10px; }
.history-item .label { min-width: 0; overflow: hidden; }
.history-item .label small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .actions { display: inline-flex; gap: 4px; flex-wrap: nowrap; align-items: center; }
.history-item .actions .tiny { white-space: nowrap; }

/* Stats strip — pipeline-wide tally of every output block's status. */
.stats-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0; }
.stat { display: flex; flex-direction: column; padding: 6px 12px; border-radius: 4px; background: var(--bg-elev, #1a1a1a); border: 1px solid var(--border); min-width: 90px; }
.stat-label { font-size: 10px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 20px; font-weight: 600; line-height: 1.2; }
.stat-done     .stat-value { color: #4caf50; }
.stat-approved .stat-value { color: #f5c518; }
.stat-progress .stat-value { color: #4a90e2; }
.stat-pending  .stat-value { color: var(--fg); }
.stat-failed   .stat-value { color: #d9534f; }
.stat-skipped { opacity: 0.55; }

/* Category breakdown boxes — sit below the total-stats strip. */
.stats-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stats-row + .stats-row { margin-top: 6px; }
.cat-box {
  flex: 1; min-width: 160px;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--bg-elev, #1a1a1a);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.cat-title { font-size: 11px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.cat-counts { font-size: 18px; line-height: 1.1; }
.cat-counts .cat-done  { color: #4caf50; font-weight: 600; }
.cat-counts .cat-total { color: var(--fg-dim); }
.cat-counts small { color: var(--fg-mute); font-size: 11px; margin-left: 4px; }
.cat-detail { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--fg-dim); min-height: 14px; }
.cat-detail .cat-ip   { color: #4a90e2; }
.cat-detail .cat-fail { color: #d9534f; }
.cat-detail .cat-ok   { color: #f5c518; }

/* ── Dedicated Approved block ───────────────────────────────────────────────
   Sits below the totals + category breakdown rows. Highlights review
   progress: how many outputs has the human signed off on, by category. */
.stats-approved { width: 100%; }
.approved-block {
  flex: 1;
  padding: 10px 14px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(70,200,130,0.06), rgba(70,200,130,0.02));
  border: 1px solid rgba(70, 200, 130, 0.35);
  display: flex; flex-direction: column; gap: 8px;
}
.approved-header { display: flex; align-items: center; gap: 10px; }
.check-icon-big {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: var(--green); color: #0d1a12;
  border-radius: 50%; font-weight: 700; font-size: 16px;
  box-shadow: 0 0 0 3px rgba(70, 200, 130, 0.18);
}
.approved-title {
  font-size: 13px; font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--green);
}
.approved-counts { margin-left: auto; display: flex; align-items: baseline; gap: 4px; }
.approved-num    { font-size: 22px; font-weight: 700; color: var(--green); }
.approved-of     { color: var(--fg-dim); font-size: 14px; }
.approved-pct    { color: var(--fg-mute); font-size: 12px; margin-left: 6px; }
.rejected-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--red);
  border: 1px solid rgba(217, 83, 79, 0.4); border-radius: 12px;
  padding: 2px 10px;
}
.pill-rej {
  font-size: 11px; color: var(--red);
  margin-left: 6px;
}

.approved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.approved-pill {
  background: var(--bg-elev, #1a1a1a);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.approved-pill.pill-full {
  border-color: rgba(70, 200, 130, 0.55);
  background: rgba(70, 200, 130, 0.06);
}
.pill-label { font-size: 10px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.pill-value { font-size: 14px; }
.pill-num   { color: var(--green); font-weight: 600; }
.pill-of    { color: var(--fg-dim); }
.pill-value small { color: var(--fg-mute); font-size: 11px; margin-left: 4px; }

/* Highlight just-regenerated thumbnails so the user can spot what changed. */
.preview a.fresh { box-shadow: 0 0 0 2px #f5c518, 0 0 12px rgba(245, 197, 24, 0.55); animation: fresh-pulse 1.6s ease-out 1; }
@keyframes fresh-pulse {
  0%   { box-shadow: 0 0 0 2px #f5c518, 0 0 24px rgba(245, 197, 24, 0.95); }
  100% { box-shadow: 0 0 0 2px #f5c518, 0 0 6px rgba(245, 197, 24, 0.30); }
}
/* "5m ago" timestamp inside out-label */
.out-label .gen-at { color: var(--fg-mute); font-size: 10px; opacity: 0.7; }

/* Preview thumb */
.preview { display: inline-flex; gap: 6px; }
.preview a { display: block; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; text-decoration: none; }
.preview img, .preview video { display: block; max-width: 130px; max-height: 90px; background: #000; }
.preview-empty { color: var(--fg-mute); font-size: 11px; }

/* Preview link card — used for non-media URLs (higgsfield share pages, etc.)
   where embedding <video>/<img> would just show a broken icon. */
.preview .preview-link-card {
  display: inline-flex; align-items: center; gap: 8px;
  width: 130px; height: 56px; padding: 6px 10px; box-sizing: border-box;
  background: var(--bg-2); color: var(--fg);
  border-radius: 4px;
}
.preview .preview-link-card:hover { background: var(--bg-3, #2a2a2a); }
.preview .preview-link-card .link-card-icon {
  flex: 0 0 22px; height: 22px; width: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 11px;
}
.preview .preview-link-card.hf .link-card-icon { background: #ff4d4d; color: #fff; }
.preview .preview-link-card.generic .link-card-icon { background: var(--border-2, #444); color: var(--fg); }
.preview .preview-link-card .link-card-label {
  display: flex; flex-direction: column; gap: 1px;
  font-size: 11px; font-weight: 500; line-height: 1.1;
  overflow: hidden; min-width: 0;
}
.preview .preview-link-card .link-card-label small {
  color: var(--fg-mute); font-size: 9px; font-family: var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Errors / asset alerts */
.alert { color: var(--red); font-size: 11px; }
.last-error { color: var(--red); font-size: 11px; font-family: var(--mono); margin-top: 4px; word-break: break-word; }

/* ── Modals ────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal.hidden { display: none; }
.modal-card { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; width: min(820px, 92vw); max-height: 90vh; display: flex; flex-direction: column; }
.modal-card.big { width: min(1100px, 95vw); }
.modal-header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 14px; flex: 1; }
.modal-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs .tab { background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 16px; color: var(--fg-dim); }
.tabs .tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab-pane.hidden { display: none; }

.modal label { display: block; margin-top: 10px; font-size: 12px; color: var(--fg-dim); }
.modal input[type=text], .modal textarea, .modal select {
  display: block; width: 100%;
  background: var(--bg); color: var(--fg); border: 1px solid var(--border-2);
  border-radius: 6px; padding: 8px 10px; font-family: var(--mono); font-size: 12px;
  margin-top: 4px;
}
.modal textarea { resize: vertical; min-height: 80px; }
.modal #edit-override { font-family: var(--mono); font-size: 12px; min-height: 360px; }
.modal pre { background: var(--bg); border: 1px solid var(--border); padding: 10px; border-radius: 6px; max-height: 300px; overflow-y: auto; font-family: var(--mono); font-size: 11px; white-space: pre-wrap; word-break: break-word; }

/* Frames preview inside Edit modal */
.frames-section { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.frames-section h4 { margin: 0 0 8px 0; font-size: 12px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.frames-grid { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.frame-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.frame-card .frame-img { width: 180px; height: 135px; background: #000; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.frame-card .frame-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame-card .frame-img.empty { background: var(--bg); color: var(--fg-mute); font-size: 11px; }
.frame-card .frame-label { font-size: 11px; color: var(--fg); }
.frame-card .frame-label small { display: block; color: var(--fg-dim); font-family: var(--mono); font-size: 10px; word-break: break-all; max-width: 180px; }
.frames-arrow { color: var(--fg-dim); font-size: 18px; padding-bottom: 30px; }

/* Resolved prompt box */
.resolved-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.resolved-section h4 { margin: 0; font-size: 12px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.resolved-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; gap: 12px; }
#edit-resolved { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--fg); white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow-y: auto; margin: 0; }
#edit-resolved.is-override { border-color: var(--accent-2); background: rgba(80,99,232,0.06); }

.login-steps { padding-left: 20px; }
.login-steps li { color: var(--fg-dim); margin: 6px 0; }
.login-steps li.active { color: var(--accent); }
.login-steps li.done   { color: var(--green); }
.login-steps li.error  { color: var(--red); }

/* ── Toasts ────────────────────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 10px 14px; min-width: 240px; font-size: 13px;
  animation: slidein 0.18s ease-out;
}
.toast.ok  { border-color: #2a4a35; color: var(--green); }
.toast.bad { border-color: #4a2828; color: var(--red); }
.toast.warn { border-color: #4a3a28; color: #d4a64a; }
@keyframes slidein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }

/* ── Top-level tab strip ───────────────────────────────────────────────── */
.tab-strip {
  display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.tab-top {
  background: transparent; border: none; color: var(--fg-dim);
  padding: 12px 18px; font-size: 14px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.tab-top:hover { color: var(--fg); }
.tab-top.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Admin tab — file cards ────────────────────────────────────────────── */
.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px; padding: 4px;
}
.file-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.file-head { display: flex; justify-content: space-between; align-items: baseline; }
.file-title { font-size: 14px; }
.file-actions a.tiny { padding: 4px 8px; font-size: 11px; text-decoration: none; }
.file-actions a[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.file-desc { font-size: 12px; line-height: 1.4; color: var(--fg-dim); }
.file-meta { font-size: 12px; color: var(--fg); }
.file-meta.bad { color: var(--red); }
.file-mtime { font-size: 11px; }
.file-drop {
  margin-top: 6px; padding: 14px; border: 1px dashed var(--border-2); border-radius: 6px;
  text-align: center; font-size: 12px; cursor: not-allowed; opacity: 0.7;
}
.file-drop:hover { background: var(--bg-3); }
