:root {
  --bg: #FAFAFB;
  --surface: #FFFFFF;
  --dark: #0B0F17;
  --dark-elevated: #121826;
  --border: #E5E7EB;
  --border-dark: #1F2937;
  --text: #0B0F17;
  --text-muted: #6B7280;
  --text-on-dark: #E5E7EB;
  --text-on-dark-muted: #8B93A7;
  --indigo: #6366F1;
  --indigo-strong: #4F46E5;
  --emerald: #10B981;
  --radius-md: 8px;
  --radius-lg: 14px;
  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
  background-image: radial-gradient(circle, rgba(11,15,23,0.05) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* Subtle film-grain overlay, everywhere — the kind of texture that makes a flat
   SaaS page feel machined rather than templated. Self-contained SVG turbulence,
   no external asset. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Scroll reveal ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].in-view { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

a { color: inherit; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Nav ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.nav.scrolled {
  background: rgba(250,250,251,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 24px -16px rgba(11,15,23,0.15);
}

.nav .wrap { display: flex; align-items: center; justify-content: space-between; width: 100%; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.brand-mark {
  display: flex;
  align-items: center;
  width: 26px;
  flex-shrink: 0;
}

.brand-mark svg { display: block; width: 100%; height: auto; }

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 13px;
  color: var(--text-muted);
}

.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--text); }

.nav-ctas { display: flex; align-items: center; gap: 10px; }
.nav-ctas a { text-decoration: none; }

/* ---------- Buttons / pills ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-md);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--indigo-strong);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset;
  position: relative;
  overflow: hidden;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
}

.btn-primary:hover {
  background: #433CD6;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(79,70,229,0.55);
}

.btn-primary:hover::after { left: 140%; }

.btn-ghost { transition: border-color 0.15s ease, transform 0.15s ease; }
.btn-ghost:hover { transform: translateY(-1px); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover { border-color: var(--indigo); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-live {
  background: rgba(16,185,129,0.12);
  color: #067A57;
}

.badge-roadmap {
  background: rgba(107,114,128,0.12);
  color: var(--text-muted);
}

/* ---------- Hero ---------- */

.hero {
  padding: 56px 0 40px;
  position: relative;
  overflow: hidden;
}

.aurora {
  position: absolute;
  inset: -20% -10%;
  z-index: 0;
  pointer-events: none;
  /* Fade the whole aurora out well before its own box edge, so overflow:hidden
     never has to hard-clip a visibly-still-bright blob into a rectangle. */
  -webkit-mask-image: radial-gradient(ellipse 65% 60% at 50% 30%, black 0%, transparent 78%);
  mask-image: radial-gradient(ellipse 65% 60% at 50% 30%, black 0%, transparent 78%);
}

.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}

.aurora span:nth-child(1) {
  width: 480px;
  height: 480px;
  left: 4%;
  top: 6%;
  background: radial-gradient(circle, rgba(99,102,241,0.55), transparent 70%);
  animation: drift-a 22s ease-in-out infinite alternate;
}

.aurora span:nth-child(2) {
  width: 420px;
  height: 420px;
  right: 6%;
  top: -4%;
  background: radial-gradient(circle, rgba(16,185,129,0.4), transparent 70%);
  animation: drift-b 26s ease-in-out infinite alternate;
}

.aurora span:nth-child(3) {
  width: 380px;
  height: 380px;
  left: 38%;
  bottom: -12%;
  background: radial-gradient(circle, rgba(79,70,229,0.4), transparent 70%);
  animation: drift-c 19s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.08); }
}

@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-30px, 40px) scale(0.95); }
}

@keyframes drift-c {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(25px, -35px) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora span { animation: none; }
}

.hero .wrap-inner, .hero-copy, .playground { position: relative; z-index: 1; }

.hero-copy { max-width: 760px; margin-bottom: 36px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--indigo-strong);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: 46px;
  line-height: 1.08;
  margin: 0 0 16px;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.hero h1 span {
  background: linear-gradient(100deg, var(--indigo-strong), #8B5CF6, var(--indigo-strong));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}

@keyframes shimmer {
  to { background-position: -200% center; }
}

@media (prefers-reduced-motion: reduce) {
  .hero h1 span { animation: none; }
}

.hero p {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 24px;
  max-width: 620px;
}

.hero-ctas { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }

.metric-pills { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Playground ---------- */

.playground {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-dark);
  box-shadow: 0 20px 60px -20px rgba(11,15,23,0.25);
}

@media (max-width: 860px) {
  .playground { grid-template-columns: 1fr; }
}

.pg-pane {
  background: var(--dark);
  display: flex;
  flex-direction: column;
  min-height: 460px;
}

.pg-pane.preview-pane { background: var(--dark-elevated); }

.pg-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-on-dark-muted);
}

