/* ============================================================
   GPTLegal — Design System
   Premium legaltech aesthetic: paper-serif gravitas + modern SaaS.
   Indigo/violet brand · emerald = trust/approve · gold = premium.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Brand */
  --brand-600: #5b4fe9;
  --brand-500: #6d5ef6;
  --brand-400: #8b7cff;
  --violet-500: #a855f7;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --gold-500: #d4a548;
  --gold-400: #e6bd6a;
  --danger-500: #ef5a6f;
  --warn-500: #f59e0b;

  /* Light theme (default) */
  --bg: #faf9f7;
  --bg-tint: #f3f1fb;
  --surface: #ffffff;
  --surface-2: #f7f6fb;
  --ink: #15171e;
  --ink-soft: #3a3f4b;
  --muted: #656d7e;
  --line: #e7e4ef;
  --line-strong: #d8d4e6;
  --shadow-sm: 0 1px 2px rgba(24, 20, 50, .06), 0 1px 3px rgba(24, 20, 50, .05);
  --shadow-md: 0 8px 24px -6px rgba(35, 25, 80, .12), 0 2px 6px rgba(35, 25, 80, .06);
  --shadow-lg: 0 30px 60px -18px rgba(40, 28, 90, .28), 0 8px 24px -12px rgba(40, 28, 90, .18);
  --glass: rgba(255, 255, 255, .72);
  --glass-line: rgba(255, 255, 255, .6);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --maxw: 1160px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

:root[data-theme="dark"] {
  --bg: #0a0c11;
  --bg-tint: #10121b;
  --surface: #12141c;
  --surface-2: #171a24;
  --ink: #eef0f5;
  --ink-soft: #c4c9d6;
  --muted: #949cad;
  --line: #232735;
  --line-strong: #2e3446;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 40px 80px -24px rgba(0, 0, 0, .7), 0 10px 30px -12px rgba(0, 0, 0, .5);
  --glass: rgba(20, 22, 32, .66);
  --glass-line: rgba(255, 255, 255, .08);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: color-mix(in srgb, var(--brand-500) 28%, transparent); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: clamp(64px, 9vw, 128px) 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand-600);
  padding: 6px 14px; border-radius: 100px;
  background: color-mix(in srgb, var(--brand-500) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-500) 22%, transparent);
}
:root[data-theme="dark"] .eyebrow { color: var(--brand-400); }

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 560; letter-spacing: -.015em; line-height: 1.08; margin: 0; }
.display {
  font-size: clamp(40px, 6.4vw, 76px);
  font-weight: 540;
  line-height: 1.02;
  letter-spacing: -.03em;
}
.h2 { font-size: clamp(30px, 4.4vw, 50px); }
.h3 { font-size: clamp(21px, 2.4vw, 27px); }
.lead { font-size: clamp(17px, 1.7vw, 21px); color: var(--muted); line-height: 1.55; }
.grad-text {
  background: linear-gradient(105deg, var(--brand-500), var(--violet-500) 55%, var(--emerald-400));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.serif-italic { font-style: italic; }

/* ---------- Buttons ---------- */
.btn {
  --pv: 12px; --ph: 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: var(--pv) var(--ph);
  font-size: 15px; font-weight: 620; letter-spacing: -.01em;
  border-radius: 100px; border: 1px solid transparent;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s, border-color .2s, color .2s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--violet-500));
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--brand-600) 55%, transparent), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -10px color-mix(in srgb, var(--brand-600) 62%, transparent), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-ghost { color: var(--ink); background: var(--surface); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--brand-400); box-shadow: var(--shadow-md); }
.btn-soft { color: var(--brand-600); background: color-mix(in srgb, var(--brand-500) 12%, transparent); }
:root[data-theme="dark"] .btn-soft { color: var(--brand-400); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-500) 20%, transparent); }
.btn-lg { --pv: 16px; --ph: 30px; font-size: 16.5px; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.glass {
  background: var(--glass);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border: 1px solid var(--glass-line);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.nav.scrolled { background: var(--glass); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(140deg, var(--brand-600), var(--violet-500)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand-600) 60%, transparent), inset 0 1px 0 rgba(255,255,255,.3); }
.brand .logo svg { width: 19px; height: 19px; }
.brand b { font-weight: 750; }
.brand .tld { color: var(--muted); font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-size: 14.5px; font-weight: 550; color: var(--ink-soft); transition: color .2s; }
.nav-links a:hover { color: var(--brand-600); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); transition: .2s; }
.icon-btn:hover { border-color: var(--brand-400); color: var(--brand-600); }
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(48px, 7vw, 96px); overflow: hidden; }
.mesh { position: absolute; inset: -20% -10% auto -10%; height: 120%; z-index: -1; filter: blur(20px); opacity: .9; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; }
.blob.b1 { width: 520px; height: 520px; top: -140px; left: -80px; background: radial-gradient(circle, var(--brand-500), transparent 70%); }
.blob.b2 { width: 460px; height: 460px; top: -80px; right: -60px; background: radial-gradient(circle, var(--violet-500), transparent 70%); }
.blob.b3 { width: 420px; height: 420px; top: 220px; left: 40%; background: radial-gradient(circle, var(--emerald-400), transparent 70%); opacity: .28; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero-copy { max-width: 620px; }
.hero-copy .display { margin: 22px 0 20px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero-trust { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 30px; color: var(--muted); font-size: 13.5px; }
.hero-trust .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--emerald-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--emerald-500) 20%, transparent); }
.avatars { display: flex; }
.avatars span { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -9px; background: linear-gradient(135deg, var(--brand-400), var(--violet-500)); }
.avatars span:first-child { margin-left: 0; }
.stars { color: var(--gold-500); letter-spacing: 2px; }

