/* ============================================================================
   osintelite Marketplace — "INTELLIGENCE CONSOLE" design system
   Single source of truth: dark-first, hairline borders, two accents
   (cyan SIGNAL + emerald TRUST), monospace for all technical data.
   No build step. Works from file:// and any static server.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------------- */
:root {
  /* Surfaces / structure */
  --bg-base: #0A0C0E;
  --bg-sunken: #07090B;
  --bg-raised: #12161A;
  --bg-raised-2: #181D22;
  --border-hairline: #1F262C;
  --border-strong: #2B343C;

  /* Text */
  --text-primary: #E4E9ED;
  --text-secondary: #A6B2BC;
  --text-muted: #7C8A95;
  --text-inverse: #07090B;

  /* Signal — CYAN (interactive, brand, active) */
  --signal: #38BDF8;
  --signal-hover: #5ECEF9;
  --signal-press: #1FA8E6;
  --signal-dim: #1C3A47;
  --signal-glow: rgba(56, 189, 248, 0.14);

  /* Trust — EMERALD (verification ONLY) */
  --trust: #2DD4A7;
  --trust-dim: #123A32;
  --trust-text: #5FE3C0;
  --trust-glow: rgba(45, 212, 167, 0.16);

  /* Themed surface effects (overridden by the light theme) */
  color-scheme: dark;
  --grid-line: rgba(122, 162, 188, 0.045);
  --aura-1: rgba(56, 189, 248, 0.14);
  --aura-2: rgba(45, 212, 167, 0.05);
  --top-highlight: rgba(255, 255, 255, 0.022);
  --top-highlight-hover: rgba(255, 255, 255, 0.05);
  --card-shadow: none;
  --card-hover-shadow: 0 14px 34px -18px rgba(0, 0, 0, 0.78);
  --card-hover-glow: rgba(56, 189, 248, 0.30);
  --signal-glow-strong: rgba(56, 189, 248, 0.22);
  --nav-bg: rgba(9, 11, 13, 0.9);
  --nav-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  --menu-shadow: 0 18px 48px -18px rgba(0, 0, 0, 0.85);
  --scroll-hover: #3A454E;

  /* Status / semantic */
  --status-ok: #2DD4A7;
  --status-warn: #F5B544;
  --status-down: #FF5C57;
  --status-idle: #7C8A95;

  /* HTTP method colors */
  --m-get: #38BDF8;
  --m-post: #2DD4A7;
  --m-put: #F5B544;
  --m-patch: #A78BFA;
  --m-delete: #FF5C57;

  /* Fonts */
  /* Brand: exactly two loaded web fonts (Exo 2 display + IBM Plex Sans body),
     matching the other osintelite sites. Technical data uses the OS monospace
     (no third web font), same pattern as map-poc-api. */
  --font-display: "Exo 2", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Liberation Mono", monospace;

  /* Radius — keep tight, "instrument" not "bubbly" */
  --r-chip: 4px;
  --r-btn: 6px;
  --r-card: 8px;
  --r-pill: 999px;

  /* Spacing base unit 4px */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Layout */
  --container: 1200px;
  --nav-h: 60px;
}

/* ---------------------------------------------------------------------------
   1b. LIGHT THEME — the DEFAULT (set via <html data-theme="light">).
   Token overrides only; the dark palette stays in :root for the toggle.
   --------------------------------------------------------------------------- */
[data-theme="light"] {
  color-scheme: light;

  --bg-base: #F7F9FB;
  --bg-sunken: #EEF2F6;
  --bg-raised: #FFFFFF;
  --bg-raised-2: #F2F6FA;
  --border-hairline: #E4E9EF;
  --border-strong: #CBD3DC;

  --text-primary: #0E1726;
  --text-secondary: #45525F;
  --text-muted: #6B7785;
  --text-inverse: #FFFFFF;

  --signal: #0284C7;
  --signal-hover: #0369A1;
  --signal-press: #075985;
  --signal-dim: #DCEEFA;
  --signal-glow: rgba(2, 132, 199, 0.16);

  --trust: #059669;
  --trust-dim: #D6F1E5;
  --trust-text: #047857;
  --trust-glow: rgba(5, 150, 105, 0.18);

  --status-ok: #059669;
  --status-warn: #B45309;
  --status-down: #DC2626;
  --status-idle: #94A3B8;

  --m-get: #0284C7;
  --m-post: #059669;
  --m-put: #B45309;
  --m-patch: #7C3AED;
  --m-delete: #DC2626;

  --grid-line: rgba(30, 58, 95, 0.05);
  --aura-1: rgba(2, 132, 199, 0.07);
  --aura-2: rgba(5, 150, 105, 0.05);
  --top-highlight: transparent;
  --top-highlight-hover: transparent;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --card-hover-shadow: 0 14px 30px -14px rgba(16, 24, 40, 0.18);
  --card-hover-glow: rgba(2, 132, 199, 0.18);
  --signal-glow-strong: rgba(2, 132, 199, 0.14);
  --nav-bg: rgba(255, 255, 255, 0.82);
  --nav-shadow: 0 1px 0 rgba(16, 24, 40, 0.06);
  --menu-shadow: 0 18px 48px -18px rgba(16, 24, 40, 0.28);
  --scroll-hover: #B6C0CB;
}

