/* Transplane World design system: tokens, materials, controls and motion shared by the
   landing page (/) and the client (/app). Adapted from TRANSPLANE WORLD v2:
   layered tray → surface → raised materials outlined by shadow rings, one ink
   primary action, a single jade accent and spring motion. */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/hanken-grotesk-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  /* Latin only; CJK punctuation (curly quotes, ellipsis) stays with the CJK face. */
  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-2017, U+2020-2025, U+2027-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  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-2017, U+2020-2025, U+2027-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
  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-2017, U+2020-2025, U+2027-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens: Night (default) ---------- */
:root {
  --tray: #0b0d0e;
  --surface: #141718;
  --raised: #1c2021;
  --sunken: #0e1011;
  --ring: rgba(255, 255, 255, .075);
  --ring-strong: rgba(255, 255, 255, .15);
  --divider: rgba(255, 255, 255, .06);
  --sheen: rgba(255, 255, 255, .07);
  --ink: #f2f4f3;
  --soft: #a4adab;
  --faint: #69716f;
  --accent: #aef2cf;
  --accent-deep: #3c6f66;
  --on-accent: #04110c;
  --accent-tint: rgba(174, 242, 207, .12);
  --lamp: #f5c45d;
  --lamp-ink: #f5c45d;
  --lamp-tint: rgba(245, 196, 93, .13);
  --danger: #ff8a7a;
  --danger-tint: rgba(255, 138, 122, .13);
  --btn: #f2f4f3;
  --btn-ink: #0b0d0e;
  --glass: rgba(20, 23, 24, .72);
  --scrim: rgba(5, 7, 8, .72);
  --aurora-jade: rgba(76, 168, 138, .30);
  --aurora-mint: rgba(174, 242, 207, .14);
  --aurora-lamp: rgba(245, 196, 93, .09);
  --brand-plane: #3c6f66;
  --brand-pixels: #639f8a;
  --brand-highlights: #83b8a0;
  --brand-origin: #aef2cf;
  --brand-glyph: #f0f2e6;
  --code-key: #aef2cf;
  --code-string: #f5c45d;
  --code-number: #8fd3c7;
  --code-comment: #69716f;
  --method-get: #8fd3c7;
  --method-post: #aef2cf;
  --method-put: #f5c45d;
  --method-patch: #e8c27a;
  --method-delete: #ff8a7a;
  --avatar-filter: saturate(.92) brightness(.94);
  --shadow-ring: 0 0 0 1px rgba(255, 255, 255, .075), inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-raised: 0 0 0 1px rgba(255, 255, 255, .09), inset 0 1px 0 rgba(255, 255, 255, .07), 0 1px 2px rgba(0, 0, 0, .5), 0 16px 36px -14px rgba(0, 0, 0, .85);
  --shadow-float: 0 0 0 1px rgba(255, 255, 255, .11), inset 0 1px 0 rgba(255, 255, 255, .08), 0 24px 60px -20px rgba(0, 0, 0, .9), 0 4px 12px -4px rgba(0, 0, 0, .6);
  --shadow-thumb: 0 0 0 1px rgba(255, 255, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .10), 0 1px 3px rgba(0, 0, 0, .6);
  --shadow-btn: inset 0 1px 0 rgba(255, 255, 255, .55), 0 1px 2px rgba(0, 0, 0, .5), 0 6px 16px -8px rgba(174, 242, 207, .35);
  --shadow-glow: 0 0 0 1px rgba(174, 242, 207, .45), 0 0 24px -4px rgba(174, 242, 207, .45);
  --focus-halo: 0 0 0 2px #0b0d0e, 0 0 0 4px #aef2cf;
  color-scheme: dark;

  --font-display: "Hanken Grotesk", "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;

  --space-2: 2px; --space-4: 4px; --space-6: 6px; --space-8: 8px; --space-10: 10px; --space-12: 12px;
  --space-16: 16px; --space-20: 20px; --space-24: 24px; --space-32: 32px; --space-40: 40px; --space-48: 48px;
  --space-64: 64px; --space-80: 80px; --space-96: 96px; --space-128: 128px;
  --radius-pixel: 2px; --radius-xs: 6px; --radius-sm: 10px; --radius-md: 14px; --radius-lg: 20px; --radius-pill: 999px;

  --gutter: clamp(16px, 4vw, 56px);
  --container: 1280px;
  --header-height: 64px;
  --control-h: 40px;
  --control-h-sm: 32px;

  --t-press: 100ms; --t-exit: 160ms; --t-hover: 180ms; --t-stagger: 40ms; --t-morph: 420ms;
  --t-sheet: 480ms; --t-spring: 520ms; --t-reveal: 700ms; --t-twinkle: 1400ms; --t-shimmer: 2200ms;
  --ease-spring: cubic-bezier(.2, 1.3, .35, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-standard: cubic-bezier(.4, 0, .2, 1);
  /* Physically simulated springs (stiffness/damping) for pops and settles. */
  --ease-bounce: linear(0, .0585, .1987, .3781, .5643, .7351, .8773, .9851, 1.0585, 1.1011, 1.1186, 1.1175, 1.1041, 1.084, 1.0616, 1.0401, 1.0215, 1.0067, .9962, .9896, .9863, .9856, .9867, .9888, .9915, .9941, .9965, .9985, 1, 1.001, 1.0015, 1.0017, 1.0017, 1.0015, 1.0012, 1.0008, 1.0005, 1.0003, 1);
  --ease-settle: linear(0, .0364, .1237, .238, .362, .4841, .5967, .6959, .7798, .8484, .9025, .9437, .9739, .9951, 1.009, 1.0174, 1.0216, 1.0229, 1.0222, 1.0202, 1.0177, 1.0148, 1.012, 1.0094, 1.0071, 1.0052, 1.0036, 1.0023, 1.0014, 1.0006, 1);

  --z-stage: 1; --z-panel: 20; --z-header: 30; --z-popover: 40; --z-toast: 50;
}

/* ---------- tokens: Day ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --tray: #e9ede8; --surface: #fbfcfa; --raised: #ffffff; --sunken: #f0f3ef;
    --ring: rgba(16, 40, 38, .10); --ring-strong: rgba(16, 40, 38, .20); --divider: rgba(16, 40, 38, .08); --sheen: rgba(255, 255, 255, .9);
    --ink: #0e1a1b; --soft: #4e625f; --faint: #8a9893;
    --accent: #2f6b5f; --accent-deep: #3c6f66; --on-accent: #f4f8f5; --accent-tint: rgba(47, 107, 95, .09);
    --lamp: #c8871a; --lamp-ink: #87580a; --lamp-tint: rgba(200, 135, 26, .12);
    --danger: #b3402f; --danger-tint: rgba(179, 64, 47, .09);
    --btn: #0e1a1b; --btn-ink: #f4f8f5;
    --glass: rgba(251, 252, 250, .76);
    --scrim: rgba(233, 237, 232, .76);
    --aurora-jade: rgba(99, 159, 138, .30); --aurora-mint: rgba(174, 242, 207, .60); --aurora-lamp: rgba(245, 196, 93, .32);
    --code-key: #2f6b5f; --code-string: #87580a; --code-number: #1f6f78; --code-comment: #8a9893;
    --method-get: #1f6f78; --method-post: #2f6b5f; --method-put: #87580a; --method-patch: #8a5a2b; --method-delete: #b3402f;
    --avatar-filter: none;
    --shadow-ring: 0 0 0 .5px rgba(16, 40, 38, .14), 0 1px 2px rgba(16, 40, 38, .05);
    --shadow-raised: 0 0 0 .5px rgba(16, 40, 38, .12), 0 1px 1px -1px rgba(16, 40, 38, .10), 0 1px 2px rgba(16, 40, 38, .05), 0 14px 32px -12px rgba(16, 40, 38, .20);
    --shadow-float: 0 0 0 .5px rgba(16, 40, 38, .12), 0 24px 60px -20px rgba(16, 40, 38, .28), 0 4px 12px -4px rgba(16, 40, 38, .10);
    --shadow-thumb: 0 0 0 .5px rgba(16, 40, 38, .14), 0 1px 2px rgba(16, 40, 38, .10), 0 2px 6px -2px rgba(16, 40, 38, .10);
    --shadow-btn: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(16, 40, 38, .25), 0 6px 16px -8px rgba(16, 40, 38, .45);
    --shadow-glow: 0 0 0 1px rgba(47, 107, 95, .45), 0 0 20px -6px rgba(47, 107, 95, .45);
    --focus-halo: 0 0 0 2px #fbfcfa, 0 0 0 4px #2f6b5f;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --tray: #e9ede8; --surface: #fbfcfa; --raised: #ffffff; --sunken: #f0f3ef;
  --ring: rgba(16, 40, 38, .10); --ring-strong: rgba(16, 40, 38, .20); --divider: rgba(16, 40, 38, .08); --sheen: rgba(255, 255, 255, .9);
  --ink: #0e1a1b; --soft: #4e625f; --faint: #8a9893;
  --accent: #2f6b5f; --accent-deep: #3c6f66; --on-accent: #f4f8f5; --accent-tint: rgba(47, 107, 95, .09);
  --lamp: #c8871a; --lamp-ink: #87580a; --lamp-tint: rgba(200, 135, 26, .12);
  --danger: #b3402f; --danger-tint: rgba(179, 64, 47, .09);
  --btn: #0e1a1b; --btn-ink: #f4f8f5;
  --glass: rgba(251, 252, 250, .76);
  --scrim: rgba(233, 237, 232, .76);
  --aurora-jade: rgba(99, 159, 138, .30); --aurora-mint: rgba(174, 242, 207, .60); --aurora-lamp: rgba(245, 196, 93, .32);
  --code-key: #2f6b5f; --code-string: #87580a; --code-number: #1f6f78; --code-comment: #8a9893;
  --method-get: #1f6f78; --method-post: #2f6b5f; --method-put: #87580a; --method-patch: #8a5a2b; --method-delete: #b3402f;
  --avatar-filter: none;
  --shadow-ring: 0 0 0 .5px rgba(16, 40, 38, .14), 0 1px 2px rgba(16, 40, 38, .05);
  --shadow-raised: 0 0 0 .5px rgba(16, 40, 38, .12), 0 1px 1px -1px rgba(16, 40, 38, .10), 0 1px 2px rgba(16, 40, 38, .05), 0 14px 32px -12px rgba(16, 40, 38, .20);
  --shadow-float: 0 0 0 .5px rgba(16, 40, 38, .12), 0 24px 60px -20px rgba(16, 40, 38, .28), 0 4px 12px -4px rgba(16, 40, 38, .10);
  --shadow-thumb: 0 0 0 .5px rgba(16, 40, 38, .14), 0 1px 2px rgba(16, 40, 38, .10), 0 2px 6px -2px rgba(16, 40, 38, .10);
  --shadow-btn: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(16, 40, 38, .25), 0 6px 16px -8px rgba(16, 40, 38, .45);
  --shadow-glow: 0 0 0 1px rgba(47, 107, 95, .45), 0 0 20px -6px rgba(47, 107, 95, .45);
  --focus-halo: 0 0 0 2px #fbfcfa, 0 0 0 4px #2f6b5f;
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--tray);
  color: var(--ink);
  font: 400 15px/1.6 var(--font-display);
  letter-spacing: -.005em;
  font-synthesis: none;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
:where(button, input, select, textarea) { font: inherit; color: inherit; letter-spacing: inherit; }
:where(a) { color: inherit; }
:where(h1, h2, h3, h4, p, dl, dd, figure, blockquote) { margin: 0; }
:where(ul, ol) { margin: 0; padding: 0; }
:where(img, svg, video) { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus { outline: none; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: none; box-shadow: var(--focus-halo); }
* { scrollbar-width: thin; scrollbar-color: var(--ring-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--ring-strong); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: content-box; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--btn); color: var(--btn-ink); font: 500 14px/1 var(--font-display); text-decoration: none;
  transform: translateY(-160%); transition: transform var(--t-spring) var(--ease-spring);
}
.skip-link:focus-visible { transform: none; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--soft); }
.optional { color: var(--faint); font-weight: 400; }
noscript p, .noscript-notice { margin: 24px; padding: 16px; border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-ring); }

/* ---------- type ---------- */
.t-display { font: 300 clamp(44px, 6.4vw, 92px)/.98 var(--font-display); letter-spacing: -.05em; text-wrap: balance; }
.t-headline { font: 300 clamp(34px, 4vw, 56px)/1.04 var(--font-display); letter-spacing: -.04em; text-wrap: balance; }
.t-section { font: 300 clamp(28px, 2.6vw, 38px)/1.1 var(--font-display); letter-spacing: -.03em; text-wrap: balance; }
:lang(zh) :is(.t-display) { line-height: 1.1; letter-spacing: -.035em; }
:lang(zh) :is(.t-headline) { line-height: 1.16; letter-spacing: -.02em; }
:lang(zh) :is(.t-section) { line-height: 1.24; letter-spacing: -.01em; }
.t-title { font: 500 20px/1.25 var(--font-display); letter-spacing: -.015em; }
.t-subtitle { font: 500 16px/1.35 var(--font-display); letter-spacing: -.01em; }
.t-body { font: 400 15px/1.6 var(--font-display); color: var(--soft); }
.t-lead { font: 400 clamp(16px, 1.3vw, 18.5px)/1.65 var(--font-display); color: var(--soft); text-wrap: pretty; }
.t-caption { font: 400 13px/1.5 var(--font-display); color: var(--soft); }
.t-data { font: 400 12px/1.4 var(--font-mono); letter-spacing: .02em; color: var(--soft); font-variant-numeric: tabular-nums; }
.t-overline { font: 500 11px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: var(--radius-xs); background: var(--raised); box-shadow: var(--shadow-ring);
  font: 500 11px/1 var(--font-mono); color: var(--soft); white-space: nowrap;
}

/* ---------- icons ---------- */
.icon { width: 18px; height: 18px; flex: none; fill: currentColor; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }
.brand-mark { width: 24px; height: 24px; flex: none; fill: currentColor; }
.brand-wordmark { width: 117.5px; height: 26px; flex: none; fill: currentColor; overflow: visible; }

/* ---------- wordmark ---------- */
.wordmark {
  display: inline-flex; align-items: center; gap: var(--space-10);
  font: 500 12px/1 var(--font-display); letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.wordmark .wordmark-tail { margin-inline-start: -.1em; color: var(--soft); font-weight: 400; }
.wordmark .brand-mark { width: 24px; height: 24px; }

/* ---------- materials ---------- */
.tray { padding: var(--space-24); border-radius: var(--radius-lg); background: var(--tray); box-shadow: inset 0 0 0 1px var(--divider); }
.card { position: relative; border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-ring); }
.card.is-raised { box-shadow: var(--shadow-raised); }
.card.is-interactive { transition: box-shadow var(--t-hover) var(--ease-out), transform var(--t-spring) var(--ease-spring); }
@media (hover: hover) { .card.is-interactive:hover { box-shadow: var(--shadow-raised); transform: translateY(-2px); } }
.glass { background: var(--glass); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); }
.divider { height: 1px; border: 0; margin: 0; background: var(--divider); }
.aurora { position: relative; isolation: isolate; }
.aurora::before {
  content: ""; position: absolute; inset: auto -20% -45% -20%; height: 90%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(45% 60% at calc(28% + var(--aurora-x, 0%)) 70%, var(--aurora-jade), transparent 70%),
    radial-gradient(40% 55% at calc(62% + var(--aurora-x, 0%) * .6) 78%, var(--aurora-mint), transparent 70%),
    radial-gradient(30% 45% at 88% 60%, var(--aurora-lamp), transparent 70%);
  filter: blur(18px);
}