.pg-pane-head .dots { display: flex; gap: 6px; }
.pg-pane-head .dots span { width: 9px; height: 9px; border-radius: 50%; background: #2A3244; display: block; }

.pane-sub { color: var(--text-on-dark-muted); font-weight: 400; }

.pg-actions { display: flex; gap: 8px; align-items: center; }

.pg-actions button {
  background: transparent;
  border: 1px solid var(--border-dark);
  color: var(--text-on-dark-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.pg-actions button:hover { color: var(--text-on-dark); border-color: #3A4457; }

#json-editor {
  flex: 1;
  background: var(--dark);
  color: #D7DEEB;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 18px 20px;
  tab-size: 2;
}

.preview-body {
  flex: 1;
  position: relative;
  background:
    linear-gradient(135deg, rgba(99,102,241,0.06) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--dark-elevated);
}

#pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

.pg-pane-head-left { display: flex; align-items: center; gap: 8px; }

.latency-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(16,185,129,0.15);
  color: #34D399;
  border: 1px solid rgba(16,185,129,0.3);
  transition: opacity 0.2s ease;
}

.error-banner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: rgba(11,15,23,0.92);
  color: #FCA5A5;
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  z-index: 3;
}

.error-banner.visible { display: flex; }

/* ---------- Sections ---------- */

section { padding: 96px 0; }

.section-head { max-width: 640px; margin-bottom: 44px; }

.section-head .eyebrow { margin-bottom: 16px; }

.section-head h2 {
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  font-weight: 700;
}

.section-head p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

/* ---------- Bento grid ---------- */

.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr; }
}

.bento .bento-card:nth-child(1) { transition-delay: 0ms; }
.bento .bento-card:nth-child(2) { transition-delay: 60ms; }
.bento .bento-card:nth-child(3) { transition-delay: 120ms; }
.bento .bento-card:nth-child(4) { transition-delay: 0ms; }
.bento .bento-card:nth-child(5) { transition-delay: 60ms; }
.bento .bento-card:nth-child(6) { transition-delay: 120ms; }
.bento .bento-card:nth-child(7) { transition-delay: 0ms; }

.pricing-grid .price-card:nth-child(2) { transition-delay: 100ms; }

