/* =========================================================================
   Glassmorphism design system for the Teratogen Study app.
   Written once here so every module's templates stay visually coherent.
   Dark animated gradient backdrop + frosted translucent panels + light text.
   ========================================================================= */

:root {
  /* Palette */
  --bg-0: #0b1020;
  --bg-1: #131a36;
  --grad-a: #5b8def;
  --grad-b: #7b61ff;
  --grad-c: #21d4c2;
  --grad-d: #f078b6;

  --text: #eef2ff;
  --text-dim: #aeb8d8;
  --text-faint: #7c87ad;

  --accent: #7aa2ff;
  --accent-2: #36e0c8;
  --danger: #ff7a8a;
  --warn: #ffce6b;
  --ok: #66e6a6;

  /* Glass surfaces */
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-border-strong: rgba(255, 255, 255, 0.28);
  --glass-shadow: 0 8px 32px rgba(2, 6, 23, 0.45);
  --blur: 16px;

  --radius: 18px;
  --radius-sm: 12px;
  --gap: 18px;
  --maxw: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  background-image:
    radial-gradient(40rem 40rem at 8% -8%, rgba(91, 141, 239, 0.45), transparent 60%),
    radial-gradient(36rem 36rem at 100% 0%, rgba(123, 97, 255, 0.40), transparent 55%),
    radial-gradient(44rem 44rem at 50% 120%, rgba(33, 212, 194, 0.30), transparent 60%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: var(--gap);
  padding: 12px clamp(14px, 4vw, 40px);
  background: rgba(11, 16, 32, 0.55);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  border-bottom: 1px solid var(--glass-border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--grad-a), var(--grad-b), var(--grad-c), var(--grad-d), var(--grad-a));
  box-shadow: 0 0 18px rgba(123, 97, 255, .8);
}
.brand small { color: var(--text-faint); font-weight: 500; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-sub { color: var(--text-faint); font-weight: 500; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: 8px; }
.nav a {
  color: var(--text-dim); padding: 7px 13px; border-radius: 999px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; transition: all .15s ease;
}
.nav a:hover { color: var(--text); background: var(--glass-bg); border-color: var(--glass-border); }
.nav a.active {
  color: #fff; background: linear-gradient(120deg, rgba(122,162,255,.35), rgba(54,224,200,.28));
  border-color: var(--glass-border-strong);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 13px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(18px, 3vw, 32px); flex: 1; }

.page-head { margin: 4px 0 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 750; }
.page-head p { margin: 0; color: var(--text-dim); max-width: 70ch; }

/* ---------- Glass panels ---------- */
.glass, .card, .panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(130%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(130%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}
.card { padding: 20px 22px; }
.card.strong { background: var(--glass-bg-strong); border-color: var(--glass-border-strong); }
.card h2, .card h3 { margin-top: 0; }
.card h2 { font-size: 18px; }
.card h3 { font-size: 15px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; }

.grid { display: grid; gap: var(--gap); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .split { grid-template-columns: 1fr; }
  .nav { display: none; }
}

/* ---------- Stat tiles ---------- */
.stat { padding: 18px 20px; }
.stat .label { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 30px; font-weight: 750; margin-top: 4px; }
.stat .sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 9px 16px; border-radius: 12px; font-size: 14px; font-weight: 650;
  color: var(--text); background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px); transition: all .15s ease; text-decoration: none;
}
.btn:hover { background: var(--glass-bg-strong); border-color: var(--glass-border-strong); text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(120deg, var(--grad-a), var(--grad-b));
  border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(123,97,255,.35);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-accent { background: linear-gradient(120deg, var(--grad-c), var(--accent-2)); color: #04201d; border-color: transparent; }
.btn-danger { background: linear-gradient(120deg, #ff5d73, #ff8a5b); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field { margin-bottom: 16px; }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=search], select, textarea {
  width: 100%; color: var(--text); font-family: inherit; font-size: 14px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,162,255,.22);
  background: rgba(255,255,255,0.09);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select option { color: #111; }
.help { color: var(--text-faint); font-size: 12px; margin-top: 5px; }
.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.checkrow { display: flex; align-items: center; gap: 8px; }
.checkrow input { width: auto; }
.checkrow label { margin: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 9px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); }
table.data th { color: var(--text-faint); font-weight: 700; text-transform: uppercase; font-size: 11.5px; letter-spacing: .06em; }
table.data tr:hover td { background: rgba(255,255,255,.04); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; border: 1px solid var(--glass-border); }
.badge.ok { color: var(--ok); background: rgba(102,230,166,.12); border-color: rgba(102,230,166,.3); }
.badge.err, .badge.danger { color: var(--danger); background: rgba(255,122,138,.12); border-color: rgba(255,122,138,.3); }
.badge.warn, .badge.pending { color: var(--warn); background: rgba(255,206,107,.12); border-color: rgba(255,206,107,.3); }
.badge.info { color: var(--accent); background: rgba(122,162,255,.12); border-color: rgba(122,162,255,.3); }
.badge.muted { color: var(--text-faint); }

/* ---------- Progress ---------- */
.progress { height: 12px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; border: 1px solid var(--glass-border); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--grad-a), var(--grad-c)); transition: width .4s ease; }
.progress.err > span { background: linear-gradient(90deg, #ff5d73, #ff8a5b); }

/* ---------- Matrix grid ---------- */
.matrix { display: grid; gap: 6px; }
.matrix .cell { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.cell.done { background: rgba(102,230,166,.25); }
.cell.pending { background: rgba(255,255,255,.05); }
.cell.error { background: rgba(255,122,138,.3); }
.cell.partial { background: rgba(255,206,107,.25); }

/* ---------- Code / mono blocks ---------- */
.mono { font-family: var(--mono); font-size: 12.5px; }
pre.log, .copybox {
  font-family: var(--mono); font-size: 12.5px; color: var(--text-dim);
  background: rgba(0,0,0,.32); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); padding: 14px; overflow: auto; white-space: pre-wrap;
  max-height: 320px;
}
.copybox { color: var(--text); white-space: pre-wrap; }

/* ---------- Flash / alerts ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid var(--glass-border); background: var(--glass-bg); }
.flash.success { border-color: rgba(102,230,166,.4); background: rgba(102,230,166,.1); }
.flash.error { border-color: rgba(255,122,138,.4); background: rgba(255,122,138,.1); }
.flash.warn { border-color: rgba(255,206,107,.4); background: rgba(255,206,107,.1); }

/* ---------- Misc ---------- */
.muted { color: var(--text-faint); }
.dim { color: var(--text-dim); }
.right { text-align: right; }
.center { text-align: center; }
.spacer { height: var(--gap); }
.divider { height: 1px; background: var(--glass-border); margin: 18px 0; border: 0; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 32px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card p { color: var(--text-dim); margin: 0 0 22px; font-size: 14px; }

/* Blind coding: hide condition-revealing chrome via a body class */
body.blind .reveal-condition { display: none !important; }

/* ---------- Live "running" indicators (API collection) ---------- */
.live-indicator { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--ok); }
.pulse-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse-ring 1.4s ease-out infinite; }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(102, 230, 166, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(102, 230, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(102, 230, 166, 0); }
}
/* Animated "barber-pole" stripes over the progress fill while a job runs. */
.progress.running > span { position: relative; overflow: hidden; }
.progress.running > span::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(45deg, rgba(255,255,255,.20) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,.20) 50%, rgba(255,255,255,.20) 75%, transparent 75%);
  background-size: 26px 26px; animation: barflow 0.7s linear infinite;
}
@keyframes barflow { from { background-position: 0 0; } to { background-position: 26px 0; } }

