/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  rgba(37,99,235,0.09);
  --primary-glow:   rgba(37,99,235,0.22);
  --secondary:      #059669;
  --secondary-dark: #047857;
  --secondary-light:rgba(5,150,105,0.09);
  --accent:         #d97706;
  --accent-light:   rgba(217,119,6,0.1);
  --danger:         #dc2626;
  --danger-light:   rgba(220,38,38,0.09);
  --purple:         #7c3aed;
  --purple-light:   rgba(124,58,237,0.09);
  --teal:           #0891b2;
  --teal-light:     rgba(8,145,178,0.09);

  --bg:        #f0f4fb;
  --surface:   #ffffff;
  --surface-2: #f6f9ff;
  --border:    #dde5f4;
  --border-focus: #2563eb;

  --text:           #0b1829;
  --text-secondary: #3d5577;
  --text-muted:     #7a93b8;

  --shadow-xs: 0 1px 2px rgba(10,25,60,0.06);
  --shadow-sm: 0 2px 6px rgba(10,25,60,0.08), 0 1px 2px rgba(10,25,60,0.04);
  --shadow:    0 4px 16px rgba(10,25,60,0.09), 0 2px 6px rgba(10,25,60,0.05);
  --shadow-md: 0 10px 30px rgba(10,25,60,0.11), 0 4px 10px rgba(10,25,60,0.06);
  --shadow-lg: 0 24px 56px rgba(10,25,60,0.13), 0 8px 20px rgba(10,25,60,0.07);
  --shadow-colored: 0 6px 20px rgba(37,99,235,0.22);

  --gradient-hero:   linear-gradient(140deg, #0b1c55 0%, #1a3fb5 42%, #0b6ea5 75%, #0b8a7a 100%);
  --gradient-card:   linear-gradient(160deg, #fff 0%, #f6f9ff 100%);
  --gradient-result: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #0878b0 100%);

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius:    13px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --ease: cubic-bezier(0.4,0,0.2,1);
  --transition: 0.18s var(--ease);
  --header-h: 60px;
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --bg:        #060f1c;
  --surface:   #0c1d2e;
  --surface-2: #112538;
  --border:    #1b3450;
  --border-focus: #4da3ff;

  --text:           #ddeeff;
  --text-secondary: #7aaec8;
  --text-muted:     #3a5f7a;

  --primary:        #4da3ff;
  --primary-dark:   #2563eb;
  --primary-light:  rgba(77,163,255,0.11);
  --primary-glow:   rgba(77,163,255,0.24);
  --secondary:      #34d399;
  --secondary-dark: #10b981;
  --secondary-light:rgba(52,211,153,0.11);
  --accent:         #fbbf24;
  --accent-light:   rgba(251,191,36,0.11);
  --danger:         #f87171;
  --danger-light:   rgba(248,113,113,0.11);
  --purple:         #a78bfa;
  --purple-light:   rgba(167,139,250,0.11);
  --teal:           #22d3ee;
  --teal-light:     rgba(34,211,238,0.11);

  --shadow-xs: 0 1px 3px rgba(0,0,0,0.45);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.5),  0 1px 3px rgba(0,0,0,0.3);
  --shadow:    0 4px 18px rgba(0,0,0,0.55), 0 2px 6px rgba(0,0,0,0.35);
  --shadow-md: 0 10px 36px rgba(0,0,0,0.62),0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 64px rgba(0,0,0,0.7), 0 8px 24px rgba(0,0,0,0.5);
  --shadow-colored: 0 6px 22px rgba(77,163,255,0.22);

  --gradient-card:   linear-gradient(160deg, #0c1d2e 0%, #112538 100%);
  --gradient-result: linear-gradient(135deg, #0c1f4a 0%, #163880 50%, #0b4a7a 100%);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.62;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
ul { list-style: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 22px; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 4px 20px rgba(10,25,60,0.06);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.site-header::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--primary) 30%,
    #0891b2 70%,
    transparent 100%
  );
  opacity: 0.55;
  pointer-events: none;
}
[data-theme="dark"] .site-header {
  background: rgba(8, 20, 40, 0.97);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 4px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .site-header::after {
  background: linear-gradient(90deg,
    transparent 0%,
    #4da3ff 30%,
    #22d3ee 70%,
    transparent 100%
  );
  opacity: 0.4;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
}
.header-sep {
  width: 1px; height: 22px;
  background: var(--border);
  margin: 0 16px;
  flex-shrink: 0;
}

/* ── LOGO ── */
.logo {
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo svg {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.logo:hover svg {
  transform: scale(1.07);
  box-shadow: 0 3px 10px rgba(0,0,0,0.22);
}
[data-theme="dark"] .logo svg {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 2px 8px rgba(0,0,0,0.5);
}
.logo-text { display: flex; align-items: baseline; line-height: 1; }
.logo-brand {
  font-weight: 800; font-size: 1rem;
  color: var(--text); letter-spacing: -0.04em;
}
.logo-tld {
  font-weight: 700; font-size: 1rem;
  color: var(--primary); letter-spacing: -0.04em;
}

/* ── NAV ── */
.site-header nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 100%;
}
.site-header nav > a {
  display: flex; align-items: center;
  height: 100%;
  padding: 0 13px;
  font-size: 0.845rem; font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.site-header nav > a:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-bottom-color: var(--primary);
  text-decoration: none;
}
.site-header nav > a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  margin-left: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px;
  color: var(--text-secondary);
  display: flex; align-items: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
[data-theme="light"] .icon-moon,
[data-theme="dark"]  .icon-sun  { display: none; }

/* Sub-nav de calculadoras (oculta: la cabecera ya incluye todos los enlaces) */
.calc-subnav { display: none; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: var(--gradient-hero);
  color: white;
  padding: 72px 0 80px;
  position: relative;
  overflow: hidden;
}
/* Dot grid pattern */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.09) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  opacity: 0.5;
}
.hero .container { position: relative; z-index: 2; }
.hero-content { max-width: 680px; }

/* ── Glowing orbs ── */
.hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(70px);
  z-index: 0;
}
.hero-orb-1 {
  width: 520px; height: 520px;
  top: -160px; right: -80px;
  background: radial-gradient(circle, rgba(56,130,255,0.38) 0%, rgba(37,99,235,0.12) 50%, transparent 70%);
  animation: float-slow 11s ease-in-out infinite;
}
.hero-orb-2 {
  width: 380px; height: 380px;
  bottom: 0; left: -60px;
  background: radial-gradient(circle, rgba(8,145,178,0.32) 0%, rgba(5,150,105,0.1) 55%, transparent 70%);
  animation: float-slow 14s ease-in-out infinite reverse;
}
.hero-orb-3 {
  width: 280px; height: 280px;
  top: 35%; right: 22%;
  background: radial-gradient(circle, rgba(124,58,237,0.22) 0%, transparent 68%);
  animation: float-slow 9s ease-in-out infinite 2s;
}

/* ── Pill badge ── */
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 99px;
  padding: 5px 16px 5px 10px;
  font-size: 0.775rem; font-weight: 700;
  color: rgba(255,255,255,0.85);
  margin-bottom: 22px;
  letter-spacing: 0.04em; text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.hero-pill-dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52,211,153,0.28);
  flex-shrink: 0;
  animation: pulse-glow 2.5s ease-in-out infinite;
}

