/* ============================================================
   Sede IA Cotizador — Brand-aligned styles
   Palette: matte black + magenta-purple gradient + white
   ============================================================ */

:root {
  --bg: #08080f;
  --bg-card: #14141f;
  --bg-card-hover: #1a1a2a;
  --bg-input: #0d0d18;
  --border: #25253a;
  --border-strong: #34344e;
  --text: #ffffff;
  --text-dim: #b4b4c8;
  --text-muted: #6e6e80;
  --magenta: #ff2f8e;
  --purple: #7b3ff5;
  --gradient: linear-gradient(135deg, #ff2f8e 0%, #7b3ff5 100%);
  --gradient-soft: linear-gradient(135deg, rgba(255,47,142,0.15), rgba(123,63,245,0.15));
  --success: #2cd99b;
  --shadow-glow: 0 0 40px rgba(255, 47, 142, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Subtle radial gradient on body */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 47, 142, 0.08), transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(123, 63, 245, 0.08), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

main, section, header, footer { position: relative; z-index: 1; }

/* ============ HEADER ============ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 15, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 18px; letter-spacing: -0.5px; }
.brand-sede { color: var(--text); }
.brand-ia { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.brand-divider { color: var(--text-muted); margin: 0 4px; font-weight: 400; }
.brand-product { color: var(--text-dim); font-weight: 500; }
/* ─── Header nav: uniform pill-shaped items, vertically centered ─── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-nav > a,
.header-nav > button,
.header-nav > div {
  display: inline-flex;
  align-items: center;
  height: 36px;
  line-height: 1;
}
.header-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 0 14px;
  border-radius: 999px;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.header-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.header-nav a:active { transform: translateY(1px); }

/* ============ HERO ============ */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
  max-width: 900px;
  margin: 0 auto;
}
.hero-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 24px;
}
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 40px;
}
.hero-meta {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 32px;
}
.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.meta-item strong {
  font-size: 24px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.meta-item span {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============ APP ============ */
.app {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto 80px;
  padding: 0 24px;
}
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }

.form-card, .result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-glow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.card-header h2 { font-size: 22px; font-weight: 700; }

.quota-badge {
  background: var(--gradient-soft);
  border: 1px solid var(--border-strong);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.quota-divider { color: var(--text-muted); margin: 0 2px; }

/* ============ FORM ============ */
fieldset {
  border: none;
  margin-bottom: 28px;
}
fieldset legend {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.optional { color: var(--text-muted); font-weight: 400; font-style: italic; }
.field-hint { color: var(--text-muted); font-size: 12px; font-style: italic; margin-top: 6px; line-height: 1.45; }

input[type="text"], input[type="number"], input[type="email"], textarea, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(255, 47, 142, 0.15);
}
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%23b4b4c8' d='M6 9L1 4h10z'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.email-gate {
  background: var(--gradient-soft);
  border-radius: var(--radius-sm);
  padding: 20px;
  border: 1px solid var(--border-strong);
}
.email-gate legend {
  background: var(--bg-card);
  padding: 0 8px;
  margin-left: -8px;
}
.email-help { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }

/* ============ BUTTONS ============ */
.btn-primary, .btn-secondary, .btn-action {
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  font-size: 15px;
}
.btn-primary {
  background: var(--gradient);
  color: white;
  padding: 16px 24px;
  width: 100%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(255, 47, 142, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  padding: 10px 16px;
}
.btn-secondary:hover { color: var(--text); border-color: var(--magenta); }
.btn-action {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 10px 14px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-action:hover { color: var(--text); border-color: var(--magenta); background: var(--bg-card-hover); }
.btn-full { width: 100%; }
.form-disclaimer { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 12px; }
.btn-loading { display: inline-flex; align-items: center; gap: 8px; }
.btn-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ RESULT ============ */
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.result-content {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  white-space: pre-wrap;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text);
  max-height: 600px;
  overflow-y: auto;
}
.result-content h1, .result-content h2, .result-content h3 { color: var(--text); margin-top: 16px; margin-bottom: 8px; }
.result-content strong { color: var(--text); font-weight: 700; }
.result-content table { border-collapse: collapse; width: 100%; margin: 16px 0; }
.result-content td, .result-content th { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }

.result-upsell {
  margin-top: 24px;
  padding: 24px;
  background: var(--gradient-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  text-align: center;
}
.result-upsell h3 { margin-bottom: 8px; font-size: 18px; }
.result-upsell p { color: var(--text-dim); margin-bottom: 16px; }
.result-upsell a { display: inline-block; padding: 12px 28px; width: auto; }

/* ============ PRICING ============ */
.pricing {
  padding: 80px 24px;
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}
.pricing h2 { font-size: 36px; font-weight: 800; margin-bottom: 8px; letter-spacing: -1px; }
.pricing-sub { color: var(--text-dim); margin-bottom: 48px; font-size: 16px; }
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 800px; margin: 0 auto; }
@media (max-width: 700px) { .pricing-grid { grid-template-columns: 1fr; } }

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: left;
  position: relative;
}
.pricing-card-pro {
  border-color: var(--magenta);
  box-shadow: 0 0 60px rgba(255, 47, 142, 0.2);
  background: linear-gradient(180deg, rgba(255,47,142,0.05) 0%, var(--bg-card) 50%);
}
.pricing-badge {
  white-space: nowrap;
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gradient);
  color: white;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 6px 14px;
  border-radius: 999px;
}
.pricing-tier {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.pricing-price {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -2px;
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.pricing-price span { font-size: 16px; color: var(--text-muted); font-weight: 500; }
.price-old { font-size: 24px !important; color: var(--text-muted) !important; text-decoration: line-through; }
.price-new { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.pricing-note { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }
.pricing-note code { background: var(--bg-input); padding: 2px 8px; border-radius: 4px; font-size: 12px; color: var(--magenta); }
.pricing-features { list-style: none; margin-bottom: 28px; }
.pricing-features li { padding: 8px 0; color: var(--text-dim); font-size: 14px; }
.pricing-features li.muted { color: var(--text-muted); text-decoration: line-through; }
.pricing-features strong { color: var(--text); }

/* ============ HOW ============ */
.how {
  padding: 80px 24px;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}
.how h2 { font-size: 36px; font-weight: 800; margin-bottom: 48px; letter-spacing: -1px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 700px) { .how-grid { grid-template-columns: 1fr; } }
.how-step { padding: 32px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.how-num {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient);
  color: white;
  font-weight: 800;
  font-size: 20px;
  border-radius: 50%;
  margin: 0 auto 16px;
}
.how-step h3 { margin-bottom: 8px; font-size: 18px; }
.how-step p { color: var(--text-dim); font-size: 14px; }

/* ============ FAQ ============ */
.faq {
  padding: 80px 24px;
  max-width: 800px;
  margin: 0 auto;
}
.faq h2 { font-size: 36px; font-weight: 800; margin-bottom: 32px; text-align: center; letter-spacing: -1px; }
.faq details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.faq details:hover { border-color: var(--border-strong); }
.faq details[open] { border-color: var(--magenta); }
.faq summary {
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--magenta); font-size: 20px; font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--text-dim); margin-top: 12px; font-size: 14px; }

/* ============ FOOTER ============ */
.site-footer {
  padding: 60px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-brand {
  font-weight: 800;
  font-size: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.site-footer p {
  color: var(--text-dim);
  margin-bottom: 24px;
}
.footer-links {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--magenta); }
.footer-fine {
  color: var(--text-muted);
  font-size: 12px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--success);
  color: var(--text);
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  transition: transform 0.3s ease-out;
  z-index: 1000;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--magenta); }

