/* AI Fusion — components + layout (design-v2) */

/* ---------- reset + base ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--accent-hover); }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }

img, svg { max-width: 100%; vertical-align: middle; }

/* ---------- typography scale ------------------------------------------- */
h1, h2, h3, h4, h5 { margin: 0; font-weight: var(--fw-semibold); letter-spacing: -0.015em; line-height: var(--lh-tight); color: var(--fg); }
h1 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.025em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--s-3); }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.mono, code, pre, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }

small { font-size: var(--fs-sm); color: var(--fg-muted); }

/* ---------- layout helpers --------------------------------------------- */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s-8) var(--page-px);
}
.page-wide { max-width: 1400px; }
.page-narrow { max-width: 760px; }

.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-8); }
.stack-sm > * + * { margin-top: var(--s-2); }

.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: var(--s-2); align-items: center; }
.row-between { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- top nav ---------------------------------------------------- */
.app-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s-5);
  height: var(--nav-h);
  padding: 0 var(--s-6);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- theme toggle button (in nav) ---------------------------------- */
.app-nav .theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: var(--r-md);
  cursor: pointer;
  padding: 0;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.app-nav .theme-toggle:hover { color: var(--fg); background: var(--bg-surface); border-color: var(--border-strong); }
.app-nav .theme-toggle svg { width: 14px; height: 14px; }
/* show the right icon per active theme — sun on dark, moon on light */
.app-nav .theme-toggle .icon-sun { display: inline; }
.app-nav .theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .app-nav .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .app-nav .theme-toggle .icon-moon { display: inline; }
.app-nav .brand {
  display: inline-flex; align-items: center; gap: var(--s-2);
  color: var(--fg); font-weight: var(--fw-semibold); font-size: var(--fs-base);
  letter-spacing: -0.01em;
}
.app-nav .brand .glyph {
  width: 18px; height: 18px; display: inline-block;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.app-nav .brand:hover { color: var(--fg); }

.app-nav .links { display: flex; align-items: center; gap: var(--s-1); flex: 1 1 auto; }
.app-nav .links a {
  padding: 6px 10px; border-radius: var(--r-md);
  color: var(--fg-muted); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.app-nav .links a:hover { color: var(--fg); background: var(--bg-surface); }
.app-nav .links a.active { color: var(--fg); background: var(--bg-surface); }
/* Primary CTA inside the nav must keep its accent background + near-black
   text on idle AND hover. The generic `.app-nav .links a:hover` rule sets a
   near-black `bg-surface` background which otherwise collapses with our
   `--on-accent` text colour into a solid black button on hover. */
.app-nav .links a.btn-primary,
.app-nav .links a.btn-primary:focus {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.app-nav .links a.btn-primary:hover {
  color: var(--on-accent);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.app-nav .pill {
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--fg-muted); font-size: var(--fs-xs);
}

.app-nav .hamburger {
  display: none; background: transparent; border: 1px solid var(--border);
  color: var(--fg); width: 34px; height: 32px; border-radius: var(--r-md);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0;
}

/* ---------- buttons (exactly 3 variants) ------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 8px 14px;
  font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  line-height: 1;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-surface-2); border-color: var(--border-strong); color: var(--fg); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-accent); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }

.btn-ghost {
  background: transparent; color: var(--fg-muted); border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-surface); color: var(--fg); border-color: transparent; }

.btn-danger {
  background: transparent; color: var(--err); border-color: rgba(239, 68, 68, 0.35);
}
.btn-danger:hover { background: var(--err-muted); color: var(--err); border-color: var(--err); }

.btn-lg { padding: 12px 20px; font-size: var(--fs-base); }
.btn-sm { padding: 5px 10px; font-size: var(--fs-xs); }
.btn-block { display: flex; width: 100%; }

/* ---------- card ------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}
.card-flush { padding: 0; overflow: hidden; }
.card-sm { padding: var(--s-4); }

.kpi { display: flex; flex-direction: column; gap: var(--s-2); }
.kpi .label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted); font-weight: var(--fw-medium); }
.kpi .value { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .trend { font-size: var(--fs-xs); color: var(--fg-muted); }
.kpi .trend.up { color: var(--success); }
.kpi .trend.down { color: var(--err); }

/* ---------- inputs ----------------------------------------------------- */
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="url"], select, textarea {
  display: block; width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 9px 12px;
  font: inherit;
  font-size: var(--fs-sm);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--shadow-accent);
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--fg-subtle); }
textarea { font-family: var(--font-mono); min-height: 96px; resize: vertical; line-height: 1.55; }

.input-mono, input.mono { font-family: var(--font-mono); }

label { display: block; font-size: var(--fs-xs); color: var(--fg-muted); margin-bottom: var(--s-1); font-weight: var(--fw-medium); text-transform: uppercase; letter-spacing: 0.04em; }