/* Colorized worker log lines (classified by app.js / collection poller). */
pre.log .l-req  { color: var(--accent); }
pre.log .l-ok   { color: var(--ok); }
pre.log .l-err  { color: var(--danger); }
pre.log .l-info { color: var(--text-faint); }

/* ---------- Floating "On this page" navigator (auto-built by app.js) ------ */
/* Anchored sections clear the sticky topbar when jumped to. */
h2 { scroll-margin-top: 84px; }

.page-toc {
  position: fixed; top: 76px; right: 14px; z-index: 40;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  max-width: 240px;
}
.page-toc-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 650;
  color: var(--text); background: rgba(11, 16, 32, 0.62);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
}
.page-toc-toggle:hover { border-color: var(--glass-border-strong); color: #fff; }
.page-toc-bars { font-size: 16px; line-height: 1; color: var(--accent); }
.page-toc-list {
  display: none; list-style: none; margin: 0; padding: 8px; width: 240px;
  max-height: 72vh; overflow: auto;
  background: rgba(11, 16, 32, 0.74); border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm); box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
}
.page-toc.open .page-toc-list { display: block; }
.page-toc-list li { margin: 0; }
.page-toc-list a {
  display: block; padding: 6px 10px; border-radius: 8px; font-size: 13px;
  color: var(--text-dim); text-decoration: none; border-left: 2px solid transparent;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page-toc-list a:hover { background: var(--glass-bg); color: var(--text); text-decoration: none; }
.page-toc-list a.active { color: #fff; background: var(--glass-bg); border-left-color: var(--accent); font-weight: 650; }

@media (max-width: 720px) {
  .page-toc { top: auto; bottom: 14px; right: 10px; }
  .page-toc-label { display: none; }
  .page-toc-list { width: 200px; max-height: 60vh; }
}

/* ======================================================================== */
/* Documentation page (/docs): sidebar TOC + live search + readable article. */
/* ======================================================================== */
.doc-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

/* --- Sidebar (sticky): search on top, scrollable TOC below ---------------- */
.doc-sidebar {
  position: sticky;
  top: 74px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 92px);
  min-width: 0;
}
.doc-search { display: flex; flex-direction: column; gap: 8px; }
.doc-search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.doc-search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.18);
}
.doc-search-icon { color: var(--text-faint); flex: 0 0 auto; }
.doc-search-box input {
  flex: 1 1 auto; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 14px; font-family: var(--font);
}
.doc-search-box input::placeholder { color: var(--text-faint); }
.doc-search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.doc-search-clear {
  flex: 0 0 auto; cursor: pointer;
  background: transparent; border: 0; color: var(--text-faint);
  font-size: 18px; line-height: 1; padding: 0 2px; border-radius: 6px;
}
.doc-search-clear:hover { color: var(--text); }
.doc-search-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-dim); padding: 0 2px;
}
.doc-search-count.no-hits { color: var(--danger); }
.doc-search-navbtns { display: inline-flex; gap: 4px; }
.doc-navbtn {
  cursor: pointer; width: 24px; height: 24px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text-dim); font-size: 13px; line-height: 1;
}
.doc-navbtn:hover { color: #fff; border-color: var(--glass-border-strong); }
.doc-search-hint { margin: 0; padding: 0 2px; font-size: 11.5px; color: var(--text-faint); }
.doc-search-hint kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 5px;
  background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-dim);
}

