/*!
 * Spreadiom UI — self-hosted design system (no CDN, no build step).
 * Layers: tokens → reset → base → layout → components → marketing → app → utilities
 */
@layer tokens, reset, base, layout, components, marketing, app, utilities;

/* ───────────────────────────── Fonts ───────────────────────────── */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin.woff2") format("woff2-variations"), url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2-variations"), url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ───────────────────────────── Tokens ───────────────────────────── */
@layer tokens {
  :root {
    color-scheme: light;
    --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

    /* brand — #6e5cf7 from the logo */
    --brand-50: #f4f2ff;
    --brand-100: #ebe7ff;
    --brand-200: #d8d0ff;
    --brand-300: #baadff;
    --brand-400: #9887fb;
    --brand-500: #6e5cf7;
    --brand-600: #5a46ec;
    --brand-700: #4a36d0;
    --brand-800: #3d2eaa;
    --brand-900: #2f2683;
    --brand-950: #1c1650;

    --gray-0: #ffffff;
    --gray-25: #fbfbfd;
    --gray-50: #f6f7f9;
    --gray-100: #eef0f4;
    --gray-200: #e3e6ec;
    --gray-300: #cdd2dc;
    --gray-400: #9aa3b2;
    --gray-500: #6b7485;
    --gray-600: #4d5565;
    --gray-700: #353c49;
    --gray-800: #222833;
    --gray-900: #131822;
    --gray-950: #0a0d13;

    --green-50: #ecfdf5;  --green-500: #10b981; --green-600: #059669; --green-700: #047857;
    --amber-50: #fffbeb;  --amber-500: #f59e0b; --amber-600: #d97706; --amber-700: #b45309;
    --red-50: #fef2f2;    --red-500: #ef4444;   --red-600: #dc2626;   --red-700: #b91c1c;
    --sky-50: #f0f9ff;    --sky-500: #0ea5e9;   --sky-600: #0284c7;   --sky-700: #0369a1;

    /* semantic surfaces */
    --bg: var(--gray-25);
    --bg-elevated: #ffffff;
    --bg-subtle: var(--gray-50);
    --bg-muted: var(--gray-100);
    --bg-inverse: var(--gray-900);
    --fg: var(--gray-900);
    --fg-muted: var(--gray-600);
    --fg-subtle: var(--gray-500);
    --fg-inverse: #ffffff;
    --border: var(--gray-200);
    --border-strong: var(--gray-300);

    --accent: var(--brand-500);
    --accent-hover: var(--brand-600);
    --accent-active: var(--brand-700);
    --accent-fg: #ffffff;
    --accent-soft: var(--brand-50);
    --accent-soft-strong: var(--brand-100);
    --accent-soft-fg: var(--brand-700);
    --link: var(--brand-600);

    --success: var(--green-600);  --success-soft: var(--green-50);  --success-fg: var(--green-700);
    --warning: var(--amber-500);  --warning-soft: var(--amber-50);  --warning-fg: var(--amber-700);
    --danger: var(--red-600);     --danger-soft: var(--red-50);     --danger-fg: var(--red-700);
    --info: var(--sky-600);       --info-soft: var(--sky-50);       --info-fg: var(--sky-700);

    --ring: color-mix(in oklab, var(--brand-500) 40%, transparent);
    --overlay: rgb(10 13 19 / 0.55);

    /* shape & depth */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-2xl: 28px;
    --r-full: 999px;

    --shadow-xs: 0 1px 2px rgb(16 24 40 / 0.05);
    --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);
    --shadow-md: 0 4px 8px -2px rgb(16 24 40 / 0.08), 0 2px 4px -2px rgb(16 24 40 / 0.05);
    --shadow-lg: 0 16px 32px -12px rgb(16 24 40 / 0.18), 0 4px 8px -4px rgb(16 24 40 / 0.06);
    --shadow-xl: 0 32px 64px -24px rgb(16 24 40 / 0.28);
    --shadow-brand: 0 10px 30px -10px color-mix(in oklab, var(--brand-500) 55%, transparent);

    /* type scale (fluid for display sizes) */
    --text-2xs: 0.6875rem;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: clamp(1.625rem, 1.35rem + 1.1vw, 1.875rem);
    --text-4xl: clamp(1.875rem, 1.45rem + 1.9vw, 2.5rem);
    --text-5xl: clamp(2.25rem, 1.55rem + 3.1vw, 3.5rem);
    --text-6xl: clamp(2.5rem, 1.5rem + 4.6vw, 4.25rem);

    --space-section: clamp(4rem, 2.8rem + 5vw, 7.5rem);
    --container: 1200px;
    --container-narrow: 760px;
    --gutter: clamp(1rem, 0.6rem + 1.6vw, 2rem);

    --header-h: 64px;
    --sidebar-w: 256px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --dur: 160ms;
  }

  /* Dark theme — explicit choice or system preference */
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0d13;
    --bg-elevated: #11161f;
    --bg-subtle: #151b25;
    --bg-muted: #1c2330;
    --bg-inverse: #f6f7f9;
    --fg: #eef1f6;
    --fg-muted: #a6afbe;
    --fg-subtle: #828da0;
    --fg-inverse: #0a0d13;
    --border: #232b38;
    --border-strong: #313a49;
    --accent: #7c6cf8;
    --accent-hover: #8f80fa;
    --accent-active: #a294fb;
    --accent-soft: color-mix(in oklab, var(--brand-500) 16%, transparent);
    --accent-soft-strong: color-mix(in oklab, var(--brand-500) 26%, transparent);
    --accent-soft-fg: var(--brand-300);
    --link: var(--brand-300);
    --success: #34d399; --success-soft: color-mix(in oklab, #10b981 16%, transparent); --success-fg: #6ee7b7;
    --warning: #fbbf24; --warning-soft: color-mix(in oklab, #f59e0b 16%, transparent); --warning-fg: #fcd34d;
    --danger: #f87171;  --danger-soft: color-mix(in oklab, #ef4444 16%, transparent);  --danger-fg: #fca5a5;
    --info: #38bdf8;    --info-soft: color-mix(in oklab, #0ea5e9 16%, transparent);    --info-fg: #7dd3fc;
    --ring: color-mix(in oklab, var(--brand-400) 50%, transparent);
    --overlay: rgb(0 0 0 / 0.65);
    --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 3px rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 10px -2px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 18px 36px -12px rgb(0 0 0 / 0.6);
    --shadow-xl: 0 32px 64px -24px rgb(0 0 0 / 0.7);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
      color-scheme: dark;
      --bg: #0a0d13;
      --bg-elevated: #11161f;
      --bg-subtle: #151b25;
      --bg-muted: #1c2330;
      --bg-inverse: #f6f7f9;
      --fg: #eef1f6;
      --fg-muted: #a6afbe;
      --fg-subtle: #828da0;
      --fg-inverse: #0a0d13;
      --border: #232b38;
      --border-strong: #313a49;
      --accent: #7c6cf8;
      --accent-hover: #8f80fa;
      --accent-active: #a294fb;
      --accent-soft: color-mix(in oklab, var(--brand-500) 16%, transparent);
      --accent-soft-strong: color-mix(in oklab, var(--brand-500) 26%, transparent);
      --accent-soft-fg: var(--brand-300);
      --link: var(--brand-300);
      --success: #34d399; --success-soft: color-mix(in oklab, #10b981 16%, transparent); --success-fg: #6ee7b7;
      --warning: #fbbf24; --warning-soft: color-mix(in oklab, #f59e0b 16%, transparent); --warning-fg: #fcd34d;
      --danger: #f87171;  --danger-soft: color-mix(in oklab, #ef4444 16%, transparent);  --danger-fg: #fca5a5;
      --info: #38bdf8;    --info-soft: color-mix(in oklab, #0ea5e9 16%, transparent);    --info-fg: #7dd3fc;
      --ring: color-mix(in oklab, var(--brand-400) 50%, transparent);
      --overlay: rgb(0 0 0 / 0.65);
      --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.4);
      --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 3px rgb(0 0 0 / 0.3);
      --shadow-md: 0 4px 10px -2px rgb(0 0 0 / 0.45);
      --shadow-lg: 0 18px 36px -12px rgb(0 0 0 / 0.6);
      --shadow-xl: 0 32px 64px -24px rgb(0 0 0 / 0.7);
    }
  }
}

