/*
 * TechWeirdo Tools — UI system
 * A dependency-free port of shadcn/ui (new-york, zinc) to plain CSS.
 * Tokens mirror shadcn's CSS variables so components read the same way:
 * .btn .input .select .textarea .card .badge .tabs .switch .checkbox .slider
 * .accordion .alert .table .kbd .dialog .sheet .command .toast .dropdown …
 */

/* ---------- Fonts (Geist, SIL OFL 1.1 — see /assets/fonts/LICENSE-Geist.txt) ---------- */
@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;

  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);

  --container: 1280px;
  --header-h: 3.5rem;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);

  /* light (zinc) */
  color-scheme: light;
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.21 0.006 285.885);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.985 0 0);
  --success: oklch(0.596 0.145 163.225);
  --warning: oklch(0.666 0.179 58.318);
  --info: oklch(0.546 0.245 262.881);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.705 0.015 286.067);
  --surface: oklch(0.985 0 0);
  --overlay: rgb(0 0 0 / .5);
  --code-bg: oklch(0.985 0.001 286.375);
  --grid-line: oklch(0.141 0.005 285.823 / .045);
  --brand: oklch(0.648 0.2 131.684);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885 / .5);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.21 0.006 285.885);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.92 0.004 286.32);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.985 0 0);
  --success: oklch(0.765 0.177 163.223);
  --warning: oklch(0.828 0.189 84.429);
  --info: oklch(0.707 0.165 254.624);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.552 0.016 285.938);
  --surface: oklch(0.175 0.005 285.823);
  --overlay: rgb(0 0 0 / .7);
  --code-bg: oklch(0.175 0.005 285.823);
  --grid-line: oklch(1 0 0 / .04);
  --brand: oklch(0.841 0.238 128.85);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .3);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .4), 0 1px 2px -1px rgb(0 0 0 / .4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .5), 0 4px 6px -4px rgb(0 0 0 / .5);
  --shadow-xl: 0 20px 40px -5px rgb(0 0 0 / .6), 0 8px 10px -6px rgb(0 0 0 / .5);
}