/* ============ AUTH UI ============ */
.nav-auth-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.nav-auth-btn:hover {
  border-color: var(--magenta);
  color: var(--magenta);
  background: rgba(255, 47, 142, 0.08);
}
.user-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  background: var(--gradient);
  color: white;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-right: 6px;
}
.nav-link-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0 12px;
  border-radius: 999px;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}
.nav-link-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
#userMenu { display: flex; align-items: center; gap: 4px; height: 36px; }

.link-btn { background: transparent; border: none; color: var(--magenta); font-family: inherit; font-size: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-decoration-color: rgba(255,47,142,0.4); }
.link-btn:hover { text-decoration-color: var(--magenta); }

/* Auth modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none !important; }
[hidden] { display: none !important; }
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), var(--shadow-glow);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--bg-input); color: var(--text); }

/* Pro tier state */
body.pro .quota-badge { background: var(--gradient); color: white; border-color: transparent; }
body.pro .quota-badge::before { content: "PRO · "; font-weight: 800; }
body.pro .quota-badge .quota-divider, body.pro .quota-badge span:not(.quota-divider) { display: none; }
body.pro .quota-badge::after { content: "Ilimitadas"; }
body.pro .result-upsell { display: none !important; }

/* ===== Bundle pricing card (3rd tier) ===== */
.pricing-grid {
  grid-template-columns: repeat(3, 1fr) !important;
  max-width: 1100px !important;
}
@media (max-width: 900px) {
  .pricing-grid { grid-template-columns: 1fr !important; max-width: 480px !important; }
}
.pricing-card-bundle {
  border-color: #7c3aed;
  box-shadow: 0 0 60px rgba(124, 58, 237, 0.25);
  background: linear-gradient(180deg, rgba(124,58,237,0.06) 0%, rgba(34,211,238,0.03) 50%, var(--bg-card) 100%);
}
.pricing-card-bundle .price-new {
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   MODE SELECTOR (v2 — 4-mode form)
   ============================================================ */
.mode-selector legend {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
@media (min-width: 900px) {
  .mode-grid { grid-template-columns: repeat(4, 1fr); }
}
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 14px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.mode-card:hover {
  border-color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
}
.mode-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.mode-card:has(input[type="radio"]:checked) {
  border-color: var(--magenta);
  background: linear-gradient(180deg, rgba(255,47,142,0.10) 0%, var(--bg-input) 100%);
  box-shadow: 0 0 24px rgba(255, 47, 142, 0.15);
}
.mode-card:has(input[type="radio"]:checked) .mode-title {
  color: var(--text);
}
.mode-icon {
  font-size: 22px;
  line-height: 1;
}
.mode-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
}
.mode-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}