/* Hero product mock */
.mock { position: relative; }
.mock .card { padding: 22px; transform: rotate(1.2deg); transition: transform .5s var(--ease); }
.mock:hover .card { transform: rotate(0deg) translateY(-4px); }
.mock-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.mock-title { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 9px; }
.mock-file { width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--brand-500) 14%, transparent); display: grid; place-items: center; color: var(--brand-600); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 640; padding: 4px 10px; border-radius: 100px; }
.badge.ok { color: var(--emerald-500); background: color-mix(in srgb, var(--emerald-500) 14%, transparent); }
.badge.warn { color: var(--warn-500); background: color-mix(in srgb, var(--warn-500) 15%, transparent); }
.badge.flag { color: var(--danger-500); background: color-mix(in srgb, var(--danger-500) 14%, transparent); }
.mock-row { display: flex; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.mock-row:last-child { border-bottom: 0; }
.mock-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }
.mock-ico.v { background: color-mix(in srgb, var(--warn-500) 15%, transparent); }
.mock-ico.r { background: color-mix(in srgb, var(--danger-500) 13%, transparent); }
.mock-ico.g { background: color-mix(in srgb, var(--emerald-500) 14%, transparent); }
.mock-row .t { font-weight: 620; font-size: 13.5px; }
.mock-row .s { font-size: 12.5px; color: var(--muted); }
.mock-float {
  position: absolute; right: -18px; bottom: 30px; padding: 12px 16px; border-radius: 14px;
  font-size: 13px; font-weight: 620; display: flex; align-items: center; gap: 9px;
  animation: float 4s ease-in-out infinite;
}
.mock-float .k { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--emerald-500), var(--emerald-400)); display: grid; place-items: center; color: #fff; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* ---------- Logo strip ---------- */
.strip { padding: 30px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strip-label { text-align: center; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 20px; }
.strip-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 40px; opacity: .8; }
.strip-row span { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--muted); }

/* ---------- Sections / headers ---------- */
.sec-head { max-width: 680px; margin: 0 auto 56px; text-align: center; }
.sec-head .h2 { margin: 18px 0 16px; }

