/* ==========================================================================
   Qgenx Tools — Common CSS (7 Structured Layers + CHRLS 70 Design Principles)
   Color Pattern: Warm Stone & Cobalt (#f6f4ef / #ffffff / #18181b / #1d4ed8)
   ========================================================================== */

@view-transition { navigation: auto; }

/* 1. Design Tokens (Warm Stone & Cobalt + OKLCH + Dark Depth Ready) */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece4;
  --border: rgba(24, 24, 27, 0.10);
  --border-strong: rgba(24, 24, 27, 0.22);

  --ink: #18181b;
  --ink-2: #52525b;
  --ink-3: #71717a;

  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: rgba(29, 78, 216, 0.08);
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.10);
  --err: #b91c1c;
  --err-soft: rgba(185, 28, 28, 0.10);

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-12: 48px;
  /* Concentric Radii: outer(14) = inner(10) + padding(4) */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

@supports (color: oklch(0 0 0)) {
  :root {
    --bg: oklch(0.966 0.008 85);
    --surface: oklch(1 0 0);
    --surface-2: oklch(0.942 0.011 85);
    --accent: oklch(0.478 0.205 262);
    --accent-hover: oklch(0.415 0.185 262);
  }
}

[data-theme="dark"] {
  --bg: #111113;
  --surface: #18181b;
  --surface-2: #222226;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.22);
  --ink: #f4f4f5;
  --ink-2: #a1a1aa;
  --ink-3: #71717a;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(96, 165, 250, 0.14);
}
.theme-switching * { transition: none !important; }

/* 2. Base & Typography (Kerning, Leading, Widow Control, Fluid Type) */
*, *::before, *::after { box-sizing: border-box; }
html {
  margin: 0; padding: 0;
  interpolate-size: allow-keywords;
  scroll-behavior: smooth;
}
body {
  margin: 0; padding: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-kerning: normal;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit; text-decoration: none;
  text-underline-offset: 0.2em; text-decoration-thickness: 1px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 {
  margin: 0; font-weight: 500; letter-spacing: -0.02em; color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(24px, 3.6vw, 38px); line-height: 1.12; }
h2 { font-size: clamp(18px, 2.1vw, 20px); line-height: 1.25; }
h3 { font-size: 15.5px; line-height: 1.35; }
@supports (text-box: trim-both cap alphabetic) {
  h1, .stat-val { text-box: trim-both cap alphabetic; }
}
p { margin: 0; color: var(--ink-2); text-wrap: pretty; max-width: 68ch; }
sup, sub { font-size: 0.75em; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -0.45em; }
sub { bottom: -0.25em; }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.acronym { font-variant-caps: all-small-caps; letter-spacing: 0.04em; }
.trunc-mid { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ico {
  width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.5;
  fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}

/* 3. Layout Shell (Fluid Auto-Adjusting Container + Safe Area) */
.wrap {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding-inline: max(clamp(12px, 3vw, 32px), env(safe-area-inset-left));
}
.sec { padding: var(--s-8) 0 0; }
.sec-head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4);
}
.sec-head p { font-size: 14px; color: var(--ink-2); }

.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.head-inner {
  height: 56px; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
}
.brand { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 600; font-size: 15.5px; }
.brand-mark {
  width: 24px; height: 24px; border-radius: var(--r-sm);
  background: var(--ink); color: var(--bg); display: grid; place-items: center;
}
.nav-links { display: flex; align-items: center; gap: var(--s-4); font-size: 14px; color: var(--ink-2); }
.nav-links a {
  display: inline-flex; flex-direction: column; align-items: center;
  transition: color 150ms var(--ease);
}
.nav-links a::after {
  content: attr(data-text); height: 0; visibility: hidden; overflow: hidden;
  user-select: none; pointer-events: none; font-weight: 500;
}
.nav-links a:hover { color: var(--ink); }

.grid-2 { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; gap: var(--s-4); grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; gap: var(--s-4); grid-template-columns: repeat(4, 1fr); }
.grid-5 { display: grid; gap: var(--s-4); grid-template-columns: repeat(5, 1fr); }
@media (max-width: 980px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; } }

.site-foot {
  margin-top: var(--s-12); padding: var(--s-6) 0;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--ink-2);
}
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-4); }