/* ---------- buttons ---------- */
.button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  height: var(--control-h); padding: 0 var(--space-16); border: 0; border-radius: var(--radius-sm);
  font: 500 14px/1 var(--font-display); letter-spacing: -.005em; white-space: nowrap; text-decoration: none; cursor: pointer;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-ring);
  transition: background-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out), transform var(--t-press) var(--ease-out), opacity var(--t-hover) var(--ease-out);
  -webkit-user-select: none; user-select: none;
}
.button .icon { width: 17px; height: 17px; }
@media (hover: hover) { .button:hover { background: var(--raised); box-shadow: 0 0 0 1px var(--ring-strong), 0 1px 2px rgba(0, 0, 0, .08); } }
.button:active:not(:disabled) { transform: scale(.97); }
.button.primary { background: var(--btn); color: var(--btn-ink); box-shadow: var(--shadow-btn); }
@media (hover: hover) { .button.primary:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-btn), var(--shadow-glow); } }
.button.accent { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-btn); }
@media (hover: hover) { .button.accent:hover { background: var(--accent); box-shadow: var(--shadow-btn), var(--shadow-glow); } }
.button.ghost { background: transparent; box-shadow: none; color: var(--soft); }
@media (hover: hover) { .button.ghost:hover { background: var(--accent-tint); color: var(--ink); box-shadow: none; } }
.button.secondary { background: var(--surface); }
.button.danger { background: var(--danger); color: var(--btn-ink); box-shadow: var(--shadow-btn); }
:root[data-theme="light"] .button.danger { color: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .button.danger { color: #fff; } }
@media (hover: hover) { .button.danger:hover { background: var(--danger); filter: brightness(1.06); box-shadow: var(--shadow-btn); } }
.button.danger-outline { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); }
@media (hover: hover) { .button.danger-outline:hover { background: var(--danger-tint); box-shadow: inset 0 0 0 1px var(--danger); } }
.button.compact, .button.sm { height: var(--control-h-sm); padding: 0 var(--space-12); font-size: 13px; gap: 6px; }
.button.lg { height: 48px; padding: 0 var(--space-20); font-size: 15px; border-radius: 12px; }
.button.full-width { width: 100%; }
.button:disabled, .button[aria-disabled="true"] { background: var(--sunken); color: var(--faint); box-shadow: var(--shadow-ring); cursor: not-allowed; filter: none; }
.button .arrow { transition: transform var(--t-spring) var(--ease-spring); }
@media (hover: hover) { .button:hover .arrow { transform: translateX(3px); } }
.button[aria-busy="true"], .button.is-loading { color: transparent !important; pointer-events: none; }
.button[aria-busy="true"]::after, .button.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 4px; height: 4px; border-radius: 1px;
  background: currentColor; color: var(--soft); box-shadow: 7px 0 0 currentColor, -7px 0 0 currentColor;
  animation: ds-dots 900ms steps(3) infinite;
}
.button.primary[aria-busy="true"]::after, .button.primary.is-loading::after { color: var(--btn-ink); }
@keyframes ds-dots { 0% { opacity: .3 } 50% { opacity: 1 } }
@media (max-width: 900px) { .button { height: 44px; } .button.compact, .button.sm { height: 36px; } }

