/* Shared look for the hub and the admin console. Light and dark themes, large touch
   targets, visible focus, and no motion for people who ask for reduced motion (ACN-01). */
:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #18202c;
  --muted: #5a6577;
  --line: #d9dee7;
  --brand: #3b4cca;
  --brand-ink: #ffffff;
  --ok-bg: #e7f6ec;
  --ok-ink: #135c2c;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4a00;
  --err-bg: #fde8e8;
  --err-ink: #8a1c1c;
  --focus: #ffbf47;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 5%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c;
    --panel: #1a2029;
    --ink: #e8ecf2;
    --muted: #a3adbd;
    --line: #2e3744;
    --brand: #8b98ff;
    --brand-ink: #10131a;
    --ok-bg: #12301d;
    --ok-ink: #a8e6bb;
    --warn-bg: #3a2e0b;
    --warn-ink: #f3d68a;
    --err-bg: #3b1616;
    --err-ink: #f5b5b5;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c;
  --panel: #1a2029;
  --ink: #e8ecf2;
  --muted: #a3adbd;
  --line: #2e3744;
  --brand: #8b98ff;
  --brand-ink: #10131a;
  --ok-bg: #12301d;
  --ok-ink: #a8e6bb;
  --warn-bg: #3a2e0b;
  --warn-ink: #f3d68a;
  --err-bg: #3b1616;
  --err-ink: #f5b5b5;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--panel); padding: 8px 12px; z-index: 10; }

header.site {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
header.site .brand { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.1rem; }
header.site nav { display: flex; gap: 14px; flex-wrap: wrap; }
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
main.wide { max-width: 1200px; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 16px; }
h2 { font-size: 1.25rem; margin: 28px 0 10px; }
h3 { font-size: 1.05rem; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow);
}
.card > :first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tile .big { font-size: 1.8rem; font-weight: 700; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.92rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], select, textarea {
  width: 100%; max-width: 100%; padding: 11px 12px; font: inherit; color: var(--ink);
  background: var(--panel); border: 2px solid var(--line); border-radius: 8px;
}
textarea { min-height: 110px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; margin: 12px 8px 0 0;
  font: inherit; font-weight: 600; border-radius: 8px; border: 2px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); cursor: pointer; text-decoration: none;
}
button.secondary, .button.secondary { background: transparent; color: var(--brand); }
button.danger { background: var(--err-ink); border-color: var(--err-ink); color: var(--panel); }
button:disabled { opacity: 0.6; cursor: progress; }
.provider { width: 100%; justify-content: flex-start; background: var(--panel); color: var(--ink); border-color: var(--line); }

.notice { border-radius: 8px; padding: 12px 14px; margin: 12px 0; border-left: 6px solid; }
.notice p:last-child { margin: 0; }
.notice-ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice-error { background: var(--err-bg); color: var(--err-ink); }
.reference { font-size: 0.85rem; }
.reference a { color: inherit; }

/* Status words always come with an icon or text, never colour alone (ACN-01). */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--line); }
.badge.ok::before { content: "✓ "; }
.badge.warn::before { content: "! "; }
.badge.err::before { content: "✕ "; }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.err { background: var(--err-bg); color: var(--err-ink); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; }
@media (max-width: 640px) {
  table.data thead { display: none; }
  table.data tr { display: block; border-bottom: 2px solid var(--line); padding: 6px 0; }
  table.data td { display: flex; gap: 12px; border: 0; padding: 4px 0; }
  table.data td::before { content: attr(data-label); font-weight: 600; min-width: 40%; color: var(--muted); }
}

.codes { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; columns: 2; }
.code-input { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.3em; font-size: 1.3rem; max-width: 12ch; }

@media (prefers-reduced-motion: no-preference) {
  .card, .tile { transition: border-color 0.15s ease; }
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="on"]) * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* The console's motion switch stops every animation, pulse and blur at once (ACN-08). */
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation: none !important; transition: none !important; backdrop-filter: none !important; }

