/* Koenig Video Translator — light blue & golden theme
   Palette: sky #EDF5FC · panel #FFFFFF · ink #16324A · muted #587089
            blue #2F76B5 · gold #C9A227 · gradient blue→gold (via light midtones) */

:root {
  --bg: #EDF5FC;
  --panel: #FFFFFF;
  --panel-2: #F2F7FC;
  --line: #D5E3F0;
  --ink: #16324A;
  --muted: #587089;
  --blue: #2F76B5;
  --blue-deep: #1D5A92;
  --gold: #C9A227;
  --gold-deep: #A9861B;
  --danger: #C0392B;
  --grad: linear-gradient(135deg, #3D85C6, #7FB3DC 45%, #E3C566 80%, #C9A227);
  --grad-bar: linear-gradient(90deg, #3D85C6, #7FB3DC 45%, #E3C566 80%, #C9A227);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(22,48,73,.06), 0 10px 30px rgba(22,48,73,.07);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  background:
    radial-gradient(900px 420px at 90% -10%, rgba(201,162,39,.10), transparent 60%),
    radial-gradient(800px 420px at -10% 30%, rgba(61,133,198,.10), transparent 55%),
    linear-gradient(160deg, #F2F8FD 0%, #E4EFF9 48%, #F5EEDC 100%) fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); }
a:hover { color: var(--blue-deep); }

main { width: calc(100vw - 48px); max-width: 1600px; margin: 0 auto; flex: 1; }

/* ---------- masthead ---------- */
.masthead { width: calc(100vw - 48px); max-width: 1600px; margin: 26px auto 20px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wordmark { display: flex; align-items: center; gap: 16px; }
.reel {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--grad);
  padding: 3px;
}
.reel::before {
  content: ""; display: block; width: 100%; height: 100%; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 22%, var(--gold) 0 3.5px, transparent 4.5px),
    radial-gradient(circle at 78% 66%, var(--blue) 0 3.5px, transparent 4.5px),
    radial-gradient(circle at 22% 66%, var(--gold) 0 3.5px, transparent 4.5px),
    radial-gradient(circle at 50% 50%, var(--blue-deep) 0 3px, transparent 4px),
    var(--panel);
}
h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -.01em; }
h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--blue), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { color: var(--muted); font-size: .88rem; }

.usernav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.whoami {
  font-family: var(--font-display); font-size: .82rem; color: var(--blue-deep);
  border: 1px solid rgba(47,118,181,.3); background: rgba(47,118,181,.07);
  padding: 6px 13px; border-radius: 99px;
}
.navlink {
  color: var(--muted); text-decoration: none; font-size: .84rem;
  padding: 8px 12px; border-radius: 10px; transition: color .15s, background .15s;
}
.navlink:hover { color: var(--ink); background: rgba(47,118,181,.08); }

/* saved-jobs icon button (top right) */
.jobsbtn {
  position: relative; width: 44px; height: 44px; flex: none;
  border-radius: 12px; border: 1px solid var(--line); cursor: pointer;
  background: var(--panel); color: var(--blue-deep);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(22,48,73,.06);
  transition: border-color .15s, transform .12s;
}
.jobsbtn:hover { border-color: var(--gold); }
.jobsbtn:active { transform: translateY(1px); }
.jobsbtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.jobs-count {
  position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px;
  border-radius: 99px; padding: 0 5px;
  background: linear-gradient(135deg, #D9B33C, var(--gold-deep));
  color: #fff; font-size: .68rem; font-weight: 600; line-height: 19px; text-align: center;
}

/* ---------- layout: options on the left, output on the right ---------- */
.layout { display: grid; grid-template-columns: minmax(250px, 330px) minmax(0, 1fr); gap: 18px; align-items: start; }
.flow { display: flex; flex-direction: column; gap: 12px; list-style: none; min-width: 0; }
.step-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity .25s, box-shadow .25s;
}
.step-card.active {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    var(--grad) border-box;
}
.step-card.locked { opacity: .55; }
.step-card.locked .step-head { cursor: default; }

.step-head {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 3px;
  padding: 16px 18px 14px;
}
.step-card.done .step-head:hover .step-title { color: var(--blue-deep); }
.step-num {
  font-family: var(--font-display); font-size: .74rem; letter-spacing: .14em;
  color: var(--gold-deep); display: flex; align-items: center; gap: 8px;
}
.step-check {
  display: none; width: 15px; height: 15px; border-radius: 50%;
  background: linear-gradient(135deg, #D9B33C, var(--gold-deep));
  color: #fff; align-items: center; justify-content: center; flex: none;
}
.step-check svg { width: 9px; height: 9px; }
.step-card.done .step-check { display: inline-flex; }
.step-title { font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; }
.step-sum {
  color: var(--muted); font-size: .78rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step-card.active .step-sum { display: none; }
.step-card.active .step-head { cursor: default; padding-bottom: 0; }

.step-body { display: none; padding: 14px 22px 22px; }
.step-card.active .step-body { display: block; }

/* ---------- right output stage ---------- */
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  min-height: 520px;
  min-width: 0;
}
.stage-h {
  font-family: var(--font-display); font-size: 1.12rem; font-weight: 500;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.stage-h .k { color: var(--gold-deep); font-size: .78rem; letter-spacing: .12em; }
.stage-empty {
  min-height: 468px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--muted); text-align: center; padding: 20px;
}
.stage-empty .film {
  width: 76px; height: 76px; border-radius: 50%; background: var(--grad); padding: 3px;
  display: flex; align-items: center; justify-content: center;
}
.stage-empty .film span {
  width: 100%; height: 100%; border-radius: 50%; background: var(--panel);
  display: flex; align-items: center; justify-content: center; color: var(--blue-deep);
}
.stage-empty strong { color: var(--ink); font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; }
.stage-empty p { font-size: .86rem; max-width: 380px; }

@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
  .stage { min-height: 0; }
  .stage-empty { min-height: 260px; }
}

/* ---------- generic card (login / sharepoint) ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 18px;
}
.card h2 {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 500;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card h2 .k { color: var(--gold-deep); font-size: .8rem; letter-spacing: .12em; }

/* ---------- login ---------- */
.login-body { justify-content: center; }
.login-wrap { width: min(430px, 92vw); margin: 9vh auto 0; flex: 1; }
.login-mark { margin-bottom: 22px; }
.login-card { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--font-display); font-size: .74rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-top: 12px;
}
.login-card select, .login-card input {
  width: 100%; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font: inherit; margin-top: 6px;
}
.login-card input[readonly] { color: var(--muted); }
.login-btn { margin-top: 20px; width: 100%; }
.login-error { color: var(--danger); font-size: .85rem; }
.inline-link { color: var(--blue); }

