/*
 * SMTP Pro v3 — design system (owner: DESIGN)
 *
 * One stylesheet for the storefront, customer area, admin console, installer and offline page.
 * Class vocabulary: SPEC §7 · Handbook with markup examples: STYLEGUIDE.md
 *
 *  1. Fonts                      13. Pricing
 *  2. Tokens (light / dark)      14. Features, steps, compare, FAQ, CTA
 *  3. Base & reset               15. Footer
 *  4. Layout                     16. Auth
 *  5. Typography helpers         17. Customer area
 *  6. Icons & brand mark         18. Data display
 *  7. Buttons                    19. Support thread
 *  8. Forms                      20. Admin console
 *  9. Feedback                   21. Dialogs
 * 10. Cards                      22. Utilities
 * 11. Header & navigation        23. PWA, motion & print
 * 12. Hero & code window
 *
 * CSP: no external URLs; inline SVG data URIs only (img-src 'self' data:).
 */

/* =============================================================================================
 * 1. Fonts — Inter Variable (OFL, self-hosted)
 * ============================================================================================= */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght.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 Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght.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;
}

/* =============================================================================================
 * 2. Tokens
 * ============================================================================================= */

:root {
  color-scheme: light;

  /* Brand — overridden per store by index.php?page=theme */
  --brand: #4f46e5;
  --brand-contrast: #ffffff;
  --brand-text-light: #4f46e5;
  --brand-text-dark: #9e99f1;

  /* Neutrals (slate) */
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-raised: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #edf1f6;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #475569;
  --muted: #64748b;
  --faint: #94a3b8;
  --overlay: rgba(15, 23, 42, 0.48);
  --grid-line: rgba(15, 23, 42, 0.05);
  --soft-mix: 9%;
  --glow-mix: 36%;

  /* Status */
  --success: #059669;
  --success-text: #047857;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #d97706;
  --warning-text: #b45309;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info: #0284c7;
  --info-text: #0369a1;
  --info-soft: #f0f9ff;
  --info-border: #bae6fd;
  --neutral-soft: #f1f5f9;
  --neutral-text: #475569;
  --neutral-border: #e2e8f0;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 14px 28px -8px rgba(15, 23, 42, 0.14), 0 4px 10px -4px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 28px 56px -16px rgba(15, 23, 42, 0.24), 0 8px 16px -8px rgba(15, 23, 42, 0.08);

  /* Typography */
  --font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: clamp(1.625rem, 1.3rem + 1.4vw, 2.25rem);
  --fs-4xl: clamp(1.875rem, 1.35rem + 2.3vw, 2.875rem);
  --fs-5xl: clamp(2.375rem, 1.45rem + 4.2vw, 4.25rem);

  /* Space, radius, layout */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 999px;
  --container: 1200px;
  --container-narrow: 760px;
  --container-wide: 1400px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;
  --sidebar-w: 264px;
  --admin-pad: clamp(1rem, 3vw, 2rem);

  /* Motion & layers */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --z-header: 40;
  --z-drawer: 60;
  --z-toast: 90;

  /* Inline icon masks / images (data URIs are allowed by img-src 'self' data:) */
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --i-check-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E");
  --i-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
  --i-check-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --i-x-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
  --i-minus-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}

/* Brand-derived tokens. Re-declared on [data-brand-preview] so a live colour preview recomputes them. */
:root,
[data-brand-preview] {
  --accent: color-mix(in oklab, var(--brand) 62%, #c026d3);
  --brand-hover: color-mix(in oklab, var(--brand) 86%, #000);
  --brand-active: color-mix(in oklab, var(--brand) 76%, #000);
  --brand-soft: color-mix(in oklab, var(--brand) var(--soft-mix), var(--surface));
  --brand-softer: color-mix(in oklab, var(--brand) 4%, var(--surface));
  --brand-border: color-mix(in oklab, var(--brand) 30%, var(--border));
  --brand-ring: color-mix(in oklab, var(--brand) 45%, transparent);
  --brand-ring-soft: color-mix(in oklab, var(--brand) 20%, transparent);
  --brand-glow: color-mix(in oklab, var(--brand) var(--glow-mix), transparent);
  --brand-grad: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  --brand-text: var(--brand-text-light);
  --focus: var(--brand);
}

@supports (color: oklch(from red l c h)) {
  :root,
  [data-brand-preview] {
    --accent: oklch(from var(--brand) calc(l + 0.03) c calc(h + 38));
  }
}

@supports not (color: color-mix(in srgb, red, blue)) {
  :root {
    --accent: #7c3aed;
    --brand-hover: #4338ca;
    --brand-active: #3730a3;
    --brand-soft: #eef2ff;
    --brand-softer: #f5f7ff;
    --brand-border: #c7d2fe;
    --brand-ring: rgba(79, 70, 229, 0.45);
    --brand-ring-soft: rgba(79, 70, 229, 0.2);
    --brand-glow: rgba(79, 70, 229, 0.36);
  }
}

/* Dark theme tokens: explicit [data-theme=dark] and OS preference when no theme is set. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b16;
  --bg-subtle: #0a0f1d;
  --bg-muted: #0e1424;
  --surface: #0f1629;
  --surface-2: #131b31;
  --surface-3: #1a2440;
  --surface-raised: #151e36;
  --border: rgba(148, 163, 184, 0.15);
  --border-subtle: rgba(148, 163, 184, 0.09);
  --border-strong: rgba(148, 163, 184, 0.27);
  --text: #eef2f8;
  --text-2: #c9d1e0;
  --text-3: #aab4c6;
  --muted: #8c97ab;
  --faint: #5e687d;
  --overlay: rgba(2, 6, 17, 0.72);
  --grid-line: rgba(148, 163, 184, 0.07);
  --soft-mix: 16%;
  --glow-mix: 45%;
  --success: #10b981;
  --success-text: #34d399;
  --success-soft: rgba(16, 185, 129, 0.12);
  --success-border: rgba(52, 211, 153, 0.28);
  --warning: #f59e0b;
  --warning-text: #fbbf24;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(251, 191, 36, 0.3);
  --danger: #ef4444;
  --danger-text: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(248, 113, 113, 0.3);
  --info: #0ea5e9;
  --info-text: #38bdf8;
  --info-soft: rgba(14, 165, 233, 0.12);
  --info-border: rgba(56, 189, 248, 0.28);
  --neutral-soft: rgba(148, 163, 184, 0.12);
  --neutral-text: #cbd5e1;
  --neutral-border: rgba(148, 163, 184, 0.22);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 12px -4px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 32px -10px rgba(0, 0, 0, 0.6), 0 4px 10px -4px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 30px 60px -18px rgba(0, 0, 0, 0.7), 0 8px 16px -8px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"],
:root[data-theme="dark"] [data-brand-preview] {
  --brand-text: var(--brand-text-dark);
  --focus: var(--brand-text-dark);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #070b16;
    --bg-subtle: #0a0f1d;
    --bg-muted: #0e1424;
    --surface: #0f1629;
    --surface-2: #131b31;
    --surface-3: #1a2440;
    --surface-raised: #151e36;
    --border: rgba(148, 163, 184, 0.15);
    --border-subtle: rgba(148, 163, 184, 0.09);
    --border-strong: rgba(148, 163, 184, 0.27);
    --text: #eef2f8;
    --text-2: #c9d1e0;
    --text-3: #aab4c6;
    --muted: #8c97ab;
    --faint: #5e687d;
    --overlay: rgba(2, 6, 17, 0.72);
    --grid-line: rgba(148, 163, 184, 0.07);
    --soft-mix: 16%;
    --glow-mix: 45%;
    --success: #10b981;
    --success-text: #34d399;
    --success-soft: rgba(16, 185, 129, 0.12);
    --success-border: rgba(52, 211, 153, 0.28);
    --warning: #f59e0b;
    --warning-text: #fbbf24;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(251, 191, 36, 0.3);
    --danger: #ef4444;
    --danger-text: #f87171;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --danger-border: rgba(248, 113, 113, 0.3);
    --info: #0ea5e9;
    --info-text: #38bdf8;
    --info-soft: rgba(14, 165, 233, 0.12);
    --info-border: rgba(56, 189, 248, 0.28);
    --neutral-soft: rgba(148, 163, 184, 0.12);
    --neutral-text: #cbd5e1;
    --neutral-border: rgba(148, 163, 184, 0.22);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 12px -4px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 32px -10px rgba(0, 0, 0, 0.6), 0 4px 10px -4px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 30px 60px -18px rgba(0, 0, 0, 0.7), 0 8px 16px -8px rgba(0, 0, 0, 0.4);
  }

  :root:not([data-theme]),
  :root:not([data-theme]) [data-brand-preview] {
    --brand-text: var(--brand-text-dark);
    --focus: var(--brand-text-dark);
  }
}

/* =============================================================================================
 * 3. Base & reset
 * ============================================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  tab-size: 4;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

body.site {
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.5em;
  color: var(--text);
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-4xl);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--fs-3xl);
  letter-spacing: -0.025em;
}

h3 {
  font-size: var(--fs-xl);
}

h4 {
  font-size: var(--fs-lg);
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

a {
  color: var(--brand-text);
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-1) var(--ease), text-decoration-color var(--dur-1) var(--ease);
}

a:hover {
  text-decoration-color: currentColor;
}

strong,
b {
  font-weight: 650;
}

small {
  font-size: 0.8125rem;
}

img,
video {
  max-width: 100%;
  height: auto;
}

svg {
  flex-shrink: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

:not(pre) > code {
  padding: 0.125em 0.375em;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  overflow-wrap: anywhere;
  /* A long value (order id, hostname) that wraps keeps one tidy chip per line. */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 0.35em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

hr {
  height: 1px;
  margin: 1.5rem 0;
  border: 0;
  background: var(--border);
}

table {
  border-collapse: collapse;
}

dialog {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in oklab, var(--brand) 24%, transparent);
  color: inherit;
}

/* =============================================================================================
 * 4. 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(var(--container-wide) + var(--gutter) * 2);
}

.site-main {
  flex: 1 0 auto;
  display: block;
  outline: none;
}

.page {
  padding-block: clamp(1.75rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem);
}

.section {
  position: relative;
  padding-block: clamp(3.5rem, 7vw, 6rem);
}

.section--tight {
  padding-block: clamp(2rem, 4vw, 3rem);
}

.section--alt {
  background: var(--bg-subtle);
  border-block: 1px solid var(--border-subtle);
}

.section-head {
  max-width: 44rem;
  margin: 0 auto clamp(2rem, 4vw, 3.25rem);
  text-align: center;
}

.section-head h2 {
  margin: 0.75rem 0 0;
  font-size: var(--fs-4xl);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.section-head p:not(.eyebrow) {
  margin: 1rem auto 0;
  max-width: 38rem;
  color: var(--text-3);
  font-size: 1.0625rem;
}

.section-head--left {
  margin-left: 0;
  text-align: left;
}

.section-head--left p:not(.eyebrow) {
  margin-left: 0;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stack > * {
  margin-block: 0;
}

.stack > :not(:first-child) {
  margin-top: 1rem;
}

.stack--sm > :not(:first-child) {
  margin-top: 0.5rem;
}

.stack--lg > :not(:first-child) {
  margin-top: 2rem;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.cluster--end {
  justify-content: flex-end;
}

.cluster--center {
  justify-content: center;
}

.cluster--between {
  justify-content: space-between;
}

.cluster--sm {
  gap: 0.375rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* Grid items default to min-width:auto, so a <pre>, a code chip or a nowrap row would widen the
   column past a phone screen. */
.split > * {
  min-width: 0;
}

@media (min-width: 960px) {
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
  }

  .split--main {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  }

  .split--sidebar {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  }

  .split--center {
    align-items: center;
  }
}

.sticky-aside {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
}

/* =============================================================================================
 * 5. Typography helpers
 * ============================================================================================= */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-text);
}

.eyebrow .icon {
  width: 16px;
  height: 16px;
}

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.65;
  color: var(--text-3);
}

.muted {
  color: var(--muted);
}