/* 4. Components (Concentric Radii, Alpha Borders, Scale 0.97, Micro-Animations) */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  hyphens: auto; overflow-wrap: anywhere;
  transition: border-color 150ms var(--ease), transform 150ms var(--ease);
}
a.card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
a.card:active { transform: scale(0.97); }

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 34px; padding: 0 var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500;
  transform-origin: center;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), transform 120ms var(--ease), opacity 120ms var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 4px 10px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12px; font-weight: 500;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 120ms var(--ease);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.err { background: var(--err-soft); color: var(--err); }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-4) 0 var(--s-2); font-size: 13px; color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

/* Compact KPI Strip (High-contrast labels on #efece4) */
.stat-strip {
  display: grid; gap: var(--s-2);
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
}
.stat-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 7px 10px; }
.stat-val { font-size: 16px; line-height: 1.2; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 11px; line-height: 1.25; color: var(--ink-2); margin-top: 2px; }

/* Custom Minus / Plus Stepper (Borderless Rounded Pill + Expanded Hit Target) */
.limit-group {
  display: inline-flex; align-items: center; gap: 6px;
  flex-wrap: nowrap; white-space: nowrap; max-width: 100%;
}
.limit-group .chip {
  border-radius: 999px; padding: 4px 10px; font-size: 11.5px; line-height: 1.2;
}
.stepper {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--surface-2); border: none; border-radius: 999px;
  padding: 2px 4px 2px 10px;
  font-size: 11.5px; font-weight: 500; color: var(--ink-2);
}
.stepper label { margin-right: 2px; }
.stepper-btn {
  position: relative;
  width: 24px; height: 24px; border-radius: 999px;
  border: none; background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08);
  display: grid; place-items: center; font-size: 14px; line-height: 1; padding: 0;
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}
.stepper-btn::after { content: ""; position: absolute; inset: -6px; }
.stepper-btn:hover { background: var(--bg); }
.stepper-btn:active { transform: scale(0.97); }
.stepper-input {
  width: 44px; height: 24px; text-align: center; font-family: var(--mono); font-size: 12px;
  border: none; border-radius: 999px;
  background: var(--surface); color: var(--ink); padding: 0 4px;
  outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper-input:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.stepper-input::-webkit-inner-spin-button,
.stepper-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* 5. Forms, Controls, Sliders & Error Shake */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.input, .textarea, .select {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: var(--s-2) var(--s-3);
  font-size: 14px; color: var(--ink);
  overscroll-behavior: contain;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.textarea { min-height: 200px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.range { width: 100%; accent-color: var(--accent); cursor: pointer; }
.swatch-stage {
  border-radius: var(--r-md); border: 1px solid var(--border);
  background-image: linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.blend-multiply { mix-blend-mode: multiply; }

@keyframes qt-shake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-4px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}
.is-error-shake { animation: qt-shake 280ms var(--ease); }

/* 6. Tool Workspace Shell */
.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-4);
  margin-top: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.ws-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.ws-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.ws-actions-end { margin-left: auto; justify-content: flex-end; }
.ws-split { display: grid; gap: var(--s-4); grid-template-columns: 1fr 1fr; }
@media (max-width: 780px) { .ws-split { grid-template-columns: 1fr; } }

/* Mobile-First Compact Layout */
@media (max-width: 680px) {
  .crumbs { padding: 10px 0 4px; font-size: 12px; }
  .sec { padding: var(--s-6) 0 0; }
  .workspace { padding: var(--s-3); gap: 8px; margin-top: 10px; }
  .textarea { min-height: 136px; }
  .ws-split { display: contents; }
  .stat-strip {
    order: -2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }
  .ws-primary-input { order: -1; }
  .stat-box { padding: 4px 2px; border-radius: 6px; text-align: center; }
  .stat-val { font-size: 12.5px; line-height: 1.15; }
  .stat-lbl { font-size: 10px; line-height: 1.15; margin-top: 1px; }
  .stepper { padding: 2px 3px 2px 8px; }
  .stepper-btn { width: 22px; height: 22px; font-size: 13px; }
  .stepper-input { width: 42px; height: 22px; font-size: 11.5px; }
}

/* 7. Hero, Info Tables & Smooth Exclusive Toggleable FAQs */
.hero { padding: var(--s-8) 0 0; display: grid; gap: var(--s-6); grid-template-columns: 1.15fr 0.85fr; align-items: center; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero-lede { margin-top: var(--s-3); font-size: 16px; color: var(--ink-2); max-width: 52ch; }
.search-box {
  margin-top: var(--s-5); display: flex; align-items: center; gap: var(--s-2);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: 4px 4px 4px var(--s-3); max-width: 460px;
}
.search-box input { border: none; background: transparent; width: 100%; outline: none; font-size: 14px; }

.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.scroll-fade { mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent); }
.info-table { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: left; }
.info-table th, .info-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.info-table th { background: var(--surface-2); font-weight: 500; color: var(--ink); }
.info-table tr:last-child td { border-bottom: none; }

.faq-acc { display: flex; flex-direction: column; gap: var(--s-2); }
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.faq-q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: 12px var(--s-4); background: transparent; border: none;
  text-align: left; font-size: 14.5px; font-weight: 500; color: var(--ink);
  transition: background-color 150ms var(--ease);
}
.faq-q:hover { background: var(--surface-2); }
.faq-chev { transition: transform 180ms var(--ease); color: var(--ink-2); }
.faq-q[aria-expanded="true"] .faq-chev { transform: rotate(180deg); }
.faq-a {
  padding: 0 var(--s-4) 14px; font-size: 13.5px; color: var(--ink-2); line-height: 1.6;
  transform-origin: top; transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}
.faq-a[hidden] { display: none; }

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

/* ==========================================================================
   Shared feel: buttons, theme switch, toasts, cookie notice (all pages)
   ========================================================================== */
button, .btn, .chip, a.card, .faq-q, .ts-opt {
  transition: transform 120ms var(--ease), background-color 150ms var(--ease),
    border-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}
button { cursor: pointer; font: inherit; }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn:hover:not(:disabled), .chip:hover { transform: translateY(-1px); }
.btn:active:not(:disabled), .chip:active, button:active:not(:disabled), .faq-q:active { transform: scale(0.97); }
a.card:hover { transform: translateY(-1px); }
a.card:active { transform: scale(0.99); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Press feel: every control sinks to 0.97 while held and springs back on release (common.js adds .is-pressed) */
:is(button, [role="button"], .btn, .pill-btn, .chip, .stepper-btn, .ts-opt, .faq-q, input[type="button"], input[type="submit"], input[type="reset"]) {
  transition: transform 220ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}
:is(button, [role="button"], .btn, .pill-btn, .chip, .stepper-btn, .ts-opt, .faq-q, input[type="button"], input[type="submit"], input[type="reset"]):not(:disabled):is(:active, .is-pressed) {
  transform: scale(0.97) !important;
  transition-duration: 70ms !important;
}

/* Tool pills and primary buttons used on the tool pages */
.pill-btn {
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2);
  font: 500 13px/1 var(--font); white-space: nowrap;
}
.pill-btn:hover { color: var(--ink); background: var(--surface-2); }
.pill-btn.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Theme switch: three icon buttons */
.theme-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px; flex: none;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
}
.ts-opt {
  display: inline-grid; place-items: center; width: 34px; height: 30px; border-radius: 999px;
  color: var(--ink-3); text-decoration: none;
}
.ts-opt .ico { width: 16px; height: 16px; }
.ts-opt:hover { color: var(--ink); }
.ts-opt:active { transform: scale(0.94); }
.ts-opt.on { background: var(--surface); color: var(--accent); box-shadow: var(--elev, 0 0 0 1px var(--border)); }

