/* ------------------------------------------------------------------ */
/*  LenderOS — clean warm light theme, Neetix amber accent.            */
/*  Shared design tokens + self-hosted fonts. Loaded on every          */
/*  server-rendered page (landing / login / error).                   */
/*  Tokens mirror web/frontend/src/styles.css so the React SPA and     */
/*  these plain HTML pages render identically.                         */
/* ------------------------------------------------------------------ */

/* Self-hosted fonts (latin) — keeps CSP font-src 'self'. */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/poppins-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/poppins-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/poppins-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fira Code';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/static/fonts/fira-code-latin-wght-normal.woff2') format('woff2');
}

:root {
  --radius: 0.75rem;

  /* Neutral graphite — near-black canvas, near-white accent */
  --background: #0A0A0B;
  --foreground: #ECECEE;

  --card: #141416;
  --card-foreground: #ECECEE;

  --popover: #19191C;
  --popover-foreground: #ECECEE;

  --primary: #FAFAFA;
  --primary-foreground: #111113;
  --primary-hover: #E4E4E7;

  --secondary: #1C1C20;
  --secondary-foreground: #D2D2D6;

  --muted: #1C1C20;
  --muted-foreground: #8B8B93;

  --accent: #242429;
  --accent-foreground: #ECECEE;

  --cta: #FAFAFA;

  --destructive: #F26D6D;

  --border: #26262B;
  --ring: #6E6E76;

  --sidebar: #070708;
  --sidebar-border: #1E1E22;

  --font-sans: 'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* shadcn-style ring used on cards (subtle, dark-mode aware). */
  --ring-card: oklch(1 0 0 / 0.09);
  --shadow-card: 0 2px 10px oklch(0 0 0 / 0.35);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0A0A0B;
    --foreground: #ECECEE;
    --card: #141416;
    --card-foreground: #ECECEE;
    --popover: #19191C;
    --popover-foreground: #ECECEE;
    --primary: #FAFAFA;
    --primary-foreground: #111113;
    --primary-hover: #E4E4E7;
    --secondary: #1C1C20;
    --secondary-foreground: #D2D2D6;
    --muted: #1C1C20;
    --muted-foreground: #8B8B93;
    --accent: #242429;
    --accent-foreground: #ECECEE;
    --cta: #FAFAFA;
    --destructive: #F26D6D;
    --border: #26262B;
    --ring: #6E6E76;
    --sidebar: #070708;
    --sidebar-border: #1E1E22;
    --ring-card: oklch(1 0 0 / 0.10);
    --shadow-card: 0 1px 2px oklch(0 0 0 / 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--foreground);
  background: var(--background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

body { display: flex; flex-direction: column; }
body.app-shell { display: block; }

a { color: inherit; text-decoration: none; }

/* Page headings — Inter semibold throughout (observability-SaaS system). */
h1 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}
/* Capsule / monospace look for inline titles that opt-in via .heading-mono */
.heading-mono {
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: -0.01em;
}
h2, h3 { font-family: var(--font-heading); font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; }

::selection { background-color: color-mix(in oklch, var(--primary) 18%, transparent); color: var(--foreground); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: oklch(0.35 0.005 285 / 0.7);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
@media (pointer: coarse) {
  button, a, [role="button"] { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
*:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: calc(var(--radius) * 0.6);
}

/* ---- Top bar (h-12 shadcn look) ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 1rem;
  background: color-mix(in oklch, var(--background) 80%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar .brand a {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  color: var(--foreground);
}
.topbar .brand a::after { content: "."; color: var(--primary); }

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

.user-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 0.5rem;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.inline-form { margin: 0; }

/* ---- Container / Footer ---- */
.container {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  font-size: 0.74rem;
  color: var(--muted-foreground);
  border-top: 1px solid var(--border);
}
.footer .env {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
}

/* ---- Pill / live indicator (mirrors Badge live variant) ---- */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 18px;
  padding: 0 0.5rem;
  border-radius: 9999px;
  background: oklch(0.85 0.18 145 / 0.15);
  color: oklch(0.40 0.16 145);
  border: 1px solid oklch(0.75 0.18 145 / 0.30);
  font-size: 10px;
  font-weight: 500;
}
.live-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: oklch(0.55 0.18 145);
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Buttons —— mirror the shadcn button variants/sizes ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 32px;
  padding: 0 0.625rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background-clip: padding-box;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--foreground);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
  background: var(--background);
  color: var(--muted-foreground);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }
.btn-sm { height: 28px; padding: 0 0.6rem; font-size: 0.78rem; border-radius: calc(var(--radius) * 0.8); }
.btn-lg { height: 40px; padding: 0 1.1rem; font-size: 0.95rem; border-radius: calc(var(--radius) * 1.2); }

/* ---- Cards (centered modals — login / error) ---- */
.card {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * 1.4);
  padding: 2rem;
  box-shadow: 0 0 0 1px var(--ring-card), var(--shadow-card);
  color: var(--card-foreground);
}
.card-center { max-width: 440px; margin: 4rem auto; text-align: center; }
.card-center h1 {
  font-size: 2.2rem;
  margin: 0 0 0.5rem;
}
.card-center p {
  color: var(--muted-foreground);
  margin: 1rem 0 1.75rem;
  font-size: 0.95rem;
}

/* ---- Alerts ---- */
.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  text-align: left;
}
.alert-error {
  background: color-mix(in oklch, var(--destructive) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--destructive) 35%, transparent);
  color: var(--destructive);
}

/* ================================================================== */
/*  Stage — centered sign-in composition (landing + login)             */
/*  Dark canvas, breathing orbs, border-beam card, staggered reveal.   */
/* ================================================================== */

body.bare { display: block; }

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem 1.25rem;
  overflow: hidden;
  background: var(--background);
}