/* ── H1 ── */
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 900; line-height: 1.15;
  margin-bottom: 18px; color: white;
  letter-spacing: -0.03em;
}
.hero-em {
  font-style: normal;
  background: linear-gradient(120deg, #93c5fd 0%, #6ee7b7 55%, #fcd34d 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 8s ease infinite;
}
.hero-br { display: block; }

/* ── Subtitle ── */
.hero-subtitle {
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  color: rgba(255,255,255,0.72);
  max-width: 560px; margin-bottom: 36px; line-height: 1.65;
}

/* ── Stats ── */
.hero-stats {
  display: flex; gap: 0; flex-wrap: wrap;
  margin-bottom: 36px; align-items: center;
}
.hero-stat { display: flex; flex-direction: column; gap: 2px; padding: 0 28px 0 0; }
.hero-stat:first-child { padding-left: 0; }
.stat-number { font-size: 1.9rem; font-weight: 900; color: white; line-height: 1; letter-spacing: -0.04em; }
.stat-label  { font-size: 0.7rem; color: rgba(255,255,255,0.52); text-transform: uppercase; letter-spacing: 0.09em; font-weight: 600; }
.hero-stat-divider {
  width: 1px; height: 36px;
  background: rgba(255,255,255,0.15);
  margin: 0 28px 0 0; flex-shrink: 0;
  align-self: center;
}

/* ── Hero actions ── */
.hero-actions {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.hero-cta {
  padding: 13px 30px; font-size: 0.95rem;
  border-radius: var(--radius); font-weight: 800;
  box-shadow: 0 6px 28px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.16);
  letter-spacing: -0.01em;
}
.hero-btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 13px 22px; border-radius: var(--radius);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.82);
  font-size: 0.9rem; font-weight: 600;
  transition: all var(--transition);
  backdrop-filter: blur(8px);
  text-decoration: none;
}
.hero-btn-ghost:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.35);
  color: white; text-decoration: none;
}

/* ── Bottom wave ── */
.hero-wave {
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 64px; pointer-events: none; z-index: 1;
}
.hero-wave svg { width: 100%; height: 100%; display: block; }

/* Offset de scroll para compensar el header sticky */
[id] { scroll-margin-top: var(--header-h); }

.breadcrumb { margin-bottom: 18px; }
.breadcrumb ol { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.breadcrumb li { font-size: 0.8rem; color: rgba(255,255,255,0.56); }
.breadcrumb li::after { content: "›"; margin-left: 6px; }
.breadcrumb li:last-child::after { display: none; }
.breadcrumb a { color: rgba(255,255,255,0.72); transition: color var(--transition); }
.breadcrumb a:hover { color: white; text-decoration: none; }

.hero h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  font-weight: 900; line-height: 1.2;
  margin-bottom: 14px; color: white;
  letter-spacing: -0.025em;
}
.hero-subtitle {
  font-size: clamp(0.92rem, 1.7vw, 1.05rem);
  color: rgba(255,255,255,0.78);
  max-width: 620px; margin-bottom: 32px; line-height: 1.6;
}
.hero-stats { display: flex; gap: 36px; flex-wrap: wrap; }
.hero-stat { display: flex; flex-direction: column; gap: 1px; }
/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 60px 0; }
.section-header { text-align: center; margin-bottom: 40px; }
.section-header h2 {
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
  font-weight: 900; margin-bottom: 8px;
  letter-spacing: -0.025em;
}
.section-header p { color: var(--text-secondary); font-size: 1rem; }

/* ============================================================
   CALCULATOR SECTION — fluid bg
   ============================================================ */
.calculator-section {
  background:
    radial-gradient(ellipse 55% 60% at 96% 8%,  rgba(37,99,235,0.05)  0%, transparent 100%),
    radial-gradient(ellipse 45% 50% at 4%  92%,  rgba(5,150,105,0.04)  0%, transparent 100%),
    var(--bg);
}
[data-theme="dark"] .calculator-section {
  background:
    radial-gradient(ellipse 55% 60% at 96% 8%,  rgba(77,163,255,0.05) 0%, transparent 100%),
    radial-gradient(ellipse 45% 50% at 4%  92%,  rgba(52,211,153,0.04) 0%, transparent 100%),
    var(--bg);
}

/* MODE TABS */
.mode-tabs {
  display: flex; gap: 3px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--radius);
  padding: 4px; margin-bottom: 22px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .mode-tabs { background: var(--surface-2); }
.tab-btn {
  flex: 1; min-width: 110px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 14px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  font-size: 0.83rem; font-weight: 600;
  transition: all var(--transition); white-space: nowrap;
}
.tab-btn:hover { background: var(--primary-light); color: var(--primary); }
.tab-btn.active {
  background: var(--primary); color: white;
  box-shadow: var(--shadow-colored);
  font-weight: 700;
}

/* CALCULATOR LAYOUT */
.calculator-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 22px; align-items: start;
}

/* FORM PANEL */
.form-panel {
  background: var(--gradient-card);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  padding: 26px; box-shadow: var(--shadow-md);
}
[data-theme="dark"] .form-panel { box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.03); }

.mode-desc {
  background: var(--primary-light); color: var(--primary);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 0.835rem; margin-bottom: 18px;
  border-left: 3px solid var(--primary); line-height: 1.45;
}

/* FIELD GROUP */
.field-group { margin-bottom: 20px; }
.field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.835rem; font-weight: 700; color: var(--text);
  margin-bottom: 7px; letter-spacing: -0.005em;
}
.input-row { display: flex; gap: 7px; align-items: center; }
.input-with-prefix, .input-with-suffix {
  display: flex; align-items: center; flex: 1;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-with-prefix:focus-within,
.input-with-suffix:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
[data-theme="dark"] .input-with-prefix,
[data-theme="dark"] .input-with-suffix { background: var(--surface-2); }
.input-prefix, .input-suffix {
  padding: 0 10px; background: var(--surface-2);
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 700;
  height: 40px; display: flex; align-items: center; user-select: none;
  border-right: 1px solid var(--border); flex-shrink: 0;
}
[data-theme="dark"] .input-prefix,
[data-theme="dark"] .input-suffix { background: rgba(255,255,255,0.04); border-color: var(--border); }
.input-suffix { border-right: none; border-left: 1px solid var(--border); }
.input-with-prefix input,
.input-with-suffix input {
  border: none; outline: none; background: transparent;
  padding: 8px 11px; font-size: 0.875rem; font-weight: 700;
  color: var(--text); width: 100%; height: 40px; font-family: inherit;
}
/* Ocultar spinners nativos del input number (se usan sliders en su lugar) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }
.select-input {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background-color: var(--surface); color: var(--text);
  padding: 0 34px 0 11px; height: 40px; font-size: 0.835rem; font-weight: 600;
  font-family: inherit; cursor: pointer; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.select-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }
[data-theme="dark"] .select-input {
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4 4 4-4'/%3E%3C/svg%3E");
}

/* SLIDERS */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--border); border-radius: 99px;
  outline: none; margin: 9px 0 4px; cursor: pointer;
}
[data-theme="dark"] .slider { background: var(--border); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary);
  border: 2.5px solid white;
  box-shadow: 0 2px 8px var(--primary-glow);
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
[data-theme="dark"] .slider::-webkit-slider-thumb { border-color: var(--surface); }
.slider::-webkit-slider-thumb:hover { transform: scale(1.18); box-shadow: 0 3px 14px var(--primary-glow); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); border: 2.5px solid white;
  box-shadow: 0 2px 8px var(--primary-glow); cursor: pointer;
}
.slider-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* TOOLTIP */
.tooltip-btn {
  background: none; border: none; color: var(--text-muted); padding: 0;
  position: relative; display: inline-flex; align-items: center;
  transition: color var(--transition);
}
.tooltip-btn:hover { color: var(--primary); }
.tooltip-text {
  display: none; position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: calc(100% + 10px);
  background: var(--text); color: var(--surface);
  font-size: 0.76rem; font-weight: 400; border-radius: var(--radius-sm);
  padding: 10px 13px; width: 226px; text-align: left;
  z-index: 60; box-shadow: var(--shadow-md); line-height: 1.45;
}
.tooltip-text::after {
  content: ""; position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--text);
}
.tooltip-btn:hover .tooltip-text,
.tooltip-btn:focus .tooltip-text { display: block; }