/* ---------------------------------------------------------------------------
   2. RESET / BASE
   --------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
/* Recon lattice — faint hairline grid, masked to fade out toward the fold */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(125% 80% at 50% -12%, #000 0%, rgba(0,0,0,0.35) 46%, transparent 82%);
  mask-image: radial-gradient(125% 80% at 50% -12%, #000 0%, rgba(0,0,0,0.35) 46%, transparent 82%);
}
/* Atmosphere — twin signal/trust auras bleeding from the top edge for depth */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(840px 460px at 82% -14%, var(--aura-1), transparent 60%),
    radial-gradient(700px 480px at 1% -6%, var(--aura-2), transparent 55%);
}

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

a {
  color: var(--signal);
  text-decoration: none;
  transition: color 0.14s ease;
}
a:hover { color: var(--signal-hover); }

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: var(--r-chip);
}

::selection { background: var(--signal-dim); color: var(--text-primary); }

/* Instrument-grade thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
::-webkit-scrollbar-track { background: transparent; }

/* Page-load orchestration — nav drops in, content rises in a short stagger.
   Disabled wholesale by the prefers-reduced-motion block at the end of file. */
@keyframes oe-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes oe-navdrop { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
main > * { animation: oe-rise 0.5s cubic-bezier(0.2, 0.6, 0.2, 1) both; }
main > *:nth-child(1) { animation-delay: 0.04s; }
main > *:nth-child(2) { animation-delay: 0.10s; }
main > *:nth-child(3) { animation-delay: 0.16s; }
main > *:nth-child(4) { animation-delay: 0.22s; }
main > *:nth-child(5) { animation-delay: 0.28s; }
main > *:nth-child(n+6) { animation-delay: 0.32s; }

hr {
  border: 0;
  border-top: 1px solid var(--border-hairline);
  margin: var(--sp-6) 0;
}

/* ---------------------------------------------------------------------------
   3. TYPOGRAPHY SCALE (modular 1.25)
   --------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin: 0 0 var(--sp-3);
  font-weight: 600;
}

.display-xl { font: 800 clamp(32px, 5.2vw, 44px)/1.06 var(--font-display); letter-spacing: -0.03em; }
.display-lg, h1 { font: 700 31px/38px var(--font-display); letter-spacing: -0.015em; }
.heading, h2 { font: 600 25px/32px var(--font-display); letter-spacing: -0.01em; }
.subheading, h3 { font: 600 20px/28px var(--font-display); letter-spacing: -0.005em; }
h4 { font: 600 16px/24px var(--font-display); letter-spacing: -0.005em; }

p { margin: 0 0 var(--sp-4); }
.body-lg { font: 400 16px/26px var(--font-body); }
.body { font: 400 16px/24px var(--font-body); }
.body-sm { font: 400 13px/20px var(--font-body); }
.lead { font: 400 16px/26px var(--font-body); color: var(--text-secondary); }

.eyebrow {
  font: 600 12px/16px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: inline-block;
}

/* Mono runs one step down for density */
.mono { font-family: var(--font-mono); }
.mono-data { font: 400 13px/20px var(--font-mono); }
.mono-sm { font: 500 12px/16px var(--font-mono); }

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-signal { color: var(--signal); }
.text-trust { color: var(--trust-text); }
.text-warn { color: var(--status-warn); }
.text-down { color: var(--status-down); }

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

/* ---------------------------------------------------------------------------
   4. LAYOUT PRIMITIVES
   --------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
}
.container-narrow { max-width: 880px; }

/* Vertical rhythm — intentional alternating cadence so sections feel paced,
   not arbitrary. Odd sections: var(--sp-12) top+bottom. Even sections: a
   tighter var(--sp-10) top with a deeper var(--sp-16) bottom to open breathing
   room before the next band. Hero + stats-band set their own padding in the
   page-local <style> to anchor the top of this cadence. */
.section { padding: var(--sp-12) 0; }
.section:nth-of-type(even) { padding: var(--sp-10) 0 var(--sp-16) 0; }
.section-sm { padding: var(--sp-8) 0; }

.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-8); }

.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.row-wrap { flex-wrap: wrap; }
.row-top { align-items: flex-start; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.grow { flex: 1; }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-services { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: var(--sp-6); }

.sidebar-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--sp-8);
  align-items: start;
}