.fine {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

.center {
  text-align: center;
}

.text-gradient {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.prose {
  max-width: 72ch;
  color: var(--text-2);
  line-height: 1.75;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.divider {
  height: 1px;
  margin: 1.5rem 0;
  border: 0;
  background: var(--border);
}

.divider--text {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  height: auto;
  background: none;
  color: var(--muted);
  font-size: 0.8125rem;
}

.divider--text::before,
.divider--text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* =============================================================================================
 * 6. Icons & brand mark
 * ============================================================================================= */

.icon {
  display: inline-block;
  flex: none;
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.25em;
  stroke-width: 2;
}

.icon--sm {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
}

.icon--lg {
  width: 1.5em;
  height: 1.5em;
}

.mark .mark__stop-a {
  stop-color: color-mix(in oklab, var(--brand) 82%, #fff);
}

.mark .mark__stop-b {
  stop-color: color-mix(in oklab, var(--accent) 88%, #000);
}

.mark .mark__env {
  fill: #fff;
}

.mark .mark__flap {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark .mark__spark {
  fill: #fff;
  opacity: 0.94;
}

/* =============================================================================================
 * 7. Buttons
 * ============================================================================================= */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  --btn-hover-bg: var(--surface-2);
  --btn-hover-fg: var(--btn-fg);
  --btn-shadow: var(--shadow-xs);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--btn-shadow);
  font-size: 0.9375rem;
  font-weight: 560;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
    color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}

.btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-fg);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn .icon {
  width: 1.125em;
  height: 1.125em;
  vertical-align: 0;
}

.btn__icon-after {
  transition: transform var(--dur-2) var(--ease);
}

.btn:hover .btn__icon-after {
  transform: translateX(2px);
}

.btn--primary {
  --btn-bg: var(--brand);
  --btn-fg: var(--brand-contrast);
  --btn-border: transparent;
  --btn-hover-bg: var(--brand-hover);
  --btn-shadow: 0 1px 2px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 6px 16px -6px var(--brand-glow);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
}

.btn--primary:hover {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 10px 24px -8px var(--brand-glow);
}

.btn--secondary {
  --btn-bg: var(--surface-raised);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  --btn-hover-bg: var(--surface-2);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-2);
  --btn-border: transparent;
  --btn-hover-bg: var(--surface-3);
  --btn-hover-fg: var(--text);
  --btn-shadow: none;
}

.btn--danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-border: transparent;
  --btn-hover-bg: color-mix(in oklab, var(--danger) 86%, #000);
  --btn-shadow: 0 1px 2px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn--success {
  --btn-bg: var(--success);
  --btn-fg: #fff;
  --btn-border: transparent;
  --btn-hover-bg: color-mix(in oklab, var(--success) 86%, #000);
  --btn-shadow: 0 1px 2px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn--sm {
  min-height: 32px;
  padding: 0 0.75rem;
  gap: 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.btn--lg {
  min-height: 48px;
  padding: 0 1.375rem;
  border-radius: var(--radius);
  font-size: 1rem;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--icon {
  width: 40px;
  padding: 0;
}

.btn--icon.btn--sm {
  width: 32px;
}

.btn--icon.btn--lg {
  width: 48px;
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  pointer-events: none;
}

.btn.is-loading,
.link-btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading > *,
.link-btn.is-loading > * {
  visibility: hidden;
}

.btn.is-loading::after,
.link-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 1.1em;
  height: 1.1em;
  margin: auto;
  border: 2px solid var(--btn-fg, var(--brand));
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.is-copied {
  --btn-fg: var(--success-text);
  --btn-hover-fg: var(--success-text);
}

.link-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-text);
  font-weight: 560;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.18em;
  cursor: pointer;
  transition: text-decoration-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.link-btn:hover {
  text-decoration-color: currentColor;
}

.link-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================================================================
 * 8. Forms
 * ============================================================================================= */

.form {
  display: grid;
  gap: 1.125rem;
  margin: 0;
}

.field {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  min-width: 0;
}

.field__label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 580;
  color: var(--text);
}

.field__optional {
  padding: 0.0625rem 0.4375rem;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 560;
}

.field__control,
.search-input input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0.5625rem 0.8125rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-size: 0.9375rem;
  line-height: 1.45;
  appearance: none;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-1);
}

/* Placeholders sometimes carry the only hint for a field, so they meet text contrast (4.5:1). */
.field__control::placeholder,
.search-input input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field__control:hover {
  border-color: color-mix(in oklab, var(--border-strong) 65%, var(--text) 18%);
}

.field__control:focus,
.search-input input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring-soft);
}

.field__control:user-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--danger) 16%, transparent);
}

.field__control[readonly] {
  background: var(--surface-2);
}

.field__control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--surface-2);
}

textarea.field__control {
  min-height: 6.5rem;
  line-height: 1.6;
  resize: vertical;
}

.field__control.mono {
  font-size: 0.8125rem;
}

input[type="number"].field__control {
  font-variant-numeric: tabular-nums;
}

.field__select {
  position: relative;
}

.field__select select {
  padding-right: 2.5rem;
  cursor: pointer;
}

.field__select-icon {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.field__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.field__hint {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.char-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.char-count.is-near {
  color: var(--warning-text);
}

.char-count.is-over {
  color: var(--danger-text);
  font-weight: 600;
}

.input-affix {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.input-affix:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring-soft);
}

.input-affix .field__control {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
}

.input-affix .field__control:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-affix__text {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.input-affix__text:first-child {
  border-right: 1px solid var(--border);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-affix__text:not(:first-child) {
  border-left: 1px solid var(--border);
}

.input-affix__text:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-affix--toggle .field__control {
  padding-right: 0.25rem;
}

.password-toggle {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  padding: 0;
  border: 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease);
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle:focus-visible {
  outline-offset: -3px;
}

.password-toggle .icon {
  width: 18px;
  height: 18px;
}

.password-toggle__hide,
.password-toggle[aria-pressed="true"] .password-toggle__show {
  display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle__hide {
  display: inline-block;
}

.form-grid {
  display: grid;
  gap: 1.125rem 1.25rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .form-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.form-grid > .span-full,
.form-grid > .fieldset,
.form-grid > .form-actions {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.45;
  cursor: pointer;
}

.check__input {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0.0625rem 0 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface) center / 14px no-repeat;
  box-shadow: var(--shadow-xs);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}

.check__input:hover {
  border-color: var(--brand);
}

.check__input:checked {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: var(--i-check-white);
}

.check__input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--brand-ring-soft);
  border-color: var(--brand);
}

.check__input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.check__body {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.check__label {
  color: var(--text);
}

.check__hint {
  font-size: 0.8125rem;
  color: var(--muted);
}

.switch {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}

.switch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.switch__track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  margin-top: 0.0625rem;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: background-color var(--dur-2) var(--ease);
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3), 0 1px 1px rgba(15, 23, 42, 0.08);
  transition: transform var(--dur-2) var(--ease-out);
}

.switch__input:checked + .switch__track {
  background: var(--brand);
}

.switch__input:checked + .switch__track .switch__thumb {
  transform: translateX(16px);
}

.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.switch__input:disabled + .switch__track {
  opacity: 0.5;
}

.switch:has(.switch__input:disabled) {
  cursor: not-allowed;
}

.switch__body {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.switch__label {
  font-size: 0.9375rem;
  font-weight: 560;
  color: var(--text);
}

.switch__hint {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.form-actions {
  position: sticky;
  bottom: -1px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding: 0.875rem 0 calc(0.875rem + 1px);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface);
  transition: box-shadow var(--dur-2) var(--ease);
}

.form-actions.is-stuck {
  box-shadow: 0 -12px 24px -16px rgba(15, 23, 42, 0.3);
}

.form-actions__note {
  margin: 0 auto 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

@media (max-width: 639.98px) {
  .form-actions.is-stuck .form-actions__note {
    display: none;
  }
}

.fieldset {
  min-width: 0;
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fieldset > legend {
  padding: 0 0.375rem;
  font-size: 0.875rem;
  font-weight: 620;
  color: var(--text);
}

.fieldset > .fieldset__body,
.fieldset > .form-grid {
  margin-top: 0.25rem;
}

.upload {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.375rem;
  padding: 1.5rem 1rem;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}

.upload:hover,
.upload.is-dragover {
  border-color: var(--brand);
  background: var(--brand-softer);
}

.upload:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring-soft);
}

.upload__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--brand-text);
  box-shadow: var(--shadow-sm);
}

.upload__text {
  font-size: 0.875rem;
  color: var(--text-2);
}

.upload__text strong {
  color: var(--brand-text);
  font-weight: 620;
}