/* Without JS, follow the OS preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --background: oklch(0.141 0.005 285.823);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.21 0.006 285.885 / .5);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.21 0.006 285.885);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.92 0.004 286.32);
    --primary-foreground: oklch(0.21 0.006 285.885);
    --secondary: oklch(0.274 0.006 286.033);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.274 0.006 286.033);
    --muted-foreground: oklch(0.705 0.015 286.067);
    --accent: oklch(0.274 0.006 286.033);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --success: oklch(0.765 0.177 163.223);
    --warning: oklch(0.828 0.189 84.429);
    --info: oklch(0.707 0.165 254.624);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.552 0.016 285.938);
    --surface: oklch(0.175 0.005 285.823);
    --code-bg: oklch(0.175 0.005 285.823);
    --grid-line: oklch(1 0 0 / .04);
    --brand: oklch(0.841 0.238 128.85);
  }
}

/* Per-tool accent tones (icon tiles, small highlights). */
.tone-coral   { --tone: oklch(0.637 0.237 25.331); }
.tone-violet  { --tone: oklch(0.606 0.25 292.717); }
.tone-amber   { --tone: oklch(0.666 0.179 58.318); }
.tone-teal    { --tone: oklch(0.6 0.118 184.704); }
.tone-pink    { --tone: oklch(0.592 0.249 0.584); }
.tone-red     { --tone: oklch(0.577 0.245 27.325); }
.tone-cyan    { --tone: oklch(0.609 0.126 221.723); }
.tone-orange  { --tone: oklch(0.646 0.222 41.116); }
.tone-lime    { --tone: oklch(0.648 0.2 131.684); }
.tone-purple  { --tone: oklch(0.558 0.288 302.321); }
.tone-sky     { --tone: oklch(0.588 0.158 241.966); }
.tone-indigo  { --tone: oklch(0.585 0.233 277.117); }
.tone-emerald { --tone: oklch(0.596 0.145 163.225); }
.tone-rose    { --tone: oklch(0.586 0.253 17.585); }
.tone-blue    { --tone: oklch(0.546 0.245 262.881); }
.tone-yellow  { --tone: oklch(0.681 0.162 75.834); }
.tone-slate   { --tone: oklch(0.554 0.046 257.417); }
:root[data-theme="dark"] [class*="tone-"] { --tone-l: 1; }
:root[data-theme="dark"] .tone-coral   { --tone: oklch(0.704 0.191 22.216); }
:root[data-theme="dark"] .tone-violet  { --tone: oklch(0.702 0.183 293.541); }
:root[data-theme="dark"] .tone-amber   { --tone: oklch(0.828 0.189 84.429); }
:root[data-theme="dark"] .tone-teal    { --tone: oklch(0.777 0.152 181.912); }
:root[data-theme="dark"] .tone-pink    { --tone: oklch(0.718 0.202 349.761); }
:root[data-theme="dark"] .tone-red     { --tone: oklch(0.704 0.191 22.216); }
:root[data-theme="dark"] .tone-cyan    { --tone: oklch(0.789 0.154 211.53); }
:root[data-theme="dark"] .tone-orange  { --tone: oklch(0.75 0.183 55.934); }
:root[data-theme="dark"] .tone-lime    { --tone: oklch(0.841 0.238 128.85); }
:root[data-theme="dark"] .tone-purple  { --tone: oklch(0.714 0.203 305.504); }
:root[data-theme="dark"] .tone-sky     { --tone: oklch(0.746 0.16 232.661); }
:root[data-theme="dark"] .tone-indigo  { --tone: oklch(0.673 0.182 276.935); }
:root[data-theme="dark"] .tone-emerald { --tone: oklch(0.765 0.177 163.223); }
:root[data-theme="dark"] .tone-rose    { --tone: oklch(0.712 0.194 13.428); }
:root[data-theme="dark"] .tone-blue    { --tone: oklch(0.707 0.165 254.624); }
:root[data-theme="dark"] .tone-yellow  { --tone: oklch(0.852 0.199 91.936); }
:root[data-theme="dark"] .tone-slate   { --tone: oklch(0.704 0.04 256.788); }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; border: 0 solid var(--border); margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); tab-size: 2; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  font-feature-settings: "rlig" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
main { flex: 1 0 auto; }
img, svg, video, canvas, iframe { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button, [role="button"] { cursor: pointer; background: none; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: inherit; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; text-wrap: balance; }
p { text-wrap: pretty; }
ol, ul { list-style: none; }
table { border-collapse: collapse; text-indent: 0; border-color: inherit; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: 1em; }
textarea { resize: vertical; }
[hidden]:where(:not([hidden="until-found"])) { display: none !important; }
::selection { background: color-mix(in oklab, var(--foreground) 15%, transparent); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
dialog { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .5rem 1rem; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-foreground); font-size: .875rem; font-weight: 500; transition: top .15s; }
.skip-link:focus { top: 1rem; }

/* Icons — <svg class="icon"><use href="/assets/icons.svg#name"/></svg> */
.icon { width: 1rem; height: 1rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.icon-xs { width: .75rem; height: .75rem; }
.icon-sm { width: .875rem; height: .875rem; }
.icon-lg { width: 1.25rem; height: 1.25rem; }
.icon-xl { width: 1.5rem; height: 1.5rem; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoom-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.96); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes slide-in-right { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .container { padding-inline: 2rem; } }
.container-sm { max-width: 768px; }
.container-md { max-width: 1024px; }

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 0%; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.gap-1 { gap: .25rem; } .gap-1\.5 { gap: .375rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; } .gap-5 { gap: 1.25rem; } .gap-6 { gap: 1.5rem; } .gap-8 { gap: 2rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-span-full { grid-column: 1 / -1; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }
.text-xs { font-size: .75rem; line-height: 1rem; }
.text-sm { font-size: .875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }
.text-muted { color: var(--muted-foreground); }
.text-foreground { color: var(--foreground); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-destructive { color: var(--destructive); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }
.tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- Typography ---------- */
.h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); line-height: 1.08; font-weight: 700; letter-spacing: -.035em; }
.h2 { font-size: clamp(1.5rem, 1.2rem + 1.1vw, 1.875rem); line-height: 1.2; font-weight: 600; letter-spacing: -.025em; }
.h3 { font-size: 1.125rem; line-height: 1.4; font-weight: 600; letter-spacing: -.01em; }
.lead { font-size: 1.125rem; line-height: 1.65; color: var(--muted-foreground); }
.muted { color: var(--muted-foreground); font-size: .875rem; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; font-weight: 500; color: var(--muted-foreground); }

.prose { color: var(--foreground); font-size: 1rem; line-height: 1.75; max-width: 72ch; }
.prose > * + * { margin-top: 1rem; }
.prose h2 { margin-top: 2.5rem; font-size: 1.5rem; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; scroll-margin-top: 5rem; }
.prose h3 { margin-top: 1.75rem; font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
.prose h2 + *, .prose h3 + * { margin-top: .75rem; }
.prose p, .prose li { color: color-mix(in oklab, var(--foreground) 82%, var(--muted-foreground)); }
.prose a { font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: color-mix(in oklab, var(--foreground) 35%, transparent); }
.prose a:hover { text-decoration-color: var(--foreground); }
.prose strong { font-weight: 600; color: var(--foreground); }
.prose ul { list-style: disc; padding-left: 1.5rem; }
.prose ol { list-style: decimal; padding-left: 1.5rem; }
.prose li + li { margin-top: .5rem; }
.prose li::marker { color: var(--muted-foreground); }
.prose :not(pre) > code { padding: .15rem .35rem; border-radius: var(--radius-sm); background: var(--muted); font-size: .875em; font-weight: 500; }
.prose blockquote { border-left: 2px solid var(--border); padding-left: 1rem; font-style: italic; color: var(--muted-foreground); }
.prose hr { border-top: 1px solid var(--border); margin-block: 2rem; }
.prose table { width: 100%; font-size: .875rem; }
.prose th { text-align: left; font-weight: 500; padding: .5rem; border-bottom: 1px solid var(--border); }
.prose td { padding: .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }

/* Inline code / kbd outside prose */
.code-inline { padding: .1rem .35rem; border-radius: var(--radius-sm); background: var(--muted); font-family: var(--font-mono); font-size: .8125em; }

/* ---------- Button ---------- */
.btn {
  --btn-h: 2.25rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: var(--btn-h);
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-xs);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
  user-select: none;
  outline: none;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
.btn:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.btn:disabled, .btn[aria-disabled="true"] { pointer-events: none; opacity: .5; }
.btn > .icon { width: 1rem; height: 1rem; }
.btn:has(> .icon:first-child) { padding-left: .75rem; }
.btn:has(> .icon:last-child) { padding-right: .75rem; }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: color-mix(in oklab, var(--secondary) 80%, var(--foreground) 6%); }
.btn-outline { background: var(--background); color: var(--foreground); border-color: var(--border); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
:root[data-theme="dark"] .btn-outline { background: color-mix(in oklab, var(--input) 30%, transparent); border-color: var(--input); }
:root[data-theme="dark"] .btn-outline:hover { background: color-mix(in oklab, var(--input) 50%, transparent); }
.btn-ghost { background: transparent; color: var(--foreground); box-shadow: none; }
.btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
:root[data-theme="dark"] .btn-ghost:hover { background: color-mix(in oklab, var(--accent) 60%, transparent); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-destructive:hover { background: color-mix(in oklab, var(--destructive) 90%, transparent); }
:root[data-theme="dark"] .btn-destructive { background: color-mix(in oklab, var(--destructive) 60%, transparent); }
.btn-link { background: transparent; box-shadow: none; color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: transparent; padding-inline: 0; height: auto; }
.btn-link:hover { background: transparent; text-decoration-color: currentColor; }
.btn-sm { --btn-h: 2rem; gap: .375rem; padding: .25rem .75rem; font-size: .8125rem; }
.btn-sm:has(> .icon:first-child) { padding-left: .625rem; }
.btn-xs { --btn-h: 1.75rem; gap: .25rem; padding: .25rem .5rem; font-size: .75rem; border-radius: var(--radius-sm); }
.btn-xs > .icon { width: .875rem; height: .875rem; }
.btn-lg { --btn-h: 2.75rem; padding: .5rem 1.5rem; font-size: .9375rem; border-radius: var(--radius-md); }
.btn-lg:has(> .icon:first-child) { padding-left: 1.125rem; }
.btn-icon { width: var(--btn-h); padding: 0 !important; }
.btn-block { width: 100%; }
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 1rem; height: 1rem; border: 2px solid; border-radius: 999px; border-color: var(--primary-foreground) transparent var(--primary-foreground) var(--primary-foreground); animation: spin .7s linear infinite; }
.btn-outline[aria-busy="true"]::after, .btn-ghost[aria-busy="true"]::after, .btn-secondary[aria-busy="true"]::after { border-color: var(--foreground) transparent var(--foreground) var(--foreground); }

/* Button group */
.btn-group { display: inline-flex; isolation: isolate; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.btn-group > .btn:last-child { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.btn-group > .btn + .btn { margin-left: -1px; }
.btn-group > .btn:focus-visible { z-index: 1; }

/* ---------- Form controls ---------- */
.label { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 500; line-height: 1; user-select: none; }
.label .hint, .label small { margin-left: auto; font-size: .75rem; font-weight: 400; color: var(--muted-foreground); }
.field { display: grid; gap: .5rem; min-width: 0; align-content: start; }
.field-description { font-size: .8125rem; line-height: 1.4; color: var(--muted-foreground); }
.field-error { font-size: .8125rem; color: var(--destructive); }
.fieldset { display: grid; gap: 1rem; }
.fieldset-legend { font-size: .875rem; font-weight: 600; }

.input, .select, .textarea {
  width: 100%;
  min-width: 0;
  height: 2.25rem;
  padding: .25rem .75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: transparent;
  box-shadow: var(--shadow-xs);
  color: var(--foreground);
  font-size: .875rem;
  line-height: 1.25rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
:root[data-theme="dark"] :is(.input, .select, .textarea) { background: color-mix(in oklab, var(--input) 30%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--destructive); box-shadow: 0 0 0 3px color-mix(in oklab, var(--destructive) 20%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled { cursor: not-allowed; opacity: .5; }
.input-lg { height: 2.75rem; font-size: 1rem; padding-inline: 1rem; }
.input-sm { height: 2rem; font-size: .8125rem; }
.input.font-mono, .textarea.font-mono { font-size: .8125rem; }
.input[type="number"] { font-variant-numeric: tabular-nums; }
.input[type="file"] { height: auto; padding: .375rem .5rem; font-size: .8125rem; color: var(--muted-foreground); }
.input[type="file"]::file-selector-button { margin-right: .75rem; height: 1.5rem; padding: 0 .625rem; border: 0; border-radius: var(--radius-sm); background: var(--secondary); color: var(--secondary-foreground); font-size: .8125rem; font-weight: 500; cursor: pointer; }
.input[type="color"] { width: 2.25rem; height: 2.25rem; padding: .25rem; cursor: pointer; }
.input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.input[type="color"]::-webkit-color-swatch { border: 0; border-radius: calc(var(--radius-sm) - 1px); }
.input[type="color"]::-moz-color-swatch { border: 0; border-radius: calc(var(--radius-sm) - 1px); }
.textarea { height: auto; min-height: 5rem; padding-block: .5rem; line-height: 1.5; field-sizing: content; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .625rem center;
  background-size: 1rem;
}
.select option { background: var(--popover); color: var(--popover-foreground); }

/* Input with leading icon / trailing actions */
.input-group { position: relative; display: flex; align-items: center; min-width: 0; }
.input-group > .input { flex: 1; }
.input-group > .icon:first-child { position: absolute; left: .75rem; color: var(--muted-foreground); }
.input-group > .icon:first-child + .input { padding-left: 2.25rem; }
.input-group > .input-actions { position: absolute; right: .25rem; display: flex; gap: .25rem; }
.input-group:has(> .input-actions) > .input { padding-right: 4.5rem; }
.input-addon { display: flex; align-items: stretch; min-width: 0; }
.input-addon > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.input-addon > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-addon > .input, .input-addon > .select { position: relative; }
.input-addon > :focus-visible { z-index: 1; }
.input-addon > .btn { height: auto; min-height: 2.25rem; }

/* Checkbox */
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  border: 1px solid var(--input);
  border-radius: 4px;
  background: transparent;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  outline: none;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
:root[data-theme="dark"] .checkbox { background: color-mix(in oklab, var(--input) 30%, transparent); }
.checkbox:checked, :root[data-theme="dark"] .checkbox:checked { background: var(--primary); border-color: var(--primary); }
.checkbox:checked::after { content: ""; position: absolute; inset: 0; background: var(--primary-foreground); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / .75rem no-repeat; }
.checkbox:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.checkbox:disabled { opacity: .5; cursor: not-allowed; }

/* Radio */
.radio { appearance: none; -webkit-appearance: none; width: 1rem; height: 1rem; flex-shrink: 0; border: 1px solid var(--input); border-radius: 999px; box-shadow: var(--shadow-xs); cursor: pointer; display: grid; place-content: center; }
.radio:checked::before { content: ""; width: .5rem; height: .5rem; border-radius: 999px; background: var(--primary); }
.radio:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }

/* Switch — <input type="checkbox" class="switch" role="switch"> */
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-flex;
  width: 2rem;
  height: 1.15rem;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--input);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  outline: none;
  transition: background-color .2s;
}
:root[data-theme="dark"] .switch { background: color-mix(in oklab, var(--input) 80%, transparent); }
.switch::before { content: ""; position: absolute; top: 50%; left: 1px; width: 1rem; height: 1rem; border-radius: 999px; background: var(--background); box-shadow: var(--shadow-sm); transform: translateY(-50%); transition: transform .2s var(--ease); }
:root[data-theme="dark"] .switch::before { background: var(--foreground); }
.switch:checked, :root[data-theme="dark"] .switch:checked { background: var(--primary); }
.switch:checked::before { transform: translate(calc(2rem - 1rem - 4px), -50%); }
:root[data-theme="dark"] .switch:checked::before { background: var(--primary-foreground); }
.switch:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* Labeled choice rows: <label class="choice"><input class="checkbox|switch"> <span>…</span></label> */
.choice { display: flex; align-items: center; gap: .625rem; font-size: .875rem; cursor: pointer; user-select: none; }
.choice-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem .875rem; border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; transition: background-color .15s, border-color .15s; }
.choice-card:hover { background: color-mix(in oklab, var(--accent) 50%, transparent); }
.choice-card:has(:checked) { border-color: color-mix(in oklab, var(--primary) 30%, var(--border)); }
.choice-card b { display: block; font-size: .875rem; font-weight: 500; }
.choice-card small { display: block; margin-top: .125rem; font-size: .8125rem; color: var(--muted-foreground); line-height: 1.35; }

/* Slider — <input type="range" class="slider"> */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 1.25rem; background: transparent; cursor: pointer; --pct: 50%; }
.slider::-webkit-slider-runnable-track { height: .375rem; border-radius: 999px; background: linear-gradient(to right, var(--primary) var(--pct), var(--muted) var(--pct)); }
.slider::-moz-range-track { height: .375rem; border-radius: 999px; background: var(--muted); }
.slider::-moz-range-progress { height: .375rem; border-radius: 999px; background: var(--primary); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 1rem; height: 1rem; margin-top: -.3125rem; border: 1px solid var(--primary); border-radius: 999px; background: var(--background); box-shadow: var(--shadow-sm); transition: box-shadow .15s; }
.slider::-moz-range-thumb { width: 1rem; height: 1rem; border: 1px solid var(--primary); border-radius: 999px; background: var(--background); box-shadow: var(--shadow-sm); }
.slider:focus-visible { outline: none; }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in oklab, var(--ring) 50%, transparent); }
.slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in oklab, var(--ring) 50%, transparent); }