.doc-toc {
  overflow: auto; padding: 4px 2px 8px;
  border-top: 1px solid var(--glass-border);
}
.doc-toc-title {
  margin: 10px 4px 6px; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-faint); font-weight: 700;
}
.doc-toc-list { list-style: none; margin: 0; padding: 0; counter-reset: sec; }
.doc-toc-list > .toc-item { margin: 1px 0; }
.toc-link {
  display: block; padding: 6px 10px; border-radius: 8px; font-size: 13.5px;
  color: var(--text-dim); text-decoration: none; border-left: 2px solid transparent;
  line-height: 1.35;
}
.toc-link:hover { background: var(--glass-bg); color: var(--text); text-decoration: none; }
.toc-link.active {
  color: #fff; background: var(--glass-bg-strong);
  border-left-color: var(--accent); font-weight: 650;
}
.toc-children {
  list-style: none; margin: 2px 0 6px; padding: 0 0 0 12px;
  border-left: 1px solid var(--glass-border);
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height .28s ease, opacity .2s ease;
}
.toc-item.expanded > .toc-children { max-height: 360px; opacity: 1; }
.toc-h3 { font-size: 12.5px; padding: 4px 10px; color: var(--text-faint); }
.toc-h3.active { color: #fff; }
/* Search filtering: dim/hide topics that don't match the query. */
.doc-toc.filtering .toc-item:not(.match) { display: none; }
.doc-toc.filtering .toc-children { max-height: 400px; opacity: 1; }
.doc-toc.filtering .toc-link:not(.match) { opacity: .4; }

/* --- Article ------------------------------------------------------------- */
.doc-content { min-width: 0; max-width: 60rem; padding-bottom: 40px; }
.doc-head { margin-bottom: 6px; }
.doc-eyebrow {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-2); font-weight: 700;
}
.doc-title {
  margin: 6px 0 8px; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15;
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.doc-lede { margin: 0 0 8px; color: var(--text-dim); font-size: 15px; max-width: 52rem; }

.doc-body { font-size: 15.5px; line-height: 1.72; color: var(--text-dim); }
.doc-body :is(h2, h3) { scroll-margin-top: 84px; color: var(--text); }
.doc-h2 {
  margin: 34px 0 12px; padding-top: 18px; font-size: 22px; line-height: 1.25;
  border-top: 1px solid var(--glass-border); font-weight: 750;
}
.doc-body > .doc-h2:first-child { border-top: 0; padding-top: 0; margin-top: 6px; }
.doc-h3 { margin: 22px 0 8px; font-size: 16.5px; font-weight: 700; color: var(--accent); }
.doc-anchor {
  margin-left: 8px; color: var(--text-faint); text-decoration: none;
  font-weight: 400; opacity: 0; transition: opacity .12s ease; font-size: .8em;
}
:is(.doc-h2, .doc-h3):hover .doc-anchor { opacity: 1; }
.doc-body p { margin: 0 0 14px; }
.doc-body strong { color: var(--text); font-weight: 700; }
.doc-body em { color: var(--text); }
.doc-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(122,162,255,.35); }
.doc-body a:hover { border-bottom-color: var(--accent); }
.doc-body code {
  font-family: var(--mono); font-size: .86em; padding: 1.5px 6px; border-radius: 6px;
  background: rgba(255,255,255,.08); border: 1px solid var(--glass-border); color: #e6ecff;
  word-break: break-word;
}
.doc-body ul, .doc-body ol { margin: 0 0 15px; padding-left: 24px; }
.doc-body li { margin: 5px 0; }
.doc-body li > ul, .doc-body li > ol { margin: 6px 0 4px; }
.doc-rule { border: 0; height: 1px; background: var(--glass-border); margin: 26px 0; }
/* The <hr>s between sections are redundant with the h2 top border -- hide them. */
.doc-body > .doc-rule { display: none; }

