@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/inter-tight.9ba14fec0e316e97.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/jetbrains-mono.6c792368e23baeb4.woff2') format('woff2');
}

/* ==========================================================================
   OpenSteward — Design Tokens
   Light-first, with dark mode via [data-theme="dark"]
   --------------------------------------------------------------------------
   Philosophy: this is infrastructure. The palette is intentionally restrained
   so consuming companies can wrap their own brand around it with minimal
   friction. Color carries meaning, not decoration.
   ========================================================================== */

/* ---- Typography ------------------------------------------------------- */
/* Self-hosted OFL fonts — TTFs in fonts/ */
:root {
  /* --- Font families --- */
  --font-sans: 'Inter Tight', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  /* --- Type scale (major third, 1.200) --- */
  --text-xs:   0.75rem;   /* 12 */
  --text-sm:   0.8125rem; /* 13 */
  --text-base: 0.9375rem; /* 15 — intentionally < 16 for density */
  --text-md:   1rem;      /* 16 */
  --text-lg:   1.125rem;  /* 18 */
  --text-xl:   1.375rem;  /* 22 */
  --text-2xl:  1.75rem;   /* 28 */
  --text-3xl:  2.25rem;   /* 36 */
  --text-4xl:  3rem;      /* 48 */
  --text-5xl:  4rem;      /* 64 */

  --leading-tight:  1.15;
  --leading-snug:   1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  --tracking-tight:  -0.02em;
  --tracking-snug:   -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.02em;
  --tracking-caps:   0.08em;

  /* ========================================================================
     COLORS — Light (default)
     A warm near-paper white + warm grayscale. Primary is a deep forest that
     reads as "open source terminal" without being clichéd green.
     ======================================================================== */

  /* --- Warm neutrals (the foundation) --- */
  --paper:      #FAF9F6;   /* app bg, warm white */
  --surface-0:  #FFFFFF;   /* cards, elevated */
  --surface-1:  #F3F1EC;   /* subtle fills, code blocks bg */
  --surface-2:  #E8E5DE;   /* hover on surface-1 */
  --surface-3:  #D9D5CB;   /* pressed / active */

  --border-subtle: #EBE8E1;
  --border-default: #DAD6CB;
  --border-strong:  #B8B2A3;

  --fg-1: #17180F;   /* primary text */
  --fg-2: #46483A;   /* secondary text, body */
  --fg-3: #73746A;   /* tertiary, metadata */
  --fg-4: #A5A599;   /* placeholder, disabled */
  --fg-on-accent: #FAF9F6;

  /* --- Primary (deep forest — "terminal green grown up") --- */
  --accent-50:  #F1F5EE;
  --accent-100: #DDE7D3;
  --accent-200: #B9CDA6;
  --accent-300: #90AE78;
  --accent-400: #6B8E56;
  --accent-500: #4E7340;   /* primary action */
  --accent-600: #3D5A33;   /* primary hover */
  --accent-700: #2F4627;
  --accent-800: #1F2E19;
  --accent-900: #142010;

  --accent:        var(--accent-500);
  --accent-hover:  var(--accent-600);
  --accent-muted:  var(--accent-100);
  --accent-fg:     var(--accent-700);

  /* --- Semantic colors --- */
  --success:    #3D7A47;
  --success-bg: #E5F0E2;
  --success-fg: #1F4527;

  --warning:    #B5751E;
  --warning-bg: #FBEFD7;
  --warning-fg: #5C3A0E;

  --danger:     #B33A2A;
  --danger-bg:  #FBE4DF;
  --danger-fg:  #651A10;

  --info:       #2F6AA8;
  --info-bg:    #E2EDF8;
  --info-fg:    #1A3F66;

  /* --- Vertical accent colors (each vertical has an identity) ---
     Used only as subtle accents in icon tiles / tags. Muted by design. */
  --vertical-crm:       #B84A7A;   /* rose */
  --vertical-crm-bg:    #FBE8F0;
  --vertical-accounting:    #4E7340;   /* forest (matches brand) */
  --vertical-accounting-bg: #E7F0DF;
  --vertical-logistics:     #2F6AA8;   /* steel blue */
  --vertical-logistics-bg:  #E2EDF8;
  --vertical-ecommerce:     #B5751E;   /* amber */
  --vertical-ecommerce-bg:  #FBEFD7;
  --vertical-payments:      #4A5BA6;   /* indigo */
  --vertical-payments-bg:   #E4E8F4;
  --vertical-docsign:       #3E6F8A;   /* slate-teal — distinct from logistics steel-blue + payments indigo */
  --vertical-docsign-bg:    #DEEAF0;
  --vertical-projects:      #C56A50;   /* terracotta */
  --vertical-projects-bg:   #F5E1D8;
  --vertical-customer-support: #C75D7B;   /* warm rose */
  --vertical-customer-support-bg: #F4D9E2;
  --vertical-inventory: #8A8A2C;   /* olive */
  --vertical-inventory-bg: #E8E8C6;
  --vertical-hr:            #864A24;   /* burnt sienna */
  --vertical-hr-bg:         #F3E2D4;
  --vertical-comms:         #2F7A79;   /* teal */
  --vertical-comms-bg:      #DDECEC;

  /* --- Elevation / shadows --- */
  --shadow-xs: 0 1px 0 0 rgba(23, 24, 15, 0.04);
  --shadow-sm: 0 1px 2px 0 rgba(23, 24, 15, 0.05), 0 0 0 1px rgba(23, 24, 15, 0.04);
  --shadow-md: 0 2px 4px -1px rgba(23, 24, 15, 0.06), 0 4px 12px -2px rgba(23, 24, 15, 0.08);
  --shadow-lg: 0 8px 16px -4px rgba(23, 24, 15, 0.08), 0 20px 40px -8px rgba(23, 24, 15, 0.12);
  --shadow-focus: 0 0 0 3px rgba(78, 115, 64, 0.22);

  /* --- Radii --- */
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* --- Spacing (4px base) --- */
  --space-0: 0;
  --space-0_5: 2px;
  --space-1: 4px;
  --space-1_5: 6px;
  --space-2: 8px;
  --space-2_5: 10px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* --- Motion --- */
  --ease-out:    cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:    120ms;
  --dur-base:    180ms;
  --dur-slow:    280ms;

  /* --- Layout --- */
  --content-max:  1200px;
  --content-read: 680px;  /* prose width */
  --sidebar-w:    248px;
}

/* ==========================================================================
   DARK MODE — warm dark, not cool gray
   ──────────────────────────────────────────────────────────────────────────
   Surfaces keep the warm temperature of light mode via oklch hue=70;
   semantic hues sit at L≥0.72 so badges pass WCAG AA on charcoal;
   shadows include a subtle rim-light highlight so elevation reads.
   ========================================================================== */
