/* Backflare design tokens — "Archive at dusk"
 * Source of truth for the whole UI. Framework-agnostic CSS custom properties.
 * Tailwind reads these via @theme (see bottom). Light is default; dark overrides
 * via [data-theme="dark"] and falls back to prefers-color-scheme.
 *
 * Every text-on-surface pair below is checked to WCAG 2.1 AA (>=4.5:1 body,
 * >=3:1 large/UI). Contrast notes live in docs/DESIGN_SYSTEM.md.
 */

:root {
  /* ── Primitive ramps (never reference these directly in components;
   *    go through the semantic tokens below) ───────────────────────────── */

  /* Flare — brand, primary action, energy (ember) */
  --flare-50:  #FDF0EA;
  --flare-100: #FAD9CC;
  --flare-200: #F4B5A0;
  --flare-300: #EC8B6C;
  --flare-400: #E2683F;
  --flare-500: #D2542B;
  --flare-600: #B8431C;
  --flare-700: #95371A;
  --flare-800: #6E2A16;
  --flare-900: #4A1D10;

  /* Safe — protected, success, calm (teal) */
  --safe-50:  #E6F4F1;
  --safe-100: #BFE6DE;
  --safe-200: #8DD3C6;
  --safe-300: #54BBA9;
  --safe-400: #1FA38C;
  --safe-500: #0E8A75;
  --safe-600: #0B6F5F;
  --safe-700: #0A5749;
  --safe-800: #083F35;
  --safe-900: #052821;

  /* Ink — cool slate neutrals (text + dark surfaces) */
  --ink-50:  #F4F6FA;
  --ink-100: #E8ECF2;
  --ink-200: #D2DAE5;
  --ink-300: #AEBACA;
  --ink-400: #8595A9;
  --ink-500: #5A6B82;
  --ink-600: #3A485E;
  --ink-700: #273347;
  --ink-800: #1B2638;
  --ink-900: #15202B;
  --ink-950: #0C131F;

  /* Paper — warm neutrals (light surfaces) */
  --paper-0:   #FFFFFF;
  --paper-50:  #FBF9F4;
  --paper-100: #F3F0E8;
  --paper-200: #E4DFD3;
  --paper-300: #D2CBBA;

  /* Semantic primitives */
  --red-600:    #C0392B;
  --red-50:     #FBEAE7;
  --amber-600:  #B8740B;
  --amber-50:   #FBF1DD;
  --blue-600:   #2C6FB5;
  --blue-50:    #E8F1FA;

  /* ── Semantic tokens — LIGHT (default) ───────────────────────────────── */
  --bg:            var(--paper-50);   /* page */
  --surface:       var(--paper-0);    /* cards */
  --surface-2:     var(--paper-100);  /* inset panels */
  --border:        var(--paper-200);
  --border-strong: var(--paper-300);

  --text:        var(--ink-900);  /* ~15:1 on --bg */
  --text-muted:  #515C6E;         /* ~5.1:1 on --bg */
  --text-subtle: #74808F;         /* ~3.4:1 — large/UI text only */
  --text-onbrand:#FFFFFF;

  --brand:        var(--flare-500);  /* tint, links, focus */
  --brand-solid:  var(--flare-600);  /* button bg w/ white text (AA) */
  --brand-hover:  var(--flare-700);
  --brand-fg:     #FFFFFF;
  --brand-tint:   var(--flare-50);   /* subtle brand bg */
  --brand-tint-fg:var(--flare-800);

  --safe:         var(--safe-600);
  --safe-fg:      #FFFFFF;
  --safe-tint:    var(--safe-50);
  --safe-tint-fg: var(--safe-700);

  --danger:  var(--red-600);   --danger-tint: var(--red-50);
  --warning: var(--amber-600); --warning-tint: var(--amber-50);
  --info:    var(--blue-600);  --info-tint: var(--blue-50);

  --ring:        var(--flare-500);
  --ring-halo:   rgba(210, 84, 43, 0.22);

  /* ── Typography ──────────────────────────────────────────────────────── */
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-sans:    "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --text-xs:   0.75rem;   /* 12 */
  --text-sm:   0.875rem;  /* 14 */
  --text-base: 1rem;      /* 16 */
  --text-lg:   1.125rem;  /* 18 */
  --text-xl:   1.375rem;  /* 22 */
  --text-2xl:  1.75rem;   /* 28 */
  --text-3xl:  2.25rem;   /* 36 */
  --text-display: clamp(2.5rem, 5vw, 3.75rem);

  --leading-tight: 1.12;
  --leading-snug:  1.35;
  --leading-body:  1.6;

  /* ── Spacing (4px base) ──────────────────────────────────────────────── */
  --space-1: 0.25rem;  --space-2: 0.5rem;  --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.5rem;  --space-6: 2rem;
  --space-8: 3rem;     --space-10: 4rem;   --space-12: 6rem;

  /* ── Radius ──────────────────────────────────────────────────────────── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ── Elevation (warm-tinted, subtle) ─────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(21, 32, 43, 0.06);
  --shadow-md: 0 4px 16px -4px rgba(21, 32, 43, 0.12);
  --shadow-lg: 0 12px 32px -8px rgba(21, 32, 43, 0.16);

  /* ── Motion ──────────────────────────────────────────────────────────── */
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);

  /* ── Layout ──────────────────────────────────────────────────────────── */
  --tap-target: 44px;       /* min interactive size (WCAG 2.5.5) */
  --measure: 68ch;          /* max readable line length */
  --container: 1100px;
  color-scheme: light;
}