.icon-button {
  display: inline-grid; place-items: center; flex: none; width: var(--control-h-sm); height: var(--control-h-sm); padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--soft); cursor: pointer;
  transition: background-color var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out), transform var(--t-press) var(--ease-out);
}
@media (hover: hover) { .icon-button:hover:not(:disabled) { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ring); } }
.icon-button:active:not(:disabled) { transform: scale(.92); }
.icon-button:disabled { color: var(--faint); cursor: not-allowed; opacity: .6; }
.icon-button[aria-pressed="true"] { color: var(--accent); background: var(--accent-tint); }
.icon-button .icon { width: 18px; height: 18px; }
.icon-button.copy-inline { width: 26px; height: 26px; border-radius: 7px; }
.icon-button.copy-inline .icon { width: 15px; height: 15px; }
.icon-button.is-copied { color: var(--accent); }

.text-button {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0; border-radius: 6px; background: none;
  font: 500 13.5px/1.2 var(--font-display); color: var(--accent); cursor: pointer; text-decoration: none;
  transition: color var(--t-hover) var(--ease-out), opacity var(--t-hover) var(--ease-out);
}
@media (hover: hover) { .text-button:hover:not(:disabled) { color: var(--ink); } }
.text-button:disabled { color: var(--faint); cursor: not-allowed; }
.text-button.danger-text { color: var(--danger); }
.text-button .icon { width: 15px; height: 15px; }

