/* ═══════════════════════════════════════════════════════════════
   api.mocii.dev — shared styles for /docs, /analytics and /manager.

   A dark take on EventBoard's "Liquid Glass" design (events.mocii.dev,
   assets/apple.css): glass only for the navigation layer (sidebar, top bar,
   buttons), calm rounded cards for content, Apple system colors, pill
   buttons, large titles, concentric corner radii.

   Layout: fixed glass sidebar on desktop; below 900px a sticky top bar with
   a menu button opens the sidebar as a drawer (checkbox toggle, no JS needed).
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* surfaces (iOS dark system backgrounds) */
  --bg: #000000;
  --bg-panel: rgba(28, 28, 30, 0.78);
  --bg-elevated: #1c1c1e;
  --bg-inset: #0e0e10;
  --bg-hover: rgba(120, 120, 128, 0.2);
  --bg-active: rgba(120, 120, 128, 0.3);
  --fill: rgba(118, 118, 128, 0.24);
  --border: rgba(84, 84, 88, 0.55);
  --separator: rgba(84, 84, 88, 0.35);

  /* text */
  --text: #f5f5f7;
  --text-muted: rgba(235, 235, 245, 0.6);
  --text-faint: rgba(235, 235, 245, 0.3);
  --code-fg: #e5e5ea;

  /* system colors (dark variants) */
  --accent: #0a84ff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --purple: #bf5af2;
  --teal: #64d2ff;
  --mint: #63e6e2;

  --method-get: var(--green);
  --method-post: var(--accent);
  --method-put: var(--orange);
  --method-delete: var(--red);
  --method-patch: var(--purple);
  --pill-required: var(--red);
  --pill-optional: rgba(235, 235, 245, 0.45);

  /* glass */
  --glass-bg: rgba(30, 30, 32, 0.6);
  --glass-bg-strong: rgba(36, 36, 38, 0.82);
  --glass-blur: blur(30px) saturate(190%);
  --glass-edge: 0 0 0 0.5px rgba(255, 255, 255, 0.14);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --glass: var(--glass-highlight), var(--glass-edge), var(--glass-shadow);
  --prominent-edge: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.4);

  /* shape + type */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-inner: 14px;
  --radius-card: 22px;
  --radius-pill: 999px;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --transition: 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);

  --sidebar-w: 272px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.25rem; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* body must stay transparent: an opaque body background would paint over
   the z-index:-1 color fields below (only html's background is under them). */
body { background: transparent; }

/* Soft color fields behind the glass, as in EventBoard, tuned for dark. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60vw 55vh at 0% 0%, rgba(10, 132, 255, 0.3), transparent 70%),
    radial-gradient(50vw 50vh at 100% 10%, rgba(191, 90, 242, 0.22), transparent 70%),
    radial-gradient(60vw 55vh at 80% 100%, rgba(100, 210, 255, 0.18), transparent 70%),
    radial-gradient(40vw 45vh at 10% 90%, rgba(255, 159, 10, 0.12), transparent 70%),
    var(--bg);
}

code, pre { font-family: var(--font-mono); font-size: 0.86em; }
:not(pre) > code { color: var(--code-fg); }

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.75; }

::selection { background: rgba(10, 132, 255, 0.45); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ── Shell ───────────────────────────────────── */

.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.shell-single { display: block; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  width: var(--sidebar-w);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem 0.85rem 2rem;
  background: rgba(22, 22, 24, 0.62);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06), 1px 0 0 rgba(0, 0, 0, 0.6);
  scrollbar-width: thin;
  scrollbar-color: var(--fill) transparent;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  margin: 0 0.35rem 1.4rem;
  color: var(--text);
}
.brand span { color: var(--text-muted); font-weight: 500; }

.nav-section { margin-bottom: 1.25rem; }
.nav-section h4 {
  margin: 0 0.75rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.nav-section a {
  display: block;
  padding: 0.42rem 0.75rem;
  margin: 1px 0;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--transition), color var(--transition);
}
.nav-section a:hover { background: var(--bg-hover); opacity: 1; }
.nav-section a.active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: var(--glass-highlight), var(--glass-edge), 0 2px 8px rgba(0, 0, 0, 0.3);
  font-weight: 600;
}