/* ── Semantic tokens — DARK ────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --bg:            var(--ink-950);
  --surface:       var(--ink-900);
  --surface-2:     var(--ink-800);
  --border:        #2A3647;
  --border-strong: var(--ink-700);

  --text:        #EDEAE2;   /* warm off-white, ~15:1 on --bg */
  --text-muted:  #A8B2C0;   /* ~8:1 */
  --text-subtle: #7E8A99;   /* large/UI only */
  --text-onbrand:#1A0905;

  --brand:        var(--flare-400);
  --brand-solid:  var(--flare-500);  /* dark text on this in dark mode */
  --brand-hover:  var(--flare-400);
  --brand-fg:     #1A0905;
  --brand-tint:   rgba(210, 84, 43, 0.14);
  --brand-tint-fg:var(--flare-200);

  --safe:         var(--safe-400);
  --safe-fg:      #04231D;
  --safe-tint:    var(--safe-900);
  --safe-tint-fg: var(--safe-200);

  --danger:  #E2685B; --danger-tint: rgba(192,57,43,0.16);
  --warning: #E0A53D; --warning-tint: rgba(184,116,11,0.16);
  --info:    #5C9BDB; --info-tint: rgba(44,111,181,0.16);

  --ring:      var(--flare-400);
  --ring-halo: rgba(226, 104, 63, 0.28);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px -4px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 32px -8px rgba(0,0,0,0.6);
  color-scheme: dark;
}

/* System preference when the user hasn't chosen explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--ink-950); --surface: var(--ink-900); --surface-2: var(--ink-800);
    --border: #2A3647; --border-strong: var(--ink-700);
    --text: #EDEAE2; --text-muted: #A8B2C0; --text-subtle: #7E8A99; --text-onbrand: #1A0905;
    --brand: var(--flare-400); --brand-solid: var(--flare-500); --brand-hover: var(--flare-400);
    --brand-fg: #1A0905; --brand-tint: rgba(210,84,43,0.14); --brand-tint-fg: var(--flare-200);
    --safe: var(--safe-400); --safe-fg: #04231D; --safe-tint: var(--safe-900); --safe-tint-fg: var(--safe-200);
    --danger: #E2685B; --warning: #E0A53D; --info: #5C9BDB;
    --ring: var(--flare-400); --ring-halo: rgba(226,104,63,0.28);
    color-scheme: dark;
  }
}

/* ── Global resets that the tokens imply ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: var(--leading-tight); color: var(--text); }
code, kbd, samp, .mono { font-family: var(--font-mono); }

/* Visible, high-contrast keyboard focus everywhere; never remove it. */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--ring-halo);
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

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