/* ───────────────────────────── Reset ───────────────────────────── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; tab-size: 4; scroll-padding-top: calc(var(--header-h) + 16px); }
  @media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
  body { min-height: 100dvh; line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
  img, picture, video, canvas, svg { display: block; max-width: 100%; }
  img, video { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
  button { cursor: pointer; background: none; border: 0; padding: 0; }
  :disabled { cursor: not-allowed; }
  p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
  h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
  p, li, dd { text-wrap: pretty; }
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
  table { border-collapse: collapse; border-spacing: 0; }
  [hidden] { display: none !important; }
  [x-cloak] { display: none !important; }
  dialog { padding: 0; border: 0; color: inherit; background: none; max-width: none; max-height: none; }
  summary { cursor: pointer; }
  summary::-webkit-details-marker { display: none; }
}

/* ───────────────────────────── Base ───────────────────────────── */
@layer base {
  html { background: var(--bg); color: var(--fg); font-family: var(--font-sans); font-size: 16px; font-feature-settings: "cv11", "ss01", "ss03"; }
  body { background: var(--bg); color: var(--fg); font-size: var(--text-base); }
  ::selection { background: var(--accent-soft-strong); color: var(--fg); }

  h1, h2, h3, h4, h5, h6 { color: var(--fg); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
  h1 { font-size: var(--text-4xl); letter-spacing: -0.03em; }
  h2 { font-size: var(--text-3xl); letter-spacing: -0.025em; }
  h3 { font-size: var(--text-xl); }
  h4 { font-size: var(--text-lg); }
  h5, h6 { font-size: var(--text-base); }

  a { color: var(--link); text-decoration: none; text-underline-offset: 3px; }
  a:hover { text-decoration: underline; }
  a:not([class]):hover { text-decoration-thickness: 1px; }
  strong, b { font-weight: 650; }
  small { font-size: var(--text-sm); }
  hr { border: 0; border-top: 1px solid var(--border); margin-block: 1.5rem; }
  code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
  :not(pre) > code { background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 0.1em 0.35em; font-size: 0.85em; }
  kbd { background: var(--bg-elevated); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--r-xs); padding: 0.05em 0.4em; font-size: 0.8em; }

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

  .tabular, td.num, th.num { font-variant-numeric: tabular-nums; }
  .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; }
  .skip-link { position: absolute; left: 1rem; top: -100px; z-index: 100; background: var(--accent); color: var(--accent-fg); padding: 0.5rem 1rem; border-radius: var(--r-sm); }
  .skip-link:focus { top: 1rem; }

  svg.icon { width: 1.25em; height: 1.25em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
  svg.icon.icon-sm { width: 1em; height: 1em; }
  svg.icon.icon-lg { width: 1.5em; height: 1.5em; }
  svg.logo { height: 28px; width: auto; color: var(--fg); }
}