/* ============================================================
   CROSS-NAV pill in header (sibling tool link)
   ============================================================ */
.nav-sibling {
  background: linear-gradient(135deg, rgba(255,47,142,0.12), rgba(124,58,237,0.12));
  border: 1px solid rgba(255,47,142,0.35);
  color: var(--text) !important;
  padding: 0 16px !important;
  border-radius: 999px;
  font-weight: 700 !important;
  font-size: 13px;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.nav-sibling:hover {
  background: linear-gradient(135deg, rgba(255,47,142,0.28), rgba(124,58,237,0.28)) !important;
  border-color: rgba(255,47,142,0.7);
  transform: translateY(-1px);
}

/* ============================================================
   CROSS-PROMO — full-section bottom strip (matches .pricing pattern)
   ============================================================ */
.cross-promo {
  padding: 80px 24px;
  text-align: center;
  background: radial-gradient(ellipse at center top, rgba(255,47,142,0.06), transparent 60%),
              radial-gradient(ellipse at center bottom, rgba(124,58,237,0.06), transparent 60%);
  border-top: 0.5px solid var(--border);
}
.cross-promo-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.cross-promo-kicker {
  font-size: 12px;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 14px;
}
.cross-promo-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.05;
  margin-bottom: 16px;
  color: var(--text);
}
.grad-factura {
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.grad-cotizador {
  background: linear-gradient(135deg, #ff2f8e, #ff8c58);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cross-promo-desc {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0 auto 28px;
  max-width: 520px;
}
.cross-promo-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff2f8e, #7c3aed);
  color: #fff !important;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 12px 28px rgba(255,47,142,0.25);
}
.cross-promo-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(255,47,142,0.4);
}
.cross-promo-bundle {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-dim);
}
.cross-promo-bundle a {
  color: var(--magenta);
  font-weight: 700;
  text-decoration: none;
}
.cross-promo-bundle a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .cross-promo { padding: 56px 20px; }
  .cross-promo-kicker { font-size: 11px; letter-spacing: 2px; }
  .cross-promo-title { font-size: 28px; letter-spacing: -0.5px; }
  .cross-promo-desc { font-size: 15px; margin-bottom: 22px; }
  .cross-promo-btn { padding: 13px 22px; font-size: 14px; }
  .nav-sibling { font-size: 12px; padding: 5px 10px !important; }
}