/* ---------- Use-case cards ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.use {
  padding: 26px; border-radius: var(--radius-lg); position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.use:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--brand-400); }
.use .emoji { font-size: 26px; }
.use .u-ico {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 25px; margin-bottom: 16px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--brand-500) 16%, transparent), color-mix(in srgb, var(--violet-500) 16%, transparent));
}
.use h3 { font-size: 20px; margin-bottom: 8px; }
.use p { color: var(--muted); font-size: 14.5px; margin: 0 0 14px; }
.use .u-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.u-tag { font-size: 12px; font-weight: 580; padding: 4px 10px; border-radius: 100px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }

/* ---------- Feature rows ---------- */
.feature { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.f-card { padding: 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: .3s var(--ease); }
.f-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.f-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 15px; color: #fff; background: linear-gradient(140deg, var(--brand-600), var(--violet-500)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand-600) 55%, transparent); }
.f-ico.em { background: linear-gradient(140deg, var(--emerald-500), var(--emerald-400)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--emerald-500) 50%, transparent); }
.f-ico.gd { background: linear-gradient(140deg, var(--gold-500), var(--gold-400)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--gold-500) 50%, transparent); }
.f-card h3 { font-size: 19px; margin-bottom: 8px; }
.f-card p { color: var(--muted); font-size: 14.5px; margin: 0; }

/* ---------- How it works ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: step; }
.step { position: relative; padding: 28px; border-radius: var(--radius-lg); background: var(--bg-tint); border: 1px solid var(--line); }
.step::before { counter-increment: step; content: "0" counter(step); font-family: var(--font-display); font-size: 42px; color: var(--brand-500); opacity: .35; font-weight: 600; }
.step h3 { font-size: 20px; margin: 6px 0 8px; }
.step p { color: var(--muted); font-size: 14.5px; margin: 0; }

/* ---------- Pricing ---------- */
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
.price {
  display: flex; flex-direction: column; padding: 30px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative;
  transition: .3s var(--ease);
}
.price:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.price.featured { border-color: transparent; box-shadow: var(--shadow-lg); background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(140deg, var(--brand-500), var(--violet-500)) border-box; border: 1.5px solid transparent; }
.price .p-tier { font-weight: 680; font-size: 15px; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.price .p-amt { font-family: var(--font-display); font-size: 46px; font-weight: 560; margin: 14px 0 2px; letter-spacing: -.02em; }
.price .p-amt small { font-family: var(--font-sans); font-size: 15px; font-weight: 550; color: var(--muted); letter-spacing: 0; }
.price .p-desc { color: var(--muted); font-size: 14px; min-height: 42px; }
.price ul { list-style: none; padding: 0; margin: 20px 0 24px; display: grid; gap: 11px; }
.price li { display: flex; gap: 10px; font-size: 14.5px; color: var(--ink-soft); align-items: flex-start; }
.price li svg { flex: none; margin-top: 3px; color: var(--emerald-500); }
.price .p-cta { margin-top: auto; }
.ribbon { position: absolute; top: 18px; right: 18px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; padding: 5px 12px; border-radius: 100px; background: linear-gradient(135deg, var(--brand-600), var(--violet-500)); }
.ribbon.gold { background: linear-gradient(135deg, var(--gold-500), var(--gold-400)); color: #3a2a06; }

/* ---------- Testimonial ---------- */
.quote { max-width: 860px; margin: 0 auto; text-align: center; }
.quote blockquote { font-family: var(--font-display); font-size: clamp(22px, 3vw, 32px); line-height: 1.35; letter-spacing: -.015em; margin: 0 0 24px; }
.quote .who { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14.5px; }
.quote .who span { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-400), var(--violet-500)); }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--line); padding: 8px 0; }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; font-weight: 600; font-size: 17px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .chev { transition: transform .3s var(--ease); color: var(--muted); flex: none; }
.faq details[open] summary .chev { transform: rotate(45deg); color: var(--brand-600); }
.faq p { color: var(--muted); margin: 0 0 16px; font-size: 15px; }