/* Skip-link + screen-reader-only helpers (voice/keyboard nav) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -100px;
  background: var(--surface); color: var(--text);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); z-index: 100;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: var(--space-3); }

/* ── Tailwind v4 bridge (CSS-first; no JS config) ──────────────────────────
 * In your main stylesheet:
 *   @import "tailwindcss";
 *   @import "./tokens.css";
 * then expose the semantic tokens to Tailwind utilities:
 *
 * @theme inline {
 *   --color-bg: var(--bg);
 *   --color-surface: var(--surface);
 *   --color-surface-2: var(--surface-2);
 *   --color-border: var(--border);
 *   --color-text: var(--text);
 *   --color-text-muted: var(--text-muted);
 *   --color-brand: var(--brand);
 *   --color-brand-solid: var(--brand-solid);
 *   --color-safe: var(--safe);
 *   --color-danger: var(--danger);
 *   --color-warning: var(--warning);
 *   --color-info: var(--info);
 *   --font-display: var(--font-display);
 *   --font-sans: var(--font-sans);
 *   --font-mono: var(--font-mono);
 *   --radius-md: var(--radius-md);
 *   --radius-lg: var(--radius-lg);
 * }
 * → enables bg-surface, text-text, text-text-muted, bg-brand-solid,
 *   border-border, font-display, rounded-md, etc.
 */

/* Backflare component + landing layer — built on the design tokens in tokens.css.
 * Plain CSS, zero build. Semantic tokens drive light/dark. Served concatenated
 * after tokens.css at /assets/app.css.
 */

/* ── Base polish ────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { text-rendering: optimizeLegibility; }
::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }
a { color: var(--brand); text-underline-offset: 2px; }

/* ── Layout primitives ─────────────────────────────────────────────────────── */
.bf-container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-5); }
.bf-main { padding-block: var(--space-6) var(--space-10); display: flex; flex-direction: column; gap: var(--space-5); }
.bf-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.bf-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.bf-spread { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }
.bf-measure { max-width: var(--measure); }
.bf-section { padding-block: clamp(3rem, 8vw, 6rem); }