.divider { border-top: 1px solid var(--border-hairline); margin: var(--sp-6) 0; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .container { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar-layout { grid-template-columns: 1fr; }
  .section { padding: var(--sp-8) 0; }
}

/* ---------------------------------------------------------------------------
   5. TOP NAV
   --------------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--border-hairline);
  box-shadow: var(--nav-shadow);
  animation: oe-navdrop 0.5s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
.nav-inner {
  height: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-primary);
}
.nav-brand:hover { color: var(--text-primary); }
.nav-logo { height: 30px; width: auto; display: block; }
.footer-logo { height: 26px; width: auto; display: block; }
/* real logo is dark-on-light; flip to white on the dark theme so it stays legible */
[data-theme="dark"] .nav-logo,
[data-theme="dark"] .footer-logo { filter: brightness(0) invert(1); }
.nav-brand .logo { width: 26px; height: 26px; flex: none; }
.nav-brand .wordmark {
  font: 600 19px/1 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: var(--sp-4);
}
.nav-link {
  position: relative;
  padding: var(--sp-2) var(--sp-3);
  font: 500 14px/1 var(--font-body);
  color: var(--text-secondary);
  border-radius: var(--r-btn);
  transition: color 0.14s ease, background 0.14s ease;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-raised); }
.nav-link.active { color: var(--text-primary); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: -19px;
  height: 2px;
  background: var(--signal);
}
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: var(--sp-3); }

/* theme toggle (injected into .nav-actions by app.js) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-btn);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.theme-toggle:hover { color: var(--text-primary); background: var(--bg-raised-2); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-btn);
  padding: var(--sp-2);
  color: var(--text-primary);
}

@media (max-width: 900px) {
  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-hairline);
    padding: var(--sp-2);
    margin: 0;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-link.active::after { display: none; }
  .nav-link.active { background: var(--bg-raised-2); }
  .nav-toggle { display: inline-flex; }
  .nav-actions .btn-ghost { display: none; }
}

/* ---------------------------------------------------------------------------
   6. FOOTER
   --------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-sunken);
  margin-top: var(--sp-16);
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--sp-12) var(--sp-6) var(--sp-8);
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--sp-8);
}
.footer-brand .row { margin-bottom: var(--sp-4); }
.footer-col h5 {
  font: 600 12px/16px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 var(--sp-4);
}
.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 14px;
  padding: var(--sp-1) 0;
}
.footer-col a:hover { color: var(--signal); }
.footer-bottom {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-6);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
}
.footer-bottom .mono-sm { color: var(--text-muted); }
@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

/* ---------------------------------------------------------------------------
   7. BUTTONS
   --------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font: 600 14px/1 var(--font-body);
  padding: 10px 16px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--signal);
  color: var(--text-inverse);
  border-color: var(--signal);
  box-shadow: 0 6px 16px -10px rgba(56, 189, 248, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); color: var(--text-inverse); box-shadow: 0 10px 24px -10px rgba(56, 189, 248, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-primary:active { background: var(--signal-press); }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--bg-raised-2); border-color: var(--border-strong); color: var(--text-primary); }

.btn-trust {
  background: transparent;
  border-color: var(--trust);
  color: var(--trust-text);
}
.btn-trust:hover { background: var(--trust-dim); color: var(--trust-text); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------------------------
   8. CARDS / PANELS
   --------------------------------------------------------------------------- */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  box-shadow: var(--card-shadow), inset 0 1px 0 var(--top-highlight);
}
.card-pad-lg { padding: var(--sp-6); }
.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  box-shadow: var(--card-shadow), inset 0 1px 0 var(--top-highlight);
}
.panel-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.panel-body { padding: var(--sp-5); }
.panel-sunken { background: var(--bg-sunken); }

/* Service card — used by OE.serviceCard, identical on home + catalog */
.service-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-left: 2px solid transparent;
  border-radius: var(--r-card);
  padding: var(--sp-5);
  color: var(--text-primary);
  box-shadow: var(--card-shadow), inset 0 1px 0 var(--top-highlight);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
  height: 100%;
}
.service-card:hover {
  background: var(--bg-raised-2);
  border-left-color: var(--signal);
  color: var(--text-primary);
  transform: translateY(-3px);
  box-shadow: var(--card-hover-shadow), 0 12px 32px -12px var(--card-hover-glow), 0 0 0 1px var(--signal-dim), inset 0 1px 0 var(--top-highlight-hover);
}
.service-card.is-verified:hover {
  border-left-color: var(--trust);
  box-shadow: var(--card-hover-shadow), 0 12px 32px -12px var(--trust-glow), 0 0 0 1px var(--trust-dim), inset 0 1px 0 var(--top-highlight-hover);
}
.service-card .sc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.service-card .sc-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.service-card .sc-cat svg { width: 14px; height: 14px; }
.service-card .sc-name { font: 600 18px/24px var(--font-display); letter-spacing: -0.01em; margin: 0; }
.service-card .sc-provider { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.service-card .sc-tagline { color: var(--text-secondary); font-size: 14px; line-height: 21px; margin: var(--sp-3) 0; flex: 1; }
.service-card .sc-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-top: var(--sp-3);
  margin-top: auto;
  border-top: 1px solid var(--border-hairline);
}
.service-card .sc-status { display: flex; align-items: center; gap: 6px; }
.service-card .sc-price { margin-left: auto; text-align: right; }
.service-card .sc-price .amt { font: 500 14px/16px var(--font-mono); color: var(--text-primary); }
.service-card .sc-price .model { font-size: 11px; color: var(--text-muted); }