[data-theme="dark"] {
  --paper:           oklch(0.18 0.012 70);
  --surface-0:       oklch(0.22 0.012 70);
  --surface-1:       oklch(0.25 0.014 70);
  --surface-2:       oklch(0.29 0.016 70);
  --surface-3:       oklch(0.34 0.018 70);

  --border-subtle:   oklch(0.30 0.014 70);
  --border-default:  oklch(0.36 0.016 70);
  --border-strong:   oklch(0.48 0.018 70);

  --fg-1:            oklch(0.96 0.008 80);
  --fg-2:            oklch(0.78 0.010 80);
  --fg-3:            oklch(0.58 0.010 80);
  --fg-4:            oklch(0.42 0.010 80);
  --fg-on-accent:    oklch(0.16 0.04 150);

  --accent:          oklch(0.74 0.13 150);
  --accent-hover:    oklch(0.82 0.13 150);
  --accent-muted:    oklch(0.30 0.06 150);
  --accent-fg:       oklch(0.82 0.13 150);
  --accent-50:       oklch(0.26 0.04 150);
  --accent-100:      oklch(0.30 0.06 150);
  --accent-200:      oklch(0.36 0.09 150);
  --accent-300:      oklch(0.46 0.10 150);
  --accent-400:      oklch(0.58 0.12 150);
  --accent-500:      var(--accent);
  --accent-700:      oklch(0.84 0.13 150);
  --accent-800:      oklch(0.90 0.13 150);

  --success:         oklch(0.74 0.16 150);
  --warning:         oklch(0.82 0.15 75);
  --danger:          oklch(0.72 0.17 25);
  --info:            oklch(0.76 0.13 235);

  --success-bg:      color-mix(in srgb, var(--success) 18%, var(--surface-0));
  --warning-bg:      color-mix(in srgb, var(--warning) 16%, var(--surface-0));
  --danger-bg:       color-mix(in srgb, var(--danger)  16%, var(--surface-0));
  --info-bg:         color-mix(in srgb, var(--info)    16%, var(--surface-0));

  /* Status-token foregrounds (.badge--*, .alert--*, .field__error, etc.).
     Lifted to L≈0.86 so the text reads on the dark tinted-surface bg
     above. Without these, the light-mode `*-fg` values (e.g. #1F4527
     forest) bleed through and render dark-on-dark — unreadable. */
  --success-fg:      oklch(0.86 0.14 150);
  --warning-fg:      oklch(0.90 0.14 75);
  --danger-fg:       oklch(0.86 0.14 25);
  --info-fg:         oklch(0.88 0.10 235);

  --hover-overlay:   color-mix(in srgb, var(--fg-1) 6%, transparent);
  --pressed-overlay: color-mix(in srgb, var(--fg-1) 12%, transparent);
  --focus-ring:      0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);

  --shadow-xs: 0 1px 0 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 0 0 color-mix(in srgb, #fff 4%, transparent), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 1px 0 0 color-mix(in srgb, #fff 6%, transparent), 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 1px 0 0 color-mix(in srgb, #fff 8%, transparent), 0 12px 32px rgba(0,0,0,0.55);
  --shadow-focus: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);

  /* ─── Payments — dark mode ────────────────────────────────────────────
     L 0.75 / chroma 0.10 / hue 270 (indigo). Same L band as the other
     vertical tokens, lifted for dark-surface contrast. */
  --vertical-payments:    oklch(0.75 0.10 270);
  --vertical-payments-bg: oklch(0.30 0.04 270);

  /* ─── Docsign — dark mode ─────────────────────────────────────────────
     L 0.75 / chroma 0.06 / hue 220 (slate-teal). Same L band as the
     other vertical tokens. */
  --vertical-docsign:    oklch(0.75 0.06 220);
  --vertical-docsign-bg: oklch(0.30 0.03 220);

  /* ─── Projects — dark mode ───
     L 0.75 / chroma 0.08 / hue 35 (terracotta). */
  --vertical-projects:    oklch(0.75 0.08 35);
  --vertical-projects-bg: oklch(0.30 0.04 35);

  /* ─── Customer Support — dark mode ──
     L 0.75 / chroma 0.07 / hue 0 (warm rose). */
  --vertical-customer-support:    oklch(0.75 0.07 0);
  --vertical-customer-support-bg: oklch(0.30 0.04 0);

  /* ─── Inventory — dark mode ────
     L 0.75 / chroma 0.07 / hue 110 (olive). */
  --vertical-inventory:    oklch(0.75 0.07 110);
  --vertical-inventory-bg: oklch(0.30 0.04 110);

  /* ─── Brand asset gradients · dark variants ───────────────────────────
     Consumed by the dark OG / README / hero exporters. Each pair is
     "start", "end" of a 135° linear gradient. The 1280×640 social card
     uses the forest-dark gradient (--og-grad-dark-*), so it has no
     dedicated pair. */
  --og-grad-dark-1:     oklch(0.18 0.012 70);
  --og-grad-dark-2:     oklch(0.22 0.014 70);
  --readme-grad-dark-1: oklch(0.18 0.012 70);
  --readme-grad-dark-2: oklch(0.22 0.04 150);
  --hero-grad-dark-1:   oklch(0.20 0.012 70);
  --hero-grad-dark-2:   oklch(0.16 0.012 70);

  /* ─── Wordmark on dark · explicit alias ───────────────────────────────
     Live wordmark uses currentColor + 500/700 weight pair so it picks
     up var(--fg-1) automatically in both themes. This token exists for
     PNG/SVG exports where the colour has to be baked into the file. */
  --wordmark-fg-dark:   var(--fg-1);
}

/* ==========================================================================
   SEMANTIC TYPE — headings, body, code
   ========================================================================== */
html { color-scheme: light; }
[data-theme="dark"] html, html[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--fg-1);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";  /* Inter Tight alt letters */
}

h1, .h1 {
  font-family: var(--font-sans);
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 600;
  color: var(--fg-1);
  text-wrap: balance;
}

h2, .h2 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 600;
  color: var(--fg-1);
  text-wrap: balance;
}

h3, .h3 {
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  font-weight: 600;
  color: var(--fg-1);
}

h4, .h4 {
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  font-weight: 600;
  color: var(--fg-1);
}

h5, .h5 {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: 600;
  color: var(--fg-1);
}

h6, .h6, .eyebrow {
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  font-weight: 600;
  color: var(--fg-3);
}

p, .body {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--fg-2);
  text-wrap: pretty;
}

.body-sm { font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--fg-2); }
.caption { font-size: var(--text-xs); color: var(--fg-3); line-height: var(--leading-snug); }

.lead {
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  color: var(--fg-2);
  font-weight: 400;
  letter-spacing: var(--tracking-snug);
}

/* Display — marketing hero only */
.display {
  font-family: var(--font-sans);
  font-size: var(--text-5xl);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--fg-1);
  text-wrap: balance;
}

/* Monospace */
code, kbd, pre, samp, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-feature-settings: "calt", "zero";
}

code {
  background: var(--surface-1);
  color: var(--fg-1);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

pre {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow: auto;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--fg-1);
}
pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }

kbd {
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 0.1em 0.5em;
  font-size: 0.85em;
  color: var(--fg-2);
}

a {
  color: var(--accent-fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in oklab, var(--accent-fg), transparent 60%);
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-8) 0;
}

::selection { background: var(--accent-200); color: var(--accent-800); }

/* Focus ring (accessibility baseline) */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Focus, motion, z-index, and control-sizing tokens
   ========================================================================== */