/* ============================================================
   MOBILE HEADER + GLOBAL OVERFLOW FIX
   ============================================================ */
html, body { overflow-x: clip; max-width: 100%; }

@media (max-width: 720px) {
  /* Compact header — smaller padding, tighter gap */
  .site-header {
    padding: 12px 16px;
    gap: 10px;
    flex-wrap: nowrap;
    min-height: 56px;
  }
  /* Compact brand — keep SEDE IA prominent, dim the product label */
  .brand { font-size: 15px; gap: 4px; flex-shrink: 0; }
  .brand-divider { margin: 0 2px; }
  .brand-product { font-size: 13px; }

  /* Tighter nav */
  .header-nav {
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
  }
  .header-nav > a,
  .header-nav > button,
  .header-nav > div { height: 32px !important; }
  .header-nav a {
    font-size: 12px;
    white-space: nowrap;
    padding: 0 10px !important;
  }
  /* Hide low-priority nav items on tight phones */
  .header-nav a[href*="/guia"],
  .header-nav a[href*="#precios"] {
    display: none;
  }
  /* Keep sibling pill compact */
  .nav-sibling {
    font-size: 11px !important;
    padding: 0 12px !important;
  }

  /* Auth button compact */
  .nav-auth-btn {
    padding: 0 12px !important;
    font-size: 12px !important;
  }
  #userMenu {
    gap: 4px !important;
    font-size: 12px !important;
    height: 32px !important;
  }
  .user-badge { font-size: 10px !important; padding: 0 8px !important; height: 20px !important; }
  .nav-link-btn { font-size: 11px !important; padding: 0 8px !important; }
  .lang-toggle { font-size: 11px !important; padding: 0 10px !important; height: 32px !important; }
}

/* Tiny phones (≤400px) — drop "Precios" too if anything overlaps, hide product label */
@media (max-width: 400px) {
  .brand-product, .brand-divider { display: none; }
  .brand { font-size: 14px; }
  .nav-sibling { font-size: 10.5px !important; padding: 0 10px !important; }
}

/* HERO mobile tightening */
@media (max-width: 720px) {
  .hero { padding: 36px 18px 28px; }
  .hero h1 { font-size: 32px; line-height: 1.05; letter-spacing: -1px; }
  .hero-sub { font-size: 15px; }
  .hero-eyebrow { font-size: 10px; letter-spacing: 1.5px; }
  .hero-meta { gap: 14px; margin-top: 24px; }
  .hero-meta strong { font-size: 18px; }
}

/* ============================================================
   CENTER THE FORM when no result is showing yet
   (was left-aligned because grid was 1fr 1fr with empty right column)
   ============================================================ */
.app:has(.result-card[hidden]) {
  grid-template-columns: 1fr;
  max-width: 720px;
}

/* Fallback for browsers without :has() — JS toggles .app--solo via app.js below */
.app.app--solo {
  grid-template-columns: 1fr;
  max-width: 720px;
}

