/* TBYM Academy — academy.tbymuk.org
 * One stylesheet for the volunteer site and Academy Connect.
 * Colours follow RELAY (TBYM blue #09517C). Light and dark. */

:root {
  --brand: #09517c; --brand-dark: #073a5a; --brand-ink: #ffffff; --brand-pale: #e8f4f8; --brand-line: #c5e0ed;
  --bg: #f4f7f9; --surface: #ffffff; --surface-2: #f8fafb; --line: #dde3e8; --line-strong: #c3ccd4;
  --text: #1f2d3a; --muted: #5a6c7d; --faint: #8a98a5;
  --ok: #2e7d32; --ok-bg: #eaf5ea; --warn: #9a5a00; --warn-bg: #fdf3e1; --bad: #c62828; --bad-bg: #fdecec;
  --teal: #0f766e; --teal-bg: #e6f6f4; --purple: #6b3fa0; --purple-bg: #f2ecfa;
  --focus: #ffbf47;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 4px 14px rgba(16, 40, 60, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #5aa9d6; --brand-dark: #3d8fbf; --brand-ink: #06131c; --brand-pale: #12283a; --brand-line: #1e4058;
    --bg: #0d1419; --surface: #141d24; --surface-2: #19242c; --line: #26333d; --line-strong: #34444f;
    --text: #e4ebf0; --muted: #9fb0bd; --faint: #73848f;
    --ok: #6cc070; --ok-bg: #15281a; --warn: #e7a74a; --warn-bg: #2b2112; --bad: #f07a7a; --bad-bg: #2e1616;
    --teal: #4fc3b7; --teal-bg: #10282a; --purple: #b994e8; --purple-bg: #221a30;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #5aa9d6; --brand-dark: #3d8fbf; --brand-ink: #06131c; --brand-pale: #12283a; --brand-line: #1e4058;
  --bg: #0d1419; --surface: #141d24; --surface-2: #19242c; --line: #26333d; --line-strong: #34444f;
  --text: #e4ebf0; --muted: #9fb0bd; --faint: #73848f;
  --ok: #6cc070; --ok-bg: #15281a; --warn: #e7a74a; --warn-bg: #2b2112; --bad: #f07a7a; --bad-bg: #2e1616;
  --teal: #4fc3b7; --teal-bg: #10282a; --purple: #b994e8; --purple-bg: #221a30;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 1.2em 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-top: .2em; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: .6em 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 20; }
:root[data-theme="dark"] .site-header, :root:not([data-theme="light"]) .site-header { background: #0b2f46; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .site-header { background: var(--brand); } }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .01em; }
.brand img { width: 34px; height: 34px; border-radius: 8px; background: #fff; }
.brand small { display: block; font-weight: 500; font-size: .72rem; opacity: .8; letter-spacing: .08em; text-transform: uppercase; }
.brand:hover { color: #fff; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 8px; font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover, .nav a[aria-current="page"] { background: rgba(255, 255, 255, .14); color: #fff; }
.btn.menu-btn { display: none; }
@media (max-width: 760px) {
  .btn.menu-btn { display: inline-flex; margin-left: auto; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: inherit; flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .site-header.open .nav { display: flex; background: var(--brand); }
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
main { flex: 1; padding: 28px 0 56px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; padding: 18px 0 28px; }
.site-footer .wrap { display: flex; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); } .small { font-size: .88rem; } .tiny { font-size: .78rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--brand); transform: translateY(-1px); color: inherit; }
.card .kicker { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.card h3 { margin: 4px 0 6px; }
.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.meter.ok > i { background: var(--ok); }
.hero { background: linear-gradient(135deg, var(--brand) 0%, #0d6b9f 100%); color: #fff; border-radius: 14px; padding: 32px 28px; margin-bottom: 28px; }
.hero h1 { color: #fff; } .hero .lead { color: rgba(255, 255, 255, .88); }
.hero .btn { background: #fff; color: #09517c; border-color: #fff; }
.stat { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat small { font-size: .9rem; font-weight: 500; color: var(--muted); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pill.brand { background: var(--brand-pale); color: var(--brand); border-color: transparent; }

/* ---------- Buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: .95rem; padding: 10px 18px; border-radius: 8px; border: 1.5px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--brand-ink); }
.btn.secondary { background: transparent; color: var(--brand); }
.btn.secondary:hover { background: var(--brand-pale); color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); padding: 8px 10px; }
.btn.ghost:hover { background: var(--brand-pale); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .86rem; }
.btn[disabled], .btn.busy { opacity: .55; cursor: not-allowed; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .86rem; display: block; margin-top: 2px; }
input[type=text], input[type=email], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-weight: 500; }
.form-ok { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-weight: 500; }

/* ---------- Notices (and the old course boxes) ---------- */
.notice, .info-box, .tbym-box, .success-box, .warning-box, .danger-box, .teal-box {
  border-radius: 0 8px 8px 0; padding: 14px 16px; margin: 16px 0; border-left: 4px solid var(--brand); background: var(--brand-pale);
}
.notice > :first-child, .info-box > :first-child, .tbym-box > :first-child, .success-box > :first-child, .warning-box > :first-child, .danger-box > :first-child, .teal-box > :first-child { margin-top: 0; }
.notice > :last-child, .info-box > :last-child, .tbym-box > :last-child, .success-box > :last-child, .warning-box > :last-child, .danger-box > :last-child, .teal-box > :last-child { margin-bottom: 0; }
.tbym-box { background: var(--surface-2); border-left-color: var(--brand); }
.notice.ok, .success-box { background: var(--ok-bg); border-left-color: var(--ok); }
.notice.warn, .warning-box { background: var(--warn-bg); border-left-color: var(--warn); }
.notice.bad, .danger-box { background: var(--bad-bg); border-left-color: var(--bad); }
.teal-box { background: var(--teal-bg); border-left-color: var(--teal); }

/* ---------- Rich content (presentations, courses) ---------- */
.content { font-size: 1.02rem; }
.content ul, .content ol { padding-left: 1.4em; } .content li { margin: .35em 0; }
.content figure { margin: 18px 0; } .content figure img { border-radius: 8px; border: 1px solid var(--line); }
.content figcaption { font-size: .86rem; color: var(--muted); margin-top: 6px; }
.content table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: .95rem; }
.content th, .content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.content th { background: var(--surface-2); }
.content [style*="var(--teal)"] { color: var(--teal); }
.two-col, .three-col, .resource-grid, .scenario-grid { display: grid; gap: 16px; margin: 18px 0; }
.two-col { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.three-col { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.resource-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.resource-card, .step-card, .stigma-card, .scenario-card, .care-step, .meter-block, .scale-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 12px 0; }
.two-col > *, .three-col > *, .resource-grid > * { margin: 0; }
.care-step { display: flex; gap: 14px; align-items: flex-start; }
.care-letter, .p-num { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.principle-row { display: flex; gap: 14px; align-items: flex-start; margin: 14px 0; }
.p-title { font-weight: 700; } .p-desc { color: var(--muted); }
.tag, .scenario-badge, .condition-badge, [class*="badge-"] { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--brand-pale); color: var(--brand); }
.badge-critical, .badge-red { background: var(--bad-bg); color: var(--bad); }
.badge-moderate, .badge-amber { background: var(--warn-bg); color: var(--warn); }
.badge-routine, .badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.pathway-flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pathway-step { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.hidden { display: none !important; }
.embed { position: relative; padding-top: 59.3%; border-radius: 10px; overflow: hidden; background: #000; margin: 16px 0; border: 1px solid var(--line); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Presentation viewer ---------- */
.deck { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .deck { grid-template-columns: 1fr; } .deck-toc { display: none; } .deck-toc.open { display: block; } }
.deck-toc { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; padding: 8px; }
.deck-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.deck-toc li a { display: flex; gap: 8px; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: .9rem; line-height: 1.35; }
.deck-toc li a::before { counter-increment: s; content: counter(s); color: var(--faint); min-width: 1.6em; font-variant-numeric: tabular-nums; }
.deck-toc li a.seen::after { content: "✓"; margin-left: auto; color: var(--ok); }
.deck-toc li a[aria-current="true"] { background: var(--brand-pale); color: var(--brand); font-weight: 600; }
.slide { min-height: 340px; padding: 28px clamp(18px, 4vw, 40px); }
.slide h2.slide-title { margin-top: 0; font-size: clamp(1.3rem, 3vw, 1.7rem); color: var(--brand); }
.deck-bar { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.deck-bar .count { color: var(--muted); font-variant-numeric: tabular-nums; margin: 0 auto; }
.notes { margin-top: 18px; } .notes summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.ack { margin-top: 22px; padding: 14px 16px; border: 1.5px dashed var(--brand-line); border-radius: 8px; background: var(--surface-2); }

/* ---------- Questions ---------- */
.section-head { margin: 34px 0 10px; }
.section-head:first-child { margin-top: 0; }
.context { background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 0 8px 8px 0; padding: 12px 16px; margin-bottom: 14px; }
.context p { margin: .3em 0; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.q legend { font-weight: 600; padding: 0; margin-bottom: 8px; font-size: 1.02rem; }
.q fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q .num { color: var(--muted); font-weight: 500; margin-right: 6px; }
.opt { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; font-size: 1rem; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; margin: 8px 0; cursor: pointer; background: var(--surface); }
.opt:hover { border-color: var(--brand-line); background: var(--surface-2); }
.opt input { width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-pale); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.q.got { border-left: 4px solid var(--ok); } .q.missed { border-left: 4px solid var(--bad); } .q.partly { border-left: 4px solid var(--warn); }
.q .verdict { font-size: .86rem; font-weight: 600; margin-top: 8px; }
.q.info { background: var(--brand-pale); border-color: transparent; }
.result { text-align: center; padding: 28px 20px; }
.result .big { font-size: clamp(2.6rem, 8vw, 3.6rem); font-weight: 800; color: var(--brand); line-height: 1; }
.sticky-submit { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); padding: 12px 0; border-top: 1px solid var(--line); margin-top: 20px; }

/* ---------- Practice blocks ---------- */
.practice, .scenario { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 18px 0; background: var(--surface); }
.practice h3, .scenario h3 { margin-top: 0; }
.choice { display: block; width: 100%; text-align: left; font: inherit; padding: 12px 14px; margin: 8px 0; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
.choice:hover:not([disabled]) { border-color: var(--brand); background: var(--surface-2); }
.choice.good, .choice.picked-right { border-color: var(--ok); background: var(--ok-bg); }
.choice.okay { border-color: var(--warn); background: var(--warn-bg); }
.choice.poor, .choice.picked-wrong { border-color: var(--bad); background: var(--bad-bg); }
.choice[disabled] { cursor: default; }
.chat { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 14px; }
.bubble .who { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .75; margin-bottom: 2px; }
.bubble.user { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble.vol { background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; align-self: flex-end; }
.scenario-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.scenario-pick { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.scenario-pick:hover { border-color: var(--brand); }
.scenario-pick .icon { font-size: 1.4rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Certificate ---------- */
.certificate { background: #fff; color: #1f2d3a; border: 10px double #09517c; border-radius: 6px; padding: clamp(24px, 6vw, 56px); text-align: center; max-width: 820px; margin: 0 auto; }
.certificate img { width: 74px; }
.certificate .k { letter-spacing: .2em; text-transform: uppercase; color: #5a6c7d; font-size: .8rem; }
.certificate h1 { font-family: Georgia, "Times New Roman", serif; color: #09517c; font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 10px 0; }
.certificate .who { font-family: Georgia, serif; font-size: clamp(1.5rem, 4vw, 2rem); border-bottom: 1px solid #c3ccd4; display: inline-block; padding: 0 18px 6px; margin: 10px 0 18px; }
@media print {
  .site-header, .site-footer, .no-print { display: none !important; }
  body, main { background: #fff; padding: 0; }
  .certificate { border-color: #09517c; box-shadow: none; }
}

/* ---------- Toast and dialogs ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; z-index: 100; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
dialog { border: 0; border-radius: 12px; padding: 0; max-width: min(560px, calc(100% - 32px)); width: 100%; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 25, 35, .5); }
dialog .dlg { padding: 22px; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------- Academy Connect ---------- */
.connect-shell { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .connect-shell { grid-template-columns: 1fr; } }
.side-nav { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 860px) { .side-nav { position: static; flex-direction: row; flex-wrap: wrap; } }
.side-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; }
.side-nav a:hover { background: var(--surface); }
.side-nav a[aria-current="page"] { background: var(--brand-pale); color: var(--brand); font-weight: 700; }
.side-nav .count { margin-left: 6px; }
.editor-block { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 10px 0; }
.editor-block > header { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: 8px 8px 0 0; font-size: .86rem; font-weight: 600; color: var(--muted); flex-wrap: wrap; }
.editor-block > header .spacer { flex: 1; }
.editor-block > .body { padding: 12px; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border: 1.5px solid var(--line-strong); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--surface-2); }
.rte-bar button { font: inherit; font-size: .84rem; border: 0; background: none; color: var(--text); padding: 5px 9px; border-radius: 5px; cursor: pointer; }
.rte-bar button:hover { background: var(--line); }
.rte { min-height: 120px; border: 1.5px solid var(--line-strong); border-radius: 0 0 8px 8px; padding: 12px 14px; background: var(--surface); }
.rte:focus { outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); border-color: var(--brand); }
textarea.code { font-family: var(--mono); font-size: .84rem; min-height: 200px; }
.q-edit { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 10px 0; }
.q-edit > summary { list-style: none; cursor: pointer; padding: 10px 14px; display: flex; gap: 10px; align-items: baseline; }
.q-edit > summary::-webkit-details-marker { display: none; }
.q-edit > summary .t { flex: 1; font-weight: 500; }
.q-edit[open] > summary { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.q-edit .body { padding: 12px 14px; }
.opt-edit { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin: 6px 0; }
.opt-edit input[type=checkbox], .opt-edit input[type=radio] { width: 20px; height: 20px; accent-color: var(--ok); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0; flex-wrap: wrap; }
.tabs button { font: inherit; border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.savebar { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 20px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.savebar .state { margin-right: auto; color: var(--muted); font-size: .9rem; }
.email-preview { width: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* The router focuses <main> after each page change (for screen readers); no ring for that. */
#app:focus { outline: none; }