/* ───────────────────────────── Layout ───────────────────────────── */
@layer layout {
  .container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
  .container-narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }
  .container-wide { max-width: calc(1360px + var(--gutter) * 2); }

  /* gap is set per class (not via an inherited custom property) so nested stacks don't inherit a parent's spacing */
  .stack { display: flex; flex-direction: column; gap: 1rem; }
  .stack.stack-xs { gap: 0.375rem; } .stack.stack-sm { gap: 0.625rem; } .stack.stack-lg { gap: 1.5rem; } .stack.stack-xl { gap: 2rem; }
  .cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
  .cluster.cluster-xs { gap: 0.375rem; } .cluster.cluster-sm { gap: 0.5rem; } .cluster.cluster-lg { gap: 1.25rem; }
  .between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
  .grid { display: grid; gap: 1.25rem; }
  .grid-auto { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
  .grid-2 { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { display: grid; gap: 1.25rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { display: grid; gap: 1.25rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  @media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
  .grid-2.keep-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { display: grid; gap: clamp(1.5rem, 3vw, 3.5rem); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
  .split-wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .with-aside { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  @media (max-width: 960px) { .split, .split-wide, .with-aside { grid-template-columns: minmax(0, 1fr); } }
  .sticky-aside { position: sticky; top: calc(var(--header-h) + 1rem); }
  @media (max-width: 960px) { .sticky-aside { position: static; } }
}

/* ───────────────────────────── Components ───────────────────────────── */
@layer components {
  /* Buttons */
  .btn {
    --btn-bg: var(--bg-elevated); --btn-fg: var(--fg); --btn-border: var(--border-strong); --btn-bg-hover: var(--bg-subtle);
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: 40px; padding: 0.5rem 1rem; border-radius: var(--r-md);
    border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
    font-size: var(--text-sm); font-weight: 600; line-height: 1.2; white-space: nowrap; text-decoration: none !important;
    box-shadow: var(--shadow-xs); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
    user-select: none; -webkit-tap-highlight-color: transparent;
  }
  .btn:hover { background: var(--btn-bg-hover); }
  .btn:active { transform: translateY(1px); }
  .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: var(--r-md); }
  .btn[disabled], .btn.is-disabled { opacity: 0.55; pointer-events: none; box-shadow: none; }
  .btn .icon { width: 1.125em; height: 1.125em; }
  .btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-fg); --btn-border: transparent; --btn-bg-hover: var(--accent-hover); box-shadow: 0 1px 2px rgb(16 24 40 / 0.1), inset 0 1px 0 rgb(255 255 255 / 0.16); }
  .btn-primary:hover { box-shadow: var(--shadow-brand); }
  .btn-dark { --btn-bg: var(--gray-900); --btn-fg: #fff; --btn-border: transparent; --btn-bg-hover: var(--gray-800); }
  :root[data-theme="dark"] .btn-dark { --btn-bg: #f6f7f9; --btn-fg: #0a0d13; --btn-bg-hover: #ffffff; }
  .btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent-soft-fg); --btn-border: transparent; --btn-bg-hover: var(--accent-soft-strong); box-shadow: none; }
  .btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-bg-hover: var(--bg-muted); box-shadow: none; }
  .btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: transparent; --btn-bg-hover: var(--red-700); }
  .btn-danger-soft { --btn-bg: var(--danger-soft); --btn-fg: var(--danger-fg); --btn-border: transparent; --btn-bg-hover: color-mix(in oklab, var(--danger) 18%, transparent); box-shadow: none; }
  .btn-success { --btn-bg: var(--success); --btn-fg: #fff; --btn-border: transparent; --btn-bg-hover: var(--green-700); }
  .btn-white { --btn-bg: #fff; --btn-fg: var(--gray-900); --btn-border: transparent; --btn-bg-hover: var(--gray-100); }
  .btn-sm { min-height: 32px; padding: 0.3rem 0.7rem; font-size: var(--text-xs); border-radius: var(--r-sm); gap: 0.375rem; }
  .btn-lg { min-height: 48px; padding: 0.75rem 1.4rem; font-size: var(--text-base); border-radius: var(--r-lg); }
  .btn-xl { min-height: 56px; padding: 0.9rem 1.75rem; font-size: var(--text-lg); border-radius: var(--r-lg); }
  .btn-block { display: flex; width: 100%; }
  .btn-icon { min-height: 0; width: 36px; height: 36px; padding: 0; }
  .btn-icon.btn-sm { width: 30px; height: 30px; }
  .btn .spinner { width: 1em; height: 1em; }
  .btn-group { display: inline-flex; }
  .btn-group > .btn { border-radius: 0; }
  .btn-group > .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
  .btn-group > .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
  .btn-group > .btn + .btn { margin-left: -1px; }
  .link-btn { color: var(--link); font-weight: 600; font-size: inherit; display: inline-flex; align-items: center; gap: 0.25rem; }
  .link-btn:hover { text-decoration: underline; }

  .spinner { display: inline-block; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; opacity: 0.9; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Badges / pills */
  .badge {
    --badge-bg: var(--bg-muted); --badge-fg: var(--fg-muted);
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.55rem; border-radius: var(--r-full);
    background: var(--badge-bg); color: var(--badge-fg); font-size: var(--text-xs); font-weight: 600; line-height: 1.5; white-space: nowrap;
  }
  .badge .icon { width: 0.95em; height: 0.95em; }
  .badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .badge-brand { --badge-bg: var(--accent-soft); --badge-fg: var(--accent-soft-fg); }
  .badge-success { --badge-bg: var(--success-soft); --badge-fg: var(--success-fg); }
  .badge-warning { --badge-bg: var(--warning-soft); --badge-fg: var(--warning-fg); }
  .badge-danger { --badge-bg: var(--danger-soft); --badge-fg: var(--danger-fg); }
  .badge-info { --badge-bg: var(--info-soft); --badge-fg: var(--info-fg); }
  .badge-outline { --badge-bg: transparent; border: 1px solid var(--border-strong); }
  .badge-lg { font-size: var(--text-sm); padding: 0.3rem 0.8rem; }
  .eyebrow { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-soft-fg); }

  /* Forms */
  .field { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
  .label { font-size: var(--text-sm); font-weight: 600; color: var(--fg); display: flex; align-items: center; gap: 0.4rem; }
  .label .optional { font-weight: 500; color: var(--fg-subtle); font-size: var(--text-xs); }
  .help { font-size: var(--text-xs); color: var(--fg-subtle); line-height: 1.5; }
  .error-text { font-size: var(--text-xs); color: var(--danger); font-weight: 500; display: flex; gap: 0.35rem; align-items: flex-start; }
  .input, .select, .textarea {
    width: 100%; min-height: 42px; padding: 0.55rem 0.8rem; border-radius: var(--r-md);
    border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--fg);
    font-size: var(--text-sm); line-height: 1.5; box-shadow: var(--shadow-xs);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }
  .input::placeholder, .textarea::placeholder { color: var(--fg-subtle); opacity: 0.85; }
  .input:hover, .select:hover, .textarea:hover { border-color: color-mix(in oklab, var(--border-strong) 60%, var(--fg-subtle)); }
  .input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
  .input[readonly] { background: var(--bg-subtle); }
  .input:disabled, .select:disabled, .textarea:disabled { background: var(--bg-muted); color: var(--fg-subtle); }
  .input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
  .input.is-invalid:focus { box-shadow: 0 0 0 3px color-mix(in oklab, var(--danger) 30%, transparent); }
  .textarea { min-height: 110px; resize: vertical; }
  .select { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7485' 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 0.7rem center; background-size: 16px; }
  .input-mono { font-family: var(--font-mono); font-size: var(--text-xs); }
  .input-lg { min-height: 50px; font-size: var(--text-base); padding-inline: 1rem; }
  .input-group { display: flex; align-items: stretch; width: 100%; }
  .input-group > .input { border-radius: 0; flex: 1 1 auto; min-width: 0; }
  .input-group > .input:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
  .input-group > .input:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
  .input-group > .btn { border-radius: 0 var(--r-md) var(--r-md) 0; margin-left: -1px; box-shadow: none; }
  .input-addon { display: inline-flex; align-items: center; padding: 0 0.8rem; background: var(--bg-subtle); border: 1px solid var(--border-strong); color: var(--fg-muted); font-size: var(--text-sm); white-space: nowrap; }
  .input-addon:first-child { border-radius: var(--r-md) 0 0 var(--r-md); border-right: 0; }
  .input-addon:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; border-left: 0; }
  .input-icon { position: relative; }
  .input-icon > .icon { position: absolute; left: 0.75rem; top: 50%; translate: 0 -50%; color: var(--fg-subtle); pointer-events: none; width: 1.05rem; height: 1.05rem; }
  .input-icon > .input { padding-left: 2.3rem; }

  .check { display: inline-flex; align-items: flex-start; gap: 0.6rem; font-size: var(--text-sm); cursor: pointer; line-height: 1.45; }
  .check input { appearance: none; flex: none; width: 18px; height: 18px; margin-top: 1px; border: 1.5px solid var(--border-strong); border-radius: 5px; background: var(--bg-elevated); display: grid; place-content: center; transition: all var(--dur) var(--ease); }
  .check input[type="radio"] { border-radius: 50%; }
  .check input::before { content: ""; width: 10px; height: 10px; transform: scale(0); transition: transform var(--dur) var(--ease); background: #fff; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
  .check input[type="radio"]::before { clip-path: circle(50%); width: 8px; height: 8px; }
  .check input:checked { background: var(--accent); border-color: var(--accent); }
  .check input:checked::before { transform: scale(1); }
  .check input:focus-visible { box-shadow: 0 0 0 3px var(--ring); outline: none; }

  .switch { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; font-size: var(--text-sm); }
  .switch input { appearance: none; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background var(--dur) var(--ease); }
  .switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
  .switch input:checked { background: var(--accent); }
  .switch input:checked::after { transform: translateX(16px); }
  .switch input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

  /* Segmented control (radio cards) */
  .segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-muted); border-radius: var(--r-md); border: 1px solid var(--border); }
  .segmented label { position: relative; }
  .segmented input { position: absolute; opacity: 0; pointer-events: none; }
  .segmented span { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.8rem; border-radius: calc(var(--r-md) - 3px); font-size: var(--text-sm); font-weight: 600; color: var(--fg-muted); cursor: pointer; }
  .segmented input:checked + span { background: var(--bg-elevated); color: var(--fg); box-shadow: var(--shadow-sm); }
  .segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
  .choice-cards { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
  .choice-card { position: relative; display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.9rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--bg-elevated); cursor: pointer; transition: border-color var(--dur), box-shadow var(--dur), background var(--dur); }
  .choice-card:hover { border-color: var(--accent); }
  .choice-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: color-mix(in oklab, var(--accent-soft) 50%, var(--bg-elevated)); }
  .choice-card input { position: absolute; opacity: 0; pointer-events: none; }
  .choice-card .title { font-weight: 650; font-size: var(--text-sm); }
  .choice-card .desc { font-size: var(--text-xs); color: var(--fg-muted); }

  .form-grid { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > .span-2 { grid-column: 1 / -1; }
  @media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
  .form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding-top: 0.5rem; }
}