/* ============================================================
   MOBILE OVERFLOW HARDFIX — prevent form/result cards from
   bleeding past viewport on iPhone widths
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; max-width: 100vw; }

@media (max-width: 720px) {
  /* App container */
  .app {
    padding: 0 12px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
  }

  /* Form + result cards */
  .form-card, .result-card {
    padding: 20px 16px;
    max-width: 100%;
    width: 100%;
    margin-bottom: 16px;
  }

  /* Card headers — wrap and tighten */
  .card-header {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
  }
  .card-header h2 { font-size: 18px; }
  .quota-badge { font-size: 11px; padding: 6px 10px; }

  /* Result content — make long underscores/text wrap */
  .result-content {
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 13.5px;
    line-height: 1.5;
    max-width: 100%;
    padding: 16px 14px;
  }

  /* Result action buttons — wrap to 2-per-row */
  .result-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .btn-action {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 13px;
    padding: 10px 12px;
    white-space: nowrap;
  }

  /* Mode selector — single column on tight phones, smaller copy */
  .mode-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .mode-card {
    padding: 12px 10px 12px;
    min-width: 0;
  }
  .mode-icon { font-size: 18px; }
  .mode-title { font-size: 12.5px; line-height: 1.25; }
  .mode-sub { font-size: 10.5px; line-height: 1.3; }

  /* Fieldsets + form fields — tight on mobile */
  fieldset { padding: 16px 14px; margin-bottom: 14px; }
  legend { font-size: 11px; padding: 0 6px; }
  .field input, .field select, .field textarea {
    font-size: 16px;  /* prevent iOS zoom */
    padding: 11px 12px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .field label { font-size: 13px; }
  .field-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Pricing cards already responsive */
  .pricing { padding: 48px 14px; }
  .pricing-card { padding: 28px 22px; }
  .pricing-price { font-size: 38px; }

  /* Upsell card */
  .result-upsell { padding: 20px 16px; }
  .result-upsell h3 { font-size: 18px; }
  .result-upsell p { font-size: 14px; }

  /* Toast */
  .toast { max-width: calc(100vw - 32px); font-size: 13px; }

  /* Modal — keep contained */
  .modal-card { max-width: calc(100vw - 32px); padding: 28px 20px; }
}

/* Extra tight for tiny phones */
@media (max-width: 380px) {
  .mode-grid { grid-template-columns: 1fr; }  /* Stack 4 cards vertically */
  .btn-action { flex: 1 1 100%; }              /* Stack action buttons too */
}

/* ============================================================
   PRO FEATURES UI — logo upload, saved clients, lang toggle, etc.
   Visible only when body has .pro class (set by render() in app.js)
   ============================================================ */
/* Hide .pro-only when NOT pro; when pro, element uses its natural display */
body:not(.pro) .pro-only { display: none !important; }
body.pro button.pro-only, body.pro span.pro-only, body.pro a.pro-only { display: inline-flex; }
body.pro .btn-action.pro-only { display: inline-flex; }
/* respect hidden attr */
.pro-section {
  border-color: rgba(255,47,142,0.3) !important;
  background: linear-gradient(135deg, rgba(255,47,142,0.04), rgba(124,58,237,0.04)) !important;
}
.pro-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ff2f8e, #7c3aed);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 1px;
  margin-left: 6px;
  vertical-align: middle;
}
.pro-help {
  color: var(--text-dim);
  font-size: 13px;
  margin: 4px 0 14px;
  line-height: 1.5;
}

/* Language toggle in header */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  height: 36px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.2s ease;
}
.lang-toggle:hover { background: rgba(255,255,255,0.12); }

/* Logo upload */
.logo-upload-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
.logo-preview {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
}
.logo-preview img {
  max-width: 100px;
  max-height: 60px;
  border-radius: 6px;
  background: white;
  padding: 4px;
}
.logo-remove {
  background: rgba(255,47,142,0.15);
  border: 0;
  color: var(--magenta);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo-remove:hover { background: var(--magenta); color: var(--text); }
.logo-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s ease;
}
.logo-upload-btn:hover {
  border-color: var(--magenta);
  background: rgba(255,47,142,0.06);
}

/* Saved clients dropdown gets standard field styling */