.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.bento-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px circle at var(--spot-x, 50%) var(--spot-y, 0%), rgba(99,102,241,0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.bento-card:hover::before { opacity: 1; }

.bento-card:hover {
  border-color: var(--indigo);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -20px rgba(11,15,23,0.2);
}

.bento-card > * { position: relative; }

.bento-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.bento-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(99,102,241,0.1);
  color: var(--indigo-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.bento-card h3 {
  font-size: 15px;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bento-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ---------- Pricing ---------- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 760px;
}

@media (max-width: 640px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.price-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(260px circle at var(--spot-x, 50%) var(--spot-y, 0%), rgba(99,102,241,0.1), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.price-card:hover::before { opacity: 1; }
.price-card:hover { transform: translateY(-2px); }
.price-card > * { position: relative; }

.price-card-featured {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--border-angle, 0deg), var(--indigo), #8B5CF6, var(--emerald), var(--indigo)) border-box;
  animation: rotate-border 6s linear infinite;
  box-shadow: 0 12px 32px -16px rgba(99,102,241,0.35);
}

@property --border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes rotate-border {
  to { --border-angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .price-card-featured { animation: none; }
}

.price-card-featured .badge { position: absolute; top: 24px; right: 24px; }

.price-card h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }

.price {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.price span { font-size: 14px; font-weight: 500; color: var(--text-muted); }

.price-card ul {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-card li {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 20px;
  position: relative;
}

.price-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--emerald);
  font-weight: 700;
}

.price-card code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(99,102,241,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

.price-card .btn { width: 100%; justify-content: center; }

/* ---------- Code sample ---------- */

.code-sample {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 860px) {
  .code-sample { grid-template-columns: 1fr; }
}

.code-block {
  background: var(--dark);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-dark);
  overflow: hidden;
}

.code-block-head {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-dark);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-on-dark-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-block pre {
  margin: 0;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #D7DEEB;
  overflow-x: auto;
}

.code-block .tok-key { color: #93C5FD; }
.code-block .tok-str { color: #86EFAC; }
.code-block .tok-num { color: #FCA5A5; }
.code-block .tok-comment { color: #6B7280; }

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field { margin-bottom: 18px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

input[type="color"] {
  width: 48px;
  height: 38px;
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.form-error {
  display: none;
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.25);
  color: #B91C1C;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.form-error.visible { display: block; }

.form-success {
  display: none;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.25);
  color: #067A57;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.form-success.visible { display: block; }

/* ---------- Auth pages ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 24px;
  text-decoration: none;
  color: var(--text);
}

.auth-card h1 {
  font-size: 20px;
  text-align: center;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
}

.auth-card .btn { width: 100%; justify-content: center; margin-top: 4px; }

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 20px;
}

.auth-switch a { color: var(--indigo-strong); font-weight: 600; text-decoration: none; }

.auth-note {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 20px;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--indigo-strong);
  cursor: pointer;
}

/* ---------- App shell (authenticated area) ---------- */

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.app-nav.scrolled {
  background: rgba(250,250,251,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
  box-shadow: 0 8px 24px -16px rgba(11,15,23,0.15);
}

.app-nav .wrap { display: flex; align-items: center; justify-content: space-between; width: 100%; }

.app-user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--text-muted); }

.app-shell { padding: 32px 0 64px; }

.app-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .app-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.panel + .panel { margin-top: 20px; }

.panel h3 {
  font-size: 14px;
  margin: 0 0 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.usage-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.usage-row .plan-badge { font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(99,102,241,0.1); color: var(--indigo-strong); }

.usage-bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 10px 0 14px; }
.usage-bar-fill { height: 100%; background: var(--indigo); border-radius: 999px; }

.usage-note { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

.logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.logo-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-row .btn { flex-shrink: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.logo-filename {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo-preview img { max-width: 100%; max-height: 100%; }
.logo-preview span { font-size: 10px; color: var(--text-muted); text-align: center; padding: 4px; }

.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="text"] { flex: 1; }

.key-reveal {
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.key-reveal code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
  color: var(--text);
}

.line-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.line-item-row {
  display: grid;
  grid-template-columns: 1fr 70px 90px auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 640px) {
  .line-item-row { grid-template-columns: 1fr 60px 80px auto; }
}

.line-item-remove {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 14px;
}

.line-item-remove:hover { border-color: #DC2626; color: #DC2626; }

.line-item-total {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

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

.invoice-preview {
  margin-top: 24px;
  background: var(--dark-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-dark);
  min-height: 420px;
  position: relative;
  overflow: hidden;
}

.invoice-preview iframe {
  width: 100%;
  height: 420px;
  border: none;
  background: white;
}

.invoice-preview .empty-state {
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-dark-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.archive-list { display: flex; flex-direction: column; }

.archive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.archive-row:last-child { border-bottom: none; }

.archive-row-main { min-width: 0; }

.archive-row-number {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.archive-row-client {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.archive-row-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.archive-row-amount { font-weight: 700; font-size: 13px; }
.archive-row-date { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

.archive-row a.btn {
  padding: 6px 12px;
  font-size: 12px;
}

/* ---------- Legal pages ---------- */

.legal { padding: 64px 0 96px; max-width: 720px; }

.legal-body h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 36px 0 10px;
}

.legal-body h3:first-child { margin-top: 0; }

.legal-body p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.legal-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(99,102,241,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}

.legal-body a { color: var(--indigo-strong); text-decoration: underline; }
.legal-body strong { color: var(--text); }

/* ---------- What's new modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11,15,23,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 64px -20px rgba(11,15,23,0.35);
}

.modal-card .eyebrow { margin-bottom: 16px; }

.whats-new-item + .whats-new-item {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.whats-new-item h4 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.whats-new-item p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.whats-new-item .whats-new-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
}

/* ---------- Docs page ---------- */

.docs-shell { padding: 40px 0 96px; }

.docs-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
}

.docs-toc {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-toc-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 8px 10px;
}

.docs-toc a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-md);
}

.docs-toc a:hover { color: var(--text); background: var(--surface); }

.docs-content { max-width: 760px; }

.docs-content h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 48px 0 12px;
  scroll-margin-top: 90px;
}

.docs-content h2:first-child { margin-top: 0; }

.docs-content h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 28px 0 10px;
  scroll-margin-top: 90px;
}

.docs-content .code-block { margin: 4px 0 20px; }
.docs-content .code-block + .code-block { margin-top: -8px; }

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 13px;
}

.docs-content th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: 8px 10px 8px 0;
}

.docs-content td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

.docs-content td:first-child, .docs-content th:first-child { color: var(--text); }
.docs-content td code { white-space: nowrap; }

.doc-callout {
  font-size: 13px;
  line-height: 1.65;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin: 0 0 18px;
}

.doc-callout-note {
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.25);
  color: var(--text);
}

.doc-callout-warn {
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.25);
  color: #B91C1C;
}

/* ---------- Footer ---------- */

footer {
  background: var(--dark);
  color: var(--text-on-dark-muted);
  font-size: 13px;
  margin-top: 40px;
}

.footer-top {
  padding: 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-dark);
}

footer .foot-links { display: flex; gap: 20px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--text-on-dark); }

.footer-bottom {
  padding: 18px 0;
  text-align: center;
  font-size: 12px;
}

.footer-bottom a { color: var(--text-on-dark-muted); }
.footer-bottom a:hover { color: var(--text-on-dark); }
.footer-dot { margin: 0 8px; opacity: 0.6; }

@media (max-width: 640px) {
  .hero h1 { font-size: 34px; }
  .footer-top { flex-direction: column; gap: 12px; text-align: center; }
}