/* RADIO */
.radio-group { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 6px; font-size: 0.845rem; color: var(--text-secondary); cursor: pointer; }
.radio-label input[type="radio"] { accent-color: var(--primary); width: 15px; height: 15px; }

/* ADVANCED TOGGLE */
.advanced-toggle button {
  display: flex; align-items: center; gap: 7px;
  background: none; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px;
  color: var(--text-secondary); font-size: 0.835rem; font-weight: 600;
  width: 100%; transition: all var(--transition);
}
.advanced-toggle button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.chevron { margin-left: auto; transition: transform 0.22s; }
.advanced-fields { overflow: hidden; max-height: 0; transition: max-height 0.38s var(--ease); }
.advanced-fields.open { max-height: 900px; margin-top: 16px; }

/* FORM ACTIONS */
.form-actions {
  display: flex; gap: 7px; flex-wrap: wrap;
  padding-top: 16px; margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 0.845rem; font-weight: 700; border: none;
  transition: all var(--transition); text-decoration: none;
  white-space: nowrap; letter-spacing: -0.005em; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-colored); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 8px 24px var(--primary-glow); }
.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white; box-shadow: 0 4px 14px rgba(5,150,105,0.28);
}
.btn-secondary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(5,150,105,0.32); }
.btn-ghost { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-sm { padding: 6px 13px; font-size: 0.775rem; border-radius: var(--radius-xs); }

/* ============================================================
   RESULTS PANEL
   ============================================================ */
.results-panel {
  background: var(--gradient-card);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  padding: 26px; box-shadow: var(--shadow-md);
}

/* MAIN RESULT — full gradient card */
.result-main {
  text-align: center; padding: 30px 22px;
  background: var(--gradient-result);
  border-radius: var(--radius); margin-bottom: 22px;
  position: relative; overflow: hidden;
  box-shadow: 0 8px 28px rgba(37,99,235,0.28);
}
[data-theme="dark"] .result-main { box-shadow: 0 8px 30px rgba(13,40,110,0.7), inset 0 1px 0 rgba(255,255,255,0.06); }
.result-main::before {
  content: ""; position: absolute;
  top: -50%; right: -15%; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(255,255,255,0.05); pointer-events: none;
}
.result-label { font-size: 0.75rem; font-weight: 700; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; }
.result-value { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 900; color: white; line-height: 1; margin-bottom: 10px; letter-spacing: -0.025em; }
.result-sublabel { font-size: 0.74rem; color: rgba(255,255,255,0.5); }

/* RESULT GRID */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.result-card {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); border-left: 3px solid var(--border);
  padding: 12px; transition: all var(--transition); position: relative;
}
[data-theme="dark"] .result-card { background: var(--surface-2); }
.result-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
#cardContributed { border-left-color: var(--primary); }
#cardInterest    { border-left-color: var(--secondary); }
#cardInflation   { border-left-color: var(--accent); }
#cardTax         { border-left-color: var(--danger); }
#cardCommission  { border-left-color: var(--purple); }
#cardAfterTax    { border-left-color: var(--teal); }

.card-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card-icon--blue   { background: var(--primary-light);   color: var(--primary); }
.card-icon--green  { background: var(--secondary-light); color: var(--secondary); }
.card-icon--amber  { background: var(--accent-light);    color: var(--accent); }
.card-icon--red    { background: var(--danger-light);    color: var(--danger); }
.card-icon--purple { background: var(--purple-light);    color: var(--purple); }
.card-icon--teal   { background: var(--teal-light);      color: var(--teal); }
.card-content { min-width: 0; }
.card-label { font-size: 0.68rem; color: var(--text-secondary); margin-bottom: 2px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.card-value { font-size: 0.9rem; font-weight: 800; color: var(--text); }

/* RATIO BAR */
.ratio-bar-container { margin-bottom: 14px; }
.ratio-label { display: flex; justify-content: space-between; font-size: 0.77rem; margin-bottom: 6px; }
.ratio-contrib  { color: var(--primary);   font-weight: 700; }
.ratio-interest { color: var(--secondary); font-weight: 700; }
.ratio-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--border); }
.ratio-bar-contrib  { background: linear-gradient(90deg, var(--primary), #3b82f6); transition: width 0.55s var(--ease); }
.ratio-bar-interest { background: linear-gradient(90deg, var(--secondary), #34d399); flex: 1; }
.ratio-pct { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.dot--blue  { background: var(--primary); }
.dot--green { background: var(--secondary); }

.microcopy {
  font-size: 0.8rem; color: var(--text-secondary);
  font-style: italic; margin-bottom: 14px;
  padding: 10px 13px; background: var(--surface-2);
  border-radius: var(--radius-sm); border-left: 3px solid var(--secondary);
  line-height: 1.45;
}
[data-theme="dark"] .microcopy { background: rgba(255,255,255,0.03); }
.export-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* SAVED SIMULATIONS */
.saved-section {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 22px; margin-top: 18px;
  box-shadow: var(--shadow);
}
.saved-section h3 { font-size: 0.95rem; font-weight: 800; margin-bottom: 14px; }
.saved-list { display: flex; gap: 10px; flex-wrap: wrap; }
.saved-item {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 0.835rem; display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: all var(--transition);
}
.saved-item:hover { border-color: var(--primary); box-shadow: var(--shadow-colored); transform: translateY(-1px); }
.saved-item-name   { font-weight: 700; color: var(--text); }
.saved-item-detail { color: var(--text-secondary); font-size: 0.75rem; }
.saved-item-delete { background: none; border: none; color: var(--danger); padding: 0; margin-left: auto; opacity: 0.5; transition: opacity var(--transition); }
.saved-item-delete:hover { opacity: 1; }

/* ============================================================
   CHARTS SECTION — fluid bg
   ============================================================ */
.charts-section {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(37,99,235,0.04) 0%, transparent 100%),
    var(--surface-2);
}
[data-theme="dark"] .charts-section {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(77,163,255,0.04) 0%, transparent 100%),
    var(--bg);
}
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 28px; }
.chart-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 22px;
  box-shadow: var(--shadow); transition: box-shadow var(--transition), transform var(--transition);
}
[data-theme="dark"] .chart-card { background: var(--surface); }
.chart-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.chart-card--wide { grid-column: 1 / -1; }
.chart-header { margin-bottom: 16px; }
.chart-header h3 { font-size: 0.9rem; font-weight: 800; margin-bottom: 3px; letter-spacing: -0.01em; }
.chart-desc { font-size: 0.77rem; color: var(--text-secondary); }
.chart-wrapper { position: relative; }
.chart-wrapper--sm { max-height: 255px; }
.chart-wrapper--donut {
  display: flex;
  justify-content: center;
  align-items: center;
}
.chart-wrapper--donut canvas {
  max-width: 255px !important;
  max-height: 255px !important;
}

/* TABLE */
.table-section {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow);
}
.table-header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
[data-theme="dark"] .table-header-row { background: var(--surface-2); }
.table-header-row h3 { font-size: 0.9rem; font-weight: 800; letter-spacing: -0.01em; }
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.835rem; }
thead { background: var(--surface-2); }
[data-theme="dark"] thead { background: rgba(255,255,255,0.03); }
th {
  padding: 11px 15px; text-align: right;
  font-weight: 700; font-size: 0.72rem; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.07em;
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
th:first-child, td:first-child { text-align: left; }
td {
  padding: 10px 15px; text-align: right; color: var(--text);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--bg); }