:root {
  /* ── Focus & selection ──────────────────────────────────────────────── */
  --focus-ring:        0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --focus-ring-danger: 0 0 0 3px color-mix(in srgb, var(--danger) 35%, transparent);
  --focus-ring-info:   0 0 0 3px color-mix(in srgb, var(--info)   35%, transparent);
  --selection-bg:      color-mix(in srgb, var(--accent) 22%, transparent);

  /* ── Interaction tints ──────────────────────────────────────────────── */
  --hover-overlay:     color-mix(in srgb, var(--fg-1) 4%, transparent);
  --pressed-overlay:   color-mix(in srgb, var(--fg-1) 8%, transparent);
  --selected-bg:       color-mix(in srgb, var(--accent) 8%, transparent);
  --selected-fg:       var(--accent-fg);

  /* ── Status dots ────────────────────────────────────────────────────── */
  --dot-healthy:       var(--success);
  --dot-warning:       var(--warning);
  --dot-error:         var(--danger);
  --dot-info:          var(--info);
  --dot-neutral:       var(--fg-3);
  --dot-syncing:       var(--accent);

  /* ── Motion ─────────────────────────────────────────────────────────── */
  --motion-fast:       120ms;
  --motion-base:       200ms;
  --motion-slow:       320ms;
  --ease-out:          cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:       cubic-bezier(0.65, 0, 0.35, 1);

  /* ── Z-index layers ─────────────────────────────────────────────────── */
  --z-sticky:          100;
  --z-overlay:         900;
  --z-modal:           1000;
  --z-toast:           1100;
  --z-tooltip:         1200;

  /* ── Form sizing ─────────────────────────────────────────────────────── */
  --control-h-sm:      28px;
  --control-h-md:      36px;
  --control-h-lg:      44px;          /* WCAG touch target */
  --control-px:        12px;

  /* ── Density aliases ─────────────────────────────────────────────────── */
  --gutter-tight:      var(--space-2);
  --gutter-default:    var(--space-4);
  --gutter-loose:      var(--space-6);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-base: 0ms;
    --motion-slow: 0ms;
  }
}

/* ==========================================================================
   OpenSteward · Design System
   Docs-server tokens
   ──────────────────────────────────────────────────────────────────────────
   HTTP method colors, code blocks, Mermaid theme, OG gradients.
   ========================================================================== */

:root {
  /* ── HTTP method colors ────────────────────────────────────────────────
     Aliases over the semantic palette so the swagger theme has one source
     of truth and the .method-pill component reads from tokens. The five
     overlapping methods reuse existing semantic colors; PATCH and HEAD get
     unique hues so the seven verbs are visually distinct.
     ──────────────────────────────────────────────────────────────────── */
  --method-get:     var(--info);
  --method-post:    var(--success);
  --method-put:     var(--warning);
  --method-patch:   oklch(0.55 0.10 200);   /* teal */
  --method-delete:  var(--danger);
  --method-head:    oklch(0.55 0.10 290);   /* violet */
  --method-options: var(--fg-3);

  /* ── Code-block colors ────────────────────────────────────────────────
     Always dark per dev-docs convention, but tokenised so the swagger
     theme and .code-tabs share one source of truth. */
  --code-bg:             oklch(0.18 0.012 70);
  --code-fg:             oklch(0.94 0.008 80);
  --code-token-string:   oklch(0.84 0.10 150);
  --code-token-number:   oklch(0.82 0.12  60);
  --code-token-keyword:  oklch(0.80 0.10 290);
  --code-token-property: oklch(0.78 0.04  80);
  --code-token-comment:  oklch(0.58 0.02  80);

  /* ── Mermaid theme variables ──────────────────────────────────────────
     Consumed by guides.ts when calling mermaid.initialize(). The mermaid
     library reads themeVariables at initialisation; we feed it tokens so
     diagrams reflect the page theme automatically. */
  --mermaid-bg:           var(--surface-1);
  --mermaid-node-fill:    var(--surface-0);
  --mermaid-node-stroke:  var(--border-default);
  --mermaid-node-text:    var(--fg-1);
  --mermaid-line:         var(--fg-3);
  --mermaid-edge-text:    var(--fg-2);
  /* per-vertical fills used by classDef aux/vert/side in the markdown */
  --mermaid-aux-fill:     var(--info-bg);
  --mermaid-aux-stroke:   color-mix(in srgb, var(--info) 30%, transparent);
  --mermaid-aux-text:     var(--info-fg);
  --mermaid-vert-fill:    var(--accent-50);
  --mermaid-vert-stroke:  var(--accent-200);
  --mermaid-vert-text:    var(--accent-fg);
  --mermaid-side-fill:    oklch(0.92 0.04 290);
  --mermaid-side-stroke:  oklch(0.70 0.07 290);
  --mermaid-side-text:    oklch(0.30 0.10 290);

  /* ── OG / share-image gradients ──────────────────────────────────────
     For the per-page OG image generator (run at build time). */
  --og-grad-1: var(--accent-700);
  --og-grad-2: var(--accent-900);
}

/* ── Dark-mode overrides for the docs additions ────────────────────────── */
[data-theme="dark"] {
  --code-bg:             oklch(0.14 0.010 70);
  --code-fg:             oklch(0.94 0.008 80);

  --mermaid-bg:          oklch(0.25 0.014 70);
  --mermaid-node-fill:   oklch(0.22 0.012 70);
  --mermaid-node-stroke: oklch(0.40 0.018 70);
  --mermaid-node-text:   oklch(0.96 0.008 80);
  --mermaid-line:        oklch(0.62 0.010 80);
  --mermaid-edge-text:   oklch(0.84 0.008 80);

  --mermaid-aux-fill:    oklch(0.30 0.05 220);
  --mermaid-aux-stroke:  oklch(0.48 0.10 220);
  --mermaid-aux-text:    oklch(0.92 0.04 220);
  --mermaid-vert-fill:   oklch(0.30 0.05 150);
  --mermaid-vert-stroke: oklch(0.48 0.10 150);
  --mermaid-vert-text:   oklch(0.92 0.04 150);
  --mermaid-side-fill:   oklch(0.30 0.05 310);
  --mermaid-side-stroke: oklch(0.48 0.10 310);
  --mermaid-side-text:   oklch(0.92 0.04 310);
}

/* ==========================================================================
   OpenSteward — base styles
   Resets + body + universal behaviors. Import after tokens.css.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
[data-theme="dark"] html, html[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--fg-1);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

img, svg, video { max-width: 100%; display: block; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

::selection { background: var(--accent-200); color: var(--accent-800); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   OpenSteward — component styles
   BEM-style component classes for the OpenSteward design system.
   Import after tokens.css + base.css.
   ========================================================================== */