/* ---------------------------------------------------------------------------
   9. BADGES
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-hairline);
  background: var(--bg-raised);
  font: 500 12px/14px var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }

/* VERIFIED (emerald) — the atomic trust unit */
.badge-verified {
  border-color: var(--trust);
  background: var(--trust-dim);
  color: var(--trust-text);
  letter-spacing: 0.04em;
}
.badge-verified svg { stroke: var(--trust); }

/* PENDING / IN REVIEW (amber) */
.badge-pending {
  border-color: var(--status-warn);
  background: var(--bg-raised);
  color: var(--status-warn);
}
.badge-pending svg { stroke: var(--status-warn); }

/* Tier badges */
.badge-tier-certified {
  border-color: var(--trust);
  background: var(--trust-dim);
  color: var(--trust-text);
}
.badge-tier-certified svg { stroke: var(--trust); }
.badge-tier-verified {
  border-color: var(--trust);
  background: transparent;
  color: var(--trust-text);
}
.badge-tier-verified svg { stroke: var(--trust); }
.badge-tier-basic {
  border-color: var(--border-strong);
  background: var(--bg-raised);
  color: var(--text-muted);
}

/* audit stamp following a verified pill */
.audit-stamp { font: 400 12px/16px var(--font-mono); color: var(--text-muted); }

/* clickable verified pill button */
.verify-pill {
  cursor: pointer;
  transition: filter 0.14s ease;
}
.verify-pill:hover { filter: brightness(1.12); }

/* Verification ledger panel */
.ledger {
  margin-top: var(--sp-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  padding: var(--sp-4) var(--sp-5);
}
.ledger[hidden] { display: none; }
.ledger-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--sp-4);
  padding: 5px 0;
  font: 400 13px/20px var(--font-mono);
}
.ledger-row .k { color: var(--text-muted); }
.ledger-row .v { color: var(--text-primary); word-break: break-all; }
.ledger-row .v.ok { color: var(--trust-text); }

/* ---------------------------------------------------------------------------
   10. METHOD BADGES (mono)
   --------------------------------------------------------------------------- */
.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 2px 7px;
  border-radius: var(--r-chip);
  border: 1px solid var(--border-hairline);
  background: var(--bg-raised);
  font: 500 12px/16px var(--font-mono);
  letter-spacing: 0.04em;
}
.method-get { color: var(--m-get); }
.method-post { color: var(--m-post); }
.method-put { color: var(--m-put); }
.method-patch { color: var(--m-patch); }
.method-delete { color: var(--m-delete); }

/* ---------------------------------------------------------------------------
   11. STAT TILES
   --------------------------------------------------------------------------- */
.stat {
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  box-shadow: var(--card-shadow), inset 0 1px 0 var(--top-highlight);
}
.stat .stat-label {
  font: 600 12px/16px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.stat .stat-value {
  font: 700 31px/36px var(--font-display);
  letter-spacing: -0.015em;
  color: var(--text-primary);
}
.stat .stat-value .unit { font: 400 14px/1 var(--font-mono); margin-left: 4px; }
.stat .stat-sub { margin-top: var(--sp-2); font-size: 13px; color: var(--text-secondary); }
.stat .stat-delta { font: 500 12px/16px var(--font-mono); }
.stat .stat-delta.up { color: var(--trust-text); }
.stat .stat-delta.down { color: var(--status-down); }

/* ---------------------------------------------------------------------------
   12. TABLES (hairline data-grid)
   --------------------------------------------------------------------------- */
.table-wrap {
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-raised);
}
.table-wrap.scroll-x { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table thead th {
  text-align: left;
  font: 600 12px/16px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
}
.table tbody td {
  padding: 0 var(--sp-4);
  height: 44px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr {
  position: relative;
  transition: background 0.12s ease;
}
.table tbody tr:hover { background: var(--bg-raised-2); }
.table tbody tr td:first-child { box-shadow: inset 0 0 0 transparent; }
.table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
.table tbody tr.is-verified:hover td:first-child { box-shadow: inset 3px 0 0 var(--trust); }
.table td.num, .table th.num { text-align: right; font-family: var(--font-mono); font-size: 13px; }
.table td .mono-data, .table td .mono-sm { color: var(--text-primary); }
.table-rows-catalog tbody td { height: 52px; }

/* ---------------------------------------------------------------------------
   13. FORMS / INPUTS
   --------------------------------------------------------------------------- */
.field { display: block; margin-bottom: var(--sp-4); }
.field-label {
  display: block;
  font: 500 13px/18px var(--font-body);
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

input[type="text"], input[type="email"], input[type="search"],
input[type="password"], input[type="number"], input[type="url"],
select, textarea, .input {
  width: 100%;
  background: var(--bg-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-btn);
  color: var(--text-primary);
  font: 400 14px/1.4 var(--font-body);
  padding: 10px 12px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus, .input:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: 0 0 0 3px var(--signal-glow);
}
textarea { resize: vertical; min-height: 96px; }
input.mono, textarea.mono, .input.mono, input[type="password"] { font-family: var(--font-mono); font-size: 13px; }
select {
  appearance: none;
  -webkit-appearance: none;
  /* Chevron is drawn from an SVG dyed to match --text-muted PER THEME.
     Default (dark) stroke = #7C8A95; the light override below swaps to #6B7785
     so the arrow stays legible against light select surfaces in both themes. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237C8A95' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7785' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* search input with leading icon */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; stroke: var(--text-muted); pointer-events: none; }
.search input { padding-left: 38px; }

/* Switch toggle */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 22px;
  flex: none;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  width: 100%;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  transition: background 0.16s ease, border-color 0.16s ease;
}
.switch .thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.16s ease, background 0.16s ease;
}
.switch input:checked + .track { background: var(--signal-dim); border-color: var(--signal); }
.switch input:checked ~ .thumb { transform: translateX(18px); background: var(--signal); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--signal-glow); }

