:root {
  /* CoastlineLMS – brand guide (Shoreline treatment) */
  --tide: #123A46; --horizon: #2E6E73; --coral: #E86A4E; --foam: #A9CFC5; --sand: #F2EBDD; --paper: #FCFAF5;
  --ink: #16211E; --muted: #55625E; --line: #E3DCCB; --line-soft: #EFE9DC; --panel: #F7F2E8;
  --bg: var(--paper); --card: #fff;
  --brand: var(--tide); --brand-ink: #fff; --ok: #2E7D5B; --warn: #A86A12; --bad: #B8412C;
  --radius: 10px; --nav-w: 232px; --top-h: 58px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: var(--font);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--horizon); }
h1, h2, h3, .display { font-family: var(--display); color: var(--tide); letter-spacing: -.01em; }
h1 { font-size: 1.7rem; font-weight: 700; margin: .2em 0 .6em; line-height: 1.15; }
h2 { font-size: 1.12rem; font-weight: 600; margin: 0 0 .7em; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.2em 0 .5em; }
code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: .88em; font-family: var(--mono); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: .82rem; }
.hint { display: block; color: var(--muted); font-size: .82rem; font-weight: 400; margin-top: 3px; }
.small-link { font-size: .85rem; color: var(--horizon); cursor: pointer; text-decoration: none; }
.small-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- wordmark */
.wordmark { display: inline-flex; align-items: center; gap: .42em; font-family: var(--display); font-weight: 700;
  letter-spacing: -.012em; line-height: 1; white-space: nowrap; }
.cl-mark { width: 1.45em; height: 1.45em; flex: none; border-radius: .29em; }
.wm-word { display: inline-flex; align-items: baseline; }
.wm-product { font-weight: 400; letter-spacing: .01em; margin-left: .06em; }
.wm-night .wm-word { color: var(--sand); } .wm-night .wm-product { color: var(--foam); }
.wm-shore .wm-word { color: var(--tide); } .wm-shore .wm-product { color: var(--horizon); }

/* ---------------------------------------------------------------- top bar + side menu */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; background: var(--tide);
  color: var(--sand); padding: 0 22px; padding-left: max(22px, env(safe-area-inset-left)); height: var(--top-h); }
.brand { display: flex; align-items: center; text-decoration: none; font-size: 1.3rem; }
.co-chip { font-family: var(--mono); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--foam);
  background: rgba(169,207,197,.14); border: 1px solid rgba(169,207,197,.38); padding: 4px 10px; border-radius: 20px;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-user { margin-left: auto; display: flex; gap: 4px; }
.top-user a { display: inline-flex; align-items: center; gap: 7px; color: #D8E4DF; text-decoration: none; padding: 7px 11px;
  border-radius: 7px; font-size: .9rem; }
.top-user a:hover, .top-user a.active { background: rgba(255,255,255,.1); color: #fff; }
.top-user .nav-ico { width: 18px; height: 18px; }
.nav-toggle { display: none; background: none; border: 0; color: var(--sand); padding: 6px; margin-left: -6px; cursor: pointer; border-radius: 7px; }
.nav-toggle:hover { background: rgba(255,255,255,.1); }

.shell { display: flex; min-height: calc(100vh - var(--top-h)); }
.sidenav { flex: none; width: var(--nav-w); background: var(--panel); border-right: 1px solid var(--line); padding: 14px 0;
  display: flex; flex-direction: column; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; }
.sidenav a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: var(--muted); text-decoration: none;
  font-size: .93rem; border-left: 3px solid transparent; }
.sidenav a:hover { color: var(--tide); background: rgba(18,58,70,.04); }
.sidenav a.active { color: var(--tide); font-weight: 600; border-left-color: var(--coral); background: rgba(232,106,78,.07); }
.nav-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-collapse { display: none; align-items: center; gap: 12px; width: 100%; padding: 8px 20px 10px; margin-bottom: 4px;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--muted); cursor: pointer;
  font: inherit; font-size: .82rem; }