/* ---- Button -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn--lg { height: 44px; padding: 0 20px; font-size: 14px; }

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

.btn--secondary {
  background: var(--surface-0);
  color: var(--fg-1);
  border-color: var(--border-default);
}
.btn--secondary:hover:not(:disabled) { background: var(--surface-1); }

.btn--ghost {
  background: transparent;
  color: var(--fg-2);
}
.btn--ghost:hover:not(:disabled) { background: var(--surface-1); color: var(--fg-1); }

.btn--danger {
  background: var(--surface-0);
  color: var(--danger-fg);
  border-color: var(--border-default);
}
.btn--danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }

/* ---- Input --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-1);
  letter-spacing: -0.005em;
}
.field__hint { font-size: var(--text-xs); color: var(--fg-3); }
.field__error { font-size: var(--text-xs); color: var(--danger-fg); }

.input, .select, .textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg-1);
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; line-height: var(--leading-normal); }
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input--invalid, .select--invalid, .textarea--invalid {
  border-color: #D48C7F;
  box-shadow: 0 0 0 3px rgba(179, 58, 42, 0.12);
}

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

/* ---- Badge / Tag --------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--fg-2);
}
.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--fg-3);
  flex-shrink: 0;
}
.badge--success { background: var(--success-bg); color: var(--success-fg); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.badge--success .badge__dot { background: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning-fg); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.badge--warning .badge__dot { background: var(--warning); }
.badge--danger { background: var(--danger-bg); color: var(--danger-fg); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge--danger .badge__dot { background: var(--danger); }
.badge--info { background: var(--info-bg); color: var(--info-fg); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.badge--info .badge__dot { background: var(--info); }
.badge--accent { background: var(--accent-100); color: var(--accent-700); border-color: var(--accent-200); }
.badge--accent .badge__dot { background: var(--accent-500); }

/* ---- Card ---------------------------------------------------------------- */
.card {
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
}
.card--elevated { border: 0; box-shadow: var(--shadow-sm); }
.card--list { padding: 16px; }
.card--marketing { border-radius: var(--radius-lg); padding: 24px; }

.card__header { display: flex; align-items: start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.card__title { font-size: var(--text-lg); font-weight: 600; color: var(--fg-1); margin: 0; }
.card__subtitle { font-size: var(--text-sm); color: var(--fg-3); margin: 4px 0 0; }

/* ---- Vertical tile (icon container keyed by vertical) -------------------- */
.vtile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  background: var(--surface-1);
  color: var(--fg-2);
}
.vtile--lg { width: 48px; height: 48px; border-radius: var(--radius-lg); font-size: 15px; }
.vtile--sm { width: 28px; height: 28px; border-radius: var(--radius-sm); font-size: 11px; }
.vtile--xs { width: 20px; height: 20px; border-radius: var(--radius-sm); font-size: 9px; }
.vtile--crm              { background: var(--vertical-crm-bg);              color: var(--vertical-crm); }
.vtile--accounting       { background: var(--vertical-accounting-bg);       color: var(--vertical-accounting); }
.vtile--logistics        { background: var(--vertical-logistics-bg);        color: var(--vertical-logistics); }
.vtile--ecommerce        { background: var(--vertical-ecommerce-bg);        color: var(--vertical-ecommerce); }
.vtile--payments         { background: var(--vertical-payments-bg);         color: var(--vertical-payments); }
.vtile--docsign          { background: var(--vertical-docsign-bg);          color: var(--vertical-docsign); }
.vtile--projects         { background: var(--vertical-projects-bg);         color: var(--vertical-projects); }
.vtile--customer-support { background: var(--vertical-customer-support-bg); color: var(--vertical-customer-support); }
.vtile--inventory        { background: var(--vertical-inventory-bg);        color: var(--vertical-inventory); }

/* A platform's logo, boxed to the footprint of the vtile monogram it falls
   back to, so a list mixing logos and monograms lines up. The swap on a
   failed load is done by the page (admin: public/js/platform-logo.js). */
.plogo { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-0); border: 1px solid var(--border-subtle); overflow: hidden; }
.plogo img { width: auto; height: auto; object-fit: contain; }
.plogo--xs { width: 20px; height: 20px; border-radius: var(--radius-sm); }
.plogo--xs img { max-width: 14px; max-height: 14px; }
.plogo--sm { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.plogo--sm img { max-width: 20px; max-height: 20px; }
.plogo--lg { width: 48px; height: 48px; border-radius: var(--radius-lg); }
.plogo--lg img { max-width: 32px; max-height: 32px; }
.vtile--hr               { background: var(--vertical-hr-bg);               color: var(--vertical-hr); }
.vtile--comms            { background: var(--vertical-comms-bg);            color: var(--vertical-comms); }

/* ---- App shell (sidebar + header) --------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--paper);
}

.sidebar {
  border-right: 1px solid var(--border-subtle);
  background: var(--surface-0);
  padding: var(--space-4) var(--space-3);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-default);
  background: var(--surface-0);
  color: var(--fg-1);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 19;
}
.sidebar-backdrop[data-open="true"] { display: block; }
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  font-weight: 600;
  color: var(--fg-1);
  text-decoration: none;
}
.sidebar__brand img { height: 24px; width: auto; }
.sidebar__brand svg.sidebar__mark { height: 24px; width: 24px; color: var(--accent); flex: none; }
.sidebar__group { margin-bottom: var(--space-4); }
.sidebar__eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
  font-weight: 600;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--fg-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}
.sidebar__link:hover { background: var(--surface-1); color: var(--fg-1); }
.sidebar__link--active { background: var(--surface-1); color: var(--fg-1); font-weight: 500; }

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  backdrop-filter: blur(8px);
}
.app-header__meta { display: flex; align-items: center; gap: var(--space-3); color: var(--fg-3); font-size: var(--text-sm); min-width: 0; }
.app-header__meta > span:not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-content {
  max-width: var(--content-max);
  width: 100%;
  padding: var(--space-8) var(--space-6);
  margin: 0 auto;
}

/* ---- App-shell responsive collapse -------------------------------------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    height: 100vh;
    width: min(84vw, 300px);
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }
  .sidebar[data-open="true"] { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .app-header { padding: 0 var(--space-4); gap: var(--space-3); }
  .app-content { padding: var(--space-6) var(--space-4); }
  .app-header__meta { gap: var(--space-2); font-size: var(--text-xs); }
  .app-header__meta .badge { display: none; }
}

@media (max-width: 520px) {
  .app-header__meta > span.muted,
  .app-header__meta > span:not(.badge):not(:last-of-type) { display: none; }
}

/* ---- Auth / centered card layouts --------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background: var(--paper);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

/* ---- Tables -------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; vertical-align: middle; }
.table th {
  color: var(--fg-3);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  border-bottom: 1px solid var(--border-subtle);
}
.table td { border-bottom: 1px solid var(--border-subtle); color: var(--fg-2); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-1); color: var(--fg-1); }

/* ---- Alerts -------------------------------------------------------------- */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--fg-2);
  font-size: var(--text-sm);
}
.alert--success { background: var(--success-bg); color: var(--success-fg); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.alert--warning { background: var(--warning-bg); color: var(--warning-fg); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.alert--danger  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: color-mix(in srgb, var(--danger)  35%, transparent); }
.alert--info    { background: var(--info-bg);    color: var(--info-fg);    border-color: color-mix(in srgb, var(--info)    35%, transparent); }

/* ---- Utility primitives (sparing — composition helpers only) ------------ */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); }
.stack--lg { gap: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: var(--space-4); }
.muted { color: var(--fg-3); }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
  font-weight: 600;
}
.divider { border: 0; border-top: 1px solid var(--border-subtle); margin: var(--space-6) 0; }