/* Toasts */
.qt-toasts {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: grid; justify-items: end; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
.qt-toast {
  width: max-content; max-width: 100%;
  padding: 10px 14px; border-radius: var(--r-md); background: var(--ink); color: var(--bg);
  font: 500 13.5px/1.35 var(--font); box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(-8px); transition: opacity 180ms var(--ease), transform 220ms var(--ease);
}
.qt-toast.in { opacity: 1; transform: none; }
.qt-toast.out { opacity: 0; transform: translateY(-6px); }
.qt-toast.is-ok::before { content: "✓  "; color: var(--ok); }
@media (max-width: 640px) {
  .qt-toasts { top: 10px; left: 16px; right: 16px; width: auto; }
}

/* Cookie notice */
.qt-note {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 150; max-width: 620px; margin-inline: auto;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border); box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.35);
  font-size: 13.5px; opacity: 1; transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.qt-note p { margin: 0; flex: 1 1 260px; }
.qt-note a { color: var(--accent); }
.qt-note.out { opacity: 0; transform: translateY(8px); }

@media (prefers-reduced-motion: reduce) {
  button, .btn, .chip, a.card, .faq-q, .ts-opt, .qt-toast, .qt-note { transition: none !important; }
  .btn:hover, .chip:hover, a.card:hover, .btn:active, .chip:active, button:active { transform: none !important; }
}

