/* CuresSync Audiobook Studio — design system
   One stylesheet, hand-written, no build step. Light + dark via tokens:
   dark is the default under prefers-color-scheme; [data-theme] on <html> wins. */

/* ──────────────────────────────────────────── Tokens ──────────────────────── */
:root {
  --bg: #fbfafc;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #ffe7ea 0%, transparent 55%),
             radial-gradient(1000px 500px at 100% 0%, #ffefe6 0%, transparent 50%);
  --surface: #ffffff;
  --surface-2: #f1f2f8;
  --surface-3: #e9eaf3;
  --border: #e4e5ef;
  --border-strong: #d2d4e3;
  --text: #15151f;
  --muted: #6a6b7e;
  --faint: #9a9bb0;
  --accent: #e1304f;
  --accent-ink: #c21f3c;
  --accent-soft: #fdebef;
  --accent-contrast: #ffffff;
  --pink: #ff7e5f;
  --amber: #f5a524;
  --green: #17b26a;
  --red: #e5484d;
  --ok-bg: #e7f8ef; --ok-fg: #0a7a47;
  --warn-bg: #fff3df; --warn-fg: #94630a;
  --err-bg: #fdeaea; --err-fg: #b42318;
  --info-bg: #eaf1ff; --info-fg: #2a52b5;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --shadow-sm: 0 1px 2px rgba(20,20,40,.06), 0 1px 3px rgba(20,20,40,.06);
  --shadow-md: 0 6px 24px -8px rgba(30,25,70,.18);
  --shadow-lg: 0 24px 60px -20px rgba(30,25,70,.32);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --maxw: 1120px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] { color-scheme: dark; }

/* Dark token overrides, applied for both the OS preference and the explicit toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a0b;
    --bg-grad: radial-gradient(1200px 600px at 12% -10%, #2a1016 0%, transparent 55%),
               radial-gradient(1000px 520px at 100% 0%, #291510 0%, transparent 52%);
    --surface: #17141a;
    --surface-2: #211b22;
    --surface-3: #2c242e;
    --border: #352b34;
    --border-strong: #463a44;
    --text: #f1ecef;
    --muted: #b6a9b0;
    --faint: #83737c;
    --accent: #ff5d78;
    --accent-ink: #ff90a4;
    --accent-soft: #3a1620;
    --accent-contrast: #1b0b10;
    --ok-bg: #0f2c20; --ok-fg: #54e0a0;
    --warn-bg: #2e2410; --warn-fg: #f3c777;
    --err-bg: #2f1518; --err-fg: #ff9ea1;
    --info-bg: #141e38; --info-fg: #9db8ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 28px -10px rgba(0,0,0,.6);
    --shadow-lg: 0 30px 70px -24px rgba(0,0,0,.72);
  }
}
:root[data-theme="dark"] {
  --bg: #0c0a0b;
  --bg-grad: radial-gradient(1200px 600px at 12% -10%, #2a1016 0%, transparent 55%),
             radial-gradient(1000px 520px at 100% 0%, #291510 0%, transparent 52%);
  --surface: #17141a;
  --surface-2: #211b22;
  --surface-3: #2c242e;
  --border: #352b34;
  --border-strong: #463a44;
  --text: #f1ecef;
  --muted: #b6a9b0;
  --faint: #83737c;
  --accent: #ff5d78;
  --accent-ink: #ff90a4;
  --accent-soft: #3a1620;
  --accent-contrast: #1b0b10;
  --ok-bg: #0f2c20; --ok-fg: #54e0a0;
  --warn-bg: #2e2410; --warn-fg: #f3c777;
  --err-bg: #2f1518; --err-fg: #ff9ea1;
  --info-bg: #141e38; --info-fg: #9db8ff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 28px -10px rgba(0,0,0,.6);
  --shadow-lg: 0 30px 70px -24px rgba(0,0,0,.72);
}

/* ──────────────────────────────────────────── Base ────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; margin-top: 2rem; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: .5rem 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .82rem; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ──────────────────────────────────────────── App shell ───────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(140%) blur(12px);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar__in {
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 1.25rem;
  display: flex; align-items: center; gap: 1.25rem;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800;
  letter-spacing: -.02em; color: var(--text); font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--pink));
  box-shadow: var(--shadow-sm); flex: none;
}
.brand__mark svg { width: 17px; height: 17px; }
.nav { display: flex; align-items: center; gap: .25rem; }
.nav a {
  color: var(--muted); font-weight: 600; font-size: .9rem;
  padding: .4rem .7rem; border-radius: 9px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.is-active { color: var(--accent-ink); background: var(--accent-soft); }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .6rem; color: var(--muted);
  font-size: .86rem; }
.ws-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .6rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  font-weight: 600; color: var(--text); font-size: .82rem;
}
.ws-chip .dot { width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); flex: none; }

.theme-toggle {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; display: grid;
  place-items: center; flex: none;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
:root[data-theme="dark"] .theme-toggle .i-sun,
:root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon,
:root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
.theme-toggle .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme]) .theme-toggle .i-moon { display: none; }
}

/* content container */
.page { max-width: var(--maxw); margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.page--narrow { max-width: 560px; }
.page--wide { max-width: var(--maxw); }

/* ──────────────────────────────────────────── Toasts / messages ──────────── */
.toasts { position: fixed; top: 4.2rem; right: 1rem; z-index: 60; display: flex;
  flex-direction: column; gap: .5rem; max-width: 380px; }
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 12px; padding: .7rem .9rem;
  box-shadow: var(--shadow-md); font-size: .9rem; display: flex; gap: .55rem;
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--amber); }
.toast.info { border-left-color: var(--accent); }

