/* FALLYN — landing + install pages
   Design: pure black, deep dark-grey accents, single off-white foreground.
   No web-fonts (no FOIT, no LCP penalty). System font stacks only —
   these match inference.vip exactly, which is also 100% system fonts:
   body gets the sans stack, every brand surface gets the mono stack. */

:root {
  /* inference.vip --font-sans (Tailwind v4 preflight default) */
  --font-sans: ui-sans-serif, system-ui, sans-serif,
               'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  /* inference.vip --font-mono — this is their brand/display face */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               'Liberation Mono', 'Courier New', monospace;

  --bg: #000000;
  --bg-elev: #0a0a0a;
  --fg: #f5f5f5;
  --fg-dim: rgba(245, 245, 245, 0.62);
  --fg-faint: rgba(245, 245, 245, 0.40);
  --line: rgba(245, 245, 245, 0.10);
  --line-strong: rgba(245, 245, 245, 0.20);
  --surface: rgba(245, 245, 245, 0.02);
  --surface-hover: rgba(245, 245, 245, 0.05);
  /* Champagne gold. The old #d4af37 sat at 0.74 saturation / 0.45 luminance,
     which read brassy and muddy against pure black. This is 0.47 / 0.60 and
     carries 12.97:1 contrast on #000, so it is calmer and far more legible. */
  --accent: #E8C87A;
  --accent-dim: rgba(232, 200, 122, 0.4);
  /* Grid spacing. Kept as variables so the minor/mobile override moves the
     colour stops with the tile instead of against them. */
  --grid-minor: 64px;
  --grid-major: 320px;
  --max: 1120px;
  --gutter: 24px;
}

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

html, body { margin: 0; padding: 0; color: var(--fg); }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: transparent; }
body {
  font-family: var(--font-sans);
  font-size: 16px; line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased;
  /* The background lives on body and html stays transparent, so body's
     background propagates to the canvas. That propagation is what lets the
     fixed z-index:-1 grid and vignette layers paint ABOVE the page. A
     background on html instead pushes body's black box in front of them and
     the grid silently vanishes. Confirmed by pixel sampling: with a background
     on html a full row sampled as a single flat (0,0,0). */
  background: var(--bg);
  overflow-x: hidden;
}

/* Background layers, ported from inference.vip's static 3-layer system.
   They are FIXED POSITION ELEMENTS rather than `background-attachment: fixed`
   on the body, which inference.vip uses at the cost of a full background
   repaint on every scroll. Two composited pseudo-elements cost nothing.
   They rely on html having no background of its own, so body's background
   propagates to the canvas and paints beneath them — same as the original. */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Layer 2 — the grid. Sizes are variables so the spacing and the line positions
   stay in step: the earlier version hardcoded 64px in the gradient and then set
   background-size on mobile, which re-tiled the gradient against mismatched
   colour stops and produced an irregular pattern.
   Opacities sit a little above inference.vip's 0.035 / 0.06. On pure black that
   original pair renders as rgb(9,9,9), which is genuinely hard to see; these
   give roughly rgb(14,14,14) minor and rgb(25,25,25) major, still restrained. */
body::after {
  background-image:
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--grid-minor) - 1px), rgba(255, 255, 255, 0.055) calc(var(--grid-minor) - 1px), rgba(255, 255, 255, 0.055) var(--grid-minor)),
    repeating-linear-gradient(to right,   transparent 0, transparent calc(var(--grid-minor) - 1px), rgba(255, 255, 255, 0.055) calc(var(--grid-minor) - 1px), rgba(255, 255, 255, 0.055) var(--grid-minor)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--grid-major) - 1px), rgba(255, 255, 255, 0.10) calc(var(--grid-major) - 1px), rgba(255, 255, 255, 0.10) var(--grid-major)),
    repeating-linear-gradient(to right,   transparent 0, transparent calc(var(--grid-major) - 1px), rgba(255, 255, 255, 0.10) calc(var(--grid-major) - 1px), rgba(255, 255, 255, 0.10) var(--grid-major));
}
/* Layer 3 — the vignette, darkening the edges. */
body::before {
  background: radial-gradient(
    ellipse 80% 70% at center,
    transparent 0%,
    transparent 50%,
    rgba(0, 0, 0, 0.45) 100%
  );
}
@media (max-width: 640px) {
  :root { --grid-minor: 80px; }
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }
em { font-style: normal; }
strong { color: var(--fg); font-weight: 700; }
code { font-family: var(--font-mono); font-size: 0.92em; }
button { font-family: inherit; }