.content {
  margin-left: var(--sidebar-w);
  padding: 2.5rem clamp(1.25rem, 4vw, 3rem) 4rem;
  max-width: calc(1100px + var(--sidebar-w));
  width: 100%;
  min-width: 0;
}
.shell-single .content { margin: 0 auto; }
.content-wide { max-width: calc(1300px + var(--sidebar-w)); }
.shell-single .content-wide { max-width: 1300px; }

/* ── Mobile top bar + drawer (hidden on desktop) ── */

.nav-toggle {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.topbar, .nav-scrim { display: none; }

/* ── Typography ──────────────────────────────── */

.title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 0.45rem;
}
.resource-desc { color: var(--text-muted); font-size: 1rem; margin: 0 0 1.75rem; }
.muted { color: var(--text-muted); }
.resource { margin-bottom: 3.5rem; scroll-margin-top: 1rem; }

/* ── Endpoint cards (/docs) ──────────────────── */

.endpoint {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.75rem;
  background: var(--bg-panel);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-edge), 0 6px 20px rgba(0, 0, 0, 0.35);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  scroll-margin-top: 1rem;
}
.endpoint:target { box-shadow: 0 0 0 2px var(--accent), 0 6px 20px rgba(0, 0, 0, 0.35); }

.endpoint-info { min-width: 0; }
.endpoint-info h2 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.endpoint-info p { margin: 0.5rem 0; }
.permission-note { color: var(--text-muted); font-size: 0.85rem; margin: 0.15rem 0 0.75rem; }
.permission-note code {
  color: var(--accent);
  background: rgba(10, 132, 255, 0.15);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
}

.var-desc { color: var(--teal); font-family: var(--font-mono); font-size: 0.9em; }

.params-table { width: 100%; border-collapse: collapse; margin-top: 1.1rem; font-size: 0.86rem; }
.params-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  border-bottom: 0.5px solid var(--border);
  padding: 0.45rem 0.6rem 0.45rem 0;
}
.params-table td {
  padding: 0.6rem 0.6rem 0.6rem 0;
  border-bottom: 0.5px solid var(--separator);
  vertical-align: top;
}
.params-table tr:last-child td { border-bottom: none; }
.params-table td:first-child { white-space: nowrap; width: 1%; }
.params-table td:last-child { color: var(--text-muted); }

.pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: 1px;
}
.pill-required { background: rgba(255, 69, 58, 0.18); color: var(--pill-required); }
.pill-optional { background: var(--fill); color: var(--pill-optional); }
.pill-ok { background: rgba(48, 209, 88, 0.18); color: var(--green); }
.pill-modified { background: rgba(255, 159, 10, 0.18); color: var(--orange); }

.code-box {
  background: var(--bg-inset);
  border-radius: var(--radius-inner);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  padding: 1rem;
  min-width: 0;
  /* Don't stretch to the parameter table's height (grid default); stay in
     view while a long table scrolls past instead. */
  align-self: start;
  position: sticky;
  top: 1.25rem;
}
.code-tabs { margin-bottom: 0.75rem; }
.code-tab {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--fill);
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-pill);
}
.code-tab.active { color: var(--text); }

.code-box h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.route { font-family: var(--font-mono); color: var(--code-fg); font-size: 0.85rem; word-break: break-all; }

.method-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}
.method-GET { background: rgba(48, 209, 88, 0.18); color: var(--method-get); }
.method-POST { background: rgba(10, 132, 255, 0.2); color: #4da3ff; }
.method-PUT { background: rgba(255, 159, 10, 0.18); color: var(--method-put); }
.method-DELETE { background: rgba(255, 69, 58, 0.18); color: var(--method-delete); }
.method-PATCH { background: rgba(191, 90, 242, 0.2); color: var(--method-patch); }

.example-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.9rem 0 0.4rem;
}
.code-box pre {
  margin: 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.06);
  padding: 0.8rem 0.9rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--code-fg);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}