/* ── Reveal-on-scroll (JS adds .is-in; reduced-motion shows immediately) ──────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ── Header / nav ──────────────────────────────────────────────────────────── */
.bf-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid transparent; transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), backdrop-filter var(--dur-base) var(--ease); }
.bf-header.is-scrolled { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom-color: var(--border); }
.bf-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: var(--space-4); }
.bf-brand { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.bf-brand .bf-brandmark { color: var(--brand); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--brand) 45%, transparent)); }
.bf-header__actions { display: flex; align-items: center; gap: var(--space-2); }
.bf-nav { display: flex; align-items: center; gap: var(--space-1); }
.bf-nav a { padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: var(--text-sm); transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.bf-nav a:hover { background: var(--surface-2); color: var(--text); }
.bf-nav a[aria-current="page"] { color: var(--text); background: var(--brand-tint); }
.bf-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
.bf-icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.bf-theme-toggle .bf-sun { display: none; }
.bf-theme-toggle .bf-moon { display: inline-flex; }
:root[data-theme="dark"] .bf-theme-toggle .bf-sun { display: inline-flex; }
:root[data-theme="dark"] .bf-theme-toggle .bf-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bf-theme-toggle .bf-sun { display: inline-flex; } :root:not([data-theme="light"]) .bf-theme-toggle .bf-moon { display: none; } }
.bf-menu-btn { display: none; }
@media (max-width: 760px) {
  .bf-menu-btn { display: inline-flex; }
  .bf-nav { position: absolute; top: 64px; right: var(--space-5); left: var(--space-5); flex-direction: column; align-items: stretch; gap: 2px; padding: var(--space-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .bf-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.bf-footer { border-top: 1px solid var(--border); margin-top: var(--space-10); padding-block: var(--space-6); color: var(--text-muted); font-size: var(--text-sm); }
.bf-footer__inner { display: flex; flex-direction: column; gap: var(--space-2); }
.bf-footer__meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; color: var(--text-subtle); }
.bf-footer a { color: var(--text-muted); }
.bf-footer__brand { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-weight: 600; color: var(--text); }

/* ── Headings / text ───────────────────────────────────────────────────────── */
.bf-h1 { font-family: var(--font-display); font-weight: 600; font-size: var(--text-3xl); line-height: var(--leading-tight); margin: 0; letter-spacing: -0.02em; }
.bf-lede { color: var(--text-muted); font-size: var(--text-lg); margin: var(--space-2) 0 0; max-width: var(--measure); line-height: var(--leading-snug); }
.bf-muted { color: var(--text-muted); }
.bf-mono { font-family: var(--font-mono); font-size: 0.85em; }
.bf-eyebrow { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); padding: 5px var(--space-3); border-radius: var(--radius-full); background: var(--brand-tint); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.bf-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.bf-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; }
.bf-card__title { font-family: var(--font-display); font-weight: 500; font-size: var(--text-xl); margin: 0; letter-spacing: -0.01em; }
.bf-card__sub { color: var(--text-muted); font-size: var(--text-sm); margin: var(--space-1) 0 0; }
.bf-card__body { padding: var(--space-5); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.bf-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--tap-target); padding: 0 var(--space-5); border-radius: var(--radius-md); border: 1px solid transparent; font-family: var(--font-sans); font-weight: 500; font-size: var(--text-sm); line-height: 1; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.bf-btn:hover { transform: translateY(-1px); }
.bf-btn:active { transform: translateY(0); }
.bf-btn .bf-icon { width: 18px; height: 18px; }
.bf-btn--sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.bf-btn--lg { min-height: 52px; padding: 0 var(--space-6); font-size: var(--text-base); border-radius: var(--radius-lg); }
.bf-btn--primary { background: var(--brand-solid); color: var(--brand-fg); box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
.bf-btn--primary:hover { background: var(--brand-hover); box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--brand) 75%, transparent); }
.bf-btn--safe { background: var(--safe); color: var(--safe-fg); }
.bf-btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.bf-btn--ghost:hover { background: var(--surface-2); }
.bf-btn--subtle { background: var(--surface-2); color: var(--text); }
.bf-btn--subtle:hover { background: var(--border); }
.bf-btn--danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.bf-btn--danger:hover { background: var(--danger-tint); }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.bf-badge { display: inline-flex; align-items: center; gap: var(--space-2); padding: 4px var(--space-3); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 500; border: 1px solid transparent; }
.bf-badge__dot { width: 7px; height: 7px; border-radius: var(--radius-full); background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.bf-badge--safe { background: var(--safe-tint); color: var(--safe-tint-fg); }
.bf-badge--warning { background: var(--warning-tint); color: var(--warning); }
.bf-badge--danger { background: var(--danger-tint); color: var(--danger); }
.bf-badge--info { background: var(--info-tint); color: var(--info); }
.bf-badge--neutral { background: var(--surface-2); color: var(--text-muted); }

/* ── Stats ─────────────────────────────────────────────────────────────────── */
.bf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.bf-stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); }
.bf-stat__value { font-family: var(--font-display); font-weight: 600; font-size: var(--text-2xl); line-height: 1.05; letter-spacing: -0.02em; }
.bf-stat__label { color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-1); }
.bf-stat__hint { color: var(--text-subtle); font-size: var(--text-xs); margin-top: var(--space-1); font-family: var(--font-mono); }

/* ── Empty states ──────────────────────────────────────────────────────────── */
.bf-empty { text-align: center; padding: var(--space-8) var(--space-4); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.bf-empty__icon { color: var(--text-subtle); display: inline-flex; padding: var(--space-3); border-radius: var(--radius-full); background: var(--surface-2); }
.bf-empty__icon .bf-icon { width: 28px; height: 28px; }
.bf-empty__title { font-family: var(--font-display); font-weight: 500; font-size: var(--text-xl); margin: 0; }
.bf-empty__body { color: var(--text-muted); max-width: 42ch; margin: 0 0 var(--space-2); }

/* ── Breadcrumbs ───────────────────────────────────────────────────────────── */
.bf-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0; margin: 0; font-size: var(--text-sm); }
.bf-crumbs li + li::before { content: "/"; color: var(--text-subtle); margin-right: var(--space-2); }
.bf-crumbs a { color: var(--text-muted); text-decoration: none; }
.bf-crumbs a:hover { color: var(--text); }
.bf-crumbs [aria-current="page"] { color: var(--text); font-weight: 500; }