[data-theme="dark"] tbody tr:nth-child(even) { background: rgba(255,255,255,0.017); }
tbody tr:hover { background: var(--primary-light); }
.table-empty { text-align: center !important; color: var(--text-muted); padding: 36px !important; font-style: italic; }
.td-positive  { color: var(--secondary); font-weight: 700; }
.td-negative  { color: var(--danger); font-weight: 700; }
.td-highlight { font-weight: 800; color: var(--primary); }

/* ============================================================
   CONTENT SECTION
   ============================================================ */
.content-section { background: var(--bg); }
.content-container { display: grid; grid-template-columns: 1fr 310px; gap: 48px; align-items: start; }

.content-main h2 {
  font-size: 1.28rem; font-weight: 900; color: var(--text);
  margin: 42px 0 15px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em; position: relative;
}
.content-main h2::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 40px; height: 2px; background: var(--primary); border-radius: 2px;
}
.content-main h2:first-child { margin-top: 0; }
.content-main p { margin-bottom: 13px; color: var(--text-secondary); line-height: 1.7; }
.content-main ul { margin: 13px 0; }
.content-main ul li { padding: 6px 0 6px 20px; position: relative; color: var(--text-secondary); line-height: 1.62; }
.content-main ul li::before { content: "→"; position: absolute; left: 0; color: var(--primary); font-size: 0.85em; font-weight: 700; }
.content-main strong { color: var(--text); font-weight: 700; }

/* FORMULA BLOCK */
.formula-block {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--primary); border-radius: var(--radius-sm);
  padding: 20px 24px; margin: 20px 0; box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .formula-block { background: var(--surface-2); }
.formula { font-size: 1.05rem; font-family: 'Courier New', monospace; font-weight: 700; color: var(--primary); margin-bottom: 16px; line-height: 1.9; }
.formula sup { font-size: 0.68em; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 3px; }
.frac .num { border-bottom: 1px solid; padding-bottom: 1px; font-size: 0.82em; }
.frac .den { font-size: 0.82em; }
.formula-legend { padding-left: 0; }
.formula-legend li { font-size: 0.855rem; padding: 3px 0; color: var(--text-secondary); }
.formula-legend li::before { display: none; }
.formula-note { font-size: 0.78rem; color: var(--text-muted); font-style: italic; margin-top: 8px; }
code { font-family: 'Courier New', monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 0.83em; }

/* EXAMPLE BLOCK */
.example-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin: 20px 0; box-shadow: var(--shadow);
}
[data-theme="dark"] .example-block { background: var(--surface-2); }
.example-params { display: grid; grid-template-columns: repeat(2,1fr); border-bottom: 1px solid var(--border); }
.example-param {
  padding: 13px 18px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.example-param:nth-child(2),.example-param:nth-child(4) { border-right: none; }
.example-param span { font-size: 0.72rem; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.example-param strong { font-size: 0.95rem; color: var(--text); font-weight: 800; }
.example-result { padding: 20px; }
.example-result-main { display: flex; align-items: baseline; gap: 12px; margin-bottom: 13px; }
.example-result-main span { color: var(--text-secondary); font-size: 0.875rem; }
.example-result-main strong { font-size: 1.6rem; font-weight: 900; color: var(--secondary); letter-spacing: -0.025em; }
.example-breakdown { display: flex; gap: 18px; margin-bottom: 12px; font-size: 0.845rem; color: var(--text-secondary); }
.example-note { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* COMPARISON LIST */
.comparison-list { margin: 14px 0 !important; display: flex; flex-direction: column; gap: 7px; }
.comparison-list li {
  padding: 12px 16px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--primary) !important;
  border-radius: 9px !important;
  color: var(--text-secondary) !important;
  transition: all var(--transition);
}
[data-theme="dark"] .comparison-list li { background: var(--surface-2) !important; }
.comparison-list li::before { display: none !important; }
.comparison-list li:hover { border-left-color: var(--primary) !important; background: var(--primary-light) !important; }

/* ERRORS LIST — elegant, no counter badges */
.errors-list { display: flex; flex-direction: column; gap: 7px; }
.errors-list li {
  padding: 12px 16px 12px 16px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--danger) !important;
  border-radius: 9px !important;
  color: var(--text-secondary) !important;
  transition: all var(--transition);
  list-style: none;
}
[data-theme="dark"] .errors-list li { background: var(--surface-2) !important; }
.errors-list li::before { display: none !important; }
.errors-list li:hover { background: var(--danger-light) !important; }

.disclaimer-inline {
  background: var(--accent-light);
  border: 1px solid var(--accent); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 15px;
  font-size: 0.8rem; color: var(--text-secondary); font-style: italic; margin-top: 14px;
}

/* SIDEBAR */
.content-sidebar { position: sticky; top: calc(var(--header-h) + 18px); }
.sidebar-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .sidebar-card { background: var(--surface-2); }
.sidebar-card h3 { font-size: 0.875rem; font-weight: 800; margin-bottom: 13px; letter-spacing: -0.01em; }
.sidebar-links { display: flex; flex-direction: column; gap: 2px; }
.sidebar-links a {
  padding: 7px 10px; border-radius: var(--radius-xs);
  font-size: 0.845rem; color: var(--text-secondary);
  transition: all var(--transition); font-weight: 500;
}
.sidebar-links a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; padding-left: 14px; }
.reference-table { display: flex; flex-direction: column; }
.ref-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.ref-row:last-child { border-bottom: none; }
.ref-row span { color: var(--text-secondary); }
.ref-row strong { color: var(--secondary); font-size: 0.875rem; font-weight: 800; }
.sidebar-note { font-size: 0.72rem; color: var(--text-muted); font-style: italic; margin-top: 11px; }

/* ============================================================
   FAQ SECTION — fluid bg
   ============================================================ */