/* ==========================================================================
   OpenSteward · Design System
   Admin primitives
   ──────────────────────────────────────────────────────────────────────────
   page-header, status-pill (badge dot), empty-state, kv-list, code-copy,
   filterbar, segmented, choice-card, toast.
   ========================================================================== */

/* ─────────────────────────────────────────────────────────────────────────
   Page header — standard top-of-view layout for admin views (title,
   description, actions).
   ───────────────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.page-header__group     { min-width: 0; }
.page-header__eyebrow {
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
  margin-bottom: 2px;
}
.page-header__title     { font: var(--font-h2); margin: 0; }
.page-header__desc      {
  color: var(--fg-2);
  font-size: var(--text-sm);
  margin-top: 2px;
  margin-bottom: 0;
}
.page-header__actions   {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
   Badge dot — extends existing .badge with a leading status indicator.
   Use with any .badge--<tone> for status pills.
   ───────────────────────────────────────────────────────────────────────── */
.badge { gap: 6px; }
.badge__dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex-shrink: 0;
}
.badge--syncing .badge__dot,
.badge--accent  .badge__dot {
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
  animation: badge-pulse 1.6s var(--ease-in-out) infinite;
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
  50%      { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 8%,  transparent); }
}

/* ─────────────────────────────────────────────────────────────────────────
   Empty state — first-run / zero-results.
   ───────────────────────────────────────────────────────────────────────── */
.empty-state {
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  background: var(--surface-0);
  text-align: center;
}
.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-100);
  color: var(--accent-700);
  margin-bottom: var(--space-3);
}
.empty-state__title {
  font: var(--font-h4);
  margin: 0 0 var(--space-1);
}
.empty-state__body {
  color: var(--fg-2);
  margin: 0 0 var(--space-4);
  max-width: 48ch;
  margin-inline: auto;
}
.empty-state__actions {
  display: inline-flex;
  gap: var(--space-2);
}
.empty-state--no-results {
  padding: var(--space-6);
  border-style: solid;
}
.empty-state--no-results .empty-state__icon { display: none; }

/* ─────────────────────────────────────────────────────────────────────────
   Key/value list — resource detail rows.
   ───────────────────────────────────────────────────────────────────────── */
.kv-list { display: grid; gap: 0; }
.kv-list__row {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) 1fr;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px dotted var(--border-subtle);
  font-size: var(--text-sm);
  align-items: baseline;
}
.kv-list__row:last-child { border-bottom: none; }
.kv-list__key   { color: var(--fg-3); }
.kv-list__value { color: var(--fg-1); }
.kv-list__value .mono { font-size: 0.95em; }
.kv-list--compact .kv-list__row { padding: var(--space-1) 0; }
.kv-list--bordered {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
}

/* ─────────────────────────────────────────────────────────────────────────
   Code copy — long string + copy button.
   ───────────────────────────────────────────────────────────────────────── */
.code-copy { position: relative; }
.code-copy pre,
.code-copy .input--mono {
  margin: 0;
  padding-right: 44px;
  font-family: var(--font-mono);
}
.code-copy__btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-2xs);
  color: var(--fg-2);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out),
              color      var(--motion-fast) var(--ease-out);
}
.code-copy__btn:hover {
  background: var(--surface-1);
  color: var(--fg-1);
}
.code-copy--block .code-copy__btn {
  top: 8px;
  transform: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   Filterbar — list-page filter row.
   ───────────────────────────────────────────────────────────────────────── */
.filterbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.filterbar__divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
}
.filterbar__clear {
  margin-left: auto;
  font-size: var(--text-2xs);
  color: var(--fg-3);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: 0;
}
.filterbar__clear:hover { color: var(--fg-2); }

/* ─────────────────────────────────────────────────────────────────────────
   Segmented control — tab-like selector for 2–4 mutually exclusive options.
   ───────────────────────────────────────────────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}
.segmented__btn {
  padding: 4px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg-3);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.segmented__btn:hover { color: var(--fg-2); }
.segmented__btn[aria-pressed="true"] {
  background: var(--surface-0);
  color: var(--fg-1);
  box-shadow: var(--shadow-sm);
}

/* ─────────────────────────────────────────────────────────────────────────
   Choice card — radio-group card for wizards / settings.
   ───────────────────────────────────────────────────────────────────────── */
.choice-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.choice-card {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  cursor: pointer;
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
.choice-card:hover { background: var(--hover-overlay); }
.choice-card[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-50);
}
.choice-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.choice-card__radio {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-strong);
  margin-top: 2px;
  flex-shrink: 0;
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
.choice-card[aria-checked="true"] .choice-card__radio {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface-0);
}
.choice-card__title { font-weight: 600; color: var(--fg-1); }
.choice-card__desc  { color: var(--fg-2); font-size: var(--text-sm); }
.choice-card[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────────────────
   Toast — transient feedback. Use .toast-stack as fixed container.
   ───────────────────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  color: var(--fg-1);
  min-width: 240px;
  max-width: 360px;
  pointer-events: auto;
  animation: toast-in var(--motion-base) var(--ease-out);
}
.toast__icon  { flex-shrink: 0; }
.toast__body  { flex: 1; }
.toast__close {
  background: none;
  border: 0;
  color: var(--fg-3);
  cursor: pointer;
  padding: 2px;
}
.toast--success { border-left: 3px solid var(--success); }
.toast--success .toast__icon { color: var(--success); }
.toast--danger  { border-left: 3px solid var(--danger);  }
.toast--danger  .toast__icon { color: var(--danger); }
.toast--warning { border-left: 3px solid var(--warning); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info    { border-left: 3px solid var(--info);    }
.toast--info    .toast__icon { color: var(--info); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────────────────────────────────
   Global focus-visible — applies the design-system ring everywhere.
   Place LAST in components.css so specificity wins over per-component rules.
   ───────────────────────────────────────────────────────────────────────── */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
::selection { background: var(--selection-bg); }

/* ==========================================================================
   OpenSteward · Design System
   Docs-server components
   ──────────────────────────────────────────────────────────────────────────
   callout, code tabs, heading anchors, TOC, prev/next nav, method pill,
   search palette, version picker, mobile sidebar, print styles,
   resource modal.
   ========================================================================== */

/* ─────────────────────────────────────────────────────────────────────────
   Callout — in-prose admonition. 5 tones, icon + optional title.
   ───────────────────────────────────────────────────────────────────────── */
.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  border: 1px solid;
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}
.callout__icon  { font-size: 18px; flex-shrink: 0; }
.callout__title { font-weight: 600; margin: 0 0 var(--space-1); }
.callout__body  { margin: 0; }
.callout__body > :first-child { margin-top: 0; }
.callout__body > :last-child  { margin-bottom: 0; }

.callout--note {
  background: var(--info-bg); color: var(--info-fg);
  border-color: color-mix(in srgb, var(--info) 24%, transparent);
  border-left-color: var(--info);
}
.callout--tip {
  background: var(--accent-50); color: var(--accent-fg);
  border-color: var(--accent-200);
  border-left-color: var(--accent);
}
.callout--warning {
  background: var(--warning-bg); color: var(--warning-fg);
  border-color: color-mix(in srgb, var(--warning) 28%, transparent);
  border-left-color: var(--warning);
}
.callout--danger {
  background: var(--danger-bg); color: var(--danger-fg);
  border-color: color-mix(in srgb, var(--danger) 26%, transparent);
  border-left-color: var(--danger);
}
.callout--info {
  background: var(--surface-1); color: var(--fg-2);
  border-color: var(--border-subtle);
  border-left-color: var(--fg-3);
}

/* ─────────────────────────────────────────────────────────────────────────
   Code tabs — multi-language code samples. Persists selection.
   ───────────────────────────────────────────────────────────────────────── */
.code-tabs {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-4) 0;
}
.code-tabs__bar {
  display: flex;
  align-items: center;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--space-1);
}
.code-tabs__btn {
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs, 11px);
  color: var(--fg-3);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color var(--motion-fast, 120ms);
}
.code-tabs__btn:hover { color: var(--fg-2); }
.code-tabs__btn[aria-selected="true"] {
  color: var(--fg-1);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.code-tabs__copy {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--text-2xs, 11px);
  color: var(--fg-3);
  background: none;
  border: 0;
  cursor: pointer;
}
.code-tabs__panel { display: none; }
.code-tabs__panel[data-active="true"] { display: block; }
.code-tabs pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--code-bg);
  color: var(--code-fg);
}