/* ---------- chips, badges and status ---------- */
.chip, .badge {
  display: inline-flex; align-items: center; gap: var(--space-6); height: 24px; padding: 0 10px;
  border-radius: var(--radius-pill); background: var(--raised); color: var(--soft);
  box-shadow: inset 0 0 0 1px var(--ring), 0 1px 0 var(--sheen);
  font: 500 12px/1 var(--font-display); white-space: nowrap; flex: none;
}
.chip .icon, .badge .icon { width: 13px; height: 13px; }
.chip.dot::before, .badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.chip.accent, .badge.accent { background: var(--accent-tint); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-tint); }
.chip.lamp, .badge.lamp { background: var(--lamp-tint); color: var(--lamp-ink); box-shadow: inset 0 0 0 1px var(--lamp-tint); }
.chip.danger, .badge.danger { background: var(--danger-tint); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-tint); }
.chip.live::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; animation: ds-pulse 1600ms ease-in-out infinite; }
.chip.sm, .badge.sm { height: 20px; padding: 0 8px; font-size: 11.5px; }
@keyframes ds-pulse { 50% { opacity: .35; transform: scale(.7); } }

.identity-tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px; flex: none;
  border-radius: 5px; background: var(--accent-tint); color: var(--accent);
  font: 500 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
}
.capability {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
  background: var(--sunken); color: var(--soft); box-shadow: inset 0 0 0 1px var(--ring); font: 400 12px/1 var(--font-display);
}
.service-status { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1 var(--font-display); color: var(--soft); }
.service-status::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--faint); }
.service-status.online { color: var(--accent); }
.service-status.online::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); animation: ds-pulse 2000ms ease-in-out infinite; }