/* ---------- Toggle group / segmented control ---------- */
.toggle-group { display: inline-flex; align-items: center; gap: 0; padding: 3px; border-radius: var(--radius-lg); background: var(--muted); color: var(--muted-foreground); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.toggle-group::-webkit-scrollbar { display: none; }
.toggle-group.w-full { display: flex; }
.toggle-group.w-full > * { flex: 1 1 0; }
.toggle-item {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  height: calc(2.25rem - 6px); padding: .25rem .75rem;
  border: 1px solid transparent; border-radius: var(--radius-md);
  color: var(--foreground); font-size: .8125rem; font-weight: 500; white-space: nowrap;
  transition: color .15s, background-color .15s, box-shadow .15s;
}
:root[data-theme="dark"] .toggle-item { color: var(--muted-foreground); }
.toggle-item:hover { color: var(--foreground); }
.toggle-item:is(.active, .is-active, [aria-pressed="true"], [aria-checked="true"], [aria-selected="true"], [data-state="on"]) { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .toggle-item:is(.active, .is-active, [aria-pressed="true"], [aria-checked="true"], [aria-selected="true"], [data-state="on"]) { background: color-mix(in oklab, var(--input) 30%, transparent); border-color: var(--input); color: var(--foreground); }
.toggle-item:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.toggle-item > .icon { width: .875rem; height: .875rem; }

/* Outline toggle chips (presets) */
.chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.chip {
  display: inline-flex; align-items: center; gap: .375rem;
  height: 1.75rem; padding: 0 .625rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--background); color: var(--foreground);
  font-size: .75rem; font-weight: 500; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
:root[data-theme="dark"] .chip { background: color-mix(in oklab, var(--input) 20%, transparent); }
.chip:hover { background: var(--accent); }
.chip:is(.active, .is-active, [aria-pressed="true"]) { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.chip:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.chip .icon { width: .75rem; height: .75rem; }
.chip-mono { font-family: var(--font-mono); font-size: .6875rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.tabs-list { display: inline-flex; align-items: center; width: fit-content; max-width: 100%; height: 2.25rem; padding: 3px; border-radius: var(--radius-lg); background: var(--muted); color: var(--muted-foreground); overflow-x: auto; scrollbar-width: none; }
.tabs-list::-webkit-scrollbar { display: none; }
.tabs-list.w-full { width: 100%; }
.tabs-list.w-full > .tabs-trigger { flex: 1 1 0; }
.tabs-trigger {
  display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: .375rem;
  height: 100%; padding: .25rem .75rem;
  border: 1px solid transparent; border-radius: var(--radius-md);
  color: var(--foreground); font-size: .875rem; font-weight: 500; white-space: nowrap;
  transition: color .15s, box-shadow .15s, background-color .15s;
}
:root[data-theme="dark"] .tabs-trigger { color: var(--muted-foreground); }
.tabs-trigger:hover { color: var(--foreground); }
.tabs-trigger:is([aria-selected="true"], .active, .is-active, [data-state="active"]) { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .tabs-trigger:is([aria-selected="true"], .active, .is-active, [data-state="active"]) { background: color-mix(in oklab, var(--input) 30%, transparent); border-color: var(--input); color: var(--foreground); }
.tabs-trigger:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.tabs-trigger > .icon { width: .875rem; height: .875rem; }
.tabs-trigger .count { min-width: 1.25rem; padding: 0 .3rem; border-radius: 999px; background: var(--muted); font-size: .6875rem; font-variant-numeric: tabular-nums; }
.tabs-content { min-width: 0; outline: none; }

/* Underline tabs variant */
.tabs-line { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs-line::-webkit-scrollbar { display: none; }
.tabs-line > .tabs-trigger { height: 2.5rem; margin-bottom: -1px; padding-inline: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent !important; box-shadow: none !important; color: var(--muted-foreground); }
.tabs-line > .tabs-trigger:is([aria-selected="true"], .active, .is-active) { border-color: var(--foreground); color: var(--foreground); }

/* ---------- Card ---------- */
.card { display: flex; flex-direction: column; gap: 1.5rem; padding-block: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); color: var(--card-foreground); box-shadow: var(--shadow-sm); min-width: 0; }
.card-header { display: grid; grid-auto-rows: min-content; grid-template-rows: auto auto; align-items: start; gap: .375rem; padding-inline: 1.5rem; }
.card-header:has(.card-action) { grid-template-columns: 1fr auto; }
.card-header.bordered { padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.card-title { font-size: 1rem; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; }
.card-description { font-size: .875rem; color: var(--muted-foreground); line-height: 1.45; }
.card-action { grid-column: 2; grid-row: 1 / span 2; align-self: start; justify-self: end; display: flex; gap: .5rem; align-items: center; }
.card-content { padding-inline: 1.5rem; min-width: 0; }
.card-footer { display: flex; align-items: center; gap: .5rem; padding-inline: 1.5rem; }
.card-footer.bordered { padding-top: 1.25rem; border-top: 1px solid var(--border); }
.card-compact { gap: 1rem; padding-block: 1rem; }
.card-compact > :is(.card-header, .card-content, .card-footer) { padding-inline: 1rem; }
.card-flush { padding: 0; gap: 0; overflow: hidden; }
.card-flat { box-shadow: none; }
.card-muted { background: var(--surface); box-shadow: none; }
a.card { transition: border-color .15s, background-color .15s, box-shadow .15s, transform .15s; }
a.card:hover { border-color: color-mix(in oklab, var(--foreground) 20%, var(--border)); box-shadow: var(--shadow-md); }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  width: fit-content; padding: .125rem .5rem;
  border: 1px solid transparent; border-radius: var(--radius-md);
  background: var(--primary); color: var(--primary-foreground);
  font-size: .75rem; font-weight: 500; line-height: 1rem; white-space: nowrap;
  flex-shrink: 0; overflow: hidden;
}
.badge > .icon { width: .75rem; height: .75rem; }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { background: transparent; color: var(--foreground); border-color: var(--border); }
.badge-destructive { background: var(--destructive); color: #fff; }
.badge-success { background: color-mix(in oklab, var(--success) 14%, transparent); color: var(--success); border-color: color-mix(in oklab, var(--success) 25%, transparent); }
.badge-warning { background: color-mix(in oklab, var(--warning) 16%, transparent); color: color-mix(in oklab, var(--warning) 80%, var(--foreground)); border-color: color-mix(in oklab, var(--warning) 30%, transparent); }
.badge-error { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); border-color: color-mix(in oklab, var(--destructive) 25%, transparent); }
.badge-info { background: color-mix(in oklab, var(--info) 12%, transparent); color: var(--info); border-color: color-mix(in oklab, var(--info) 25%, transparent); }
.badge-tone { background: color-mix(in oklab, var(--tone) 12%, transparent); color: var(--tone); border-color: color-mix(in oklab, var(--tone) 22%, transparent); }
.badge-pill { border-radius: 999px; }
.badge-lg { padding: .25rem .75rem; font-size: .8125rem; }
.dot { width: .5rem; height: .5rem; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.dot-pulse { position: relative; }
.dot-pulse::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; animation: ping 1.5s cubic-bezier(0, 0, .2, 1) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }

/* ---------- Status line (inline result messages) ---------- */
.status { display: flex; align-items: center; gap: .5rem; min-height: 1.25rem; font-size: .8125rem; color: var(--muted-foreground); }
.status:empty { display: none; }
.status::before { content: ""; width: .375rem; height: .375rem; border-radius: 999px; background: currentColor; opacity: .7; flex-shrink: 0; }
.status:is(.ok, .is-good, .success) { color: var(--success); }
.status:is(.err, .is-error, .error) { color: var(--destructive); }
.status:is(.warn, .is-warning) { color: var(--warning); }
.status:is(.working, .is-working)::before { width: .75rem; height: .75rem; border: 2px solid currentColor; border-right-color: transparent; background: none; animation: spin .7s linear infinite; opacity: 1; }

/* ---------- Alert ---------- */
.alert { position: relative; display: grid; grid-template-columns: 0 1fr; align-items: start; gap: .125rem 0; width: 100%; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--card-foreground); font-size: .875rem; }
.alert:has(> .icon) { grid-template-columns: 1rem 1fr; column-gap: .75rem; }
.alert > .icon { width: 1rem; height: 1rem; transform: translateY(.125rem); color: currentColor; }
.alert-title { grid-column: 2; min-height: 1rem; font-weight: 500; letter-spacing: -.01em; line-height: 1.4; }
.alert-description { grid-column: 2; display: grid; gap: .25rem; color: var(--muted-foreground); font-size: .875rem; line-height: 1.5; }
.alert-destructive { color: var(--destructive); }
.alert-destructive .alert-description { color: color-mix(in oklab, var(--destructive) 90%, var(--foreground)); }
.alert-success { color: var(--success); border-color: color-mix(in oklab, var(--success) 30%, var(--border)); background: color-mix(in oklab, var(--success) 6%, var(--card)); }
.alert-success .alert-description { color: color-mix(in oklab, var(--success) 70%, var(--foreground)); }
.alert-warning { color: color-mix(in oklab, var(--warning) 85%, var(--foreground)); border-color: color-mix(in oklab, var(--warning) 35%, var(--border)); background: color-mix(in oklab, var(--warning) 7%, var(--card)); }
.alert-warning .alert-description { color: color-mix(in oklab, var(--warning) 55%, var(--foreground)); }
.alert-info { color: var(--info); }

/* ---------- Separator ---------- */
.separator { height: 1px; width: 100%; background: var(--border); flex-shrink: 0; }
.separator-v { width: 1px; height: 1rem; background: var(--border); flex-shrink: 0; align-self: center; }

/* ---------- Kbd ---------- */
.kbd, kbd.kbd { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem; border-radius: var(--radius-sm); background: var(--muted); color: var(--muted-foreground); font-family: var(--font-sans); font-size: .75rem; font-weight: 500; line-height: 1; pointer-events: none; user-select: none; }
.kbd-group { display: inline-flex; align-items: center; gap: .25rem; }

/* ---------- Table ---------- */
.table-container { position: relative; width: 100%; overflow-x: auto; }
.table { width: 100%; caption-side: bottom; font-size: .875rem; }
.table thead tr { border-bottom: 1px solid var(--border); }
.table tbody tr { border-bottom: 1px solid var(--border); transition: background-color .15s; }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); }
.table th { height: 2.5rem; padding: 0 .5rem; text-align: left; vertical-align: middle; font-weight: 500; color: var(--foreground); white-space: nowrap; }
.table td { padding: .5rem; vertical-align: middle; }
.table caption { margin-top: 1rem; font-size: .875rem; color: var(--muted-foreground); }
.table .mono { font-family: var(--font-mono); font-size: .8125rem; }

/* ---------- Accordion (<details>) ---------- */
.accordion { width: 100%; }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: 0; }
.accordion-trigger { display: flex; flex: 1; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-radius: var(--radius-md); font-size: .9375rem; font-weight: 500; text-align: left; cursor: pointer; outline: none; transition: color .15s; }
.accordion-trigger:hover { text-decoration: underline; text-underline-offset: 4px; }
.accordion-trigger:focus-visible { box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.accordion-trigger::after { content: ""; width: 1rem; height: 1rem; flex-shrink: 0; margin-top: .125rem; background: var(--muted-foreground); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform .2s; }
.accordion-item[open] > .accordion-trigger::after { transform: rotate(180deg); }
.accordion-content { padding-bottom: 1rem; font-size: .9375rem; line-height: 1.65; color: color-mix(in oklab, var(--foreground) 80%, var(--muted-foreground)); }
.accordion-content > * + * { margin-top: .75rem; }
.accordion-content code { padding: .1rem .3rem; border-radius: var(--radius-sm); background: var(--muted); font-size: .85em; }
.accordion-content a { text-decoration: underline; text-underline-offset: 3px; }
.accordion-item[open] > .accordion-content { animation: slide-up .2s var(--ease); }

/* Collapsible section (design groups) */
.collapsible { border-top: 1px solid var(--border); }
.collapsible > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .875rem 1.5rem; font-size: .875rem; font-weight: 500; cursor: pointer; user-select: none; }
.collapsible > summary:hover { background: color-mix(in oklab, var(--accent) 40%, transparent); }
.collapsible > summary:focus-visible { outline-offset: -2px; }
.collapsible > summary::after { content: ""; width: 1rem; height: 1rem; background: var(--muted-foreground); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; transition: transform .2s; }
.collapsible[open] > summary::after { transform: rotate(180deg); }
.collapsible-body { display: grid; gap: 1rem; padding: .25rem 1.5rem 1.5rem; }

/* ---------- Progress / skeleton / spinner ---------- */
.progress { position: relative; width: 100%; height: .5rem; overflow: hidden; border-radius: 999px; background: color-mix(in oklab, var(--primary) 20%, transparent); }
.progress > i, .progress-indicator { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width .2s; }
.skeleton { border-radius: var(--radius-md); background: var(--accent); animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.spinner { display: inline-block; width: 1rem; height: 1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px; animation: spin .7s linear infinite; vertical-align: -.125em; flex-shrink: 0; }

/* ---------- Empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; min-height: 14rem; padding: 2rem 1.5rem; border: 1px dashed var(--border); border-radius: var(--radius-lg); text-align: center; }
.empty-media { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-lg); background: var(--muted); color: var(--foreground); }
.empty-media .icon { width: 1.25rem; height: 1.25rem; }
.empty-title { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.empty-description { max-width: 26rem; font-size: .875rem; line-height: 1.55; color: var(--muted-foreground); }
.empty-plain { border: 0; }

/* ---------- Code / output blocks ---------- */
.code-block { position: relative; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--code-bg); overflow: hidden; }
.code-block pre, pre.code-block, .code-output { margin: 0; padding: 1rem; overflow: auto; font-family: var(--font-mono); font-size: .8125rem; line-height: 1.65; white-space: pre; color: var(--foreground); tab-size: 2; }
.code-output { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--code-bg); max-height: 32rem; }
.code-output.wrap, .code-output.wrap-lines, .wrap-lines { white-space: pre-wrap; word-break: break-word; }
.code-block-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.5rem; padding: .375rem .375rem .375rem .875rem; border-bottom: 1px solid var(--border); font-size: .75rem; color: var(--muted-foreground); }