.upload__hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.upload__name {
  max-width: 100%;
  padding: 0.125rem 0.625rem;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 0.8125rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload__name:empty {
  display: none;
}

.color-field {
  gap: 0.625rem;
}

.color-field__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-field__picker {
  flex: none;
  width: 46px;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.color-field__picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-field__picker::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.color-field__picker::-moz-color-swatch {
  border: 0;
  border-radius: 6px;
}

.color-field__hex {
  max-width: 10rem;
  text-transform: lowercase;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch.is-active {
  box-shadow: 0 0 0 2px var(--text);
}

.swatch--indigo { background: #4f46e5; }
.swatch--violet { background: #7c3aed; }
.swatch--fuchsia { background: #c026d3; }
.swatch--pink { background: #db2777; }
.swatch--rose { background: #e11d48; }
.swatch--orange { background: #ea580c; }
.swatch--amber { background: #d97706; }
.swatch--green { background: #16a34a; }
.swatch--emerald { background: #059669; }
.swatch--teal { background: #0d9488; }
.swatch--cyan { background: #0891b2; }
.swatch--sky { background: #0284c7; }
.swatch--blue { background: #2563eb; }
.swatch--slate { background: #334155; }

/* Radio "segment" cards ([data-segment] group) */
.segment {
  display: grid;
  gap: 0.625rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}

.segment__item {
  position: relative;
  display: grid;
  gap: 0.125rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-1);
}

.segment__item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment__item:hover {
  border-color: var(--brand-border);
}

.segment__item.is-selected,
.segment__item:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-softer);
  box-shadow: 0 0 0 3px var(--brand-ring-soft);
}

.segment__item:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.segment__title {
  font-weight: 620;
  font-size: 0.9375rem;
}

.segment__meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* =============================================================================================
 * 9. Feedback — alerts, badges, toasts, spinners, empty states
 * ============================================================================================= */

.alert {
  --alert-bg: var(--info-soft);
  --alert-border: var(--info-border);
  --alert-icon: var(--info);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--alert-border);
  border-radius: var(--radius);
  background: var(--alert-bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.5;
  transition: opacity var(--dur-3) var(--ease), transform var(--dur-3) var(--ease);
}

.alert__icon {
  display: flex;
  flex: none;
  margin-top: 0.0625rem;
  color: var(--alert-icon);
}

.alert__icon .icon {
  width: 20px;
  height: 20px;
}

.alert__body {
  display: grid;
  flex: 1;
  gap: 0.25rem;
  min-width: 0;
}

.alert__body > * {
  margin: 0;
}

.alert__title {
  font-weight: 650;
  color: var(--text);
}

.alert__text {
  color: var(--text-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.alert__close {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -0.25rem -0.375rem -0.25rem 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.alert__close:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
}

.alert--success {
  --alert-bg: var(--success-soft);
  --alert-border: var(--success-border);
  --alert-icon: var(--success);
}

.alert--error {
  --alert-bg: var(--danger-soft);
  --alert-border: var(--danger-border);
  --alert-icon: var(--danger);
}

.alert--warning {
  --alert-bg: var(--warning-soft);
  --alert-border: var(--warning-border);
  --alert-icon: var(--warning);
}

.alert--info {
  --alert-bg: var(--info-soft);
  --alert-border: var(--info-border);
  --alert-icon: var(--info);
}

.alert--flash {
  box-shadow: var(--shadow-sm);
  animation: slide-down var(--dur-3) var(--ease-out);
}

.alert.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
}

.badge {
  --badge-bg: var(--neutral-soft);
  --badge-fg: var(--neutral-text);
  --badge-border: var(--neutral-border);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 22px;
  padding: 0 0.5rem;
  border: 1px solid var(--badge-border);
  border-radius: var(--radius-full);
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.005em;
  white-space: nowrap;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.badge .icon {
  width: 12px;
  height: 12px;
}

.badge .dot {
  width: 6px;
  height: 6px;
}

.badge--success {
  --badge-bg: var(--success-soft);
  --badge-fg: var(--success-text);
  --badge-border: var(--success-border);
}

.badge--warning {
  --badge-bg: var(--warning-soft);
  --badge-fg: var(--warning-text);
  --badge-border: var(--warning-border);
}

.badge--danger {
  --badge-bg: var(--danger-soft);
  --badge-fg: var(--danger-text);
  --badge-border: var(--danger-border);
}

.badge--info {
  --badge-bg: var(--info-soft);
  --badge-fg: var(--info-text);
  --badge-border: var(--info-border);
}

.badge--neutral {
  --badge-bg: var(--neutral-soft);
  --badge-fg: var(--neutral-text);
  --badge-border: var(--neutral-border);
}

.badge--brand {
  --badge-bg: var(--brand-soft);
  --badge-fg: var(--brand-text);
  --badge-border: var(--brand-border);
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.badge[data-status="check"] .dot,
.badge[data-status="process"] .dot,
.badge[data-status="confirm_check"] .dot,
.badge[data-status="creating"] .dot,
.badge[data-status="refund_process"] .dot {
  animation: pulse-dot 1.8s var(--ease) infinite;
}

.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 0.5rem;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

@media (min-width: 640px) {
  .toast-region {
    left: auto;
    right: 24px;
    bottom: 24px;
    transform: none;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius);
  background: #0f172a;
  color: #f8fafc;
  box-shadow: var(--shadow-xl);
  font-size: 0.875rem;
  font-weight: 520;
  pointer-events: auto;
  animation: toast-in var(--dur-3) var(--ease-out);
}

.toast .icon {
  color: #34d399;
}

.toast--error .icon {
  color: #f87171;
}

.toast--info .icon {
  color: #7dd3fc;
}

.toast.is-leaving {
  animation: toast-out var(--dur-2) var(--ease) forwards;
}

.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 0.7s linear infinite;
}

.spinner--lg {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
}

.skeleton {
  display: block;
  min-height: 1em;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  text-align: center;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 0.25rem;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-text);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.empty-state__icon .icon {
  width: 24px;
  height: 24px;
}

.empty-state__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
}

.empty-state__text {
  max-width: 40ch;
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.empty-state__action {
  margin-top: 0.75rem;
}

.card .empty-state {
  border: 0;
  background: transparent;
}

/* =============================================================================================
 * 10. Cards
 * ============================================================================================= */

.card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card__head:last-child {
  border-bottom: 0;
}

.card__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.card__title .icon {
  color: var(--muted);
}

.card__sub {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.card__body {
  padding: 1.25rem;
}

.card__body--flush {
  padding: 0;
}

.card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
  background: var(--surface-2);
}

@media (min-width: 640px) {
  .card__head,
  .card__body,
  .card__foot {
    padding-inline: 1.5rem;
  }

  .card__body--flush {
    padding: 0;
  }
}

.card > .table-wrap,
.card__body--flush > .table-wrap {
  border: 0;
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
  box-shadow: none;
}

.card .form-actions {
  margin-inline: -1.25rem;
  padding-inline: 1.25rem;
}

@media (min-width: 640px) {
  .card .form-actions {
    margin-inline: -1.5rem;
    padding-inline: 1.5rem;
  }
}

.card .form-actions:last-child {
  margin-bottom: -1.25rem;
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
}

.card--flat {
  background: var(--surface-2);
  box-shadow: none;
}

.card--hover {
  transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease), border-color var(--dur-2);
}

.card--hover:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.card--glow {
  border-color: var(--brand-border);
  box-shadow: 0 0 0 1px var(--brand-border), 0 22px 50px -26px var(--brand-glow);
  overflow: hidden;
}

.card--glow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 70% at 50% 0%, color-mix(in oklab, var(--brand) 8%, transparent), transparent 60%);
  pointer-events: none;
}

.card--glow > * {
  position: relative;
}

/* =============================================================================================
 * 11. Header & navigation
 * ============================================================================================= */

.skip-link {
  position: absolute;
  top: -120px;
  left: 1rem;
  z-index: 100;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: var(--brand-contrast);
  font-weight: 620;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top var(--dur-2) var(--ease);
}

.skip-link:focus {
  top: 1rem;
}

.announce {
  --announce-bg: color-mix(in oklab, var(--brand) 7%, var(--bg));
  --announce-fg: var(--text);
  --announce-border: var(--border-subtle);
  --announce-link: var(--brand-text);
  position: relative;
  z-index: calc(var(--z-header) + 1);
  border-bottom: 1px solid var(--announce-border);
  background: var(--announce-bg);
  color: var(--announce-fg);
  font-size: 0.875rem;
}

.announce__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.375rem 0.75rem;
  min-height: 40px;
  padding-block: 0.5rem;
  text-align: center;
}

.announce__icon {
  display: inline-flex;
  opacity: 0.9;
}

.announce__text {
  margin: 0;
  font-weight: 520;
}

.announce__link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--announce-link);
  font-weight: 650;
  text-decoration: none;
}

.announce__link:hover {
  text-decoration: underline;
}

.announce__link .icon {
  transition: transform var(--dur-2) var(--ease);
}

.announce__link:hover .icon {
  transform: translateX(2px);
}

.announce--info {
  --announce-bg: color-mix(in oklab, var(--brand) 7%, var(--bg));
  --announce-fg: var(--text);
  --announce-link: var(--brand-text);
  --announce-border: var(--border-subtle);
}

.announce--promo {
  --announce-bg: var(--brand-grad);
  --announce-fg: var(--brand-contrast);
  --announce-link: var(--brand-contrast);
  --announce-border: transparent;
}

.announce--promo .announce__link {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

.announce--warning {
  --announce-bg: var(--warning-soft);
  --announce-fg: var(--warning-text);
  --announce-link: var(--warning-text);
  --announce-border: var(--warning-border);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(14px);
  backdrop-filter: saturate(1.8) blur(14px);
  transition: box-shadow var(--dur-3) var(--ease), background var(--dur-3) var(--ease);
}

.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.28);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header {
    background: var(--bg);
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 720;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: 0 4px 12px -4px var(--brand-glow);
  object-fit: cover;
}

.brand__logo {
  display: block;
  width: auto;
  height: 32px;
  max-width: 180px;
  object-fit: contain;
}

.brand__name {
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: none;
}

@media (min-width: 1024px) {
  .nav {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.125rem;
    min-width: 0;
    margin-left: 0.5rem;
  }

  /* The links. With JavaScript nothing is ever clipped here (app.js switches to the drawer first);
     the sideways scroll is only the no-JS fallback. The Tools dropdown sits outside this box. */
  .nav__list {
    position: relative;
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 0.125rem;
    min-width: 0;
    padding: 6px 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav__list::-webkit-scrollbar {
    display: none;
  }

  /* Without JavaScript the drawer cannot open, so an overflowing nav shows its scrollbar. */
  .no-js .nav__list {
    scrollbar-width: thin;
  }

  .no-js .nav__list::-webkit-scrollbar {
    display: block;
    height: 4px;
  }

  /* Too many items for this width (app.js measures): use the drawer, which lists every link. */
  .nav-compact .nav {
    display: none;
  }
}

/* A header with many links uses the wide container, so large screens keep the full nav
   (site-header--wide from PHP's estimate, html.nav-wide from app.js's measurement). */
.site-header--wide .site-header__inner,
.nav-wide .site-header__inner {
  max-width: calc(var(--container-wide) + var(--gutter) * 2);
}

/*
 * First paint of a full header. ui_header_layout() estimates the width the desktop nav needs and
 * sets site-header--bp-NNNN; below that width the drawer is used until app.js has measured the
 * real header (it then sets html.nav-fit or html.nav-compact). Without JavaScript the nav always
 * shows (the drawer needs JavaScript).
 */
@media (min-width: 1024px) and (max-width: 1151.98px) {
  :root.js:not(.nav-fit) .site-header--bp-1152 .nav {
    display: none;
  }

  :root.js:not(.nav-fit) .site-header--bp-1152 .nav-toggle {
    display: inline-grid;
  }

  :root.js:not(.nav-fit) .site-header--bp-1152 .header-actions__dash {
    display: inline-flex;
  }

  :root.js:not(.nav-fit) .site-header--bp-1152 .header-actions__install {
    display: none !important;
  }

  :root.js:not(.nav-fit) .site-header--bp-1152 ~ .mobile-nav {
    display: block;
  }
}

@media (min-width: 1024px) and (max-width: 1279.98px) {
  :root.js:not(.nav-fit) .site-header--bp-1280 .nav {
    display: none;
  }

  :root.js:not(.nav-fit) .site-header--bp-1280 .nav-toggle {
    display: inline-grid;
  }

  :root.js:not(.nav-fit) .site-header--bp-1280 .header-actions__dash {
    display: inline-flex;
  }

  :root.js:not(.nav-fit) .site-header--bp-1280 .header-actions__install {
    display: none !important;
  }

  :root.js:not(.nav-fit) .site-header--bp-1280 ~ .mobile-nav {
    display: block;
  }
}

@media (min-width: 1024px) and (max-width: 1365.98px) {
  :root.js:not(.nav-fit) .site-header--bp-1366 .nav {
    display: none;
  }

  :root.js:not(.nav-fit) .site-header--bp-1366 .nav-toggle {
    display: inline-grid;
  }

  :root.js:not(.nav-fit) .site-header--bp-1366 .header-actions__dash {
    display: inline-flex;
  }

  :root.js:not(.nav-fit) .site-header--bp-1366 .header-actions__install {
    display: none !important;
  }

  :root.js:not(.nav-fit) .site-header--bp-1366 ~ .mobile-nav {
    display: block;
  }
}

@media (min-width: 1024px) and (max-width: 1439.98px) {
  :root.js:not(.nav-fit) .site-header--bp-1440 .nav {
    display: none;
  }

  :root.js:not(.nav-fit) .site-header--bp-1440 .nav-toggle {
    display: inline-grid;
  }

  :root.js:not(.nav-fit) .site-header--bp-1440 .header-actions__dash {
    display: inline-flex;
  }

  :root.js:not(.nav-fit) .site-header--bp-1440 .header-actions__install {
    display: none !important;
  }

  :root.js:not(.nav-fit) .site-header--bp-1440 ~ .mobile-nav {
    display: block;
  }
}

@media (min-width: 1024px) and (max-width: 1535.98px) {
  :root.js:not(.nav-fit) .site-header--bp-1536 .nav {
    display: none;
  }

  :root.js:not(.nav-fit) .site-header--bp-1536 .nav-toggle {
    display: inline-grid;
  }

  :root.js:not(.nav-fit) .site-header--bp-1536 .header-actions__dash {
    display: inline-flex;
  }

  :root.js:not(.nav-fit) .site-header--bp-1536 .header-actions__install {
    display: none !important;
  }

  :root.js:not(.nav-fit) .site-header--bp-1536 ~ .mobile-nav {
    display: block;
  }
}

@media (min-width: 1024px) {
  :root.js:not(.nav-fit) .site-header--bp-none .nav {
    display: none;
  }

  :root.js:not(.nav-fit) .site-header--bp-none .nav-toggle {
    display: inline-grid;
  }

  :root.js:not(.nav-fit) .site-header--bp-none .header-actions__dash {
    display: inline-flex;
  }

  :root.js:not(.nav-fit) .site-header--bp-none .header-actions__install {
    display: none !important;
  }

  :root.js:not(.nav-fit) .site-header--bp-none ~ .mobile-nav {
    display: block;
  }
}

.nav__link {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.375rem;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: 0.9375rem;
  font-weight: 540;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), border-color var(--dur-1),
    box-shadow var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}

.nav__link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav__link.is-active {
  color: var(--text);
  font-weight: 600;
}

.nav__list > .nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.nav__icon {
  width: 16px;
  height: 16px;
}

.nav__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav__link--button {
  height: 34px;
  margin-inline: 0.25rem;
  padding: 0 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.nav__link--button:hover {
  border-color: var(--brand-border);
  background: var(--brand-softer);
  color: var(--brand-text);
}

.nav__link--highlight {
  height: 34px;
  margin-inline: 0.25rem;
  padding: 0 0.9375rem;
  border-radius: var(--radius-full);
  background: var(--brand) linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
  color: var(--brand-contrast);
  font-weight: 600;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--brand) 60%, transparent), 0 6px 20px -6px var(--brand-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nav__link--highlight:hover {
  background-color: var(--brand-hover);
  color: var(--brand-contrast);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--brand) 60%, transparent), 0 8px 28px -6px var(--brand-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.nav__badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 0.375rem;
  border-radius: var(--radius-full);
  background: var(--brand-grad);
  color: var(--brand-contrast);
  font-size: 0.625rem;
  font-weight: 720;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 2px 8px -2px var(--brand-glow);
}

.nav__link--highlight .nav__badge {
  background: color-mix(in srgb, var(--brand-contrast) 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-contrast) 30%, transparent);
}

.nav__ext {
  display: inline-flex;
  opacity: 0.55;
}

.nav__ext .icon {
  width: 13px;
  height: 13px;
}

/*
 * Header "Tools" dropdown: <details class="nav-dropdown"> with the <summary> as its trigger, so it
 * opens without JavaScript. app.js adds Esc, outside click, arrow keys and edge alignment
 * (.nav-dropdown--end right-aligns the panel when it would pass the viewport edge).
 */
.nav-dropdown {
  position: relative;
  flex: none;
}

.nav-dropdown__trigger {
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.nav-dropdown__trigger::-webkit-details-marker {
  display: none;
}

.nav-dropdown__trigger::marker {
  content: "";
}

.nav-dropdown__chevron {
  width: 16px;
  height: 16px;
  margin-right: -0.125rem;
  color: var(--muted);
  transition: transform var(--dur-2) var(--ease), color var(--dur-1) var(--ease);
}

.nav-dropdown[open] > .nav-dropdown__trigger,
.nav-dropdown.is-open > .nav-dropdown__trigger {
  background: var(--surface-3);
  color: var(--text);
}

.nav-dropdown[open] .nav-dropdown__chevron,
.nav-dropdown.is-open .nav-dropdown__chevron {
  color: var(--text);
  transform: rotate(180deg);
}

.nav-dropdown__panel {
  position: absolute;
  top: calc(100% + 0.625rem);
  left: 0;
  z-index: 5;
  width: 22.5rem;
  max-width: calc(100vw - 2rem);
  padding: 0.375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-xl), 0 0 0 1px color-mix(in srgb, var(--border) 40%, transparent);
  transform-origin: 1.5rem top;
  animation: dropdown-in var(--dur-2) var(--ease-out);
}

.nav-dropdown--end .nav-dropdown__panel,
.no-js .nav-dropdown__panel {
  right: 0;
  left: auto;
  transform-origin: calc(100% - 1.5rem) top;
}

.nav-dropdown__list {
  display: grid;
  gap: 2px;
  /* Room for the announcement bar above the header too; longer menus scroll inside the panel. */
  max-height: calc(100vh - var(--header-h) - 6rem);
  max-height: calc(100dvh - var(--header-h) - 6rem);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.nav-dropdown__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: background var(--dur-1) var(--ease);
}

.nav-dropdown__item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav-dropdown__item:focus-visible {
  background: var(--surface-3);
  outline-offset: -2px;
}

.nav-dropdown__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand-text);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}

.nav-dropdown__icon .icon {
  width: 18px;
  height: 18px;
}

.nav-dropdown__item:hover .nav-dropdown__icon,
.nav-dropdown__item:focus-visible .nav-dropdown__icon,
.nav-dropdown__item--featured .nav-dropdown__icon {
  border-color: transparent;
  background: var(--brand);
  color: var(--brand-contrast);
}

.nav-dropdown__body {
  display: grid;
  flex: 1 1 auto;
  gap: 0.0625rem;
  min-width: 0;
}

.nav-dropdown__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.nav-dropdown__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-dropdown__title .nav__badge {
  flex: none;
}

.nav-dropdown__desc {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.nav-dropdown__ext {
  display: inline-flex;
  flex: none;
  color: var(--faint);
  transition: color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}

.nav-dropdown__ext .icon {
  width: 14px;
  height: 14px;
}

.nav-dropdown__item:hover .nav-dropdown__ext,
.nav-dropdown__item:focus-visible .nav-dropdown__ext {
  color: var(--text-3);
  transform: translate(1px, -1px);
}

/* Static, always-open copy for the admin live preview (ui_tools_menu_html(..., ['preview' => true])). */
.nav-dropdown--preview .nav-dropdown__panel {
  position: static;
  width: auto;
  max-width: 22.5rem;
  margin-top: 0.5rem;
  animation: none;
  box-shadow: var(--shadow-md);
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

.header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

.header-actions__signin,
.header-actions .signout-form {
  display: none;
}

.header-actions__cta {
  display: none;
}

@media (min-width: 560px) {
  .header-actions__cta {
    display: inline-flex;
  }
}

@media (min-width: 1024px) {
  .header-actions__signin {
    display: inline-flex;
  }

  .header-actions .signout-form {
    display: inline-flex;
  }

  /* Signed in: the desktop nav already links to the account ("Account"). */
  :root:not(.nav-compact) .header-actions__dash {
    display: none;
  }

  .nav-tight .header-actions__install,
  .nav-compact .header-actions__install {
    display: none !important;
  }
}

@media (max-width: 1023.98px) {
  .header-actions__install {
    display: none !important;
  }
}

.nav-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--surface-2);
}

@media (min-width: 1024px) {
  :root:not(.nav-compact) .nav-toggle {
    display: none;
  }
}

.no-js .nav-toggle {
  display: none;
}

.theme-toggle .theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-toggle__sun {
  display: inline-block;
}

:root[data-theme="dark"] .theme-toggle .theme-toggle__moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .theme-toggle__sun {
    display: inline-block;
  }

  :root:not([data-theme]) .theme-toggle .theme-toggle__moon {
    display: none;
  }
}

.theme-toggle--labelled {
  gap: 0.5rem;
}

/* Drawer theme button label ("Switch to dark/light mode", kept current by app.js). */
.theme-toggle__text {
  font-weight: 560;
  white-space: nowrap;
}

.install-btn .icon {
  color: var(--brand-text);
}

/* Mobile drawer */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear var(--dur-3);
}

.mobile-nav[data-open] {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.mobile-nav__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease);
}

.mobile-nav[data-open] .mobile-nav__backdrop {
  opacity: 1;
}

.mobile-nav__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(360px, 88vw);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform var(--dur-3) var(--ease-out);
}

.mobile-nav[data-open] .mobile-nav__panel {
  transform: none;
}

.mobile-nav__head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
  padding: 0 0.75rem 0 1rem;
  border-bottom: 1px solid var(--border);
}

.mobile-nav__links {
  display: grid;
  gap: 0.125rem;
  padding: 0.75rem;
}

.mobile-nav__links .nav__link {
  justify-content: flex-start;
  height: 46px;
  margin: 0;
  padding: 0 0.875rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  gap: 0.75rem;
}

.mobile-nav__links .nav__link .nav__icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.mobile-nav__links .nav__link--custom:not(.nav__link--button, .nav__link--highlight):not(:has(.nav__icon)) {
  padding-left: calc(0.875rem + 18px + 0.75rem);
}

.mobile-nav__links .nav__link.is-active {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.mobile-nav__links .nav__link.is-active .nav__icon {
  color: var(--brand-text);
}

.mobile-nav__links .nav__link--button,
.mobile-nav__links .nav__link--highlight {
  margin-bottom: 0.375rem;
  border-radius: var(--radius);
}

.mobile-nav__links .nav__link--highlight .nav__icon {
  color: inherit;
}

.mobile-nav__links .nav__ext {
  margin-left: auto;
}

.mobile-nav__foot {
  display: grid;
  gap: 0.625rem;
  margin-top: auto;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.mobile-nav__foot .signout-form {
  display: flex;
}

.mobile-nav__foot .user-chip {
  padding: 0.25rem 0.25rem 0.5rem;
}

.mobile-nav__tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Drawer "Tools" section: the header dropdown's links with icon, title and description. */
.mobile-nav__section {
  margin: 0 0.75rem 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.mobile-nav__heading {
  margin: 0.5rem 0.875rem 0.375rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 680;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mobile-nav__tool-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mobile-nav__tool-list .nav-dropdown__item {
  padding-inline: 0.875rem 0.75rem;
}

@media (min-width: 1024px) {
  :root:not(.nav-compact) .mobile-nav {
    display: none;
  }
}

body.nav-open,
body.drawer-open {
  overflow: hidden;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.user-chip__text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.user-chip__name,
.user-chip__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip__name {
  font-size: 0.875rem;
  font-weight: 620;
  color: var(--text);
}

.user-chip__email {
  font-size: 0.75rem;
  color: var(--muted);
}

.avatar {
  --avatar-bg: #e0e7ff;
  --avatar-fg: #3730a3;
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-fg);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.avatar--1 { --avatar-bg: #e0e7ff; --avatar-fg: #3730a3; }
.avatar--2 { --avatar-bg: #dcfce7; --avatar-fg: #166534; }
.avatar--3 { --avatar-bg: #fef3c7; --avatar-fg: #92400e; }
.avatar--4 { --avatar-bg: #fce7f3; --avatar-fg: #9d174d; }
.avatar--5 { --avatar-bg: #e0f2fe; --avatar-fg: #075985; }
.avatar--6 { --avatar-bg: #f3e8ff; --avatar-fg: #6b21a8; }

:root[data-theme="dark"] .avatar {
  --avatar-bg: rgba(129, 140, 248, 0.18);
  --avatar-fg: #c7d2fe;
}

:root[data-theme="dark"] .avatar--2 { --avatar-bg: rgba(52, 211, 153, 0.16); --avatar-fg: #a7f3d0; }
:root[data-theme="dark"] .avatar--3 { --avatar-bg: rgba(251, 191, 36, 0.16); --avatar-fg: #fde68a; }
:root[data-theme="dark"] .avatar--4 { --avatar-bg: rgba(244, 114, 182, 0.16); --avatar-fg: #fbcfe8; }
:root[data-theme="dark"] .avatar--5 { --avatar-bg: rgba(56, 189, 248, 0.16); --avatar-fg: #bae6fd; }
:root[data-theme="dark"] .avatar--6 { --avatar-bg: rgba(192, 132, 252, 0.16); --avatar-fg: #e9d5ff; }

/* Same palette when the OS is dark and no theme was chosen (JavaScript off). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .avatar {
    --avatar-bg: rgba(129, 140, 248, 0.18);
    --avatar-fg: #c7d2fe;
  }

  :root:not([data-theme]) .avatar--2 { --avatar-bg: rgba(52, 211, 153, 0.16); --avatar-fg: #a7f3d0; }
  :root:not([data-theme]) .avatar--3 { --avatar-bg: rgba(251, 191, 36, 0.16); --avatar-fg: #fde68a; }
  :root:not([data-theme]) .avatar--4 { --avatar-bg: rgba(244, 114, 182, 0.16); --avatar-fg: #fbcfe8; }
  :root:not([data-theme]) .avatar--5 { --avatar-bg: rgba(56, 189, 248, 0.16); --avatar-fg: #bae6fd; }
  :root:not([data-theme]) .avatar--6 { --avatar-bg: rgba(192, 132, 252, 0.16); --avatar-fg: #e9d5ff; }
}

/* =============================================================================================
 * 12. Hero & code window
 * ============================================================================================= */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(3.5rem, 8vw, 7rem) clamp(3rem, 6vw, 5.5rem);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto;
  z-index: -2;
  height: 130%;
  background:
    radial-gradient(38% 46% at 18% 18%, color-mix(in oklab, var(--brand) 24%, transparent), transparent 70%),
    radial-gradient(34% 42% at 82% 8%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(42% 36% at 62% 72%, color-mix(in oklab, var(--brand) 11%, transparent), transparent 72%);
  filter: blur(24px);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 0%, #000 35%, transparent 100%);
  pointer-events: none;
}

.hero > .container {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: center;
}

@media (min-width: 1024px) {
  .hero > .container:has(> .hero__visual) {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  }
}

.hero--center {
  text-align: center;
}

.hero--center .hero__lead {
  margin-inline: auto;
}

.hero--center .hero__actions,
.hero--center .hero__trust {
  justify-content: center;
}

.hero__content {
  min-width: 0;
}

.hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.3125rem 0.875rem 0.3125rem 0.375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
  font-size: 0.8125rem;
  font-weight: 560;
  text-decoration: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.hero__pill > .icon {
  color: var(--brand-text);
}

.hero__pill-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 0.5rem;
  border-radius: var(--radius-full);
  background: var(--brand-grad);
  color: var(--brand-contrast);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero__title {
  max-width: 17ch;
  margin: 1.25rem 0 0;
  color: var(--text);
  font-size: var(--fs-5xl);
  font-weight: 740;
  line-height: 1.04;
  letter-spacing: -0.042em;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero__title {
    background: linear-gradient(180deg, var(--text) 30%, color-mix(in oklab, var(--text) 62%, var(--brand)));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

/* 1024–1279px: the two-column hero gives the headline only ~470–600px, so scale the title with
   the viewport instead of using the full display size (owners can write up to 140 characters). */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .hero > .container:has(> .hero__visual) .hero__title {
    font-size: clamp(2.5rem, 0.6rem + 3.9vw, 3.5rem);
  }
}

.hero--center .hero__title {
  margin-inline: auto;
}

.hero__lead {
  max-width: 38rem;
  margin: 1.25rem 0 0;
  color: var(--text-3);
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem 1.5rem;
  margin: 2rem 0 0;
  padding: 0;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  list-style: none;
}

.hero__trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.hero__trust li::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background-color: var(--success);
  -webkit-mask: var(--i-check-circle) center / contain no-repeat;
  mask: var(--i-check-circle) center / contain no-repeat;
}

.hero__visual {
  position: relative;
  min-width: 0;
}

.hero__visual::before {
  content: "";
  position: absolute;
  inset: 10% 6% -2%;
  z-index: -1;
  border-radius: 48px;
  background: var(--brand-grad);
  filter: blur(64px);
  opacity: 0.32;
  pointer-events: none;
}

.hero__float {
  position: absolute;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  animation: float 6s var(--ease) infinite;
}

.hero__float .icon {
  padding: 5px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--success-soft);
  color: var(--success-text);
}

.hero__float--a {
  left: -1.75rem;
  bottom: -1.5rem;
}

.hero__float--b {
  top: 42%;
  right: -1.5rem;
  animation-delay: -3s;
}

.hero__float--b .icon {
  background: var(--brand-soft);
  color: var(--brand-text);
}

@media (min-width: 1100px) {
  .hero__float {
    display: inline-flex;
  }
}

.code-window {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  background: #0b1020;
  color: #cbd5e1;
  box-shadow: 0 32px 64px -24px rgba(2, 6, 23, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-family: var(--font-mono);
}

.code-window__bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 44px;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.code-window__dots {
  display: flex;
  gap: 6px;
}

.code-window__dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #334155;
}

.code-window__dots span:nth-child(1) { background: #f87171; }
.code-window__dots span:nth-child(2) { background: #fbbf24; }
.code-window__dots span:nth-child(3) { background: #34d399; }

.code-window__title {
  flex: 1;
  overflow: hidden;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 520;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-window__tag {
  padding: 0.125rem 0.5rem;
  border: 1px solid rgba(165, 180, 252, 0.3);
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.code-window__body {
  margin: 0;
  padding: 1.25rem 1.25rem 1.5rem;
  overflow-x: auto;
  background: none;
  color: #e2e8f0;
  font-size: 0.8125rem;
  line-height: 1.9;
  white-space: pre;
}

.code-window__body code {
  font-size: inherit;
}

.tok-k { color: #a5b4fc; }
.tok-s { color: #86efac; }
.tok-c { color: #64748b; }
.tok-p { color: #94a3b8; }
.tok-n { color: #fcd34d; }

/* =============================================================================================
 * 13. Pricing
 * ============================================================================================= */

.billing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-3);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.billing-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 38px;
  padding: 0 1.125rem;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.billing-toggle button:hover {
  color: var(--text);
}

.billing-toggle button[aria-pressed="true"] {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.save-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 20px;
  padding: 0 0.5rem;
  border: 1px solid var(--success-border);
  border-radius: var(--radius-full);
  background: var(--success-soft);
  color: var(--success-text);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.plans {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 272px), 1fr));
  align-items: stretch;
  margin-top: 2.5rem;
}

@media (min-width: 1100px) {
  .plans {
    grid-template-columns: repeat(auto-fit, minmax(272px, 372px));
    justify-content: center;
  }
}

/*
 * Four (or eight) plans: full rows of four only where each card keeps ~260px (1200px+), 2 × 2
 * from 640px, one column on phones — never 3 + 1. Descriptions reserve three lines so prices,
 * volumes and feature lists line up across a row.
 */
.plans.plans--4 {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
}

@media (min-width: 640px) {
  .plans.plans--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plans--4 .plan__desc {
    min-height: calc(3 * 1.5em);
  }
}

@media (min-width: 1200px) {
  .plans.plans--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .plans--4 .plan {
    padding: 1.5rem;
  }

  .plans--4 .plan__amount {
    font-size: 2.25rem;
  }
}

/* Phones: two or more plans become a swipeable row (the next card peeks in) instead of a
   3,000px stack of full cards; the comparison table below still lists every feature. */
@media (max-width: 639.98px) {
  .plans:has(> .plan ~ .plan) {
    grid-template-columns: none;
    /* A fixed card width: "minmax(0, 86%)" let the browser shrink every card to fit one screen. */
    grid-auto-columns: min(86%, 22rem);
    grid-auto-flow: column;
    gap: 0.875rem;
    margin-inline: calc(var(--gutter) * -1);
    padding: 1rem var(--gutter) 1.25rem; /* room for the plan badge and card shadows */
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: var(--gutter);
    scroll-snap-type: x mandatory;
  }

  .plans:has(> .plan ~ .plan) > .plan {
    scroll-snap-align: start;
  }
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease), border-color var(--dur-2);
}

.plan:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.plan > * {
  position: relative;
  margin: 0;
}

.plan--featured {
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(160deg, var(--brand), var(--accent) 55%, color-mix(in oklab, var(--brand) 25%, var(--border))) border-box;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 28px 64px -28px var(--brand-glow);
}

.plan--featured::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 55% at 50% 0%, color-mix(in oklab, var(--brand) 10%, transparent), transparent 62%);
  pointer-events: none;
}

.plan--featured:hover {
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 34px 72px -26px var(--brand-glow);
}

@media (min-width: 1100px) {
  .plan--featured {
    transform: translateY(-10px);
  }

  .plan--featured:hover {
    transform: translateY(-14px);
  }
}

.plan__badge {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 26px;
  padding: 0 0.8125rem;
  border-radius: var(--radius-full);
  background: var(--brand-grad);
  color: var(--brand-contrast);
  box-shadow: 0 8px 20px -8px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 0.6875rem;
  font-weight: 720;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.plan > .plan__badge {
  position: absolute;
  margin: 0;
}

.plan__badge .icon {
  width: 12px;
  height: 12px;
}

.plan__head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.plan__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-text);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.plan--featured .plan__icon {
  background: var(--brand-grad);
  color: var(--brand-contrast);
  box-shadow: 0 8px 20px -8px var(--brand-glow);
}

.plan__name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 680;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.plan__desc {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.plan__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem;
}

.plan__amount {
  color: var(--text);
  font-size: clamp(2.25rem, 1.9rem + 1.2vw, 2.75rem);
  font-weight: 740;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.plan__period {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
}

.plan__note {
  min-height: 1.25rem;
  margin-top: -0.75rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.plan__volume {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 560;
}

.plan__volume .icon {
  color: var(--brand-text);
}

.plan__volume strong {
  font-variant-numeric: tabular-nums;
}

.plan__features {
  display: grid;
  gap: 0.625rem;
  padding: 0;
  color: var(--text-2);
  font-size: 0.9375rem;
  list-style: none;
}

.plan__features li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  line-height: 1.45;
}

.plan__features li::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 0.0625rem;
  background-color: var(--brand-text);
  -webkit-mask: var(--i-check-circle) center / contain no-repeat;
  mask: var(--i-check-circle) center / contain no-repeat;
}

.plan__cta {
  display: grid;
  gap: 0.5rem;
  margin-top: auto !important;
}

.plan__cta.btn {
  display: flex;
  width: 100%;
}

.plan__cta .btn {
  width: 100%;
}

.plan__stock {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 580;
}

.plan__stock::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

.plan__stock--in { color: var(--success-text); }
.plan__stock--low { color: var(--warning-text); }
.plan__stock--out { color: var(--danger-text); }
.plan__stock--soon { color: var(--muted); }

.plans-note {
  max-width: 44rem;
  margin: 2rem auto 0;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}

/* =============================================================================================
 * 14. Features, steps, comparison, FAQ, CTA band, payment strip
 * ============================================================================================= */

.features-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

@media (min-width: 960px) {
  .features-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

.feature {
  position: relative;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-3) var(--ease), transform var(--dur-3) var(--ease-out);
}

.feature:hover {
  border-color: var(--brand-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-text);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.feature h3,
.feature__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.012em;
}

.feature p,
.feature__text {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.steps {
  position: relative;
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  list-style: none;
}

.step {
  position: relative;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.step__num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--brand-grad);
  color: var(--brand-contrast);
  box-shadow: 0 6px 16px -6px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-size: 0.9375rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.step h3,
.step__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.step p,
.step__text {
  margin: 0.375rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

@media (min-width: 1024px) {
  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: calc(1.5rem + 18px);
    left: calc(1.5rem + 36px + 0.75rem);
    right: calc(-1.25rem - 1px);
    border-top: 1.5px dashed var(--brand-border);
    pointer-events: none;
  }
}

.compare {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.compare table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9375rem;
}

.compare th,
.compare td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
  vertical-align: middle;
}

.compare th:first-child,
.compare td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 520;
  text-align: left;
}

.compare thead th {
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 680;
  vertical-align: bottom;
}

.compare thead th:first-child {
  background: var(--surface-2);
}

.compare tbody tr:last-child td {
  border-bottom: 0;
}

.compare tbody tr:hover td {
  background: var(--surface-2);
}

.compare .is-featured {
  background: var(--brand-softer);
}

.compare thead .is-featured {
  color: var(--brand-text);
  box-shadow: inset 0 3px 0 var(--brand);
}

.compare .icon {
  display: block;
  margin-inline: auto;
}

.compare__price {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 520;
  font-variant-numeric: tabular-nums;
}

/* Phones: a narrow sticky label column, so plan columns are visible and the table scrolls sideways
   (the 620px minimum otherwise gave the label column most of the screen). */
@media (max-width: 639.98px) {
  .compare table {
    width: max-content;
    min-width: 100%;
    font-size: 0.875rem;
  }

  .compare th,
  .compare td {
    padding: 0.75rem;
  }

  .compare th:first-child,
  .compare td:first-child {
    width: 8.5rem;
    min-width: 8.5rem;
  }

  .compare th:not(:first-child),
  .compare td:not(:first-child) {
    min-width: 6.5rem;
  }
}

.faq {
  display: grid;
  gap: 0.75rem;
  max-width: 50rem;
  margin-inline: auto;
}

.faq__item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-3) var(--ease);
}

.faq__item:hover {
  border-color: var(--border-strong);
}

.faq__item[open] {
  border-color: var(--brand-border);
  box-shadow: var(--shadow-md);
}

.faq__item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  border-radius: 14px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 620;
  letter-spacing: -0.005em;
  list-style: none;
  cursor: pointer;
}

.faq__item > summary::-webkit-details-marker {
  display: none;
}

.faq__item > summary::after {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  background-color: var(--muted);
  -webkit-mask: var(--i-plus) center / contain no-repeat;
  mask: var(--i-plus) center / contain no-repeat;
  transition: transform var(--dur-3) var(--ease-out), background-color var(--dur-2);
}

.faq__item[open] > summary::after {
  background-color: var(--brand-text);
  transform: rotate(135deg);
}

.faq__item > summary:focus-visible {
  outline-offset: -2px;
}

.faq__answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-3);
  font-size: 0.9375rem;
  line-height: 1.7;
  white-space: pre-line;
}

.faq__item[open] .faq__answer {
  animation: slide-down var(--dur-3) var(--ease-out);
}

.faq__answer > :last-child {
  margin-bottom: 0;
}

.cta-band {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 1.5rem;
  align-items: center;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 3.5rem);
  border-radius: var(--radius-2xl);
  background: var(--brand-grad);
  color: var(--brand-contrast);
  box-shadow: 0 32px 64px -32px var(--brand-glow);
}

.cta-band::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 70% 90% at 100% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 90% at 100% 0%, #000 20%, transparent 75%);
}

.cta-band::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  z-index: -1;
  width: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
}

@media (min-width: 860px) {
  .cta-band {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.cta-band h2 {
  margin: 0;
  color: inherit;
  font-size: var(--fs-3xl);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.cta-band p:not(.eyebrow) {
  max-width: 40rem;
  margin: 0.625rem 0 0;
  color: color-mix(in srgb, var(--brand-contrast) 84%, transparent);
}

.cta-band .btn--primary {
  --btn-bg: var(--brand-contrast);
  --btn-fg: color-mix(in oklab, var(--brand) 78%, #000);
  --btn-hover-bg: color-mix(in srgb, var(--brand-contrast) 90%, var(--brand));
  --btn-shadow: 0 8px 24px -8px rgba(2, 6, 23, 0.4);
  background-image: none;
}

.cta-band .btn--secondary,
.cta-band .btn--ghost {
  --btn-bg: color-mix(in srgb, var(--brand-contrast) 12%, transparent);
  --btn-fg: var(--brand-contrast);
  --btn-border: color-mix(in srgb, var(--brand-contrast) 32%, transparent);
  --btn-hover-bg: color-mix(in srgb, var(--brand-contrast) 20%, transparent);
  --btn-shadow: none;
}

.cta-band__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pay-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.625rem 0.75rem;
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.pay-strip__item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 30px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
  font-size: 0.8125rem;
  font-weight: 650;
}

.pay-strip__item .icon {
  width: 15px;
  height: 15px;
  color: var(--brand-text);
}

/* =============================================================================================
 * 15. Footer
 * ============================================================================================= */

.site-footer {
  padding: clamp(3rem, 6vw, 4.5rem) 0 2rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-size: 0.9375rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem 2rem;
}

.footer-col {
  flex: 1 1 150px;
  min-width: 0;
}

.footer-col--brand {
  flex: 2 1 260px;
  max-width: 26rem;
}

/* Tool names are longer than the other footer links: give that column more room (the brand
   column and the column gaps give some up, so six columns still fit the 1200px container). */
.footer-col--tools {
  flex: 1.25 1 185px;
}

.footer-grid:has(> .footer-col--tools) {
  column-gap: 1.5rem;
}

.footer-grid:has(> .footer-col--tools) > .footer-col--brand {
  flex-basis: 250px;
}

.footer-col__title {
  margin: 0 0 0.875rem;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 680;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-col__list {
  display: grid;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col__text {
  max-width: 34ch;
  margin: 1rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.footer-link:hover {
  color: var(--text);
}

.footer-link .nav__icon {
  width: 15px;
  height: 15px;
}

.footer-link--highlight {
  color: var(--brand-text);
  font-weight: 600;
}

.footer-link--button {
  color: var(--text);
  font-weight: 600;
}

.footer-pay {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-3);
  font-size: 0.8125rem;
  font-weight: 560;
}

.footer-pay .icon {
  color: var(--brand-text);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
}

.footer-bottom p {
  margin: 0;
}

/* "Prices in USD · One-time payments · No automatic renewal" */
.footer-bottom__note {
  color: var(--muted);
  text-wrap: balance;
}

@media (max-width: 639.98px) {
  .footer-bottom {
    flex-direction: column;
  }
}

/* =============================================================================================
 * 16. Auth
 * ============================================================================================= */

.auth {
  display: grid;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
}

@media (min-width: 960px) {
  .auth {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.auth__aside {
  position: relative;
  isolation: isolate;
  display: none;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: clamp(2.5rem, 5vw, 4.5rem);
  background: var(--brand-grad);
  color: var(--brand-contrast);
}

@media (min-width: 960px) {
  .auth__aside {
    display: flex;
  }
}

.auth__aside::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 20% 10%, #000 20%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 70% at 20% 10%, #000 20%, transparent 80%);
}

.auth__aside::after {
  content: "";
  position: absolute;
  right: -20%;
  bottom: -30%;
  z-index: -1;
  width: 80%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent 65%);
}

.auth__aside .brand {
  color: inherit;
}

.auth__aside .brand__mark {
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--brand-contrast) 45%, transparent), 0 8px 20px -8px rgba(2, 6, 23, 0.4);
}

.auth__aside h2 {
  max-width: 18ch;
  margin: 2.5rem 0 0;
  color: inherit;
  font-size: var(--fs-3xl);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.auth__aside p:not(.eyebrow) {
  max-width: 40ch;
  margin: 0.875rem 0 0;
  color: color-mix(in srgb, var(--brand-contrast) 85%, transparent);
}

.auth__points {
  display: grid;
  gap: 1.125rem;
  max-width: 28rem;
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
}

.auth__points li {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  color: color-mix(in srgb, var(--brand-contrast) 88%, transparent);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.auth__points .icon {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand-contrast) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-contrast) 22%, transparent);
  color: var(--brand-contrast);
}

.auth__points strong {
  display: block;
  color: var(--brand-contrast);
}

.auth__main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 6vw, 4rem) var(--gutter);
}

.auth__card {
  width: 100%;
  max-width: 420px;
}

.auth__card h1 {
  margin: 0;
  font-size: clamp(1.625rem, 1.4rem + 1vw, 2rem);
  letter-spacing: -0.03em;
}

.auth__card .lead,
.auth__card > p:not(.eyebrow) {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.auth__card > .form,
.auth__card > form {
  margin-top: 1.75rem;
}

.auth__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1.25rem;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-text);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.auth__alt {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
}

.auth__alt a {
  font-weight: 600;
}

.otp-input {
  height: 64px;
  padding-left: 0.5em;
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.qr {
  display: inline-grid;
  place-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.qr img {
  display: block;
  image-rendering: pixelated;
}

/* =============================================================================================
 * 17. Customer area
 * ============================================================================================= */

.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.75rem;
}

.dash-head h1 {
  margin: 0.375rem 0 0;
  font-size: var(--fs-3xl);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.dash-head p:not(.eyebrow) {
  margin: 0.375rem 0 0;
  color: var(--muted);
}

/*
 * Stat tiles. Four tiles (.stats--4, or any .stats with exactly four children) use the same
 * switcher as .kpi-grid — one row of four, else 2 × 2 (also on phones), else one column — and a
 * stacked tile (icon above the text) so values such as "30 or 365 days" fit narrow columns.
 */
.stats {
  --tile-gap: 1rem;
  --tile-min: 13.5rem;
  --tile-min-2: 9rem;
  display: grid;
  gap: var(--tile-gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
}

.stats--4,
.stats:has(> :nth-child(4):last-child) {
  --tile-half: clamp(
    calc((100% - var(--tile-gap)) / 2 - 1px),
    (2 * var(--tile-min-2) + var(--tile-gap) - 100%) * 999,
    100%
  );
  grid-template-columns: repeat(
    auto-fit,
    minmax(clamp(calc((100% - 3 * var(--tile-gap)) / 4 - 1px), (4 * var(--tile-min) + 3 * var(--tile-gap) - 100%) * 999, var(--tile-half)), 1fr)
  );
}

.stat {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.stat__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-text);
}

.stat__text {
  min-width: 0;
}

.stat__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 540;
}

.stat__value {
  margin: 0.125rem 0 0;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.stat__meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.stats--4 > .stat,
.stats:has(> :nth-child(4):last-child) > .stat {
  flex-direction: column;
  gap: 0.75rem;
}

@media (max-width: 479.98px) {
  .stats {
    --tile-gap: 0.75rem;
  }

  .stats--4 > .stat,
  .stats:has(> :nth-child(4):last-child) > .stat {
    padding: 0.875rem 1rem;
  }

  .stats--4 .stat__icon,
  .stats:has(> :nth-child(4):last-child) .stat__icon {
    width: 34px;
    height: 34px;
  }

  .stats--4 .stat__value,
  .stats:has(> :nth-child(4):last-child) .stat__value {
    font-size: 1.25rem;
  }
}

.service-card {
  position: relative;
  display: grid;
  gap: 1rem;
  overflow: hidden;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.service-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--brand-grad);
}

.service-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.service-card__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 680;
  letter-spacing: -0.015em;
}

.service-card__sub {
  margin: 0.125rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.service-card__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.service-card__meta strong {
  color: var(--text);
  font-weight: 620;
}

.service-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--brand);
  appearance: none;
  -webkit-appearance: none;
}

.progress::-webkit-progress-bar {
  border-radius: var(--radius-full);
  background: var(--surface-3);
}

.progress::-webkit-progress-value {
  border-radius: var(--radius-full);
  background: var(--brand-grad);
  transition: width var(--dur-3) var(--ease);
}

.progress::-moz-progress-bar {
  border-radius: var(--radius-full);
  background: var(--brand-grad);
}

.progress--sm {
  height: 6px;
}

.progress--success::-webkit-progress-value { background: var(--success); }
.progress--success::-moz-progress-bar { background: var(--success); }
.progress--warning::-webkit-progress-value { background: var(--warning); }
.progress--warning::-moz-progress-bar { background: var(--warning); }
.progress--danger::-webkit-progress-value { background: var(--danger); }
.progress--danger::-moz-progress-bar { background: var(--danger); }

.cred {
  position: relative;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.cred__row {
  display: grid;
  grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.cred__row:last-child {
  border-bottom: 0;
}

.cred__row:hover {
  background: var(--surface-2);
}

.cred__label {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 580;
}

.cred__copy {
  --btn-fg: var(--muted);
}

.cred__value {
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  word-break: break-all;
  user-select: all;
}

@media (max-width: 520px) {
  .cred__row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.125rem;
  }

  .cred__label {
    grid-column: 1 / -1;
  }
}

.snippet {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.snippet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.375rem 0.375rem 0.375rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.snippet__title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 620;
}

.snippet__title .icon {
  color: var(--muted);
}

.snippet__body {
  margin: 0;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  background: #0b1020;
  color: #e2e8f0;
  font-size: 0.8125rem;
  line-height: 1.7;
}

.snippet__body code {
  font-size: inherit;
}

.timeline {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline__item {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.125rem;
  min-height: 2.75rem;
  padding: 0 0 1.25rem 2.25rem;
}

.timeline__item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface) center / 12px no-repeat;
}

.timeline__item::after {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 2px;
  left: 10px;
  width: 2px;
  border-radius: 2px;
  background: var(--border);
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__item:last-child::after {
  display: none;
}

.timeline__item.is-done::before {
  border-color: var(--success);
  background-color: var(--success);
  background-image: var(--i-check-white);
}

.timeline__item.is-done::after {
  background: var(--success);
}

.timeline__item.is-current::before {
  border-color: var(--brand);
  background: radial-gradient(circle, var(--brand) 0 4px, var(--surface) 4.5px);
  box-shadow: 0 0 0 4px var(--brand-ring-soft);
  animation: ring-pulse 2.2s var(--ease) infinite;
}

.timeline__item.is-failed::before {
  border-color: var(--danger);
  background-color: var(--danger);
  background-image: var(--i-x-white);
  background-size: 11px;
}

.timeline__title {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 620;
  line-height: 22px;
}

.timeline__item:not(.is-done, .is-current, .is-failed) .timeline__title {
  color: var(--muted);
  font-weight: 520;
}

.timeline__item.is-failed .timeline__title {
  color: var(--danger-text);
}

.timeline__meta {
  color: var(--muted);
  font-size: 0.8125rem;
}

.timeline__text {
  color: var(--text-2);
  font-size: 0.875rem;
}

@media (min-width: 640px) {
  .timeline--h {
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
  }

  .timeline--h .timeline__item {
    min-height: 0;
    padding: 2.25rem 0.75rem 0 0;
  }

  .timeline--h .timeline__item::after {
    top: 10px;
    right: 0;
    bottom: auto;
    left: 26px;
    width: auto;
    height: 2px;
  }

  .timeline--h .timeline__item:last-child::after {
    display: none;
  }
}

.summary-card {
  display: grid;
  gap: 0.75rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.summary-row > :last-child {
  color: var(--text);
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.summary-row--discount > :last-child {
  color: var(--success-text);
}

.summary-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.25rem;
  padding-top: 0.875rem;
  border-top: 1px dashed var(--border-strong);
  color: var(--text);
  font-size: 1rem;
  font-weight: 680;
}

.summary-total > :last-child {
  font-size: 1.625rem;
  font-weight: 740;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.coupon-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin: 0;
}

.coupon-form .field {
  flex: 1;
}

.coupon-form .field__control {
  text-transform: uppercase;
}

/* =============================================================================================
 * 18. Data display — tables, tabs, pagination, key/value, chips, toolbar
 * ============================================================================================= */

.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.table th {
  padding: 0.6875rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-2);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background var(--dur-1) var(--ease);
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table td > strong,
.table td > a {
  color: var(--text);
  font-weight: 600;
}

.table td a {
  text-decoration: none;
}

.table td a:hover {
  color: var(--brand-text);
  text-decoration: underline;
}

.table .is-num,
.table .tabular {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.table th.is-num {
  text-align: right;
}

.table__meta {
  display: block;
  margin-top: 0.125rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
}

.table-empty td {
  padding: 2.5rem 1rem;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 720px) {
  /* Auto table layout would squeeze an avatar + name cell to its ellipsis ("Alic…"): give the
     identity a floor and let the table scroll instead. */
  .table .user-chip__text {
    min-width: 9.5rem;
  }

  /* Scroll cue: when a wide table scrolls sideways, soft shadows mark the hidden edge(s). The
     "local" covers travel with the content and hide each shadow at its end of the scroll. */
  .table-wrap {
    background:
      linear-gradient(to right, var(--surface) 35%, transparent) left center / 3rem 100% no-repeat local,
      linear-gradient(to left, var(--surface) 35%, transparent) right center / 3rem 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(15, 23, 42, 0.16), transparent) left center / 0.875rem 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(15, 23, 42, 0.16), transparent) right center / 0.875rem 100% no-repeat scroll,
      var(--surface);
  }

  :root[data-theme="dark"] .table-wrap {
    background:
      linear-gradient(to right, var(--surface) 35%, transparent) left center / 3rem 100% no-repeat local,
      linear-gradient(to left, var(--surface) 35%, transparent) right center / 3rem 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.55), transparent) left center / 0.875rem 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.55), transparent) right center / 0.875rem 100% no-repeat scroll,
      var(--surface);
  }
}

@media (min-width: 720px) and (prefers-color-scheme: dark) {
  :root:not([data-theme]) .table-wrap {
    background:
      linear-gradient(to right, var(--surface) 35%, transparent) left center / 3rem 100% no-repeat local,
      linear-gradient(to left, var(--surface) 35%, transparent) right center / 3rem 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.55), transparent) left center / 0.875rem 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.55), transparent) right center / 0.875rem 100% no-repeat scroll,
      var(--surface);
  }
}

@media (max-width: 719.98px) {
  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .card > .table-wrap,
  .card__body--flush > .table-wrap {
    padding: 0.75rem;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table tr {
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
  }

  .table tbody tr:hover {
    background: var(--surface);
  }

  .table tr:last-child {
    margin-bottom: 0;
  }

  .table td {
    display: flow-root;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
  }

  .table tbody tr:last-child td {
    border-bottom: 1px solid var(--border-subtle);
  }

  .table tbody tr td:last-child {
    border-bottom: 0;
  }

  .table td[data-label]::before {
    content: attr(data-label);
    float: left;
    max-width: 48%;
    margin-right: 1rem;
    padding-top: 0.125rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-align: left;
    text-transform: uppercase;
  }

  .table td:not([data-label]) {
    text-align: left;
  }

  .table td:not([data-label]) .table-actions {
    justify-content: flex-start;
  }

  /* A stacked card never shows an empty strip (e.g. no actions left for a sold account). */
  .table td:empty,
  .table td:not([data-label]):has(> .table-actions:empty) {
    display: none;
  }

  .table .is-num {
    text-align: right;
  }
}

.tabs {
  position: relative;
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
  height: 44px;
  padding: 0 0.875rem;
  border: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 580;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-1) var(--ease), background var(--dur-1);
}

.tab:hover {
  color: var(--text);
  background: var(--surface-3);
}

.tab.is-active,
.tab[aria-selected="true"] {
  color: var(--text);
}

.tab.is-active::after,
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 0.625rem;
  bottom: -1px;
  left: 0.625rem;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.tab:focus-visible {
  outline-offset: -2px;
}

.tab .icon {
  width: 16px;
  height: 16px;
}

.tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 0.375rem;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.tab.is-active .tab__count {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.pagination__info {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.kv {
  display: grid;
  margin: 0;
}

.kv__row {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.kv__row:first-child {
  padding-top: 0;
}

.kv__row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.kv dt {
  color: var(--muted);
  font-size: 0.875rem;
}

.kv dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 540;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .kv__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.125rem;
  }
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 32px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 580;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1), color var(--dur-1);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.is-active {
  border-color: var(--brand-border);
  background: var(--brand-soft);
  color: var(--brand-text);
}

.chip .icon {
  width: 14px;
  height: 14px;
}

.chip__count {
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.chip.is-active .chip__count {
  background: var(--surface);
  color: var(--brand-text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.toolbar > .search-input {
  flex: 1 1 240px;
  max-width: 380px;
}

.toolbar__spacer {
  flex: 1;
}

.search-input {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.search-input > .icon {
  position: absolute;
  left: 0.75rem;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.search-input input {
  height: 40px;
  min-height: 40px;
  padding: 0 2.5rem 0 2.375rem;
}

.search-input input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-input kbd {
  position: absolute;
  right: 0.625rem;
  pointer-events: none;
}

.search-input input:focus ~ kbd {
  display: none;
}

/* =============================================================================================
 * 19. Support thread
 * ============================================================================================= */

.thread {
  display: grid;
  gap: 1.125rem;
}

.msg {
  display: grid;
  gap: 0.5rem;
  max-width: min(46rem, 90%);
}

.msg--customer {
  justify-self: start;
}

.msg--staff {
  justify-self: end;
}

.msg__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.msg__meta strong {
  color: var(--text);
  font-weight: 620;
}

.msg__meta .avatar {
  width: 28px;
  height: 28px;
  font-size: 0.6875rem;
}

.msg--staff .msg__meta {
  justify-content: flex-end;
}

.msg__body {
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg__body > :last-child {
  margin-bottom: 0;
}

.msg--customer .msg__body {
  border-top-left-radius: 6px;
}

.msg--staff .msg__body {
  border-color: var(--brand-border);
  border-top-right-radius: 6px;
  background: var(--brand-soft);
}

/* =============================================================================================
 * 20. Admin console
 * ============================================================================================= */

.admin-body {
  background: var(--bg-subtle);
}

.admin {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .admin {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
}

.admin-sidebar {
  --sb-bg: #0a0f1e;
  --sb-fg: #9aa6ba;
  --sb-fg-strong: #f1f5f9;
  --sb-muted: #8490a4; /* group titles: ≥ 5:1 on the sidebar, also under the brand glow */
  --sb-hover: rgba(148, 163, 184, 0.1);
  --sb-border: rgba(148, 163, 184, 0.12);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  width: min(288px, 86vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--sb-border);
  background:
    radial-gradient(120% 40% at 0% 0%, color-mix(in oklab, var(--brand) 22%, transparent), transparent 60%),
    var(--sb-bg);
  color: var(--sb-fg);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
  visibility: hidden;
  transform: translateX(-100%);
  transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
}

.admin-sidebar[data-open] {
  visibility: visible;
  transform: none;
  transition-delay: 0s;
  box-shadow: var(--shadow-xl);
}

@media (min-width: 1024px) {
  .admin-sidebar {
    position: sticky;
    top: 0;
    width: auto;
    height: 100vh;
    visibility: visible;
    transform: none;
    transition: none;
  }

  .admin-sidebar[data-open] {
    box-shadow: none;
  }
}

.admin-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-drawer) - 1);
  background: var(--overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-3) var(--ease), visibility 0s linear var(--dur-3);
}

.admin-sidebar[data-open] ~ .admin-backdrop {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

@media (min-width: 1024px) {
  .admin-backdrop {
    display: none;
  }
}

.admin-sidebar__brand {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: 64px;
  padding: 0 0.75rem 0 1.25rem;
  border-bottom: 1px solid var(--sb-border);
}

.admin-sidebar__brand .brand {
  color: var(--sb-fg-strong);
  font-size: 1rem;
}

.admin-sidebar__brand .badge {
  --badge-bg: rgba(148, 163, 184, 0.14);
  --badge-fg: #cbd5e1;
  --badge-border: rgba(148, 163, 184, 0.2);
}

.admin-nav {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 1.375rem;
  padding: 1.125rem 0.75rem 1.5rem;
}

.admin-nav__group {
  display: grid;
  gap: 2px;
}

.admin-nav__group-title {
  margin: 0 0 0.375rem;
  padding: 0 0.75rem;
  color: var(--sb-muted);
  font-size: 0.6875rem;
  font-weight: 680;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.admin-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 38px;
  padding: 0 0.75rem;
  border-radius: 9px;
  color: var(--sb-fg);
  font-size: 0.9rem;
  font-weight: 530;
  text-decoration: none;
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}

.admin-nav__link .icon {
  flex: none;
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.admin-nav__link:hover {
  background: var(--sb-hover);
  color: var(--sb-fg-strong);
}

.admin-nav__link.is-active {
  background: color-mix(in oklab, var(--brand) 24%, rgba(255, 255, 255, 0.02));
  color: #fff;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--brand) 38%, transparent);
}

.admin-nav__link.is-active::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -0.75rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-text-dark);
}

.admin-nav__link.is-active .icon {
  color: var(--brand-text-dark);
  opacity: 1;
}

.admin-nav__link:focus-visible {
  outline-color: var(--brand-text-dark);
  outline-offset: -2px;
}

.admin-nav__count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  margin-left: auto;
  padding: 0 0.375rem;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
  font-size: 0.6875rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.admin-nav__count--warn {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.admin-nav__count--danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.admin-sidebar__foot {
  display: grid;
  flex: none;
  gap: 0.375rem;
  padding: 0.75rem;
  border-top: 1px solid var(--sb-border);
}

.admin-sidebar .btn--ghost,
.admin-sidebar .nav-toggle {
  --btn-fg: var(--sb-fg);
  --btn-hover-bg: var(--sb-hover);
  --btn-hover-fg: var(--sb-fg-strong);
}

.admin-sidebar .btn--ghost {
  justify-content: flex-start;
}

.admin-sidebar .btn--icon {
  justify-content: center;
}

.admin-sidebar :focus-visible {
  outline-color: var(--brand-text-dark);
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 64px;
  padding: 0 var(--admin-pad);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-subtle) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
}

.admin-topbar .search-input {
  flex: 1 1 auto;
  max-width: 460px;
}

.admin-topbar__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

.admin-topbar .user-chip__text {
  display: none;
}

@media (min-width: 768px) {
  .admin-topbar .user-chip__text {
    display: grid;
  }
}

@media (max-width: 639.98px) {
  .admin-topbar__store .btn__label {
    display: none;
  }
}

@media (max-width: 479.98px) {
  .admin-topbar {
    gap: 0.5rem;
  }

  .admin-topbar .search-input kbd,
  .admin-topbar .admin-topbar__store,
  .admin-topbar .signout-form {
    display: none;
  }
}

.admin-topbar [data-admin-toggle] {
  flex: none;
}

@media (min-width: 1024px) {
  .admin-topbar [data-admin-toggle] {
    display: none;
  }
}

.admin-content {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 1.5rem;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2rem) var(--admin-pad) 4rem;
  outline: none;
}

.admin-content > * {
  min-width: 0;
}

.admin-content > .page-header ~ .page-header {
  margin-top: 1.5rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.page-header__text {
  flex: 1 1 20rem;
  min-width: 0;
}

.page-header__back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 580;
  text-decoration: none;
}

.page-header__back:hover {
  color: var(--text);
}

.page-header__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--brand-text);
  font-size: 0.75rem;
  font-weight: 680;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-header__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: -0.028em;
}

.page-header__sub {
  max-width: 64ch;
  margin: 0.375rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/*
 * KPI tiles. Any count: auto-fit columns of at least --tile-min. Exactly three or four tiles never
 * leave an orphan (3 + 1): they switch between one row, 2 × 2 (four only) and one column, based on
 * the grid's own width, so the same rule works beside the admin sidebar, inside cards and on
 * phones. Switcher: clamp(narrow, (threshold - 100%) × 999, wide) picks one of the two widths.
 */
.kpi-grid {
  --tile-gap: 1rem;
  --tile-min: 12.5rem; /* narrowest tile in a full row */
  --tile-min-2: 9.25rem; /* narrowest tile in a 2 × 2 grid (phones) */
  display: grid;
  gap: var(--tile-gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--tile-min)), 1fr));
}

.kpi-grid:has(> :nth-child(4):last-child) {
  --tile-half: clamp(
    calc((100% - var(--tile-gap)) / 2 - 1px),
    (2 * var(--tile-min-2) + var(--tile-gap) - 100%) * 999,
    100%
  );
  grid-template-columns: repeat(
    auto-fit,
    minmax(clamp(calc((100% - 3 * var(--tile-gap)) / 4 - 1px), (4 * var(--tile-min) + 3 * var(--tile-gap) - 100%) * 999, var(--tile-half)), 1fr)
  );
}

.kpi-grid:has(> :nth-child(3):last-child) {
  grid-template-columns: repeat(
    auto-fit,
    minmax(clamp(calc((100% - 2 * var(--tile-gap)) / 3 - 1px), (3 * var(--tile-min) + 2 * var(--tile-gap) - 100%) * 999, 100%), 1fr)
  );
}

.kpi {
  position: relative;
  display: grid;
  gap: 0.5rem;
  overflow: hidden;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-3) var(--ease), transform var(--dur-3) var(--ease-out);
}

a.kpi:hover,
.kpi--link:hover {
  border-color: var(--brand-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kpi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.kpi__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 580;
}

.kpi__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-text);
}

.kpi__icon .icon {
  width: 18px;
  height: 18px;
}

.kpi__value {
  margin: 0;
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 740;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.kpi__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-full);
  background: var(--neutral-soft);
  color: var(--neutral-text);
  font-size: 0.75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.kpi__delta--up {
  background: var(--success-soft);
  color: var(--success-text);
}

.kpi__delta--down {
  background: var(--danger-soft);
  color: var(--danger-text);
}

/* Phones show KPI tiles two by two: tighten them a little. */
@media (max-width: 479.98px) {
  .kpi-grid {
    --tile-gap: 0.75rem;
  }

  .kpi {
    padding: 0.875rem 1rem;
  }

  .kpi__value {
    font-size: 1.5rem;
  }

  .kpi__icon {
    width: 30px;
    height: 30px;
  }
}

.chart-figure {
  position: relative;
  margin: 0;
  overflow-x: auto;
  container-type: inline-size;
}

.chart {
  display: block;
  width: 100%;
  min-width: 420px;
  height: auto;
  overflow: visible;
  font-family: var(--font-sans);
}

/* Chart kinds (ui_bar_chart / ui_line_chart). The first grid line is the zero baseline: draw it
   solid so bars and the area fill stand on it. */
.chart--bar .chart__grid:first-of-type,
.chart--line .chart__grid:first-of-type {
  stroke: var(--border-strong);
  stroke-dasharray: none;
}

.chart__grid {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  shape-rendering: crispEdges;
}

.chart__label {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Y-axis values: right-aligned against the plot (text-anchor="end" in the markup) with lining,
   tabular digits so the amounts line up. */
.chart__label--y {
  font-feature-settings: "tnum", "lnum";
  letter-spacing: -0.01em;
}

/* SVG text scales with the chart; keep labels ~11–13px on screen (viewBox width 720). */
@container (max-width: 559.98px) {
  .chart__label {
    font-size: 17px;
  }
}

@container (min-width: 560px) and (max-width: 719.98px) {
  .chart__label {
    font-size: 15px;
  }
}

@container (min-width: 720px) and (max-width: 939.98px) {
  .chart__label {
    font-size: 13px;
  }
}

.chart__bar {
  fill: var(--brand);
  transition: fill var(--dur-1) var(--ease), opacity var(--dur-1);
}

.chart__bar--muted {
  fill: color-mix(in oklab, var(--brand) 24%, var(--surface-3));
}

.chart__hit {
  fill: transparent;
}

.chart__col:hover .chart__hit,
.chart__col.is-active .chart__hit {
  fill: color-mix(in oklab, var(--brand) 6%, transparent);
}

.chart__col:hover .chart__bar,
.chart__col.is-active .chart__bar {
  fill: var(--brand-hover);
}

.chart__line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__area {
  fill: var(--brand);
  fill-opacity: 0.1;
  stroke: none;
}

.chart__dot {
  fill: var(--surface);
  stroke: var(--brand);
  stroke-width: 2;
  opacity: 0;
  transition: opacity var(--dur-1);
}

.chart__col:hover .chart__dot,
.chart__col.is-active .chart__dot {
  opacity: 1;
}

.chart-tip {
  position: absolute;
  z-index: 5;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #f8fafc;
  box-shadow: var(--shadow-lg);
  font-size: 0.75rem;
  font-weight: 580;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
}

/* Dark theme: the card is already near-black, so the tooltip is lifted with a lighter surface
   and a visible edge instead of a shadow. */
:root[data-theme="dark"] .chart-tip {
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .chart-tip {
    border: 1px solid var(--border-strong);
    background: var(--surface-3);
    color: var(--text);
  }
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.chart-legend__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.375rem;
  border-radius: 3px;
  background: var(--brand);
}

.chart-legend__swatch--muted {
  background: color-mix(in oklab, var(--brand) 24%, var(--surface-3));
}

.checklist {
  display: grid;
  gap: 0.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist__item {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: 44px;
  padding: 0.5rem 0.75rem 0.5rem 2.625rem;
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.9375rem;
}

.checklist__item::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.75rem;
  width: 20px;
  height: 20px;
  border: 2px solid var(--warning);
  border-radius: 50%;
  background: var(--warning-soft) center / 11px no-repeat;
  transform: translateY(-50%);
}

.checklist__item.is-done::before {
  border-color: var(--success);
  background-color: var(--success);
  background-image: var(--i-check-white);
}

.checklist__item.is-done {
  color: var(--muted);
}

.checklist__item:hover {
  background: var(--surface-2);
}

.checklist__item > :last-child:is(a, .btn, form) {
  margin-left: auto;
}

.stock-meter {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 140px;
}

.stock-meter > progress,
.stock-meter > meter {
  flex: 1;
  min-width: 60px;
}

.stock-meter meter {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--surface-3);
}

.stock-meter meter::-webkit-meter-bar {
  height: 8px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--surface-3);
}

.stock-meter meter::-webkit-meter-optimum-value {
  border-radius: var(--radius-full);
  background: var(--success);
}

.stock-meter meter::-webkit-meter-suboptimum-value {
  border-radius: var(--radius-full);
  background: var(--warning);
}

.stock-meter meter::-webkit-meter-even-less-good-value {
  border-radius: var(--radius-full);
  background: var(--danger);
}

.stock-meter meter::-moz-meter-bar {
  border-radius: var(--radius-full);
}

.stock-meter meter:-moz-meter-optimum::-moz-meter-bar { background: var(--success); }
.stock-meter meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warning); }
.stock-meter meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--danger); }