/* ── Fields / forms ────────────────────────────────────────────────────────── */
.bf-field { display: flex; flex-direction: column; gap: var(--space-2); }
.bf-field__label { font-weight: 500; font-size: var(--text-sm); }
.bf-input { min-height: var(--tap-target); padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--text); font: inherit; font-size: var(--text-base); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.bf-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring-halo); }
.bf-input::placeholder { color: var(--text-subtle); }
.bf-field__hint { color: var(--text-muted); font-size: var(--text-xs); margin: 0; }
.bf-search { display: flex; gap: var(--space-2); align-items: flex-end; }
.bf-search .bf-field { flex: 1; }

/* ── Tree (native details/summary — keyboard-operable, zero JS) ─────────────── */
.bf-tree { display: flex; flex-direction: column; gap: 2px; }
.bf-tree details > summary { list-style: none; }
.bf-tree details > summary::-webkit-details-marker { display: none; }
.bf-node { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); min-height: var(--tap-target); transition: background var(--dur-fast) var(--ease); }
.bf-node:hover { background: var(--surface-2); }
summary.bf-node { cursor: pointer; }
.bf-node .bf-icon { color: var(--text-subtle); flex: none; width: 18px; height: 18px; }
.bf-node__name { font-weight: 500; }
.bf-node__name a { color: var(--text); text-decoration: none; }
.bf-node__name a:hover { color: var(--brand); }
.bf-node__meta { color: var(--text-subtle); font-size: var(--text-xs); font-family: var(--font-mono); margin-left: auto; white-space: nowrap; }
.bf-tree details > .bf-tree { margin-left: var(--space-4); border-left: 1px solid var(--border); padding-left: var(--space-2); }
.bf-twist { display: inline-flex; color: var(--text-subtle); transition: transform var(--dur-fast) var(--ease); }
.bf-twist .bf-icon { width: 16px; height: 16px; }
.bf-tree details[open] > summary .bf-twist { transform: rotate(90deg); }

/* ── Tables (lists) ────────────────────────────────────────────────────────── */
.bf-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.bf-table th { text-align: left; color: var(--text-muted); font-weight: 500; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.bf-table td { padding: var(--space-3); border-bottom: 1px solid var(--border); }
.bf-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.bf-table tbody tr:hover { background: var(--surface-2); }
.bf-table tr:last-child td { border-bottom: none; }
.bf-table a { color: var(--text); text-decoration: none; }
.bf-table a:hover { color: var(--brand); }

/* ── Progress (live backup) ────────────────────────────────────────────────── */
.bf-progress { display: flex; flex-direction: column; gap: var(--space-3); }
.bf-progress__bar { height: 10px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.bf-progress__fill { height: 100%; background: linear-gradient(90deg, var(--brand-solid), var(--flare-400)); border-radius: var(--radius-full); transition: width var(--dur-slow) var(--ease); }
.bf-progress__fill--indeterminate { width: 40%; animation: bf-indeterminate 1.4s var(--ease) infinite; }
@keyframes bf-indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.bf-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: bf-spin .8s linear infinite; }
@keyframes bf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bf-progress__fill--indeterminate { animation: none; width: 100%; } .bf-spinner { animation: none; } }

/* ── Callout ───────────────────────────────────────────────────────────────── */
.bf-callout { background: var(--brand-tint); color: var(--brand-tint-fg); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent); }
.bf-callout strong { font-weight: 500; }

/* ════════════════════════════════════════════════════════════════════════════
   Landing page
   ════════════════════════════════════════════════════════════════════════════ */
.lp { display: flex; flex-direction: column; }
.lp-hero { position: relative; overflow: hidden; padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5rem); }
.lp-hero__aurora { position: absolute; inset: -20% -10% auto; height: 620px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 20% 20%, color-mix(in srgb, var(--brand) 26%, transparent), transparent 70%),
    radial-gradient(38% 48% at 82% 12%, color-mix(in srgb, var(--safe) 22%, transparent), transparent 70%);
  filter: blur(20px); opacity: .9; }
.lp-hero__grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 900px) { .lp-hero__grid { grid-template-columns: 1fr; } }
.lp-hero__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.6rem, 6vw, 4.2rem); line-height: 1.04; letter-spacing: -0.03em; margin: var(--space-4) 0 0; }
.lp-hero__title .lp-accent { color: var(--brand); }
.lp-hero__sub { color: var(--text-muted); font-size: clamp(1.05rem, 2vw, 1.3rem); line-height: 1.5; margin: var(--space-4) 0 0; max-width: 38ch; }
.lp-cta-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.lp-trustline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-top: var(--space-5); color: var(--text-subtle); font-size: var(--text-sm); }
.lp-trustline span { display: inline-flex; align-items: center; gap: var(--space-2); }
.lp-trustline .bf-icon { width: 16px; height: 16px; color: var(--safe); }