/* Key/value description list */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.kv-grid > div, .kv-grid > .kv { display: grid; gap: .25rem; align-content: start; padding: .75rem 1rem; min-width: 0; box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border); }
.kv-grid dt { font-size: .75rem; color: var(--muted-foreground); }
.kv-grid dd { font-family: var(--font-mono); font-size: .8125rem; word-break: break-word; }
.kv-grid .wide { grid-column: 1 / -1; }

/* Item list (shadcn Item) */
.item-list { display: grid; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.item { display: flex; align-items: center; gap: .75rem; min-width: 0; padding: .625rem .75rem; font-size: .875rem; }
.item + .item { border-top: 1px solid var(--border); }
.item-media { display: grid; place-items: center; width: 2rem; height: 2rem; flex-shrink: 0; border-radius: var(--radius-md); background: var(--muted); }
.item-content { flex: 1; min-width: 0; display: grid; gap: .125rem; }
.item-title { font-weight: 500; }
.item-description { color: var(--muted-foreground); font-size: .8125rem; }
.item-actions { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }

/* Numbered output rows */
.out-list { display: grid; max-height: 28rem; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--code-bg); }
.out-row { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: center; gap: .5rem; min-height: 2.5rem; padding: .25rem .375rem .25rem 0; border-bottom: 1px solid var(--border); }
.out-row:last-child { border-bottom: 0; }
.out-row:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); }
.out-row > span { color: var(--muted-foreground); font-family: var(--font-mono); font-size: .6875rem; text-align: right; font-variant-numeric: tabular-nums; }
.out-row > code { font-size: .8125rem; overflow-wrap: anywhere; }