dl.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 16px; margin: 0 0 16px; }
dl.kv dt { color: var(--muted); font-weight: 600; text-transform: capitalize; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
dialog.card { max-width: 480px; width: calc(100% - 32px); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / 45%); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
@media print { header.site, button { display: none; } }

/* Pop-up windows (ACN-13) */
.win-layer { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.win {
  position: absolute; pointer-events: auto; width: min(720px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px));
  min-width: 280px; min-height: 200px; display: flex; flex-direction: column; resize: both; overflow: hidden;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgb(0 0 0 / 25%);
}
.win:focus-visible { outline: 3px solid var(--focus); }
.win-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; background: var(--bg); border-bottom: 1px solid var(--line); cursor: move; touch-action: none; }
.win-title { flex: 1; font-size: 1rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-buttons { display: flex; gap: 2px; }
.win-btn { min-height: 36px; min-width: 40px; margin: 0; padding: 4px 8px; background: transparent; color: var(--ink); border: 1px solid transparent; font-size: 1.1rem; }
.win-btn:hover { border-color: var(--line); }
.win-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 10px; border-bottom: 1px solid var(--line); }
.small-btn { min-height: 36px; padding: 4px 10px; margin: 0; font-size: 0.9rem; }
.win-trail { padding: 6px 14px; font-size: 0.9rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.win-trail:empty { display: none; }
.win-body { flex: 1; overflow: auto; padding: 4px 16px 16px; }
.win-max { left: 0 !important; top: 0 !important; width: 100% !important; height: calc(100% - 48px) !important; resize: none; border-radius: 0; }
.win-taskbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; padding: 6px; z-index: 30; pointer-events: auto; }
.win-taskbar:empty { display: none; }
.win-taskbar { background: var(--panel); border-top: 1px solid var(--line); }
/* Phones and high zoom: windows fill the screen. */
@media (max-width: 700px), (max-height: 500px) {
  .win { left: 0 !important; top: 0 !important; width: 100% !important; height: calc(100% - 48px) !important; resize: none; border-radius: 0; }
}
.idle-warning { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 40; max-width: calc(100% - 32px); }
.idle-warning h2 { font-size: 1rem; margin: 0 0 4px; }