.stock-meter__label {
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.list {
  display: grid;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  list-style: none;
}

.card .list,
.card__body--flush > .list {
  border: 0;
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
}

.list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.875rem;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}

.list__item:last-child {
  border-bottom: 0;
}

.list__main {
  flex: 1 1 12rem;
  min-width: 0;
}

.list__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 620;
}

.list__meta {
  margin: 0.125rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list__actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

.drag-handle {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted); /* a control: at least 3:1 against the row */
  cursor: grab;
  touch-action: none;
}

.drag-handle:hover {
  background: var(--surface-3);
  color: var(--text-2);
}

.drag-handle:active {
  cursor: grabbing;
}

.sortable-list.is-sorting {
  user-select: none;
}

.sortable-list > [data-id] {
  position: relative;
  transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}

.sortable-list > [data-id].is-dragging {
  z-index: 2;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xl), 0 0 0 1.5px var(--brand);
  transform: scale(1.01);
}

.sortable-list > [data-id].is-moved {
  animation: flash-bg 1.2s var(--ease);
}

.sortable-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
  background: var(--brand-softer);
  animation: slide-down var(--dur-3) var(--ease-out);
}

.sortable-form:not(.is-dirty) {
  display: none;
}

.sortable-form__note {
  margin: 0 auto 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.link-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* never wider than its card (the menu preview is clipped instead) */
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.link-preview__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 680;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.link-preview__url {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.link-preview__warn {
  margin: 0;
  color: var(--warning-text);
  font-size: 0.8125rem;
}

.preview-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 58px;
  padding: 0 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.preview-bar .brand {
  font-size: 0.9375rem;
}

.preview-bar .brand__mark {
  width: 26px;
  height: 26px;
}

.preview-bar__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
}

.preview-bar__fake {
  flex: none;
  width: 44px;
  height: 8px;
  margin: 0 0.5rem;
  border-radius: 4px;
  background: var(--surface-3);
}

.preview-bar .nav__link {
  height: 32px;
  font-size: 0.875rem;
}

.danger-zone {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-lg);
  background: color-mix(in oklab, var(--danger-soft) 55%, var(--surface));
}