/* Product window mock */
.lp-window { border-radius: var(--radius-xl); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg), 0 40px 80px -40px color-mix(in srgb, var(--brand) 30%, transparent); overflow: hidden; }
.lp-window__bar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lp-dots { display: inline-flex; gap: 6px; }
.lp-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); display: inline-block; }
.lp-window__url { margin-left: var(--space-2); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-subtle); }
.lp-window__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.lp-mockhead { display: flex; align-items: center; justify-content: space-between; }
.lp-mockhead h3 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0; }
.lp-mockstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.lp-mockstat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); }
.lp-mockstat b { font-family: var(--font-display); font-size: var(--text-xl); display: block; letter-spacing: -0.02em; }
.lp-mockstat span { color: var(--text-muted); font-size: var(--text-xs); }
.lp-timeline { display: flex; align-items: center; gap: 0; }
.lp-timeline i { flex: 1; height: 2px; background: var(--border); }
.lp-tick { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); flex: none; }
.lp-tick.is-now { border-color: var(--brand); background: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.lp-mockrow { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); }
.lp-mockrow .bf-icon { width: 16px; height: 16px; color: var(--text-subtle); }
.lp-mockrow span { font-size: var(--text-sm); }
.lp-mockrow b { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-subtle); font-weight: 400; }

/* Sections */
.lp-sectionhead { text-align: center; max-width: 56ch; margin-inline: auto; margin-bottom: clamp(2rem, 5vw, 3.5rem); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.lp-h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0; }
.lp-sectionhead p { color: var(--text-muted); font-size: var(--text-lg); margin: 0; }

/* Differentiator band */
.lp-band { background: var(--surface); border-block: 1px solid var(--border); }
.lp-band__inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
@media (max-width: 820px) { .lp-band__inner { grid-template-columns: 1fr; } }
.lp-band__big { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
.lp-band__big em { font-style: normal; color: var(--brand); }

/* Steps */
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (max-width: 820px) { .lp-steps { grid-template-columns: 1fr; } }
.lp-step { position: relative; padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.lp-step__num { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--brand); }
.lp-step__icon { display: inline-flex; padding: var(--space-3); border-radius: var(--radius-md); background: var(--brand-tint); color: var(--brand); margin: var(--space-2) 0 var(--space-3); }
.lp-step h3 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--space-1); }
.lp-step p { color: var(--text-muted); margin: 0; font-size: var(--text-sm); line-height: 1.55; }

/* Features */
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (max-width: 900px) { .lp-features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .lp-features { grid-template-columns: 1fr; } }
.lp-feature { padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease); }
.lp-feature:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.lp-feature__icon { display: inline-flex; padding: 10px; border-radius: var(--radius-md); color: var(--brand); background: var(--brand-tint); margin-bottom: var(--space-3); }
.lp-feature h3 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--space-1); }
.lp-feature p { color: var(--text-muted); margin: 0; font-size: var(--text-sm); line-height: 1.55; }

