:root {
  --bg: #f7f8fa; --surface: #ffffff; --text: #1b1f24; --muted: #4f5964; --border: #b9c2cc;
  --accent: #0b5cad; --accent-text: #ffffff; --ok: #1a6b35; --warn: #7a4900; --bad: #b0201c; --focus: #ffbf47;
  --disabled-bg: #e3e7eb; --disabled-text: #4f5964; --disabled-border: #7c8792;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171b; --surface: #1d2126; --text: #e8ebee; --muted: #b3bcc6; --border: #4a535d;
    --accent: #7ab8f7; --accent-text: #0b1520; --ok: #7bd896; --warn: #f2bd6b; --bad: #ff9b96;
    --disabled-bg: #2a2f35; --disabled-text: #b3bcc6; --disabled-border: #7d8791; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px; z-index: 2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
h1 { font-size: 1.3rem; margin: 0; } h2 { font-size: 1.15rem; margin: 0 0 8px; } h2:focus { outline: none; }
.tag { font-size: .75rem; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; color: var(--muted); vertical-align: middle; }
.session { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); }
main { max-width: 780px; margin: 0 auto; padding: 16px; }
main:focus { outline: none; }
.steps { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.steps li::before { content: counter(list-item) ". "; } .steps li { counter-increment: list-item; }
.steps li[aria-current="step"] { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
section { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.hint, .notice { color: var(--muted); margin: 4px 0 8px; }
label { display: block; font-weight: 600; margin: 8px 0 4px; }
/* agreement checkboxes (2026-10-28): a bold label in a clear box; the whole label is the click target */
label.check { font-weight: 700; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 8px; margin: 12px 0 4px; }
label.check input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
label.check:has(input:checked) { border-color: var(--accent); }
label.check:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
label.check.long, label.check.consent-check { font-weight: 400; }
.check-hint { margin: 2px 0 8px; font-weight: 600; color: var(--warn); }
.check-hint[hidden] { display: none; }
input[type=search] { width: 100%; padding: 8px; min-height: 44px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; }
.drop { display: block; border: 2px dashed var(--border); border-radius: 8px; padding: 20px 16px; text-align: center; cursor: pointer; font-weight: 400; }
.drop.over { border-color: var(--accent); background: var(--bg); }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop-title { display: block; font-weight: 600; }
.file-input { display: block; margin: 8px auto 0; max-width: 100%; font: inherit; color: var(--text); }
button { font: inherit; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-text); cursor: pointer; margin-top: 8px; min-height: 44px; }
button.secondary { background: transparent; color: var(--accent); }
/* unmistakably disabled (2026-10-28): grey, dashed border, no accent colour */
button:disabled, button.secondary:disabled { opacity: 1; background: var(--disabled-bg); color: var(--disabled-text);
  border: 2px dashed var(--disabled-border); cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
progress { width: 100%; height: 12px; }
fieldset { border: 0; padding: 0; margin: 8px 0; min-width: 0; }
.lang-list { list-style: none; padding: 0; margin: 0; max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.lang-list li { border-bottom: 1px solid var(--border); } .lang-list li:last-child { border-bottom: 0; }
.lang-list label { font-weight: 400; margin: 0; padding: 10px 12px; display: flex; gap: 8px; align-items: center; cursor: pointer; flex-wrap: wrap; }
.lang-list .avail { margin-left: auto; font-size: .85rem; font-weight: 600; border: 1px solid var(--border); border-radius: 10px; padding: 0 8px; color: var(--muted); }
.lang-list .why { color: var(--muted); font-size: .85rem; padding: 0 12px 8px 40px; }
.lang-list .why p { margin: 2px 0; }
.lang-list .why details summary { cursor: pointer; min-height: 24px; }
.audio-note { border-left: 3px solid var(--warn); padding: 4px 10px; margin: 8px 0; }
.chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.chips button { margin: 0; padding: 4px 10px; min-height: 36px; border-radius: 18px; background: transparent; color: var(--text); border-color: var(--border); }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0; }
.summary dt { color: var(--muted); } .summary dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.jobs { list-style: none; padding: 0; margin: 0; }
.jobs > li { border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 8px; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-weight: 600; }
.badge { font-size: .9rem; font-weight: 600; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); } .badge.wait { color: var(--muted); }
.stages { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 8px 0 0; font-size: .9rem; color: var(--muted); }
.stages li[data-state="done"]::before { content: "✓ "; color: var(--ok); }
.stages li[data-state="current"] { color: var(--text); font-weight: 600; }
.stages li[data-state="current"]::before { content: "▸ "; }
.task-msg { margin: 6px 0 0; }
.job-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.error { border: 1px solid var(--bad); color: var(--bad); border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; overflow-wrap: anywhere; }
.task-error { color: var(--bad); margin: 6px 0 0; }
@media (max-width: 480px) { main { padding: 8px; } section { padding: 12px; } .summary { grid-template-columns: 1fr; } }
/* ---- translation progress panel (docs/PROGRESS_UI_REPORT.md) ---- */
.progress-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 4px 0 16px;
  background: linear-gradient(180deg, var(--surface), var(--bg)); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.05); }