/* ===== Page loader ===== */
/* Booting locks scroll so the page cannot move behind the splash. The class is
   set by the inline gate in <head>; if JS is off the class never appears and
   the <noscript> rule below hides the splash instead. */
html.booting, html.booting body { overflow: hidden; }
html.boot-seen .loader { display: none !important; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  pointer-events: auto;
}
.loader.is-loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transform: translateZ(0);
}
.loader-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
}
.loader-mark .bar {
  display: block;
  width: 4px;
  background: var(--fg);
  border-radius: 1px;
  transform-origin: bottom center;
  animation: loader-pulse 1.1s ease-in-out infinite;
  will-change: transform;
}
.loader-mark .bar:nth-child(1) { height: 70%;  animation-delay: 0s; }
.loader-mark .bar:nth-child(2) { height: 45%;  animation-delay: 0.13s; background: var(--fg-dim); }
.loader-mark .bar:nth-child(3) { height: 100%; animation-delay: 0.26s; }
.loader-mark .bar:nth-child(4) { height: 55%;  animation-delay: 0.39s; background: var(--fg-dim); }

@keyframes loader-pulse {
  0%, 100% { transform: scaleY(0.30); }
  50%      { transform: scaleY(1.00); }
}

/* The splash word. It starts large and is flown down onto the hero wordmark.
   transform-origin stays at the centre so the JS can express the whole move as
   translate(dx,dy) scale(k) with no layout maths.

   It also arrives rather than popping: hidden and 20px low, then eased up into
   place by .is-revealed before the flight ever begins. */
.loader-text {
  margin: 0;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 10vw, 8rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  transform-origin: center center;
  will-change: transform, color;
  opacity: 0;
  transform: translateY(20px);
}

/* First-frame reveal. inference.vip opens the same way: fade and lift, then
   hold, then move. Source order matters — .is-flying below must win. */