/* Dropzone */
.dropzone { display: grid; place-items: center; gap: .5rem; min-height: 11rem; padding: 1.5rem; border: 1.5px dashed var(--border); border-radius: var(--radius-lg); background: color-mix(in oklab, var(--muted) 35%, transparent); text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; outline: none; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover, .dropzone.drag { border-color: color-mix(in oklab, var(--foreground) 40%, var(--border)); background: color-mix(in oklab, var(--muted) 70%, transparent); }
.dropzone:focus-visible { box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }

/* ---------- Tooltip (CSS only: data-tooltip="…") ---------- */
[data-tooltip] { position: relative; }
@media (hover: hover) {
  [data-tooltip]::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 6px); z-index: 60; padding: .375rem .625rem; border-radius: var(--radius-md); background: var(--foreground); color: var(--background); font-size: .75rem; font-weight: 500; line-height: 1.2; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, 2px); transition: opacity .12s, transform .12s; transition-delay: 0s; }
  [data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .35s; }
  [data-tooltip-side="bottom"]::after { bottom: auto; top: calc(100% + 6px); }
}

/* ---------- Dialog (native <dialog class="dialog">) ---------- */
.dialog { position: fixed; top: 50%; left: 50%; z-index: 80; width: calc(100% - 2rem); max-width: 32rem; max-height: calc(100dvh - 2rem); margin: 0; padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xl); transform: translate(-50%, -50%); overflow: auto; }
.dialog[open] { display: grid; gap: 1rem; animation: zoom-in .18s var(--ease); }
.dialog::backdrop { background: var(--overlay); animation: fade-in .18s; }
.dialog-header { display: grid; gap: .5rem; text-align: left; }
.dialog-title { font-size: 1.125rem; font-weight: 600; line-height: 1; letter-spacing: -.01em; }
.dialog-description { font-size: .875rem; color: var(--muted-foreground); line-height: 1.5; }
.dialog-footer { display: flex; flex-direction: column-reverse; gap: .5rem; }
@media (min-width: 640px) { .dialog-footer { flex-direction: row; justify-content: flex-end; } }
.dialog-close { position: absolute; top: 1rem; right: 1rem; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: var(--radius-sm); color: var(--muted-foreground); opacity: .8; transition: opacity .15s, background-color .15s; }
.dialog-close:hover { opacity: 1; background: var(--accent); }
body:has(dialog[open]) { overflow: hidden; }