/* ---------------------------------------------------------------------------
   14. TABS
   --------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border-hairline);
  margin-bottom: var(--sp-6);
}
.tab {
  position: relative;
  background: transparent;
  border: 0;
  padding: var(--sp-3) var(--sp-3);
  font: 500 14px/1 var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.14s ease;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); }
.tab.active::after {
  content: "";
  position: absolute;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: -1px;
  height: 2px;
  background: var(--signal);
}
.tab-panel[hidden] { display: none; }

/* ---------------------------------------------------------------------------
   15. STEPPER / WIZARD
   --------------------------------------------------------------------------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--sp-8);
}
.step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-muted);
  font: 500 14px/1 var(--font-body);
}
.step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  font: 500 13px/1 var(--font-mono);
  color: var(--text-muted);
  flex: none;
}
.step .step-line { width: 40px; height: 1px; background: var(--border-hairline); margin: 0 var(--sp-3); }
.step.active { color: var(--text-primary); }
.step.active .step-num { border-color: var(--signal); color: var(--signal); }
.step.done { color: var(--text-secondary); }
.step.done .step-num { border-color: var(--trust); background: var(--trust-dim); color: var(--trust-text); }
@media (max-width: 720px) {
  .step .step-label { display: none; }
  .step .step-line { width: 20px; margin: 0 var(--sp-2); }
}

/* ---------------------------------------------------------------------------
   16. PILL FILTERS / CHECKBOX-PILLS / TAG CHIPS
   --------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-hairline);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font: 500 13px/1 var(--font-body);
  cursor: pointer;
  user-select: none;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}
.pill svg { width: 14px; height: 14px; }
.pill:hover { border-color: var(--border-strong); color: var(--text-primary); }
.pill.active {
  border-color: var(--signal);
  background: var(--signal-dim);
  color: var(--signal);
}
.pill .count { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.pill.active .count { color: var(--signal); }

.pill-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* checkbox-pill (hidden checkbox) */
.pill-check { cursor: pointer; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check input:checked + .pill {
  border-color: var(--signal);
  background: var(--signal-dim);
  color: var(--signal);
}
.pill-check input:focus-visible + .pill { box-shadow: 0 0 0 3px var(--signal-glow); }

/* tag chip (static) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-chip);
  border: 1px solid var(--border-hairline);
  background: var(--bg-sunken);
  color: var(--text-secondary);
  font: 500 12px/16px var(--font-body);
  white-space: nowrap;
}
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------------------
   17. CODE BLOCKS / MONO EVIDENCE / COPY
   --------------------------------------------------------------------------- */
.code {
  background: var(--bg-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  padding: var(--sp-4);
  font: 400 13px/20px var(--font-mono);
  color: var(--text-primary);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-bottom: 0;
  border-radius: var(--r-card) var(--r-card) 0 0;
  font: 500 12px/16px var(--font-mono);
  color: var(--text-muted);
}
.code-header + .code { border-radius: 0 0 var(--r-card) var(--r-card); }
/* Copy-affordance hover feedback — themed token works in BOTH themes */
.code-header:hover { background: var(--bg-raised-2); }

/* JSON syntax tints — only existing tokens */
.code .j-key { color: var(--text-secondary); }
.code .j-str { color: var(--trust-text); opacity: 0.85; }
.code .j-num { color: var(--signal); }
.code .j-bool { color: var(--signal); }
.code .j-punc { color: var(--text-muted); }

/* inline mono identifier chip — click to copy */
.tok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-chip);
  padding: 2px 7px;
  font: 400 13px/18px var(--font-mono);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
  vertical-align: baseline;
}
.tok:hover { border-color: var(--border-strong); }
.tok svg { width: 12px; height: 12px; stroke: var(--text-muted); }
.tok.copied { border-color: var(--signal); }
.tok.copied svg { stroke: var(--signal); }