.danger-zone__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--danger-text);
  font-size: 1rem;
  font-weight: 680;
}

.danger-zone__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--danger-border);
}

.danger-zone__row p {
  max-width: 60ch;
  margin: 0;
  color: var(--text-2);
  font-size: 0.9rem;
}

.icon-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.icon-picker > legend {
  margin-bottom: 0.5rem;
  padding: 0;
}

.icon-picker__grid {
  position: relative;
  display: grid;
  gap: 0.375rem;
  max-height: 232px;
  padding: 0.5rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  scrollbar-width: thin;
}

.icon-picker__grid--open {
  max-height: none;
  overflow: visible;
}

.icon-picker__item {
  position: relative;
  display: block;
  cursor: pointer;
}

.icon-picker__input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.icon-picker__tile {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text-2);
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-2);
}

.icon-picker__item:hover .icon-picker__tile {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.icon-picker__input:checked + .icon-picker__tile {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-text);
  box-shadow: 0 0 0 3px var(--brand-ring-soft);
}

.icon-picker__input:focus-visible + .icon-picker__tile {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.icon-picker__tile--none {
  color: var(--faint);
}

.secret-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 24px;
  padding: 0 0.625rem;
  border: 1px solid var(--neutral-border);
  border-radius: var(--radius-full);
  background: var(--neutral-soft);
  color: var(--neutral-text);
  font-size: 0.75rem;
  font-weight: 620;
  white-space: nowrap;
}