.note { border-radius: 12px; padding: .7rem .9rem; margin: .6rem 0; font-size: .9rem;
  border: 1px solid transparent; }
.note.info { background: var(--info-bg); color: var(--info-fg); }
.note.success { background: var(--ok-bg); color: var(--ok-fg); }
.note.warning { background: var(--warn-bg); color: var(--warn-fg); }
.note.error { background: var(--err-bg); color: var(--err-fg); }

/* ──────────────────────────────────────────── Buttons ────────────────────── */
.btn, button {
  font-family: inherit; font-size: .9rem; font-weight: 650; cursor: pointer;
  border: 1px solid transparent; border-radius: 11px; padding: .55rem 1rem;
  display: inline-flex; align-items: center; gap: .45rem; line-height: 1.1;
  background: var(--accent); color: var(--accent-contrast); text-decoration: none;
  transition: transform .04s ease, filter .15s ease, background .15s ease;
}
.btn:hover, button:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn--ghost, button.btn--ghost {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-2); filter: none; }
.btn--soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn--soft:hover { filter: none; background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 14%); }
.btn--sm { padding: .38rem .7rem; font-size: .82rem; border-radius: 9px; }
.btn--lg { padding: .75rem 1.3rem; font-size: 1rem; border-radius: 13px; }
.btn--block { display: flex; width: 100%; justify-content: center; }
.btn--danger { background: var(--red); }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; }
.linkish { background: none; border: none; color: var(--accent-ink); padding: 0;
  font-weight: 600; }
.linkish:hover { filter: none; text-decoration: underline; }
.backlink { color: var(--muted); font-weight: 600; font-size: .88rem; }

/* ──────────────────────────────────────────── Cards & layout ─────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 1rem; }
.card__head { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: .75rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.spread { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.spread__main { flex: 1 1 420px; min-width: 300px; }
.spread__side { flex: 0 0 300px; }
@media (max-width: 760px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .spread__side { flex-basis: 100%; }
}

/* page header block */
.pagehead { margin-bottom: 1.4rem; }
.pagehead .eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem;
  font-weight: 700; color: var(--accent-ink); }
.pagehead p.sub { color: var(--muted); margin-top: .15rem; }
.crumbs { color: var(--faint); font-size: .84rem; margin-bottom: .6rem; }
.crumbs a { color: var(--muted); }

/* ──────────────────────────────────────────── Badges ─────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem;
  border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .01em;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge--ok { background: var(--ok-bg); color: var(--ok-fg); border-color: transparent; }
.badge--warn { background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; }
.badge--err { background: var(--err-bg); color: var(--err-fg); border-color: transparent; }
.badge--accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ──────────────────────────────────────────── Forms ──────────────────────── */
.field { margin: .85rem 0; }
label { display: block; font-size: .82rem; font-weight: 650; margin: 0 0 .3rem;
  color: var(--text); }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: .92rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 11px; padding: .6rem .7rem; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