@layer components {
  /* Cards */
  .card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-xs); min-width: 0; }
  .card-pad { padding: clamp(1rem, 0.8rem + 1vw, 1.5rem); }
  .card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
  .card-header h2, .card-header h3 { font-size: var(--text-base); font-weight: 650; letter-spacing: -0.01em; }
  .card-header .sub { font-size: var(--text-xs); color: var(--fg-subtle); margin-top: 0.15rem; }
  .card-body { padding: 1.25rem; }
  .card-footer { padding: 0.9rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg-subtle); border-radius: 0 0 var(--r-xl) var(--r-xl); }
  .card-flat { box-shadow: none; }
  .card-muted { background: var(--bg-subtle); box-shadow: none; }
  .card-hover { transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
  .card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
  a.card { color: inherit; text-decoration: none; display: block; }
  .card-accent { border-color: color-mix(in oklab, var(--accent) 45%, var(--border)); box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 25%, transparent), var(--shadow-md); }

  /* Alerts / callouts */
  .alert { --alert-bg: var(--info-soft); --alert-fg: var(--info-fg); --alert-border: color-mix(in oklab, var(--info) 30%, transparent);
    display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: var(--r-lg); background: var(--alert-bg); border: 1px solid var(--alert-border); color: var(--fg); font-size: var(--text-sm); }
  .alert > .icon { color: var(--alert-fg); margin-top: 0.1rem; }
  .alert .alert-title { font-weight: 650; color: var(--fg); }
  .alert .alert-body { color: var(--fg-muted); }
  .alert .alert-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
  @media (max-width: 640px) { .alert { flex-wrap: wrap; } .alert .alert-actions { margin-left: 0; width: 100%; } }
  .alert-success { --alert-bg: var(--success-soft); --alert-fg: var(--success-fg); --alert-border: color-mix(in oklab, var(--success) 30%, transparent); }
  .alert-warning { --alert-bg: var(--warning-soft); --alert-fg: var(--warning-fg); --alert-border: color-mix(in oklab, var(--warning) 35%, transparent); }
  .alert-danger { --alert-bg: var(--danger-soft); --alert-fg: var(--danger-fg); --alert-border: color-mix(in oklab, var(--danger) 30%, transparent); }
  .alert-brand { --alert-bg: var(--accent-soft); --alert-fg: var(--accent-soft-fg); --alert-border: color-mix(in oklab, var(--accent) 30%, transparent); }

  /* Tables */
  .table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { width: 100%; font-size: var(--text-sm); }
  .table th { text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.04em; padding: 0.65rem 1rem; background: var(--bg-subtle); border-bottom: 1px solid var(--border); white-space: nowrap; }
  .table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .table tr:last-child td { border-bottom: 0; }
  .table tbody tr { transition: background var(--dur); }
  .table tbody tr:hover { background: color-mix(in oklab, var(--bg-subtle) 70%, transparent); }
  .table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
  .table .actions { text-align: right; white-space: nowrap; }
  .table .muted { color: var(--fg-subtle); }
  .table-compact td { padding: 0.55rem 0.85rem; }
  .cell-title { font-weight: 600; color: var(--fg); }
  .cell-sub { font-size: var(--text-xs); color: var(--fg-subtle); }
  /* stacked rows on phones */
  @media (max-width: 720px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
    .table-stack td { border: 0; padding: 0.2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
    .table-stack td::before { content: attr(data-label); font-size: var(--text-xs); color: var(--fg-subtle); font-weight: 600; text-align: left; }
    .table-stack td.cell-main { display: block; text-align: left; padding-bottom: 0.4rem; }
    .table-stack td.cell-main::before { content: none; }
    .table-stack td.actions { justify-content: flex-end; padding-top: 0.5rem; }
    .table-stack td.actions::before { content: none; }
  }

  /* Description lists */
  .dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 0.6rem 1.25rem; font-size: var(--text-sm); }
  .dl dt { color: var(--fg-subtle); }
  .dl dd { color: var(--fg); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
  .dl-stack { display: grid; gap: 0.85rem; }
  .dl-stack dt { font-size: var(--text-xs); color: var(--fg-subtle); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
  .dl-stack dd { font-size: var(--text-sm); margin-top: 0.15rem; }

  /* Stats */
  .stat { display: flex; flex-direction: column; gap: 0.25rem; padding: 1.1rem 1.25rem; }
  .stat-label { font-size: var(--text-xs); font-weight: 600; color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 0.4rem; }
  .stat-value { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
  .stat-meta { font-size: var(--text-xs); color: var(--fg-muted); }
  .stat-icon { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-fg); }
  .trend-up { color: var(--success); } .trend-down { color: var(--danger); }

  /* Modal (native <dialog>) */
  .modal { position: fixed; inset: 0; margin: auto; width: min(560px, calc(100vw - 2rem)); max-height: min(88dvh, 860px); border-radius: var(--r-xl); background: var(--bg-elevated); color: var(--fg); box-shadow: var(--shadow-xl); border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; }
  .modal:not([open]) { display: none; }
  .modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
  .modal[open] { animation: modal-in 180ms var(--ease); }
  @keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
  .modal-lg { width: min(820px, calc(100vw - 2rem)); }
  .modal-xl { width: min(1080px, calc(100vw - 2rem)); }
  .modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
  .modal-header h2 { font-size: var(--text-lg); font-weight: 650; }
  .modal-header p { font-size: var(--text-sm); color: var(--fg-muted); margin-top: 0.2rem; }
  .modal-body { padding: 1.25rem; overflow-y: auto; }
  .modal-footer { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.9rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg-subtle); flex-wrap: wrap; }
  @media (max-width: 640px) {
    .modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; }
    .modal[open] { animation: sheet-in 220ms var(--ease); }
    .modal-footer .btn { flex: 1; }
  }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } }

  /* Drawer (side panel) */
  .drawer { position: fixed; inset: 0 0 0 auto; margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); background: var(--bg-elevated); border-left: 1px solid var(--border); box-shadow: var(--shadow-xl); display: flex; flex-direction: column; }
  .drawer:not([open]) { display: none; }
  .drawer::backdrop { background: var(--overlay); }
  .drawer[open] { animation: drawer-in 220ms var(--ease); }
  @keyframes drawer-in { from { transform: translateX(24px); opacity: 0.5; } }

  /* Dropdown menu (positioned under trigger; Alpine controls visibility) */
  .dropdown { position: relative; display: inline-block; }
  .menu { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; min-width: 200px; padding: 0.35rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
  .menu-left { right: auto; left: 0; }
  .menu-up { top: auto; bottom: calc(100% + 6px); }
  .menu-item { display: flex; width: 100%; align-items: center; gap: 0.6rem; padding: 0.5rem 0.65rem; border-radius: var(--r-sm); font-size: var(--text-sm); color: var(--fg); text-align: left; text-decoration: none !important; }
  .menu-item:hover, .menu-item:focus-visible { background: var(--bg-muted); outline: none; }
  .menu-item .icon { color: var(--fg-subtle); width: 1.05rem; height: 1.05rem; }
  .menu-item.danger { color: var(--danger); } .menu-item.danger .icon { color: var(--danger); }
  .menu-sep { height: 1px; background: var(--border); margin: 0.3rem 0.2rem; }
  .menu-label { padding: 0.45rem 0.65rem 0.25rem; font-size: var(--text-xs); color: var(--fg-subtle); font-weight: 600; }

  /* Tabs */
  .tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.65rem 0.85rem; font-size: var(--text-sm); font-weight: 600; color: var(--fg-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
  .tab:hover { color: var(--fg); }
  .tab[aria-selected="true"], .tab.is-active { color: var(--fg); border-bottom-color: var(--accent); }
  .tab .count { font-size: var(--text-2xs); padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--bg-muted); color: var(--fg-muted); }
  .tab.is-active .count, .tab[aria-selected="true"] .count { background: var(--accent-soft); color: var(--accent-soft-fg); }
  .pills { display: flex; gap: 0.4rem; flex-wrap: wrap; }
  .pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.8rem; border-radius: 999px; font-size: var(--text-sm); font-weight: 600; color: var(--fg-muted); background: var(--bg-elevated); border: 1px solid var(--border); text-decoration: none !important; }
  .pill:hover { color: var(--fg); border-color: var(--border-strong); }
  .pill.is-active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

  /* Pagination */
  .pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: var(--text-sm); }
  .pagination .info { color: var(--fg-subtle); }
  .pagination .pages { display: flex; gap: 0.25rem; flex-wrap: wrap; }
  .page-btn { min-width: 36px; height: 36px; padding: 0 0.6rem; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg-elevated); color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none !important; }
  .page-btn:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
  .page-btn[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
  .page-btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

  /* Toasts */
  .toasts { position: fixed; z-index: 90; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: 0.6rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
  .toast { pointer-events: auto; display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: var(--r-lg); background: var(--bg-elevated); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: var(--text-sm); animation: toast-in 220ms var(--ease); }
  .toast .icon { margin-top: 0.1rem; }
  .toast-success .icon { color: var(--success); } .toast-error .icon { color: var(--danger); } .toast-info .icon { color: var(--info); } .toast-warning .icon { color: var(--warning); }
  .toast .close { margin-left: auto; color: var(--fg-subtle); }
  @keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
  @media (max-width: 640px) { .toasts { left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); width: auto; } }

  /* Empty states */
  .empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.6rem; padding: clamp(2rem, 4vw, 3.5rem) 1.5rem; }
  .empty .empty-icon { width: 52px; height: 52px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-fg); margin-bottom: 0.25rem; }
  .empty .empty-icon .icon { width: 26px; height: 26px; }
  .empty h3 { font-size: var(--text-base); font-weight: 650; }
  .empty p { color: var(--fg-muted); font-size: var(--text-sm); max-width: 420px; }

  /* Misc */
  .divider { height: 1px; background: var(--border); border: 0; margin: 0; }
  .avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-fg); font-weight: 700; font-size: var(--text-sm); overflow: hidden; flex-shrink: 0; }
  .avatar img { width: 100%; height: 100%; object-fit: cover; }
  .avatar-sm { width: 28px; height: 28px; font-size: var(--text-xs); }
  .avatar-lg { width: 56px; height: 56px; font-size: var(--text-lg); }
  .progress { height: 8px; border-radius: 999px; background: var(--bg-muted); overflow: hidden; }
  .progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 400ms var(--ease); }
  .skeleton { background: linear-gradient(90deg, var(--bg-muted), var(--bg-subtle), var(--bg-muted)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-sm); }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .code-block { position: relative; border-radius: var(--r-lg); background: #0d1117; color: #e6edf3; border: 1px solid #1f2733; font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.65; }
  .code-block pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; white-space: pre; }
  .code-block .code-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0.6rem 0.5rem 1rem; border-bottom: 1px solid #1f2733; font-family: var(--font-sans); font-size: var(--text-xs); color: #9aa7b6; }
  .code-block .btn { --btn-bg: #1b222d; --btn-fg: #e6edf3; --btn-border: #2b3442; --btn-bg-hover: #242d3a; box-shadow: none; }
  .tok-tag { color: #7ee787; } .tok-attr { color: #79c0ff; } .tok-str { color: #a5d6ff; } .tok-punc { color: #9aa7b6; }
  .kv { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--text-sm); padding: 0.45rem 0; }
  .kv + .kv { border-top: 1px dashed var(--border); }
  .kv .k { color: var(--fg-muted); } .kv .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
  .kv.total { border-top: 1px solid var(--border-strong); margin-top: 0.25rem; padding-top: 0.7rem; font-size: var(--text-base); }
  .kv.total .v { font-size: var(--text-lg); }

  /* Steps (vertical checklist) */
  .steps { display: grid; gap: 0.25rem; counter-reset: step; }
  .step { display: grid; grid-template-columns: 32px 1fr auto; gap: 0.85rem; align-items: center; padding: 0.75rem; border-radius: var(--r-lg); }
  .step:hover { background: var(--bg-subtle); }
  .step-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed var(--border-strong); color: var(--fg-subtle); font-size: var(--text-xs); font-weight: 700; }
  .step.is-done .step-dot { border: 0; background: var(--success); color: #fff; }
  .step.is-current .step-dot { border: 2px solid var(--accent); color: var(--accent); }
  .step-title { font-weight: 600; font-size: var(--text-sm); }
  .step.is-done .step-title { color: var(--fg-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
  .step-desc { font-size: var(--text-xs); color: var(--fg-subtle); }

  /* Timeline */
  .timeline { display: grid; gap: 0; }
  .timeline-item { display: grid; grid-template-columns: 20px 1fr; gap: 0.75rem; position: relative; padding-bottom: 1rem; }
  .timeline-item::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
  .timeline-item:last-child::before { display: none; }
  .timeline-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--bg-elevated); border: 2px solid var(--border-strong); margin-top: 2px; }
  .timeline-item.is-done .timeline-dot { background: var(--success); border-color: var(--success); }
  .timeline-item.is-current .timeline-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
  .timeline-item .t-title { font-size: var(--text-sm); font-weight: 600; }
  .timeline-item .t-meta { font-size: var(--text-xs); color: var(--fg-subtle); }
}