.json-key { color: var(--teal); }
.json-value { color: #a5e8a8; }

/* ── Panels, stats, tables (/analytics, /manager) ── */

.panel {
  background: var(--bg-panel);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-edge), 0 6px 20px rgba(0, 0, 0, 0.35);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
  min-width: 0;
}
.panel h2 {
  font-family: var(--font-display);
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.panel h2 .pill { vertical-align: middle; }
.panel-danger { box-shadow: 0 0 0 0.5px rgba(255, 69, 58, 0.5), 0 6px 20px rgba(0, 0, 0, 0.35); }
.panel-danger h2 { color: var(--red); }
.info-panel { box-shadow: 0 0 0 0.5px rgba(10, 132, 255, 0.55), 0 6px 20px rgba(0, 0, 0, 0.35); }

.trend-svg {
  width: 100%;
  height: 120px;
  stroke: var(--accent);
  fill: none;
}
.trend-svg polyline { stroke-width: 2; vector-effect: non-scaling-stroke; }

.stats-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.stats-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  border-bottom: 0.5px solid var(--border);
  padding: 0.5rem 0.6rem;
  white-space: nowrap;
}
.stats-table td { padding: 0.6rem; border-bottom: 0.5px solid var(--separator); vertical-align: middle; }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table tbody tr { transition: background var(--transition); }
.stats-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.stats-table th:first-child, .stats-table td:first-child { padding-left: 0; }

.status-pill {
  font-family: var(--font-mono);
  background: var(--fill);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  color: var(--text);
  transition: background var(--transition), transform var(--transition);
}
.stat-tile:hover { background: var(--glass-bg-strong); opacity: 1; }
.stat-tile:active { transform: scale(0.98); }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--text-muted); font-size: 0.82rem; }

/* ── /manager specifics ──────────────────────── */

.crumbs { margin: 0 0 0.35rem; font-size: 0.88rem; color: var(--text-muted); }
.subhead { margin: 1.75rem 0 0.35rem; font-size: 1rem; font-weight: 700; }
.hint { color: var(--text-muted); font-size: 0.8rem; font-weight: 400; }
.warn { color: var(--orange); font-size: 0.8rem; margin-top: 0.2rem; }
.row-dim td { opacity: 0.45; }
.route-lg { font-size: 1.05rem; }
.route-link { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.token {
  display: inline-block;
  font-size: 0.78rem;
  background: var(--fill);
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill);
  margin: 0.1rem 0.2rem 0.1rem 0;
}

.flash {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass);
  border-radius: var(--radius-inner);
  padding: 0.8rem 1.1rem 0.8rem 2.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  position: relative;
}
.flash::before {
  content: '';
  position: absolute;
  left: 1rem; top: 1.05rem;
  width: 0.6rem; height: 0.6rem;
  border-radius: 50%;
  background: var(--accent);
}
.flash ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.flash-ok::before { background: var(--green); }
.flash-warn::before { background: var(--orange); }
.flash-error::before { background: var(--red); }

/* ── Forms ───────────────────────────────────── */

form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}
form label.check, form label.confirm { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--text); }
form label.confirm { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.inline-form { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.inline-form label.confirm { margin: 0; }
.subform { margin-top: 1rem; }
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.bare[disabled] { opacity: 0.5; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 1rem;
}
.form-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
  width: 100%;
  background: var(--fill);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  padding: 0.62rem 0.85rem;
  font: inherit;
  /* 16px stops iOS Safari from zooming into focused fields */
  font-size: 16px;
  transition: box-shadow var(--transition), background var(--transition);
}
@media (min-width: 900px) {
  input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea { font-size: 0.9rem; }
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23ebebf5' stroke-opacity='.6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}
textarea { font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  background-color: rgba(118, 118, 128, 0.3);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.45);
}
input[type="checkbox"] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.6rem; }

/* ── Buttons: glass capsules ─────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  box-shadow: var(--prominent-edge);
  padding: 0.5rem 1.15rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), filter var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.12); opacity: 1; }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn-ghost {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), var(--glass-edge), 0 2px 8px rgba(0, 0, 0, 0.3);
  color: var(--text);
}
.btn-ghost:hover { background: var(--glass-bg-strong); filter: none; }
.btn-danger {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-highlight), var(--glass-edge), 0 2px 8px rgba(0, 0, 0, 0.3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(255, 69, 58, 0.16); filter: none; }
.btn-small { min-height: 1.85rem; padding: 0.28rem 0.8rem; font-size: 0.8rem; }
.btn:disabled, fieldset[disabled] .btn { cursor: not-allowed; opacity: 0.5; transform: none; }

.key-once {
  background: var(--bg-inset);
  border: 1px dashed rgba(10, 132, 255, 0.7);
  border-radius: var(--radius-inner);
  padding: 1rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 1rem 0;
}

.result-table td:first-child { white-space: nowrap; }
.steps { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.steps li { margin-bottom: 0.4rem; }

/* ── Tablet & phone ──────────────────────────── */