.loader.is-revealed .loader-text {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.loader.is-revealed .loader-mark { opacity: 1; transition: opacity 0.5s ease 0.12s; }
.loader-mark { opacity: 0; transition: opacity 0.28s ease; }

/* The mark is FALLYN's own; it holds the frame, then gets out of the way. */
.loader.is-flying .loader-mark { opacity: 0; transition: opacity 0.28s ease; }

/* The flight itself. Duration is read by the JS teardown timer, so the two
   must stay in step — see FLIGHT_MS in fallyn.js. */
.loader.is-flying .loader-text {
  transition:
    transform 0.95s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.95s ease;
}

@media (prefers-reduced-motion: reduce) {
  .loader-mark .bar { animation: none; transform: scaleY(0.6); }
  .loader { transition-duration: 0.15s; }
  .loader.is-flying .loader-text { transition-duration: 0.01s; }
  .loader.is-revealed .loader-text { transition-duration: 0.01s; }
  .loader-mark { transition-duration: 0.01s; }
  /* Reduced motion must not leave the word stuck at opacity 0 waiting on a
     transition the user has asked us not to run. */
  .loader-text { opacity: 1; transform: none; }
  .loader-mark { opacity: 1; }
  .error-inner { animation: none; }
}

/* ===== Navigation ===== */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-inner { max-width: var(--max); margin: 0 auto; padding: 16px var(--gutter); display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--fg); font-weight: 700; letter-spacing: 0.04em; }
.brand-mark { display: inline-flex; gap: 2px; }
.mark-bar { display: block; width: 4px; height: 14px; background: var(--fg); border-radius: 1px; }
.mark-bar:nth-child(1) { height: 14px; }
.mark-bar:nth-child(2) { height: 10px; align-self: flex-end; background: var(--fg-dim); }
.mark-bar:nth-child(3) { height: 14px; }
.mark-bar:nth-child(4) { height: 8px;  align-self: flex-end; background: var(--fg-dim); }
.brand-stack { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text { font-size: 0.95rem; font-family: var(--font-mono); }
.brand-by { font-size: 0.62rem; color: var(--fg-faint); font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 3px; }
.nav-links { display: flex; gap: 28px; margin-left: auto; }
.nav-links a { color: var(--fg-dim); font-size: 0.86rem; letter-spacing: 0.04em; }
.nav-links a:hover { color: var(--fg); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 16px; background: var(--fg); color: var(--bg);
  border-radius: 999px; font-size: 0.84rem; font-weight: 600; letter-spacing: 0.01em;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.nav-cta:hover { background: var(--accent); color: #000; transform: translateY(-1px); }
.nav-cta:active { transform: translateY(0); }
.nav-cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.nav-cta-icon { width: 15px; height: 15px; flex: 0 0 auto; border-radius: 2px; }

/* Account cluster. Sign in is quiet, the primary action carries the weight. */
.nav-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.nav-signin {
  color: var(--fg-dim); font-size: 0.86rem; font-weight: 500;
  transition: color 0.18s ease;
}
.nav-signin:hover { color: var(--fg); }
.nav-signin:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.nav-account {
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  padding: 6px 14px 6px 7px; border: 1px solid var(--line-strong);
  border-radius: 999px; color: var(--fg); font-size: 0.84rem; font-weight: 600;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.nav-account:hover { border-color: var(--accent); background: var(--surface); }
.nav-account:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; display: block; }
.nav-account-name { padding-right: 2px; }
.nav-user { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.nav-user-name {
  max-width: 16ch; overflow: hidden; text-overflow: ellipsis;
  color: var(--fg-dim); font-size: 0.86rem;
}
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}

/* ===== Hero ===== */
.hero { position: relative; padding: 120px var(--gutter) 96px; }
.hero-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, #000 40%, transparent 100%); -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, #000 40%, transparent 100%); pointer-events: none; opacity: 0.5; }
.hero-inner { max-width: var(--max); margin: 0 auto; position: relative; }
.hero-title { margin: 0; font-size: clamp(2.4rem, 6vw, 4.5rem); font-weight: 800; line-height: 1.04; letter-spacing: -0.02em; color: var(--fg); }
.hero-title-line-1 { display: block; color: var(--accent); }
.hero-title-line-2 { display: block; color: var(--fg); margin-top: 4px; }
.hero-title-line-3 { display: block; color: var(--fg-dim); font-size: 0.65em; margin-top: 8px; letter-spacing: -0.01em; }
.hero-hi { display: inline-block; }
.hero-sub { max-width: 56ch; margin: 28px 0 0; color: var(--fg-dim); font-size: 1.05rem; line-height: 1.7; }
.hero-cta-row { margin-top: 36px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-meta { margin-top: 28px; color: var(--fg-faint); font-size: 0.78rem; }

/* ===== Buttons ===== */
.btn { display: inline-block; padding: 12px 22px; border-radius: 999px; font-size: 0.88rem; font-weight: 600; letter-spacing: 0.02em; }
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: #000; }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Sections ===== */
.section-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Install CTA */
.install-cta { padding: 96px 0; border-top: 1px solid var(--line); }
.install-inner { text-align: center; }
.install-title { margin: 0 0 18px; color: var(--fg); font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.install-lede { max-width: 60ch; margin: 0 auto 24px; color: var(--fg-dim); font-size: 1.02rem; line-height: 1.7; }
.install-cmd-wrap { position: relative; max-width: 720px; margin: 0 auto 24px; }
.install-cmd-wrap .install-cmd { max-width: none; margin: 0; padding-right: 130px; }
.install-cmd { max-width: 720px; margin: 0 auto 24px; padding: 18px 22px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; text-align: left; }
.install-cmd code { font-family: var(--font-mono); font-size: 0.86rem; color: var(--fg); white-space: nowrap; }

/* Click-to-copy button */
.copy-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 11px;
  background: rgba(245, 245, 245, 0.04);
  color: var(--fg-dim);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.copy-btn:hover { background: rgba(245, 245, 245, 0.10); color: var(--fg); border-color: var(--accent); }
.copy-btn:active { transform: translateY(-50%) scale(0.97); }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-btn svg { width: 13px; height: 13px; display: block; flex-shrink: 0; }
.copy-btn .copy-btn-check { display: none; }
.copy-btn.copied .copy-btn-icon { display: none; }
.copy-btn.copied .copy-btn-check { display: block; }
.copy-btn.copied { background: var(--accent); color: #000; border-color: var(--accent); }
.copy-btn.copy-failed { background: rgba(220, 80, 80, 0.16); color: #ffb0b0; border-color: rgba(220, 80, 80, 0.5); }
@media (max-width: 720px) {
  .copy-btn .copy-btn-label { display: none; }
  .copy-btn { padding: 7px 9px; right: 8px; }
  .install-cmd-wrap .install-cmd { padding-right: 60px; }
}
.install-meta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 0 0 16px; }
.install-fineprint { margin: 24px auto 0; color: var(--fg-faint); font-size: 0.78rem; max-width: 60ch; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 32px; background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.012)); }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer-col-title { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-faint); font-weight: 600; margin: 0 0 12px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin: 0 0 6px; }
.footer-col a { color: var(--fg-dim); font-size: 0.88rem; }
.footer-col a:hover { color: var(--accent); }
.footer-brand { margin: 0 0 6px; color: var(--fg); font-size: 1.1rem; font-weight: 700; letter-spacing: 0.04em; font-family: var(--font-mono); }
.footer-tag { margin: 0; color: var(--fg-faint); font-size: 0.86rem; max-width: 32ch; }
.footer-bottom { max-width: var(--max); margin: 32px auto 0; padding: 20px var(--gutter) 0; border-top: 1px solid var(--line); color: var(--fg-faint); font-size: 0.78rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.footer-build { color: var(--fg-faint); }

/* Install hero (used on landing page + install page) */
.install-hero { padding: 96px var(--gutter) 48px; border-top: 1px solid var(--line); }
.install-hero-inner { max-width: 760px; margin: 0 auto; }
.install-h1 { margin: 0 0 18px; color: var(--fg); font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.install-mini { margin: 18px 0 0; color: var(--fg-faint); font-size: 0.84rem; line-height: 1.6; max-width: 64ch; }
.install-paragraph { margin: 0 0 24px; color: var(--fg-dim); font-size: 1.02rem; line-height: 1.7; max-width: 64ch; }

/* Landing hero brand: FALLYN title + acronym expansion */
.brand-title { color: var(--accent) !important; letter-spacing: 0.02em; font-family: var(--font-mono); }
.install-lede .acro { color: var(--accent); font-weight: 700; }

/* ===== Diffusion (text decode) =====
   Ported from inference.vip's .hero-glitch. The JS swaps the characters; this
   is only the glow and the flicker layered on top while it settles. */
.is-decoding {
  text-shadow: 0 0 7px rgba(255, 255, 255, 0.35), 0 0 22px rgba(232, 200, 122, 0.16);
  animation: decode-flicker 0.42s steps(3, end) infinite;
}
@keyframes decode-flicker {
  0%, 100% { opacity: 1; }
  42% { opacity: 0.9; }
  44% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .is-decoding { animation: none; text-shadow: none; }
}

/* Center the landing hero content (scoped to #hero so the install page stays left-aligned) */
#hero .install-h1,
#hero .install-lede,
#hero .install-paragraph,
#hero .install-mini {
  text-align: center;
}
#hero .install-lede { margin-left: auto; margin-right: auto; }
#hero .install-paragraph { margin-left: auto; margin-right: auto; }
#hero .install-mini { margin-left: auto; margin-right: auto; }

/* Install page-specific */
.install-page .install-lede { margin: 0 0 24px; color: var(--fg-dim); font-size: 1.02rem; line-height: 1.7; }
.install-step { padding: 48px 0; border-top: 1px solid var(--line); }
.install-step .step-num { color: var(--accent); font-size: 0.78rem; letter-spacing: 0.22em; text-transform: uppercase; margin: 0 0 12px; }
.install-step .step-h2 { margin: 0 0 18px; color: var(--fg); font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; }
.install-step .step-lede { color: var(--fg-dim); margin: 0 0 16px; max-width: 64ch; }
.install-step .step-fineprint { color: var(--fg-faint); font-size: 0.84rem; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 16px 0 0; }
.mode { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.mode h3 { margin: 0 0 6px; color: var(--fg); font-size: 1rem; font-weight: 600; }
.mode p { margin: 0 0 12px; color: var(--fg-dim); font-size: 0.9rem; }
.autonomy-pick { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.autonomy-pick li { padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--fg-dim); font-size: 0.92rem; }
.autonomy-pick strong { color: var(--accent); font-family: var(--font-mono); margin-right: 8px; }

/* ===== Platform app shell =====
   A fixed sidebar on desktop, a slide-in drawer under 960px. The layout never
   depends on a fixed height, so long pages scroll normally. */
.app-body { background: var(--bg); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #000; padding: 10px 16px; border-radius: 0 0 8px 0;
  font-size: 0.85rem; font-weight: 600;
}
.skip-link:focus { left: 0; }

.app-shell { display: flex; min-height: 100dvh; }

.app-side {
  width: 248px; flex: 0 0 248px;
  border-right: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; height: 100dvh;
}
.side-nav { display: flex; flex-direction: column; height: 100%; padding: 20px 14px; }

.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 22px; color: var(--fg); text-decoration: none;
}
.side-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.side-brand-name { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.03em; }
.side-brand-sub { font-size: 0.62rem; color: var(--fg-faint); letter-spacing: 0.16em; text-transform: uppercase; margin-top: 2px; }

.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 8px;
  color: var(--fg-dim); text-decoration: none;
  font-size: 0.89rem; font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}
.side-link:hover { background: var(--surface-hover); color: var(--fg); }
.side-link.is-active { background: var(--surface); color: var(--fg); font-weight: 600; }
.side-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-icon { display: inline-flex; width: 17px; height: 17px; flex: 0 0 17px; color: var(--fg-faint); }
.side-icon svg { width: 100%; height: 100%; }
.side-link.is-active .side-icon, .side-link:hover .side-icon { color: var(--accent); }

.side-foot { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 0 8px 12px; min-width: 0; }
.side-avatar { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; display: block; }
.side-avatar-fallback {
  display: grid; place-items: center; background: var(--surface-hover);
  color: var(--accent); font-size: 0.8rem; font-weight: 700;
}
.side-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-user-name { color: var(--fg); font-size: 0.84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-mail { color: var(--fg-faint); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-signout {
  display: block; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 8px; color: var(--fg-dim); text-decoration: none;
  font-size: 0.82rem; text-align: center; transition: border-color 0.16s ease, color 0.16s ease;
}
.side-signout:hover { border-color: var(--accent); color: var(--fg); }

.app-main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; min-height: 62px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.app-title { margin: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; color: var(--fg); }
.app-top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.app-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.76rem; color: var(--fg-dim); white-space: nowrap;
}
.app-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-faint); flex: 0 0 7px; }
.app-badge[data-status="ok"] .app-dot { background: var(--accent); }
.app-badge[data-status="down"] .app-dot { background: #E5484D; }

.app-burger { display: none; }
.app-main { padding: 28px; flex: 1; }

.page { max-width: 1120px; margin: 0 auto; }
.page-lede { margin: 0 0 26px; color: var(--fg-dim); font-size: 0.98rem; line-height: 1.65; max-width: 62ch; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 28px; }
.tile {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); text-decoration: none; color: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.tile:hover { border-color: var(--line-strong); background: var(--surface-hover); transform: translateY(-2px); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-label { color: var(--fg-dim); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.tile-value { color: var(--fg); font-family: var(--font-mono); font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.tile-note { color: var(--fg-faint); font-size: 0.82rem; line-height: 1.55; }

/* Panels */
.panel { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.panel-title { margin: 0; font-size: 0.92rem; font-weight: 650; color: var(--fg); }
.panel-note { margin-left: auto; color: var(--fg-faint); font-size: 0.78rem; }
.panel-body { padding: 20px; }
.empty { margin: 0; color: var(--fg-faint); font-size: 0.88rem; }

.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 0.87rem; }
.stat-row + .stat-row { border-top: 1px solid var(--line); }
.stat-key { color: var(--fg-dim); }
.stat-val { color: var(--fg); font-family: var(--font-mono); font-weight: 600; }

/* Segmented status meters. Each segment is one unit: green when healthy,
   red when not. A 13-of-13 row reads at a glance without reading a number. */
.meter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.meter { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--surface); }
.meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.meter-label { color: var(--fg-dim); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.meter-value { color: var(--fg); font-family: var(--font-mono); font-size: 0.86rem; font-weight: 700; }
.meter-bar { display: flex; gap: 3px; flex-wrap: wrap; }
.meter-bar .seg {
  flex: 1 1 6px; min-width: 5px; height: 7px; border-radius: 2px;
  background: rgba(229, 72, 77, 0.55);
  transition: background 0.3s ease;
}
.meter-bar .seg.on { background: var(--accent); }
.meter-bar.is-empty .seg { background: var(--line-strong); }

.roster-list { display: flex; flex-direction: column; gap: 8px; }
.roster-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg-elev);
}
.roster-dot { width: 8px; height: 8px; border-radius: 50%; background: #E5484D; flex: 0 0 8px; }
.roster-dot[data-status="active"] { background: var(--accent); }
.roster-name { color: var(--fg); font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600; }
.roster-meta { margin-left: auto; color: var(--fg-faint); font-size: 0.76rem; display: flex; gap: 12px; }
.panel-link { margin-left: auto; color: var(--fg-dim); font-size: 0.8rem; text-decoration: none; }
.panel-link:hover { color: var(--accent); }

.token-reveal { margin-top: 18px; padding: 14px; border: 1px solid var(--accent-dim); border-radius: 9px; background: var(--surface); }
.token-warn { margin: 0 0 10px; color: var(--accent); font-size: 0.8rem; line-height: 1.5; }
.token-value, .token-cmd {
  margin: 0 0 10px; padding: 10px 12px; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
}
.token-value code, .token-cmd code {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg); white-space: pre;
}

/* Attention requests raised by a linked machine */
.attention-list { display: flex; flex-direction: column; gap: 12px; }
.attention-item { padding: 16px; border: 1px solid var(--accent-dim); border-radius: 10px; background: var(--bg-elev); }
.attention-q { margin: 0 0 6px; color: var(--fg); font-size: 0.94rem; line-height: 1.55; }
.attention-meta { margin: 0 0 12px; color: var(--fg-faint); font-size: 0.78rem; }
.attention-form { display: flex; gap: 8px; }
.attention-form .field-input { flex: 1; }

/* Agents */
.agents-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.agents-layout .panel { margin-bottom: 0; }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-label { color: var(--fg-dim); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.field-input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-elev); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: inherit; font-size: 0.9rem; line-height: 1.5;
  transition: border-color 0.16s ease;
}
.field-input::placeholder { color: var(--fg-faint); }
.field-input:hover { border-color: var(--line-strong); }
.field-input:focus { outline: none; border-color: var(--accent); }
.field-textarea { resize: vertical; min-height: 92px; }
.field-mono { font-family: var(--font-mono); font-size: 0.82rem; }
.field-help { margin: 0; color: var(--fg-faint); font-size: 0.78rem; line-height: 1.5; }
select.field-input { appearance: none; cursor: pointer; }
.form-error {
  margin: 0; padding: 10px 12px; border-radius: 8px;
  background: rgba(229, 72, 77, 0.1); border: 1px solid rgba(229, 72, 77, 0.35);
  color: #FF8A8E; font-size: 0.85rem; line-height: 1.5;
}
.form-actions { display: flex; gap: 10px; }

.agent-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--bg-elev); }
.agent-card + .agent-card { margin-top: 12px; }
.agent-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.agent-name { color: var(--fg); font-family: var(--font-mono); font-size: 0.98rem; font-weight: 700; }
.agent-tag {
  margin-left: auto; padding: 3px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--fg-dim);
}
.agent-tag[data-status="active"] { color: var(--accent); border-color: var(--accent-dim); }
.agent-desc { margin: 0 0 10px; color: var(--fg-dim); font-size: 0.86rem; line-height: 1.6; }
.agent-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--fg-faint); font-size: 0.78rem; }
.agent-meta b { color: var(--fg-dim); font-weight: 600; }
.agent-actions { display: flex; gap: 8px; margin-top: 12px; }
.agent-btn {
  padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: transparent; color: var(--fg-dim); font-family: inherit;
  font-size: 0.78rem; cursor: pointer; transition: border-color 0.16s ease, color 0.16s ease;
}
.agent-btn:hover { border-color: var(--accent); color: var(--fg); }
.agent-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.agent-btn-danger:hover { border-color: #E5484D; color: #FF8A8E; }

@media (max-width: 860px) {
  .agents-layout { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

/* Placeholder */
.placeholder {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 48px 32px; text-align: center; background: var(--surface);
}
.placeholder-mark {
  display: inline-grid; place-items: center; width: 46px; height: 46px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  color: var(--accent); margin-bottom: 20px;
}
.placeholder-mark svg { width: 20px; height: 20px; }
.placeholder-title { margin: 0 0 12px; color: var(--fg); font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.placeholder-text { margin: 0 auto 14px; max-width: 52ch; color: var(--fg-dim); font-size: 0.95rem; line-height: 1.65; }
.placeholder-note { margin: 0 auto 24px; max-width: 52ch; color: var(--fg-faint); font-size: 0.85rem; line-height: 1.6; }
.placeholder-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.app-scrim {
  position: fixed; inset: 0; z-index: 28;
  background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.2s ease;
}
.app-scrim.is-open { opacity: 1; }

@media (max-width: 960px) {
  .app-side {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
    width: 272px; flex-basis: 272px; height: 100dvh;
    transform: translateX(-100%); transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    border-right: 1px solid var(--line-strong);
  }
  .app-side.is-open { transform: none; }
  .app-burger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 38px; height: 38px; padding: 0 9px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
    cursor: pointer;
  }
  .app-burger span { display: block; height: 1.5px; background: var(--fg); border-radius: 2px; transition: transform 0.2s ease, opacity 0.2s ease; }
  .app-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  .app-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .app-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
  .app-top { padding: 14px 18px; }
  .app-main { padding: 20px 18px 48px; }
}

@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr; }
  .tile { padding: 18px; }
  .placeholder { padding: 36px 20px; }
  .app-badge .app-status-text { display: none; }
  .app-badge { padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .side-link, .app-side, .app-scrim, .app-burger span { transition: none; }
  .tile:hover { transform: none; }
}

/* ===== Sign in and Platform ===== */
.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  animation: auth-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.auth-brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--fg); text-decoration: none; font-weight: 700;
  letter-spacing: 0.04em; font-size: 0.95rem; font-family: var(--font-mono);
  margin-bottom: 34px;
}
.auth-title {
  margin: 0 0 8px; color: var(--fg);
  font-size: clamp(1.5rem, 4vw, 1.9rem); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.15;
}
.auth-lede {
  margin: 0 0 26px; color: var(--fg-dim);
  font-size: 0.94rem; line-height: 1.6;
}
.auth-alert {
  margin: 0 0 20px; padding: 11px 14px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--fg-dim);
  font-size: 0.86rem; line-height: 1.5;
}
.auth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 18px;
  background: var(--fg); color: var(--bg);
  border: 1px solid transparent; border-radius: 10px;
  font-size: 0.94rem; font-weight: 600; text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.auth-btn:hover { background: var(--accent); color: #000; transform: translateY(-1px); }
.auth-btn:active { transform: translateY(0); }
.auth-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.auth-btn-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.auth-btn-disabled {
  background: var(--surface); color: var(--fg-faint);
  border-color: var(--line); cursor: not-allowed; transform: none;
}
.auth-btn-disabled:hover { background: var(--surface); color: var(--fg-faint); transform: none; }
.auth-note {
  margin: 12px 0 0; color: var(--fg-faint);
  font-size: 0.8rem; text-align: center;
}
.auth-fineprint {
  margin: 30px 0 0; text-align: center;
  font-size: 0.82rem; color: var(--fg-faint);
}
.auth-fineprint a { color: var(--fg-dim); }
.auth-fineprint a:hover { color: var(--accent); }

.platform-page { padding: 72px 0 96px; }
.platform-page .install-lede { max-width: 56ch; text-align: left; margin-left: 0; }

.nav-cta-short { display: none; }

@media (max-width: 720px) {
  /* The nav is already tight once the brand mark and account button are in it. */
  .nav-actions { gap: 10px; }
  .nav-user-name { display: none; }
  .nav-account { padding: 6px; }
  .nav-account-name { display: none; }
  /* Reclaim width: the quiet "Sign in" link is redundant next to the Google
     button, and the nav gap plus gutter were enough to push the cluster past
     the viewport at 320px. */
  .nav-signin { display: none; }
  .nav-inner { gap: 12px; padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 400px) {
  .nav-inner { padding-left: 14px; padding-right: 14px; }
  .brand-text { font-size: 0.86rem; }
  .nav-cta { padding: 8px 13px; font-size: 0.8rem; }
  .nav-cta-long { display: none; }
  .nav-cta-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; }
  .auth-btn, .nav-cta, .nav-account { transition: none; }
}

/* ===== Error pages (404 / 500) ===== */
.error-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}
.error-inner {
  max-width: 560px;
  width: 100%;
  text-align: center;
  animation: error-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes error-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.error-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  font-family: var(--font-mono);
  margin-bottom: 40px;
}
.error-status {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.error-title {
  margin: 0 0 14px;
  color: var(--fg);
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.error-lede {
  margin: 0 auto 28px;
  max-width: 44ch;
  color: var(--fg-dim);
  font-size: 1rem;
  line-height: 1.7;
}
.error-ref {
  margin: 0 0 28px;
  color: var(--fg-faint);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.error-ref code {
  color: var(--fg-dim);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: clamp(1.8rem, 8vw, 2.6rem); }
  .install-cmd { padding: 14px 16px; }
  .install-cmd code { font-size: 0.78rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.roster-actions { display: flex; gap: 6px; margin-left: 10px; }
@media (max-width: 720px) { .roster-actions { margin-left: auto; } }

/* ===== Agent rows and per-agent console ===== */
.roster-item { text-decoration: none; color: inherit; }
.roster-item:hover { border-color: var(--line-strong); }
.roster-dot[data-life="pending"]           { background: var(--fg-faint); }
.roster-dot[data-life="ready_to_install"] { background: var(--fg-dim); }
.roster-dot[data-life="installing"]       { background: var(--accent); animation: life-pulse 1.4s ease-in-out infinite; }
.roster-dot[data-life="online"]           { background: var(--accent); }
.roster-dot[data-life="degraded"]         { background: #E8A33D; }
.roster-dot[data-life="offline"]          { background: #E5484D; }
@keyframes life-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.life-text { color: var(--fg-dim); }

.agent-rows { display: flex; flex-direction: column; gap: 10px; }
.agent-row {
  display: flex; flex-direction: column; gap: 8px; position: relative;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-elev); text-decoration: none; color: inherit;
  transition: border-color 0.16s ease;
}
.agent-row:hover { border-color: var(--line-strong); }
.agent-row-main { display: flex; align-items: center; gap: 10px; }
.agent-row-name { color: var(--fg); font-family: var(--font-mono); font-size: 0.94rem; font-weight: 700; }
.life-tag {
  margin-left: auto; padding: 3px 9px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--fg-dim);
}
.life-tag.life-good { color: var(--accent); border-color: var(--accent-dim); }
.life-tag.life-warn { color: #E8A33D; border-color: rgba(232,163,61,0.4); }
.life-tag.life-bad  { color: #FF8A8E; border-color: rgba(229,72,77,0.4); }
.agent-row-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--fg-faint); font-size: 0.76rem; }
.agent-row-hint { color: var(--fg-dim); }
.agent-row-actions { display: flex; gap: 8px; margin-top: 2px; }

.agent-head { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.agent-head-main { min-width: 0; }
.back-link { display: inline-block; margin-bottom: 10px; color: var(--fg-faint); font-size: 0.8rem; text-decoration: none; }
.back-link:hover { color: var(--accent); }
.agent-title { margin: 0 0 8px; color: var(--fg); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; font-family: var(--font-mono); }
.agent-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.agent-hint { color: var(--fg-faint); font-size: 0.84rem; }
.life { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-dim); }
.life::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.life-good { color: var(--accent); }
.life-warn { color: #E8A33D; }
.life-bad  { color: #FF8A8E; }
.life-idle { color: var(--fg-faint); }
.life-busy { color: var(--accent); }
.agent-head-actions { margin-left: auto; display: flex; gap: 8px; }
.tiles-tight { margin-bottom: 18px; }
.tile-flat { cursor: default; }
.tile-flat:hover { transform: none; border-color: var(--line); background: var(--surface); }
.tile-value-sm { font-size: 1.3rem; }
.install-log-sm { max-height: 260px; }

@media (max-width: 640px) {
  .agent-row-actions { flex-wrap: wrap; }
  .agent-head-actions { margin-left: 0; }
}