/* ───────────────────────────── Marketing ───────────────────────────── */
@layer marketing {
  /* Header */
  .site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid color-mix(in oklab, var(--border) 75%, transparent); }
  .site-header .container { height: 100%; display: flex; align-items: center; gap: 1.5rem; }
  .site-header .brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--fg); text-decoration: none; flex-shrink: 0; }
  .site-header .brand svg.logo { height: 26px; }
  .site-nav { display: flex; align-items: center; gap: 0.15rem; }
  .site-nav a { padding: 0.45rem 0.75rem; border-radius: var(--r-sm); color: var(--fg-muted); font-size: var(--text-sm); font-weight: 550; text-decoration: none; }
  .site-nav a:hover { color: var(--fg); background: var(--bg-muted); }
  .site-nav a[aria-current="page"] { color: var(--fg); }
  .header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
  .nav-toggle { display: none; }
  @media (max-width: 900px) {
    .site-nav, .header-actions .hide-mobile { display: none; }
    .nav-toggle { display: inline-flex; }
  }
  .mobile-nav { position: fixed; inset: var(--header-h) 0 0 0; z-index: 49; background: var(--bg); padding: 1rem var(--gutter) 2rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.25rem; border-top: 1px solid var(--border); }
  .mobile-nav a.m-link { display: flex; align-items: center; justify-content: space-between; padding: 0.95rem 0.25rem; border-bottom: 1px solid var(--border); font-size: var(--text-lg); font-weight: 600; color: var(--fg); text-decoration: none; }
  .mobile-nav .m-actions { display: grid; gap: 0.6rem; margin-top: 1.25rem; }

  /* Sections */
  .section { padding-block: var(--space-section); position: relative; }
  .section-sm { padding-block: clamp(3rem, 2rem + 3vw, 4.5rem); }
  .section-muted { background: var(--bg-subtle); border-block: 1px solid var(--border); }
  .section-dark { background: #0b0d16; color: #e9ecf3; --fg: #f3f5f9; --fg-muted: #a8b0c0; --fg-subtle: #8a93a5; --border: #20263a; --bg-elevated: #121626; --bg-subtle: #10131f; --bg-muted: #191e30; --accent-soft: color-mix(in oklab, var(--brand-500) 20%, transparent); --accent-soft-fg: var(--brand-300); --link: var(--brand-300); }
  .section-head { max-width: 720px; margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.25rem); }
  .section-head.center { margin-inline: auto; text-align: center; }
  .section-head .eyebrow { margin-bottom: 0.85rem; }
  .section-head h2 { font-size: var(--text-4xl); letter-spacing: -0.03em; }
  .section-head p { margin-top: 1rem; font-size: var(--text-lg); color: var(--fg-muted); }
  .lead { font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem); color: var(--fg-muted); line-height: 1.65; }
  .text-gradient { background: linear-gradient(100deg, var(--brand-500) 10%, #a855f7 55%, #ec4899 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

  /* Hero */
  .hero { position: relative; padding-block: clamp(3.5rem, 2rem + 6vw, 7rem) clamp(3rem, 2rem + 4vw, 5.5rem); overflow: hidden; isolation: isolate; }
  .hero::before { content: ""; position: absolute; inset: -20% -10% auto; height: 120%; z-index: -1; background:
      radial-gradient(40% 50% at 20% 10%, color-mix(in oklab, var(--brand-400) 26%, transparent), transparent 70%),
      radial-gradient(35% 45% at 85% 0%, color-mix(in oklab, #ec4899 14%, transparent), transparent 70%),
      radial-gradient(50% 50% at 60% 60%, color-mix(in oklab, var(--brand-300) 14%, transparent), transparent 70%); }
  .hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(60% 55% at 50% 30%, #000 20%, transparent 75%); opacity: 0.55; }
  .hero h1 { font-size: var(--text-6xl); letter-spacing: -0.04em; line-height: 1.04; font-weight: 800; }
  .hero .lead { margin-top: 1.25rem; max-width: 620px; }
  .hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; }
  .hero-note { margin-top: 1rem; font-size: var(--text-sm); color: var(--fg-subtle); display: flex; gap: 1rem; flex-wrap: wrap; }
  .hero-note span { display: inline-flex; align-items: center; gap: 0.35rem; }
  .hero-note .icon { color: var(--success); width: 1rem; height: 1rem; }
  .hero-center { text-align: center; }
  .hero-center .lead { margin-inline: auto; }
  .hero-center .hero-actions, .hero-center .hero-note { justify-content: center; }
  .announce { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.4rem 0.3rem 0.35rem; border-radius: 999px; border: 1px solid var(--border); background: color-mix(in oklab, var(--bg-elevated) 80%, transparent); font-size: var(--text-sm); color: var(--fg-muted); text-decoration: none !important; margin-bottom: 1.5rem; box-shadow: var(--shadow-xs); }
  .announce .badge { font-size: var(--text-2xs); }
  .announce:hover { border-color: var(--border-strong); color: var(--fg); }

  /* Product mockups */
  .mock { border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--bg-elevated); box-shadow: var(--shadow-xl); overflow: hidden; }
  .mock-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
  .mock-dots { display: flex; gap: 6px; }
  .mock-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
  .mock-dots i:nth-child(1) { background: #ff5f57; } .mock-dots i:nth-child(2) { background: #febc2e; } .mock-dots i:nth-child(3) { background: #28c840; }
  .mock-url { flex: 1; margin-inline: 0.5rem; padding: 0.25rem 0.75rem; border-radius: var(--r-sm); background: var(--bg-elevated); border: 1px solid var(--border); font-size: var(--text-xs); color: var(--fg-subtle); display: flex; align-items: center; gap: 0.4rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .mock-body { padding: 1rem; }
  .mock-line { height: 8px; border-radius: 4px; background: var(--bg-muted); }
  .ad-placeholder { display: grid; place-items: center; text-align: center; border-radius: var(--r-md); border: 1.5px dashed color-mix(in oklab, var(--accent) 55%, var(--border)); background: repeating-linear-gradient(-45deg, var(--accent-soft), var(--accent-soft) 10px, transparent 10px, transparent 20px); color: var(--accent-soft-fg); font-weight: 700; font-size: var(--text-sm); padding: 0.75rem; }
  .ad-live { border-radius: var(--r-md); overflow: hidden; background: linear-gradient(120deg, #111827, #312e81 60%, #6e5cf7); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; }
  .float-card { position: absolute; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 0.75rem 0.9rem; font-size: var(--text-sm); display: flex; gap: 0.6rem; align-items: center; }
  .float-card .icon-wrap { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; }
  @media (max-width: 960px) { .float-card { display: none; } }

  /* Feature cards */
  .feature { padding: 1.5rem; border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--bg-elevated); display: flex; flex-direction: column; gap: 0.6rem; }
  .feature-icon { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-fg); margin-bottom: 0.35rem; }
  .feature-icon .icon { width: 22px; height: 22px; }
  .feature h3 { font-size: var(--text-lg); font-weight: 650; letter-spacing: -0.015em; }
  .feature p { color: var(--fg-muted); font-size: var(--text-sm); line-height: 1.65; }
  .bento { display: grid; gap: 1rem; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bento > * { grid-column: span 2; }
  .bento > .wide { grid-column: span 4; }
  .bento > .half { grid-column: span 3; }
  @media (max-width: 960px) { .bento > *, .bento > .wide, .bento > .half { grid-column: span 3; } }
  @media (max-width: 640px) { .bento { grid-template-columns: minmax(0, 1fr); } .bento > *, .bento > .wide, .bento > .half { grid-column: auto; } }

  /* How-it-works steps */
  .how { display: grid; gap: 1.25rem; grid-template-columns: repeat(3, minmax(0, 1fr)); counter-reset: how; }
  @media (max-width: 960px) { .how { grid-template-columns: minmax(0, 1fr); } }
  .how-step { position: relative; padding: 1.5rem; border-radius: var(--r-xl); background: var(--bg-elevated); border: 1px solid var(--border); }
  .how-step::before { counter-increment: how; content: counter(how); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--fg); color: var(--bg); font-weight: 700; font-size: var(--text-sm); margin-bottom: 1rem; }
  .how-step h3 { font-size: var(--text-lg); margin-bottom: 0.4rem; }
  .how-step p { color: var(--fg-muted); font-size: var(--text-sm); }
  .how-step .how-visual { margin-top: 1.1rem; }

  /* Money flow diagram */
  .flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; align-items: stretch; }
  .flow-node { position: relative; padding: 1.1rem; border-radius: var(--r-lg); background: var(--bg-elevated); border: 1px solid var(--border); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
  .flow-node .flow-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-soft-fg); }
  .flow-node .t { font-weight: 650; font-size: var(--text-sm); }
  .flow-node .d { font-size: var(--text-xs); color: var(--fg-muted); }
  .flow-node:not(:last-child)::after { content: ""; position: absolute; right: -0.75rem; top: 50%; width: 0.75rem; height: 2px; background: var(--border-strong); }
  .flow-node.is-highlight { border-color: color-mix(in oklab, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 4px var(--accent-soft); }
  @media (max-width: 760px) { .flow { grid-template-columns: minmax(0, 1fr); } .flow-node:not(:last-child)::after { right: 50%; top: auto; bottom: -0.75rem; width: 2px; height: 0.75rem; } }

  /* Comparison table */
  .compare { width: 100%; font-size: var(--text-sm); border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--border); background: var(--bg-elevated); }
  .compare th, .compare td { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
  .compare thead th { background: var(--bg-subtle); font-weight: 650; }
  .compare thead th.is-us { background: var(--accent); color: #fff; }
  .compare td.is-us { background: color-mix(in oklab, var(--accent-soft) 60%, transparent); font-weight: 600; }
  .compare tr:last-child td { border-bottom: 0; }
  .compare .yes { color: var(--success); } .compare .no { color: var(--fg-subtle); }

  /* Pricing */
  .price-card { padding: clamp(1.5rem, 1rem + 2vw, 2.25rem); border-radius: var(--r-2xl); border: 1px solid var(--border); background: var(--bg-elevated); display: flex; flex-direction: column; gap: 1rem; }
  .price-card.is-featured { border-color: color-mix(in oklab, var(--accent) 50%, var(--border)); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg); }
  .price-amount { font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
  .price-amount small { font-size: var(--text-base); font-weight: 600; color: var(--fg-muted); letter-spacing: 0; }
  .check-list { display: grid; gap: 0.6rem; list-style: none; padding: 0; font-size: var(--text-sm); }
  .check-list li { display: flex; gap: 0.6rem; align-items: flex-start; }
  .check-list li .icon { color: var(--success); margin-top: 0.15rem; width: 1.1rem; height: 1.1rem; }
  .check-list.muted li .icon { color: var(--fg-subtle); }

  /* FAQ */
  .faq { display: grid; gap: 0.75rem; }
  .faq details { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-elevated); transition: border-color var(--dur); }
  .faq details[open] { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
  .faq summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.2rem; font-weight: 600; }
  .faq summary .icon { transition: transform var(--dur) var(--ease); color: var(--fg-subtle); }
  .faq details[open] summary .icon { transform: rotate(45deg); }
  .faq .answer { padding: 0 1.2rem 1.1rem; color: var(--fg-muted); font-size: var(--text-sm); line-height: 1.7; }
  .faq .answer p + p { margin-top: 0.6rem; }

  /* CTA band */
  .cta-band { position: relative; overflow: hidden; border-radius: var(--r-2xl); padding: clamp(2.25rem, 1.5rem + 3vw, 4rem); background: radial-gradient(60% 120% at 0% 0%, #7c6cf8 0%, transparent 60%), radial-gradient(60% 120% at 100% 100%, #c026d3 0%, transparent 55%), #1b1544; color: #fff; }
  .cta-band h2 { color: #fff; font-size: var(--text-4xl); }
  .cta-band p { color: rgb(255 255 255 / 0.8); font-size: var(--text-lg); margin-top: 0.75rem; max-width: 620px; }
  .cta-band .hero-actions { margin-top: 1.75rem; }

  /* Footer */
  .site-footer { border-top: 1px solid var(--border); background: var(--bg-subtle); padding-block: 3.5rem 2rem; margin-top: auto; }
  .footer-grid { display: grid; gap: 2rem; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); }
  @media (max-width: 860px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .footer-grid > :first-child { grid-column: 1 / -1; } }
  .footer-grid .footer-title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-subtle); margin-bottom: 0.85rem; }
  .footer-grid ul { list-style: none; padding: 0; display: grid; gap: 0.55rem; }
  .footer-grid a { color: var(--fg-muted); font-size: var(--text-sm); }
  .footer-grid a:hover { color: var(--fg); }
  .footer-bottom { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: var(--text-xs); color: var(--fg-subtle); }

  /* Breadcrumbs */
  .breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; font-size: var(--text-sm); color: var(--fg-subtle); }
  .breadcrumbs a { color: var(--fg-muted); }
  .breadcrumbs .icon { width: 0.9rem; height: 0.9rem; }

  /* Article cards + prose */
  .post-card { display: flex; flex-direction: column; border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--border); background: var(--bg-elevated); color: inherit; text-decoration: none !important; transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur); height: 100%; }
  .post-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
  .post-card .cover { aspect-ratio: 1200 / 630; background: var(--bg-muted); overflow: hidden; }
  .post-card .cover img { width: 100%; height: 100%; object-fit: cover; }
  .post-card .body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
  .post-card h3 { font-size: var(--text-lg); line-height: 1.35; font-weight: 650; letter-spacing: -0.015em; }
  .post-card p { color: var(--fg-muted); font-size: var(--text-sm); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .post-card .meta { margin-top: auto; padding-top: 0.5rem; font-size: var(--text-xs); color: var(--fg-subtle); display: flex; gap: 0.75rem; }

  .prose { font-size: 1.0625rem; line-height: 1.8; color: var(--fg); max-width: 72ch; }
  .prose > * + * { margin-top: 1.15em; }
  .prose h2 { font-size: var(--text-2xl); margin-top: 2.2em; letter-spacing: -0.02em; scroll-margin-top: calc(var(--header-h) + 1rem); }
  .prose h3 { font-size: var(--text-xl); margin-top: 1.8em; scroll-margin-top: calc(var(--header-h) + 1rem); }
  .prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
  .prose p, .prose li { color: color-mix(in oklab, var(--fg) 88%, var(--fg-muted)); }
  .prose ul, .prose ol { padding-left: 1.4em; }
  .prose li + li { margin-top: 0.4em; }
  .prose li::marker { color: var(--fg-subtle); }
  .prose a { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--link) 40%, transparent); text-underline-offset: 3px; }
  .prose a:hover { text-decoration-color: currentColor; }
  .prose blockquote { border-left: 3px solid var(--accent); padding: 0.25rem 0 0.25rem 1.1rem; color: var(--fg-muted); font-style: italic; }
  .prose table { width: 100%; font-size: var(--text-sm); display: block; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
  .prose th, .prose td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; min-width: 8.5rem; } /* narrow screens scroll the table instead of squeezing it */
  .prose thead th { background: var(--bg-subtle); font-weight: 650; white-space: nowrap; }
  .prose tr:last-child td { border-bottom: 0; }
  .prose pre { background: #0d1117; color: #e6edf3; padding: 1rem 1.1rem; border-radius: var(--r-lg); overflow-x: auto; font-size: 0.85rem; line-height: 1.65; }
  .prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
  .prose hr { margin-block: 2.2em; }
  .prose img { border-radius: var(--r-lg); }
  .prose .key-takeaways, .prose h2#key-takeaways + ul { background: var(--accent-soft); border: 1px solid color-mix(in oklab, var(--accent) 25%, transparent); border-radius: var(--r-lg); padding: 1rem 1.25rem 1rem 2.4rem; }
  .toc { font-size: var(--text-sm); display: grid; gap: 0.15rem; }
  .toc a { color: var(--fg-muted); padding: 0.3rem 0.6rem; border-left: 2px solid var(--border); text-decoration: none; display: block; line-height: 1.4; }
  .toc a:hover { color: var(--fg); border-left-color: var(--fg-subtle); }
  .toc a.is-active { color: var(--accent-soft-fg); border-left-color: var(--accent); }
}