.task-status { --chip-c: var(--soft); }
.task-status.active { background: var(--accent-tint); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-tint); }
.task-status.cancel_requested { background: var(--lamp-tint); color: var(--lamp-ink); box-shadow: inset 0 0 0 1px var(--lamp-tint); }
.task-status.succeeded { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.task-status.failed { background: var(--danger-tint); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-tint); }
.task-status.cancelled { background: var(--sunken); color: var(--soft); }

.count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-pill); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring);
  font: 500 11px/1 var(--font-mono); color: var(--soft); font-variant-numeric: tabular-nums;
}
.count.accent { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* ---------- in-progress marks ---------- */
.pixmark { display: inline-grid; grid-template-columns: repeat(3, 3px); gap: 1.5px; flex: none; }
.pixmark > i { width: 3px; height: 3px; border-radius: .5px; background: var(--accent); animation: ds-twinkle var(--t-twinkle) ease-in-out infinite; }
.pixmark > i:nth-child(2) { animation-delay: -1100ms } .pixmark > i:nth-child(3) { animation-delay: -300ms }
.pixmark > i:nth-child(4) { animation-delay: -800ms } .pixmark > i:nth-child(5) { animation-delay: 0ms }
.pixmark > i:nth-child(6) { animation-delay: -500ms } .pixmark > i:nth-child(7) { animation-delay: -1300ms }
.pixmark > i:nth-child(8) { animation-delay: -200ms } .pixmark > i:nth-child(9) { animation-delay: -900ms }
.pixmark.lamp > i { background: var(--lamp); }
@keyframes ds-twinkle { 0%, 100% { opacity: .18 } 50% { opacity: 1 } }
.shimmer {
  background: linear-gradient(100deg, var(--soft) 0%, var(--soft) 40%, var(--ink) 50%, var(--soft) 60%, var(--soft) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: ds-shimmer var(--t-shimmer) linear infinite;
}
@keyframes ds-shimmer { from { background-position: 125% 0 } to { background-position: -125% 0 } }
.spinner { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ring-strong); position: relative; flex: none; }
.spinner::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent); animation: ds-spin 700ms linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* ---------- fields ---------- */
.field { display: grid; gap: var(--space-8); min-width: 0; }
.field > label, .field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font: 500 13px/1.3 var(--font-display); color: var(--ink); }
.field small, .field-hint { margin: 0; font: 400 12.5px/1.45 var(--font-display); color: var(--soft); }
:where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"]), textarea, select).input,
.field :where(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, select),
.input {
  box-sizing: border-box; width: 100%; min-height: var(--control-h); padding: 0 var(--space-12);
  border: 0; border-radius: var(--radius-sm); background: var(--sunken); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ring), inset 0 1px 2px rgba(0, 0, 0, .06);
  font: 400 15px/1.4 var(--font-display); letter-spacing: -.005em;
  transition: box-shadow var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out);
  -webkit-appearance: none; appearance: none;
}
.field textarea, textarea.input { padding: 10px var(--space-12); resize: vertical; line-height: 1.55; min-height: 88px; }
.field select, select.input {
  padding-inline-end: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%), linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.field :is(input, textarea, select)::placeholder, .input::placeholder { color: var(--faint); }
@media (hover: hover) { .field :is(input, textarea, select):hover:not(:disabled):not(:focus), .input:hover:not(:disabled):not(:focus) { box-shadow: inset 0 0 0 1px var(--ring-strong); } }
.field :is(input, textarea, select):focus, .input:focus { background-color: var(--surface); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-tint); }
.field :is(input, textarea, select):disabled, .input:disabled { color: var(--faint); cursor: not-allowed; }
.field :is(input, textarea).mono, .input.mono { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0; }
.field.is-error :is(input, textarea, select), .input[aria-invalid="true"] { background-color: var(--danger-tint); box-shadow: inset 0 0 0 1px var(--danger); }
.field.is-error small { color: var(--danger); }
@media (max-width: 900px) { .field :is(input, select), .input { min-height: 44px; font-size: 16px; } }
.password-field { position: relative; display: flex; align-items: center; }
.password-field input { padding-inline-end: 46px; }
.password-field .icon-button { position: absolute; inset-inline-end: 4px; }

.check-label { display: inline-flex; align-items: center; gap: 10px; font: 400 14px/1.3 var(--font-display); color: var(--soft); cursor: pointer; -webkit-user-select: none; user-select: none; }
.check-label input[type="checkbox"], input[type="checkbox"].checkbox {
  -webkit-appearance: none; appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border-radius: 5px;
  background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring-strong); cursor: pointer; position: relative;
  transition: background-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out);
}
.check-label input[type="checkbox"]::after, input[type="checkbox"].checkbox::after {
  content: ""; position: absolute; left: 5.5px; top: 3.5px; width: 5px; height: 9px; border: solid var(--on-accent); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform var(--t-spring) var(--ease-spring);
}
.check-label input[type="checkbox"]:checked, input[type="checkbox"].checkbox:checked { background: var(--accent); box-shadow: none; }
.check-label input[type="checkbox"]:checked::after, input[type="checkbox"].checkbox:checked::after { transform: rotate(45deg) scale(1); }