.nav-collapse:hover { color: var(--tide); }
.nav-collapse svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.nav-foot { margin-top: auto; padding-top: 14px; }
.nav-ver { display: block; padding: 8px 20px 0; font-family: var(--mono); font-size: .68rem; color: #8E9792; letter-spacing: .05em; }
.nav-only-mobile { display: none !important; }
.nav-scrim { position: fixed; inset: 0; background: rgba(22,33,30,.4); z-index: 44; }
.shell > main { flex: 1; min-width: 0; }

.page { max-width: 1140px; margin: 0 auto; padding: 28px 28px 70px; }
.page.wide { max-width: 1440px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.narrow { max-width: 560px; margin: 20px auto; }
.empty { text-align: center; padding: 44px 24px; }
.empty p { color: var(--muted); max-width: 460px; margin: 0 auto 18px; }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 14px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 8px 10px; font: inherit; font-weight: 400;
  border: 1px solid #D8D0BD; border-radius: 7px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: var(--brand); }
input[type=file] { display: block; margin-top: 6px; font-size: .88rem; max-width: 100%; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: 3px; }
label.inline { display: inline-block; min-width: 200px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.row-end > a.muted:first-child { margin-right: auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 15px;
  border: 1px solid #D8D0BD; border-radius: 7px; background: #fff; color: var(--ink); font: inherit;
  font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--panel); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #0D2A33; }
.btn.danger { color: var(--bad); border-color: #e3b6b0; }
.btn.danger:hover { background: #fdecea; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid transparent; background: none;
  cursor: pointer; color: var(--muted); font-size: .95rem; }
.icon-btn:hover:not(:disabled) { background: var(--panel); color: var(--ink); }
.icon-btn.danger:hover { background: #fdecea; color: var(--bad); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* flash / toast */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: .92rem; }
.flash-ok { background: #e7f6ed; color: #14532d; }
.flash-error { background: #fdecea; color: #7f1d1d; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--tide); color: #fff; padding: 10px 18px; border-radius: 8px; transition: all .2s;
  pointer-events: none; z-index: 50; max-width: min(560px, 90vw); font-size: .92rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); }
.progress-note { background: #E6F0EE; color: var(--tide); border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; font-weight: 600; }

/* dashboard table */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; text-decoration: none; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.side { position: sticky; top: 16px; display: grid; gap: 14px; max-height: calc(100vh - 32px); overflow-y: auto; padding-bottom: 4px; }
.side form + form { margin-top: 8px; }
.side .card form .btn { width: 100%; }
.slide-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; scroll-margin-top: 20px; }
.slide-card.busy { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 40%, transparent); }
.slide-card:target { box-shadow: 0 0 0 3px #f5c451; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-tools { display: flex; gap: 2px; }
.pill { font-size: .78rem; font-weight: 700; background: #E6F0EE; color: var(--tide); padding: 3px 10px; border-radius: 20px; }
.pill.q { background: #f3e9fb; color: #5b2a86; }
.slide-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
.thumb { display: block; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #f0f2f5; }
.thumb img { display: block; width: 100%; height: auto; }
.replace-form { margin-top: 6px; }
.script-label { margin-bottom: 4px; }
.script-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); min-height: 1.2em; margin-bottom: 10px; }
.audio-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.audio-row audio { height: 34px; max-width: 100%; flex: 1 1 220px; }
.audio-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; }
.badge { font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.b-none { background: var(--line-soft); color: var(--muted); }
.b-ok { background: #e3f5ea; color: #17643a; }
.b-stale { background: #fff1d6; color: #7a4a00; }
.insert-bar { display: flex; justify-content: center; gap: 6px; margin: 4px 0; opacity: 0; transition: opacity .15s; }
.insert-bar:hover, .insert-bar:focus-within, .slides > .insert-bar:last-of-type, .side .insert-bar { opacity: 1; }
.insert-btn { background: #faf5fe; border: 1px dashed #cdb4e3; color: #5b2a86; font: inherit; font-size: .8rem;
  padding: 3px 14px; border-radius: 20px; cursor: pointer; }
.insert-btn.decl { background: #eef8f6; border-color: #a9d8cc; color: #1d6b58; }
.insert-btn:hover { filter: brightness(.97); }
.side .insert-bar { justify-content: stretch; margin: 0 0 8px; }
.side .insert-bar form { flex: 1; margin: 0 !important; }
.side .insert-bar .insert-btn { width: 100%; padding: 7px; font-size: .85rem; font-weight: 600; }
.tpl-slot { background: #fffbea; border: 1px dashed #e8d48a; border-radius: var(--radius); padding: 10px 14px; font-size: .88rem; margin: 6px 0; }
.script-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.script-label-text { font-weight: 600; font-size: .88rem; }
.thumb-video { width: 100%; border-radius: 6px; background: #000; display: block; }
.pill.d { background: #e3f4ef; color: #1d6b58; }
.pill.v { background: #fdeee0; color: #8a4512; }
.doc-line { font-size: .85rem; margin-top: 2px; }
.settings-form h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px;
  padding-top: 12px; border-top: 1px solid var(--line-soft); }
.rev-form .two-col { gap: 0 10px; }
.rev-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .83rem; }
.rev-table th { text-align: left; font-size: .72rem; text-transform: uppercase; color: var(--muted); padding: 4px; border-bottom: 1px solid var(--line); }
.rev-table td { padding: 5px 4px; border-bottom: 1px solid #f0f2f5; vertical-align: top; }
.nowrap { white-space: nowrap; }
.wide-btn { width: 100%; margin-bottom: 8px; }
.small { font-size: .84rem; }

.q-editor .options { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 14px; }
.q-editor legend { font-weight: 600; font-size: .88rem; padding: 0 4px; }
.q-editor legend .hint { display: inline; margin-left: 6px; }
.opt { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.opt input[type=radio] { width: 18px; height: 18px; flex: none; accent-color: var(--ok); }
.opt input[type=text] { margin-top: 0 !important; }
.q-editor .tf-only, .q-editor .hs-only, .q-editor .multi-hint { display: none; }
.q-editor[data-type=tf] .opt-only, .q-editor[data-type=hotspot] .opt-only { display: none; }
.q-editor[data-type=tf] .tf-only { display: flex; }
.q-editor[data-type=hotspot] .hs-only { display: block; }
/* The picture: optional on every type, required (and marked up) on hotspot. */
.q-pic { margin-bottom: 14px; }
.q-editor[data-type=hotspot] .pic-hint { display: none; }
.q-pic .hs-list, .q-pic .pic-alt { display: none; }
.q-editor[data-type=hotspot] .q-pic .hs-list { display: flex; }
.q-pic.has-pic .pic-alt { display: block; }
.q-pic:not(.has-pic) .hs-stage { min-height: 0; border-style: dashed; }
.q-pic:not(.has-pic) .hs-stage .hs-empty { position: static; padding: 14px; }
.q-editor:not([data-type=hotspot]) .q-pic:not(.has-pic) .hs-stage { display: none; }
.q-editor:not([data-type=hotspot]) .hs-stage { cursor: default; }
.q-editor:not([data-type=hotspot]) .hs-layer { display: none; }
.q-pic .hs-stage { max-width: 520px; }
/* These sit in a legend, where `.q-editor legend .hint` would otherwise win on specificity,
   showing both hints at once. */
.q-editor legend .multi-hint { display: none; }
.q-editor[data-type=multi] legend .multi-hint { display: inline; }
.q-editor[data-type=multi] legend .mc-hint { display: none; }
.opt input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--ok); }
.tf-label { font-weight: 600; font-size: .88rem; }
.tf-opts { align-items: center; margin-bottom: 14px; }
.hotspot { margin-bottom: 14px; }
.hs-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.hs-toolbar .hint { margin: 0; }
.hs-stage { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f0f2f5;
  cursor: crosshair; user-select: none; touch-action: none; }
.hs-stage.empty { min-height: 160px; cursor: default; }
.hs-img { display: block; width: 100%; height: auto; }
.hs-stage.empty .hs-img { display: none; }
.hs-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; padding: 20px; text-align: center; }
.hs-layer { position: absolute; inset: 0; pointer-events: none; }
.hs-region { position: absolute; border: 3px solid #e3a018; background: rgba(227,160,24,.18); border-radius: 4px; }
.hs-region.drawing { border-style: dashed; }
.hs-region span { position: absolute; top: -2px; left: -2px; background: #e3a018; color: #111; font-weight: 700; font-size: .75rem;
  padding: 1px 6px; border-radius: 3px 0 3px 0; }
.hs-list { margin: 8px 0 0; padding-left: 0; list-style: none; display: flex; gap: 6px; flex-wrap: wrap; }
.hs-list li { background: #fff6e0; border-radius: 16px; padding: 1px 2px 1px 10px; font-size: .82rem; display: flex; align-items: center; gap: 2px; }
.hs-list .icon-btn { width: 24px; height: 24px; font-size: .8rem; }
.tf-opts { gap: 22px; }
.tf-opts label { margin: 0; }
.q-status { font-size: .82rem; min-height: 1.2em; }
.q-status.warn { color: var(--warn); }
.q-narration { margin-top: 8px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.q-narration summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--muted); margin-bottom: 10px; }

/* templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tpl-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tpl-meta { display: flex; flex-direction: column; font-size: .88rem; }
.tpl-actions { display: flex; gap: 6px; margin-top: auto; }
.tpl-mini { --onp: #fff; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--b); color: var(--t); font-size: .72rem; }
.tpl-mini-bar { background: var(--p); color: var(--onp); display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-weight: 600; min-height: 30px; }
.tpl-mini-bar img { max-height: 20px; max-width: 70px; object-fit: contain; }
.tpl-mini-body { display: flex; gap: 8px; padding: 8px; height: 90px; }
.tpl-mini-menu { width: 26%; display: flex; flex-direction: column; gap: 5px; }
.tpl-mini-menu i { display: block; height: 9px; border-radius: 5px; background: color-mix(in srgb, var(--t) 15%, transparent); }
.tpl-mini-menu i.done, .tpl-card .tpl-mini-menu i:first-child { background: var(--a); }
.tpl-mini-slide { flex: 1; background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.tpl-mini.big { font-size: .9rem; }
.tpl-mini.big .tpl-mini-bar { min-height: 42px; padding: 8px 14px; }
.tpl-mini.big .tpl-mini-bar img { max-height: 30px; max-width: 120px; }
.tpl-mini.big .tpl-mini-body { height: 200px; padding: 12px; gap: 12px; }
.tpl-mini.big .tpl-mini-menu i { height: 14px; }
.tpl-mini-foot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid color-mix(in srgb, var(--t) 12%, transparent); }
.tpl-mini-btn { border: 1px solid color-mix(in srgb, var(--t) 25%, transparent); background: #fff; color: #222; border-radius: 6px; padding: 4px 12px; font-weight: 600; font-size: .8rem; }
.tpl-mini-btn.primary { background: var(--p); color: var(--onp); border-color: var(--p); }
.tpl-mini-prog { flex: 1; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--t) 14%, transparent); }
.tpl-mini-prog b { display: block; width: 40%; height: 100%; background: var(--p); border-radius: 3px; }
.tpl-mini-footer { text-align: center; font-size: .72rem; opacity: .65; padding: 0 8px 6px; min-height: 1em; }
.tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.colors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.colors input[type=color] { display: block; width: 100%; height: 40px; border: 1px solid #D8D0BD; border-radius: 7px; padding: 2px; margin-top: 5px; background: #fff; cursor: pointer; }
.logo-current { display: flex; align-items: center; gap: 14px; margin: -6px 0 14px; padding: 10px; background: var(--panel); border-radius: 8px; }
.logo-current img { max-height: 40px; max-width: 140px; }
.logo-current label { margin: 0; }

/* settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.settings-grid .full { grid-column: 1 / -1; }
.test-row { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.test-row input { margin-top: 0 !important; }
#test-audio { width: 100%; margin-top: 10px; }

/* preview */
.preview-body { background: #2a3440; }
.preview-shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100vh; }
.preview-frame { display: flex; flex-direction: column; min-width: 0; }
.preview-frame iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.preview-warn { margin: 0; border-radius: 0; }
.lms-panel { background: #fff; padding: 18px; overflow-y: auto; border-left: 1px solid var(--line); }
.lms-panel p { font-size: .85rem; }
.lms-vals { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: .9rem; margin: 14px 0; }
.lms-vals dt { color: var(--muted); }
.lms-vals dd { margin: 0; font-weight: 700; }
.st-passed, .st-completed { color: var(--ok); }
.st-failed { color: var(--bad); }
.st-incomplete { color: var(--warn); }
.lms-buttons { display: flex; gap: 6px; margin-bottom: 12px; }
.lms-log { list-style: none; padding: 0; margin: 0; font-size: .75rem; }
.lms-log li { padding: 3px 0; border-bottom: 1px solid #f0f2f5; word-break: break-all; }
.lms-log li.warn { color: var(--bad); }
pre { white-space: pre-wrap; word-break: break-all; background: var(--panel); padding: 8px; border-radius: 6px; }

@media (max-width: 1000px) {
  .editor { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; order: -1; }
  .slide-body { grid-template-columns: 1fr; }
  .tpl-edit, .settings-grid { grid-template-columns: 1fr; }
  .preview-shell { grid-template-columns: 1fr; grid-template-rows: 70vh auto; height: auto; }
}
@media (max-width: 600px) {
  .two-col, .colors { grid-template-columns: 1fr 1fr; }
}

/* v1.1 additions */
.ai-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.overdue { color: var(--bad); font-weight: 600; }
.import-form { display: inline; margin: 0; }
.tpl-slide { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 4px; margin: 0 0 14px; }
.tpl-slide legend { font-weight: 700; font-size: .9rem; padding: 0 4px; }
.tpl-slide legend .hint { display: inline; margin-left: 6px; }
.tpl-slide-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.tpl-slide-img { width: 180px; border-radius: 4px; border: 1px solid var(--line); }
.tpl-slide-row label { margin: 0; }
.tpl-audio { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tpl-audio audio { height: 34px; flex: 1 1 200px; }
.tpl-audio label { margin: 0; }
@media (max-width: 600px) { .ai-grid { grid-template-columns: 1fr; } }

/* YouTube */
.yt-thumb { position: relative; display: block; border-radius: 6px; overflow: hidden; background: #000; }
.yt-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.yt-play { position: absolute; left: 50%; top: 50%; width: 64px; height: 44px; margin: -22px 0 0 -32px; border-radius: 12px;
  background: #e62117; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.yt-play::after { content: ""; position: absolute; left: 26px; top: 13px; border-left: 16px solid #fff;
  border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.yt-meta { margin-top: 4px; }
.video-swap { margin-top: 6px; }
.video-swap summary { list-style: none; }
.video-swap summary::-webkit-details-marker { display: none; }
.yt-form { display: flex; gap: 6px; margin: 8px 0 6px; }
.yt-form input { margin-top: 0 !important; }
.yt-add { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* Upload progress */
.up-overlay { position: fixed; inset: 0; background: rgba(18, 32, 47, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.up-card { background: #fff; border-radius: 12px; padding: 22px 24px; width: min(440px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.up-title { font-weight: 700; font-size: 1.05rem; }
.up-files { margin: 2px 0 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 10px; border-radius: 5px; background: #e4e9ef; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: var(--brand); border-radius: 5px; transition: width .2s; }
.up-bar.busy .up-fill { background: repeating-linear-gradient(45deg, var(--brand) 0 12px, #3b7cb8 12px 24px);
  background-size: 34px 34px; animation: up-stripes 1s linear infinite; }
@keyframes up-stripes { to { background-position: 34px 0; } }
.up-row { display: flex; justify-content: space-between; margin-top: 8px; font-variant-numeric: tabular-nums; }
.up-pct { font-weight: 700; }
.up-phase { margin-top: 10px; min-height: 1.2em; }
.up-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* v1.3: slide titles */
.card-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.card-title .pill { flex: none; }
.slide-title { flex: 1; min-width: 0; margin: 0 !important; border-color: transparent !important; background: transparent !important;
  font-weight: 600; padding: 5px 8px !important; border-radius: 6px; }
.slide-title:hover { border-color: #d5dce4 !important; background: #fff !important; }
.slide-title:focus { border-color: var(--brand) !important; background: #fff !important; }
.slide-title.saved { box-shadow: 0 0 0 2px #bfe6cd; }
.card-head { gap: 10px; }

/* per-slide minimum time */
.hold-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 10px;
  border-top: 1px dashed #e3e8ee; font-size: .86rem; }
.hold-label { font-weight: 600; color: var(--muted); }
.hold-row select { width: auto !important; margin: 0 !important; padding: 5px 8px !important; font-size: .86rem; }
.hold-secs { display: inline-flex; align-items: center; gap: 6px; }
.hold-secs input { width: 80px !important; margin: 0 !important; padding: 5px 8px !important; }
.hold-row[data-mode=""] .hold-secs, .hold-row[data-mode="none"] .hold-secs { display: none; }

/* insert button */
.insert-bar { opacity: .55; }
.insert-bar:hover, .insert-bar:focus-within { opacity: 1; }
.insert-btn { background: #F3F8F7; border: 1px dashed #A9CFC5; color: var(--horizon); font-weight: 600; }

/* matching + gaps editors */
.q-editor .match-only, .q-editor .blanks-only, .q-editor .written-only { display: none; margin-bottom: 14px; }
.q-editor[data-type=match] .match-only, .q-editor[data-type=blanks] .blanks-only,
.q-editor[data-type=written] .written-only { display: block; }
.q-editor[data-type=match] .opt-only, .q-editor[data-type=blanks] .opt-only,
.q-editor[data-type=written] .opt-only { display: none; }
/* A written answer has no right or wrong, so the feedback boxes don't apply. */
.q-editor[data-type=written] .fb-only { display: none; }
.written .field-label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 6px; }
.written .check { margin-bottom: 4px; }
.match-head, .pair { display: grid; grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.match-head { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.pair { margin-bottom: 6px; }
.pair input { margin: 0 !important; }
.pair-arrow { text-align: center; color: var(--muted); font-weight: 700; }
.bl-preview { background: #f7f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.blp-head { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.blp-line { line-height: 2.1; }
.blp-gap { display: inline-block; border: 2px dashed #8fb3d6; border-radius: 6px; padding: 0 8px; margin: 0 2px; line-height: 1.6;
  color: var(--horizon); font-weight: 600; background: #fff; }
.blp-bank { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.blp-chip { border: 1px solid #c5d3e1; background: #fff; border-radius: 14px; padding: 1px 10px; font-size: .82rem; font-weight: 600; }
.blp-chip.extra { border-style: dashed; color: var(--muted); }

/* modals */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(18, 32, 47, .45); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none !important; }
.modal-card { background: #fff; border-radius: 14px; box-shadow: 0 16px 50px rgba(0,0,0,.28); width: min(620px, 100%);
  max-height: calc(100vh - 32px); overflow: auto; padding: 20px 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h2 { margin: 0 0 4px; font-size: 1.2rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.add-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 4px; }
.add-choice { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left;
  border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; cursor: pointer; font: inherit; color: var(--ink); }
.add-choice:hover { border-color: #9fbbd6; }
.add-choice.active { border-color: var(--brand); background: #f1f6fb; }
.add-ico { grid-row: span 2; font-size: 1.5rem; line-height: 1.2; }
.add-choice span:last-child { font-size: .82rem; color: var(--muted); }
.add-pane { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.qtype-pick { border: 0; padding: 0; margin: 0 0 6px; }
.qtype-pick legend { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.qtype-pick label { margin-bottom: 8px; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 6px 0 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* confirm */
.cf-card { width: min(460px, 100%); text-align: center; padding-top: 24px; }
.cf-card h2 { margin: 10px 0 6px; font-size: 1.2rem; }
.cf-card p { color: #3b4652; margin: 0 0 6px; }
.cf-icon { width: 48px; height: 48px; margin: 0 auto; border-radius: 50%; background: #fdecea; color: var(--bad);
  display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; }
.cf-type { text-align: left; margin: 14px 0 0; font-weight: 400; font-size: .88rem; }
.cf-type input { font-weight: 600; }
.cf-card .modal-foot { justify-content: center; }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-solid:hover { background: #a93226; }
.btn.danger-solid:disabled { opacity: .45; cursor: not-allowed; }

/* reorder */
.reorder-card { width: min(1000px, 100%); display: flex; flex-direction: column; }
.ro-grid { list-style: none; margin: 14px 0 0; padding: 4px; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); overflow-y: auto; max-height: calc(100vh - 230px);
  touch-action: none; user-select: none; }
.ro-tile { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 6px; cursor: grab;
  display: flex; flex-direction: column; gap: 4px; }
.ro-tile:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,95,153,.25); }
.ro-thumb { aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--line-soft); display: grid; place-items: center;
  font-size: 1.6rem; font-weight: 800; color: #fff; }
.ro-thumb img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ro-thumb.ro-q { background: #7b4fa6; } .ro-thumb.ro-d { background: #1d6b58; } .ro-thumb.ro-v { background: #8a4512; }
.ro-num { position: absolute; top: 10px; left: 10px; background: rgba(18,32,47,.85); color: #fff; font-weight: 700;
  font-size: .78rem; border-radius: 12px; padding: 1px 8px; }
.ro-name { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ro-kind { font-size: .72rem; color: var(--muted); }
.ro-placeholder { opacity: .3; border-style: dashed; }
.ro-ghost { position: fixed; z-index: 120; pointer-events: none; box-shadow: 0 12px 30px rgba(0,0,0,.3); transform: rotate(2deg); cursor: grabbing; }
@media (max-width: 600px) {
  .add-choices { grid-template-columns: 1fr; }
  .ro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .match-head, .pair { grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 28px; }
}

/* v1.4: run time + aligned audio buttons */
.runtime { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; padding: 4px 12px;
  background: #eef4fa; border: 1px solid #d6e3f0; border-radius: 20px; font-size: .88rem; }
.runtime strong { font-size: .95rem; font-variant-numeric: tabular-nums; }
.rt-icon { font-size: .95rem; }
.audio-actions { align-items: center; }
.audio-actions .btn, .audio-actions label.btn { margin: 0; min-height: 38px; min-width: 128px; padding: 0 14px; font-size: .86rem;
  box-sizing: border-box; }
.btn.outline-danger { background: #fff; border: 1.5px solid var(--bad); color: var(--bad); }
.btn.outline-danger:hover { background: #fdecea; }

/* v1.4.1: course editor as two independently scrolling panes (wide screens).
   The window itself doesn't scroll; the slide list and the settings column each scroll on their own,
   and both fit exactly inside the window. */
@media (min-width: 1001px) {
  html:has(body.editor-page), body.editor-page { height: 100%; overflow: hidden; }
  body.editor-page { display: flex; flex-direction: column; }
  body.editor-page .topbar, body.editor-page .acting-bar { flex: none; }
  body.editor-page .shell { flex: 1; min-height: 0; }
  body.editor-page .sidenav { position: static; height: auto; }
  /* The editor starts as a narrow strip of icons, to leave room for the slides.
     The ⟩ button at the top opens the full menu; the choice is remembered. */
  body.editor-page:not(.nav-wide) .sidenav { width: 64px; }
  body.editor-page:not(.nav-wide) .sidenav a { justify-content: center; padding: 12px 0; }
  body.editor-page:not(.nav-wide) .sidenav a span, body.editor-page:not(.nav-wide) .nav-ver { display: none; }
  body.editor-page:not(.nav-wide) .nav-collapse { justify-content: center; }
  body.editor-page:not(.nav-wide) .nav-collapse span { display: none; }
  body.editor-page .nav-collapse { display: flex; }
  body.editor-page.nav-wide .nav-collapse svg { transform: rotate(180deg); }
  body.editor-page main.page { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column;
    padding-bottom: 0; overflow: hidden; }
  body.editor-page main.page > .flash, body.editor-page .page-head, body.editor-page .progress-note { flex: none; }
  body.editor-page .editor { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  body.editor-page .slides { overflow-y: auto; min-height: 0; padding: 4px 8px 40px 4px; margin: -4px -8px 0 -4px;
    overscroll-behavior: contain; }
  body.editor-page .side { position: static; top: auto; max-height: none; height: 100%; align-content: start;
    overflow-y: auto; padding: 0 6px 24px 0; overscroll-behavior: contain; }
}
.flash.fading { opacity: 0; transition: opacity .4s; }
.import-list { margin: 0 0 14px; padding-left: 20px; font-size: .9rem; }
.import-list li { margin-bottom: 6px; }

/* ---------------------------------------------------------------- hosted: shared bits */
.acting-bar { background: #fff4d6; color: #5c4400; padding: 8px 22px; font-size: .9rem; text-align: center; }
.acting-bar a { margin-left: 10px; font-weight: 700; color: #5c4400; }
.acting-bar.inactive { background: #fdecea; color: #7f1d1d; }
.flash-info { background: #E6F0EE; color: var(--tide); }
.section-title { margin-top: 34px; font-size: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.card + .card, .grid-2 + .card, .card + .grid-2 { margin-top: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 150px; margin: 0; }
.filters input[name="q"], .filters input[type="search"] { min-width: 240px; }
.filters.tight { margin-bottom: 10px; }
.inline-label { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); margin: 0; }
.inline-label input { min-width: 0 !important; }
.view-switch { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-switch a { padding: 7px 14px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.view-switch a.on { background: var(--brand); color: #fff; }
form.inline { display: inline; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.stack-form { margin: 14px 0; }
.top-gap { margin-top: 18px; }
.nowrap { white-space: nowrap; }
.overdue { color: var(--bad); }
.row-inactive td, .row-inactive { opacity: .6; }
.row-error td { background: #fff6f5; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 4px 0; }
table.list.compact td { padding: 7px 10px; }
.badge.ok { background: #e7f6ed; color: #14532d; }
.badge.off { background: #fdecea; color: #7f1d1d; }
.badge:not(.ok):not(.off) { background: var(--panel); color: var(--muted); }
.danger-zone { border-color: #f0c9c4; }
.auth-card { margin-top: 60px; }
.code-input { font-size: 1.4rem; letter-spacing: .3em; font-family: ui-monospace, monospace; max-width: 220px; }
.qr-box { background: #fff; display: inline-block; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }

/* status colours */
.pill { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: .78rem; font-weight: 700; white-space: nowrap; text-decoration: none; background: var(--panel); color: var(--muted); }
.st-passed, .st-completed { background: #e7f6ed; color: #14532d; }
.st-overdue, .st-expired { background: #fdecea; color: #7f1d1d; }
.st-failed, .st-lapsed { background: #fff4d6; color: #6b4a00; }
.st-in_progress { background: #E6F0EE; color: var(--tide); }
.st-not_started, .st-cancelled { background: var(--panel); color: var(--muted); }
.st-review, .st-due { background: #FDECE6; color: #8a3a22; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat-tile { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 9px; text-decoration: none; border: 2px solid transparent; }
.stat-tile strong { font-size: 1.4rem; line-height: 1.1; }
.stat-tile span { font-size: .78rem; }
.stat-tile.on { border-color: currentColor; }
table.matrix th.matrix-head { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.matrix td.cell { text-align: center; }

/* send page */
.radio-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; cursor: pointer; margin: 0; font-weight: 400; }
.radio-row:hover { background: var(--panel); }
.radio-row input { width: auto; margin-top: 4px; }
.radio-row.disabled { cursor: default; opacity: .8; }
.radio-row .problem { display: block; color: var(--bad); font-size: .85rem; margin-top: 3px; }
.worker-picks { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.worker-picks label.check { margin: 0; padding: 5px 0; }
.link-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.link-row:last-child { border-bottom: 0; }

/* learner pages */
.learn-body { background: var(--bg); }
.learn-bar { display: flex; align-items: center; gap: 14px; background: var(--tide); color: #fff; padding: 0 18px; height: 50px; }
.learn-bar.slim { height: 42px; font-size: .92rem; }
.learn-bar .brand { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learn-out { margin-left: auto; color: #cfe0f0; text-decoration: none; font-size: .9rem; white-space: nowrap; }
.learn-out + .learn-out { margin-left: 14px; }
.learn-status { margin-left: auto; font-size: .82rem; color: #a9c3dc; }
.learn-status.bad { color: #ffd2cc; font-weight: 700; }
.learn-status + .learn-out { margin-left: 14px; }
.learn-page { max-width: 640px; margin: 0 auto; padding: 16px; }
.course-body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.course-frame-wrap { flex: 1; display: flex; padding: 0; max-width: none; }
.course-frame { flex: 1; border: 0; width: 100%; height: 100%; background: #fff; }
.btn.big { padding: 12px 26px; font-size: 1.05rem; }
.done-card { text-align: center; }
.done-card dl.facts { text-align: left; max-width: 340px; margin: 16px auto; }
.done-tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 2rem; line-height: 64px; margin: 6px auto 8px; }
.lead { font-size: 1.1rem; }
.row-center { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }



/* ---------------------------------------------------------------- all screen sizes */
@media (max-width: 1000px) {
  .nav-toggle { display: inline-flex; }
  .sidenav { position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(300px, 86vw); z-index: 45;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(18,58,70,.25);
    padding-top: max(18px, env(safe-area-inset-top)); }
  body.nav-open .sidenav { transform: none; }
  body.nav-open { overflow: hidden; }
  .sidenav a { padding: 13px 22px; font-size: 1rem; }
  .page { padding: 22px 18px 60px; }
  .grid-2, .form-row { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  :root { --top-h: 54px; }
  .topbar { padding: 0 12px; gap: 10px; padding-left: max(12px, env(safe-area-inset-left)); }
  .brand { font-size: 1.12rem; }
  .top-user { display: none; }
  .co-chip { margin-left: auto; max-width: 42vw; font-size: .66rem; }
  .nav-only-mobile { display: flex !important; }
  .page { padding: 16px 12px 56px; }
  h1 { font-size: 1.4rem; }
  .page-head { align-items: flex-start; }
  .head-actions { width: 100%; }
  .head-actions > .btn, .head-actions > form { flex: 1 1 auto; }
  .head-actions > form .btn { width: 100%; }
  .card { padding: 16px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .filters input, .filters select, .filters .btn { flex: 1 1 140px; min-width: 0 !important; }
  .filters input[name="q"], .filters input[type="search"] { flex-basis: 100%; }
  .view-switch { margin-left: 0; }
  dl.facts { grid-template-columns: 1fr; gap: 0; }
  dl.facts dt { margin-top: 8px; font-size: .8rem; }
  .row-end { flex-wrap: wrap; gap: 8px; }
  .row-end .btn { flex: 1 1 auto; }
  .inline-form > * { flex: 1 1 100%; }
  .link-row { flex-direction: column; align-items: flex-start; }
  input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea { font-size: 16px; } /* no zoom on iPhone */

  /* list tables become stacked cards; each cell shows its column name */
  .table-wrap:has(table.stack) { background: none; border: 0; overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
  table.stack td { border: 0 !important; padding: 3px 0 !important; text-align: left !important; display: flex; gap: 10px; }
  table.stack td[data-label]::before { content: attr(data-label); flex: 0 0 38%; color: var(--muted); font-size: .8rem; padding-top: 2px; }
  table.stack td.stack-title { font-size: 1.02rem; padding-bottom: 6px !important; }
  table.stack td.stack-title::before { display: none; }
  table.stack td.actions { padding-top: 8px !important; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
  table.stack td.actions::before { display: none; }
  table.stack td.actions .btn + .btn { margin-left: 0; }
}
@media (max-width: 380px) {
  .co-chip { display: none; }
}
/* the course player page and other learner pages */
.learn-bar { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
@media (max-width: 700px) {
  .learn-bar { padding-left: 12px; padding-right: 12px; gap: 10px; }
  .learn-bar.slim .brand { font-size: .88rem; }
  .learn-status { display: none; }
  .learn-page { padding: 12px; }
  .auth-card { margin-top: 18px; }
}

/* ---------------------------------------------------------------- voice picker */
.voice-picker { margin: 6px 0 4px; }
.vp-status { font-size: .88rem; color: var(--muted); padding: 10px 0; }
.vp-status.vp-error { color: var(--bad); }
.vp-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.vp-chip { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 20px; padding: 5px 13px;
  font: inherit; font-size: .84rem; cursor: pointer; }
.vp-chip.on { background: var(--tide); border-color: var(--tide); color: var(--sand); }
.vp-row { display: flex; align-items: stretch; gap: 8px; }
.vp-select { flex: 1; min-width: 0; height: 42px; }
.vp-caption { font-size: .8rem; color: var(--muted); margin: 6px 0 0; min-height: 1.1em; }
.vp-play { flex: none; width: 46px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  cursor: pointer; position: relative; color: var(--tide); }
.vp-play::before { content: ""; position: absolute; left: 50%; top: 50%; margin: -7px 0 0 -4px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent currentColor; }
.vp-play:hover { background: #EFE7D6; }
.vp-play:disabled { opacity: .45; cursor: default; }
.vp-play.playing::before { width: 10px; height: 12px; margin: -6px 0 0 -5px; border: 0; border-left: 3.5px solid currentColor; border-right: 3.5px solid currentColor; }
.vp-play.loading::before { width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: vp-spin .8s linear infinite; }
@keyframes vp-spin { to { transform: rotate(360deg); } }
.vp-more { display: inline-block; margin-top: 10px; background: none; border: 0; padding: 0; font: inherit; font-size: .84rem; }
.try-box { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
.try-box input { margin: 0 !important; }
.speed-row { display: flex; align-items: center; gap: 12px; }
.speed-row input[type=range] { flex: 1; accent-color: var(--coral); }
.speed-row output { font-family: var(--mono); min-width: 3.5em; text-align: right; }
@media (max-width: 700px) {
  .vp-play { width: 44px; }
  .try-box { flex-direction: column; }
}
.field { margin-bottom: 14px; }
.field-label { display: block; font-weight: 600; font-size: .88rem; }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.server-status { font-family: var(--mono); font-size: .76rem; letter-spacing: .04em; padding: 4px 10px; border-radius: 20px; background: var(--panel); color: var(--muted); }
.server-status.ok { background: #E3F1EC; color: #1F5E48; }
.server-status.ok::before { content: "● "; color: #2E7D5B; }
.server-status.bad { background: #FBE7E2; color: #8A2E1C; }
details.advanced { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
details.advanced summary { cursor: pointer; color: var(--horizon); font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.settings-grid .card.full { grid-column: 1 / -1; }
.grid-2.tight { margin-bottom: 6px; }
pre.pron-system { margin: 5px 0 0; min-height: 100px; max-height: 214px; overflow: auto; font-family: var(--mono); font-size: .84rem; color: var(--muted); border: 1px dashed var(--line); background: var(--panel); }
/* Phones: the course player has its own header, so the page's own bar goes (progress saves automatically) */
@media (max-width: 700px), (max-height: 520px) and (orientation: landscape) {
  .course-body .learn-bar.slim { display: none; }
}
.nav-brand { display: none; padding: 4px 22px 18px; font-size: 1.15rem; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.filter-details > summary { display: none; }
.filter-details > summary::-webkit-details-marker { display: none; }
@media (max-width: 1000px) { .nav-brand { display: block; } }
@media (max-width: 700px) {
  .filter-details { margin-bottom: 12px; }
  .filter-details > summary { display: inline-flex; list-style: none; margin-bottom: 10px; }
  .filter-details[open] > summary { background: var(--panel); }
  .stat-row { display: flex; overflow-x: auto; gap: 8px; margin: 0 -12px 14px; padding: 0 12px 4px; scroll-snap-type: x proximity;
    scrollbar-width: none; }
  .stat-row::-webkit-scrollbar { display: none; }
  .stat-tile { flex: 0 0 auto; min-width: 104px; scroll-snap-align: start; padding: 8px 12px; }
  .stat-tile strong { font-size: 1.2rem; }
}
/* let grid columns shrink on small screens instead of pushing the page wider */
.grid-2 > *, .form-row > *, .tpl-edit > *, .settings-grid > *, .two-col > *, .editor > * { min-width: 0; }
@media (max-width: 700px) {
  .tabs { overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; padding: 9px 12px; }
  .card table.list:not(.stack) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card table.list.stack tr { box-shadow: none; }
  .card .table-wrap:has(table.stack) { margin: 0; }
}
fieldset { min-width: 0; min-inline-size: 0; }
@media (max-width: 700px) { .tpl-slide-row { flex-wrap: wrap; } .tpl-slide-img { width: 100%; max-width: 260px; } }
@media (max-width: 700px) { .w-row > .muted { display: block; font-size: .82rem; } .worker-picks label.check { flex-wrap: wrap; } }

/* ---------------------------------------------------------------- public front page */
body.front { background: var(--paper); }
.front .eyebrow { display: block; font-family: var(--mono); font-size: .72rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--horizon); margin-bottom: 14px; }
.fr-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px;
  background: var(--tide); color: var(--sand); padding: 12px clamp(16px, 5vw, 56px); }
.fr-brand { font-size: 1.22rem; text-decoration: none; }
.fr-nav { display: flex; gap: 22px; margin-left: 14px; }
.fr-nav a { color: #CFE0DA; text-decoration: none; font-size: .94rem; }
.fr-nav a:hover { color: #fff; }
.fr-signin { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.fr-btn { display: inline-flex; align-items: center; justify-content: center; background: var(--coral); color: #fff;
  border-radius: 8px; padding: 9px 18px; font-weight: 600; text-decoration: none; border: 1.5px solid var(--coral); }
.fr-btn:hover { background: #d85c40; border-color: #d85c40; }
.fr-ghost { display: inline-flex; align-items: center; justify-content: center; color: var(--sand);
  text-decoration: none; padding: 9px 4px; font-size: .94rem; border-bottom: 1px solid transparent; }
.fr-ghost:hover { border-bottom-color: var(--foam); }
.fr-btn.big, .fr-ghost.big { padding: 13px 26px; font-size: 1.02rem; border-radius: 9px; }
.fr-ghost.big { border: 1.5px solid rgba(169,207,197,.5); }

.fr-hero { background: var(--tide); color: var(--sand); padding: clamp(40px, 7vw, 86px) clamp(16px, 5vw, 56px) 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center;
  position: relative; overflow: hidden; }
.fr-hero::after { content: ""; position: absolute; left: -2%; right: -2%; bottom: -46px; height: 90px;
  border-radius: 50% 50% 0 0; background: #0D2A33; }
.fr-hero-text { padding-bottom: clamp(40px, 7vw, 86px); }
.fr-hero h1 { font-family: var(--display); font-size: clamp(30px, 4.3vw, 50px); font-weight: 700; line-height: 1.06;
  letter-spacing: -.02em; margin: 0 0 18px; color: var(--sand); }
.fr-hero p { max-width: 46ch; color: #D3E0DB; font-size: 1.04rem; margin: 0 0 26px; }
.fr-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.fr-hero-art { position: relative; z-index: 2; padding-bottom: clamp(30px, 5vw, 60px);
  display: flex; align-items: flex-end; gap: 16px; }

/* the little illustration: an admin list and a phone */
.mock { background: var(--paper); border-radius: 12px; overflow: hidden; box-shadow: 0 22px 50px rgba(0,0,0,.3);
  color: var(--ink); flex: 1 1 auto; min-width: 0; }
.mock-bar { background: var(--panel); border-bottom: 1px solid var(--line); padding: 9px 14px; display: flex;
  align-items: center; gap: 6px; }
.mock-dot { width: 9px; height: 9px; border-radius: 50%; background: #D6CDB8; }
.mock-title { font-family: var(--display); font-weight: 600; font-size: .86rem; color: var(--tide); margin-left: 10px; }
.mock-body { padding: 14px; }
.mock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.mock-stats div { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.mock-stats b { display: block; font-family: var(--display); font-size: 1.22rem; color: var(--tide); }
.mock-stats span { font-size: .68rem; color: var(--muted); }
.mock-row { display: flex; align-items: center; gap: 9px; font-size: .82rem; padding: 8px 2px;
  border-bottom: 1px solid var(--line-soft); }
.mock-row em { margin-left: auto; font-family: var(--mono); font-style: normal; font-size: .72rem; color: var(--muted); }
.pip { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pip.ok { background: var(--foam); } .pip.due { background: var(--coral); }
.phone { flex: none; width: 172px; background: #0A2027; border-radius: 22px;
  padding: 9px; box-shadow: 0 18px 40px rgba(0,0,0,.42); }
.phone-screen { background: var(--paper); border-radius: 15px; padding: 13px 11px; color: var(--ink); }
.ph-q { font-family: var(--display); font-weight: 600; font-size: .78rem; color: var(--tide); margin-bottom: 9px; }
.ph-a { border: 1.5px solid var(--line); border-radius: 7px; padding: 7px 9px; font-size: .7rem; margin-bottom: 6px; background: #fff; }
.ph-a.on { border-color: var(--coral); background: #FFF3EF; }
.ph-next { background: var(--tide); color: var(--sand); text-align: center; border-radius: 7px; padding: 7px;
  font-size: .72rem; font-weight: 600; }

.fr-sec { padding: clamp(44px, 6vw, 78px) clamp(16px, 5vw, 56px); max-width: 1180px; margin: 0 auto; }
.fr-sec h2 { font-family: var(--display); font-size: clamp(22px, 2.6vw, 31px); color: var(--tide); margin: 0 0 26px; letter-spacing: -.015em; }
.fr-alt { background: var(--panel); max-width: none; }
.fr-alt > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.fr-steps { counter-reset: s; list-style: none; margin: 0; padding: 0; display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.fr-steps li { counter-increment: s; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 24px; position: relative; font-size: .95rem; color: var(--muted); }
.fr-steps li::before { content: counter(s); display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; background: var(--tide); color: var(--sand);
  font-family: var(--display); font-weight: 700; margin-bottom: 12px; }
.fr-steps b { display: block; font-family: var(--display); font-size: 1.02rem; color: var(--tide); margin-bottom: 5px; }
.fr-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.fr-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.fr-card h3 { font-family: var(--display); font-size: 1.02rem; color: var(--tide); margin: 0 0 7px; }
.fr-card h3::before { content: ""; display: block; width: 26px; height: 3px; border-radius: 2px;
  background: var(--coral); margin-bottom: 11px; }
.fr-card p { margin: 0; font-size: .92rem; color: var(--muted); }
.fr-talk { background: var(--tide); color: var(--sand); text-align: center; padding: clamp(44px, 6vw, 76px) 22px; }
.fr-talk h2 { font-family: var(--display); font-size: clamp(22px, 2.6vw, 31px); margin: 0 0 12px; color: var(--sand); }
.fr-hero .eyebrow, .fr-talk .eyebrow { color: var(--foam); }
.fr-talk p { max-width: 50ch; margin: 0 auto 24px; color: #D3E0DB; }
.fr-foot { background: #0A2027; color: #7FA39C; padding: 30px clamp(16px, 5vw, 56px); display: flex;
  align-items: center; gap: 22px; flex-wrap: wrap; font-size: .9rem; }
.fr-foot .wordmark { font-size: 1.05rem; }
.fr-foot-links { display: flex; gap: 20px; }
.fr-foot-links a { color: #A9CFC5; text-decoration: none; }
.fr-foot-links a:hover { text-decoration: underline; }
.fr-fine { width: 100%; margin: 0; font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; }

@media (max-width: 900px) {
  .fr-hero { grid-template-columns: 1fr; padding-bottom: 0; }
  .fr-hero-text { padding-bottom: 10px; }
  .fr-hero-art { padding-bottom: 40px; }
  .mock { max-width: 100%; }
  .fr-hero-art { flex-direction: column; align-items: stretch; gap: 0; }
  .phone { align-self: flex-end; margin: -28px 6px 0 0; }
  .fr-nav { display: none; }
}
@media (max-width: 460px) { .fr-top .wm-word { display: none; } }
@media (max-width: 560px) {
  .fr-top { gap: 10px; padding: 10px 14px; }
  .fr-brand { font-size: 1.02rem; }
  .fr-signin { gap: 10px; }
  .fr-ghost { font-size: .86rem; padding: 9px 0; }
  .fr-btn { padding: 9px 14px; }
  .fr-cta .fr-btn, .fr-cta .fr-ghost { flex: 1 1 100%; min-width: 0; }
  .fr-btn.big, .fr-ghost.big { padding: 13px 14px; }
  .fr-ghost.big { display: inline-flex; }
}

/* Written answers waiting to be read on the assignment page */
.answer { border: 1px solid var(--line); border-left: 3px solid var(--horizon); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px; }
.answer.waiting { border-left-color: var(--coral); background: #FFF9F7; }
.answer h3 { font-family: var(--display); font-size: 1rem; color: var(--tide); margin: 0 0 4px; }
.answer-meta { margin: 0 0 10px; }
.answer-text { margin: 0 0 14px; padding: 12px 14px; background: var(--panel); border-radius: 8px;
  white-space: pre-wrap; font-size: .95rem; line-height: 1.55; }
.answer-form textarea { width: 100%; }
.answer-form .row-end { margin-top: 10px; }
.answer-verdict { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Licences and tickets */
.st-pending { background: #FDECE6; color: #8a3a22; }
.st-expired { background: #FBE9E7; color: #8E2F20; }
.st-expiring { background: #FDF3DD; color: #7A5A12; }
.st-current { background: #E6F2EC; color: #1F6B4C; }
.st-no_expiry { background: var(--panel); color: var(--muted); }
.ticket-add { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.ticket-add > summary { display: inline-flex; cursor: pointer; list-style: none; }
.ticket-add > summary::-webkit-details-marker { display: none; }
.ticket-add[open] > summary { margin-bottom: 14px; }
.ticket-add input[type=file] { font-size: .9rem; }
.my-tickets { list-style: none; margin: 0 0 18px; padding: 0; }
.my-tickets li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 0;
  border-bottom: 1px solid var(--line-soft); font-size: .94rem; }
.ticket-upload { border-top: 1px solid var(--line); padding-top: 16px; }

/* Read and sign */
.doc-card { max-width: 880px; margin: 20px auto; }
.doc-view { display: block; width: 100%; height: 62vh; min-height: 320px; margin: 16px 0 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.doc-open { margin: 0 0 18px; font-size: .9rem; }
.sign-form { border-top: 1px solid var(--line); padding-top: 18px; }
.check.big { font-size: 1.02rem; align-items: flex-start; gap: 12px; }
.check.big input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.btn.big { padding: 13px 28px; font-size: 1.02rem; }
.signed-box { background: #E6F2EC; border-radius: 10px; padding: 18px 20px; margin: 16px 0; }
.signed-box h2 { margin: 6px 0; font-size: 1.1rem; color: #1F6B4C; }
@media (max-width: 700px) { .doc-view { height: 52vh; } }

/* In-person training */
.pick-list.tall { max-height: 60vh; }
.attend { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr); gap: 8px; align-items: center;
  padding: 7px 4px; border-bottom: 1px solid var(--line-soft); opacity: .55; }
.attend.on { opacity: 1; }
.attend .pick { margin: 0; }
.attend select, .attend input[type=text], .attend input:not([type]) { height: 34px; font-size: .88rem; }
@media (max-width: 760px) { .attend { grid-template-columns: 1fr; gap: 5px; } }

/* Training matrix */
.st-m-ok { background: #E6F2EC; color: #1F6B4C; }
.st-m-soon { background: #FDF3DD; color: #7A5A12; }
.st-m-expired, .st-m-overdue { background: #FBE9E7; color: #8E2F20; }
.st-m-missing { background: #FDECE6; color: #8a3a22; }
.st-m-in_progress { background: #E8EEF4; color: #2b4e6b; }
.st-m-pending { background: var(--panel); color: var(--muted); }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.matrix { border-collapse: collapse; font-size: .88rem; min-width: 100%; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line-soft); padding: 7px 6px; text-align: center; }
.matrix td:not(.who):not(.filler) { min-width: 44px; font-weight: 600; }
.matrix thead th { vertical-align: bottom; }
.matrix thead th { position: sticky; top: 0; background: var(--panel); font-weight: 600; color: var(--tide);
  font-size: .74rem; writing-mode: vertical-rl; transform: rotate(180deg); height: 210px; white-space: nowrap;
  padding: 8px 4px; }
.matrix th.filler, .matrix td.filler { width: 100%; border-bottom-color: transparent; }
.matrix thead th.filler { writing-mode: horizontal-tb; transform: none; height: auto; }
.matrix th.who, .matrix td.who { position: sticky; left: 0; background: #fff; text-align: left; width: 200px; min-width: 180px;
  writing-mode: horizontal-tb; transform: none; height: auto; border-right: 1px solid var(--line); z-index: 2; }
.matrix thead th.who { background: var(--panel); z-index: 3; }
.matrix td a { text-decoration: none; display: block; }
.matrix td.m-ok { background: #E6F2EC; color: #1F6B4C; }
.matrix td.m-soon { background: #FDF3DD; color: #7A5A12; }
.matrix td.m-expired, .matrix td.m-overdue { background: #FBE9E7; color: #8E2F20; font-weight: 700; }
.matrix td.m-missing { background: #FDECE6; color: #8a3a22; }
.matrix td.m-in_progress { background: #E8EEF4; color: #2b4e6b; }
.matrix td.m-pending { background: var(--panel); color: var(--muted); }
.matrix td.m-na { color: #c9c3b4; }
.matrix-key { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: .82rem;
  color: var(--muted); margin-top: 12px; }
.matrix-key span { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 5px; margin-right: 2px; font-weight: 700; }
.matrix-key .m-ok { background: #E6F2EC; color: #1F6B4C; }
.matrix-key .m-soon { background: #FDF3DD; color: #7A5A12; }
.matrix-key .m-expired { background: #FBE9E7; color: #8E2F20; }
.matrix-key .m-missing { background: #FDECE6; color: #8a3a22; }
.matrix-key .m-in_progress { background: #E8EEF4; color: #2b4e6b; }
.matrix-key .m-pending { background: var(--panel); }
.matrix-key .m-na { background: var(--panel); color: #c9c3b4; }
.req-add { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.roles-pick { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px;
  margin: 0 0 14px; min-width: 0; }
.roles-pick legend { padding: 0 6px; font-size: .86rem; color: var(--muted); }
.roles-pick legend .hint { display: block; margin-top: 2px; }
.roles-pick .check { margin: 4px 0; }
.card .list.compact td { vertical-align: middle; }
.card .list.compact td:nth-child(2) { white-space: nowrap; }