/* Compare */
.lp-compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 720px) { .lp-compare { grid-template-columns: 1fr; } }
.lp-compare__col { padding: var(--space-5); border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.lp-compare__col--win { border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.lp-compare h3 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0 0 var(--space-3); display: flex; align-items: center; gap: var(--space-2); }
.lp-compare ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.lp-compare li { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.lp-compare li .bf-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.lp-compare li.yes { color: var(--text); } .lp-compare li.yes .bf-icon { color: var(--safe); }
.lp-compare li.no .bf-icon { color: var(--text-subtle); }

/* FAQ */
.lp-faq { max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; gap: var(--space-2); }
.lp-faq details { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.lp-faq summary { list-style: none; cursor: pointer; padding: var(--space-4) var(--space-5); font-weight: 500; font-size: var(--text-base); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary .bf-icon { color: var(--text-subtle); transition: transform var(--dur-fast) var(--ease); flex: none; }
.lp-faq details[open] summary .bf-icon { transform: rotate(180deg); }
.lp-faq__a { padding: 0 var(--space-5) var(--space-5); color: var(--text-muted); line-height: 1.6; }

/* CTA band */
.lp-cta { text-align: center; position: relative; overflow: hidden; border-radius: var(--radius-xl); border: 1px solid var(--border); padding: clamp(2.5rem, 6vw, 4.5rem) var(--space-5); background: var(--surface); }
.lp-cta::before { content: ""; position: absolute; inset: 0; z-index: 0; background: radial-gradient(60% 120% at 50% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%); }
.lp-cta > * { position: relative; z-index: 1; }
.lp-cta h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 4.5vw, 2.8rem); letter-spacing: -0.02em; margin: 0 0 var(--space-3); }
.lp-cta p { color: var(--text-muted); font-size: var(--text-lg); margin: 0 auto var(--space-6); max-width: 46ch; }

/* Footer columns */
.lp-footcols { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: var(--space-6); padding-block: var(--space-6); }
@media (max-width: 720px) { .lp-footcols { grid-template-columns: 1fr; } }
.lp-footcol h4 { font-size: var(--text-sm); color: var(--text); margin: 0 0 var(--space-3); }
.lp-footcol a { display: block; color: var(--text-muted); text-decoration: none; font-size: var(--text-sm); padding: 4px 0; }
.lp-footcol a:hover { color: var(--text); }
.lp-footcol p { color: var(--text-muted); font-size: var(--text-sm); max-width: 36ch; margin: var(--space-2) 0 0; }

/* ── Fleet dashboard ───────────────────────────────────────────────────────── */
.bf-fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.bf-wcard { display: flex; flex-direction: column; }
.bf-wcard__title { display: flex; align-items: center; gap: var(--space-2); }
.bf-wcard__icon { display: inline-flex; align-items: center; color: var(--color-brand); }
.bf-wcard__icon .bf-icon { width: 22px; height: 22px; }
.bf-table tr.is-selected td { background: var(--surface-2); }

/* ── Shared: avatars, chips, section titles ──────────────────────────────────── */
.bf-section-title { font-family: var(--font-display, inherit); font-size: var(--text-lg, 1.15rem); margin: 0; }
.bf-avatar { flex: 0 0 auto; width: 40px; height: 40px; border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 0.8rem; font-weight: 600; background-size: cover; background-position: center; }
.bf-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-full); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); font-size: var(--text-xs, 0.72rem); line-height: 1.6; }
.bf-chip .bf-icon { width: 13px; height: 13px; }
.bf-chip--cal { color: var(--text); }

/* ── Mail: inbox ─────────────────────────────────────────────────────────────── */
.bf-inbox { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.bf-inbox__row + .bf-inbox__row { border-top: 1px solid var(--border); }
.bf-inbox__link { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); text-decoration: none; color: var(--text); align-items: flex-start; transition: background 0.12s ease; }
.bf-inbox__link:hover { background: var(--surface-2); }
.bf-inbox__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.bf-inbox__top { display: flex; justify-content: space-between; gap: var(--space-3); align-items: baseline; }
.bf-inbox__from { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-inbox__date { flex: 0 0 auto; color: var(--text-muted); font-size: var(--text-sm); }
.bf-inbox__subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.bf-inbox__snippet { color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-inbox__row.is-unread .bf-inbox__from, .bf-inbox__row.is-unread .bf-inbox__subject { font-weight: 700; }
.bf-inbox__row.is-unread .bf-inbox__link { background: color-mix(in srgb, var(--color-brand) 6%, var(--surface)); }
.bf-clip { display: inline-flex; color: var(--text-muted); }
.bf-clip .bf-icon { width: 14px; height: 14px; transform: rotate(0); }

/* ── Mail: message view ──────────────────────────────────────────────────────── */
.bf-mailview { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-5); }
.bf-mailview__subject { font-family: var(--font-display, inherit); font-size: 1.5rem; margin: 0 0 var(--space-4); }
.bf-mailview__meta { display: flex; gap: var(--space-3); align-items: center; }
.bf-mailview__meta > div { flex: 1; min-width: 0; }
.bf-mailview__to { font-size: var(--text-sm); }
.bf-mailview__date { flex: 0 0 auto; font-size: var(--text-sm); }
.bf-mailbody { margin-top: var(--space-4); border-top: 1px solid var(--border); padding-top: var(--space-4); }
.bf-mailbody__note { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); margin: 0 0 var(--space-3); }
.bf-mailbody__text { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 0.95rem; line-height: 1.6; margin: 0; }