/* breathing orbs */
.stage-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .05; }
  50% { transform: scale(1.2); opacity: .12; }
}
.stage-orb-1 {
  width: 600px; height: 600px;
  top: -22%; left: 50%; margin-left: -300px;
  background: var(--primary);
  animation: breathe 8s ease-in-out infinite;
}
.stage-orb-2 {
  width: 500px; height: 500px;
  bottom: -22%; right: -10%;
  background: #3F3F46;
  animation: breathe 10s ease-in-out infinite 2s;
}
.stage-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(oklch(1 0 0 / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, oklch(1 0 0 / 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, black 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, black 25%, transparent 75%);
}

.stage-wrap {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2.5rem;
  width: 100%; max-width: 420px;
}
@media (min-width: 900px) {
  .stage-wrap { flex-direction: row; align-items: center; gap: 4rem; max-width: 900px; }
}

/* entrance animations */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.rise { animation: riseIn .5s ease-out both; animation-delay: var(--d, 0s); }
@keyframes popIn {
  from { opacity: 0; transform: scale(.8); }
  to { opacity: 1; transform: scale(1); }
}
.pop { animation: popIn .45s cubic-bezier(.2,.9,.3,1.3) both; animation-delay: .3s; }

/* left brand */
.stage-wordmark {
  position: absolute; top: 1.5rem; left: 2rem; z-index: 2;
  font-size: .95rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--foreground);
}
.stage-brand { flex: 1; text-align: center; }
@media (min-width: 900px) { .stage-brand { text-align: left; } }

.stage-badge {
  display: inline-flex; align-items: center;
  margin-bottom: 1.1rem;
  padding: .3rem .7rem;
  border-radius: 9999px;
  border: 1px solid color-mix(in oklch, var(--primary) 30%, transparent);
  background: color-mix(in oklch, var(--primary) 10%, transparent);
  color: #9B9EF5;
  font-size: .66rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
}
.stage-title {
  margin: 0 0 .9rem;
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
}
.grad {
  background: linear-gradient(92deg, #FFFFFF, #D4D4D8 45%, #A1A1AA);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.dot { color: var(--primary); }
.stage-lead {
  margin: 0 auto 1.8rem;
  max-width: 26rem;
  font-size: .93rem;
  line-height: 1.65;
  color: var(--muted-foreground);
}

/* live fleet mock — the product, on the landing page */
.mock {
  max-width: 26rem;
  margin-inline: auto;
  border-radius: .9rem;
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 75%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 34px oklch(0 0 0 / .35);
  overflow: hidden;
}
.mock-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent) 60%, transparent);
  font-size: .72rem; font-weight: 600; color: var(--foreground);
}
.mock-time { margin-left: auto; font-weight: 400; font-size: .64rem; color: var(--muted-foreground); }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.35} }
.mock-dot-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 8px #4ADE8088;
  animation: pulse-dot 1.8s ease-in-out infinite;
}
.mock-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .62rem .9rem;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
  font-size: .8rem;
}
.mock-row:last-child { border-bottom: none; }
.m-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.m-dot.ok { background: #4ADE80; box-shadow: 0 0 6px #4ADE8066; }
.m-name { font-weight: 500; color: var(--foreground); }
.m-meta { margin-left: auto; font-family: var(--font-heading); font-size: .7rem; color: var(--muted-foreground); }
.m-chip {
  padding: .14rem .5rem; border-radius: .4rem;
  font-size: .64rem; font-weight: 600;
}
.m-chip.ok { background: #142A1B; color: #4ADE80; }
.m-chip.warn { background: #2C2411; color: #FBBF24; }

/* right card */
.stage-card {
  position: relative;
  width: 100%; max-width: 400px;
  margin: 0 auto;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 8px 32px oklch(0 0 0 / .35);
  overflow: hidden;
}
.stage-logo {
  display: block; margin: 0 auto 1.1rem; border-radius: 14px;
  box-shadow: 0 8px 26px -6px color-mix(in oklch, var(--primary) 55%, transparent);
}
.stage-mobile-brand {
  display: none;
  margin: 0 0 .4rem;
  font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em;
}
@media (max-width: 1023px) { .stage-mobile-brand { display: block; } }
.stage-card-title { margin: 0 0 .3rem; font-size: 1.3rem; font-weight: 600; letter-spacing: -0.015em; }
.stage-card-sub { margin: 0 0 1.6rem; font-size: .84rem; color: var(--muted-foreground); }
.stage-note {
  margin: 1.1rem 0 0;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  opacity: .7;
}

/* animated border beam (credit-engine style) */
@keyframes beam-orbit { 100% { offset-distance: 100%; } }
.beam {
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.beam::after {
  content: '';
  position: absolute;
  width: 90px; height: 90px;
  background: radial-gradient(closest-side, #FFFFFF, #71717A 60%, transparent);
  opacity: .8;
  offset-path: rect(0 auto auto 0 round 1rem);
  offset-anchor: 50% 50%;
  animation: beam-orbit 12s linear infinite;
  filter: blur(18px);
}

/* CTA with sliding arrow */
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; height: 42px;
  border-radius: .625rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 500; font-size: .9rem;
  transition: background .15s ease, transform .12s ease, box-shadow .2s ease;
  box-shadow: 0 6px 22px -6px color-mix(in oklch, var(--primary) 55%, transparent);
}
.cta:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px -6px color-mix(in oklch, var(--primary) 65%, transparent);
}
.cta-arrow {
  width: 15px; height: 15px;
  opacity: 0; transform: translateX(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
.cta:hover .cta-arrow { opacity: 1; transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  .stage-orb, .beam::after, .rise, .pop, .mock-dot-live { animation: none !important; }
  .rise, .pop { opacity: 1 !important; transform: none !important; }
}