/* ───────────────────────────── App shell (publisher / admin) ───────────────────────────── */
@layer app {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
  .sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 0.75rem; border-right: 1px solid var(--border); background: var(--bg-elevated); overflow-y: auto; }
  .sidebar .brand { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.6rem 1rem; color: var(--fg); text-decoration: none; }
  .sidebar .brand svg.logo { height: 24px; }
  .sidebar .brand .badge { margin-left: auto; }
  .nav-section { margin-top: 0.75rem; padding: 0 0.6rem 0.35rem; font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-subtle); }
  .nav-link { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.65rem; border-radius: var(--r-md); color: var(--fg-muted); font-size: var(--text-sm); font-weight: 550; text-decoration: none !important; position: relative; }
  .nav-link .icon { width: 1.15rem; height: 1.15rem; color: var(--fg-subtle); }
  .nav-link:hover { background: var(--bg-muted); color: var(--fg); }
  .nav-link.is-active { background: var(--accent-soft); color: var(--accent-soft-fg); }
  .nav-link.is-active .icon { color: var(--accent-soft-fg); }
  .nav-link .count { margin-left: auto; font-size: var(--text-2xs); font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--accent); color: #fff; }
  .nav-link .dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
  .sidebar-foot { margin-top: auto; padding-top: 1rem; display: grid; gap: 0.5rem; }
  .sidebar-card { padding: 0.9rem; border-radius: var(--r-lg); background: var(--bg-subtle); border: 1px solid var(--border); font-size: var(--text-xs); color: var(--fg-muted); }
  .sidebar-card strong { color: var(--fg); display: block; font-size: var(--text-sm); margin-bottom: 0.2rem; }

  .main { min-width: 0; display: flex; flex-direction: column; }
  .topbar { position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; gap: 0.75rem; padding: 0 clamp(1rem, 2vw, 2rem); background: color-mix(in oklab, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
  .topbar .crumb { font-size: var(--text-sm); color: var(--fg-subtle); display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
  .topbar .crumb strong { color: var(--fg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .right { margin-left: auto; display: flex; align-items: center; gap: 0.35rem; }
  .user-btn { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0.5rem 0.25rem 0.25rem; border-radius: 999px; border: 1px solid transparent; }
  .user-btn:hover { background: var(--bg-muted); }
  .user-btn .name { font-size: var(--text-sm); font-weight: 600; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content { padding: clamp(1rem, 2vw, 2rem); display: flex; flex-direction: column; gap: 1.5rem; max-width: 1360px; width: 100%; }
  .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
  .page-head h1 { font-size: var(--text-2xl); letter-spacing: -0.025em; }
  .page-head p { color: var(--fg-muted); font-size: var(--text-sm); margin-top: 0.3rem; max-width: 640px; }
  .page-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
  .menu-toggle { display: none; }
  .app-backdrop { display: none; }

  @media (max-width: 1024px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(300px, 86vw); transform: translateX(-102%); transition: transform 220ms var(--ease); box-shadow: var(--shadow-xl); }
    .sidebar.is-open { transform: none; }
    .app-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
    .menu-toggle { display: inline-flex; }
    .user-btn .name { display: none; }
  }

  /* Booking page */
  .booking-hero { padding-block: clamp(1.5rem, 1rem + 2vw, 2.75rem) 1.5rem; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--bg-subtle), var(--bg)); }
  .site-chip { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.75rem 0.3rem 0.3rem; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border); font-size: var(--text-sm); font-weight: 600; color: var(--fg); text-decoration: none !important; }
  .site-chip img, .site-chip .avatar { width: 26px; height: 26px; }
  .slot-preview { border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--bg-elevated); padding: 1rem; }
  /* Ad slots are rectangles on the publisher's site: square corners, so a banner's own border isn't clipped. */
  .slot-frame { position: relative; margin-inline: auto; width: 100%; overflow: hidden; background: var(--bg-muted); box-shadow: 0 1px 2px rgb(16 24 40 / 0.08), 0 6px 18px -8px rgb(16 24 40 / 0.22); }
  .slot-frame img { width: 100%; height: 100%; object-fit: cover; }
  .slot-frame .size-tag { position: absolute; right: 6px; bottom: 6px; font-size: var(--text-2xs); font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 6px; background: rgb(10 13 19 / 0.7); color: #fff; font-variant-numeric: tabular-nums; }
  .metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
  .metric { padding: 0.85rem 1rem; border-radius: var(--r-lg); background: var(--bg-subtle); border: 1px solid var(--border); }
  .metric .v { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .metric .l { font-size: var(--text-xs); color: var(--fg-subtle); font-weight: 600; }
  @media (max-width: 480px) { .metric-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; } .metric { padding: 0.7rem; } .metric .v { font-size: var(--text-lg); } }
  .checkout-card { position: sticky; top: calc(var(--header-h) + 1rem); }
  @media (max-width: 960px) { .checkout-card { position: static; } }
  .mobile-paybar { display: none; }
  @media (max-width: 960px) {
    .mobile-paybar { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom)); background: color-mix(in oklab, var(--bg-elevated) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); align-items: center; gap: 1rem; }
    .mobile-paybar .total { font-weight: 700; font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
    .mobile-paybar .sub { font-size: var(--text-xs); color: var(--fg-subtle); }
    .mobile-paybar .btn { margin-left: auto; }
    .has-paybar { padding-bottom: 88px; }
  }

  /* Calendar (availability) */
  .cal { user-select: none; max-width: 520px; }
  .cal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
  .cal-head .month { font-weight: 650; }
  .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .cal-dow { font-size: var(--text-2xs); font-weight: 700; color: var(--fg-subtle); text-align: center; padding: 0.3rem 0; text-transform: uppercase; letter-spacing: 0.04em; }
  .cal-day { position: relative; height: 42px; display: grid; place-items: center; border-radius: var(--r-sm); font-size: var(--text-sm); font-variant-numeric: tabular-nums; color: var(--fg); background: transparent; border: 1px solid transparent; }
  button.cal-day:hover:not(:disabled) { border-color: var(--accent); }
  .cal-day.is-out { color: transparent; pointer-events: none; }
  .cal-day.is-past { color: var(--fg-subtle); opacity: 0.45; }
  .cal-day.is-booked { background: repeating-linear-gradient(-45deg, var(--bg-muted), var(--bg-muted) 4px, transparent 4px, transparent 8px); color: var(--fg-subtle); text-decoration: line-through; }
  .cal-day.is-today { font-weight: 700; box-shadow: inset 0 0 0 1px var(--border-strong); }
  .cal-day.in-range { background: var(--accent-soft); color: var(--accent-soft-fg); border-radius: 0; }
  .cal-day.is-start, .cal-day.is-end { background: var(--accent); color: #fff; font-weight: 700; }
  .cal-day.is-start { border-radius: var(--r-sm) 0 0 var(--r-sm); }
  .cal-day.is-end { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
  .cal-day.is-start.is-end { border-radius: var(--r-sm); }
  .cal-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.75rem; font-size: var(--text-xs); color: var(--fg-subtle); }
  .cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 0.35rem; }

  /* Dropzone + cropper */
  .dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; text-align: center; padding: 1.5rem; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--bg-subtle); color: var(--fg-muted); font-size: var(--text-sm); cursor: pointer; transition: border-color var(--dur), background var(--dur); }
  .dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
  .dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
  .dropzone .icon { width: 28px; height: 28px; color: var(--accent); }
  .cropper { position: relative; width: 100%; overflow: hidden; border-radius: var(--r-md); background: repeating-conic-gradient(var(--bg-muted) 0 25%, var(--bg-elevated) 0 50%) 0 0 / 16px 16px; touch-action: none; cursor: grab; box-shadow: 0 0 0 1px var(--border-strong); }
  .cropper:active { cursor: grabbing; }
  .cropper img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; }
  .cropper .crop-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgb(255 255 255 / 0.25) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.25) 1px, transparent 1px); background-size: 33.333% 33.333%; box-shadow: inset 0 0 0 2px var(--accent); }
  .range { width: 100%; accent-color: var(--accent); }

  /* SVG charts */
  .chart { width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); }
  .chart .grid line { stroke: var(--border); stroke-dasharray: 3 4; }
  .chart .axis text { fill: var(--fg-subtle); font-size: 10px; font-variant-numeric: tabular-nums; }
  .chart .bar { fill: var(--accent); opacity: 0.88; transition: opacity var(--dur); }
  .chart .bar:hover { opacity: 1; }
  .chart .bar.alt { fill: color-mix(in oklab, var(--accent) 35%, var(--bg-muted)); }
  .chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
  .chart .line.alt { stroke: #f59e0b; }
  .chart .area { fill: url(#chart-fill); }
  .chart .pt { fill: var(--bg-elevated); stroke: var(--accent); stroke-width: 2; }
  .chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: var(--text-xs); color: var(--fg-muted); }
  .chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.35rem; vertical-align: -1px; background: var(--accent); }
  .chart-legend i.alt { background: #f59e0b; }
  .chart-tip { position: absolute; pointer-events: none; z-index: 5; padding: 0.4rem 0.6rem; border-radius: var(--r-sm); background: var(--gray-900); color: #fff; font-size: var(--text-xs); white-space: nowrap; box-shadow: var(--shadow-md); transform: translate(-50%, calc(-100% - 8px)); }
  .sparkline { width: 100%; height: 36px; }
  .sparkline path { fill: none; stroke: var(--accent); stroke-width: 1.75; }

  /* Auth */
  .auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .auth-main { display: flex; flex-direction: column; padding: clamp(1.25rem, 3vw, 2.5rem); }
  .auth-main .brand { color: var(--fg); display: inline-flex; }
  .auth-form { width: 100%; max-width: 420px; margin: auto; padding-block: 2.5rem; }
  .auth-form h1 { font-size: var(--text-3xl); }
  .auth-form .sub { color: var(--fg-muted); margin-top: 0.4rem; font-size: var(--text-sm); }
  .auth-aside { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 4vw, 4rem); background: radial-gradient(70% 60% at 20% 15%, #7c6cf8 0%, transparent 60%), radial-gradient(60% 60% at 90% 90%, #c026d3 0%, transparent 55%), #15123a; color: #fff; }
  .auth-aside h2 { color: #fff; font-size: var(--text-3xl); max-width: 460px; }
  .auth-aside p { color: rgb(255 255 255 / 0.78); margin-top: 0.75rem; max-width: 460px; }
  .auth-aside .check-list li { color: rgb(255 255 255 / 0.9); }
  .auth-aside .check-list .icon { color: #a7f3d0; }
  .oauth { display: grid; gap: 0.6rem; grid-template-columns: 1fr 1fr; }
  .or { display: flex; align-items: center; gap: 0.75rem; font-size: var(--text-xs); color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.06em; }
  .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  @media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-aside { display: none; } }
}

/* ───────────────────────────── Utilities ───────────────────────────── */
@layer utilities {
  .muted { color: var(--fg-muted); } .subtle { color: var(--fg-subtle); } .text-fg { color: var(--fg); }
  .text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning-fg); } .text-brand { color: var(--accent-soft-fg); }
  .text-xs { font-size: var(--text-xs); } .text-sm { font-size: var(--text-sm); } .text-base { font-size: var(--text-base); } .text-lg { font-size: var(--text-lg); } .text-xl { font-size: var(--text-xl); } .text-2xl { font-size: var(--text-2xl); }
  .fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
  .mono { font-family: var(--font-mono); } .nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .break { overflow-wrap: anywhere; }
  .center { text-align: center; } .right { text-align: right; }
  .mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; } .mt-12 { margin-top: 3rem; }
  .mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
  .ml-auto { margin-left: auto; } .mx-auto { margin-inline: auto; }
  .p-0 { padding: 0; } .p-4 { padding: 1rem; } .p-6 { padding: 1.5rem; }
  .w-full { width: 100%; } .max-w-sm { max-width: 420px; } .max-w-md { max-width: 560px; } .max-w-lg { max-width: 720px; }
  .flex { display: flex; } .inline-flex { display: inline-flex; } .items-center { align-items: center; } .items-start { align-items: flex-start; } .justify-between { justify-content: space-between; } .justify-center { justify-content: center; } .flex-1 { flex: 1 1 0; min-width: 0; } .shrink-0 { flex-shrink: 0; } .wrap { flex-wrap: wrap; }
  .gap-1 { gap: 0.25rem; } .gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
  .rounded { border-radius: var(--r-md); } .rounded-lg { border-radius: var(--r-lg); } .rounded-full { border-radius: 999px; }
  .border { border: 1px solid var(--border); } .bg-subtle { background: var(--bg-subtle); } .bg-elevated { background: var(--bg-elevated); }
  .overflow-hidden { overflow: hidden; } .relative { position: relative; }
  @media (max-width: 640px) { .hide-sm { display: none !important; } }
  @media (min-width: 641px) { .show-sm { display: none !important; } }
  @media (max-width: 960px) { .hide-md { display: none !important; } }
  @media (min-width: 961px) { .show-md { display: none !important; } }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }
}