/* ---------- sharepoint connection (legacy pages) ---------- */
.steps-list { margin: 14px 0 18px 20px; color: var(--muted); font-size: .9rem; }
.steps-list li { margin-bottom: 8px; }
.steps-list code { color: var(--blue-deep); background: var(--panel-2); padding: 2px 7px; border-radius: 6px; font-size: .82rem; }
textarea, .test-form input[type=text], input[type=file] {
  width: 100%; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font: inherit; font-size: .84rem; margin-top: 6px; resize: vertical;
}
textarea:focus-visible, .test-form input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.notice { margin-top: 12px; color: var(--gold-deep); font-size: .88rem; }
.test-form { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }

/* ---------- form bits ---------- */
.setup-row { margin: 6px 0 4px; }
.lang-row { display: flex; flex-direction: column; gap: 10px; }
select {
  width: 100%;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font: inherit;
}
select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
select:disabled { opacity: .55; cursor: not-allowed; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 10px; }

.needs-lang {
  margin-top: 16px; padding: 14px 16px;
  border: 1px solid rgba(201,162,39,.5); border-radius: 10px;
  background: rgba(201,162,39,.07);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.needs-lang p { color: var(--gold-deep); font-size: .9rem; flex: 1; min-width: 180px; }

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed #B9CFE3;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: linear-gradient(160deg, rgba(61,133,198,.04), rgba(201,162,39,.05));
  transition: border-color .2s, background .2s, color .2s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.drag {
  border-color: var(--gold); color: var(--ink);
  background: linear-gradient(160deg, rgba(61,133,198,.08), rgba(201,162,39,.1));
  outline: none;
}
.dropzone.locked { opacity: .55; cursor: not-allowed; }
.dropzone.locked:hover { border-color: #B9CFE3; color: var(--muted); }
.dropzone svg { margin-bottom: 10px; color: var(--blue); }
.dropzone strong { color: var(--ink); }

/* ---------- upload bar ---------- */
.upload-progress { margin-top: 18px; }
.bar-track { height: 8px; background: #E2ECF5; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--grad-bar); border-radius: 99px; transition: width .25s; }
#uploadLabel { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.filename {
  font-size: .85rem; color: var(--muted); margin-top: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-display); font-size: .9rem; font-weight: 500;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
  transition: transform .12s, filter .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, #D9B33C, var(--gold-deep));
  color: #FFFDF5;
  box-shadow: 0 2px 8px rgba(169,134,27,.3);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { background: #E2ECF5; color: var(--muted); box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: var(--panel); color: var(--blue-deep); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--blue); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- signature: the dubbing tape ---------- */
.tape-wrap { margin: 6px 0 14px; }
.tape {
  position: relative; height: 46px;
  background: #E7F0F8;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.tape-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--grad-bar);
  transition: width .5s ease;
}
.tape-holes {
  position: absolute; left: 0; right: 0; height: 8px;
  background-image: radial-gradient(circle at 6px 4px, #F2F8FD 0 3px, transparent 3.5px);
  background-size: 22px 8px; background-repeat: repeat-x;
}
.tape-holes.top { top: 4px; }
.tape-holes.bottom { bottom: 4px; }

.tape-meta { display: flex; align-items: baseline; gap: 14px; margin-top: 12px; }
.pct {
  font-family: var(--font-display); font-size: 2.3rem; font-weight: 700; line-height: 1;
  background: linear-gradient(120deg, var(--blue), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pct small { font-size: 1rem; }
.phase { color: var(--muted); font-size: .92rem; }
.segline { color: var(--muted); font-size: .82rem; min-height: 1.2em; }
.lang-chip {
  background: rgba(47,118,181,.08); color: var(--blue-deep);
  border: 1px solid rgba(47,118,181,.3);
  font-size: .75rem; padding: 3px 10px; border-radius: 99px; letter-spacing: .04em;
}

.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.error-box {
  margin-top: 16px; padding: 14px 16px;
  border: 1px solid rgba(192,57,43,.35); border-radius: 10px;
  background: rgba(192,57,43,.05);
}
.error-box p { color: var(--danger); font-size: .88rem; margin-bottom: 10px; word-break: break-word; }

/* ---------- result ---------- */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.result-cell {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.result-title {
  font-family: var(--font-display); font-weight: 500; font-size: .95rem;
  color: var(--muted); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.result-title.accent { color: var(--gold-deep); }
.result-grid video {
  width: 100%; aspect-ratio: 16 / 9; border-radius: 10px;
  background: #0B1B29; display: block;
}
@media (max-width: 900px) { .result-grid { grid-template-columns: 1fr; } }

/* ---------- saved-jobs drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(22,48,73,.35);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 40;
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 94vw);
  background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -14px 0 44px rgba(22,48,73,.16);
  transform: translateX(103%); transition: transform .3s ease;
  z-index: 50; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(61,133,198,.05), rgba(201,162,39,.06));
}
.drawer-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; }
.drawer-close {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 1.1rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.drawer-close:hover { color: var(--ink); border-color: var(--blue); }
.drawer-body { overflow-y: auto; padding: 6px 22px 22px; flex: 1; }

.job-list { list-style: none; }
.job-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 0; border-top: 1px solid var(--line);
}
.job-list li:first-child { border-top: 0; }
.job-name { flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.job-sub { color: var(--muted); font-size: .78rem; display: block; }
.job-list .btn { padding: 8px 15px; font-size: .8rem; }

footer { text-align: center; color: var(--muted); font-size: .78rem; padding: 26px 0 34px; }

@media (max-width: 560px) {
  .step-body { padding: 12px 16px 18px; }
  .pct { font-size: 1.8rem; }
}

/* ---------- Dokploy batch/background additions ---------- */
.layout { grid-template-columns: minmax(290px, 390px) minmax(0, 1fr); }

.switch-row {
  margin-top: 14px; padding: 13px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer;
}
.switch-row > span:first-child { min-width: 0; }
.switch-row strong { display: block; font-family: var(--font-display); font-size: .88rem; font-weight: 500; }
.switch-row small { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.switch { position: relative; flex: none; width: 46px; height: 26px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui {
  position: absolute; inset: 0; border-radius: 99px; background: #CBD9E6;
  transition: background .2s; box-shadow: inset 0 0 0 1px rgba(22,48,73,.08);
}
.switch-ui::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; box-shadow: 0 2px 5px rgba(22,48,73,.2);
  transition: transform .2s;
}
.switch input:checked + .switch-ui { background: linear-gradient(135deg, #3D85C6, #C9A227); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--gold); outline-offset: 2px; }

.file-queue { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.queue-row {
  padding: 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2); min-width: 0;
}
.queue-row.has-error { border-color: rgba(192,57,43,.45); background: rgba(192,57,43,.04); }
.queue-top { display: flex; align-items: flex-start; gap: 10px; }
.queue-name-wrap { min-width: 0; flex: 1; }
.queue-name { display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-size { color: var(--muted); font-size: .72rem; }
.icon-remove {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--muted); cursor: pointer; font-size: 1.05rem; line-height: 1;
}
.icon-remove:hover { color: var(--danger); border-color: rgba(192,57,43,.45); }
.icon-remove:disabled { opacity: .45; cursor: not-allowed; }
.queue-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.queue-select { padding: 9px 10px; font-size: .76rem; min-width: 0; }
.mini-switch-row {
  grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 7px;
  color: var(--muted); font-size: .75rem; cursor: pointer;
}
.mini-switch-row input { accent-color: var(--blue); }
.queue-progress { margin-top: 9px; }
.queue-progress .bar-track { height: 5px; }
.queue-status { display: block; color: var(--muted); font-size: .72rem; margin-top: 5px; word-break: break-word; }
.queue-row.has-error .queue-status { color: var(--danger); }
.start-batch { width: 100%; margin-top: 14px; }
.compact-actions .btn { flex: 1; padding-left: 10px; padding-right: 10px; }

.stage-title-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  margin-bottom: 16px;
}
.stage-title-row .stage-h { margin-bottom: 0; }
.small-btn { padding: 8px 13px; font-size: .78rem; flex: none; }
.batch-job-list { display: flex; flex-direction: column; gap: 13px; }
.batch-job-card {
  border: 1px solid var(--line); border-radius: 13px; padding: 16px;
  background: linear-gradient(160deg, rgba(61,133,198,.035), rgba(201,162,39,.035));
}
.batch-job-card.complete { border-color: rgba(47,118,181,.32); }
.batch-job-card.has-error { border-color: rgba(192,57,43,.42); background: rgba(192,57,43,.035); }
.batch-job-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.batch-job-title { min-width: 0; flex: 1; }
.batch-job-title strong { display: block; font-family: var(--font-display); font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-job-title span { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.mode-chip {
  flex: none; padding: 4px 9px; border-radius: 99px; font-size: .67rem;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.mode-chip.background { color: var(--blue-deep); background: rgba(47,118,181,.09); border: 1px solid rgba(47,118,181,.25); }
.mode-chip.browser { color: var(--gold-deep); background: rgba(201,162,39,.09); border: 1px solid rgba(201,162,39,.3); }
.job-progress-row { display: grid; grid-template-columns: 1fr 44px; gap: 12px; align-items: center; margin-top: 13px; }
.job-progress-row .bar-track { height: 9px; }
.job-progress-row > strong { font-family: var(--font-display); color: var(--blue-deep); font-size: .84rem; text-align: right; }
.job-phase { margin-top: 9px; font-size: .84rem; color: var(--ink); word-break: break-word; }
.batch-job-card.has-error .job-phase { color: var(--danger); }
.job-detail { margin-top: 2px; color: var(--muted); font-size: .74rem; }
.job-actions { margin-top: 12px; }
.job-actions .btn { padding: 8px 13px; font-size: .77rem; }
.result-file-name { color: var(--muted); font-size: .83rem; margin: -7px 0 14px; overflow-wrap: anywhere; }

.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .queue-options { grid-template-columns: 1fr; }
  .mini-switch-row { grid-column: auto; }
}

@media (max-width: 520px) {
  .stage-title-row { flex-direction: column; }
  .small-btn { align-self: stretch; }
  .batch-job-head { flex-direction: column; }
  .mode-chip { align-self: flex-start; }
  .job-actions .btn { flex: 1; }
}

/* ---------- upload / course-recording source selector ---------- */
.source-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
  padding: 5px; margin: 2px 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
}
.source-tab {
  border: 0; border-radius: 9px; padding: 10px 9px; cursor: pointer;
  background: transparent; color: var(--muted); font: 500 .78rem var(--font-display);
  transition: background .15s, color .15s, box-shadow .15s;
}
.source-tab.active {
  background: var(--panel); color: var(--blue-deep);
  box-shadow: 0 2px 9px rgba(22,48,73,.09);
}
.source-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.source-panel { min-width: 0; }

.course-search-form label {
  display: block; margin-bottom: 7px; color: var(--ink);
  font-family: var(--font-display); font-size: .8rem; font-weight: 500;
}
.course-search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.course-search-row input[type="search"] {
  width: 100%; min-width: 0; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--ink); font: inherit; font-size: .82rem;
}
.course-search-row input[type="search"]:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px;
}
.course-search-row .btn { padding: 10px 13px; white-space: nowrap; font-size: .78rem; }
.course-status {
  margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: .76rem; line-height: 1.45;
}
.course-status.info { color: var(--blue-deep); background: rgba(47,118,181,.06); }
.course-status.success { color: #236B4B; border-color: rgba(35,107,75,.3); background: rgba(35,107,75,.06); }
.course-status.error { color: var(--danger); border-color: rgba(192,57,43,.35); background: rgba(192,57,43,.05); }
.course-results-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.course-results-head > strong { font-family: var(--font-display); font-size: .84rem; }
.course-results { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.course-recording-card {
  padding: 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2); min-width: 0;
}
.course-recording-card.queued { border-color: rgba(47,118,181,.35); background: rgba(47,118,181,.045); }
.course-recording-card.has-error { border-color: rgba(192,57,43,.4); background: rgba(192,57,43,.035); }
.course-recording-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.course-recording-head > div { min-width: 0; }
.course-recording-head strong {
  display: block; font-family: var(--font-display); font-size: .82rem;
  overflow-wrap: anywhere;
}
.course-recording-head span { display: block; color: var(--muted); font-size: .7rem; margin-top: 2px; }
.source-preview-link { flex: none; font-size: .69rem; text-decoration: none; white-space: nowrap; }
.course-options { margin-top: 10px; }
.course-recording-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line);
}
.course-recording-status { min-width: 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.course-recording-card.has-error .course-recording-status { color: var(--danger); }
.course-recording-footer .btn { max-width: 165px; line-height: 1.25; }

@media (max-width: 560px) {
  .source-tabs, .course-search-row { grid-template-columns: 1fr; }
  .course-recording-footer { align-items: stretch; flex-direction: column; }
  .course-recording-footer .btn { max-width: none; width: 100%; }
}