/* Switch: a native checkbox restyled; state changes are announced natively. */
input[type="checkbox"].switch, .setting-row input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 38px; height: 22px; margin: 0;
  border-radius: var(--radius-pill); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring-strong); cursor: pointer;
  transition: background-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out);
}
input[type="checkbox"].switch::after, .setting-row input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ink); box-shadow: var(--shadow-thumb); transition: transform var(--t-spring) var(--ease-spring), background-color var(--t-hover);
}
:root[data-theme="light"] :is(input[type="checkbox"].switch, .setting-row input[type="checkbox"])::after { background: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) :is(input[type="checkbox"].switch, .setting-row input[type="checkbox"])::after { background: #fff; } }
:is(input[type="checkbox"].switch, .setting-row input[type="checkbox"]):checked { background: var(--accent); box-shadow: none; }
:is(input[type="checkbox"].switch, .setting-row input[type="checkbox"]):checked::after { transform: translateX(16px); background: var(--on-accent); }
:root[data-theme="light"] :is(input[type="checkbox"].switch, .setting-row input[type="checkbox"]):checked::after { background: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) :is(input[type="checkbox"].switch, .setting-row input[type="checkbox"]):checked::after { background: #fff; } }
:is(input[type="checkbox"].switch, .setting-row input[type="checkbox"]):active::after { width: 20px; }
:is(input[type="checkbox"].switch, .setting-row input[type="checkbox"]):checked:active::after { transform: translateX(12px); }
:is(input[type="checkbox"].switch, .setting-row input[type="checkbox"]):disabled { opacity: .5; cursor: not-allowed; }

/* Segmented control: radio inputs or buttons over a sliding thumb (--i / --n set by ds.js). */
.seg {
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; margin: 0; border: 0; min-width: 0;
  border-radius: calc(var(--radius-sm) + 3px); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring);
}
.seg > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.seg > label, .seg > button { position: relative; z-index: 1; display: grid; place-items: center; }
.seg > label > input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg > label > span, .seg > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 30px; padding: 0 12px; border: 0; background: none;
  border-radius: var(--radius-sm); font: 500 13px/1 var(--font-display); color: var(--soft); white-space: nowrap; cursor: pointer;
  transition: color var(--t-hover) var(--ease-out);
}
.seg > label > span .icon, .seg > button .icon { width: 15px; height: 15px; }
@media (hover: hover) { .seg > label:hover > span, .seg > button:hover { color: var(--ink); } }
.seg > label > input:checked + span, .seg > button[aria-pressed="true"] { color: var(--ink); }
.seg > label > input:focus-visible + span { box-shadow: var(--focus-halo); }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n, 3));
  transform: translateX(calc(100% * var(--i, 0))); border-radius: var(--radius-sm); background: var(--raised); box-shadow: var(--shadow-thumb);
  transition: transform var(--t-spring) var(--ease-spring);
}
.seg:not(.is-ready) .seg-thumb { transition: none; }

.search-field { position: relative; display: flex; align-items: center; min-width: 0; }
.search-field > .icon { position: absolute; inset-inline-start: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; transition: color var(--t-hover); }
.search-field input {
  width: 100%; height: 36px; padding: 0 12px 0 34px; border: 0; border-radius: var(--radius-sm); background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--ring); font: 400 14px/1 var(--font-display); color: var(--ink);
  transition: box-shadow var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out); -webkit-appearance: none; appearance: none;
}
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-field input::placeholder { color: var(--faint); }
.search-field input:focus { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-tint); }
.search-field input:focus ~ .icon, .search-field:focus-within > .icon { color: var(--accent); }
.search-field .kbd { position: absolute; inset-inline-end: 8px; pointer-events: none; transition: opacity var(--t-hover); }
.search-field:focus-within .kbd { opacity: 0; }
@media (max-width: 900px) { .search-field input { height: 42px; font-size: 16px; } }