.secret-status .icon {
  width: 13px;
  height: 13px;
}

.secret-status--set {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success-text);
}

.secret-status--unset {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning-text);
}

.inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.inline-form .field {
  gap: 0;
}

/* =============================================================================================
 * 21. Dialogs
 * ============================================================================================= */

.modal {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 32px 80px -16px rgba(2, 6, 23, 0.5);
}

.modal[open] {
  display: flex;
  flex-direction: column;
  animation: modal-in var(--dur-3) var(--ease-out);
}

.modal::backdrop {
  background: rgba(2, 6, 23, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal[open]::backdrop {
  animation: fade-in var(--dur-2) var(--ease);
}

.modal--wide {
  width: min(780px, calc(100vw - 32px));
}

.modal > form,
.modal__form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}

.modal__head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0.875rem 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 680;
  letter-spacing: -0.015em;
}

.modal__body {
  flex: 1 1 auto;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
}

.modal__body > :first-child {
  margin-top: 0;
}

.modal__foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-2);
}

.modal--confirm .modal__body p {
  margin: 0;
  color: var(--text-2);
}

.modal--danger .modal__title {
  color: var(--danger-text);
}

@media (max-width: 639.98px) {
  .modal {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
  }

  .modal[open] {
    animation: sheet-in var(--dur-3) var(--ease-out);
  }

  .modal__foot {
    padding-bottom: calc(0.875rem + env(safe-area-inset-bottom, 0px));
  }

  .modal__foot .btn {
    flex: 1 1 auto;
  }
}