/* ---------- Sheet (side dialog) ---------- */
.sheet { position: fixed; inset: 0 0 0 auto; z-index: 80; width: min(22rem, 85vw); max-width: none; height: 100dvh; max-height: none; margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--border); background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xl); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; animation: slide-in-right .25s var(--ease); }
.sheet::backdrop { background: var(--overlay); animation: fade-in .2s; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--header-h); padding: 0 .75rem 0 1rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 1rem; overscroll-behavior: contain; }
.sheet-footer { padding: 1rem; border-top: 1px solid var(--border); }

/* ---------- Dropdown menu / popover ---------- */
.dropdown { position: relative; }
.dropdown-menu, .popover { position: absolute; top: calc(100% + .375rem); right: 0; z-index: 70; min-width: 9rem; padding: .25rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-md); animation: pop-in .14s var(--ease); }
.dropdown-menu[hidden], .popover[hidden] { display: none; }
.dropdown-label { padding: .375rem .5rem; font-size: .75rem; font-weight: 500; color: var(--muted-foreground); }
.dropdown-item { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .375rem .5rem; border-radius: var(--radius-sm); font-size: .875rem; text-align: left; cursor: default; outline: none; }
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--accent); color: var(--accent-foreground); }
.dropdown-item .icon { color: var(--muted-foreground); }
.dropdown-item[aria-checked="true"]::after { content: ""; margin-left: auto; width: 1rem; height: 1rem; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.dropdown-separator { height: 1px; margin: .25rem -.25rem; background: var(--border); }

/* ---------- Command palette ---------- */
.command-dialog { position: fixed; top: 12vh; left: 50%; z-index: 90; width: calc(100% - 2rem); max-width: 36rem; max-height: min(32rem, 76dvh); margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-xl); transform: translateX(-50%); overflow: hidden; }
.command-dialog[open] { display: flex; flex-direction: column; animation: pop-in .16s var(--ease); }
.command-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); animation: fade-in .15s; }
.command-input-wrap { display: flex; align-items: center; gap: .5rem; height: 3rem; padding: 0 .75rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.command-input-wrap > .icon { color: var(--muted-foreground); opacity: .6; }
.command-input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: .9375rem; outline: none; }
.command-input::placeholder { color: var(--muted-foreground); }
.command-input::-webkit-search-cancel-button { display: none; }
.command-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: .25rem; scroll-padding-block: .25rem; }
.command-group + .command-group { margin-top: .25rem; }
.command-group-heading { padding: .5rem .5rem .375rem; font-size: .75rem; font-weight: 500; color: var(--muted-foreground); }
.command-item { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 2.75rem; padding: .375rem .5rem; border-radius: var(--radius-md); font-size: .875rem; text-align: left; cursor: pointer; outline: none; }
.command-item[aria-selected="true"] { background: var(--accent); color: var(--accent-foreground); }
.command-item .tool-icon { width: 1.75rem; height: 1.75rem; border-radius: var(--radius-sm); }
.command-item .tool-icon .icon { width: .875rem; height: .875rem; }
.command-item-text { display: grid; min-width: 0; flex: 1; }
.command-item-text b { font-weight: 500; }
.command-item-text small { font-size: .75rem; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-item > .icon:last-child { color: var(--muted-foreground); opacity: 0; }
.command-item[aria-selected="true"] > .icon:last-child { opacity: 1; }
.command-empty { padding: 2.5rem 1rem; font-size: .875rem; text-align: center; color: var(--muted-foreground); }
.command-footer { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; height: 2.5rem; padding: 0 .75rem; border-top: 1px solid var(--border); font-size: .75rem; color: var(--muted-foreground); flex-shrink: 0; }
.command-footer span { display: inline-flex; align-items: center; gap: .375rem; }

/* ---------- Toasts (sonner-like) ---------- */
.toaster { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column-reverse; gap: .5rem; width: min(22.25rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: .625rem; width: 100%; padding: .875rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-lg); font-size: .875rem; pointer-events: auto; animation: slide-up .22s var(--ease); transition: opacity .2s, transform .2s; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
.toast > .icon { margin-top: .125rem; }
.toast-success > .icon { color: var(--success); }
.toast-error > .icon { color: var(--destructive); }
.toast-warning > .icon { color: var(--warning); }
.toast-body { display: grid; gap: .125rem; min-width: 0; }
.toast-title { font-weight: 500; overflow-wrap: anywhere; }
.toast-description { color: var(--muted-foreground); font-size: .8125rem; overflow-wrap: anywhere; }
@media (max-width: 639px) { .toaster { left: 50%; right: auto; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); } }

/* ---------- Breadcrumb ---------- */
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; font-size: .875rem; color: var(--muted-foreground); overflow-wrap: anywhere; }
.breadcrumb li { display: inline-flex; align-items: center; gap: .375rem; }
.breadcrumb a { transition: color .15s; }
.breadcrumb a:hover { color: var(--foreground); }
.breadcrumb [aria-current="page"] { color: var(--foreground); font-weight: 400; }
.breadcrumb li + li::before { content: ""; width: .875rem; height: .875rem; background: currentColor; opacity: .7; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ---------- Tool icon tile ---------- */
.tool-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex-shrink: 0; border: 1px solid color-mix(in oklab, var(--tone, var(--foreground)) 18%, transparent); border-radius: var(--radius-lg); background: color-mix(in oklab, var(--tone, var(--foreground)) 10%, transparent); color: var(--tone, var(--foreground)); }
.tool-icon .icon { width: 1.25rem; height: 1.25rem; }
.tool-icon-lg { width: 3rem; height: 3rem; border-radius: var(--radius-xl); }
.tool-icon-lg .icon { width: 1.5rem; height: 1.5rem; }
.tool-icon-sm { width: 2rem; height: 2rem; border-radius: var(--radius-md); }
.tool-icon-sm .icon { width: 1rem; height: 1rem; }

/* ============================================================
   Site shell
   ============================================================ */