/* ─────────────────────────────────────────────────────────────────────────
   Heading anchor — visible-on-hover # marker.
   ───────────────────────────────────────────────────────────────────────── */
.heading-anchor {
  margin-left: var(--space-2);
  color: var(--fg-4);
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.7em;
  opacity: 0;
  transition: opacity var(--motion-fast, 120ms);
}
:is(h1, h2, h3, h4):hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; color: var(--accent-fg); }

/* ─────────────────────────────────────────────────────────────────────────
   TOC (on-this-page rail).
   ───────────────────────────────────────────────────────────────────────── */
.toc {
  font-size: var(--text-sm);
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.toc__title {
  font-size: var(--text-2xs, 11px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
  margin-bottom: var(--space-2);
}
.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc__list li { padding: 0; margin: 0; }
.toc__link {
  display: block;
  padding: 2px var(--space-2);
  margin-left: -2px;
  color: var(--fg-3);
  border-left: 2px solid transparent;
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--motion-fast, 120ms);
}
.toc__link:hover { color: var(--fg-2); }
.toc__link[aria-current="true"] {
  color: var(--accent-fg);
  border-left-color: var(--accent);
  font-weight: 500;
}
.toc__link--depth-2 { padding-left: var(--space-5); }
.toc__link--depth-3 { padding-left: var(--space-8); }

/* ─────────────────────────────────────────────────────────────────────────
   Prev/next nav pair.
   ───────────────────────────────────────────────────────────────────────── */
.docs-nav-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-top: var(--space-6);
}
.docs-nav-pair__link {
  display: block;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--motion-fast, 120ms);
}
.docs-nav-pair__link:hover { border-color: var(--border-strong); }
.docs-nav-pair__link--next { text-align: right; }
.docs-nav-pair__label {
  display: block;
  font-size: var(--text-2xs, 11px);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-3);
}
.docs-nav-pair__title {
  display: block;
  margin-top: var(--space-1);
  color: var(--fg-1);
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

/* ─────────────────────────────────────────────────────────────────────────
   Doc meta strip.
   ───────────────────────────────────────────────────────────────────────── */
.doc-meta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  margin-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--fg-3);
}
.doc-meta-strip a { color: var(--accent-fg); }

/* ─────────────────────────────────────────────────────────────────────────
   Skip link.
   ───────────────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--accent);
  color: var(--fg-on-accent);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  z-index: var(--z-toast, 1100);
  transform: translateY(-150%);
  transition: transform var(--motion-fast, 120ms);
}
.skip-link:focus { transform: translateY(0); }

/* ─────────────────────────────────────────────────────────────────────────
   Method pill — HTTP verb badge.
   ───────────────────────────────────────────────────────────────────────── */
.method-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 3px var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs, 11px);
  font-weight: 600;
  color: var(--fg-on-accent);
  background: var(--fg-3);
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}
.method-pill--get     { background: var(--method-get); }
.method-pill--post    { background: var(--method-post); }
.method-pill--put     { background: var(--method-put); }
.method-pill--patch   { background: var(--method-patch); }
.method-pill--delete  { background: var(--method-delete); }
.method-pill--head    { background: var(--method-head); }
.method-pill--options { background: var(--method-options); }

/* ─────────────────────────────────────────────────────────────────────────
   Search palette — ⌘K overlay.
   ───────────────────────────────────────────────────────────────────────── */
.search-palette {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
  background: color-mix(in srgb, var(--fg-1) 35%, transparent);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal, 1000);
}
.search-palette[hidden] { display: none; }
.search-palette__box {
  width: min(560px, 92vw);
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: search-palette-in var(--motion-base, 200ms) var(--ease-out, ease);
}
@keyframes search-palette-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.search-palette__input-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}
.search-palette__input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--fg-1);
  outline: none;
}
.search-palette__results {
  padding: 4px;
  max-height: 60vh;
  overflow-y: auto;
}
.search-palette__result {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.search-palette__result:hover,
.search-palette__result[aria-selected="true"] { background: var(--surface-1); }
.search-palette__result strong { display: block; color: var(--fg-1); }
.search-palette__result span   { display: block; color: var(--fg-3); font-size: var(--text-2xs, 11px); font-family: var(--font-mono); }
.search-palette__footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-2xs, 11px);
  color: var(--fg-3);
}
.search-palette__empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--fg-3);
  font-size: var(--text-sm);
}

/* ─────────────────────────────────────────────────────────────────────────
   Version picker — dropdown for switching docs versions (styles only;
   no menu logic is wired up).
   ───────────────────────────────────────────────────────────────────────── */
.version-picker {
  position: relative;
  display: inline-block;
}
.version-picker__trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-2xs, 11px);
  color: var(--fg-1);
  cursor: pointer;
}
.version-picker__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  padding: var(--space-1);
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: var(--z-overlay, 900);
}
.version-picker__item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-1_5, 6px) var(--space-2);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--fg-2);
}
.version-picker__item:hover { background: var(--surface-1); color: var(--fg-1); }
.version-picker__item[aria-current="true"] { color: var(--fg-1); font-weight: 500; }
.version-picker__age { font-size: var(--text-2xs, 11px); color: var(--fg-3); }

/* ─────────────────────────────────────────────────────────────────────────
   Mobile sidebar disclosure — collapses guides nav into a <details>.
   ───────────────────────────────────────────────────────────────────────── */