/* OTP: one real input drives six visual cells (autofill and paste keep working). */
.otp { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-8); max-width: 360px; }
.otp > input {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; z-index: 2;
  font-size: 16px; caret-color: transparent; letter-spacing: 1em; cursor: text;
}
.otp-cell {
  position: relative; display: grid; place-items: center; height: 56px; border-radius: var(--radius-sm);
  background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring); font: 500 24px/1 var(--font-mono); color: var(--ink);
  transition: box-shadow var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out), transform var(--t-spring) var(--ease-spring);
}
.otp-cell.filled { animation: ds-cell var(--t-spring) var(--ease-bounce); }
.otp-cell.is-focus { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-tint); }
.otp-cell.is-focus::after { content: ""; width: 2px; height: 24px; background: var(--accent); animation: ds-caret 1s steps(1) infinite; }
.otp-cell:nth-of-type(4) { margin-inline-start: 10px; }
.otp.is-ok .otp-cell { background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-tint); color: var(--accent); }
.otp.is-error .otp-cell { background: var(--danger-tint); box-shadow: inset 0 0 0 1px var(--danger); animation: ds-shake 420ms var(--ease-standard); }
@keyframes ds-caret { 50% { opacity: 0; } }
@keyframes ds-cell { from { transform: scale(.86); } }
@keyframes ds-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* ---------- stepper ---------- */
.stepper { display: grid; grid-template-columns: repeat(var(--steps, 3), 1fr); gap: var(--space-8); list-style: none; margin: 0; padding: 0; }
.stepper li { display: grid; gap: var(--space-8); }
.stepper .bar { height: 3px; border-radius: var(--radius-pill); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring); overflow: hidden; }
.stepper .bar i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: inherit; transform: scaleX(0); transform-origin: left; transition: transform var(--t-reveal) var(--ease-out); }
.stepper li.done .bar i { transform: none; }
.stepper li.now .bar i { transform: scaleX(.5); }
.stepper .lbl { display: flex; align-items: center; gap: var(--space-6); font: 500 12.5px/1.2 var(--font-display); color: var(--faint); transition: color var(--t-hover); }
.stepper li.done .lbl, .stepper li.now .lbl { color: var(--ink); }
.stepper .n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--ring-strong); font: 500 10px/1 var(--font-mono); transition: background-color var(--t-hover), box-shadow var(--t-hover), color var(--t-hover); }
.stepper li.done .n { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.stepper li.now .n { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }

/* ---------- messages, banners, toasts ---------- */
.form-message { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); font: 400 13.5px/1.5 var(--font-display); background: var(--sunken); color: var(--soft); box-shadow: inset 0 0 0 1px var(--ring); }
.form-message.error { background: var(--danger-tint); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-tint); }
.form-message.success { background: var(--accent-tint); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-tint); }
.form-message:not([hidden]) { animation: ds-rise var(--t-spring) var(--ease-spring) both; }
.message-banner { display: flex; align-items: center; gap: var(--space-10); padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-ring); font: 400 13.5px/1.45 var(--font-display); color: var(--soft); }
.message-banner.error { background: var(--danger-tint); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-tint); }
.message-banner.success { background: var(--accent-tint); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-tint); }
.message-banner.warning { background: var(--lamp-tint); color: var(--lamp-ink); box-shadow: inset 0 0 0 1px var(--lamp-tint); }

.toast-region { position: fixed; z-index: var(--z-toast); inset-inline: 0; bottom: max(20px, env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  display: inline-flex; align-items: center; gap: var(--space-10); max-width: min(560px, 100%); min-height: 40px; padding: 6px 6px 6px 14px;
  border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow-float); pointer-events: auto;
  font: 400 14px/1.35 var(--font-display); color: var(--ink); animation: ds-pop var(--t-spring) var(--ease-spring) both;
}
.toast p { margin: 0; padding: 4px 0; }
.toast .toast-mark { width: 8px; height: 8px; border-radius: 2px; background: var(--soft); flex: none; }
.toast.success .toast-mark { background: var(--accent); }
.toast.error .toast-mark { background: var(--danger); }
.toast .icon-button { width: 28px; height: 28px; border-radius: var(--radius-pill); }
.toast.is-leaving { animation: ds-exit var(--t-exit) var(--ease-in) forwards; }

/* ---------- avatar ---------- */
.avatar {
  --av: 36px; position: relative; display: inline-grid; place-items: center; flex: none; width: var(--av); height: var(--av);
  border-radius: 50%; overflow: hidden; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring);
}
.avatar img { width: 100%; height: 100%; image-rendering: pixelated; filter: var(--avatar-filter); }
.avatar.avatar-agent { border-radius: 28%; }
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--ring); pointer-events: none; }
.avatar-sm { --av: 24px; }
.avatar-large { --av: 48px; }
.avatar-xl { --av: 72px; }
.avatar-xxl { --av: 96px; }

/* ---------- empty and skeleton ---------- */
.empty-state { display: grid; justify-items: center; gap: var(--space-10); padding: var(--space-48) var(--space-24); text-align: center; }
.empty-state .empty-art { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 6px; border-radius: var(--radius-md); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring); color: var(--soft); }
.empty-state .empty-art .icon { width: 26px; height: 26px; }
.empty-state h2 { font: 500 16px/1.35 var(--font-display); letter-spacing: -.01em; }
.empty-state p { max-width: 320px; font: 400 13.5px/1.55 var(--font-display); color: var(--soft); }
.empty-state .button { margin-top: 8px; }
.skeleton { display: block; border-radius: var(--radius-xs); background: linear-gradient(90deg, var(--sunken) 30%, var(--raised) 50%, var(--sunken) 70%); background-size: 300% 100%; animation: ds-skel 1600ms linear infinite; }
@keyframes ds-skel { from { background-position: 100% 0 } to { background-position: -100% 0 } }