.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field + .field { margin-top: var(--s-4); }
.help { font-size: var(--fs-xs); color: var(--fg-subtle); margin-top: var(--s-1); }

form.inline { display: flex; gap: var(--s-2); align-items: flex-end; flex-wrap: wrap; }
form.inline > * { margin: 0; }

/* ---------- table ------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th {
  color: var(--fg-muted); font-weight: var(--fw-medium);
  text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: 0.05em;
  background: var(--bg-surface-2);
}
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover td { background: var(--bg-surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.table td.mono { font-family: var(--font-mono); color: var(--fg); }
.table .empty { padding: var(--s-10); text-align: center; color: var(--fg-muted); }

/* Wrap table in .card.card-flush for inset border */

/* ---------- tabs ------------------------------------------------------- */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-6);
  overflow-x: auto;
}
.tabs .tab {
  padding: 10px 16px;
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--fg-muted);
  background: transparent; border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs .tab:hover { color: var(--fg); text-decoration: none; }
.tabs .tab.active { color: var(--fg); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Auth-style segmented control (used on dashboard_login) */
.segmented {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--r-md);
}
.segmented .tab {
  flex: 1; padding: 7px 10px; text-align: center;
  font-size: var(--fs-sm); color: var(--fg-muted);
  background: transparent; border: 0; border-radius: var(--r-sm);
  cursor: pointer; font-weight: var(--fw-medium);
  margin: 0;
}
.segmented .tab.active { background: var(--bg-surface-2); color: var(--fg); }

/* ---------- badges ----------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  background: var(--bg-surface-2); color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.badge-accent  { background: var(--accent-muted); color: var(--accent); border-color: rgba(0, 229, 255, 0.25); }
.badge-success { background: var(--success-muted); color: var(--success); border-color: rgba(34, 197, 94, 0.3); }
.badge-warn    { background: var(--warn-muted); color: var(--warn); border-color: rgba(245, 158, 11, 0.3); }
.badge-err     { background: var(--err-muted); color: var(--err); border-color: rgba(239, 68, 68, 0.3); }
.badge-mono    { font-family: var(--font-mono); }

/* legacy aliases used by existing templates — keep them working */
.badge.ok    { background: var(--success-muted); color: var(--success); border-color: rgba(34, 197, 94, 0.3); }
.badge.warn  { background: var(--warn-muted); color: var(--warn); border-color: rgba(245, 158, 11, 0.3); }
.badge.err   { background: var(--err-muted); color: var(--err); border-color: rgba(239, 68, 68, 0.3); }
.badge.muted { background: var(--bg-surface-2); color: var(--fg-muted); border-color: var(--border); }

/* ---------- banners ---------------------------------------------------- */
.banner {
  padding: 10px 14px; border-radius: var(--r-md);
  font-size: var(--fs-sm); display: flex; gap: var(--s-2); align-items: center;
}
.banner-info    { background: var(--accent-muted); color: var(--accent); border: 1px solid rgba(0, 229, 255, 0.25); }
.banner-success, .banner.notice { background: var(--success-muted); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.banner-warn    { background: var(--warn-muted); color: var(--warn); border: 1px solid rgba(245, 158, 11, 0.3); }
.banner-err, .banner.error { background: var(--err-muted); color: var(--err); border: 1px solid rgba(239, 68, 68, 0.3); }

/* ---------- code blocks ------------------------------------------------ */
pre, .code {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--fg);
}
pre code, .code code { background: transparent; border: 0; padding: 0; font-size: inherit; color: inherit; }

:not(pre) > code {
  background: var(--bg-surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 1px 6px;
  font-size: 0.9em;
  color: var(--fg);
}

.code-block { position: relative; }
.code-block .copy-btn {
  position: absolute; top: 10px; right: 10px;
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--fg-muted);
  padding: 4px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-family: var(--font-sans); font-weight: var(--fw-medium);
  cursor: pointer;
  opacity: 0; transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.code-block:hover .copy-btn { opacity: 1; }
.code-block .copy-btn:hover { color: var(--fg); border-color: var(--border-strong); }
.code-block .copy-btn.ok { color: var(--success); border-color: rgba(34, 197, 94, 0.3); opacity: 1; }

/* ---------- hero / marketing ------------------------------------------- */
.hero {
  padding: var(--s-20) 0 var(--s-16);
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}
.hero .eyebrow {
  display: inline-block; padding: 3px 12px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--fg-muted); font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: var(--s-5);
}
.hero h1 {
  font-size: clamp(36px, 6vw, var(--fs-4xl));
  font-weight: var(--fw-bold); line-height: 1.05; letter-spacing: -0.035em;
  margin: 0 auto var(--s-5); max-width: 760px;
}
.hero h1 .accent-stroke {
  position: relative; display: inline-block; color: var(--fg);
}
.hero h1 .accent-stroke::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 3px; background: var(--accent); border-radius: 2px;
}
.hero .lede { font-size: var(--fs-lg); color: var(--fg-muted); max-width: 620px; margin: 0 auto var(--s-8); line-height: var(--lh-relaxed); }
.hero .ctas { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }
.hero .stats { display: flex; gap: var(--s-8); justify-content: center; margin-top: var(--s-10); flex-wrap: wrap; color: var(--fg-muted); font-size: var(--fs-sm); }
.hero .stats strong { color: var(--fg); font-weight: var(--fw-semibold); font-size: var(--fs-xl); font-variant-numeric: tabular-nums; display: block; }