textarea { resize: vertical; min-height: 5rem; }
::placeholder { color: var(--faint); }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.help { color: var(--muted); font-size: .84rem; }

/* auth card */
.auth { max-width: 420px; margin: 3.5rem auto; }
.auth .card { padding: 1.75rem; }
.auth h1 { font-size: 1.35rem; }

/* ──────────────────────────────────────────── Tables ─────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); font-weight: 700; padding: .7rem .9rem;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
tbody td { padding: .7rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.table-empty { color: var(--muted); text-align: center; padding: 1.5rem; }

/* ──────────────────────────────────────────── Steps / pipeline ───────────── */
.steps { display: flex; gap: .5rem; flex-wrap: wrap; margin: .25rem 0 0; }
.step {
  display: flex; align-items: center; gap: .45rem; padding: .35rem .7rem;
  border: 1px solid var(--border); border-radius: 999px; font-size: .8rem;
  color: var(--muted); background: var(--surface);
}
.step .n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.step.done { color: var(--ok-fg); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.step.done .n { background: var(--green); color: #fff; }
.step.current { color: var(--accent-ink); border-color: var(--accent);
  background: var(--accent-soft); }
.step.current .n { background: var(--accent); color: #fff; }

/* meter */
.meter { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--pink)); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ──────────────────────────────────────────── Cover art ──────────────────── */
.cover {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius);
  background: linear-gradient(145deg,
    hsl(var(--h, 265) 78% 62%), hsl(calc(var(--h, 265) + 40) 72% 48%));
  box-shadow: var(--shadow-md); overflow: hidden; display: flex; flex-direction: column;
  justify-content: flex-end; padding: .85rem; color: #fff; isolation: isolate;
}
.cover::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 80% at 20% 0%, rgba(255,255,255,.28), transparent 60%);
}
.cover__title { font-weight: 800; font-size: 1rem; line-height: 1.15;
  text-shadow: 0 1px 10px rgba(0,0,0,.25); letter-spacing: -.01em; }
.cover__by { font-size: .76rem; opacity: .9; margin-top: .15rem; }
.cover__locale { position: absolute; top: .6rem; left: .6rem; font-size: .68rem;
  font-weight: 700; background: rgba(0,0,0,.28); padding: .12rem .5rem; border-radius: 999px;
  letter-spacing: .04em; backdrop-filter: blur(4px); }
.cover__wave { position: absolute; top: .6rem; right: .6rem; display: flex; gap: 2px;
  align-items: flex-end; height: 16px; opacity: .85; }
.cover__wave i { width: 3px; background: #fff; border-radius: 2px; animation: eq 1.1s ease-in-out infinite; }
.cover__wave i:nth-child(1){height:40%;animation-delay:-.2s}
.cover__wave i:nth-child(2){height:80%;animation-delay:-.5s}
.cover__wave i:nth-child(3){height:55%;animation-delay:-.1s}
.cover__wave i:nth-child(4){height:95%;animation-delay:-.7s}
@keyframes eq { 0%,100%{transform:scaleY(.5)} 50%{transform:scaleY(1)} }
@media (prefers-reduced-motion: reduce){ .cover__wave i{animation:none} }

/* ──────────────────────────────────────────── Marketplace ────────────────── */
.hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)),
    color-mix(in srgb, var(--pink) 12%, var(--surface)));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 2.4rem 2rem; margin-bottom: 1.75rem; box-shadow: var(--shadow-sm);
}
.hero h1 { font-size: 2.15rem; max-width: 18ch; }
.hero p { color: var(--muted); font-size: 1.02rem; max-width: 52ch; }
.hero .row { margin-top: 1.1rem; }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1.25rem; }
.toolbar input[type="search"] { max-width: 320px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: .84rem; font-weight: 600;
  cursor: pointer; }
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.chip.is-active { background: var(--accent); color: var(--accent-contrast);
  border-color: transparent; }