@layer base {
  body.site { display: flex; flex-direction: column; }
  body.site > main { flex: 1 0 auto; }
}

/* ── refinements after visual QA ── */
@layer base {
  svg.icon { display: inline-block; vertical-align: -0.2em; }
}
@layer marketing {
  .hero-mock-grid { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 14px; }
  .cta-band .btn-ghost:hover { background: rgb(255 255 255 / 0.1); }
  @media (max-width: 640px) {
    .hero-actions .btn { width: 100%; }
    .announce { font-size: var(--text-xs); }
    .hero-mock-grid { grid-template-columns: minmax(0, 1fr) 96px; gap: 10px; }
    .hero-mock-grid .ad-live { flex-direction: column; align-items: flex-start; gap: 0.35rem; padding: 0.8rem; }
    .cta-band .hero-actions .btn { width: 100%; }
  }
}

@layer app {
  @media (min-width: 1025px) {
    .app { background: linear-gradient(90deg, var(--bg-elevated) calc(var(--sidebar-w) - 1px), var(--border) calc(var(--sidebar-w) - 1px), var(--border) var(--sidebar-w), var(--bg) var(--sidebar-w)); }
  }
}

@layer components {
  .card-flex { display: flex; flex-direction: column; }
  .card-flex > .card-body { flex: 1 1 auto; }
}
@layer components { .code-wrap pre { white-space: pre-wrap; word-break: break-all; } }
@layer utilities { .mr-auto { margin-right: auto; } }

@layer components {
  /* toast stack lives in the top layer (popover) so it shows above open dialogs */
  .toasts[popover] { inset: auto 1rem 1rem auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; color: inherit; }
  @media (max-width: 640px) { .toasts[popover] { inset: auto 1rem calc(1rem + env(safe-area-inset-bottom)) 1rem; } }
}