/* ---------- CTA band ---------- */
.cta-band { position: relative; overflow: hidden; border-radius: var(--radius-xl); padding: clamp(48px, 7vw, 84px); text-align: center; color: #fff; background: linear-gradient(140deg, var(--brand-600), var(--violet-500) 70%, var(--brand-500)); box-shadow: var(--shadow-lg); }
.cta-band::after { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 300px at 20% 0%, rgba(255,255,255,.22), transparent 60%), radial-gradient(500px 300px at 90% 100%, rgba(16,185,129,.35), transparent 60%); pointer-events: none; }
.cta-band .h2 { color: #fff; margin-bottom: 14px; position: relative; }
.cta-band p { color: rgba(255,255,255,.86); font-size: 18px; margin: 0 auto 28px; max-width: 540px; position: relative; }
.cta-band .btn-ghost { background: #fff; color: var(--brand-600); border-color: transparent; position: relative; }
.cta-band .btn-primary { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4); backdrop-filter: blur(6px); position: relative; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 60px 0 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.footer h4 { font-family: var(--font-sans); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; font-weight: 650; }
.footer a { display: block; color: var(--ink-soft); font-size: 14.5px; padding: 6px 0; transition: color .2s; }
.footer a:hover { color: var(--brand-600); }
.footer .about { color: var(--muted); font-size: 14px; max-width: 300px; margin: 16px 0 0; }
.disclaimer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .mock-float { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   APP (the tool) styles
   ============================================================ */
.app-wrap { max-width: 980px; margin: 0 auto; padding: 40px 24px 80px; }
.app-head { text-align: center; margin-bottom: 8px; }
.app-head h1 { font-size: clamp(30px, 4vw, 44px); }
.app-head p { color: var(--muted); margin-top: 10px; }
.notice { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 26px 0; }
.notice svg { flex: none; margin-top: 1px; color: var(--brand-500); }

.tabs { display: inline-flex; gap: 4px; padding: 5px; border-radius: 100px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 22px; }
.tab { padding: 9px 20px; border-radius: 100px; border: 0; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); transition: .25s var(--ease); }
.tab.active { background: var(--surface); color: var(--brand-600); box-shadow: var(--shadow-sm); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.input, .textarea {
  width: 100%; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 14px 16px; font: inherit; transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.textarea { min-height: 260px; line-height: 1.6; }
.input:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500) 15%, transparent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.app-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.app-hint { color: var(--muted); font-size: 12.5px; }

.spinner { width: 18px; height: 18px; border: 2.5px solid color-mix(in srgb, var(--brand-500) 30%, transparent); border-top-color: var(--brand-500); border-radius: 50%; animation: spin .7s linear infinite; display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { display: none; margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); font-size: 14px; color: var(--danger-500); background: color-mix(in srgb, var(--danger-500) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger-500) 28%, transparent); }

/* Result */
#result { display: none; margin-top: 26px; }
.res-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 26px; border-radius: var(--radius-lg); background: linear-gradient(140deg, color-mix(in srgb, var(--brand-500) 8%, var(--surface)), var(--surface)); border: 1px solid var(--line); margin-bottom: 18px; }
.res-hero .summary { font-size: 18px; line-height: 1.5; margin: 12px 0 0; }
.res-block { padding: 22px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); margin-bottom: 16px; }
.res-block h3 { font-family: var(--font-sans); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kv-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.kv-item .k { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.kv-item .val { font-weight: 560; }
.li-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 9px; }
.li-item:last-child { margin-bottom: 0; }
.li-item .t { font-weight: 620; }
.li-item .s { color: var(--muted); font-size: 14px; margin-top: 3px; }
.li-item.flag { border-left: 3px solid var(--danger-500); }
.li-item.deadline { border-left: 3px solid var(--warn-500); }
.li-item.lawyer { border-left: 3px solid var(--brand-500); }
#draftBox .li-item .s { color: var(--ink); }

/* ---------- Account / usage ---------- */
.usage-bar { height: 10px; border-radius: 100px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.usage-bar span { display: block; height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--brand-600), var(--violet-500)); transition: width .5s var(--ease); }
.usage-bar span.unlimited { background: linear-gradient(90deg, var(--emerald-500), var(--emerald-400)); }
.nav-auth { display: inline-flex; align-items: center; gap: 10px; }
.nav-auth .who { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Create flow ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.doc-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  text-align: left; padding: 20px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease), border-color .28s;
}
.doc-card:hover { transform: translateY(-5px); border-color: var(--brand-400); box-shadow: var(--shadow-lg); }
.doc-emoji { font-size: 28px; }
.doc-aud { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-600); }
:root[data-theme="dark"] .doc-aud { color: var(--brand-400); }
.doc-name { font-family: var(--font-display); font-size: 19px; font-weight: 560; }
.doc-blurb { font-size: 13.5px; color: var(--muted); }

.back-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 0; transition: color .2s; }
.back-btn:hover { color: var(--brand-600); }