.faq-section {
  background:
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(37,99,235,0.04) 0%, transparent 100%),
    var(--surface-2);
}
[data-theme="dark"] .faq-section {
  background:
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(77,163,255,0.04) 0%, transparent 100%),
    var(--surface);
}
.faq-list { max-width: 840px; margin: 0 auto; display: flex; flex-direction: column; gap: 7px; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
[data-theme="dark"] .faq-item { background: var(--surface-2); }
.faq-item:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.faq-question {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 17px 20px;
  background: none; border: none; text-align: left;
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  gap: 12px; transition: background var(--transition); letter-spacing: -0.005em;
}
.faq-question:hover { background: var(--primary-light); }
.faq-question[aria-expanded="true"] { color: var(--primary); }
.faq-icon { flex-shrink: 0; transition: transform 0.22s var(--ease); }
.faq-question[aria-expanded="true"] .faq-icon { transform: rotate(180deg); }
.faq-answer {
  padding: 15px 20px 18px; font-size: 0.875rem;
  color: var(--text-secondary); line-height: 1.65;
  border-top: 1px solid var(--border);
}
.faq-answer p:not(:last-child) { margin-bottom: 8px; }

/* ============================================================
   DISCLAIMER
   ============================================================ */
.disclaimer-section { background: var(--bg); padding: 32px 0; }
.disclaimer-box {
  display: flex; gap: 16px;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 20px 24px;
  align-items: flex-start; box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .disclaimer-box { background: var(--surface-2); }
.disclaimer-box svg { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.disclaimer-box h2 { font-size: 0.9rem; font-weight: 800; margin-bottom: 5px; color: var(--text); }
.disclaimer-box p { font-size: 0.845rem; line-height: 1.55; color: var(--text-secondary); }

/* ============================================================
   FOOTER — minimal
   ============================================================ */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
[data-theme="dark"] .site-footer { background: var(--surface-2); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand .logo-brand { font-size: 0.88rem; }
.footer-brand .logo-tld   { font-size: 0.82rem; }
.footer-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.footer-nav a {
  font-size: 0.82rem; color: var(--text-secondary);
  padding: 4px 11px; border-radius: 6px; font-weight: 600;
  transition: all var(--transition);
}
.footer-nav a:hover { color: var(--primary); background: var(--primary-light); text-decoration: none; }
.footer-copy { font-size: 0.74rem; color: var(--text-muted); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--text); color: var(--surface);
  padding: 12px 20px; border-radius: var(--radius);
  font-size: 0.845rem; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 1000;
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.28s, transform 0.28s;
  pointer-events: none; max-width: 320px;
}
[data-theme="dark"] .toast { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.toast.show { opacity: 1; transform: translateY(0); }

/* ============================================================
   LEGAL PAGES
   ============================================================ */
.legal-hero {
  background: var(--gradient-hero);
  color: white; padding: 52px 0 80px;
  position: relative; overflow: hidden;
}
.legal-hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 28px 28px; pointer-events: none; opacity: 0.35;
}
.legal-hero .container { position: relative; z-index: 1; }
.legal-hero h1 { font-size: clamp(1.45rem,2.8vw,2.1rem); font-weight: 900; color: white; margin-bottom: 8px; letter-spacing: -0.025em; }
.legal-hero p { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.legal-content { padding: 56px 0; }
.legal-content .container { max-width: 800px; }
.legal-content h2 {
  font-size: 1.15rem; font-weight: 900; color: var(--text);
  margin: 36px 0 13px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.018em; position: relative;
}
.legal-content h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 34px; height: 2px; background: var(--primary); border-radius: 2px; }
.legal-content h2:first-child { margin-top: 0; }
.legal-content p { margin-bottom: 13px; color: var(--text-secondary); line-height: 1.7; }
.legal-content ul { margin: 13px 0 13px 18px; list-style: disc; }
.legal-content ul li { color: var(--text-secondary); margin-bottom: 6px; line-height: 1.62; }
.legal-content strong { color: var(--text); font-weight: 700; }
.legal-content a { color: var(--primary); }
.legal-notice {
  background: var(--primary-light); border: 1px solid var(--border);
  border-left: 4px solid var(--primary); border-radius: var(--radius-sm);
  padding: 15px 18px; margin-bottom: 32px;
  font-size: 0.855rem; color: var(--text-secondary); line-height: 1.55;
}
[data-theme="dark"] .legal-notice { background: rgba(77,163,255,0.07); border-color: var(--border); border-left-color: var(--primary); }
.legal-note-future {
  background: var(--accent-light); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 20px 0;
  font-size: 0.835rem; color: var(--text-secondary); line-height: 1.55;
  font-style: italic;
}
[data-theme="dark"] .legal-note-future { background: rgba(251,191,36,0.06); border-left-color: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .calculator-layout  { grid-template-columns: 1fr; }
  .content-container  { grid-template-columns: 1fr; }
  .content-sidebar    { position: static; }
  .charts-grid        { grid-template-columns: 1fr; }
  .chart-card--wide   { grid-column: auto; }
}
/* Nav con 6 enlaces: reducir padding en pantallas medias */
@media (max-width: 960px) and (min-width: 769px) {
  .site-header nav > a,
  .nav-dropdown-btn { padding: 0 8px; font-size: 0.78rem; }
  .logo-brand { font-size: 0.85rem; }
}
@media (max-width: 768px) {
  /* ── Layout general ── */
  .section      { padding: 32px 0; }
  .container    { padding-left: 14px; padding-right: 14px; }

  /* ── Calculadora ── */
  .mode-tabs    { gap: 2px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .tab-btn      { min-width: auto; padding: 8px 9px; font-size: 0.77rem; flex-shrink: 0; }
  .tab-btn svg  { display: none; }
  .calculator-layout { gap: 16px; }
  .form-panel,.results-panel { padding: 14px; }
  .result-grid  { grid-template-columns: 1fr; }
  .example-params { grid-template-columns: 1fr; }

  /* ── Gráficos: evitar cortes ── */
  .charts-grid  { gap: 12px; }
  .chart-card   { overflow: hidden; }
  .chart-wrapper { position: relative; width: 100%; max-width: 100%; overflow: hidden; }
  .chart-wrapper canvas { max-width: 100% !important; }
  .chart-wrapper--sm { max-height: 220px; }

  /* ── Header nav: ocultar en escritorio, mostrar con hamburger ── */
  .site-header nav { display: none; }
  .header-sep   { display: none; }

  /* ── Menú móvil: fondo sólido, sin transparencias ── */
  .nav-hamburger { display: flex; }
  .site-header nav.mobile-open {
    display: flex;
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    background: #ffffff;
    border-top: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    padding: 12px 0 20px;
    flex-direction: column;
    gap: 0;
    z-index: 500;
    box-shadow: 0 16px 40px rgba(10,25,60,0.2);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  [data-theme="dark"] .site-header nav.mobile-open {
    background: #0c1d2e;
    border-top-color: #1b3450;
    border-bottom-color: #1b3450;
    box-shadow: 0 16px 40px rgba(0,0,0,0.7);
  }
  .site-header nav > a {
    padding: 16px 24px;
    font-size: 1rem;
    border-radius: 0;
    width: 100%;
    height: auto;
    border-bottom: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
  }
  .site-header nav > a:hover,
  .site-header nav > a.active {
    border-bottom: none;
    border-left-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
  }
}
@media (max-width: 480px) {
  .form-actions  { flex-direction: column; }
  .btn           { justify-content: center; }
  .result-value  { font-size: 1.8rem; }
  .export-actions { flex-wrap: wrap; gap: 8px; }
  .result-main   { padding: 20px 16px; }
  .mode-tabs     { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .tab-btn       { flex-shrink: 0; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .site-header,.hero,nav,.mode-tabs,.form-panel,
  .export-actions,.form-actions,.site-footer,
  .saved-section,.advanced-toggle,.theme-toggle,
  .breadcrumb,.faq-section,.disclaimer-section { display: none !important; }
  body { background: white; color: black; font-size: 11pt; }
  .section { padding: 14px 0; break-inside: avoid; }
  .results-panel { box-shadow: none; border: 1px solid #ccc; }
  .result-main { background: #1d4ed8 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .chart-card { break-inside: avoid; }
  table { font-size: 9pt; }
  .container { max-width: 100%; padding: 0 8px; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.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; }
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 4px; }

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.62s var(--ease), transform 0.62s var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 0.09s; }
.reveal-d2 { transition-delay: 0.18s; }
.reveal-d3 { transition-delay: 0.27s; }
.reveal-d4 { transition-delay: 0.36s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none !important; opacity: 1 !important; transform: none !important; }
}

/* ============================================================
   HERO CHART VISUAL
   ============================================================ */
.hero-visual {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 195px; pointer-events: none; z-index: 0; overflow: hidden;
}
.hero-visual svg { width: 100%; height: 100%; }
@media (max-width: 768px) { .hero-visual { height: 130px; opacity: 0.45; } }

/* ============================================================
   NAV DROPDOWN + HAMBURGER
   ============================================================ */
.nav-dropdown { position: relative; display: flex; align-items: center; height: 100%; }
.nav-dropdown-btn {
  display: flex; align-items: center; gap: 5px;
  height: 100%;
  padding: 0 13px; border-radius: 0;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.845rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all var(--transition); white-space: nowrap;
}
.nav-dropdown-btn:hover,
.nav-dropdown-btn.open {
  background: var(--primary-light);
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.nav-dropdown-btn .dd-chevron { transition: transform 0.22s var(--ease); }
.nav-dropdown-btn.open .dd-chevron { transform: rotate(180deg); }
.nav-dropdown-menu {
  display: none; position: absolute;
  top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 7px; min-width: 252px; z-index: 300;
}
[data-theme="dark"] .nav-dropdown-menu { background: var(--surface-2); }
.nav-dropdown-menu.open { display: flex; flex-direction: column; gap: 2px; }
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 0.845rem; font-weight: 600; color: var(--text-secondary);
  transition: all var(--transition);
}
.nav-dropdown-item:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.dd-icon {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
  transition: all var(--transition);
}
.nav-dropdown-item:hover .dd-icon { background: var(--primary); color: white; }
.nav-dropdown-divider { height: 1px; background: var(--border); margin: 4px 6px; }

.nav-hamburger {
  display: none; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px; color: var(--text-secondary);
  align-items: center; cursor: pointer;
  transition: all var(--transition); flex-shrink: 0; margin-left: auto;
}
.nav-hamburger:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ============================================================
   CALCULATOR SUB-PAGES — shared styles
   ============================================================ */
.calc-hero {
  background: var(--gradient-hero); color: white;
  padding: 48px 0 80px; position: relative; overflow: hidden;
}
.calc-hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 28px 28px; pointer-events: none; opacity: 0.3;
}
.calc-hero .container { position: relative; z-index: 1; }
.calc-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 99px; padding: 4px 13px; font-size: 0.775rem;
  font-weight: 700; color: rgba(255,255,255,0.88); margin-bottom: 14px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.calc-hero h1 {
  font-size: clamp(1.45rem, 2.8vw, 2.1rem); font-weight: 900;
  margin-bottom: 10px; letter-spacing: -0.025em; line-height: 1.2;
}
.calc-hero p { color: rgba(255,255,255,0.72); max-width: 560px; font-size: 0.95rem; line-height: 1.55; }
.calc-breadcrumb {
  display: flex; gap: 5px; align-items: center; margin-bottom: 16px;
  font-size: 0.8rem; color: rgba(255,255,255,0.52); flex-wrap: wrap;
}
.calc-breadcrumb a { color: rgba(255,255,255,0.72); }
.calc-breadcrumb a:hover { color: white; text-decoration: none; }
.calc-breadcrumb-sep { color: rgba(255,255,255,0.35); font-size: 0.85em; }

.calc-section { padding: 52px 0; background: var(--bg); }
.calc-section .section-header { margin-bottom: 30px; }
.calc-layout {
  display: grid; grid-template-columns: 400px 1fr;
  gap: 22px; align-items: start;
}
@media (max-width: 960px) { .calc-layout { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  /* ── Layout general ── */
  .section      { padding: 32px 0; }
  .container    { padding-left: 14px; padding-right: 14px; }

  /* ── Calculadora ── */
  .mode-tabs    { gap: 2px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .tab-btn      { min-width: auto; padding: 8px 9px; font-size: 0.77rem; flex-shrink: 0; }
  .tab-btn svg  { display: none; }
  .calculator-layout { gap: 16px; }
  .form-panel,.results-panel { padding: 14px; }
  .result-grid  { grid-template-columns: 1fr; }
  .example-params { grid-template-columns: 1fr; }

  /* ── Gráficos: evitar cortes ── */
  .charts-grid  { gap: 12px; }
  .chart-card   { overflow: hidden; }
  .chart-wrapper { position: relative; width: 100%; max-width: 100%; overflow: hidden; }
  .chart-wrapper canvas { max-width: 100% !important; }
  .chart-wrapper--sm { max-height: 220px; }

  /* ── Header nav: ocultar en escritorio, mostrar con hamburger ── */
  .site-header nav { display: none; }
  .header-sep   { display: none; }

  /* ── Menú móvil ── */
  .nav-hamburger { display: flex; }
  /* backdrop-filter crea un nuevo bloque contenedor para position:fixed;
     desactivarlo en móvil para que el menú se posicione respecto al viewport */
  .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .site-header nav.mobile-open {
    display: flex;
    position: fixed;
    top: var(--header-h); left: 0; right: 0;
    height: auto;
    background: #ffffff;
    border-top: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    padding: 12px 0 20px;
    flex-direction: column;
    gap: 0;
    z-index: 500;
    box-shadow: 0 16px 40px rgba(10,25,60,0.2);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  [data-theme="dark"] .site-header nav.mobile-open {
    background: #0c1d2e;
    border-top-color: #1b3450;
    border-bottom-color: #1b3450;
    box-shadow: 0 16px 40px rgba(0,0,0,0.7);
  }
  .site-header nav > a {
    padding: 16px 24px;
    font-size: 1rem;
    border-radius: 0;
    width: 100%;
    height: auto;
    border-bottom: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
  }
  .site-header nav > a:hover,
  .site-header nav > a.active {
    border-bottom: none;
    border-left-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
  }
}

/* ============================================================
   CALC-INFO — sección informativa inferior de sub-páginas
   ============================================================ */
.calc-info {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 56px 0 64px;
}
[data-theme="dark"] .calc-info { background: var(--surface-2); }

.calc-info-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

.calc-info h2 {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.calc-info h2:not(:first-child) { margin-top: 36px; }

.calc-info p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.calc-info ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calc-info ul li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.935rem;
  line-height: 1.6;
  color: var(--text-secondary);
}
.calc-info ul li::before {
  content: "→";
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

@media (max-width: 768px) {
  .calc-info { padding: 36px 0 44px; }
  .calc-info-container { padding: 0 14px; }
  .calc-info h2 { font-size: 1.1rem; }
  .calc-info p, .calc-info ul li { font-size: 0.9rem; }
}

/* ============================================================
   PREMIUM DESIGN ENHANCEMENTS
   ============================================================ */

/* ── @keyframes ── */
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}
@keyframes shimmer-sweep {
  0%   { transform: translateX(-120%) skewX(-20deg); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateX(300%) skewX(-20deg); opacity: 0; }
}
@keyframes float-slow {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-14px) scale(1.04); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 8px 28px rgba(37,99,235,0.28); }
  50%       { box-shadow: 0 12px 40px rgba(37,99,235,0.48), 0 0 60px rgba(37,99,235,0.12); }
}

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Section badge — small pill above headings ── */
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 99px;
  padding: 4px 15px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
[data-theme="dark"] .section-badge {
  border-color: rgba(77,163,255,0.2);
}

/* Gradient underline accent under section headings */
.section-header::after {
  content: '';
  display: block;
  width: 52px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  border-radius: 99px;
  margin: 12px auto 0;
}

/* ── Hero (index), Calc-hero & legal-hero: animated gradient ── */
.hero,
.calc-hero,
.legal-hero {
  background: var(--gradient-hero);
  background-size: 220% 220%;
  animation: gradient-shift 14s ease infinite;
}

/* ── Calculator section: richer ambient light ── */
.calculator-section {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 70% at 98%  2%,  rgba(37,99,235,0.09)  0%, transparent 100%),
    radial-gradient(ellipse 45% 55% at 2%  98%,  rgba(8,145,178,0.07)  0%, transparent 100%),
    radial-gradient(ellipse 30% 40% at 50% 50%,  rgba(5,150,105,0.04)  0%, transparent 100%),
    var(--bg);
}
[data-theme="dark"] .calculator-section {
  background:
    radial-gradient(ellipse 55% 70% at 98%  2%,  rgba(77,163,255,0.07)  0%, transparent 100%),
    radial-gradient(ellipse 45% 55% at 2%  98%,  rgba(34,211,238,0.06)  0%, transparent 100%),
    radial-gradient(ellipse 30% 40% at 50% 50%,  rgba(52,211,153,0.04)  0%, transparent 100%),
    var(--bg);
}
.calculator-section::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 440px; height: 440px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.07) 0%, transparent 68%);
  pointer-events: none;
  animation: float-slow 9s ease-in-out infinite;
}
.calculator-section::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -100px;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(8,145,178,0.06) 0%, transparent 68%);
  pointer-events: none;
  animation: float-slow 11s ease-in-out infinite reverse;
}

/* ── Mode tabs: gradient active state ── */
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, #0878c7 100%);
  box-shadow: 0 4px 16px rgba(37,99,235,0.38), 0 2px 6px rgba(37,99,235,0.2);
}
[data-theme="dark"] .tab-btn.active {
  background: linear-gradient(135deg, #2066eb 0%, #0891b2 100%);
}

/* ── Primary button: gradient + shimmer on hover ── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 55%, #0878b0 100%);
  box-shadow: 0 4px 16px rgba(37,99,235,0.32), 0 2px 4px rgba(37,99,235,0.18);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -80%;
  width: 55%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: skewX(-18deg);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1a56db 0%, var(--primary) 55%, #0891b2 100%);
  box-shadow: 0 8px 30px rgba(37,99,235,0.46), 0 3px 8px rgba(37,99,235,0.24);
  transform: translateY(-2px);
}
.btn-primary:hover::after {
  animation: shimmer-sweep 0.65s ease forwards;
}
.btn-primary:active { transform: translateY(0); }

/* ── Form & Results panels: hover glow border ── */
.form-panel,
.results-panel {
  transition: box-shadow 0.35s ease, transform 0.25s ease;
}
.form-panel:hover,
.results-panel:hover {
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(37,99,235,0.18), 0 0 48px rgba(37,99,235,0.07);
}
[data-theme="dark"] .form-panel:hover,
[data-theme="dark"] .results-panel:hover {
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(77,163,255,0.15), 0 0 48px rgba(77,163,255,0.05);
}

/* ── Result main: shimmer diagonal + pulse ── */
.result-main {
  animation: pulse-glow 4s ease-in-out infinite;
}
.result-main::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0) 20%,
    rgba(255,255,255,0.07) 50%,
    rgba(255,255,255,0) 80%
  );
  pointer-events: none;
  border-radius: inherit;
}