.doc-callout {
  margin: 6px 0 16px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent-2);
}
.doc-callout > :first-child { margin-top: 0; }
.doc-callout > :last-child { margin-bottom: 0; }
.doc-callout p:first-child strong { color: var(--accent-2); }
.doc-callout ul, .doc-callout ol { margin-bottom: 0; }

/* --- Search highlight ---------------------------------------------------- */
mark.doc-hit {
  background: rgba(255, 206, 107, 0.30); color: #fff;
  border-radius: 3px; padding: 0 1px; box-shadow: 0 0 0 1px rgba(255,206,107,.35);
}
mark.doc-hit.current {
  background: var(--warn); color: #1a1206; box-shadow: 0 0 0 2px rgba(255,206,107,.6);
}
.doc-empty {
  margin: 8px 0 14px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(255,122,138,.10); border: 1px solid rgba(255,122,138,.35);
  color: var(--text); font-size: 14px;
}

.doc-totop {
  position: fixed; right: 18px; bottom: 18px; z-index: 45; cursor: pointer;
  padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 650;
  background: var(--glass-bg-strong); color: var(--text);
  border: 1px solid var(--glass-border-strong);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--glass-shadow);
}
.doc-totop:hover { border-color: var(--accent); }

@media (max-width: 900px) {
  .doc-shell { grid-template-columns: 1fr; gap: 16px; }
  .doc-sidebar {
    position: static; max-height: none;
    padding-bottom: 10px; border-bottom: 1px solid var(--glass-border);
  }
  .doc-toc { max-height: 320px; }
  .doc-content { max-width: 100%; }
}