/* Sheet dialog (iOS "Add to Home Screen" steps): a compact card on wide screens; on phones a
   bottom sheet (every .modal is one below 640px) with a grab handle, next to Safari's toolbar. */
.modal--sheet {
  width: min(440px, calc(100vw - 32px));
}

@media (max-width: 639.98px) {
  .modal--sheet {
    width: 100%;
  }

  .modal--sheet::before {
    content: "";
    flex: none;
    align-self: center;
    width: 40px;
    height: 4px;
    margin-top: 0.5rem;
    border-radius: var(--radius-full);
    background: var(--border-strong);
  }
}

.install-steps {
  display: grid;
  gap: 0.875rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.install-steps li {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.install-steps__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand-text);
}

/* =============================================================================================
 * 22. Utilities
 * ============================================================================================= */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.text-success { color: var(--success-text) !important; }
.text-danger { color: var(--danger-text) !important; }
.text-warning { color: var(--warning-text) !important; }
.text-brand { color: var(--brand-text) !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.w-full { width: 100% !important; }
.nowrap { white-space: nowrap !important; }
.mono { font-family: var(--font-mono) !important; }
.tabular { font-variant-numeric: tabular-nums !important; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 639.98px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 640px) {
  .show-mobile {
    display: none !important;
  }
}

/* Offline page (public_html/offline.html) */
.offline {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem var(--gutter);
  background: radial-gradient(60% 50% at 50% 0%, color-mix(in oklab, var(--brand) 12%, transparent), transparent 70%), var(--bg);
  text-align: center;
}

.offline__card {
  display: grid;
  justify-items: center;
  gap: 1rem;
  max-width: 28rem;
}

.offline__mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 16px 40px -12px var(--brand-glow);
}