/* ── Chart cards: accent bar on top + stronger hover ── */
.chart-card {
  position: relative;
}
.chart-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--teal), transparent);
  border-radius: 0 0 99px 99px;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.chart-card:hover::before { opacity: 1; }
.chart-card:hover {
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(37,99,235,0.1);
  transform: translateY(-4px);
}

/* ── FAQ items: premium hover ── */
.faq-item:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(37,99,235,0.14);
}

/* ── Saved items: richer hover ── */
.saved-item:hover {
  box-shadow: var(--shadow-colored), 0 0 0 1px rgba(37,99,235,0.18);
  transform: translateY(-2px);
}

/* ── Input focus: stronger glow ring ── */
.input-with-prefix:focus-within,
.input-with-suffix:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.select-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ── Slider thumb: larger + stronger glow ── */
.slider::-webkit-slider-thumb {
  width: 20px; height: 20px;
  box-shadow: 0 2px 10px var(--primary-glow), 0 0 0 2.5px white;
}
[data-theme="dark"] .slider::-webkit-slider-thumb {
  box-shadow: 0 2px 10px var(--primary-glow), 0 0 0 2.5px var(--surface);
}
.slider::-webkit-slider-thumb:hover {
  transform: scale(1.28);
  box-shadow: 0 4px 20px var(--primary-glow), 0 0 0 2.5px white;
}