.site-header { position: sticky; top: 0; z-index: 50; width: 100%; border-bottom: 1px solid transparent; background: color-mix(in oklab, var(--background) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); transition: border-color .2s; }
.site-header.is-scrolled, .site-header:has(.mega[data-open]) { border-bottom-color: var(--border); }
.site-header-inner { display: flex; align-items: center; gap: .5rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .5rem; margin-right: .75rem; font-weight: 600; font-size: .9375rem; letter-spacing: -.02em; white-space: nowrap; border-radius: var(--radius-md); }
.brand-mark { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: .5rem; background: #18181b; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08); }
.brand-mark svg { width: 1.125rem; height: 1.125rem; }
.brand-name small { margin-left: .125rem; font-weight: 400; color: var(--muted-foreground); }
.main-nav { display: none; align-items: center; gap: .125rem; }
.nav-link { display: inline-flex; align-items: center; gap: .25rem; height: 2.25rem; padding: 0 .75rem; border-radius: var(--radius-md); font-size: .875rem; font-weight: 500; color: color-mix(in oklab, var(--foreground) 70%, transparent); transition: color .15s, background-color .15s; white-space: nowrap; }
.nav-link:hover, .nav-link[aria-expanded="true"] { color: var(--foreground); background: var(--accent); }
.nav-link[aria-current="page"] { color: var(--foreground); }
.nav-link .icon { width: .75rem; height: .75rem; transition: transform .2s; }
.nav-link[aria-expanded="true"] .icon { transform: rotate(180deg); }
.header-actions { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.search-trigger { display: none; align-items: center; gap: .5rem; width: 15rem; height: 2.25rem; padding: 0 .375rem 0 .75rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: color-mix(in oklab, var(--muted) 50%, transparent); color: var(--muted-foreground); font-size: .875rem; box-shadow: var(--shadow-xs); transition: background-color .15s, color .15s; }
.search-trigger:hover { background: var(--accent); color: var(--foreground); }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger .kbd { background: var(--background); border: 1px solid var(--border); }
@media (min-width: 768px) { .search-trigger { display: inline-flex; } .search-icon-btn { display: none !important; } }
@media (min-width: 1024px) { .main-nav { display: flex; } .menu-btn { display: none !important; } }
@media (min-width: 1180px) { .search-trigger { width: 17rem; } }

/* Mega menu */
.mega { position: relative; }
.mega-panel { position: absolute; top: calc(100% + .5rem); left: 0; z-index: 60; width: min(54rem, calc(100vw - 2rem)); padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-xl); }
.mega:not([data-open]) .mega-panel { display: none; }
.mega[data-open] .mega-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem; animation: pop-in .14s var(--ease); }
.mega-col { display: grid; align-content: start; gap: .25rem; }
.mega-group { padding: .375rem; }
.nav-heading { padding: .25rem .5rem .375rem; font-size: .75rem; font-weight: 500; color: var(--muted-foreground); }
.mega-link { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: var(--radius-md); transition: background-color .15s; }
.mega-link:hover, .mega-link:focus-visible { background: var(--accent); outline: none; }
.mega-link .tool-icon { width: 2.125rem; height: 2.125rem; border-radius: var(--radius-md); }
.mega-link .tool-icon .icon { width: 1rem; height: 1rem; }
.mega-link b { display: block; font-size: .875rem; font-weight: 500; line-height: 1.3; }
.mega-link small { display: block; font-size: .75rem; line-height: 1.35; color: var(--muted-foreground); }
.mega-link[aria-current="page"] b::after { content: " · current"; font-weight: 400; color: var(--muted-foreground); }

/* Mobile nav sheet content */
.mobile-nav .nav-heading { margin-top: 1rem; }
.mobile-nav .nav-heading:first-child { margin-top: 0; }
.mobile-nav a { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: var(--radius-md); font-size: .9375rem; font-weight: 500; }
.mobile-nav a:hover, .mobile-nav a[aria-current="page"] { background: var(--accent); }
.mobile-nav .tool-icon { width: 2rem; height: 2rem; border-radius: var(--radius-md); }
.mobile-nav .tool-icon .icon { width: 1rem; height: 1rem; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; padding: 3px; border-radius: var(--radius-lg); background: var(--muted); }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; gap: .375rem; height: 2rem; border-radius: var(--radius-md); font-size: .8125rem; font-weight: 500; color: var(--muted-foreground); }
.theme-switch button[aria-checked="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }

/* Theme toggle icon swap */
.theme-toggle .i-sun, .theme-toggle .i-moon { transition: transform .3s var(--ease), opacity .2s; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .i-moon { display: none; }

/* Footer */
.site-footer { margin-top: 5rem; border-top: 1px solid var(--border); background: var(--surface); font-size: .875rem; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; padding-block: 3.5rem 2.5rem; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); } }
.footer-brand p { margin-top: .875rem; max-width: 20rem; color: var(--muted-foreground); line-height: 1.6; }
.footer-col h2 { margin-bottom: .875rem; font-size: .8125rem; font-weight: 600; }
.footer-col ul { display: grid; gap: .625rem; }
.footer-col a { color: var(--muted-foreground); transition: color .15s; }
.footer-col a:hover { color: var(--foreground); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.5rem; border-top: 1px solid var(--border); font-size: .8125rem; color: var(--muted-foreground); }
.footer-bottom a { text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom a:hover { color: var(--foreground); }
.status-pill { display: inline-flex; align-items: center; gap: .5rem; }
.status-pill .dot { color: var(--success); }

/* ============================================================
   Pages
   ============================================================ */
.page { padding-top: 1.5rem; }
.page-header { display: grid; gap: 1rem; padding-block: 1.25rem 2rem; }
.page-header-top { display: flex; align-items: center; gap: .875rem; }
.page-header h1 { font-size: clamp(1.875rem, 1.3rem + 2.2vw, 2.75rem); line-height: 1.1; font-weight: 700; letter-spacing: -.035em; }
.page-header .lead { max-width: 48rem; font-size: 1.0625rem; }
.page-header .badges { display: flex; flex-wrap: wrap; gap: .375rem; }
@media (min-width: 768px) { .page-header .lead { font-size: 1.125rem; } }

.section { padding-block: 3rem; }
.section-head { display: grid; gap: .5rem; align-content: start; margin-bottom: 1.75rem; max-width: 48rem; }
.section-head h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 1.875rem); line-height: 1.2; font-weight: 600; letter-spacing: -.025em; }
.section-head p { color: var(--muted-foreground); font-size: 1rem; line-height: 1.6; }
.section-head.center { margin-inline: auto; text-align: center; justify-items: center; }

/* Tool workspace layouts */
.workspace { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 1024px) {
  .workspace-split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .workspace-sidebar { grid-template-columns: 22rem minmax(0, 1fr); }
  .workspace-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky-panel { position: sticky; top: calc(var(--header-h) + 1rem); }
}

/* Docs/content area under tools */
.doc { display: grid; gap: 3rem; margin-top: 4rem; }
@media (min-width: 1024px) { .doc { grid-template-columns: minmax(0, 1fr) 15rem; gap: 4rem; } }
.doc-main { display: grid; gap: 3.5rem; min-width: 0; }
.doc-main > section { scroll-margin-top: 5rem; }
.doc-main h2 { font-size: 1.5rem; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; }
.doc-aside { display: none; }
@media (min-width: 1024px) { .doc-aside { display: block; } .doc-aside > div { position: sticky; top: calc(var(--header-h) + 1.5rem); } }
.toc h2 { margin-bottom: .75rem; font-size: .875rem; font-weight: 500; }
.toc ul { display: grid; gap: .5rem; font-size: .875rem; }
.toc a { color: var(--muted-foreground); transition: color .15s; }
.toc a:hover, .toc a.active { color: var(--foreground); }
.toc-card { margin-top: 1.5rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); font-size: .8125rem; line-height: 1.5; color: var(--muted-foreground); }
.toc-card b { display: block; margin-bottom: .25rem; color: var(--foreground); font-weight: 500; font-size: .875rem; }

/* Steps */
.steps { display: grid; gap: 0; counter-reset: step; margin-top: 1.25rem; }
.steps > li { position: relative; padding: 0 0 1.75rem 3rem; counter-increment: step; }
.steps > li:last-child { padding-bottom: 0; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: -.125rem; display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--border); border-radius: 999px; background: var(--background); font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 1rem; top: 2.125rem; bottom: .25rem; width: 1px; background: var(--border); }
.steps h3 { font-size: 1rem; font-weight: 600; line-height: 1.5; }
.steps p { margin-top: .25rem; color: color-mix(in oklab, var(--foreground) 75%, var(--muted-foreground)); font-size: .9375rem; line-height: 1.65; }

/* Feature grid */
.feature-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin-top: 1.25rem; }
.feature { display: grid; gap: .5rem; align-content: start; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); }
.feature .tool-icon, .feature-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; margin-bottom: .5rem; border-radius: var(--radius-md); background: var(--muted); color: var(--foreground); }
.feature-icon .icon { width: 1.125rem; height: 1.125rem; }
.feature h3 { font-size: .9375rem; font-weight: 600; }
.feature p { font-size: .875rem; line-height: 1.6; color: var(--muted-foreground); }
.feature p code { font-size: .8125rem; }