/* ---------- dialogs (native <dialog>, modal) ---------- */
dialog {
  width: min(480px, calc(100vw - 32px)); max-width: none; max-height: min(86vh, 760px); padding: 0; border: 0; overflow: hidden;
  border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float);
}
dialog[open] { display: flex; flex-direction: column; animation: ds-dialog-in var(--t-sheet) var(--ease-spring) both; }
dialog.is-closing { animation: ds-dialog-out var(--t-exit) var(--ease-in) forwards; }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: ds-fade var(--t-hover) var(--ease-out) both; }
dialog.is-closing::backdrop { animation: ds-fade-out var(--t-exit) var(--ease-in) forwards; }
@keyframes ds-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes ds-dialog-out { to { opacity: 0; transform: scale(.96); } }
@keyframes ds-fade { from { opacity: 0; } }
@keyframes ds-fade-out { to { opacity: 0; } }
.dialog-form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; margin: 0; }
.dialog-heading {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--divider); background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.dialog-heading h2 { flex: 1; min-width: 0; font: 500 16px/1.3 var(--font-display); letter-spacing: -.01em; }
.dialog-body { display: grid; gap: var(--space-16); padding: 20px; overflow: auto; min-height: 0; }
.dialog-form > :not(.dialog-heading, .dialog-footer, .dialog-body) { margin-inline: 20px; }
.dialog-form > .dialog-heading + :not(.dialog-body) { margin-top: 20px; }
.dialog-form > :not(.dialog-heading, .dialog-footer) + :not(.dialog-footer) { margin-top: 16px; }
.dialog-form > :not(.dialog-heading):last-child:not(.dialog-footer) { margin-bottom: 20px; }
.dialog-description { font: 400 13.5px/1.55 var(--font-display); color: var(--soft); }
.dialog-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; padding: 14px 20px;
  border-top: 1px solid var(--divider); background: var(--sunken);
}
.dialog-footer .start { margin-inline-end: auto; }
.dialog-secondary-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 20px 16px; margin: 0 !important; background: var(--sunken); }
.dialog-footer + .dialog-secondary-actions { padding-top: 0; }
@media (max-width: 520px) {
  dialog { width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  dialog[open] { animation: ds-sheet-in var(--t-sheet) var(--ease-spring) both; }
  dialog.is-closing { animation: ds-sheet-out var(--t-exit) var(--ease-in) forwards; }
  .dialog-footer { flex-direction: column-reverse; align-items: stretch; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .dialog-footer .button { width: 100%; }
}
@keyframes ds-sheet-in { from { transform: translateY(100%); } }
@keyframes ds-sheet-out { to { transform: translateY(100%); } }

/* ---------- popover / menu ---------- */
.menu { min-width: 220px; padding: var(--space-6); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-float); }
.menu-item {
  display: flex; align-items: center; gap: var(--space-10); width: 100%; min-height: 36px; padding: 0 var(--space-10); border: 0; border-radius: var(--radius-xs);
  background: none; font: 400 14px/1 var(--font-display); color: var(--ink); text-align: start; cursor: pointer; text-decoration: none;
}
.menu-item .icon { color: var(--soft); width: 17px; height: 17px; }
.menu-item:hover, .menu-item[aria-selected="true"] { background: var(--raised); box-shadow: inset 0 0 0 1px var(--ring); }
.menu-item .menu-hint { margin-inline-start: auto; color: var(--faint); font: 400 12px/1 var(--font-mono); }

/* ---------- code ---------- */
.code {
  margin: 0; padding: 16px 18px; overflow: auto; border-radius: var(--radius-md); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--ring);
  font: 400 12.5px/1.75 var(--font-mono); color: var(--ink); tab-size: 2; white-space: pre;
}
.code .k { color: var(--code-key); } .code .s { color: var(--code-string); } .code .n { color: var(--code-number); } .code .c { color: var(--code-comment); }
.code .m { color: var(--accent); font-weight: 500; } .code .p { color: var(--soft); }
.method { display: inline-grid; place-items: center; min-width: 52px; height: 20px; padding: 0 6px; border-radius: 5px; font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em; color: var(--m, var(--soft)); background: color-mix(in srgb, var(--m, var(--soft)) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--m, var(--soft)) 22%, transparent); }
.method.get { --m: var(--method-get); } .method.post { --m: var(--method-post); } .method.put { --m: var(--method-put); } .method.patch { --m: var(--method-patch); } .method.delete { --m: var(--method-delete); }

/* ---------- motion primitives ---------- */
@keyframes ds-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes ds-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes ds-exit { to { opacity: 0; transform: scale(.96); } }
@keyframes ds-in-left { from { opacity: 0; transform: translateX(-12px); } }
@keyframes ds-in-right { from { opacity: 0; transform: translateX(16px); } }
@keyframes ds-badge { from { transform: scale(0); } }
.roll-cell { display: inline-block; height: 1.2em; height: 1lh; overflow: hidden; vertical-align: bottom; }
.roll-col { display: flex; flex-direction: column; }
.roll-col > span { display: block; height: 1.2em; height: 1lh; }
.rise-in { animation: ds-rise var(--t-reveal) var(--ease-spring) both; animation-delay: calc(var(--i, 0) * var(--t-stagger) + var(--delay, 0ms)); }
.pop-in { animation: ds-pop var(--t-spring) var(--ease-spring) both; animation-delay: calc(var(--i, 0) * var(--t-stagger)); }
/* Scroll reveal keeps content visible and only plays a short spring settle. */
.js [data-reveal] { transform: translateY(22px); opacity: .001; transition: transform 900ms var(--ease-settle), opacity 600ms var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.js [data-reveal].is-in { transform: none; opacity: 1; }
.js [data-reveal="fade"] { transform: none; }
.js [data-reveal="scale"] { transform: scale(.96); }
.js [data-reveal="scale"].is-in { transform: none; }

/* ---------- theme switch (View Transitions) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-transition::view-transition-new(root) { animation: ds-theme-reveal 720ms var(--ease-out) both; }
@keyframes ds-theme-reveal { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 50%)); } to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 50%) var(--vt-y, 50%)); } }
/* The toggle shows the effective theme: moon for Night, sun for Day. */
.theme-toggle { position: relative; }
.theme-toggle .icon { position: absolute; inset: 0; margin: auto; transition: transform var(--t-spring) var(--ease-spring), opacity var(--t-hover) var(--ease-out); }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
:root[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun { opacity: 1; transform: none; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { transform: none; opacity: 1; }
  .shimmer { background: none; color: var(--soft); }
}
