:root {
  --bg: #101a2b;
  --panel: #18263c;
  --panel-soft: #21324d;
  --line: #344d74;
  --text: #eef4ff;
  --muted: #bfd0ea;
  --primary: #a8c7ff;
  --primary-ink: #11294f;
  --danger: #fb7185;
  --brand-a: rgba(56,189,248,.22);
  --brand-b: rgba(167,139,250,.20);
  --brand-c: rgba(59,130,246,.16);

  /* Design tokens (Phase A) */
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 13px;
  --font-size-lg: 14px;

  --space-1: 6px;
  --space-2: 8px;
  --space-3: 10px;
  --space-4: 12px;
  --space-5: 14px;
  --space-6: 18px;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  --shadow-card: 0 6px 18px rgba(4,10,20,.16);
  --shadow-card-hover: 0 10px 20px rgba(4,10,20,.2);
  --focus-ring: 0 0 0 3px rgba(138,180,255,.16);
}
* { box-sizing: border-box; }
body { font-family: Manrope, Inter, ui-sans-serif, system-ui, Segoe UI, Arial, sans-serif; background: radial-gradient(1100px 650px at 18% -8%, rgba(191,214,255,.16) 0%, transparent 58%), var(--bg); color: var(--text); margin: 0; letter-spacing: .1px; line-height: 1.55; font-size: 16px; }
body.is-logged-out,
body.is-logged-in {
  --bg: #f4f7ff;
  --panel: rgba(255,255,255,.78);
  --panel-soft: rgba(255,255,255,.92);
  --line: rgba(159,183,220,.45);
  --text: #18253a;
  --muted: #4c5f80;
  background:
    radial-gradient(1000px 600px at 6% -8%, rgba(126,173,246,.2), transparent 56%),
    radial-gradient(900px 480px at 94% 4%, rgba(167,139,250,.18), transparent 60%),
    #f4f7ff;
}
body.is-logged-out::before,
body.is-logged-in::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('/assets/logo.png') center 42% / min(95vh, 66vw) no-repeat;
  opacity: .13;
  filter: blur(8px) saturate(.8);
  pointer-events: none;
  z-index: 0;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: #fff;
  color: #0f172a;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 120;
  text-decoration: none;
}
.skip-link:focus { left: 8px; }
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; opacity: .22; z-index: 0; }
.bg-glow { position: fixed; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(168,199,255,.12) 0%, rgba(168,199,255,0) 67%); right: -120px; top: -120px; pointer-events: none; z-index: 0; }
.ambient-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(30px);
  z-index: 0;
  animation: orbDrift 14s ease-in-out infinite alternate;
}
.orb-a { width: 340px; height: 340px; left: -80px; top: 26%; background: rgba(116,167,255,.2); }
.orb-b { width: 280px; height: 280px; right: 6%; bottom: 10%; background: rgba(181,146,255,.16); animation-delay: 2s; }
@keyframes orbDrift { from { transform: translateY(0px); } to { transform: translateY(-26px); } }
[data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity .72s ease, transform .72s cubic-bezier(.2,.68,.2,1); }
[data-reveal].reveal-in { opacity: 1; transform: translateY(0); }

