/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --navy-900: #0f1b2d;
  --navy-800: #16273f;
  --navy-700: #1c2f4a;
  --border-navy: #263a56;
  --ink: #16233a;
  --paper: #f7f5f0;
  --paper-alt: #efece4;
  --card-border: #e6e2d8;
  --muted: #4a5568;
  --muted-2: #7c869a;
  --accent: oklch(72% 0.12 78);
  --accent-ink: #16233a;
  --ok: #2f9e6a;
  --error: #b23b3b;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(20px, 5vw, 96px);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; text-wrap: balance; line-height: 1.15; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--paper); color: var(--ink);
  z-index: 9999; border-radius: 8px; font-weight: 500;
}
.skip-link:focus { top: 1rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.section { padding-block: clamp(56px, 9vw, 96px); }
.section-dark { background: var(--navy-900); color: var(--paper); }
.section-alt { background: var(--paper-alt); }
.eyebrow {
  color: #8a7433; font-size: 13px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
}
.section-dark .eyebrow { color: var(--accent); }
.section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 34px); }

/* =============================================================
   4. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 8px; font-weight: 600; font-size: 15px;
  transition: filter .2s var(--ease-out), background .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn-ghost { border: 1px solid var(--border-navy); color: var(--paper); }
.btn-ghost:hover { border-color: var(--paper); }
.btn-outline { border: 1px solid var(--card-border); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 13.5px; }

.badge-demo {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fbf2de; border: 1px solid #e9d5a4; color: #7a5f1f;
  font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 100px;
}

.card {
  background: var(--paper); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 28px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--muted-2); }
.field input, .field textarea, .field select {
  padding: 11px 13px; border: 1px solid var(--card-border); border-radius: 7px;
  background: #fff; font-size: 15px;
}
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }

.notice {
  padding: 12px 16px; border-radius: 8px; font-size: 14px; line-height: 1.55;
}
.notice-info { background: #eef2f9; color: #2c3e5e; border: 1px solid #d6e0ef; }
.notice-error { background: #fbeaea; color: #7a2a2a; border: 1px solid #f1c9c9; }
.notice-ok { background: #e9f7f0; color: #1e6b47; border: 1px solid #c7ecda; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy-900); color: var(--paper); padding: 13px 22px; border-radius: 8px;
  font-size: 14.5px; opacity: 0; pointer-events: none; transition: all .25s var(--ease-out);
  z-index: 999; max-width: min(90vw, 420px); text-align: center;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =============================================================
   5. Nav
   ============================================================= */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gutter); background: var(--navy-900);
}
.nav-brand { display: flex; align-items: center; gap: 10px; color: var(--paper); font-family: var(--font-serif); font-size: 21px; font-weight: 600; }
.nav-links { display: flex; align-items: center; gap: clamp(16px, 2vw, 36px); }
.nav-links a { color: #cdd3dd; font-size: 14.5px; }
.nav-links a:hover { color: var(--paper); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-mobile-toggle { display: none; }

@media (max-width: 719px) {
  .nav-links { display: none; }
  .nav-mobile-toggle { display: inline-flex; color: var(--paper); }
}

/* =============================================================
   6. Landing sections
   ============================================================= */
.hero {
  background: var(--navy-900); color: var(--paper);
  padding: clamp(56px, 8vw, 96px) var(--gutter) clamp(64px, 9vw, 120px);
  display: flex; gap: 56px; align-items: center; flex-wrap: wrap;
}
.hero-copy { flex: 1 1 460px; max-width: 600px; display: flex; flex-direction: column; gap: 24px; }
.hero-pill {
  display: inline-flex; width: fit-content; align-items: center; gap: 8px;
  padding: 7px 14px; border: 1px solid rgba(217,169,78,.4); border-radius: 100px;
}
.hero-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero-pill span:last-child { color: var(--accent); font-size: 13px; font-weight: 500; letter-spacing: .02em; }
.hero h1 { font-size: clamp(32px, 4.4vw, 48px); }
.hero p.lede { color: #b7bfcc; font-size: 18px; line-height: 1.6; max-width: 54ch; }
.hero-cta-note { color: var(--muted-2); font-size: 13.5px; }
.hero-visual { flex: 1 1 360px; display: flex; justify-content: center; }
.doc-preview {
  width: min(400px, 100%); background: var(--paper); border-radius: var(--radius);
  padding: 30px; box-shadow: 0 30px 60px rgba(0,0,0,.35);
}
.doc-preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.doc-preview-head span:first-child { font-family: var(--font-serif); font-size: 15px; font-weight: 600; }
.doc-preview-tag { font-size: 11px; color: #8a7433; background: #f3e6c8; padding: 4px 9px; border-radius: 100px; font-weight: 600; }
.doc-line { height: 9px; background: #e6e2d8; border-radius: 3px; }
.doc-field {
  display: inline-flex; width: fit-content; align-items: center; gap: 6px;
  padding: 6px 10px; background: #fbf2de; border: 1px solid #e9d5a4; border-radius: 6px;
}
.doc-field .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.doc-field span { font-size: 12.5px; color: #7a5f1f; font-weight: 500; }
.doc-preview-body { display: flex; flex-direction: column; gap: 12px; }

.steps-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 28px; }
.step-card { display: flex; flex-direction: column; gap: 12px; padding: 30px; background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius); }
.step-num { font-family: var(--font-serif); font-size: 30px; color: var(--accent); font-weight: 600; }
.step-card h3 { font-size: 18px; }
.step-card p { font-size: 14.5px; color: var(--muted); line-height: 1.6; }

.docs-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; }
.doc-card { display: flex; flex-direction: column; gap: 10px; padding: 26px; background: var(--paper); border-radius: var(--radius); }
.doc-card svg { color: var(--ink); }
.doc-card h3 { font-size: 16px; }
.doc-card p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }

.trust-list { display: flex; flex-direction: column; gap: 26px; }
.trust-item { display: flex; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--card-border); }
.trust-item:last-child { border-bottom: 0; padding-bottom: 0; }
.trust-item svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.trust-item h3 { font-size: 16.5px; }
.trust-item p { font-size: 14.5px; color: var(--muted); line-height: 1.6; }
.trust-layout { display: flex; gap: 56px; flex-wrap: wrap; }
.trust-layout > .trust-head { flex: 0 0 300px; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; }
.price-card { display: flex; flex-direction: column; gap: 18px; padding: 32px 26px; background: var(--navy-800); border-radius: 12px; border: 1px solid var(--border-navy); position: relative; }
.price-card.is-featured { background: var(--navy-700); border-color: var(--accent); border-width: 1.5px; }
.price-badge {
  position: absolute; top: -13px; right: 22px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 100px;
}
.price-card .plan-name { color: #cdd3dd; font-size: 14px; font-weight: 600; }
.price-amount { display: flex; align-items: baseline; gap: 6px; }
.price-amount .num { font-family: var(--font-serif); font-size: 36px; font-weight: 600; }
.price-amount .per { color: var(--muted-2); font-size: 13px; }
.price-card p.desc { font-size: 13.5px; color: var(--muted-2); line-height: 1.55; }

.payment-row {
  display: flex; align-items: center; justify-content: center; gap: 40px; flex-wrap: wrap;
  padding: 40px var(--gutter); background: var(--navy-900); border-top: 1px solid var(--border-navy);
}
.payment-methods { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.payment-methods span { color: #cdd3dd; font-size: 14px; font-weight: 600; }

.faq-list { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 1px; background: #d8d3c5; border-radius: 10px; overflow: hidden; }
.faq-item { padding: 24px 28px; background: var(--paper); display: flex; flex-direction: column; gap: 8px; }
.faq-item h3 { font-size: 15.5px; }
.faq-item p { font-size: 13.8px; color: var(--muted); line-height: 1.6; }

.cta-band { padding: clamp(56px, 9vw, 90px) var(--gutter); background: var(--paper); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.cta-band h2 { font-size: clamp(26px, 3.4vw, 32px); max-width: 560px; }

.site-footer { padding: 34px var(--gutter); background: var(--navy-900); display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.site-footer .brand { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--paper); }
.site-footer p { font-size: 12.5px; color: #6b7488; max-width: 540px; line-height: 1.6; }
.site-footer .links { display: flex; gap: 18px; font-size: 12.5px; }
.site-footer .links a { color: #8a93a8; }
.site-footer .links a:hover { color: var(--paper); }

/* =============================================================
   7. Auth pages
   ============================================================= */
.auth-shell { min-height: 100vh; display: flex; }
.auth-side {
  flex: 1 1 45%; background: var(--navy-900); color: var(--paper);
  display: flex; flex-direction: column; justify-content: space-between; padding: 40px var(--gutter);
}
.auth-side .quote { font-family: var(--font-serif); font-size: 22px; line-height: 1.4; max-width: 30ch; }
.auth-main { flex: 1 1 55%; display: flex; align-items: center; justify-content: center; padding: 40px var(--gutter); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.auth-card h1 { font-size: 26px; }
.auth-card .switch { font-size: 14px; color: var(--muted); }
.auth-card .switch a { color: var(--accent-ink); font-weight: 600; text-decoration: underline; }
@media (max-width: 900px) { .auth-side { display: none; } }

/* =============================================================
   8. App shell (app.html, cuenta.html)
   ============================================================= */
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter); background: #fff; border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; z-index: 20;
}
.app-topbar .nav-brand { color: var(--ink); }
.app-topbar-right { display: flex; align-items: center; gap: 16px; }
.credits-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  background: var(--paper-alt); border-radius: 100px; font-weight: 600; font-size: 14px;
}
.credits-pill svg { color: var(--accent-ink); }
.account-menu { position: relative; }
.account-menu button { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.account-menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--card-border);
  border-radius: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.12); min-width: 160px; overflow: hidden; z-index: 30;
}
.account-menu-dropdown a, .account-menu-dropdown button {
  display: block; width: 100%; text-align: left; padding: 11px 16px; font-size: 14px;
}
.account-menu-dropdown a:hover, .account-menu-dropdown button:hover { background: var(--paper-alt); }

.app-shell { max-width: 900px; margin: 0 auto; padding: 40px var(--gutter) 90px; }
.app-header { display: flex; flex-direction: column; gap: 6px; margin-bottom: 28px; }
.app-header h1 { font-size: 26px; }
.app-header p { color: var(--muted); font-size: 14.5px; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 8px; }
.type-card {
  text-align: left; padding: 20px; border: 1.5px solid var(--card-border); border-radius: var(--radius);
  background: #fff; display: flex; flex-direction: column; gap: 8px; transition: border-color .2s var(--ease-out);
}
.type-card:hover { border-color: var(--accent); }
.type-card.is-selected { border-color: var(--accent); background: #fdf8ee; }
.type-card h3 { font-size: 15px; }
.type-card p { font-size: 12.8px; color: var(--muted); line-height: 1.5; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 20px; }
.form-grid .field.full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.cost-line { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--paper-alt); border-radius: 8px; font-size: 14.5px; margin-bottom: 18px; }
.cost-line strong { font-weight: 600; }

.clause { border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; background: #fff; }
.clause label { display: block; font-size: 13px; font-weight: 700; letter-spacing: .02em; margin-bottom: 8px; color: var(--ink); }
.clause textarea { width: 100%; border: 1px solid var(--card-border); border-radius: 7px; padding: 11px; font-size: 14.5px; line-height: 1.6; min-height: 90px; }

.legal-disclaimer {
  display: flex; gap: 12px; padding: 14px 18px; background: #fbf2de; border: 1px solid #e9d5a4;
  border-radius: 8px; font-size: 13.5px; color: #6b5218; line-height: 1.55; margin-bottom: 24px;
}

.state-box { text-align: center; padding: 60px 20px; color: var(--muted); }

/* =============================================================
   9. Cuenta page
   ============================================================= */
.cuenta-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; }
@media (max-width: 800px) { .cuenta-grid { grid-template-columns: 1fr; } }
.history-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--card-border); font-size: 14px; }
.history-row:last-child { border-bottom: 0; }
.history-row .meta { color: var(--muted-2); font-size: 12.5px; }
.history-amount.negative { color: var(--error); }
.history-amount.positive { color: var(--ok); }

/* =============================================================
   10. Checkout modal
   ============================================================= */
dialog#checkout-modal, dialog#type-picker-modal, dialog#confirm-modal {
  border: none; border-radius: 14px; padding: 0; max-width: 440px; width: 92vw;
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(15,27,45,.55); }
.modal-body { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.modal-body h2 { font-size: 20px; }
.fake-card { border: 1px solid var(--card-border); border-radius: 8px; padding: 14px; font-family: ui-monospace, monospace; font-size: 14px; color: var(--muted); background: var(--paper-alt); }

/* =============================================================
   11. Legal pages
   ============================================================= */
.legal-body { max-width: 760px; margin: 0 auto; padding: 60px var(--gutter) 100px; display: flex; flex-direction: column; gap: 18px; }
.legal-body h1 { font-size: 30px; }
.legal-body h2 { font-size: 19px; margin-top: 12px; }
.legal-body p, .legal-body li { color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.legal-body ul { padding-left: 20px; }

/* =============================================================
   12. Responsive
   ============================================================= */
@media (max-width: 960px) {
  .steps-grid, .docs-grid, .pricing-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .trust-layout > .trust-head { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .steps-grid, .docs-grid, .pricing-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; }
  .payment-row { flex-direction: column; gap: 18px; }
}
