/* Design tokens (task 91, glass SaaS direction chosen by Chul; see design-system/recapsmith/MASTER.md).
 * Light is the default; dark follows the OS unless data-theme pins one.
 * Contrast (WCAG AA): white on the CTA gradient is 5.2:1 (#2563EB) to 5.7:1 (#7C3AED);
 * --text-muted #475569 on frosted white is >= 6:1; dark --text-muted #94A3B8 on #0B1020 is 7.4:1. */
:root {
  --bg: #F8FAFC;
  --surface: rgba(255, 255, 255, .66);       /* frosted glass panels */
  --surface-solid: #FFFFFF;                  /* inputs, dialogs: always readable */
  --surface-2: rgba(241, 245, 249, .85);
  --surface-3: #E2E8F0;
  --border: rgba(203, 213, 225, .65);
  --border-strong: #CBD5E1;
  --glass-edge: rgba(255, 255, 255, .85);
  --text: #1E293B;
  --text-muted: #475569;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(37, 99, 235, .12);
  --cta: linear-gradient(135deg, #2563EB, #7C3AED);
  --cta-hover: linear-gradient(135deg, #1D4ED8, #6D28D9);
  --glow: radial-gradient(circle at 12% 8%, rgba(147, 197, 253, .75) 0, transparent 38%),
          radial-gradient(circle at 92% 28%, rgba(253, 186, 116, .55) 0, transparent 34%),
          radial-gradient(circle at 45% 100%, rgba(196, 181, 253, .7) 0, transparent 40%);
  --ok: #15803D;
  --warn: #B45309;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --danger-ink: #991B1B;
  --shadow: 0 1px 2px rgba(30, 41, 59, .05), 0 8px 24px rgba(30, 41, 59, .08);
  --shadow-pop: 0 24px 70px rgba(30, 41, 59, .25);
  --backdrop: rgba(15, 23, 42, .35);
  --blur: 16px;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 280px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%232563EB'/%3E%3Cstop offset='1' stop-color='%237C3AED'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='11' cy='11' r='11' fill='url(%23g)'/%3E%3Cpath d='M9 7l6 4-6 4z' fill='%23fff'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1020;
    --surface: rgba(17, 24, 39, .62);
    --surface-solid: #111827;
    --surface-2: rgba(30, 41, 59, .7);
    --surface-3: #1E293B;
    --border: rgba(148, 163, 184, .16);
    --border-strong: rgba(148, 163, 184, .32);
    --glass-edge: rgba(148, 163, 184, .18);
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --accent: #60A5FA;
    --accent-hover: #93C5FD;
    --accent-ink: #0B1020;
    --accent-soft: rgba(96, 165, 250, .16);
    --glow: radial-gradient(circle at 12% 8%, rgba(37, 99, 235, .35) 0, transparent 38%),
            radial-gradient(circle at 92% 28%, rgba(234, 88, 12, .14) 0, transparent 34%),
            radial-gradient(circle at 45% 100%, rgba(124, 58, 237, .32) 0, transparent 40%);
    --ok: #4ADE80;
    --warn: #FBBF24;
    --danger: #F87171;
    --danger-bg: #2A1215;
    --danger-ink: #FECACA;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-pop: 0 24px 70px rgba(0, 0, 0, .6);
    --backdrop: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1020; --surface: rgba(17, 24, 39, .62); --surface-solid: #111827; --surface-2: rgba(30, 41, 59, .7);
  --surface-3: #1E293B; --border: rgba(148, 163, 184, .16); --border-strong: rgba(148, 163, 184, .32);
  --glass-edge: rgba(148, 163, 184, .18); --text: #E2E8F0; --text-muted: #94A3B8;
  --accent: #60A5FA; --accent-hover: #93C5FD; --accent-ink: #0B1020; --accent-soft: rgba(96, 165, 250, .16);
  --glow: radial-gradient(circle at 12% 8%, rgba(37, 99, 235, .35) 0, transparent 38%),
          radial-gradient(circle at 92% 28%, rgba(234, 88, 12, .14) 0, transparent 34%),
          radial-gradient(circle at 45% 100%, rgba(124, 58, 237, .32) 0, transparent 40%);
  --ok: #4ADE80; --warn: #FBBF24; --danger: #F87171; --danger-bg: #2A1215; --danger-ink: #FECACA;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35); --shadow-pop: 0 24px 70px rgba(0, 0, 0, .6); --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--glow), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 21px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
p { margin: 0; }

a { color: var(--accent); }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.hidden, [hidden] { display: none !important; }

/* ── top bar ─────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.topbar-actions { display: flex; gap: 8px; flex: none; }
.nav-toggle { display: none; }
.brand-mark { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 9px; }
.brand-mark::before { content: ""; width: 24px; height: 24px; background: var(--logo) center / contain no-repeat; flex: none; }
.brand-sub { font-size: 13px; color: var(--text-muted); }

/* ── layout ──────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 61px);
}
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 12px;
  overflow-y: auto;
  position: sticky;
  top: 61px;
  height: calc(100vh - 61px);
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 10px;
}
.detail { padding: 26px 30px 60px; max-width: 1100px; }

/* ── job list ────────────────────────────────────────────── */
.job-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.job-list:empty + #emptyJobs { display: block; }
.job-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 10px;
  cursor: pointer;
  font: inherit;
  display: grid;
  gap: 3px;
}
.job-item:hover { background: var(--surface-2); }
.job-item.active { background: var(--surface-3); border-color: var(--border-strong); }
.job-item .name {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.job-item .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-item .sub { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; }

/* ── grouping sources ─────────────────────────────────────── */
.sidebar-tools { display: flex; align-items: center; gap: 6px; }
.sidebar-sub {
  margin-top: 12px;
  padding: 14px 6px 8px;
  border-top: 1px solid var(--border);
}
.group-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.job-item .tick {
  flex: none;
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 10px;
  line-height: 1;
  color: transparent;
}
.job-item.picked .tick {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ── pills / status ──────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.ready { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.failed { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.pill.transcribing, .pill.analyzing, .pill.rendering, .pill.queued, .pill.created { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.transcribing::before, .pill.analyzing::before,
.pill.rendering::before, .pill.queued::before { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

/* ── buttons ─────────────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background .13s, border-color .13s;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: transparent; }
.btn.danger:hover { background: var(--danger-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 11px; font-size: 13px; }

/* a length target next to each Summarize button */
label.length {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
select.target-select {
  font: inherit;
  padding: 9px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 5px 7px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ── panels ──────────────────────────────────────────────── */
.placeholder { padding: 40px 0; display: grid; gap: 14px; justify-items: start; max-width: 620px; }
.placeholder h1 { font-size: 27px; line-height: 1.25; }

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.job-head h1 { overflow-wrap: anywhere; }
.job-head > div:first-child { min-width: 0; }
.job-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; flex: none; }
.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.provenance {
  margin-top: 9px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.provenance b { color: var(--text); font-weight: 600; }
.provenance code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
}

.panel { margin-top: 28px; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.banner {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  margin-top: 16px;
  border: 1px solid;
}
.banner.error { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger-ink); }

/* ── candidates ──────────────────────────────────────────── */
.candidate-list { display: grid; gap: 10px; }
.candidate {
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 66px 1fr auto;
  gap: 16px;
  align-items: center;
}
.candidate:hover { border-color: var(--border-strong); }
.score {
  width: 60px; height: 60px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-3) 0);
  position: relative;
}
.score::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--surface-solid);
}
.score span { position: relative; z-index: 1; }
.score small { display: block; font-size: 9px; font-weight: 600; color: var(--text-muted); letter-spacing: .06em; }
.cand-body { display: grid; gap: 5px; min-width: 0; }
.cand-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cand-title strong { font-size: 15px; }
.cand-time { font-family: var(--mono); font-size: 13px; color: var(--text-muted); }
.cand-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.reason {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
}
.cand-actions { display: flex; gap: 8px; }
.signals {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}
.signals i { font-style: normal; color: var(--text); }

/* ── clips ───────────────────────────────────────────────── */
.clip-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.clip {
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  align-content: start;
}
.clip-thumb {
  aspect-ratio: 9 / 16;
  background: var(--surface-2);
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.clip-thumb img, .clip-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip-thumb .pending { font-size: 13px; color: var(--text-muted); }
.clip-body { padding: 11px 12px; display: grid; gap: 8px; }
.clip-title { font-size: 13.5px; font-weight: 600; }
.clip-meta { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.clip-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.clip-failed { color: var(--danger); font-size: 12px; word-break: break-word; }
.clip-export { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--border); }
.clip-export span { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

/* ── job view polish (task 80) ───────────────────────────── */
.steps {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.steps li { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-muted); }
.steps li.now { color: var(--text); font-weight: 650; }
.step-mark {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid var(--border-strong);
  flex: none;
}
.steps li.done .step-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.now .step-mark { border-color: var(--accent); }
.steps li.now .spinner { width: 12px; height: 12px; }

.empty {
  margin: 0;
  padding: 18px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
}
.empty b { color: var(--text); font-weight: 650; }

details.why summary {
  cursor: pointer;
  width: fit-content;
  font-size: 12px;
  color: var(--text-muted);
}
details.why summary:hover { color: var(--text); }
details.why .signals { margin-top: 6px; }

.clip-thumb .pending { display: inline-flex; align-items: center; gap: 8px; }
.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.play-overlay svg {
  width: 52px; height: 52px;
  padding: 13px 11px 13px 15px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  transition: transform .15s, background .15s;
}
.play-overlay:hover svg, .play-overlay:focus-visible svg { transform: scale(1.08); background: var(--accent); }
.play-overlay:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.dur-badge {
  position: absolute;
  right: 8px; bottom: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font: 600 12px/1.4 var(--mono);
  pointer-events: none;
}
.clip.failed { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }

/* ── dialogs ─────────────────────────────────────────────── */
dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog form { padding: 20px 22px 22px; display: grid; gap: 15px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: 17px; text-transform: none; letter-spacing: -0.01em; color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.hint { color: var(--text-muted); font-size: 13px; line-height: 1.6; margin: 10px 0 0; }

label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--text); }
input[type="url"], input[type="email"], input[type="text"], input[type="number"], input[type="file"],
select, textarea {
  font: inherit;
  font-weight: 400;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
textarea { resize: vertical; }

.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-sm); }
.tab {
  flex: 1;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.tab.active { background: var(--surface-3); color: var(--text); }

fieldset.provenance-form {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  display: grid;
  gap: 12px;
  margin: 0;
}
legend { font-size: 12.5px; font-weight: 700; color: var(--text-muted); padding: 0 6px; text-transform: uppercase; letter-spacing: .06em; }

/* ── add-source dialog (task 79) ─────────────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 26px 18px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 400;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.dz-icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: 4px; }
.dz-title { font-weight: 650; font-size: 15px; max-width: 100%; overflow-wrap: anywhere; }
.dz-sub { font-size: 13.5px; color: var(--text-muted); }
.dz-sub u { color: var(--accent); text-underline-offset: 2px; }
.dz-limits { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.tab-panel { display: grid; gap: 10px; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-weight: 400;
  transition: border-color .13s, background .13s;
}
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input { position: absolute; left: 12px; top: 13px; margin: 0; accent-color: var(--accent); }
.choice-title { font-size: 13.5px; font-weight: 650; }
.choice-help { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }

.adv-grid { display: grid; gap: 12px; padding-top: 13px; }

.upload-progress { display: grid; gap: 6px; }
.upload-progress .bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.upload-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ── clip adjust ─────────────────────────────────────────── */
.preview { display: grid; gap: 9px; }
.preview-frame {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
}
.preview-label { font-family: var(--mono); font-size: 19px; font-weight: 600; }
.preview-arrow { color: var(--text-muted); }
.preview-dur { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 600; }

.preview-track {
  position: relative;
  height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.preview-range {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--accent-soft);
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}
.preview-marker {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border-strong);
}

.bounds { display: grid; gap: 11px; }
.bound-row { display: grid; grid-template-columns: 1fr 92px; gap: 10px; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--accent); padding: 0; }
.snap-row { display: flex; gap: 8px; }

.word-preview {
  max-height: 150px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.85;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 7px;
  align-content: flex-start;
}
.word-preview .w { color: var(--text-muted); }
.word-preview .w.in { color: var(--text); }
.word-preview .w.edge { color: var(--accent); font-weight: 650; }
.word-preview .none { color: var(--text-muted); font-size: 13px; }

details.options { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
details.options summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 13px; }

/* ── misc ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 17px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 50;
  box-shadow: var(--shadow-pop);
}
.toast.error { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger-ink); }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: inline-flex; }
  .sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--border); position: static; height: auto; max-height: 60vh; }
  body.nav-open .sidebar { display: block; }
  .job-head { flex-direction: column; gap: 14px; }
  .job-actions { justify-content: flex-start; }
  .detail { padding: 20px 16px 50px; }
  .candidate { grid-template-columns: 54px 1fr; }
  .cand-actions { grid-column: 1 / -1; }
  .opt-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .brand-sub { display: none; }
  .topbar .btn { padding: 8px 12px; }
  .detail { padding: 16px 14px 40px; }
  .placeholder h1 { font-size: 23px; }
  .clip-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .clip-body { padding: 9px 10px; }
  .candidate { padding: 12px; gap: 12px; }
  .score { width: 50px; height: 50px; font-size: 14px; }
  .cand-time { flex-basis: 100%; }
  .steps { gap: 8px 14px; }
  dialog form { padding: 16px; }
}

/* ── glass layer (task 91) ─────────────────────────────────── */
.topbar, .sidebar, .candidate, .clip, dialog, .job-item.active, .group-bar, details.options, fieldset.provenance-form {
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}
.topbar { border-bottom-color: var(--glass-edge); }
.sidebar { border-right-color: var(--glass-edge); }
.candidate, .clip { border-color: var(--glass-edge); }
dialog { background: var(--surface-solid); }
input[type="url"], input[type="email"], input[type="text"], input[type="number"], input[type="file"], select, textarea { background: var(--surface-solid); }
.choice { background: var(--surface-solid); }
.dropzone { background: var(--surface-2); }

/* primary actions use the brand gradient; white text passes AA on every stop */
.btn.primary, a.btn.primary { background: var(--cta); border-color: transparent; color: #FFFFFF; }
.btn.primary:hover, a.btn.primary:hover { background: var(--cta-hover); border-color: transparent; }
.btn { border-radius: var(--radius-sm); min-height: 40px; }
.btn.sm { min-height: 34px; }
.steps li.done .step-mark { background: var(--cta); border-color: transparent; color: #FFFFFF; }
.upload-progress .bar i { background: var(--cta); }

/* touch targets on phones */
@media (max-width: 640px) {
  .btn, .btn.sm, .icon-btn, .tab { min-height: 44px; }
}

/* respect reduced motion: no transitions or spinning */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* browsers without backdrop-filter get solid panels instead of see-through ones */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .sidebar, .candidate, .clip { background: var(--surface-solid); }
}

/* ── narrated recap panel (task 65) ───────────────────────── */
.narr-form { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: end; margin-bottom: 12px; }
.narr-goal { min-width: 0; }
.narr-form .length { padding-bottom: 2px; }
.script { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: seg; }
.seg {
  position: relative;
  padding: 12px 14px 12px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  display: grid;
  gap: 8px;
}
.seg::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cta); }
.seg.play::before { background: var(--border-strong); }
.seg-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.seg-kind { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.seg.narration .seg-kind { color: var(--accent); }
.seg-time { font: 12.5px/1.4 var(--mono); color: var(--text-muted); }
.seg-tools { margin-left: auto; display: flex; gap: 2px; }
.seg-tools .icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; }
.seg-tools .icon-btn:disabled { opacity: .35; cursor: default; }
.seg-tools svg, .play-cue svg { width: 16px; height: 16px; }
.seg textarea { min-height: 64px; line-height: 1.55; }
.seg-body { display: flex; align-items: flex-start; gap: 12px; }
.play-cue {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #FFFFFF; background: var(--cta);
  transition: transform .15s, box-shadow .15s;
}
.play-cue:hover { transform: scale(1.06); box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.play-cue:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.play-cue[aria-pressed="true"] { background: var(--text); }
.seg-quote { quotes: "\201C" "\201D"; font-size: 14px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.narr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.narr-spacer { flex: 1; }
@media (max-width: 640px) {
  .narr-form { grid-template-columns: 1fr; }
  .narr-form .btn { width: 100%; justify-content: center; }
  .seg-tools .icon-btn { width: 44px; height: 44px; }
  .narr-actions .btn { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 420px) { .hide-sm { display: none; } .brand-mark { font-size: 16px; } .topbar-actions { gap: 6px; } }

/* in-place rename of the job title */
#jobTitle { cursor: text; }
#jobTitle:hover { text-decoration: underline dotted; text-underline-offset: 6px; }
.title-edit { font: inherit; width: 100%; padding: 2px 6px; }

/* ── #98 visuals for audio-only clips ── */
.visuals { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 14px 0 0; }
.visuals legend { padding: 0 6px; font-size: 13px; font-weight: 650; color: var(--text-muted); }
.visuals .seg, .platforms .seg { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.visuals .seg::before, .platforms .seg::before { content: none; }
.visuals .seg label, .platforms .seg label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-solid); font-size: 14px; }
.visuals .seg label:has(input:checked), .platforms .seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.visuals .seg input:focus-visible, .platforms .seg input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visuals #visualsRefresh { margin-top: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; max-height: 260px; overflow-y: auto; }
.thumb { position: relative; display: flex; flex-direction: column; gap: 4px; cursor: pointer; font-size: 12px; color: var(--text-muted); }
.thumb img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; border: 2px solid var(--accent); background: var(--surface-3); }
.thumb input { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; accent-color: var(--accent); }
.thumb:has(input:not(:checked)) img { border-color: transparent; opacity: .35; filter: grayscale(1); }
.thumb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── billing in the account menu ── */
.account-billing { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
#billingBtn { margin: 8px 0; }

/* ── #102 split-screen background ── */
.bgpick .thumbs { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.bgpick .thumb input { position: absolute; opacity: 0; }
.bgpick .thumb img, .bgpick .bg-none { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 2px solid transparent; background: var(--surface-3); }
.bgpick .thumb:has(input:checked) img, .bgpick .thumb:has(input:checked) .bg-none { border-color: var(--accent); }
.bgpick .thumb:has(input:checked) span { color: var(--accent); font-weight: 650; }
.bgpick .thumb:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.bgpick .bg-upload { margin-top: 10px; display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; }
.bgpick #bgPos { margin-top: 10px; }
.bg-preview { display: block; margin-top: 10px; max-height: 360px; max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }

/* ── #101 platform picker ── */
.platforms { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.platforms legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 650; color: var(--text-muted); }
.platforms .hint { margin: 8px 0 0; }

/* ── #29 sign-in and account menu ── */
body.signed-out .layout, body.signed-out .topbar-actions { display: none; }
.signin { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 24px 16px; }
.signin-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(18px); box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,.08)); }
.signin-card h1 { margin: 0; font-size: 24px; }
.signin-card p { margin: 0; }
.signin-card label { display: grid; gap: 6px; font-weight: 600; }
.signin-card .btn { min-height: 44px; }
.signin-sent { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); }
.account { position: relative; }
.account summary { list-style: none; padding: 4px; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.account summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, #2563EB, #7C3AED); }
.account-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; max-width: calc(100vw - 32px);
  padding: 14px; display: grid; gap: 8px; border-radius: var(--radius-sm); background: var(--surface-solid); border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.account-pop p { margin: 0; }
.account-email { font-weight: 600; overflow-wrap: anywhere; }

/* ── #77 legal links ── */
.app-footer { padding: 18px 20px 28px; }
.app-footer nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.app-footer a { color: var(--text-muted); font-size: 13px; text-decoration: none; }
.app-footer a:hover, .app-footer a:focus-visible { color: var(--text); text-decoration: underline; }
.legal-note { margin: 4px 0 0; text-align: center; line-height: 1.5; }