.guides-sidebar-mobile {
  display: none;
  margin: var(--space-3) 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.guides-sidebar-mobile summary {
  padding: var(--space-2) var(--space-3);
  background: var(--surface-1);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--text-sm);
}
.guides-sidebar-mobile ul {
  list-style: none;
  padding: var(--space-2);
  margin: 0;
}
.guides-sidebar-mobile a {
  display: block;
  padding: var(--space-1_5, 6px) var(--space-2);
  text-decoration: none;
  color: var(--fg-2);
  font-size: var(--text-sm);
}
@media (max-width: 880px) {
  .guides-sidebar { display: none; }
  .guides-sidebar-mobile { display: block; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Print stylesheet — hide chrome, force light, expand details.
   ───────────────────────────────────────────────────────────────────────── */
@media print {
  .oi-nav,
  .guides-sidebar,
  .guides-sidebar-mobile,
  .toc,
  .search-palette,
  .skip-link,
  .docs-nav-pair,
  .doc-meta-strip a { display: none !important; }
  details > summary { list-style: none; }
  details:not([open]) > summary::after { content: ' (expanded for print)'; }
  details:not([open]) > * { display: revert !important; }
  body { background: white; color: black; }
  pre, code { background: #f4f4f4; color: black; border: 1px solid #ddd; }
  .callout { break-inside: avoid; }
  a::after { content: ' (' attr(href) ')'; font-size: 0.85em; color: #666; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Resource modal — a detail page shown in a dialog instead of navigated to.
   Filled at click time by the admin app's public/js/resource-modal.js, which
   lifts `main.app-content` out of the fetched page; the markup here is the
   empty shell (views/_resource-modal.ejs).
   ───────────────────────────────────────────────────────────────────────── */
.resource-modal {
  width: min(760px, 92vw);
  max-height: 86vh;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-0);
  color: var(--fg-1);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
/* Only when open: a bare `display: flex` would defeat the UA rule that keeps a
   closed <dialog> hidden, and the shell ships on every signed-in page. */
.resource-modal[open] {
  display: flex;
  flex-direction: column;
  /* --motion-base collapses to 0ms under prefers-reduced-motion (tokens.css),
     so the preference is honoured by opting into the token rather than by
     repeating the media query here. */
  animation: resource-modal-in var(--motion-base, 200ms) var(--ease-out, ease);
}
@keyframes resource-modal-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Literal ink rather than var(--fg-1): ::backdrop only started inheriting from
   its originating element recently, and in the browsers that predate that a
   token here resolves to nothing and the backdrop disappears. */
.resource-modal::backdrop {
  background: color-mix(in srgb, #17180F 45%, transparent);
  backdrop-filter: blur(2px);
}
.resource-modal__bar {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  padding: var(--space-3) var(--space-3) 0;
}
.resource-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  font-size: 18px;
}
.resource-modal__close:hover { background: var(--surface-1); color: var(--fg-1); }
.resource-modal__body {
  padding: 0 var(--space-6) var(--space-6);
  overflow-y: auto;
}
/* The extracted content leads with the detail page's own <h1>, which carries
   the page's top margin. Inside the dialog the close bar already provides it. */
.resource-modal__body > :first-child { margin-top: 0; }


/* ==========================================================================
   License service layer, over the design system above
   ========================================================================== */

/* Tokens components.css uses but tokens.css does not define (the admin console's page-header
   title and empty-state title fall back to the body font without them). */
:root {
  --text-2xs: 0.6875rem;
  --font-h2: 600 var(--text-3xl) / var(--leading-tight) var(--font-sans);
  --font-h4: 600 var(--text-xl) / var(--leading-snug) var(--font-sans);
}

[hidden] { display: none !important; }

/* ---- Icons (Phosphor, from the sprite) ---------------------------------- */
.icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: currentColor;
  vertical-align: -0.2em;
}
.btn .icon { width: 16px; height: 16px; }
.btn--sm .icon { width: 14px; height: 14px; }

/* ---- Brand --------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--fg-1);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--fg-1); }
.brand__mark { width: 24px; height: 24px; color: var(--accent); flex: none; }
.brand__product { color: var(--fg-3); font-weight: 400; }

/* ---- Skip link and main --------------------------------------------------- */
main:focus, main:focus-visible { outline: none; box-shadow: none; }
.page-body { display: flex; flex-direction: column; gap: var(--space-5); }
.page-body > * { margin-block: 0; }

/* ---- Signed-in shell: the admin console's sidebar, header and content ---- */
.sidebar { display: flex; flex-direction: column; }
.sidebar__brand { white-space: nowrap; }
.sidebar__link .icon { width: 16px; height: 16px; color: var(--fg-3); }
.sidebar__link--active .icon, .sidebar__link:hover .icon { color: var(--fg-1); }
.sidebar__org {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-1);
  min-width: 0;
}
.sidebar__org span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__org .icon { width: 16px; height: 16px; color: var(--fg-3); }
.sidebar__sublinks { margin: 0 0 var(--space-2) var(--space-4); padding-left: var(--space-2); border-left: 1px solid var(--border-subtle); }
.sidebar__link span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__footer {
  margin-top: auto;
  padding: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  color: var(--fg-3);
}
.sidebar__footer a { color: var(--fg-3); }
.sidebar__footer a:hover { color: var(--fg-1); }
.app-header__email { color: var(--fg-2); }
.app-header form { margin: 0; }
.app-header .row { gap: var(--space-2); }
.app-content.page-body { gap: var(--space-5); }

/* Without the script nothing opens the off-canvas menu: on a narrow screen it sits above the
   page instead. */
@media (max-width: 900px) {
  html:not([data-js]) .sidebar {
    position: static;
    width: auto;
    height: auto;
    transform: none;
    box-shadow: none;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* ---- Theme toggle: a moon in light, a sun in dark ----------------------- */
.theme-toggle .icon--sun { display: none; }
[data-theme="dark"] .theme-toggle .icon--sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .icon--moon { display: none; }

/* ---- Signed-out shell ---------------------------------------------------- */
.public-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.public-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 56px;
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  backdrop-filter: blur(8px);
}
.public-header .row { gap: var(--space-2); }
.public-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}
.public-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  color: var(--fg-3);
}
.public-footer a { color: var(--fg-3); }
.public-footer a:hover { color: var(--fg-1); }
@media (max-width: 520px) {
  .public-header { padding: 0 var(--space-4); }
  .public-main { padding: var(--space-6) var(--space-4) var(--space-10); }
  .brand__product { display: none; }
}

/* ---- Page head: eyebrow or back link, title, description, actions ------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}
.page-head__group { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.page-head__group > * { margin: 0; }
.page-head h1 { overflow-wrap: anywhere; }
.page-head__desc { color: var(--fg-3); max-width: 64ch; margin-top: var(--space-1); }
.page-head__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  width: fit-content;
  font-size: var(--text-sm);
  color: var(--fg-3);
  text-decoration: none;
}
.page-head__back:hover { color: var(--fg-1); }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (max-width: 520px) {
  h1 { font-size: var(--text-3xl); }
}

/* ---- Cards ---------------------------------------------------------------- */
.card--section { display: flex; flex-direction: column; gap: var(--space-4); }
.card--section > * { margin-block: 0; }
.card__header { margin-bottom: 0; }
.card__header .actions { flex-shrink: 0; }
.card__note { font-size: var(--text-sm); color: var(--fg-3); }
details.card > summary, .disclosure > summary { cursor: pointer; font-weight: 500; color: var(--fg-1); }
details.card[open] > summary { margin-bottom: var(--space-4); }
.disclosure > summary { width: fit-content; font-size: var(--text-sm); }
.disclosure[open] > summary { margin-bottom: var(--space-3); }
.card-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  align-items: start;
}

/* ---- Running text --------------------------------------------------------- */
.prose > * { margin-block: 0; }
.prose > * + * { margin-top: var(--space-3); }
.prose > h2 { font-size: var(--text-xl); margin-top: var(--space-8); }
.prose > h2.card__title { font-size: var(--text-lg); margin-top: 0; }
.prose > h3 { font-size: var(--text-md); letter-spacing: normal; margin-top: var(--space-6); }
.prose > h2 + *, .prose > h3 + * { margin-top: var(--space-2); }
.prose--read { max-width: var(--content-read); }
main ul, main ol { padding-left: var(--space-5); margin-block: 0; }
main li { color: var(--fg-2); line-height: var(--leading-relaxed); }
main li + li { margin-top: var(--space-1); }
.prose li { font-size: var(--text-md); }
.list-plain { list-style: none; padding-left: 0; }
.list-plain li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
main code { overflow-wrap: anywhere; }
/* No programming ligatures: JetBrains Mono draws "<label>-license.key" with an arrow otherwise,
   and these are file names and commands people retype. */
code, kbd, pre, samp, .mono, .token { font-variant-ligatures: none; font-feature-settings: "zero"; }
pre { margin: 0; }

/* ---- Key/value facts: the design system's kv-list on a <dl> -------------- */
dl.kv-list { margin: 0; }
dl.kv-list dd { margin: 0; overflow-wrap: anywhere; }
.kv-list__value .badge + .badge { margin-left: var(--space-1); }

/* ---- Alerts (notices) ------------------------------------------------------- */
.alert__body { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.alert__body > * { margin: 0; }
.alert p, .alert li { font-size: inherit; line-height: var(--leading-normal); color: inherit; }
.alert a { color: inherit; text-decoration: underline; }
.alert strong { font-weight: 600; }

/* ---- Badges: status pills ------------------------------------------------- */
.badge { white-space: nowrap; }

/* ---- Forms -------------------------------------------------------------- */
.form { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); max-width: 36rem; margin: 0; }
.form > .field, .form > .check, .form > fieldset, .form > .alert { align-self: stretch; }
form.inline { display: inline; margin: 0; }
.field > * { margin: 0; }
.field__error { font-weight: 500; }
.input--invalid:hover { border-color: var(--danger); }
.input--sm, .select--sm {
  height: var(--control-h-sm);
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  width: auto;
  min-width: 0;
}
.check { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-sm); color: var(--fg-1); }
.check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); }
.check label { min-width: 0; }
.check + .field__error { margin-top: calc(var(--space-2) * -1); }
fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
legend { padding: 0 var(--space-1); font-size: var(--text-sm); font-weight: 500; color: var(--fg-1); }