/* dedicated copy button */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-chip);
  padding: 3px 8px;
  font: 500 12px/16px var(--font-mono);
  color: var(--text-secondary);
  transition: border-color 0.14s ease, color 0.14s ease;
}
.copy-btn svg { width: 13px; height: 13px; stroke: currentColor; }
.copy-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.copy-btn.copied { color: var(--signal); border-color: var(--signal); }

.endpoint {
  font: 400 13px/20px var(--font-mono);
  color: var(--text-primary);
}

/* ---------------------------------------------------------------------------
   18. STATUS DOTS
   --------------------------------------------------------------------------- */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--status-idle);
}
.dot-ok { background: var(--status-ok); box-shadow: 0 0 0 0 var(--trust-glow); animation: pulse-ok 2s ease-in-out infinite; }
.dot-warn { background: var(--status-warn); }
.dot-down { background: var(--status-down); }
.dot-idle { background: var(--status-idle); }
@keyframes pulse-ok {
  0%   { box-shadow: 0 0 0 0 var(--trust-glow); }
  70%  { box-shadow: 0 0 0 6px rgba(45, 212, 167, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 167, 0); }
}
.status-label { font: 500 12px/16px var(--font-mono); color: var(--text-secondary); }

/* ---------------------------------------------------------------------------
   19. PROGRESS / QUOTA BARS
   --------------------------------------------------------------------------- */
.bar {
  width: 100%;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--bg-sunken);
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--signal);
  border-radius: var(--r-pill);
  transition: width 0.4s ease;
}
.bar.warn > span { background: var(--status-warn); }
.bar.down > span { background: var(--status-down); }
.quota {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 400 12px/16px var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 6px;
}
.quota .used { color: var(--text-primary); }

/* ---------------------------------------------------------------------------
   20. SPARKLINE / CHART CONTAINERS
   --------------------------------------------------------------------------- */
.sparkline { display: inline-flex; align-items: center; gap: 8px; }
.sparkline svg { display: block; }
.sparkline .readout { font: 500 12px/16px var(--font-mono); color: var(--text-primary); }
.sparkline .readout .unit { color: var(--text-muted); }

.chart {
  width: 100%;
}
.chart svg { width: 100%; height: auto; display: block; }

.live-rail {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ---------------------------------------------------------------------------
   21. HERO + RECON CONTOUR TEXTURE
   --------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-hairline);
  padding: var(--sp-16) 0 var(--sp-12);
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}
.hero-bg svg { position: absolute; top: -10%; right: -6%; width: 720px; height: 720px; }
.hero .container { position: relative; z-index: 1; }
.section-recon { position: relative; overflow: hidden; }
.section-recon .recon-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}
.section-recon > .container { position: relative; z-index: 1; }

/* phosphor scan sweep on data-load panels */
.scan {
  position: relative;
  overflow: hidden;
}
.scan::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--signal), transparent);
  opacity: 0;
  animation: scan-sweep 0.6s ease-out 1;
}
@keyframes scan-sweep {
  0%   { transform: translateY(0); opacity: 0.7; }
  100% { transform: translateY(220px); opacity: 0; }
}

/* ---------------------------------------------------------------------------
   22. MISC UTILITIES
   --------------------------------------------------------------------------- */
.kicker { display: flex; align-items: center; gap: 8px; margin-bottom: var(--sp-4); }
.kicker .line { width: 32px; height: 2px; background: var(--signal); }

.muted-rule { border-top: 1px solid var(--border-hairline); }

.notice {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-card);
  border: 1px solid var(--border-hairline);
  background: var(--bg-raised);
  font-size: 14px;
  color: var(--text-secondary);
}
.notice svg { width: 18px; height: 18px; flex: none; stroke: var(--signal); margin-top: 1px; }
.notice-trust { border-color: var(--trust); background: var(--trust-dim); }
.notice-trust svg { stroke: var(--trust); }
.notice-warn { border-color: var(--status-warn); }
.notice-warn svg { stroke: var(--status-warn); }

.rating { display: inline-flex; align-items: center; gap: 6px; }
.rating .stars { display: inline-flex; gap: 1px; }
.rating .stars svg { width: 14px; height: 14px; }
.rating .stars .filled { fill: var(--signal); stroke: var(--signal); }
.rating .stars .empty { fill: none; stroke: var(--border-strong); }
.rating .score { font: 500 13px/1 var(--font-mono); color: var(--text-primary); }
.rating .count { font-size: 12px; color: var(--text-muted); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-btn);
  background: var(--bg-raised-2);
  border: 1px solid var(--border-hairline);
  color: var(--signal);
  font: 600 14px/1 var(--font-display);
  flex: none;
}

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: var(--sp-4); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--signal); }
.breadcrumb .sep { color: var(--border-strong); }

.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.full { width: 100%; }

/* count-up helper start state handled in JS; ensure no layout shift */
[data-count] { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   23. AUTH — account chip + menu (nav) and access gate (shared via app.js)
   --------------------------------------------------------------------------- */
.acct { position: relative; }
.acct-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-btn);
  padding: 4px 10px 4px 4px;
  color: var(--text-primary);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.acct-btn:hover { border-color: var(--border-strong); background: var(--bg-raised-2); }
