/* Online Radio – accessible base styles.
   Colour pairs meet WCAG 2.2 AA (text >= 4.5:1, UI >= 3:1). Station --brand is checked on save (>= 4.5:1 vs white). */
:root {
  --brand: #1b4f8a;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #555555;         /* 7.4:1 on white */
  --border: #767676;        /* 4.5:1 on white */
  --surface: #f3f4f6;
  --focus: #b3261e;
  --ok-bg: #e6f4ea; --ok-fg: #1e5e2c;
  --warn-bg: #fff4d6; --warn-fg: #6b4b00;
  --bad-bg: #fde7e7; --bad-fg: #9b1c1c;
  --player-h: 7.5rem;
  /* links and text buttons use the station colour unless a display mode needs another */
  --link: var(--brand);
  --field-bg: #fff;
  --rule: #c4c4c4;
  --neutral-fg: #333;
  --info-fg: #222;
  --header-bg: var(--brand);
  --header-fg: #fff;
  color-scheme: light;
}
html { font-size: 100%; scroll-padding-bottom: calc(var(--player-h) + 1rem); scroll-padding-top: 1rem; }
body.font-large { font-size: 125%; }
body.font-xlarge { font-size: 150%; }
body.font-xxlarge { font-size: 175%; }
body.font-huge { font-size: 200%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: "Noto Sans Thai", "Sarabun", "Leelawadee UI", "Thonburi", Tahoma, system-ui, sans-serif;
  line-height: 1.6;
}
body.has-player { padding-bottom: calc(var(--player-h) + 1rem); }
@media (max-width: 40rem) {
  .player-custom { gap: .25rem .75rem; }
  .player-info { flex-basis: calc(100% - 12rem); min-width: 0; }
  .volume input { width: 6rem; }
}
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 3px; }
h1, h2, h3 { line-height: 1.3; }
h1 { font-size: 2rem; margin-top: .5rem; }
code { background: var(--surface); padding: .1em .3em; border-radius: 3px; word-break: break-all; }