.section { padding: var(--s-16) 0; }
.section + .section { border-top: 1px solid var(--border-subtle); }
.section-head { text-align: center; margin-bottom: var(--s-10); }
.section-head h2 { font-size: var(--fs-2xl); letter-spacing: -0.02em; margin-bottom: var(--s-2); }
.section-head .sub { color: var(--fg-muted); font-size: var(--fs-base); max-width: 560px; margin: 0 auto; }

.feature { padding: var(--s-6); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.feature .icon {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-muted); color: var(--accent);
  border-radius: var(--r-md); margin-bottom: var(--s-4);
}
.feature h3 { font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.feature p { color: var(--fg-muted); font-size: var(--fs-sm); margin: 0; line-height: var(--lh-relaxed); }

.plan { padding: var(--s-6); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; }
.plan.featured { border-color: var(--accent); }
.plan .name { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin: 0; }
.plan .desc { color: var(--fg-muted); font-size: var(--fs-sm); margin: var(--s-1) 0 var(--s-4); min-height: 36px; }
.plan .price { font-size: var(--fs-3xl); font-weight: var(--fw-bold); margin: 0; letter-spacing: -0.025em; }
.plan .price .per { font-size: var(--fs-sm); color: var(--fg-muted); font-weight: var(--fw-regular); margin-left: var(--s-1); }
.plan ul { list-style: none; padding: 0; margin: var(--s-5) 0; font-size: var(--fs-sm); color: var(--fg-muted); }
.plan ul li { padding: var(--s-2) 0; display: flex; gap: var(--s-2); align-items: center; border-bottom: 1px solid var(--border-subtle); }
.plan ul li:last-child { border-bottom: 0; }
.plan ul li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--accent-muted); color: var(--accent); flex: none; background-image: linear-gradient(0deg, var(--accent-muted), var(--accent-muted)); }
.plan .pick { margin-top: auto; }

/* ---------- footer ----------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--s-8) var(--page-px);
  background: var(--bg-base);
}
.site-footer .inner {
  max-width: var(--page-max); margin: 0 auto;
  display: flex; gap: var(--s-6); flex-wrap: wrap; align-items: center; justify-content: space-between;
}
.site-footer .links { display: flex; gap: var(--s-5); flex-wrap: wrap; }
.site-footer .links a { color: var(--fg-muted); font-size: var(--fs-sm); }
.site-footer .links a:hover { color: var(--fg); }
.site-footer .copy { color: var(--fg-subtle); font-size: var(--fs-xs); }

/* ---------- auth card -------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-6);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: var(--s-8);
  box-shadow: var(--shadow-md);
}
.auth-card .brand { display: inline-flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-6); }
.auth-card .brand .glyph { width: 18px; height: 18px; background: var(--accent); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); display: inline-block; }
.auth-card .brand-name { font-weight: var(--fw-semibold); font-size: var(--fs-base); color: var(--fg); letter-spacing: -0.01em; }
.auth-card h1 { font-size: var(--fs-xl); margin-bottom: var(--s-1); font-weight: var(--fw-semibold); letter-spacing: -0.015em; }
.auth-card .sub { color: var(--fg-muted); font-size: var(--fs-sm); margin-bottom: var(--s-6); }
.auth-card .footer-link { margin-top: var(--s-5); text-align: center; font-size: var(--fs-sm); color: var(--fg-muted); }
.auth-card .footer-link a { color: var(--accent); font-weight: var(--fw-medium); }

/* ---------- docs layout ------------------------------------------------ */
.docs-layout {
  display: grid; grid-template-columns: 220px 1fr;
  max-width: var(--page-max); margin: 0 auto; gap: var(--s-10);
  padding: var(--s-8) var(--page-px) var(--s-20);
}
.docs-toc { position: sticky; top: calc(var(--nav-h) + var(--s-5)); align-self: start; max-height: calc(100vh - var(--nav-h) - var(--s-8)); overflow-y: auto; }
.docs-toc h4 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); margin-bottom: var(--s-3); font-weight: var(--fw-semibold); }
.docs-toc ol { list-style: none; padding: 0; margin: 0 0 var(--s-6); counter-reset: toc; }
.docs-toc ol li { counter-increment: toc; padding: var(--s-1) 0; font-size: var(--fs-sm); }
.docs-toc ol li a { color: var(--fg-muted); }
.docs-toc ol li a:hover, .docs-toc ol li a.active { color: var(--fg); }