.acct-av { width: 28px; height: 28px; font-size: 11px; }
.acct-name { font: 500 13px/1 var(--font-body); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn svg { color: var(--text-muted); }
.acct-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  min-width: 252px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  padding: var(--sp-2);
  box-shadow: var(--menu-shadow), inset 0 1px 0 var(--top-highlight);
}
.acct-menu[hidden] { display: none; }
.acct-head { padding: var(--sp-3); }
.acct-name-lg { font: 600 14px/1.2 var(--font-display); color: var(--text-primary); }
.acct-sub { font: 400 12px/1.4 var(--font-mono); color: var(--text-muted); margin-top: 3px; }
.acct-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  background: transparent;
  border-radius: var(--r-btn);
  color: var(--text-secondary);
  font: 500 14px/1 var(--font-body);
  text-align: left;
  cursor: pointer;
}
.acct-item svg { width: 16px; height: 16px; color: var(--text-muted); }
.acct-item:hover { background: var(--bg-raised-2); color: var(--text-primary); }
.acct-item:hover svg { color: var(--signal); }
.acct-danger:hover, .acct-danger:hover svg { color: var(--status-down); }
.acct-sep { height: 1px; background: var(--border-hairline); margin: var(--sp-2) 0; }

.auth-gate {
  max-width: 560px;
  margin: var(--sp-12) auto;
  text-align: center;
  background: var(--bg-raised);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-card);
  padding: var(--sp-10) var(--sp-8);
  box-shadow: var(--card-shadow), inset 0 1px 0 var(--top-highlight);
}
.auth-gate-ic {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--sp-5);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-sunken);
  color: var(--signal);
}
.auth-gate .lead { margin-bottom: var(--sp-6); }

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

/* ============================================================================
   Mobile polish (<=640px) — phone tier, appended LAST so it overrides the
   desktop + 768/720 tiers (and page-local <style> rules in index/service.html)
   by source order and, where needed, by higher specificity.
   CSS-only, additive, no HTML assumptions. Targets ~360-414px phones.
   ========================================================================== */