/* ── Ratio bar: slightly thicker ── */
.ratio-bar { height: 10px; }

/* ── Result card: bigger icon area ── */
.card-icon { width: 36px; height: 36px; border-radius: 10px; }

/* ── Mode desc: gradient tint ── */
.mode-desc {
  background: linear-gradient(135deg, var(--primary-light) 0%, rgba(8,145,178,0.07) 100%);
}

/* ── Calc-info h2: gradient text ── */
.calc-info h2 {
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 65%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Footer: always-dark premium ── */
.site-footer {
  background: linear-gradient(180deg, #0c1829 0%, #060f1c 100%);
  border-top: 1px solid rgba(37,99,235,0.14);
  padding: 36px 0;
}
[data-theme="dark"] .site-footer {
  background: linear-gradient(180deg, #040810 0%, #020508 100%);
  border-top-color: rgba(77,163,255,0.08);
}
.site-footer .logo-brand { color: rgba(255,255,255,0.88); }
.site-footer .logo-tld   { color: #4da3ff; }
.footer-nav a { color: rgba(255,255,255,0.44); }
.footer-nav a:hover {
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.07);
  text-decoration: none;
}
.footer-copy { color: rgba(255,255,255,0.24); }

/* ── Logo: glow pulse on hover ── */
.logo:hover svg {
  box-shadow: 0 0 0 3px rgba(37,99,235,0.22), 0 4px 16px rgba(0,0,0,0.3);
}

/* ── Header accent line: gradient ── */
.site-header::after {
  opacity: 0.7;
}

/* ── Nav active link: pill bg ── */
.site-header nav > a.active {
  background: var(--primary-light);
  border-radius: var(--radius-xs);
}

/* ── Theme toggle: richer hover ── */
.theme-toggle:hover {
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Disclaimer box: gradient left border ── */
.disclaimer-box {
  border-left: 4px solid;
  border-image: linear-gradient(180deg, var(--accent), #f59e0b) 1;
}

/* ── Table rows: richer hover ── */
tbody tr:hover {
  background: var(--primary-light);
  transition: background 0.12s ease;
}

/* ── Microcopy block ── */
.microcopy {
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--secondary-light) 0%, rgba(8,145,178,0.05) 100%);
}

/* ── Advanced toggle button ── */
.advanced-toggle button:hover {
  box-shadow: 0 0 0 3px var(--primary-glow);
}

@media (max-width: 768px) {
  .calculator-section::before,
  .calculator-section::after { display: none; }
}

/* ============================================================
   BUG FIXES — chart centering & microcopy spacing
   ============================================================ */

/* Center chart canvas inside its wrapper (fixes left-alignment of doughnut charts) */
.chart-wrapper canvas {
  display: block;
  margin: 0 auto;
}

/* More breathing room between microcopy text and the section around it */
.microcopy {
  margin-top: 18px;
}

/* REVERT — canvas centering broke chart sizes; undo it */
.chart-wrapper canvas {
  display: unset;
  margin: unset;
}

/* ============================================================
   MOBILE EXCELLENCE — Touch, Motion & Visual Polish
   ============================================================ */

/* ── Hero section (index.html) ── */
.hero-cta {
  margin-top: 8px;
  padding: 12px 28px;
  font-size: 0.95rem;
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}
.hero-cta:hover { box-shadow: 0 10px 36px rgba(0,0,0,0.32); }

/* ── Respect prefers-reduced-motion for ALL animations ── */
@media (prefers-reduced-motion: reduce) {
  .hero, .calc-hero, .legal-hero { animation: none !important; background-position: 0% 50% !important; }
  .hero-em { animation: none !important; }
  .hero-orb { animation: none !important; }
  .hero-pill-dot { animation: none !important; }
  .calculator-section::before,
  .calculator-section::after { animation: none !important; }
  .result-main { animation: none !important; }
}

/* ── Touch devices: disable hover lifts (prevents tap-triggered jump) ── */
@media (hover: none) {
  .chart-card:hover       { transform: none; box-shadow: var(--shadow); }
  .chart-card:hover::before { opacity: 0; }
  .result-card:hover      { transform: none; box-shadow: none; }
  .form-panel:hover,
  .results-panel:hover    { box-shadow: var(--shadow-md); }
  .btn-primary:hover      { transform: none; }
  .btn-primary:active     { transform: scale(0.97); }
  .btn-secondary:hover    { transform: none; filter: none; }
  .btn-ghost:hover        { transform: none; }
  .saved-item:hover       { transform: none; }
  .faq-item:hover         { box-shadow: var(--shadow-sm); }
  .calculator-section::before,
  .calculator-section::after { display: none; }
}

/* ── Tap highlight color ── */
* { -webkit-tap-highlight-color: rgba(37,99,235,0.12); }

/* ── Mobile touch target & visual improvements ── */
@media (max-width: 768px) {
  /* Inputs: 44px minimum touch target */
  .input-with-prefix input,
  .input-with-suffix input { height: 44px; font-size: 1rem; }
  .input-prefix, .input-suffix { height: 44px; }
  .select-input { height: 44px; font-size: 0.9rem; }

  /* Sliders: thicker track */
  .slider { height: 6px; }

  /* Tab buttons: taller touch targets */
  .tab-btn { padding: 10px 10px; min-height: 40px; }

  /* Section header: less bottom margin */
  .section-header { margin-bottom: 22px; }
  .section-header h2 { font-size: clamp(1.2rem, 4.5vw, 1.6rem); }

  /* Hero: compact on mobile */
  .hero { padding: 44px 0 52px; }
  .hero h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); }
  .hero-br { display: none; }
  .hero-pill { font-size: 0.72rem; margin-bottom: 16px; }
  .hero-subtitle { font-size: 0.94rem; margin-bottom: 26px; }
  .hero-stats { gap: 0; margin-bottom: 28px; }
  .hero-stat { padding-right: 18px; }
  .hero-stat-divider { margin-right: 18px; height: 28px; }
  .stat-number { font-size: 1.6rem; }
  .hero-actions { gap: 10px; }
  .hero-cta { padding: 12px 24px; font-size: 0.9rem; }
  .hero-btn-ghost { padding: 12px 18px; font-size: 0.87rem; }
  .hero-orb-1 { width: 300px; height: 300px; top: -80px; right: -60px; }
  .hero-orb-2 { width: 220px; height: 220px; }
  .hero-orb-3 { display: none; }
  .hero-wave { height: 44px; }

  /* Calc-hero: more compact on mobile */
  .calc-hero { padding: 30px 0 22px; }
  .calc-hero h1 { font-size: clamp(1.25rem, 5vw, 1.75rem); }

  /* Result main: more padding breathing room */
  .result-main { padding: 24px 18px; }

  /* Chart cards: no border-radius clip issue */
  .chart-card { border-radius: var(--radius); }

  /* Form actions: full-width buttons */
  .form-actions .btn { flex: 1; justify-content: center; min-height: 44px; }

  /* FAQ question: bigger touch */
  .faq-question { padding: 16px 16px; }

  /* Mode-desc: smaller padding */
  .mode-desc { padding: 8px 12px; font-size: 0.82rem; }

  /* Mobile nav: "Más calculadoras" dropdown becomes inline list */
  .site-header nav.mobile-open .nav-dropdown {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    height: auto;
  }
  .site-header nav.mobile-open .nav-dropdown-btn {
    padding: 16px 24px;
    height: auto;
    width: 100%;
    justify-content: flex-start;
    font-size: 1rem;
    border-radius: 0;
    border-bottom: none;
    border-left: 3px solid transparent;
    color: var(--text-secondary);
    background: transparent;
  }
  .site-header nav.mobile-open .nav-dropdown-btn.open,
  .site-header nav.mobile-open .nav-dropdown-btn:hover {
    border-left-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
  }
  .site-header nav.mobile-open .nav-dropdown-menu {
    position: static !important;
    transform: none !important;
    box-shadow: none;
    border: none;
    background: transparent;
    border-radius: 0;
    min-width: auto;
    padding: 0;
  }
  .site-header nav.mobile-open .nav-dropdown-menu.open {
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  .site-header nav.mobile-open .nav-dropdown-item {
    padding: 12px 24px 12px 44px;
    font-size: 0.92rem;
    border-radius: 0;
    border-left: 3px solid transparent;
  }
  .site-header nav.mobile-open .nav-dropdown-item:hover {
    border-left-color: var(--primary);
    background: var(--primary-light);
  }
  .site-header nav.mobile-open .nav-dropdown-divider {
    margin: 2px 24px;
  }
  .site-header nav.mobile-open .dd-icon {
    width: 24px; height: 24px;
  }
}

/* ── Small phones (≤400px) ── */
@media (max-width: 400px) {
  .mode-tabs { gap: 1px; }
  .tab-btn   { padding: 9px 7px; font-size: 0.73rem; }
  .result-value { font-size: 1.7rem; }
  .form-panel, .results-panel { padding: 12px; }
  .result-main { padding: 18px 13px; }
  .hero { padding: 36px 0 44px; }
  .hero h1 { font-size: 1.55rem; }
  .hero-subtitle { font-size: 0.875rem; margin-bottom: 20px; }
  .stat-number { font-size: 1.45rem; }
  .hero-stat { padding-right: 14px; }
  .hero-stat-divider { margin-right: 14px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn, .hero-btn-ghost { text-align: center; justify-content: center; }
}

/* ============================================================
   COMPARE MODE PANEL
   ============================================================ */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.compare-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 12px 14px;
  text-align: center;
  background: var(--surface);
  transition: all var(--transition);
}
[data-theme="dark"] .compare-card { background: var(--surface-2); }
.compare-card--medio {
  border-color: var(--primary);
  background: linear-gradient(160deg, var(--primary-light) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-colored);
  position: relative;
}
.compare-card--medio::before {
  content: '★ Recomendado';
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: white;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 10px; border-radius: 99px; white-space: nowrap;
}
.compare-label {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-secondary); margin-bottom: 3px;
}
.compare-card--medio    .compare-label  { color: var(--primary); }
.compare-card--optimista .compare-label { color: var(--secondary); }
.compare-rate {
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 10px;
}
.compare-card--medio    .compare-rate   { color: var(--primary); opacity: 0.8; }
.compare-card--optimista .compare-rate  { color: var(--secondary); opacity: 0.8; }
.compare-value {
  font-size: 1.1rem; font-weight: 900; color: var(--text);
  letter-spacing: -0.025em; line-height: 1.1; margin-bottom: 6px;
}
.compare-card--medio    .compare-value  { color: var(--primary); font-size: 1.25rem; }
.compare-card--optimista .compare-value { color: var(--secondary); }
.compare-detail {
  font-size: 0.68rem; color: var(--text-muted); line-height: 1.4;
}
@media (max-width: 540px) {
  .compare-grid { grid-template-columns: 1fr; gap: 14px; }
  .compare-card--medio { margin-top: 10px; }
}

/* ============================================================
   FIXES: buttons, gradient text, mobile hero
   ============================================================ */

/* Hero CTA: same border as ghost button → equal height */
.hero-cta { border: 1px solid transparent; }

/* Form actions: 3 buttons always on same line, equal width */
.form-actions { flex-wrap: nowrap; }
.form-actions .btn { flex: 1; justify-content: center; min-width: 0; }

/* Gradient text on content section headings (index.html) */
.content-main h2 {
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 60%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="dark"] .content-main h2 {
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 55%, var(--teal) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Mobile calc-hero: enough padding-bottom for the wave */
@media (max-width: 768px) {
  .calc-hero { padding: 30px 0 62px; }
  .legal-hero { padding: 36px 0 72px; }
}