.layout { position: relative; z-index: 1; max-width: 1240px; margin: 24px auto; padding: 0 16px; display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
.sidebar { position: sticky; top: 14px; height: fit-content; display:none; }

body.is-logged-out .layout,
body.is-logged-in .layout {
  max-width: 100vw;
  width: 100%;
  margin: 0 auto;
  padding: 0 2vw;
  grid-template-columns: 1fr;
  gap: 0;
}
body.is-logged-out .content,
body.is-logged-in .content { width: 100%; }
body.is-logged-out .view { display: none !important; }
.logo { font-weight: 800; margin-bottom: 10px; }
.nav-btn { display: block; width: 100%; margin: 8px 0; text-align: left; background: rgba(255,255,255,.02); color: var(--muted); border: 1px solid #4a6488; transition: background-color .18s ease, border-color .18s ease, color .18s ease; }
.nav-btn:hover { background: rgba(168,199,255,.12); color: #eef6ff; border-color: #89a9d6; }
.nav-btn.active { background: rgba(168,199,255,.24); color: #ffffff; border-color: #b8d4ff; font-weight: 800; }
.nav-btn:focus-visible { outline: 2px solid rgba(56,189,248,.95); outline-offset: 2px; box-shadow: 0 0 0 3px rgba(56,189,248,.22); }

.content { min-width: 0; }
h1 { margin: 0 0 6px; font-size: 28px; }
h2 { margin: 0 0 12px; font-size: 17px; }
.muted { color: var(--muted); }
[data-state="loading"] { color: #bfe9ff; }
[data-state="success"] { color: #bbf7d0; }
[data-state="empty"] { color: #fde68a; }
[data-state="error"] { color: #fecdd3; }
mark.hl {
  background: rgba(250, 204, 21, 0.28);
  color: #fef3c7;
  padding: 0 3px;
  border-radius: 4px;
}
.auth-shell { min-height: 84vh; display: block; }
.prelogin-shell {
  padding: 10px 0 26px;
  position: relative;
  overflow: hidden;
}
.prelogin-shell::before,
.prelogin-shell::after {
  content: none;
}

body.brand-aurora-1 { --brand-a: rgba(56,189,248,.24); --brand-b: rgba(167,139,250,.20); --brand-c: rgba(59,130,246,.16); }
body.brand-aurora-2 { --brand-a: rgba(45,212,191,.22); --brand-b: rgba(244,114,182,.18); --brand-c: rgba(99,102,241,.18); }
body.brand-aurora-3 { --brand-a: rgba(250,204,21,.18); --brand-b: rgba(236,72,153,.16); --brand-c: rgba(14,165,233,.18); }
.prelogin-wrap {
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  padding: 0 2vw;
  position: relative;
  z-index: 2;
}
.prelogin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.prelogin-brand { font-weight: 800; font-size: 24px; letter-spacing: .2px; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-logo { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(47,95,174,.28)); mix-blend-mode: multiply; opacity: .92; }
.prelogin-links { display: flex; gap: 18px; flex-wrap: wrap; }
.prelogin-links a { color: #d5e3ff; text-decoration: none; font-size: 14px; transition: color .2s ease, transform .2s ease; display:inline-flex; }
.prelogin-links a:hover { color: #ffffff; transform: translateY(-1px); }
body.is-logged-out .prelogin-links a { color: #253756; }
body.is-logged-out .prelogin-links a:hover { color: #0f1f36; }
.prelogin-actions { display: flex; gap: 8px; }
.prelogin-hero { padding: 4px 0 0; min-height: calc(100vh - 56px); display: grid; align-items: stretch; }
.split-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.hero-pane { text-align: left; }
.prelogin-hero h1 { font-size: clamp(30px, 4vw, 48px); margin-bottom: 10px; }
.prelogin-hero h2 { font-size: clamp(24px, 3vw, 36px); margin: 0 0 10px; }
.prelogin-hero .muted { font-size: 16px; }
.landing-stack {
  display: block;
}
.landing-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .95fr);
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  border-color: rgba(122,159,214,.42);
  background: linear-gradient(145deg, rgba(34,51,82,.96), rgba(23,36,59,.94));
}
.landing-hero-panel {
  margin: 0;
  background: linear-gradient(180deg, rgba(11,18,32,.7), rgba(20,30,50,.82));
  border-color: rgba(122,159,214,.34);
}
.landing-hero-copy,
.landing-hero-panel {
  min-width: 0;
}
.landing-pills { margin-bottom: 18px; }
.landing-cta-row { margin-top: 10px; }
.landing-checklist {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}
.landing-panel-note {
  margin-top: 14px;
  font-size: 13px;
}
.landing-hero-card--airy {
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  min-height: calc(100vh - 80px);
  position: relative;
  overflow: visible;
  border-radius: 0;
  border: 0;
  background: transparent !important;
  box-shadow: none;
  margin: 0;
  padding: 6px 0 0;
}
.landing-hero-card--airy::before {
  content: none;
}
.landing-hero-card--airy > * { position: relative; z-index: 1; }
.landing-slider {
  display: grid;
  gap: 12px;
  overflow: visible;
}
.landing-slide-rail {
  position: relative;
  height: clamp(516px, 69.6vw, 744px);
  width: min(1450px, 100%);
  margin: 0 auto;
  overflow: visible;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transform-style: preserve-3d;
  perspective: 1400px;
}
.landing-slide-rail.is-dragging { cursor: grabbing; }
.landing-slide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(515px, 56.8vw, 739px);
  min-height: 515px;
  border-radius: 10px;
  padding: 20px;
  border: 0;
  cursor: pointer;
  transform-origin: center center;
  transition: transform .45s cubic-bezier(.22,.61,.36,1), opacity .28s ease, box-shadow .3s ease, filter .3s ease;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, opacity;
  filter: saturate(.95) brightness(.92);
}
.landing-slide * { user-select: none; -webkit-user-select: none; }
.landing-slide h3 { font-size: clamp(22px, 2vw, 30px); line-height: 1.12; margin-bottom: 10px; }
.landing-slide .muted { font-size: clamp(14px, .95vw, 16px); line-height: 1.45; }
.glass-slide {
  background: linear-gradient(152deg, rgba(255,255,255,.97), rgba(248,252,255,.94));
  backdrop-filter: blur(8px);
  box-shadow: 0 22px 56px rgba(41, 77, 128, .16);
}
.landing-slide.is-active {
  box-shadow: 0 34px 74px rgba(41, 77, 128, .22);
  filter: saturate(1.02) brightness(1);
}
.landing-slide::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -34px;
  height: 24px;
  background: radial-gradient(ellipse at center, rgba(53,88,146,.22), rgba(53,88,146,0) 70%);
  opacity: .28;
  transform: scale(.92);
  pointer-events: none;
}
.landing-slide.is-active::after {
  opacity: .6;
  transform: scale(1);
}
.landing-slider-dots {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
}
.landing-slider-dots .dot {
  width: 9px;
  height: 9px;
  min-height: 9px;
  min-width: 9px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(93,121,163,.35);
  box-shadow: none;
}
.landing-slider-dots .dot.active {
  width: 24px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}
.landing-section {
  padding: 36px 2vw;
  position: relative;
}
.landing-soft {
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.landing-soft::before {
  content: "";
  position: absolute;
  inset: -6px 4% auto;
  height: 70px;
  background: radial-gradient(55% 100% at 50% 0%, rgba(103,140,207,.14), transparent 72%);
  opacity: .35;
  pointer-events: none;
}
.landing-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.landing-section-head > .muted {
  max-width: 520px;
  font-size: 14px;
}
.landing-detail-grid,
.landing-about-grid {
  display: grid;
  gap: 16px;
}
.landing-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.landing-about-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.landing-detail-card {
  border: 0;
  border-radius: 18px;
  padding: 20px;
  background: linear-gradient(160deg, rgba(255,255,255,.56), rgba(245,249,255,.34));
  box-shadow: 0 16px 38px rgba(35,69,119,.1);
  backdrop-filter: blur(10px);
}
.value-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}
.value-tile {
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(255,255,255,.64), rgba(246,250,255,.36));
  box-shadow: 0 12px 30px rgba(35,69,119,.09);
}
.experience-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}
.exp-step {
  padding: 24px;
  border-radius: 20px;
  background: linear-gradient(162deg, rgba(255,255,255,.62), rgba(244,248,255,.38));
  box-shadow: 0 16px 34px rgba(37,71,122,.1);
}
.exp-step span {
  font-size: 12px;
  letter-spacing: .15em;
  color: #6a86ad;
  font-weight: 700;
}
.hero-inline-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn-glow {
  background: linear-gradient(120deg, #2f6fe0, #5f9dff);
  color: #fff;
  border: 0;
  box-shadow: 0 12px 28px rgba(47,111,224,.35);
}
.btn-ghost {
  background: rgba(255,255,255,.52);
  border: 1px solid rgba(102,133,184,.3);
  color: #1d355b;
}
.landing-final-cta {
  margin: 34px 2vw 10px;
  text-align: center;
  padding: 38px 18px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(255,255,255,.62), rgba(243,249,255,.3));
  box-shadow: 0 26px 60px rgba(35,69,119,.12);
}
body.is-logged-in .landing-slide,
body.is-logged-in .pricing-tier,
body.is-logged-in .value-tile,
body.is-logged-in .exp-step {
  backdrop-filter: none;
}
body.is-logged-in .card::after,
body.is-logged-in .plan-card::after {
  opacity: .45;
}
.landing-detail-card h3 {
  margin-top: 0;
}
.hero-list { margin: 10px 0 18px; padding-left: 18px; }
.hero-list li { margin: 8px 0; }
.prelogin-agent {
  margin: 16px 0 0;
  max-width: 100%;
  text-align: left;
  border-color: #30405f;
  background: rgba(11,18,32,.62);
}
.prelogin-agent textarea {
  width: 100%;
  resize: none;
  margin-top: 10px;
  border: 1px solid #34425f;
  border-radius: 12px;
  padding: 11px;
  color: #a8b7d1;
  background: rgba(13,21,37,.78);
}
.prelogin-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 16px; margin-top: 24px; }
.prelogin-card { margin: 0; min-height: 230px; grid-column: span 3; position: relative; overflow: hidden; }
#pricing > .prelogin-card:first-child { grid-column: 1 / -1; }
.prelogin-card:nth-child(odd) {
  background: linear-gradient(180deg, rgba(38,56,88,.90), rgba(31,47,76,.92));
  border-color: rgba(122,159,214,.42);
  box-shadow: 0 10px 26px rgba(10,18,34,.25);
}
.prelogin-card:nth-child(even) {
  background: linear-gradient(180deg, rgba(34,51,82,.90), rgba(28,43,70,.92));
  border-color: rgba(122,159,214,.36);
  box-shadow: 0 10px 26px rgba(10,18,34,.22);
}
.pricing-compare { margin-top: 12px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; width: 100%; }
body.is-logged-out .pricing-compare-landing {
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  grid-template-columns: unset;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
}
body.is-logged-out .pricing-compare-landing .pricing-tier { scroll-snap-align: start; }
body.is-logged-out .pricing-compare-landing::-webkit-scrollbar { height: 8px; }
.pricing-tier {
  border: 0;
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,.64), rgba(246,250,255,.35));
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 38px rgba(35,69,119,.1);
}
.pricing-tier b { display: block; font-size: 18px; }
.tier-price { margin: 6px 0 8px; font-weight: 700; color: #dbe7ff; }
.tier-chip {
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid rgba(56,189,248,.55);
  color: #d7f1ff;
  background: rgba(56,189,248,.14);
  margin-bottom: 6px;
}
.tier-chip-enterprise {
  border-color: rgba(250,204,21,.6);
  color: #fde68a;
  background: rgba(250,204,21,.14);
}
.pricing-tier ul { margin: 0 0 10px; padding-left: 18px; min-height: 88px; }
.pricing-tier li { margin: 6px 0; color: var(--muted); font-size: 13px; }
.pricing-tier .btn-secondary { width: 100%; justify-content: center; }
.enterprise-contact-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #bae6fd;
  text-decoration: none;
}
.enterprise-contact-link:hover { text-decoration: underline; color: #e0f2fe; }
.pricing-tier-pro {
  border-color: rgba(56,189,248,.7);
  box-shadow: 0 0 0 1px rgba(56,189,248,.25), 0 10px 24px rgba(2,132,199,.15);
  background: linear-gradient(180deg, rgba(30,58,138,.26), rgba(11,18,32,.55));
}
.pricing-tier-team {
  border-color: rgba(250,204,21,.5);
  box-shadow: 0 0 0 1px rgba(250,204,21,.2), 0 10px 24px rgba(250,204,21,.09);
  background: linear-gradient(180deg, rgba(120,53,15,.2), rgba(11,18,32,.55));
}
.pricing-tier.recommended {
  border-color: rgba(56,189,248,.7);
  box-shadow: inset 0 0 0 1px rgba(56,189,248,.35);
  background: rgba(56,189,248,.12);
}
.pricing-tier.selected-plan {
  box-shadow: inset 0 0 0 2px rgba(34,197,94,.45), 0 8px 22px rgba(34,197,94,.12);
}
.recommend-badge {
  border: 1px solid rgba(56,189,248,.6);
  color: #d8f4ff;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(56,189,248,.15);
}
.pricing-compare span { color: var(--muted); font-size: 12px; }
.billing-placeholder { margin-top: 9px; font-size: 12px; border-left: 2px solid #3a527d; padding-left: 8px; }
.prelogin-footnote { margin-top: 14px; text-align: center; }

.pricing-focus {
  box-shadow: 0 0 0 2px rgba(56,189,248,.35), 0 0 0 8px rgba(56,189,248,.12);
  border-radius: 14px;
  animation: pricingPulse .7s ease-out;
}
@keyframes pricingPulse {
  0% { transform: translateY(0); }
  40% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}
.auth-subtitle { margin-bottom: 12px; }
.auth-trust-row { display:flex; gap:8px; justify-content:center; flex-wrap: wrap; margin: 10px 0 14px; }
.trust-pill { border:1px solid #30405f; color:#c7d6f1; border-radius: var(--radius-pill); padding:4px 9px; font-size: var(--font-size-xs); background: rgba(15,23,42,.5); }
.auth-title { font-size: 24px; margin: 8px 0 10px; }
.auth-support-copy { margin-bottom: 14px; }
.auth-label { display:block; text-align:left; color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.auth-copy { margin-bottom: 10px; }
.auth-primary { width: 100%; margin-top: 2px; }
.auth-switch { margin: 10px 0 4px; font-size: 13px; }
.auth-switch a { color: #9dc0ff; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.google-btn { width: 100%; background: #fff; color: #0f172a; border: 1px solid #d1d5db; display:flex; align-items:center; justify-content:center; gap:10px; border-radius: 12px; padding: 12px 14px; position: relative; overflow: hidden; }
.google-btn::after { content:""; position:absolute; top:0; left:-130%; width:70%; height:100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: skewX(-18deg); animation: loginShine 3.2s infinite; }
.google-btn:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.22); transform: translateY(-1px); }
@keyframes loginShine { 0% { left: -130%; } 60% { left: 180%; } 100% { left: 180%; } }
.google-icon { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(#ea4335 0 25%, #fbbc05 25% 50%, #34a853 50% 75%, #4285f4 75% 100%); }
.auth-divider { text-align:center; color: var(--muted); margin: 12px 0; position: relative; }
.auth-divider span { background: var(--panel); padding: 0 8px; position: relative; z-index: 1; }
.auth-divider::before { content: ""; position:absolute; left:0; right:0; top: 50%; border-top:1px solid #30405f; }
.auth-mini-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.auth-mini-item { border: 1px solid #30405f; border-radius: 10px; padding: 8px; background: rgba(11,18,32,.45); text-align: left; }
.auth-mini-item strong { display:block; font-size: 12px; color: #dce8ff; }
.auth-mini-item span { font-size: 11px; color: var(--muted); }
.auth-terms { margin-top: 12px; font-size: 12px; }
.signature-line { margin: 8px 0 2px; font-size: 12px; color: #9fb3d8; }
.auth-license {
  margin-top: 12px;
  text-align: left;
  border: 1px solid #30405f;
  border-radius: 12px;
  padding: 10px;
  background: rgba(11,18,32,.45);
}
.auth-license strong { font-size: 13px; color: #dbe7ff; }
#auth-license-plan-select { min-width: 280px; flex: 1 1 280px; }

.topbar { display: none; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 14px 16px; }
.topbar-main { display: grid; gap: 10px; min-width: 0; flex: 1 1 auto; }
.topbar-title h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: -.02em; }
.topbar-title .muted { margin: 0; max-width: 70ch; }
.topbar-meta { display: flex; align-items: center; gap: 8px; }
.topbar-right { display:flex; gap:8px; align-items:center; justify-content: flex-end; }
.user-chip { border:1px solid #7f9fca; border-radius:9px; padding:6px 10px; color:#edf4ff; font-size:12px; background: rgba(255,255,255,.06); }
.badge { background: rgba(191,214,255,.18); border: 1px solid rgba(191,214,255,.42); color: #edf5ff; border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-6); margin: var(--space-5) 0; box-shadow: var(--shadow-card); transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease; position: relative; overflow: hidden; }
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-card-hover); border-color: #5a769e; }
body.is-logged-out .card {
  border-radius: 22px;
  border-color: rgba(159,183,220,.4);
  background: linear-gradient(150deg, rgba(255,255,255,.76), rgba(245,249,255,.58));
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 36px rgba(33, 65, 115, .12);
}
body.is-logged-out .sidebar { display: none !important; }
body.is-logged-out .landing-slide {
  animation: none;
}
body.is-logged-in .topbar,
body.is-logged-in .card {
  border: 0;
  background: linear-gradient(155deg, rgba(255,255,255,.92), rgba(246,250,255,.82));
  box-shadow: 0 18px 44px rgba(34, 66, 114, .1);
  border-radius: 20px;
}
body.is-logged-in .topbar {
  position: sticky;
  top: 8px;
  z-index: 30;
  backdrop-filter: blur(8px);
  padding: 10px 12px;
  border-radius: 14px;
}
body.is-logged-in .topbar-title h1 {
  font-size: clamp(20px, 2.2vw, 28px);
  margin: 0;
}
body.is-logged-in .topbar-title .muted {
  font-size: 13px;
  color: #5e7496;
}
body.is-logged-in #view-dashboard,
body.is-logged-in #view-history,
body.is-logged-in #view-lawyer,
body.is-logged-in #view-account,
body.is-logged-in #view-admin {
  max-width: min(1420px, 97vw);
  margin: 8px auto 0;
}
body.is-logged-in .view {
  animation: viewFadeIn .32s ease;
}
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
body.is-logged-in .table-wrap table {
  border-collapse: separate;
  border-spacing: 0 8px;
}
body.is-logged-in .table-wrap tbody tr td {
  background: rgba(255,255,255,.9);
  border-top: 1px solid rgba(156,183,222,.35);
  border-bottom: 1px solid rgba(156,183,222,.35);
}
body.is-logged-in .table-wrap tbody tr td:first-child {
  border-left: 1px solid rgba(156,183,222,.35);
  border-radius: 12px 0 0 12px;
}
body.is-logged-in .table-wrap tbody tr td:last-child {
  border-right: 1px solid rgba(156,183,222,.35);
  border-radius: 0 12px 12px 0;
}

.card::after,
.prelogin-card::after,
.pricing-tier::after,
.plan-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s ease;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), rgba(56,189,248,.16), rgba(56,189,248,0) 62%);
}

.card.spotlight-on::after,
.prelogin-card.spotlight-on::after,
.pricing-tier.spotlight-on::after,
.plan-card.spotlight-on::after {
  opacity: 1;
}
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.hero { display:grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: center; background: linear-gradient(160deg, rgba(255,255,255,.9), rgba(246,250,255,.76)); border-radius: 18px; box-shadow: 0 14px 34px rgba(39,73,122,.1); }
.wow-card { position: relative; overflow: hidden; }
.wow-card::after { content:""; position:absolute; inset:0; background-image:url('/assets/hero-bg-kie.png'); background-size: cover; background-position: center; opacity:.09; mix-blend-mode: normal; pointer-events:none; }
.wow-card::before { content: ""; position: absolute; inset: -20% 45% auto -10%; height: 180px; background: radial-gradient(circle, rgba(168,199,255,.16), rgba(168,199,255,0) 70%); pointer-events: none; z-index:1; }
.wow-card > * { position: relative; z-index: 2; }
.hero h2 { font-size: clamp(28px, 3vw, 38px); line-height: 1.08; margin-bottom: 8px; color: #152c4c; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; color: #9fd3ff; font-size: 12px; margin: 4px 0 10px; }
.live-dot span { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.55); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.eyebrow { letter-spacing: .12em; font-size: 11px; font-weight: 700; color: #99b5e6; margin: 0 0 8px; }
.hero-pills { display:flex; gap:8px; flex-wrap: wrap; margin-top: 12px; }
.hero-upload { background: rgba(32,48,78,.44); border:1px solid #4c6790; border-radius: 14px; padding: 14px; }
.process-stepper { margin-top: 10px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.process-stepper .step { font-size: 11px; text-align: center; padding: 6px 8px; border-radius: 999px; border: 1px solid #30405f; color: #9fb3d8; background: rgba(11,18,32,.45); }
.process-stepper .step.is-active { border-color: rgba(56,189,248,.55); color: #d8f4ff; background: rgba(56,189,248,.18); }
.process-stepper .step.is-done { border-color: rgba(34,197,94,.55); color: #bbf7d0; background: rgba(34,197,94,.16); }
.hint-box { margin-top: 10px; padding: 8px 10px; border: 1px dashed #3a527d; border-radius: 10px; background: rgba(13,22,40,.4); font-size: 12px; }
.camera-preview {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.camera-page {
  border: 1px solid #30405f;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(11,18,32,.6);
  position: relative;
}
.camera-page img {
  width: 100%;
  height: 86px;
  object-fit: cover;
  display: block;
}
.camera-page-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
}
.camera-page button {
  min-height: 24px;
  width: 24px;
  padding: 0;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(15,23,42,.88);
  border: 1px solid rgba(148,163,184,.35);
  color: #fff;
}
.camera-page button[data-camera-remove] {
  background: rgba(239,68,68,.9);
  border-color: rgba(239,68,68,.7);
}
.camera-page span {
  display: block;
  padding: 4px 6px;
  font-size: 11px;
  color: #cbd5e1;
}
.upload-trust-strip {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(56,189,248,.28);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(8,20,40,.48), rgba(9,18,34,.35));
  display: grid;
  gap: 8px;
}
.upload-trust-strip .trust-pill { width: fit-content; }
.upload-trust-details summary {
  cursor: pointer;
  color: #bfe9ff;
  font-size: 12px;
  font-weight: 700;
}
.upload-trust-details p { margin: 8px 0 0; font-size: 12px; }
.upload-policy-links {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.upload-policy-links a {
  font-size: 12px;
  color: #bfe9ff;
  text-decoration: none;
  border: 1px solid rgba(56,189,248,.35);
  border-radius: 999px;
  padding: 2px 8px;
}
.upload-policy-links a:hover { text-decoration: underline; color: #e0f2fe; }
.getting-started-license {
  margin-top: 10px;
  border: 1px solid #32476e;
  border-radius: 12px;
  padding: 10px;
  background: rgba(10,18,33,.45);
}
.getting-started-license strong {
  color: #dbe7ff;
  font-size: 13px;
}
.enterprise-upsell {
  margin-top: 10px;
  border: 1px solid rgba(250,204,21,.45);
  border-radius: 12px;
  padding: 10px;
  background: rgba(250,204,21,.1);
}
.enterprise-upsell strong { color: #fde68a; font-size: 13px; }
#license-plan-select {
  min-width: 280px;
  flex: 1 1 280px;
}
.safety-card { border-color: #7c5b14; }
.onboarding-card { margin-top: 0; }
.onboarding-list { margin: 8px 0 0 18px; padding: 0; display: grid; gap: 4px; }
.kpi-grid { display:grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.kpi {
  margin: 0;
  background: linear-gradient(160deg, rgba(255,255,255,.95), rgba(246,250,255,.78));
  box-shadow: 0 12px 30px rgba(38,72,122,.08);
}
.kpi-label { color: #6a7f9f; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.kpi-value { font-size: clamp(26px, 2.4vw, 34px); font-weight: 800; margin-top: 6px; color: #193157; }
.risk-trend-bars { display: grid; gap: 8px; }
.risk-trend-row { display: grid; grid-template-columns: 70px 1fr 28px; align-items: center; gap: 8px; }
.risk-trend-label { font-size: 12px; color: #cbd5e1; }
.risk-trend-track { height: 10px; border-radius: 999px; background: rgba(30,41,59,.55); overflow: hidden; border: 1px solid rgba(71,85,105,.45); }
.risk-trend-fill { display: block; height: 100%; border-radius: 999px; }
.risk-trend-fill.high { background: linear-gradient(90deg, rgba(251,113,133,.95), rgba(244,63,94,.85)); }
.risk-trend-fill.medium { background: linear-gradient(90deg, rgba(245,158,11,.95), rgba(251,191,36,.85)); }
.risk-trend-fill.low { background: linear-gradient(90deg, rgba(34,197,94,.95), rgba(16,185,129,.85)); }
.risk-trend-fill.na { background: linear-gradient(90deg, rgba(148,163,184,.95), rgba(100,116,139,.85)); }
.risk-trend-count { font-size: 12px; color: #e2e8f0; text-align: right; }
.risk-trend-empty { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > input[type="text"],
.row.wrap > input[type="number"],
.row.wrap > select {
  flex: 1 1 220px;
  min-width: 180px;
  margin: 0;
}
.row.wrap > button {
  flex: 0 0 auto;
  align-self: stretch;
}
.row.wrap.between { align-items: flex-start; }
.between { justify-content: space-between; }

button { background: var(--primary); color: var(--primary-ink); border: none; border-radius: var(--radius-lg); padding: var(--space-3) 13px; font-weight: 700; cursor: pointer; min-height: 44px; transition: transform .18s ease, filter .18s ease, box-shadow .2s ease, background-color .2s ease; }
button:hover { filter: brightness(1.05); box-shadow: var(--focus-ring); }
a.btn-secondary { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-height: 44px; padding: var(--space-3) 13px; border-radius: var(--radius-lg); }
button:active { transform: translateY(1px); }
body.is-logged-in .btn-secondary:hover,
body.is-logged-in .btn-danger:hover,
body.is-logged-in button:hover {
  box-shadow: 0 14px 28px rgba(39,73,122,.18);
}
button:disabled { opacity: .65; cursor: not-allowed; box-shadow: none !important; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(56,189,248,.9);
  outline-offset: 2px;
}
.btn-secondary { background: rgba(168,199,255,.18); color: #eef5ff; border: 1px solid rgba(168,199,255,.45); }
.theme-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(138,168,209,.45);
  background: rgba(255,255,255,.06);
}
.theme-toggle-btn {
  min-height: 30px;
  height: 30px;
  min-width: 64px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  color: #dbe8ff;
  font-size: 12px;
  font-weight: 700;
}
.theme-toggle-btn:hover { background: rgba(191,214,255,.14); box-shadow: none; }
.theme-toggle-btn.active {
  background: linear-gradient(135deg, rgba(129,173,255,.34), rgba(91,132,232,.24));
  border-color: rgba(166,194,243,.6);
  color: #ffffff;
}
.switch-icon { font-size: 14px; line-height: 1; }
.theme-toggle-label { font-size: 12px; font-weight: 700; letter-spacing: .01em; }
.upgrade-link { display: inline-block; margin-top: 10px; text-decoration: none; }
.btn-danger { background: rgba(251,113,133,.14); color: #ffd9df; border: 1px solid rgba(251,113,133,.45); }
.mobile-only { display: none !important; }

input[type="file"] { width: 100%; margin: var(--space-1) 0 var(--space-3); border: 1px dashed #30405f; border-radius: var(--radius-md); padding: var(--space-3); color: var(--muted); background: rgba(11,18,32,.5); }
input[type="text"], input[type="number"], select {
  width: 100%;
  margin: var(--space-1) 0 var(--space-3);
  border: 1px solid #34425f;
  border-radius: var(--radius-lg);
  padding: 11px;
  color: #dbe7ff;
  background: rgba(13,21,37,.78);
  min-width: 180px;
  min-height: 44px;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  outline: none;
  border-color: rgba(138,180,255,.7);
  box-shadow: var(--focus-ring);
}
h3 { margin: var(--space-1) 0 var(--space-3); font-size: var(--font-size-lg); color: #c7ddff; font-weight: 600; }
.result-box { margin-top: 12px; background: #0b1220; border: 1px solid #1f2d46; border-radius: 10px; padding: 10px; color: #cbd5e1; font-size: 13px; white-space: pre-wrap; }
.skeleton-line { height: 12px; border-radius: 8px; background: linear-gradient(90deg, #1b2840 20%, #2a3b5f 50%, #1b2840 80%); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 8px 0; }
.skeleton-line.short { width: 45%; }
.skeleton-line.mid { width: 70%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.result-box h3 { margin: 8px 0; font-size: 14px; }
.result-box ul { margin: 6px 0 10px 18px; }
.result-box .pill { display: inline-block; border-radius: 999px; padding: 3px 9px; margin-right: 6px; font-size: 11px; background: #1e293b; color: #cbd5e1; }
.pill-ok { background: rgba(34,197,94,.18) !important; color: #bbf7d0 !important; border: 1px solid rgba(34,197,94,.35); }
.pill-warn { background: rgba(245,158,11,.16) !important; color: #fde68a !important; border: 1px solid rgba(245,158,11,.35); }
.security-posture-panel {
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(246,250,255,.78));
  border: 1px solid rgba(151,178,220,.36);
}
.security-pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.security-posture-note {
  margin-top: 8px;
  font-size: 12px;
}
.analysis-summary-block { margin-top: 10px; display: grid; gap: 8px; }
.analysis-summary-item {
  border: 1px solid #34425f;
  border-radius: 10px;
  background: rgba(14,23,38,.45);
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}
.analysis-summary-item span { font-size: 11px; color: #93c5fd; text-transform: uppercase; letter-spacing: .06em; }
.analysis-summary-item strong { font-size: 13px; color: #e2e8f0; line-height: 1.4; }
.result-box .sev-high { color: #fecaca; }
.result-box .sev-medium { color: #fde68a; }
.result-box .sev-low { color: #bbf7d0; }
.risk-chip-grid { display: grid; gap: 8px; }
.risk-chip { border: 1px solid #34425f; border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; }
.risk-chip.high { border-color: rgba(251,113,133,.55); background: rgba(251,113,133,.1); }
.risk-chip strong { font-size: 12px; color: #ffe1e6; }
.risk-chip span { font-size: 12px; color: #cbd5e1; }
.risk-tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.risk-tag {
  display: inline-flex;
  border: 1px solid rgba(148,163,184,.45);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  color: #cbd5e1;
  background: rgba(15,23,42,.45);
}
.result-box details { margin-top: 10px; border-top: 1px solid #253556; padding-top: 8px; }
.result-box summary { cursor: pointer; color: #9dc0ff; font-weight: 600; }
.upgrade-note { margin-top: 10px; border: 1px solid rgba(250,204,21,.45); background: rgba(250,204,21,.12); color: #fde68a; padding: 8px 10px; border-radius: 10px; font-size: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid #1f2d46; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #1f2d46; }
th { color: #c7ddff; background: #0b1220; position: sticky; top: 0; }
tr:hover td { background: rgba(30,41,59,.25); }
body.is-logged-in .history-toolbar {
  position: sticky;
  top: 88px;
  z-index: 12;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.88), rgba(245,250,255,.74));
  backdrop-filter: blur(8px);
  border: 1px solid rgba(151,178,220,.35);
}
body.is-logged-in .history-toolbar input,
body.is-logged-in .history-toolbar select {
  background: rgba(255,255,255,.9);
  border-color: rgba(151,178,220,.45);
}
body.is-logged-in .table-wrap {
  border: 0;
  box-shadow: 0 14px 34px rgba(38,72,122,.08);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.92), rgba(245,250,255,.76));
}
body.is-logged-in th {
  background: transparent;
  color: #35527a;
  border-bottom: 1px solid rgba(156,183,222,.45);
}
.status-pill { padding: 5px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; border: 1px solid transparent; }
.status-done { background: rgba(34,197,94,.18); color: #bbf7d0; border-color: rgba(34,197,94,.48); box-shadow: 0 0 0 1px rgba(34,197,94,.2), 0 0 16px rgba(34,197,94,.16); }
.status-running, .status-queued { background: rgba(56,189,248,.16); color: #bfe9ff; border-color: rgba(56,189,248,.52); box-shadow: 0 0 0 1px rgba(56,189,248,.2), 0 0 16px rgba(56,189,248,.15); }
.status-warning { background: rgba(245,158,11,.18); color: #fde68a; border-color: rgba(245,158,11,.48); box-shadow: 0 0 0 1px rgba(245,158,11,.18), 0 0 14px rgba(245,158,11,.14); }
.status-muted { background: rgba(148,163,184,.18); color: #cbd5e1; border-color: rgba(148,163,184,.38); }
.status-failed { background: rgba(251,113,133,.18); color: #fecdd3; border-color: rgba(251,113,133,.52); box-shadow: 0 0 0 1px rgba(251,113,133,.2), 0 0 16px rgba(251,113,133,.14); }

.action-row { display:flex; gap:6px; flex-wrap:wrap; }
.btn-mini { padding: 6px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; }
.btn-mini-link { background: rgba(56,189,248,.12); color: #cdefff; border: 1px solid rgba(56,189,248,.4); }
.quick-prompts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.plan-grid { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:8px; }
.plan-card { border:1px solid #32476e; border-radius:10px; padding:8px; display:grid; gap:5px; background:rgba(10,18,33,.45); position: relative; overflow: hidden; }
.plan-card.active { border-color: rgba(56,189,248,.65); box-shadow: inset 0 0 0 1px rgba(56,189,248,.35); }
.plan-card b { font-size: 13px; }
.plan-card span { font-size: 12px; color: var(--muted); }
.lawyer-card { position: relative; overflow: hidden; }
.lawyer-card::before { content:""; position:absolute; inset:auto -20% -35% -20%; height: 180px; background: radial-gradient(circle, rgba(168,85,247,.2), rgba(168,85,247,0) 70%); pointer-events:none; }
.lawyer-card > * { position: relative; z-index:1; }

.compare-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-box { border:1px solid #2a3b5a; border-radius: 12px; padding: 12px; background: rgba(12,20,35,.45); }
.compare-box.ours { border-color: rgba(56,189,248,.45); }
.compare-box.other { border-color: rgba(148,163,184,.35); }
.compare-box h3 { margin-top: 0; }

.view { display: none; }
#view-dashboard { max-width: 1120px; margin: 0 auto; }
.active-view { display: block; }

@media (min-width: 1100px) {
  button:hover {
    box-shadow: 0 0 0 3px rgba(138,180,255,.2), 0 8px 24px rgba(76,122,214,.2);
  }

  .topbar-right button,
  .hero-upload button {
    position: relative;
    overflow: hidden;
  }

  .topbar-right button::after,
  .hero-upload button::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,.18), transparent 45%, rgba(167,139,250,.2));
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
  }

  .topbar-right button:hover::after,
  .hero-upload button:hover::after {
    opacity: .9;
  }

  body.is-logged-in::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: .42;
    background:
      radial-gradient(42rem 20rem at 8% 0%, rgba(56,189,248,.16), transparent 70%),
      radial-gradient(38rem 18rem at 88% 6%, rgba(167,139,250,.18), transparent 68%),
      radial-gradient(30rem 16rem at 50% 96%, rgba(34,197,94,.11), transparent 72%);
  }

  .topbar.card,
  .sidebar.card {
    background: linear-gradient(180deg, rgba(31,47,76,.84), rgba(23,35,58,.78));
    border-color: rgba(148,179,224,.42);
    backdrop-filter: blur(10px);
    box-shadow: 0 14px 36px rgba(6,10,24,.34);
  }

  .hero.card {
    border-color: rgba(99,146,220,.48);
    box-shadow: 0 18px 48px rgba(15,23,42,.38);
  }

  .hero.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(56,189,248,.08), rgba(167,139,250,.06), rgba(34,197,94,.06));
  }

  .btn-secondary,
  button:not(.btn-danger):not(.theme-toggle-btn) {
    background-image: linear-gradient(135deg, rgba(129,173,255,.28), rgba(91,132,232,.2));
    border: 1px solid rgba(166,194,243,.46);
  }

  .kpi.card {
    border-color: rgba(126,161,219,.5);
    box-shadow: 0 12px 30px rgba(7,12,28,.32);
  }
}

@media (max-width: 1200px) {
  .prelogin-grid { grid-template-columns: repeat(12, minmax(0,1fr)); }
  .prelogin-card { grid-column: span 6; }
  .pricing-compare { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .landing-hero-card { grid-template-columns: 1fr; }
  .landing-slide-rail { width: 100%; height: clamp(475px, 96vw, 686px); }
  .landing-slide { width: min(96vw, 660px); min-height: 449px; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .nav-btn { width: auto; margin: 0; flex: 0 0 auto; min-width: 132px; text-align: center; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(11,18,32,.86);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(98,125,170,.35);
    border-radius: 12px;
    margin-bottom: 8px;
  }
  .topbar-main { width: 100%; gap: 8px; }
  .topbar-meta { justify-content: flex-start; }
  .topbar-right { flex-wrap: wrap; justify-content: flex-start; }
  .user-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .prelogin-nav { flex-wrap: wrap; }
  .prelogin-links { order: 3; width: 100%; justify-content: center; }
  .split-hero { grid-template-columns: 1fr; }
  .prelogin-grid { grid-template-columns: repeat(12, minmax(0,1fr)); }
  .prelogin-card { grid-column: span 12; min-height: 0; }
  .pricing-compare { grid-template-columns: 1fr; }
  .landing-section-head,
  .landing-detail-grid,
  .landing-about-grid,
  .value-rail,
  .experience-flow { grid-template-columns: 1fr; }
  .landing-section-head { display: grid; }
  .auth-mini-grid { grid-template-columns: 1fr; }
  .process-stepper { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
}
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #2d3d5c;
  background: rgba(11,18,32,.92);
  color: #d8e6ff;
  opacity: 0;
  transform: translateY(10px);
  transition: all .2s ease;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 140;
}
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: .9;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to {
    transform: translate3d(var(--dx, 0px), 110vh, 0) rotate(var(--rot, 360deg));
    opacity: .05;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  place-items: center;
  z-index: 80;
}
.modal-backdrop.show { display: grid; }
.modal-card {
  width: min(460px, 92vw);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-soft), var(--panel));
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .mobile-only { display: inline-flex !important; }

  .layout {
    margin: 10px auto 0;
    padding: 0 10px 20px;
    gap: 10px;
  }

  body.is-logged-out .sidebar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    top: auto;
    z-index: 45;
    display: flex !important;
    align-items: stretch;
    gap: 6px;
    margin: 0;
    padding: 8px;
    height: auto !important;
    max-height: 92px;
    border-radius: 16px;
    background: rgba(10,16,30,.92);
    border: 1px solid rgba(120,146,188,.42);
    box-shadow: 0 14px 30px rgba(2,6,18,.45);
    backdrop-filter: blur(10px);
  }

  body.is-logged-in .sidebar {
    position: static !important;
    left: auto;
    right: auto;
    bottom: auto;
    top: auto;
    z-index: auto;
    margin: 0 0 8px;
    padding: 0 4px;
    gap: 14px;
    max-height: none;
  }

  .sidebar .logo { display: none; }

  .nav-btn {
    margin: 0;
    min-height: 56px;
    min-width: 0;
    width: auto;
    flex: 1 1 0;
    padding: 6px 4px;
    border-radius: 12px;
    text-align: center;
    font-size: 10px;
    line-height: 1.12;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    word-break: break-word;
    background: rgba(255,255,255,.04);
  }

  .nav-btn[data-view="dashboard"]::before { content: "🏠 "; }
  .nav-btn[data-view="history"]::before { content: "🕘 "; }
  .nav-btn[data-view="lawyer"]::before { content: "⚖️ "; }
  .nav-btn[data-view="lawyer"] { letter-spacing: -.01em; }
  .nav-btn[data-view="account"]::before { content: "👤 "; }
  .nav-btn[data-view="admin"]::before { content: "🛠️ "; }

  @supports (-webkit-touch-callout: none) {
    .sidebar {
      max-height: 86px;
      padding-bottom: calc(8px + env(safe-area-inset-bottom) * 0.2);
    }
    .nav-btn {
      min-height: 52px;
      font-size: 9px;
      line-height: 1.05;
      padding: 4px 3px;
    }
    .nav-btn[data-view="lawyer"] {
      font-size: 8.5px;
      letter-spacing: -.015em;
    }
  }

  .topbar {
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
    gap: 8px;
  }
  .topbar-main { width: 100%; gap: 8px; }
  .topbar-title h1 { font-size: 18px; margin: 0 0 2px; }
  .topbar-title .muted { font-size: 12px; margin: 0; }
  .topbar-meta { justify-content: flex-start; }
  .topbar-right {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
  }
  .topbar-right > * { flex: 0 0 auto; }
  #btn-topbar-plans { font-size: 12px; padding: 8px 10px; }
  #btn-logout { font-size: 12px; padding: 8px 10px; }
}

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

body.light-theme {
  --bg: #eef3fb;
  --panel: #f8fbff;
  --panel-soft: #ffffff;
  --line: #d4e1f3;
  --text: #162235;
  --muted: #4b5f7d;
  --primary: #2f5fae;
  --primary-ink: #f6f9ff;
}
body.light-theme .bg-glow { opacity: .45; }
body.light-theme .result-box,
body.light-theme th { background: #f3f7ff; color: #1f2a44; }
body.light-theme .prelogin-links a { color: #22324a; }
body.light-theme .prelogin-links a:hover { color: #101a2a; }
body.light-theme .upload-trust-strip {
  background: linear-gradient(180deg, rgba(228,241,255,.86), rgba(214,230,248,.72));
  border-color: rgba(47,95,174,.35);
}
body.light-theme .upload-trust-details summary { color: #1d4f9e; }
body.light-theme .nav-btn {
  background: #e8edf4;
  border-color: #b7c5d8;
  color: #32455f;
}
body.light-theme .nav-btn:hover {
  background: #dde7f2;
  border-color: #8fa7c5;
  color: #1b2d47;
}
body.light-theme .nav-btn.active {
  background: #b7c9e3;
  border-color: #5e7ea8;
  color: #10233e;
  font-weight: 700;
}
body.light-theme .prelogin-agent { background: #f7faff; border-color: #c6d7ef; }
body.light-theme .prelogin-agent textarea { background: #fff; color: #0f172a; border-color: #c6d5ea; }
body.light-theme .prelogin-card:nth-child(odd) { background: linear-gradient(180deg, #e9edf3, #e1e8f1); }
body.light-theme .prelogin-card:nth-child(even) { background: linear-gradient(180deg, #e4eaf2, #dce4ee); }
body.light-theme .pricing-tier { background: #e7edf4; border-color: #b6c6da; }
body.light-theme .pricing-tier-pro { background: linear-gradient(180deg, #eef5ff, #f7faff); border-color: #8fb7eb; }
body.light-theme .pricing-tier-team { background: linear-gradient(180deg, #fff8e7, #fefcf6); border-color: #f0cf77; }
body.light-theme .pricing-tier.recommended { background: #e8f2ff; border-color: #8fb7eb; }
body.light-theme .tier-chip { color: #1e3a8a; border-color: #8fb7eb; background: #e8f2ff; }
body.light-theme .tier-chip-enterprise { color: #8a5b00; border-color: #f0cf77; background: #fff4d6; }
body.light-theme .tier-price { color: #1f2a44; }
body.light-theme .recommend-badge { color: #1e3a8a; border-color: #8fb7eb; background: #e8f2ff; }
body.light-theme .billing-placeholder { border-left-color: #9bb6e9; color: #385070; }
body.light-theme input[type="text"],
body.light-theme input[type="number"],
body.light-theme select,
body.light-theme input[type="file"] { background: #fff; color: #0f172a; border-color: #c6d5ea; }
body.light-theme .google-btn { border-color: #cdd8e6; }
body.light-theme .auth-mini-item { background: #f7faff; border-color: #d4e0f2; }
body.light-theme .auth-mini-item strong { color: #1f2a44; }
body.light-theme .auth-license { background: #f7faff; border-color: #c6d7ef; }
body.light-theme .auth-license strong { color: #1f2a44; }
body.light-theme .hero-upload { background: #f6f9ff; border-color: #d3def0; }
body.light-theme .landing-hero-card { background: transparent; border-color: transparent; box-shadow: none; }
body.light-theme .landing-hero-panel,
body.light-theme .landing-detail-card { background: linear-gradient(180deg, #f8fbff, #eef4fb); border-color: #d4e0f2; }
body.light-theme .compare-box { background: #f7faff; border-color: #d4e0f2; }
body.light-theme .compare-box.ours { border-color: #93c5fd; }
body.light-theme .signature-line { color: #5b6f93; }
body.light-theme .upgrade-note { background: #fff7db; color: #8a5b00; border-color: #f6d878; }
body.light-theme .risk-chip { background: #f8fbff; border-color: #d4e0f2; }
body.light-theme .risk-chip.high { background: #fff1f4; border-color: #f2b6c3; }
body.light-theme .risk-chip strong { color: #8a1d36; }
body.light-theme .risk-chip span { color: #334155; }
body.light-theme .result-box details { border-top-color: #d4e0f2; }
body.light-theme .result-box summary { color: #1e3a8a; }
body.light-theme .process-stepper .step { background: #f7faff; border-color: #c6d7ef; color: #4b5b76; }
body.light-theme .process-stepper .step.is-active { background: #e7f2ff; border-color: #8fb7eb; color: #1e3a8a; }
body.light-theme .process-stepper .step.is-done { background: #eafbf1; border-color: #8ed5aa; color: #166534; }
body.light-theme .lawyer-card::before { background: radial-gradient(circle, rgba(147,51,234,.14), rgba(147,51,234,0) 70%); }
body.light-theme .hint-box { background: #f7faff; border-color: #b8cbe8; color: #385070; }
body.light-theme .getting-started-license { background: #f7faff; border-color: #c6d7ef; }
body.light-theme .getting-started-license strong { color: #1f2a44; }
body.light-theme .enterprise-upsell { background: #fff7db; border-color: #f6d878; }
body.light-theme .enterprise-upsell strong { color: #8a5b00; }
body.light-theme .safety-card { border-color: #d5b469; }
body.light-theme .btn-secondary { color: #1e3a8a; border-color: #9bb6e9; background: #eaf1ff; }
body.light-theme .theme-toggle-btn { color: #1e3a8a; border-color: #9bb6e9; background: #eaf1ff; }
body.light-theme .user-chip { color: #1f2a44; border-color: #c7d5ea; }
body.light-theme .prelogin-shell::after { opacity: .1; }
body.light-theme .landing-hero-card,
body.light-theme .landing-section,
body.light-theme .landing-detail-card { box-shadow: 0 12px 30px rgba(47,95,174,.08); }

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

/* final guard: logged-in nav stays neutral in light theme too */
body.is-logged-in .nav-btn,
body.light-theme.is-logged-in .nav-btn {
  background: transparent !important;
  border: 0 !important;
  color: #2a3f61 !important;
  box-shadow: none !important;
}
body.is-logged-in .nav-btn:hover,
body.light-theme.is-logged-in .nav-btn:hover {
  background: transparent !important;
  color: #2a3f61 !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Logged-in nav: simple, single-row, text-first */
body.is-logged-in .sidebar {
  position: static !important;
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 22px;
  margin: 0 0 12px;
  padding: 2px 6px;
  width: 100%;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
body.is-logged-in .sidebar .logo { display: none !important; }
body.is-logged-in .nav-btn {
  width: auto;
  margin: 0;
  padding: 4px 0;
  min-height: auto;
  min-width: auto;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #2a3f61 !important;
  font-weight: 600;
  border-radius: 0;
  font-size: 15px;
  letter-spacing: .01em;
}
body.is-logged-in .nav-btn:hover,
body.is-logged-in .nav-btn:active,
body.is-logged-in .nav-btn:focus-visible {
  color: #2a3f61 !important;
  background: transparent !important;
  transform: none !important;
  box-shadow: none !important;
  outline: none;
}
body.is-logged-in .nav-btn.active {
  color: #10243f !important;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}
body.is-logged-in .nav-btn::before { content: none !important; }

/* Billing/account surfaces aligned with landing style */
body.is-logged-in .plan-card,
body.is-logged-in #billing-render,
body.is-logged-in #account-panel {
  border: 0 !important;
  background: linear-gradient(158deg, rgba(255,255,255,.92), rgba(244,249,255,.78)) !important;
  box-shadow: 0 14px 34px rgba(39,73,122,.1) !important;
  border-radius: 16px !important;
}
body.is-logged-in .plan-card {
  padding: 12px;
  transition: transform .18s ease, box-shadow .18s ease;
}
body.is-logged-in .plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(39,73,122,.14) !important;
}

/* Ensure no framed box look on landing hero */
body.is-logged-out .prelogin-hero,
body.is-logged-out .landing-hero-card,
body.is-logged-out .landing-hero-card--airy,
body.is-logged-out .landing-soft {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.trust-page {
  background: radial-gradient(900px 440px at 8% -10%, rgba(47,95,174,.18), transparent 60%),
    radial-gradient(800px 420px at 92% 0%, rgba(30,58,138,.14), transparent 58%),
    #eff4fb;
}
.trust-layout { max-width: 980px; margin: 20px auto; padding: 0 14px 30px; }
.trust-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.trust-brand { font-size: 22px; }
.trust-hero h1 { margin-top: 0; }
.trust-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.trust-page-link { white-space: nowrap; }
.trust-teaser { background: linear-gradient(145deg, rgba(238,244,251,.92), rgba(231,238,248,.88)); }

@media (max-width: 760px) {
  .trust-header { flex-wrap: wrap; }
  .trust-grid { grid-template-columns: 1fr; }
}