.bar { position: relative; height: 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; margin: 8px 0 4px; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .6s ease; }
.bar.indeterminate .bar-fill { width: 30% !important; animation: pp-slide 1.6s ease-in-out infinite; }
@keyframes pp-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
.pp-line { margin: 4px 0; font-weight: 600; } .pp-line #pp-bar-label { font-weight: 400; color: var(--muted); }
.pp-stale { color: var(--warn); font-weight: 600; margin: 4px 0; }
.pp-done { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
.pp-done-head { font-weight: 600; margin: 0 0 4px; }
.pp-done.complete .pp-done-head::before { content: "✓"; display: inline-block; margin-right: 6px; color: var(--ok); animation: pp-pop .35s ease-out; }
@keyframes pp-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.gate-msg { border-left: 3px solid var(--warn); padding: 4px 10px; margin: 8px 0; }
.stage-help { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.jobs > li { transition: border-color .3s ease; border-radius: 10px; }
.stages { flex-direction: column; gap: 2px; }
.stages li { padding: 2px 6px; border-radius: 6px; transition: background-color .3s ease; }
.stages li .st-word { color: var(--muted); font-weight: 400; }
.stages li[data-state="current"] { background: var(--bg); }
.stages li[data-state="pending"]::before { content: "○ "; }
.stages li[data-state="current"]::before { content: "● "; color: var(--accent); }
.stages li[data-state="stopped"]::before { content: "✕ "; color: var(--bad); }
/* ---- source disclaimer, data handling, voice choice, validation summary ---- */
.source-disclaimer { background: var(--surface); border: 2px solid var(--text); border-left-width: 6px; border-radius: 8px;
  padding: 12px 14px; margin: 0 0 12px; font-size: 1.05rem; line-height: 1.45; }
.data-handling { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; margin: 0 0 16px; }
.data-handling summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.voice-choices { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.voice-choices legend { font-weight: 600; padding: 0 4px; }
.voice-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.voice-row label { margin: 0; min-width: 9rem; }
.voice-row select { font: inherit; padding: 6px 8px; min-height: 40px; max-width: 100%; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); }
.checks-summary { border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; margin: 8px 0; }
.checks-summary ul { margin: 4px 0; padding-left: 18px; }
.checks-head { font-weight: 600; margin: 4px 0; }

.rec { margin: .5rem 0; padding: .5rem .75rem; border-left: 3px solid var(--border, #ccc); }
.rec audio { display: block; max-width: 100%; margin: .25rem 0; }
/* "Before you translate" (locked consent text): bold red uses --bad, which meets 4.5:1 on the surface in both themes */
.consent { border-width: 2px; }
.consent-point { border-top: 1px solid var(--border); padding: 8px 0 4px; }
.consent-point p { margin: 4px 0; }
.warn-red { color: var(--bad); font-weight: 700; }
.consent-check { align-items: flex-start; margin: 16px 0 12px; }
.consent-check input { margin-top: 2px; min-width: 22px; min-height: 22px; }
.keep-open { border-left: 3px solid var(--bad); padding: 4px 10px; margin: 8px 0; }

/* slide-by-slide progress (2026-10-26) */
.slide-count { margin: 6px 0 4px; font-weight: 600; }
.slides { list-style: none; margin: 6px 0; padding: 0; max-height: 22rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.slides li { display: flex; gap: 8px; align-items: baseline; padding: 4px 10px; border-bottom: 1px solid var(--border); }
.slides li:last-child { border-bottom: 0; }
.slides .sl-icon { width: 1.4em; flex: none; text-align: center; font-weight: 700; }
.slides li[data-state="done"] .sl-icon { color: #1a7f37; }
.slides li[data-state="issue"] .sl-icon { color: #9a6700; }
.slides li[data-state="failed"] .sl-icon { color: #cf222e; }
.slides li[data-state="waiting"] { color: var(--muted); }
.slides li[data-state="working"] { font-weight: 600; }
.slides .sl-issue { color: var(--muted); font-size: .9rem; }
.issues { margin: 6px 0; padding-left: 1.2rem; }
details.tech { margin-top: 8px; } details.tech summary { cursor: pointer; } details.tech p, details.tech ul { font-size: .9rem; color: var(--muted); }
.pp-done-head { margin: 4px 0; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .slides li[data-state="done"] .sl-icon { color: #4ac26b; }
  .slides li[data-state="issue"] .sl-icon { color: #d4a72c; }
  .slides li[data-state="failed"] .sl-icon { color: #ff7b72; }
}

/* inactivity warning (session.js, 2026-10-28) */
.idle-warning { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 10; }
.idle-warning[hidden] { display: none; }
.idle-box { background: var(--surface); color: var(--text); border: 2px solid var(--text); border-radius: 10px; padding: 18px 20px;
  max-width: 440px; width: 100%; }
.idle-box h2 { margin: 0 0 8px; }
/* Course Layout Automation page (web/layout/, 2026-10-28) */
.product-title { display: flex; align-items: center; gap: 8px; }
.product-icon { flex: none; }
.product-description { font-size: 1.05rem; margin: 0 0 12px; }
.result-head { font-weight: 700; font-size: 1.05rem; margin: 8px 0; }