/* ---------- Admin console (ACN-05 to ACN-09) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { flex: none; vertical-align: -0.2em; }
:root {
  --c-blue: #3b6cf6; --c-orange: #e8590c; --c-red: #d6336c; --c-purple: #7048e8; --c-green: #2f9e44;
  --c-teal: #0c8599; --c-grey: #6c757d; --c-cyan: #1098ad; --c-indigo: #4c6ef5; --c-brown: #a0522d;
  --panel-2: #fbfcfe; --info-bg: #e7f0ff; --info-ink: #1c3d8f;
}
:root[data-theme="dark"] { --panel-2: #212835; --info-bg: #182a4d; --info-ink: #b7ceff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --panel-2: #212835; --info-bg: #182a4d; --info-ink: #b7ceff; } }

.console { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.menu { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 10px; }
.brand-block { display: flex; gap: 10px; align-items: center; padding: 4px 8px 10px; border-bottom: 1px solid var(--line); }
.menu-list, .submenu { list-style: none; margin: 0; padding: 0; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; margin: 2px 0; padding: 8px 10px; min-height: 42px; background: transparent; color: var(--ink); border: 0; border-radius: 8px; font-weight: 600; text-align: left; }
.menu-item:hover { background: var(--bg); }
.menu-item.current { background: var(--bg); }
.menu-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.menu-label { flex: 1; }
.arrow { display: inline-flex; transition: transform 0.2s ease; }
.arrow.open { transform: rotate(90deg); }
.submenu { margin: 0 0 6px 40px; overflow: hidden; }
.submenu.open { animation: slide-open 0.2s ease; }
@keyframes slide-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.submenu a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 0.95rem; }
.submenu a:hover { background: var(--bg); }
.submenu a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.count-badge { background: var(--err-ink); color: var(--panel); border-radius: 999px; font-size: 0.75rem; padding: 1px 8px; }
.menu-group-title { padding: 10px 10px 4px; }
.menu-ext { display: block; padding: 4px 10px; font-size: 0.9rem; }
.menu-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 10px 8px 0; display: grid; gap: 6px; }
.section-blue .menu-icon, .section-blue .card-icon { background: var(--c-blue); }
.section-orange .menu-icon, .section-orange .card-icon { background: var(--c-orange); }
.section-red .menu-icon, .section-red .card-icon { background: var(--c-red); }
.section-purple .menu-icon, .section-purple .card-icon { background: var(--c-purple); }
.section-green .menu-icon, .section-green .card-icon { background: var(--c-green); }
.section-teal .menu-icon, .section-teal .card-icon { background: var(--c-teal); }
.section-grey .menu-icon, .section-grey .card-icon { background: var(--c-grey); }
.section-cyan .menu-icon, .section-cyan .card-icon { background: var(--c-cyan); }
.section-indigo .menu-icon, .section-indigo .card-icon { background: var(--c-indigo); }
.section-brown .menu-icon, .section-brown .card-icon { background: var(--c-brown); }

.console-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
/* A fixed width, so the controls beside it do not shift as the time ticks. */
.topbar .updated { display: inline-block; min-width: 12em; text-align: right; font-variant-numeric: tabular-nums; }
.title-block h1 { font-size: 1.35rem; margin: 0; }
.title-block p { margin: 0; }
.top-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.top-tools select { width: auto; padding: 6px 10px; }
.compact { margin: 0; font-weight: 400; }
.icon-btn { min-height: 40px; min-width: 40px; margin: 0; padding: 6px; background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.spinning .icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.menu-toggle { display: none; }
.content { padding: 20px; max-width: 1400px; width: 100%; }
.content:focus { outline: none; }

.card { background: var(--panel-2); }
.card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 1.1rem; }
.card-head p { margin: 2px 0 0; }
.card-head > .action, .card-head > button { margin-left: auto; }
.card-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.period-note { display: flex; gap: 4px; align-items: center; }
.tile { text-align: left; color: var(--ink); font: inherit; display: flex; flex-direction: column; gap: 6px; }
button.tile { color: var(--ink); border: 1px solid var(--line); justify-content: flex-start; align-items: stretch; padding: 16px; }
button.tile:not([class*="tint-"]) { background: var(--panel); }
.tile.clickable { cursor: pointer; margin: 0; min-height: 0; border-width: 1px; border-style: solid; font-weight: 400; }
.tile-title { color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.tile .big { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.tint-ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok-ink) 30%, transparent); }
.tint-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn-ink) 30%, transparent); }
.tint-err { background: var(--err-bg); border-color: color-mix(in srgb, var(--err-ink) 30%, transparent); }
.tint-info { background: var(--info-bg); }
.tint-off { background: var(--bg); }
.status { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; font-size: 0.92rem; }
.status.ok { color: var(--ok-ink); }
.status.warn { color: var(--warn-ink); }
.status.err { color: var(--err-ink); }
.status.info { color: var(--info-ink); }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pill { margin: 0; min-height: 34px; padding: 4px 12px; border-radius: 999px; background: transparent; color: var(--brand); border: 1px solid var(--brand); font-weight: 600; font-size: 0.88rem; }
.pill.active { background: var(--brand); color: var(--brand-ink); }
.live { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ok-ink); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-green); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(47 158 68 / 50%); } 50% { box-shadow: 0 0 0 6px rgb(47 158 68 / 0%); } }
.row-between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chart-wrap { margin: 0; }
.chart { width: 100%; height: 120px; display: block; }
.bar-ok { fill: var(--c-green); }
.bar-bad { fill: var(--c-red); }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="off"]) .chart rect { transform-origin: bottom; transform-box: fill-box; animation: grow 0.5s ease-out both; }
  :root:not([data-motion="off"]) .card:hover, :root:not([data-motion="off"]) .tile.clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(0 0 0 / 10%); }
  :root:not([data-motion="off"]) .glow { animation: glow 1.2s ease-out; }
  :root:not([data-motion="off"]) .win { animation: win-in 0.18s ease-out; }
}
/* Cards never move while focused (ACN-08). */
.card:focus-within, .tile:focus-within { transform: none !important; }
.card, .tile { transition: transform 0.15s ease, box-shadow 0.15s ease; }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes glow { 0% { box-shadow: 0 0 0 3px var(--focus); } 100% { box-shadow: none; } }
@keyframes win-in { from { opacity: 0; transform: scale(0.96); } }
.banner { display: flex; gap: 6px; align-items: center; padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-weight: 600; text-decoration: none; }
.banner.urgent { background: var(--err-bg); color: var(--err-ink); }
.banner.action { background: var(--warn-bg); color: var(--warn-ink); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px; color: var(--muted); }
.empty p { margin: 6px 0 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form label { margin: 0; }
.inline-form input, .inline-form select { width: auto; min-width: 200px; }
.inline-form button { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: flex-start; }
.action .notice { margin: 6px 0; }
.preview { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 0.9rem; }
.switch-card .action button { margin-top: 4px; }
.tour { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 380px; box-shadow: 0 10px 30px rgb(0 0 0 / 25%); }
.tour-target { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
/* Behind the focused window, the screen dims and blurs slightly (ACN-14). */
body:has(.win:focus-within) .content { filter: blur(1px) brightness(0.96); }
@media (max-width: 900px) {
  .console { grid-template-columns: 1fr; }
  .menu { position: fixed; z-index: 30; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 30px rgb(0 0 0 / 30%); }
  body.menu-open .menu { transform: none; }
  .menu-toggle { display: inline-flex; margin: 0; }
  .content { padding: 14px; }
}

/* Guide pages (GDE-08): colourful, readable, with screenshots. */
.shot { margin: 8px 0 20px; }
.shot img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
#guide-results { list-style: none; padding: 0; }
#guide-results li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.guide main h2 { border-left: 5px solid var(--brand); padding-left: 10px; }