/* ── Calendar: agenda ────────────────────────────────────────────────────────── */
.bf-agenda { display: flex; flex-direction: column; gap: var(--space-5); }
.bf-agenda__day { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 var(--space-2); }
.bf-agenda__row { display: grid; grid-template-columns: 84px 1fr; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); text-decoration: none; color: var(--text); margin-bottom: var(--space-2); transition: border-color 0.12s ease; }
.bf-agenda__row:hover { border-color: var(--color-brand); }
.bf-agenda__time { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: var(--text-sm); border-right: 2px solid var(--safe, var(--color-brand)); padding-right: var(--space-3); }
.bf-agenda__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bf-agenda__title { font-weight: 500; }
.bf-agenda__meta { display: flex; flex-wrap: wrap; gap: var(--space-3); color: var(--text-muted); font-size: var(--text-sm); }
.bf-agenda__meta .bf-icon { width: 13px; height: 13px; vertical-align: -2px; }

/* ── Contacts: card grid ─────────────────────────────────────────────────────── */
.bf-contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-3); }
.bf-contact-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); text-decoration: none; color: var(--text); transition: transform 0.12s ease, border-color 0.12s ease; }
.bf-contact-card:hover { transform: translateY(-2px); border-color: var(--color-brand); }
.bf-contact-card .bf-avatar { width: 56px; height: 56px; font-size: 1.1rem; margin-bottom: var(--space-2); }
.bf-contact-card__name { font-weight: 500; }
.bf-contact-card__line { font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bf-contact-hero { display: flex; gap: var(--space-4); align-items: center; margin-bottom: var(--space-2); }
.bf-contact-hero .bf-avatar { width: 64px; height: 64px; font-size: 1.3rem; }

/* ── Tasks: checklist ────────────────────────────────────────────────────────── */
.bf-tasks { list-style: none; margin: 0; padding: 0; }
.bf-task { display: flex; gap: var(--space-3); padding: var(--space-2) 0; align-items: flex-start; }
.bf-task + .bf-task { border-top: 1px solid var(--border); }
.bf-task__box { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--border-strong, var(--border)); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.bf-task.is-done .bf-task__box { background: var(--safe, var(--color-brand)); border-color: var(--safe, var(--color-brand)); }
.bf-task__box .bf-icon { width: 14px; height: 14px; }
.bf-task__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bf-task__title { font-weight: 500; }
.bf-task.is-done .bf-task__title { text-decoration: line-through; color: var(--text-muted); }
.bf-task__notes { color: var(--text-muted); font-size: var(--text-sm); white-space: pre-wrap; }
.bf-task__due { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: var(--text-xs, 0.72rem); }
.bf-task__due .bf-icon { width: 13px; height: 13px; }

/* ── Detail: facts, key-values, people ───────────────────────────────────────── */
.bf-detail { display: flex; flex-direction: column; gap: var(--space-4); }
.bf-facts { display: grid; gap: var(--space-3); }
.bf-fact { display: flex; gap: var(--space-3); align-items: flex-start; }
.bf-fact__icon { flex: 0 0 auto; color: var(--color-brand); display: inline-flex; margin-top: 2px; }
.bf-fact__label { font-size: var(--text-sm); color: var(--text-muted); }
.bf-fact__value { font-weight: 500; }
.bf-kv { display: flex; gap: var(--space-3); }
.bf-kv__k { flex: 0 0 84px; color: var(--text-muted); font-size: var(--text-sm); text-transform: capitalize; }
.bf-kv__v { flex: 1; min-width: 0; word-break: break-word; }
.bf-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.bf-person { display: flex; gap: var(--space-3); align-items: center; }
.bf-person .bf-avatar { width: 32px; height: 32px; font-size: 0.7rem; }
.bf-person__name { display: block; font-weight: 500; }
.bf-person__sub { display: block; font-size: var(--text-xs, 0.72rem); text-transform: capitalize; }