.docs-main h1 { font-size: var(--fs-2xl); margin-bottom: var(--s-2); }
.docs-main .lede { color: var(--fg-muted); font-size: var(--fs-lg); margin-bottom: var(--s-10); line-height: var(--lh-relaxed); }
.docs-section { padding: var(--s-8) 0; border-top: 1px solid var(--border-subtle); scroll-margin-top: calc(var(--nav-h) + var(--s-4)); }
.docs-section:first-of-type { border-top: 0; padding-top: 0; }
.docs-section h2 { font-size: var(--fs-xl); margin-bottom: var(--s-3); }
.docs-section h3 { font-size: var(--fs-lg); margin: var(--s-6) 0 var(--s-2); }
.docs-section p { color: var(--fg); line-height: var(--lh-relaxed); margin-bottom: var(--s-3); }

/* ---------- legacy-class shims (existing templates pre-design-v2) ------ */
.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); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.card .value { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.card h3 { font-size: var(--fs-xs); color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: var(--fw-medium); margin-bottom: var(--s-2); }
.card h3:first-child { margin-top: 0; }
/* Legacy default buttons in <form>/bare <button> — map to .btn styling */
button:not(.btn):not(.tab):not(.hamburger):not(.copy-btn):not([type="button"]),
button.btn:not(.btn-primary):not(.btn-ghost):not(.btn-danger),
input[type="submit"]:not(.btn),
input[type="button"]:not(.btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 8px 14px;
  font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1;
  background: var(--accent); color: var(--on-accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-md); cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
button:not(.btn):not(.tab):not(.hamburger):not(.copy-btn):not([type="button"]):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost, .btn.ghost {
  background: transparent !important; color: var(--fg) !important; border: 1px solid var(--border) !important;
}
button.ghost:hover, .btn.ghost:hover { background: var(--bg-surface-2) !important; }
button.danger {
  background: transparent !important; color: var(--err) !important; border: 1px solid rgba(239,68,68,0.35) !important;
}
/* top-level table (not inside .card.card-flush) — still give it the new look */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table th { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--fg-muted); font-weight: var(--fw-medium); text-transform: uppercase; font-size: var(--fs-xs); letter-spacing: 0.05em; }
table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tr:hover td { background: var(--bg-surface-2); }

/* ---------- misc utilities --------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-warn    { color: var(--warn); }
.text-err     { color: var(--err); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.bg-surface-2 { background: var(--bg-surface-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.flex-1 { flex: 1 1 0%; }

/* progress bar */
.progress { height: 6px; background: var(--bg-base); border-radius: 3px; overflow: hidden; border: 1px solid var(--border-subtle); }
.progress > .fill { height: 100%; background: var(--accent); transition: width var(--dur) var(--ease); }
.progress.warn > .fill { background: var(--warn); }
.progress.err > .fill { background: var(--err); }
.progress.success > .fill { background: var(--success); }

/* ---------- responsive ------------------------------------------------- */
@media (max-width: 960px) {
  .docs-layout { grid-template-columns: 1fr; gap: var(--s-5); }
  .docs-toc { position: static; max-height: none; }
}
@media (max-width: 768px) {
  :root { --page-px: 16px; }
  .page { padding: var(--s-5) var(--page-px); }
  .app-nav { padding: 0 var(--s-4); flex-wrap: wrap; }
  .app-nav .hamburger { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; }
  .app-nav .links { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: var(--s-3) 0; border-top: 1px solid var(--border); order: 10; }
  .app-nav .links.open { display: flex; }
  .app-nav .links a { padding: 10px var(--s-2); border-radius: 0; }
  .app-nav .spacer { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: var(--s-12) 0 var(--s-10); }
  .hero h1 { font-size: clamp(28px, 8vw, 40px); }
  .hero .stats { gap: var(--s-4); }
  .section { padding: var(--s-10) 0; }
  .docs-layout { padding: var(--s-5) var(--page-px) var(--s-12); }
  .card { padding: var(--s-4); }
  .table { font-size: var(--fs-xs); }
  .table th, .table td { padding: 8px 10px; }
  /* allow tables to scroll horizontally */
  .card-flush { overflow-x: auto; }
}