/* FAQ block */
.faq { margin-top: 1rem; border-top: 1px solid var(--border); }
.faq .accordion-item { border-bottom: 1px solid var(--border); }
.faq .accordion-item:last-child { border-bottom: 1px solid var(--border); }

/* Related tools */
.related-grid { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr); margin-top: 1.25rem; }
@media (min-width: 640px) { .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tool-card { position: relative; display: flex; flex-direction: column; gap: .75rem; min-height: 100%; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .2s, transform .2s; }
.tool-card:hover { border-color: color-mix(in oklab, var(--tone, var(--foreground)) 35%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tool-card:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent); }
.tool-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.tool-card h3 { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.tool-card p { font-size: .875rem; line-height: 1.55; color: var(--muted-foreground); }
.tool-card .badge { font-weight: 500; }
.tool-card-arrow { margin-top: auto; display: inline-flex; align-items: center; gap: .375rem; font-size: .8125rem; font-weight: 500; color: var(--muted-foreground); transition: color .15s, gap .15s; }
.tool-card:hover .tool-card-arrow { color: var(--foreground); gap: .5rem; }
.tool-card-row { flex-direction: row; align-items: center; gap: .875rem; padding: .875rem 1rem; }
.tool-card-row > span { display: grid; gap: .125rem; }
.tool-card-row h3 { font-size: .9375rem; }
.tool-card-row p { font-size: .8125rem; }
.tool-card-row > .icon { margin-left: auto; color: var(--muted-foreground); }

/* Privacy note line */
.note { display: flex; align-items: flex-start; gap: .5rem; font-size: .8125rem; line-height: 1.5; color: var(--muted-foreground); }
.note .icon { margin-top: .125rem; width: .875rem; height: .875rem; }

/* ============================================================
   Home
   ============================================================ */
.hero { position: relative; isolation: isolate; padding-block: 4.5rem 3.5rem; text-align: center; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%); -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%); }
.hero::after { content: ""; position: absolute; left: 50%; top: -12rem; z-index: -1; width: 56rem; height: 28rem; transform: translateX(-50%); background: radial-gradient(closest-side, color-mix(in oklab, var(--brand) 16%, transparent), transparent); filter: blur(20px); opacity: .9; }
.hero-badge { display: inline-flex; align-items: center; gap: .5rem; height: 2rem; padding: 0 .375rem 0 .75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--background); font-size: .8125rem; font-weight: 500; box-shadow: var(--shadow-xs); }
.hero-badge .badge { border-radius: 999px; }
.hero h1 { margin: 1.5rem auto 0; max-width: 54rem; font-size: clamp(2.375rem, 1.4rem + 4.2vw, 4.25rem); line-height: 1.02; font-weight: 700; letter-spacing: -.045em; }
.hero h1 .muted-part { color: var(--muted-foreground); }
.hero .lead { margin: 1.25rem auto 0; max-width: 42rem; font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 2rem; }
.hero-search { display: flex; align-items: center; gap: .75rem; width: min(100%, 34rem); height: 3.25rem; margin: 2rem auto 0; padding: 0 .5rem 0 1rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--background); color: var(--muted-foreground); font-size: 1rem; box-shadow: var(--shadow-md), 0 0 0 4px color-mix(in oklab, var(--muted) 60%, transparent); transition: box-shadow .2s, border-color .2s; }
.hero-search:hover { border-color: color-mix(in oklab, var(--foreground) 25%, var(--border)); }
.hero-search span { flex: 1; text-align: left; }
.hero-search .kbd { height: 1.5rem; padding: 0 .4rem; border: 1px solid var(--border); background: var(--muted); }
.hero-badge .short { display: none; }
@media (max-width: 639px) { .hero-badge .long { display: none; } .hero-badge .short { display: inline; } }
@media (hover: none) { .hero-search .kbd, .hint-desktop { display: none !important; } }
.hero-proof { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.5rem; margin-top: 1.75rem; font-size: .8125rem; color: var(--muted-foreground); }
.hero-proof span { display: inline-flex; align-items: center; gap: .375rem; }
.hero-proof .icon { width: .875rem; height: .875rem; color: var(--success); }

.tool-groups { display: grid; gap: 2.5rem; }
.tool-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; margin-bottom: .875rem; }
.tool-group-head h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.015em; }
.tool-group-head p { font-size: .875rem; color: var(--muted-foreground); }
.tool-group-head .badge { margin-left: auto; align-self: center; }
.tool-card-blurb { display: none; }
.tools-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.tools-grid { display: grid; gap: .875rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.tools-grid .tool-card { padding: 1.25rem 1.25rem 1.125rem; }
.tool-card .tool-meta { display: flex; flex-wrap: wrap; gap: .375rem; }
.tools-empty { padding: 3rem 1rem; text-align: center; color: var(--muted-foreground); font-size: .9375rem; }

.cta-band { display: grid; gap: 1.25rem; align-items: center; padding: 2rem; border: 1px solid var(--border); border-radius: var(--radius-2xl); background: radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--brand) 12%, transparent), transparent 55%), var(--surface); }
@media (min-width: 768px) { .cta-band { grid-template-columns: 1fr auto; padding: 2.5rem; } }
.cta-band h2 { font-size: clamp(1.375rem, 1.2rem + .8vw, 1.75rem); font-weight: 600; letter-spacing: -.025em; }
.cta-band p { margin-top: .375rem; color: var(--muted-foreground); }

.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--border); }
@media (min-width: 768px) { .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 1.25rem; background: var(--background); }
.stat b { display: block; font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stat span { display: block; margin-top: .25rem; font-size: .8125rem; color: var(--muted-foreground); }

/* ============================================================
   Responsive & accessibility
   ============================================================ */
@media (max-width: 639px) {
  .card-header:has(.card-action) { grid-template-columns: minmax(0, 1fr); }
  .card-action { grid-column: 1; grid-row: auto; justify-self: start; flex-wrap: wrap; margin-top: .375rem; }
  .out-row > code { font-size: .75rem; }
  .tools-grid { gap: .5rem; grid-template-columns: minmax(0, 1fr); }
  .tools-grid .tool-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .875rem; row-gap: .125rem; align-items: center; padding: .875rem 1rem; }
  .tools-grid .tool-card-head { grid-row: 1 / 3; }
  .tools-grid .tool-card-head .badge, .tools-grid .tool-card-arrow, .tools-grid .tool-card-text { display: none; }
  .tools-grid .tool-card h3 { font-size: .9375rem; align-self: end; }
  .tools-grid .tool-card-blurb { display: block; font-size: .8125rem; align-self: start; }
  .tool-group-head p { flex-basis: 100%; order: 3; }
  .tool-groups { gap: 2rem; }
}
@media (max-width: 767px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .card { padding-block: 1.25rem; gap: 1.25rem; }
  .card-header, .card-content, .card-footer { padding-inline: 1.125rem; }
  .collapsible > summary { padding-inline: 1.125rem; }
  .collapsible-body { padding-inline: 1.125rem; }
  .hero { padding-block: 3rem 2.5rem; }
  .section { padding-block: 2.25rem; }
  .doc { margin-top: 3rem; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .switch, .checkbox, .radio { appearance: auto; -webkit-appearance: auto; }
  .btn, .chip, .tabs-trigger, .toggle-item { border: 1px solid ButtonText; }
}
@media print {
  .site-header, .site-footer, .toaster, .doc-aside, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