/* Generate's plan follows "What is this license for?" (routes/org.ts planByPurpose): Pro and Free
   for Production, a line saying Free for any other purpose, neither until one is checked. Without
   :has() both parts show; the server gives any other purpose Free whatever plan is ticked. */
.generate-plan { display: flex; flex-direction: column; }
.form > .generate-plan { align-self: stretch; }
.generate-plan--other p { margin: 0; font-size: var(--text-sm); color: var(--fg-1); }
.generate-plan--other .muted { color: var(--fg-3); }
@supports selector(:has(*)) {
  .generate-plan { display: none; }
  #generate-form:has(#license-purpose-production:checked) .generate-plan--production,
  #generate-form:has([name="purpose"]:checked:not(#license-purpose-production)) .generate-plan--other {
    display: flex;
  }
}

/* The profile's "how do your clients use it?" (routes/profile.ts) shows only once an audience in
   CLIENT_AUDIENCES (domain/usage.ts) is checked. Without :has() it always shows; the server drops
   the answer for any other audience. */
@supports selector(:has(*)) {
  #profile-form:not(:has(#audience-clients:checked, #audience-both:checked)) #clientUse {
    display: none;
  }
}
.textarea.token {
  min-height: 9rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  word-break: break-all;
  background: var(--surface-1);
}
.search-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); max-width: none; }
.search-form > .field { flex: 1 1 24rem; align-self: auto; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Buttons and actions ---------------------------------------------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
summary.btn { list-style: none; width: fit-content; }
summary.btn::-webkit-details-marker { display: none; }
.copy-status { font-size: var(--text-sm); color: var(--success-fg); }

/* A table row's rarely used form (Revoke), folded behind a button: the admin console's
   .row-actions, expanding in the row rather than floating over it. */
.row-actions { margin-top: var(--space-2); }
.row-actions:first-child { margin-top: 0; }
.row-actions[open] { padding: var(--space-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-0); max-width: 32rem; }
.row-actions[open] > summary { margin-bottom: var(--space-3); }
.row-actions p { font-size: var(--text-sm); color: var(--fg-2); }
.row-actions .form { gap: var(--space-3); }

/* ---- Tables ---------------------------------------------------------------- */
.table caption {
  caption-side: top;
  padding: 0 var(--space-4) var(--space-2);
  text-align: left;
  font-size: var(--text-sm);
  color: var(--fg-3);
}
.table td .actions { min-height: 28px; }
.table th[scope="row"] { color: var(--fg-3); font-weight: 400; font-size: var(--text-sm); text-transform: none; letter-spacing: normal; border-bottom: 1px solid var(--border-subtle); }
.table .muted { font-size: var(--text-xs); }
.table .form { gap: var(--space-2); }
.table .field__label { font-size: var(--text-xs); }

/* ---- Signed-out pages: the landing intro and the centred auth cards ----- */
.hero { display: flex; flex-direction: column; gap: var(--space-3); max-width: 64ch; }
.hero > * { margin: 0; }
.hero > p:not(.eyebrow) { font-size: var(--text-lg); color: var(--fg-2); }
.hero__plans { display: flex; flex-direction: column; gap: var(--space-1); padding-left: var(--space-5); color: var(--fg-2); }
.auth-card { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-card > * { margin: 0; }
.auth-card h1 { font-size: var(--text-2xl); }
.auth-card h2 { font-size: var(--text-xl); }
.auth-card .form { max-width: none; }
.auth-card .btn--primary[type="submit"] { width: 100%; justify-content: center; }
.card-grid .auth-card { max-width: none; }
.auth-center { display: flex; justify-content: center; padding-top: var(--space-6); }

/* ---- Empty states ---------------------------------------------------------- */
.empty-state__title { margin: 0 0 var(--space-1); color: var(--fg-1); }
.empty-state__body { margin-bottom: 0; }
.empty-state__icon .icon { width: 24px; height: 24px; }
.empty-state--compact { padding: var(--space-6) var(--space-5); }
.empty-state--compact .empty-state__title,
.empty-state--no-results .empty-state__title { font: 600 var(--text-md) / var(--leading-snug) var(--font-sans); }
.empty-state--compact .empty-state__icon { width: 40px; height: 40px; }