[hidden] { display: none !important; }

/* ==========================================================================
   Site header and footer, admin pages (version 1.0.0.0038)
   ========================================================================== */
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 300; padding: 8px 12px; border-radius: var(--r-md); background: var(--ink); color: var(--bg); text-decoration: none; }
.skip-link:focus { top: 12px; }
.site-head { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.head-inner { height: 60px; flex-wrap: nowrap; }
.head-inner > * { flex: none; }
.brand { white-space: nowrap; }
.nav-links { gap: 2px; margin-left: var(--s-4); }
.nav-links > a, .nav-links > details > summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px;
  border-radius: var(--r-md); color: var(--ink-2); text-decoration: none; font-weight: 500; cursor: pointer; list-style: none;
}
.nav-links > a:hover, .nav-links > details > summary:hover { color: var(--ink); background: var(--surface-2); }
.nav-links > a[aria-current="page"], .nav-links > details > summary.on { color: var(--ink); background: var(--surface-2); }
.nav-links summary::-webkit-details-marker { display: none; }
.nav-links > a, .nav-links > details > summary { flex-direction: row; align-items: center; line-height: 1; }
.nav-links a::after { content: none; }
.nav-links .menu { position: relative; }
.menu-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 80; min-width: 240px; padding: 6px;
  display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.35);
}
.menu-panel a { display: block; padding: 9px 12px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.menu-panel a:hover { background: var(--surface-2); }
.menu-panel a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.menu-panel .menu-all { border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 var(--r-md) var(--r-md); color: var(--accent); font-weight: 600; }
.head-inner .theme-switch { margin-left: auto; }
@media (max-width: 680px) {
  .head-inner { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; height: auto; padding-block: 10px 8px; }
  .head-inner .brand { grid-column: 1; grid-row: 1; }
  .head-inner .theme-switch { grid-column: 2; grid-row: 1; }
  .nav-links { grid-column: 1 / -1; grid-row: 2; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .nav-links > a, .nav-links > details > summary { justify-content: center; min-height: 38px; padding: 0 8px; background: var(--surface-2); }
  .nav-links .menu { position: static; }
  .nav-links .menu > summary { width: 100%; }
  .menu-panel { top: calc(100% + 6px); left: 12px; right: 12px; min-width: 0; grid-template-columns: 1fr 1fr; }
  .menu-panel .menu-all { grid-column: 1 / -1; }
}

.site-foot { border-top: 1px solid var(--border); margin-top: var(--s-12); background: var(--surface); }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding-block: 44px 28px; }
.foot-brand p { margin: var(--s-3) 0 0; color: var(--ink-2); font-size: 14px; max-width: 34ch; }
.foot-brand .brand { color: var(--ink); }
.foot-col { display: grid; gap: 10px; align-content: start; }
.foot-col h2 { font-size: 13px; margin: 0 0 4px; color: var(--ink); letter-spacing: 0; text-transform: none; }
.foot-col a { color: var(--ink-2); text-decoration: none; font-size: 14px; }
.foot-col a:hover { color: var(--ink); text-decoration: underline; }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 16px 28px; border-top: 1px solid var(--border); color: var(--ink-3); font-size: 13px; }
@media (max-width: 760px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .nav-links > a { padding: 0 8px; }
}
@media (max-width: 420px) {
  .foot-grid { grid-template-columns: 1fr; }
}