.offline__card h1 {
  margin: 0.5rem 0 0;
  font-size: var(--fs-3xl);
}

.offline__card p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}

/* Scroll-reveal (app.js adds .is-revealed; content stays visible without JS) */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* =============================================================================================
 * 23. PWA, motion & print
 * ============================================================================================= */

.is-standalone [data-install] {
  display: none !important;
}

.is-standalone .site-header {
  padding-top: env(safe-area-inset-top, 0px);
}

@media (display-mode: window-controls-overlay) {
  .site-header,
  .admin-topbar {
    -webkit-app-region: drag;
    app-region: drag;
    padding-left: env(titlebar-area-x, 0px);
    padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw));
  }

  .site-header a,
  .site-header button,
  .site-header form,
  .site-header summary,
  .nav-dropdown__panel,
  .admin-topbar a,
  .admin-topbar button,
  .admin-topbar form,
  .admin-topbar input {
    -webkit-app-region: no-drag;
    app-region: no-drag;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

@keyframes ring-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px var(--brand-ring-soft);
  }

  50% {
    box-shadow: 0 0 0 7px color-mix(in oklab, var(--brand) 8%, transparent);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes flash-bg {
  from {
    background: var(--brand-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  html,
  body,
  .admin-body {
    background: #fff !important;
    color: #000 !important;
  }

  .announce,
  .site-header,
  .mobile-nav,
  .site-footer,
  .admin-sidebar,
  .admin-backdrop,
  .admin-topbar,
  .toast-region,
  .skip-link,
  .nav-toggle,
  .theme-toggle,
  .form-actions,
  [data-install],
  .btn,
  .alert__close {
    display: none !important;
  }

  .admin {
    display: block;
  }

  .card,
  .plan,
  .table-wrap,
  .summary-card,
  .kpi,
  .stat,
  .cred {
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .hero::before,
  .hero::after,
  .hero__visual::before {
    display: none;
  }

  a {
    color: inherit;
  }

  .prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
}