@media (max-width: 640px) {

  /* ---- Top nav bar: stop overflow, comfortable taps ---------------------- */
  .nav-inner { padding: 0 var(--sp-4); gap: var(--sp-3); }
  .nav-actions { gap: var(--sp-2); }
  .nav-actions .nav-docs { display: none; }   /* phones: keep only the "Get API key" CTA */
  .nav-actions .btn-sm { min-height: 40px; padding: 9px 14px; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
  }
  .theme-toggle { width: 40px; height: 40px; }

  /* ---- Open hamburger menu: full-row tap targets, scrollable ------------- */
  .nav-links {
    left: var(--sp-2);
    right: var(--sp-2);
    padding: var(--sp-2);
    border-radius: 10px;
    max-height: calc(100vh - var(--nav-h) - 12px);
    overflow-y: auto;
    box-shadow: var(--nav-shadow);
  }
  .nav-links .nav-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: var(--sp-3) var(--sp-4);
    font-size: 15px;
    border-radius: 6px;
  }
  .nav-links .nav-link + .nav-link {
    border-top: 1px solid var(--border-hairline);
    border-radius: 0;
  }

  /* ---- Home hero: natural reading order + scaled display type ------------ */
  /* Beat the page-local `.hero-side { order:-1 }`: card goes BELOW the copy. */
  .hero-grid .hero-copy { order: 0; max-width: 100%; padding-right: 0; }
  .hero-grid .hero-side { order: 1; }
  section.hero { padding: var(--sp-8) 0 var(--sp-10); }
  .hero h1.display-xl {
    font-size: clamp(26px, 7.2vw, 36px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    overflow-wrap: break-word;
  }
  .hero .lead { font-size: 14px; line-height: 22px; }

  /* Hero search row: never overflow, protect the input width */
  .hero-search { max-width: 100%; gap: var(--sp-2); }
  .hero-search input { min-width: 0; }
  .hero-search .btn { padding: 0 var(--sp-4); }

  /* Hero report card: let long values wrap instead of crowding the label */
  .hero-card .rep-row {
    flex-wrap: wrap;
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }
  .hero-card .rep-row .rep-k { width: 72px; }
  .hero-card .rep-row .rep-v { min-width: 0; flex: 1; word-break: break-word; }

  /* ---- Stats band: 2-up reads denser than 4 stacked tiles --------------- */
  .stats-band .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .stats-band .stat { padding: var(--sp-4); }
  .stats-band .stat .stat-value { font-size: 24px; line-height: 30px; }

  /* ---- Home "AI assistant" section: let the 1-col grid shrink ----------- */
  .agent-grid, .agent-grid > *, .agent-points { min-width: 0; }
  .agent-grid > * { max-width: 100%; }

  /* ---- Provider CTA band (home): full-width stacked buttons ------------- */
  .cta-band .cta-inner { gap: var(--sp-5); padding: var(--sp-8) 0; }
  .cta-band .cta-inner .row { width: 100%; flex-direction: column; align-items: stretch; }
  .cta-band .cta-inner .btn-lg { width: 100%; }

  /* ---- Catalog: collapse the 380px card grid + stack the results bar ---- */
  .grid.grid-services { grid-template-columns: 1fr; gap: var(--sp-4); }
  .sidebar-layout > section { min-width: 0; }
  .sidebar-layout .results-bar { flex-direction: column; align-items: stretch; }
  .sidebar-layout .sort-control select { flex: 1; min-width: 0; min-height: 44px; }
  #filterRail .pill { padding: 9px 14px; min-height: 40px; }
  #filterRail .check-row { padding: 10px 8px; }

  /* ---- Service page: contain overflow (the grid/flex min-width:auto bug) -- */
  /* The single-column svc-layout main cell must be allowed to shrink to the
     phone width — otherwise the tab strip + capability blocks force it (and the
     whole page) wider than the viewport. */
  .svc-layout, .svc-layout > *,
  .svc-layout .stack, .svc-layout .stack-lg, .svc-layout .card,
  .svc-layout .panel, .svc-layout .panel-body, .capability { min-width: 0; }

  /* ---- Service page: scrollable tab strip (was non-wrapping flex) -------- */
  .svc-tabs-bar { position: static; min-width: 0; max-width: 100%; }
  .svc-tabs-bar .tabs {
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
    margin-bottom: var(--sp-5);
  }
  .svc-tabs-bar .tabs::-webkit-scrollbar { height: 0; display: none; }
  .svc-tabs-bar .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: var(--sp-3) 10px;
    min-height: 44px;
  }

  /* Service hero actions: full-width stacked primary CTAs */
  .svc-hero-actions { width: 100%; flex-direction: column; align-items: stretch; gap: var(--sp-2); }
  .svc-hero-actions .btn { width: 100%; }

  /* Stacked sidebar should stop being sticky once it drops below main */
  .side-card { position: static; top: auto; }

  /* Key-stats strip reads cleaner as one column on a phone */
  .svc-keystats { grid-template-columns: 1fr; }
  .svc-keystat {
    border-right: 0 !important;
    border-bottom: 1px solid var(--border-hairline);
    padding: var(--sp-3) var(--sp-4);
  }
  .svc-keystat:last-child { border-bottom: 0; }

  /* Trim nested panel/card padding so content keeps a usable measure */
  .panel-body { padding: var(--sp-4); }
  .svc-layout .card { padding: var(--sp-4); }

  /* ---- Audit-ledger rows: stack label over value (home + verification) -- */
  .ledger-row { grid-template-columns: 1fr; gap: 2px; padding: var(--sp-2) 0; }
  .ledger-row .v { word-break: normal; overflow-wrap: anywhere; }
  .ledger { padding: var(--sp-4); }

  /* ---- Footer: collapse to a single column ------------------------------ */
  .footer .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
    padding: var(--sp-10) var(--sp-4) var(--sp-6);
  }
  .footer .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-4);
  }

  /* ---- Typography: fluid display/h1 (verification hero, terms head) ------ */
  .display-lg, h1 {
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1.18;
    letter-spacing: -0.01em;
  }
  .v-hero .display-lg { margin-top: var(--sp-3); }

  /* ---- Verification page: full-width CTAs + tighter closing band -------- */
  .v-hero .row .btn,
  .cta-band .row .btn { width: 100%; padding-top: 12px; padding-bottom: 12px; }
  .v-hero .row,
  .cta-band .row-between > .row { width: 100%; }
  .cta-band { padding: var(--sp-5); }
  .cta-band .row-between { flex-direction: column; align-items: stretch; gap: var(--sp-4); }

  /* ---- Terms (legal) prose: reduce indent + tighten clause rhythm ------- */
  .legal { padding-top: var(--sp-8); }
  .legal-clause { padding: var(--sp-5) 0 var(--sp-1); }
  .legal-clause ul { padding-left: var(--sp-5); }
  .legal-clause h2 { font-size: 18px; line-height: 26px; gap: var(--sp-2); }
  .legal-meta { gap: var(--sp-2) var(--sp-4); }
}

/* ============================================================================
   Micro tier (<=400px) — the very narrowest phones (~320-400px)
   ========================================================================== */
@media (max-width: 400px) {
  /* Keep the single "Get API key" CTA compact so it still fits beside the logo
     + theme toggle + hamburger on the narrowest phones. */
  .nav-actions .btn-trust { padding: 8px 11px; font-size: 13px; }
  .nav-inner { gap: var(--sp-2); }

  /* Verification timeline + stepper: shrink the marker rail so step copy
     keeps a usable measure on the smallest screens. */
  .flow-step { grid-template-columns: 32px 1fr; gap: var(--sp-3); }
  .flow-step .marker .num { width: 28px; height: 28px; }
  .stepper { justify-content: flex-start; row-gap: var(--sp-2); }
  .step .step-line { width: 12px; margin: 0 var(--sp-1); }
}