/* Admin */
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 24px; margin-top: var(--s-8); }
.admin-head h1 { margin: 0; }
.stat-lbl { margin: 0; color: var(--ink-3); font-size: 13px; }
.stat-big { margin: 6px 0 0; font-size: 28px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.table { width: 100%; border-collapse: collapse; margin-top: var(--s-3); font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--ink-3); font-weight: 600; font-size: 13px; }
.num-col { text-align: right !important; font-variant-numeric: tabular-nums; }
.msg { margin-top: 12px; display: grid; gap: 10px; }
.msg.is-new { border-left: 3px solid var(--accent); }
.msg-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: baseline; }
.msg-head a { margin-left: 8px; font-size: 14px; }
.msg-body { color: var(--ink-2); white-space: normal; overflow-wrap: anywhere; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-danger { color: var(--err); border-color: var(--err-soft, var(--border)); }
.btn-danger:hover { background: var(--err-soft, var(--surface-2)); }
.notice.err { border-color: var(--err); }
.notice.err p { color: var(--err); margin: 0; }
.legal-summary p { margin: 0; }
.legal .card { margin-top: var(--s-3); }
.legal-sec h2 { font-size: 16px; margin: 0 0 var(--s-2); }
.contact-form select.input { appearance: auto; }

/* Button help card: opens at the top of the screen while a button is hovered or focused */
.qt-help {
  position: fixed; top: 74px; left: 50%; z-index: 190;
  width: min(440px, calc(100vw - 32px));
  padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong);
  box-shadow: var(--pop, 0 16px 40px -16px rgba(0, 0, 0, 0.35));
  opacity: 0; pointer-events: none; transform: translate(-50%, -6px);
  transition: opacity 160ms var(--ease), transform 200ms var(--ease);
}
.qt-help.in { opacity: 1; transform: translate(-50%, 0); }
.qt-help-k { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.qt-help-t { font-size: 15px; font-weight: 600; margin: 2px 0 6px; color: var(--ink); }
.qt-help p { font-size: 13.5px; line-height: 1.5; margin: 0 0 8px; max-width: none; color: var(--ink-2); }
.qt-help-ex { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink); white-space: pre-wrap; }
@media (max-width: 680px) { .qt-help { top: 118px; } }

/* Tool content sections */
.tool-sec ul, .tool-sec ol { margin: var(--s-3) 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); max-width: 72ch; }
.tool-sec p + p { margin-top: var(--s-3); }

/* Changelog */
.cl-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-8); margin-top: var(--s-8); align-items: start; }
.cl-side { position: sticky; top: 84px; }
.cl-side-h { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 var(--s-3); }
.cl-side ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cl-side li { display: flex; flex-direction: column; }
.cl-side li a { font-family: var(--mono); font-size: 13px; color: var(--ink-2); text-decoration: none; }
.cl-side li a:hover { color: var(--accent); }
.cl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); min-width: 0; }
.cl-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-6); scroll-margin-top: 84px; }
.cl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 13px; color: var(--ink-3); }
.cl-ver { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.cl-title { font-size: 20px; margin: var(--s-3) 0 var(--s-3); }
.cl-bullets { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); max-width: 72ch; }
.cl-p { margin: 0 0 var(--s-3); }
@media (max-width: 860px) {
  .cl-layout { grid-template-columns: 1fr; gap: var(--s-4); }
  .cl-side { position: static; }
  .cl-side ol { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .cl-item { padding: var(--s-4); }
}

/* Legal pages: sidebar table of contents + article */
.legal-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s-8); margin-top: var(--s-8); align-items: start; }
.legal-side { position: sticky; top: 84px; display: grid; gap: var(--s-4); }
.legal-toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-3) var(--s-4); }
.legal-toc summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink); list-style: none; }
.legal-toc summary::-webkit-details-marker { display: none; }
.legal-toc ol { margin: var(--s-3) 0 0; padding: 0; list-style: none; display: grid; gap: 2px; counter-reset: toc; }
.legal-toc li a { display: block; padding: 6px 8px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13.5px; text-decoration: none; line-height: 1.35; }
.legal-toc li a:hover { background: var(--surface-2); color: var(--ink); }
.legal-toc li a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.legal-side-other { font-size: 13px; color: var(--ink-3); margin: 0; max-width: none; }
.legal-side-other a { color: var(--accent); }
.legal-body { display: grid; gap: var(--s-4); min-width: 0; }
.legal-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-6); scroll-margin-top: 84px; }
.legal-sec h2 { font-size: 18px; margin: 0 0 var(--s-3); }
.legal-sec p + p { margin-top: var(--s-3); }
.legal-sec p { max-width: 72ch; }
.legal-list { margin: var(--s-3) 0 0; padding-left: 20px; color: var(--ink-2); display: grid; gap: 6px; max-width: 72ch; }
.legal-table { margin-top: var(--s-4); }
.legal-table .info-table td, .legal-table .info-table th { vertical-align: top; }
@media (min-width: 861px) {
  .legal-toc summary { display: none; }
}
@media (max-width: 860px) {
  .legal-layout { grid-template-columns: 1fr; gap: var(--s-4); }
  .legal-side { position: static; }
  .legal-toc ol { max-height: 46vh; overflow-y: auto; }
  .legal-sec { padding: var(--s-4); }
}

/* Page heading block for the simple pages: text stacks under the title */
.page-hero { display: block; }
.page-hero .lead { max-width: 62ch; margin-top: var(--s-3); }