/* Result actions — wrap nicely with Pro buttons */
.result-actions { flex-wrap: wrap; gap: 8px; }
.btn-action.pro-only {
  border-color: rgba(255,47,142,0.4);
  background: linear-gradient(135deg, rgba(255,47,142,0.08), rgba(124,58,237,0.08));
}
.btn-action.pro-only:hover {
  border-color: var(--magenta);
  background: linear-gradient(135deg, rgba(255,47,142,0.18), rgba(124,58,237,0.18));
}

@media (max-width: 720px) {
  .lang-toggle { font-size: 11px; padding: 0 10px !important; height: 32px !important; }
  .logo-preview img { max-width: 80px; max-height: 48px; }
  .logo-upload-btn { padding: 10px 14px; font-size: 13px; }
  .pro-badge { font-size: 9px; padding: 2px 6px; }
}

/* ============================================================
   FORM VALIDATION — red highlight + shake on invalid required fields
   ============================================================ */
.field-invalid,
input.field-invalid,
select.field-invalid,
textarea.field-invalid {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18) !important;
  animation: field-shake 0.35s ease;
}
.field-invalid:focus,
input.field-invalid:focus,
select.field-invalid:focus,
textarea.field-invalid:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.28) !important;
}
@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* Toast: keep error toasts visible longer than success */
.toast.error {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
}

/* ============================================================
   GLOBAL TEXT-WRAP for AI output — prevents long ===== / _____ strings
   from blowing out card width on desktop AND mobile
   ============================================================ */
.result-content,
.result-content * {
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  max-width: 100%;
}
.result-content {
  white-space: pre-wrap;
  font-family: 'Courier New', Menlo, Monaco, monospace;
  font-size: 13px;
  line-height: 1.55;
  padding: 18px 16px;
  background: rgba(0,0,0,0.18);
  border-radius: 10px;
  border: 1px solid var(--border);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.result-content[contenteditable="true"]:focus,
.result-content[contenteditable="true"]:hover {
  border-color: #ff2f8e;
  box-shadow: 0 0 0 3px rgba(255, 47, 142, 0.12);
  cursor: text;
}
.edit-hint {
  margin: 14px 0 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(255, 47, 142, 0.10), rgba(120, 80, 255, 0.10));
  border: 1px solid rgba(255, 47, 142, 0.25);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.edit-hint strong { color: var(--text); font-weight: 700; }

/* ============================================================
   MENSAJES IA — 3 reply cards grid
   ============================================================ */
.replies-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}
.reply-card {
  background: rgba(255, 47, 142, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.reply-card:hover {
  border-color: rgba(255, 47, 142, 0.45);
  background: rgba(255, 47, 142, 0.06);
}
.reply-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.reply-tono {
  font-size: 13px;
  font-weight: 700;
  color: #ff2f8e;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.reply-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 999px;
}
.reply-text {
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  white-space: pre-wrap;
  outline: none;
  min-height: 80px;
  transition: border-color 0.15s, background 0.15s;
}
.reply-text:hover,
.reply-text:focus {
  border-color: rgba(255, 47, 142, 0.4);
  background: rgba(0, 0, 0, 0.22);
  cursor: text;
}
.reply-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.reply-actions .btn-action {
  flex: 1;
  min-height: 36px;
  font-size: 13px;
}

@media (max-width: 720px) {
  .reply-card { padding: 12px 14px; }
  .reply-text { font-size: 14px; padding: 10px 12px; }
  .reply-actions .btn-action { font-size: 12px; min-height: 34px; }
}

/* Make the .app grid breathe better on desktop — but ONLY when the
   result card is visible. When hidden, fall back to single-column +
   centered (handled by .app:has(.result-card[hidden]) and .app--solo). */
@media (min-width: 901px) {
  .app:not(:has(.result-card[hidden])):not(.app--solo) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
  }
  .form-card, .result-card {
    min-width: 0;  /* let grid cells shrink instead of overflowing */
  }
  /* Solo mode (no result yet): single column, comfortable max width */
  .app:has(.result-card[hidden]),
  .app.app--solo {
    grid-template-columns: 1fr;
    max-width: 720px;
  }
}