@media (max-width: 1100px) {
  .endpoint { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
  .code-box { position: static; }
}

@media (max-width: 900px) {
  html { scroll-padding-top: calc(var(--topbar-h) + 0.75rem); }
  .resource, .endpoint { scroll-margin-top: calc(var(--topbar-h) + 0.75rem); }

  .topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--topbar-h);
    padding: 0 1rem;
    background: rgba(22, 22, 24, 0.7);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.1);
  }
  .topbar .brand { margin: 0; font-size: 1.05rem; }
  .menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    background: var(--glass-bg);
    box-shadow: var(--glass-highlight), var(--glass-edge);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .menu-button:active { transform: scale(0.96); }
  .menu-icon, .menu-icon::before, .menu-icon::after {
    display: block;
    width: 14px;
    height: 1.8px;
    border-radius: 2px;
    background: currentColor;
    transition: transform var(--transition), opacity var(--transition);
  }
  .menu-icon { position: relative; }
  .menu-icon::before, .menu-icon::after { content: ''; position: absolute; left: 0; }
  .menu-icon::before { top: -4.5px; }
  .menu-icon::after { top: 4.5px; }
  .nav-toggle:focus-visible ~ .topbar .menu-button { outline: 2px solid var(--accent); outline-offset: 2px; }
  .nav-toggle:checked ~ .topbar .menu-icon { background: transparent; }
  .nav-toggle:checked ~ .topbar .menu-icon::before { transform: translateY(4.5px) rotate(45deg); }
  .nav-toggle:checked ~ .topbar .menu-icon::after { transform: translateY(-4.5px) rotate(-45deg); }

  .sidebar {
    top: var(--topbar-h);
    width: min(320px, 86vw);
    padding-top: 1rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    background: rgba(28, 28, 30, 0.88);
    border-radius: 0 var(--radius-card) var(--radius-card) 0;
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform var(--transition), visibility 0s linear 0.28s;
  }
  .sidebar > .brand { display: none; }
  .nav-toggle:checked ~ .shell .sidebar {
    transform: none;
    visibility: visible;
    transition: transform var(--transition), visibility 0s;
    box-shadow: var(--glass-shadow), inset -1px 0 0 rgba(255, 255, 255, 0.08);
  }
  .nav-section a { padding: 0.6rem 0.75rem; font-size: 0.95rem; }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
  }
  .nav-toggle:checked ~ .shell .nav-scrim { opacity: 1; pointer-events: auto; }

  .content { margin-left: 0; padding: 1.5rem 1rem 3rem; max-width: none; }
  .shell-single .content { padding-top: 2rem; }
  .title { font-size: 1.9rem; }

  .endpoint, .panel { padding: 1.15rem; border-radius: 20px; }
  .code-box { margin: 0 -0.35rem; }

  /* wide tables scroll inside their card instead of widening the page */
  .stats-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .stats-table td { white-space: nowrap; }
  .params-table td:first-child { white-space: normal; width: auto; }
  .params-table td:first-child .pill { margin: 0.25rem 0 0; display: table; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .stat-value { font-size: 1.6rem; }

  .form-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 420px) {
  .title { font-size: 1.7rem; }
  .endpoint, .panel { padding: 1rem; }
}

/* ── Accessibility & fallbacks ───────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
  :root { --glass-bg: #1c1c1e; --glass-bg-strong: #2c2c2e; --glass-blur: none; }
  body::before { background: var(--bg); }
  .sidebar, .topbar { background: #161618; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass-bg: #1c1c1e; --glass-bg-strong: #2c2c2e; }
  .sidebar, .topbar { background: #161618; }
}