.doc-layout { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; margin-top: 22px; align-items: start; }
.doc-paper { padding: 0; overflow: hidden; }
.doc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
.doc-body { padding: 28px 32px 34px; max-height: 74vh; overflow-y: auto; }
.doc-body h2 { font-family: var(--font-display); font-size: 22px; margin: 4px 0 14px; }
.doc-body h3 { font-family: var(--font-sans); font-size: 15px; font-weight: 700; letter-spacing: .01em; margin: 22px 0 8px; }
.doc-body h4 { font-size: 14px; font-weight: 650; margin: 16px 0 6px; color: var(--ink-soft); }
.doc-body p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.7; color: var(--ink-soft); }
.doc-body ul { margin: 0 0 14px; padding-left: 20px; }
.doc-body li { font-size: 14.5px; line-height: 1.65; margin-bottom: 6px; color: var(--ink-soft); }
.doc-body strong { color: var(--ink); }
.doc-aside { position: sticky; top: 88px; }
.doc-aside .res-block { margin-bottom: 14px; }

@media (max-width: 940px) {
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
  .doc-layout { grid-template-columns: 1fr; }
  .doc-aside { position: static; }
  .doc-body { max-height: none; }
}

/* ---------- History ---------- */
.hist-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.hist-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-400); }
.hist-open { flex: 1; display: flex; align-items: center; gap: 13px; background: transparent; border: 0; text-align: left; cursor: pointer; min-width: 0; }
.hist-ico { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--surface-2); border: 1px solid var(--line); }
.hist-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hist-title { font-weight: 620; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.hist-del { padding: 8px 12px; color: var(--muted); }
.hist-del:hover { color: var(--danger-500); border-color: var(--danger-500); }

/* Responsive ---------- */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .mock { max-width: 480px; margin: 0 auto; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .feature, .steps, .pricing { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-toggle { display: grid; }
  .grid-4, .grid-3, .grid-2, .doc-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .res-hero { flex-direction: column; }
}

/* ---------- upload dropzone ---------- */
.dropzone {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; margin-bottom: 12px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--brand-400);
  background: var(--bg-tint);
  outline: none;
}
.dropzone.dragging {
  border-color: var(--brand-500);
  background: var(--bg-tint);
  transform: scale(1.01);
}
.dropzone.busy { opacity: .65; pointer-events: none; }
.dz-icon { color: var(--brand-500); flex: none; }
.dz-text { font-size: 14.5px; color: var(--ink-soft); line-height: 1.45; }
.dz-link { color: var(--brand-500); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.dz-status {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13.5px; color: var(--ink-soft);
}
.dz-status.error { border-color: var(--danger-500); color: var(--danger-500); background: transparent; }
.dz-status .dz-name { font-weight: 600; color: var(--ink); }
.dz-status .dz-meta { color: var(--muted); font-size: 12.5px; }
.dz-status .dz-clear {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 12.5px; text-decoration: underline;
}
.dz-status .dz-clear:hover { color: var(--ink); }
.dz-spin {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--brand-500);
  animation: dz-rot .7s linear infinite;
}
@keyframes dz-rot { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .dropzone { flex-direction: column; text-align: center; gap: 10px; }
}

/* ---------- verifiable citations ---------- */
.cite-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 20px 22px;
}
.cite-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.cite-title { font-family: var(--font-display); font-size: 19px; font-weight: 560; color: var(--ink); }
.cite-source {
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.cite-topic { padding: 16px 0; border-bottom: 1px solid var(--line); }
.cite-topic:last-of-type { border-bottom: 0; }
.cite-topic-name { font-weight: 650; font-size: 15.5px; color: var(--ink); margin-bottom: 6px; }
.cite-doctrine { font-size: 14px; color: var(--ink-soft); line-height: 1.55; margin: 0 0 12px; }

.cite-card {
  display: block; text-decoration: none;
  padding: 13px 15px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.cite-card:hover {
  border-color: var(--brand-400);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.cite-card:last-child { margin-bottom: 0; }
.cite-case { font-weight: 600; color: var(--ink); font-size: 14.5px; font-style: italic; }
.cite-ref { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: var(--brand-500); margin-top: 3px; }
.cite-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.cite-snip { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin-top: 8px; }
.cite-link { display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--brand-500); margin-top: 9px; }
.cite-disclaimer { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); text-align: left; line-height: 1.5; }