/* Focus: always visible, thick, never removed (WCAG 2.4.7 / 2.4.13) */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus, h1:focus, .error-summary:focus, #player:focus { outline: none; }
main:focus-visible, .error-summary:focus-visible { outline: 3px solid var(--focus); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: .5rem; top: -10rem; background: #000; color: #fff; padding: .75rem 1rem; z-index: 1000; font-weight: bold; }
.skip-link:focus { top: .5rem; }

/* Header */
.site-header { background: var(--header-bg); color: var(--header-fg); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding-top: .5rem; padding-bottom: .5rem; }
.site-header a, .site-header .link-button { color: var(--header-fg); }
.site-header :focus-visible { outline-color: #fff; box-shadow: 0 0 0 5px #000; }
.site-name { margin: 0; font-size: 1.25rem; font-weight: bold; }
.site-name a { text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; }
.logo { height: 2.5rem; width: auto; background: #fff; border-radius: 4px; }
.nav { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0; padding: 0; }
.nav a { display: inline-block; padding: .5rem .25rem; min-height: 24px; }
.nav a[aria-current="page"] { font-weight: bold; text-decoration-thickness: 3px; }
.header-tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.inline { display: inline; margin: 0; }

.page { display: flex; gap: 2rem; align-items: flex-start; padding-top: 1rem; padding-bottom: 2rem; }
.page main { flex: 1; min-width: 0; }
.subnav { flex: 0 0 14rem; }
.subnav .nav { flex-direction: column; }
.subnav .nav a { color: var(--link); }
@media (max-width: 48rem) { .page { flex-direction: column; } .subnav { flex: none; width: 100%; } .subnav .nav { flex-direction: row; } }
/* On a wide screen the side menu is always open (its summary is only a toggle on small screens) */
.subnav-menu > summary { display: none; }
@media (max-width: 48rem) {
  .subnav-menu > summary { display: block; cursor: pointer; font-weight: bold; padding: .6rem .75rem; border: 2px solid var(--link); border-radius: 6px; color: var(--link); min-height: 24px; }
  .subnav-menu[open] > summary { margin-bottom: .5rem; }
}

/* Forms */
.field { margin: 0 0 1.25rem; }
label, legend { display: block; font-weight: bold; margin-bottom: .25rem; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 1rem; margin: 0 0 1.25rem; }
fieldset fieldset { border-style: dashed; }
.field-check { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-bottom: .5rem; }
.field-check label { font-weight: normal; margin: 0; }
.field-check .hint { flex-basis: 100%; margin-left: 2rem; }
input[type="text"], input[type="email"], input[type="number"], input[type="search"], input[type="url"], input[type="date"], input[type="time"], select, textarea, input:not([type]) {
  font: inherit; padding: .5rem .6rem; border: 2px solid var(--border); border-radius: 4px; background: var(--field-bg); color: var(--fg);
  max-width: 100%; min-height: 44px; box-sizing: border-box;
}
input[type="text"], input[type="email"], input[type="search"], input[type="url"], textarea, input:not([type]) { width: 32rem; }
input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; margin: .1rem 0 0; accent-color: var(--brand); }
.hint { color: var(--muted); margin: 0 0 .35rem; font-size: .95em; }
.req { color: var(--bad-fg); font-weight: normal; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad-fg); border-width: 3px; }
.error-text { color: var(--bad-fg); font-weight: bold; margin: 0 0 .35rem; }
.error-summary { border: 4px solid var(--bad-fg); padding: 1rem 1.25rem; margin-bottom: 1.5rem; background: var(--bad-bg); }
.error-summary h2 { margin-top: 0; font-size: 1.25rem; }
.error-summary a { color: var(--bad-fg); font-weight: bold; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0 1rem; align-items: flex-end; }
.inline-form .field { margin-bottom: .75rem; }
.inline-form input[type="search"] { width: 20rem; }

button, .button { font: inherit; min-height: 44px; min-width: 44px; padding: .5rem 1rem; border: 2px solid var(--link); background: var(--field-bg); color: var(--link); border-radius: 4px; cursor: pointer; }
button:hover { background: var(--surface); }
button[disabled] { opacity: .55; cursor: not-allowed; }
.button-primary { background: var(--brand); color: #fff; font-weight: bold; }
.button-primary:hover { background: var(--brand); text-decoration: underline; }
.button-danger { border-color: var(--bad-fg); color: var(--bad-fg); }
.link-button { background: none; border: none; padding: .5rem .25rem; min-height: 24px; min-width: 0; text-decoration: underline; color: var(--link); font: inherit; cursor: pointer; }
/* a text button keeps its own background on hover (button:hover would put white header text on light grey) */
.link-button:hover { background: none; text-decoration-thickness: 3px; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 0 0 1.5rem; }
caption { text-align: left; font-weight: bold; padding: .25rem 0 .5rem; }
th, td { border: 1px solid var(--rule); padding: .5rem .6rem; text-align: left; vertical-align: top; }
thead th { background: var(--surface); }
tbody th { font-weight: normal; }
tbody th a { font-weight: bold; }
tr.on-air { background: var(--ok-bg); }
@media (max-width: 40rem) { table { display: block; overflow-x: auto; } }

/* Status / feedback */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .9em; font-weight: bold; border: 1px solid currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-bad { background: var(--bad-bg); color: var(--bad-fg); }
.badge-neutral { background: var(--surface); color: var(--neutral-fg); }
.flash { padding: .75rem 1rem; border-left: 6px solid; margin-bottom: 1.25rem; }
.flash-success { background: var(--ok-bg); color: var(--ok-fg); }
.flash-error { background: var(--bad-bg); color: var(--bad-fg); }
.flash-info { background: var(--surface); color: var(--info-fg); border-color: var(--link); }
.muted { color: var(--muted); }
.lead { font-size: 1.2rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; }
.facts dt { font-weight: bold; }
.facts dd { margin: 0; }
.card-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.card { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.card h2 { margin-top: 0; font-size: 1.25rem; }
.link-list li, .notes li { margin-bottom: .5rem; }
.pager { list-style: none; display: flex; gap: 1rem; padding: 0; }
.prose { max-width: 48rem; }
.logo-preview { max-height: 4rem; vertical-align: middle; background: var(--surface); }
.site-footer { border-top: 1px solid var(--rule); padding: 1rem 0; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: 0; }
.footer-links a { display: inline-block; padding: .25rem 0; }

/* Persistent player bar: fixed at the bottom; page reserves space so focus is never hidden (WCAG 2.4.11) */
.player-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #0f1b2d; color: #fff; border-top: 4px solid var(--brand); z-index: 50; }
.player-inner { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; padding-top: .6rem; padding-bottom: .6rem; min-height: 3.5rem; }
.player-bar :focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
.player-custom { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; width: 100%; }
.player-custom[hidden] { display: none; }
.player-native audio { width: min(30rem, 100%); }
.play-toggle { background: #fff; color: #0f1b2d; border-color: #fff; font-weight: bold; display: inline-flex; gap: .5rem; align-items: center; }
.play-toggle[aria-pressed="true"] { background: #ffd54a; border-color: #ffd54a; }
.player-info { flex: 1; min-width: 12rem; }
.player-info p { margin: 0; }
.player-status { font-size: .9em; color: #d7e3f4; }
.now-playing { font-weight: bold; }
.volume { display: flex; align-items: center; gap: .5rem; font-weight: normal; margin: 0; }
.volume input { width: 8rem; min-height: 44px; accent-color: #ffd54a; }
.player-more summary { cursor: pointer; padding: .5rem; min-height: 24px; }
.player-more-body { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; padding: .5rem 0; }
.player-more-body label { font-weight: normal; }
.player-bar select, .player-bar button { min-height: 44px; }
.player-bar button:not(.play-toggle) { background: transparent; color: #fff; border-color: #fff; }
.capacity-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* User preference: high contrast */
body.contrast-high { --bg: #000; --fg: #ffea00; --muted: #ffffff; --border: #ffffff; --surface: #1a1a1a; --focus: #00e5ff; --brand: #000;
  --link: #00e5ff; --field-bg: #000; --rule: #fff; --neutral-fg: #fff; --info-fg: #fff; --header-bg: #000; --header-fg: #ffea00; color-scheme: dark; }
body.contrast-high, body.contrast-high input, body.contrast-high select, body.contrast-high textarea { background: #000; color: #ffea00; }
body.contrast-high a, body.contrast-high .link-button, body.contrast-high button { color: #00e5ff; border-color: #00e5ff; background: #000; }
body.contrast-high .button-primary { background: #ffea00; color: #000; border-color: #ffea00; }
body.contrast-high .site-header { background: #000; border-bottom: 2px solid #ffea00; }
body.contrast-high thead th, body.contrast-high tr.on-air { background: #1a1a1a; }
body.contrast-high th, body.contrast-high td { border-color: #fff; }
body.contrast-high .badge, body.contrast-high .flash, body.contrast-high .error-summary { background: #000; color: #fff; border-color: #fff; }
body.contrast-high .player-bar { background: #000; border-top-color: #ffea00; }

/* User preference + OS setting: reduce motion (WCAG 2.3.3) */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (forced-colors: active) { .badge, .flash, .error-summary { border: 2px solid CanvasText; } .play-toggle[aria-pressed="true"] { outline: 3px solid Highlight; } }

/* ---------- DJ console ---------- */
.dj-page .page { max-width: 90rem; }
.dj { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 1rem; }
.dj-panel { border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; }
.dj-panel h2 { margin-top: 0; font-size: 1.25rem; }
.dj-status { grid-column: 1 / -1; }
.dj[data-air="on_air"] .dj-status { border: 4px solid var(--bad-fg); }
.dj[data-air="on_air"] .onair-state { background: var(--bad-fg); color: #fff; }
.dj[data-air="rehearsal"] .onair-state { background: var(--warn-bg); color: var(--warn-fg); }
.dj[data-mode="console"] { outline: 3px dashed var(--brand); outline-offset: 6px; }
.onair-state { font-size: 1.4rem; font-weight: bold; padding: .5rem .75rem; border-radius: 6px; background: var(--surface); margin: 0 0 .5rem; }
.decks { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 40rem) { .decks { grid-template-columns: 1fr; } }
.deck { border: 1px solid #c4c4c4; border-radius: 6px; padding: .5rem; }
.deck h3 { margin: 0; }
.deck-title { font-weight: bold; min-height: 3em; margin: .25rem 0; }
.deck-time { font-variant-numeric: tabular-nums; font-size: 1.3rem; margin: 0; }
.deck-meter, .level-meter { height: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; overflow: hidden; margin: .25rem 0; }
.deck-meter div, .level-meter div { height: 100%; width: 0; background: var(--brand); }
.listbox { list-style: none; margin: .25rem 0; padding: 0; border: 2px solid var(--border); border-radius: 4px; max-height: 18rem; overflow-y: auto; min-height: 3rem; }
.listbox:focus-visible { outline: 3px solid var(--focus); }
.listbox [role="option"] { padding: .4rem .6rem; border-bottom: 1px solid #e3e3e3; cursor: pointer; }
.listbox [role="option"].active { background: var(--brand); color: #fff; }
.inline-check { display: inline-flex; gap: .35rem; align-items: center; font-weight: normal; margin-right: 1rem; }
.inline-fieldset { border: none; padding: 0; margin: .5rem 0; }
.cart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .5rem; margin: .5rem 0; }
.cart-slot { display: flex; flex-direction: column; gap: .25rem; }
.cart-slot button[aria-pressed="true"] { background: var(--warn-bg); border-width: 3px; }
.chat-log { max-height: 12rem; overflow-y: auto; }
dialog { max-width: 32rem; border: 2px solid var(--border); border-radius: 8px; }
dialog::backdrop { background: rgba(0,0,0,.5); }
body.contrast-high .listbox [role="option"].active { background: #ffea00; color: #000; }

/* Statistics: charts are one image + summary; the same numbers are always in the table beside them */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.stat-grid > div { border: 1px solid var(--border); border-radius: 6px; padding: .75rem 1rem; background: var(--surface); }
.stat-grid dt { font-size: .95rem; color: var(--muted); }
.stat-grid dd { margin: 0; font-size: 1.6rem; font-weight: 700; }
.chart { margin: 0 0 2rem; }
.chart-title { font-weight: 700; font-size: 1.1rem; margin-bottom: .5rem; }
.chart-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 56rem) { .chart-body { grid-template-columns: 1fr; } }
.chart-svg { width: 100%; height: auto; color: var(--brand); }
.chart-bar { fill: currentColor; }
.chart-grid { stroke: var(--border); stroke-width: .5; stroke-dasharray: 3 3; }
.chart-axis { stroke: var(--fg); stroke-width: 1; }
.chart-tick, .chart-value { fill: var(--fg); font-size: 11px; font-family: inherit; }
.chart-summary { margin: .25rem 0 0; }
.table-scroll { overflow-x: auto; max-height: 26rem; overflow-y: auto; }
.table-scroll:focus-visible { outline: 3px solid var(--focus); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
@media (forced-colors: active) { .chart-bar { fill: CanvasText; } .chart-tick, .chart-value { fill: CanvasText; } .chart-grid, .chart-axis { stroke: CanvasText; } }
body.contrast-high .chart-svg { color: #00e5ff; }
textarea.code, input.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9rem; width: 100%; max-width: 44rem; box-sizing: border-box; }
/* Deck waveform (decorative: the same information is in the text line below it and in Alt+Shift+U) */
.deck-meter { position: relative; }
.deck-wave { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--muted); }
.deck-wave .wave { fill: currentColor; opacity: .45; }
.deck-wave .wave-intro, .deck-wave .wave-outro { stroke: var(--fg); stroke-width: 1.2; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.deck-wave .wave-hot { stroke: var(--focus); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.deck-shape { font-size: .95rem; margin: .25rem 0; }
.hotcues button { min-width: 7.5rem; }
body.contrast-high .deck-wave { color: #00e5ff; }
@media (forced-colors: active) { .deck-wave .wave { fill: CanvasText; } .deck-wave line { stroke: Highlight; } }
.deck .deck-meter { height: 2.5rem; }
.deck .deck-meter div { position: absolute; left: 0; top: 0; opacity: .35; }
/* Hour clock face (decorative summary; the table beside it has everything) */
.clock-svg { width: 100%; max-width: 22rem; height: auto; color: var(--brand); }
.clock-bg { fill: var(--surface); stroke: var(--border); }
.clock-seg { stroke: var(--bg); stroke-width: 1.5; }
.clock-music.clock-even { fill: currentColor; } .clock-music.clock-odd { fill: currentColor; opacity: .7; }
.clock-jingle { fill: var(--warn-fg); } .clock-voicetrack { fill: var(--ok-fg); }
.clock-break { stroke: var(--bad-fg); stroke-width: 4; }
.clock-hub { fill: var(--bg); stroke: var(--border); }
.clock-num { fill: var(--fg); font-size: 11px; font-family: inherit; }
.clock-row { border: 1px solid var(--border); border-radius: 6px; padding: .5rem 1rem; }
body.contrast-high .clock-svg { color: #00e5ff; }
@media (forced-colors: active) { .clock-seg { fill: CanvasText; stroke: Canvas; } .clock-break { stroke: Highlight; } }
/* Invoices and receipts */
.taxdoc { border: 1px solid var(--border); border-radius: 6px; padding: 1rem 1.25rem; margin: 1rem 0; background: var(--bg); }
.taxdoc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.taxdoc-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.taxdoc-party h3 { font-size: 1rem; margin-bottom: .25rem; }
.taxdoc-party p { margin: .1rem 0; }
.taxdoc-lines, .taxdoc-totals { width: 100%; margin: .75rem 0; }
.taxdoc-totals { max-width: 32rem; margin-left: auto; }
.taxdoc-totals th { text-align: left; font-weight: normal; }
.pre { white-space: pre-line; }
.qr { max-width: 22rem; } .qr-img svg { width: 100%; height: auto; background: #fff; }
.radio { display: flex; gap: .5rem; align-items: baseline; margin: .25rem 0; }
@media print {
  .site-header, .site-footer, nav, .player-bar, .no-print, .skip-link, .flash { display: none !important; }
  body { padding: 0 !important; background: #fff; color: #000; }
  .taxdoc { border: none; padding: 0; break-inside: avoid; }
  .taxdoc + .taxdoc { break-before: page; }
}
/* Emergency alerts: text + icon + border, never colour alone; high contrast in every theme */
.emergency { border: 4px solid #9b1c1c; background: #fde7e7; color: #3b0a0a; border-radius: 6px; padding: .75rem 1rem; margin: 0 0 1rem; }
.emergency h2 { margin: 0 0 .25rem; font-size: 1.25rem; color: #7a1010; }
.emergency p { margin: .25rem 0; }
.emergency-test { border-color: #6b4b00; background: #fff4d6; color: #3d2b00; } .emergency-test h2 { color: #4d3700; }
body.contrast-high .emergency { background: #000; color: #fff; border-color: #ffea00; } body.contrast-high .emergency h2 { color: #ffea00; }
@media (forced-colors: active) { .emergency { border: 4px solid CanvasText; } }
/* Support impersonation banner: always visible, first thing on the page */
.impersonation { background: #6b4b00; color: #fff; padding: .5rem 0; }
.impersonation p { margin: 0 0 .25rem; } .impersonation button { font: inherit; }
@media (forced-colors: active) { .impersonation { border-bottom: 3px solid CanvasText; } }

/* Terms to accept: a scrollable, keyboard-focusable box so the button stays near */
.legal-box { max-height: 60vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0 1rem 1rem; margin: 1rem 0; }
.legal-box:focus-visible { outline: 3px solid var(--focus, #1b4f8a); outline-offset: 2px; }
.prose table { border-collapse: collapse; }

/* ---------- Selecting several rows, undo, confirmation ---------- */
.bulk-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.bulk-status { margin: .5rem 0; font-weight: 600; }
table[data-bulk] thead th[data-bulk-head] input[type="checkbox"],
table[data-bulk] tbody td input[type="checkbox"] { width: 1.5rem; height: 1.5rem; }
.flash-undo { display: inline-block; margin-inline-start: .75rem; }
.confirm-box { border: 3px solid currentColor; border-radius: .5rem; padding: 1rem 1.25rem; max-width: 48rem; }
.confirm-box form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }

/* ---------- Sign-in fallbacks ---------- */
.recovery-codes { font-size: 1.25rem; line-height: 2; columns: 2 12rem; }
.recovery-codes code, .setup-key { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .08em; }
.setup-key { font-size: 1.25rem; word-break: break-all; }
.qr svg { width: 12rem; height: 12rem; background: #fff; }
@media print {
  header, nav, footer, .subnav, form, .flash, [data-requires-js] { display: none !important; }
  .recovery-codes { columns: 2; }
}
.reveal-password { margin-inline-start: .5rem; }
.menu-search { margin-bottom: .75rem; }
.menu-search input { width: 100%; }
.setup-checklist { border: 2px solid var(--border); border-radius: .5rem; padding: .75rem 1rem; margin-bottom: 1.5rem; }
.setup-checklist li { margin-bottom: .5rem; }
.subnav .nav-group { font-size: 1rem; margin: 1rem 0 .25rem; text-transform: none; color: var(--muted); }
progress[data-upload-bar] { width: 100%; height: 1rem; }
.storage-status { margin: .25rem 0 1rem; }
.onair-line { margin: .25rem 0; }
.plain-list { list-style: none; padding-left: 0; margin: .5rem 0; } .plain-list li { margin: .15rem 0; }
.share-item { border-top: 1px solid var(--border, #767676); padding: .5rem 0 .75rem; }
.share-item h4 { margin: .25rem 0; }
.copy-field input[readonly], .copy-field textarea[readonly] { width: 100%; max-width: 42rem; }
.copy-field button { margin-top: .25rem; }
.share-box { margin: 1rem 0; }
.share-box summary { font-weight: bold; cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; }
.inline-list { list-style: none; padding-left: 0; display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.record-choice { margin: .5rem 0; } .rec-dialog { max-width: 36rem; width: calc(100% - 2rem); } .rec-dialog::backdrop { background: rgba(0,0,0,.5); }

/* ---------- Control centre (views/menu.ts) ---------- */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: .5rem 0 0; font-size: .95em; }
.breadcrumbs li + li::before { content: "›" / ""; margin: 0 .4rem 0 .15rem; color: var(--muted); }
.breadcrumbs [aria-current] { color: var(--muted); }
.hub-todo { padding: .6rem .9rem; border: 2px solid var(--warn-fg); border-radius: 8px; background: var(--warn-bg); color: var(--warn-fg); }
.hub-todo a { color: inherit; font-weight: bold; }
.hub-status { padding: .6rem .9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.hub-group { margin: 1.75rem 0; }
.hub-group > h2 { margin-bottom: .5rem; padding-bottom: .25rem; border-bottom: 2px solid var(--rule); }
.hub-group h3 { font-size: 1.05rem; color: var(--muted); margin: 1rem 0 .4rem; }
.hub-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.hub-card a { display: flex; flex-direction: column; gap: .2rem; height: 100%; box-sizing: border-box; padding: .8rem 1rem; border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none; color: var(--fg); background: var(--bg); min-height: 44px; }
.hub-card a:hover { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.hub-card-name { font-weight: bold; color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.hub-card a:hover .hub-card-name { text-decoration-thickness: 3px; }
.hub-card-note { font-weight: bold; color: var(--fg); font-size: .9em; }
.hub-card-desc { color: var(--muted); font-size: .95em; }
.stat-tiles { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .75rem; }
.stat-tiles li { border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem; }
.stat-value { display: block; font-size: 1.6rem; font-weight: bold; }
.stat-label { color: var(--muted); }
.table-scroll { overflow-x: auto; max-width: 100%; }
.workspaces { margin: 0 0 1rem; border: 1px solid var(--border); border-radius: 8px; padding: .25rem .75rem; }
.workspaces summary { cursor: pointer; font-weight: bold; padding: .4rem 0; min-height: 24px; }
.workspaces ul { list-style: none; padding: 0; margin: .25rem 0 .5rem; }
.workspaces li { margin: .35rem 0; }
.workspaces [aria-current] { font-weight: bold; }
.subnav .nav-sub { font-size: .95rem; margin: .6rem 0 .2rem; color: var(--muted); }

/* ---------- Accessibility helper (routes/a11y-helper.ts, a11y-helper.js) ---------- */
.a11y-helper { position: relative; }
.a11y-helper > summary { list-style: none; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; padding: .45rem .8rem; min-height: 24px;
  border: 2px solid var(--header-fg); border-radius: 999px; font-weight: bold; color: var(--header-fg); }
.a11y-helper > summary::-webkit-details-marker { display: none; }
.a11y-helper[open] > summary { background: var(--header-fg); color: var(--header-bg); }
.a11y-helper-icon { flex: none; }
.a11y-helper-panel { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 60; width: min(26rem, 92vw); max-height: 75vh; overflow: auto;
  background: var(--bg); color: var(--fg); border: 2px solid var(--border); border-radius: 10px; padding: 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.a11y-helper-panel fieldset { padding: .6rem .8rem .2rem; margin-bottom: .8rem; }
.a11y-helper-panel .field { margin-bottom: .7rem; }
.a11y-helper-panel select { width: 100%; }
.a11y-helper-panel .checkbox { display: flex; gap: .5rem; align-items: flex-start; }
.a11y-helper-panel .checkbox label { font-weight: normal; margin: 0; }
.a11y-helper-panel a, .a11y-helper-panel .link-button { color: var(--link); }
.a11y-helper-actions { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .25rem 0 .75rem; }
.a11y-helper-reset { margin: 0 0 .5rem; }
.a11y-outline ul { padding-left: 1.25rem; margin: .5rem 0; }
.a11y-outline li { margin: .2rem 0; }
@media (max-width: 40rem) { .a11y-helper-panel { position: fixed; left: .5rem; right: .5rem; top: 4rem; width: auto; } }

/* Text sizes 175% and 200%: tables and wide boxes scroll inside themselves */
body.font-xxlarge .hub-cards, body.font-huge .hub-cards { grid-template-columns: 1fr; }

/* Text spacing (WCAG 1.4.12): line 1.5+, paragraphs 2x, letters .12em, words .16em */
body.spacing-wide { line-height: 1.9; letter-spacing: .12em; word-spacing: .16em; }
body.spacing-wide p, body.spacing-wide li { margin-bottom: 1em; }
body.spacing-wide p { margin-bottom: 2em; }

/* Easy-to-read font: looped Thai (Noto Sans Thai Looped, SIL Open Font License, public/fonts) */
@font-face { font-family: "Noto Sans Thai Looped"; src: url("/assets/fonts/noto-sans-thai-looped-thai-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai Looped"; src: url("/assets/fonts/noto-sans-thai-looped-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Thai Looped"; src: url("/assets/fonts/noto-sans-thai-looped-thai-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai Looped"; src: url("/assets/fonts/noto-sans-thai-looped-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
body.typeface-readable, body.typeface-readable input, body.typeface-readable select, body.typeface-readable textarea, body.typeface-readable button {
  font-family: "Noto Sans Thai Looped", Verdana, Tahoma, sans-serif; }

body.links-underline a { text-decoration: underline !important; text-decoration-thickness: 2px !important; }
body.focus-strong :focus-visible { outline: 5px solid var(--focus) !important; outline-offset: 3px !important; box-shadow: 0 0 0 9px var(--bg) !important; }
body.cursor-large, body.cursor-large * { cursor: url("/assets/cursor-large.svg") 4 2, auto !important; }
body.cursor-large a, body.cursor-large button, body.cursor-large summary, body.cursor-large label, body.cursor-large select { cursor: url("/assets/cursor-large-hand.svg") 14 2, pointer !important; }

/* Visual guide bar (แถบนำทางสายตา): a band that follows the pointer, drawn by a11y-helper.js */
.a11y-guide { position: fixed; left: 0; right: 0; height: 2.6em; pointer-events: none; z-index: 70;
  border-top: 3px solid var(--focus); border-bottom: 3px solid var(--focus); background: rgba(255, 234, 0, .12); }
body.reduce-motion .a11y-guide { transition: none; }
@media (forced-colors: active) { .a11y-guide { border-color: Highlight; background: transparent; } }

/* Dark colour mode: chosen, or the device's choice when the person left it on "same as my device" */
body.theme-dark { color-scheme: dark; --bg: #121417; --fg: #e8eaed; --muted: #b6bcc4; --border: #8a929c; --surface: #1f2329; --focus: #ffb4a9;
  --ok-bg: #12301b; --ok-fg: #a6e3b4; --warn-bg: #33290a; --warn-fg: #ffd77a; --bad-bg: #3a1414; --bad-fg: #ffb3b3;
  --link: #9cc7ff; --field-bg: #1a1d22; --rule: #5b636d; --neutral-fg: #e8eaed; --info-fg: #e8eaed; }
@media (prefers-color-scheme: dark) {
  body:not(.theme-light):not(.contrast-high):not([class*="scheme-"]) { color-scheme: dark; --bg: #121417; --fg: #e8eaed; --muted: #b6bcc4; --border: #8a929c; --surface: #1f2329; --focus: #ffb4a9;
    --ok-bg: #12301b; --ok-fg: #a6e3b4; --warn-bg: #33290a; --warn-fg: #ffd77a; --bad-bg: #3a1414; --bad-fg: #ffb3b3;
    --link: #9cc7ff; --field-bg: #1a1d22; --rule: #5b636d; --neutral-fg: #e8eaed; --info-fg: #e8eaed; }
}
body.theme-dark .button-primary { background: var(--link); color: #0b0d10; border-color: var(--link); }
@media (prefers-color-scheme: dark) { body:not(.theme-light):not(.contrast-high):not([class*="scheme-"]) .button-primary { background: var(--link); color: #0b0d10; border-color: var(--link); } }

/* Text and background display (การแสดงผลตัวอักษรและพื้นหลัง): white on black, black on yellow, dark blue on cream.
   (Yellow on black is body.contrast-high above.) Every pair is at least 7:1 (WCAG AAA). */
body.scheme-wob { color-scheme: dark; --bg: #000; --fg: #fff; --muted: #e0e0e0; --border: #fff; --surface: #1a1a1a; --focus: #ffea00; --link: #8fd3ff;
  --field-bg: #000; --rule: #fff; --neutral-fg: #fff; --info-fg: #fff; --header-bg: #000; --header-fg: #fff;
  --ok-bg: #000; --ok-fg: #9ff5b0; --warn-bg: #000; --warn-fg: #ffea00; --bad-bg: #000; --bad-fg: #ffb3b3; }
body.scheme-boy { --bg: #ffea00; --fg: #000; --muted: #222; --border: #000; --surface: #fff59d; --focus: #000; --link: #00007a;
  --field-bg: #fffde0; --rule: #000; --neutral-fg: #000; --info-fg: #000; --header-bg: #000; --header-fg: #ffea00;
  --ok-bg: #fff59d; --ok-fg: #003d12; --warn-bg: #fff59d; --warn-fg: #3d2a00; --bad-bg: #fff59d; --bad-fg: #6b0000; }
body.scheme-cream { --bg: #fdf6e3; --fg: #0b2a5b; --muted: #34496b; --border: #34496b; --surface: #f3e9cc; --focus: #9b1c1c; --link: #6b2500;
  --field-bg: #fffbef; --rule: #8c7f5e; --neutral-fg: #0b2a5b; --info-fg: #0b2a5b; --header-bg: #0b2a5b; --header-fg: #fdf6e3; }
body[class*="scheme-"] .button-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
body[class*="scheme-"] .player-bar { background: var(--header-bg); border-top-color: var(--focus); }
body[class*="scheme-"] .badge { border-width: 2px; }