.catalog { display: grid; gap: 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.book { display: block; color: inherit; }
.book:hover { text-decoration: none; }
.book:hover .cover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.book .cover { transition: transform .18s ease, box-shadow .18s ease; }
.book__meta { margin-top: .55rem; }
.book__title { font-weight: 700; font-size: .92rem; line-height: 1.25; }
.book__by { color: var(--muted); font-size: .82rem; }
.book__row { display: flex; align-items: center; justify-content: space-between;
  margin-top: .25rem; }
.price { font-weight: 800; font-size: .88rem; }
.price--free { color: var(--green); }

.empty {
  text-align: center; padding: 3.5rem 1rem; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: .5rem; }

/* detail */
.detail-grid { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; align-items: start; }
.detail-grid .cover { aspect-ratio: 2/3; }
@media (max-width: 720px) { .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .cover { max-width: 220px; } }

/* sample player */
.player {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow-sm);
}
.player__bar { display: flex; align-items: center; gap: .75rem; }
.player__play {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-contrast); border: none; flex: none;
  box-shadow: var(--shadow-md);
}
.player__play svg { width: 20px; height: 20px; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 34px; overflow: hidden; }
.wave i { flex: 1; min-width: 2px; background: var(--surface-3); border-radius: 2px;
  transition: background .12s, height .12s; }
.wave i.on { background: linear-gradient(var(--accent), var(--pink)); }
.sample-lines { margin-top: 1rem; display: flex; flex-direction: column; gap: .1rem; }
.sample-line { padding: .5rem .6rem; border-radius: 10px; border: 1px solid transparent; }
.sample-line.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.sample-line .spk { font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent-ink); }
.sample-line[dir="rtl"] { text-align: right; }

/* preview player (studio) reused styles */
.pv-blocks { list-style: none; padding: 0; margin: 1rem 0; }
.pv-blocks li { padding: .55rem .65rem; border-radius: 10px; margin: .15rem 0;
  cursor: pointer; border: 1px solid transparent; }
.pv-blocks li:hover { background: var(--surface-2); }
.pv-blocks li.pv-current { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pv-blocks li.pv-missing { opacity: .45; cursor: default; }
.pv-blocks .pv-spk { font-size: .72rem; font-weight: 800; color: var(--accent-ink);
  text-transform: uppercase; letter-spacing: .04em; }
.pv-blocks .pv-dir { font-size: .8rem; color: var(--muted); font-style: italic; }
.pv-chapters { flex: 0 0 190px; min-width: 160px; font-size: .9rem; }
.pv-chapters ol { list-style: none; padding: 0; margin: .5rem 0; }
.pv-chapters a { display: block; padding: .32rem .45rem; border-radius: 8px;
  color: var(--muted); }
.pv-chapters a:hover { background: var(--surface-2); text-decoration: none; }
.pv-chapters a.pv-current { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.pv-toolbar { position: sticky; top: 58px; background: var(--surface); z-index: 1;
  padding: .6rem; border: 1px solid var(--border); border-radius: 12px;
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
pre.preview { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem; max-height: 420px; overflow: auto; font-size: .86rem; }
.tag-adapted { background: var(--warn-bg); color: var(--warn-fg); padding: .1rem .5rem;
  border-radius: 6px; font-size: .72rem; font-weight: 700; vertical-align: middle; }

footer.foot { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 3rem;
  color: var(--faint); font-size: .82rem; border-top: 1px solid var(--border); }

/* ─── Legacy-class shims ─────────────────────────────────────────────────────
   Pages that still use the older markup (`.msg` flash boxes, `.selected` rows)
   pick up the current theme without needing a rewrite. */
.msg { border-radius: 12px; padding: .7rem .9rem; margin: .6rem 0; font-size: .9rem;
  border: 1px solid transparent; background: var(--surface-2); color: var(--text); }
.msg.info { background: var(--info-bg); color: var(--info-fg); }
.msg.success { background: var(--ok-bg); color: var(--ok-fg); }
.msg.warning { background: var(--warn-bg); color: var(--warn-fg); }
.msg.error { background: var(--err-bg); color: var(--err-fg); }
tr.selected, tr.selected:hover { background: var(--accent-soft); }
details > summary { cursor: pointer; }
