:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --text: #16212e;
  --text-muted: #5b6b7c;
  --navy: #0b1f3a;
  --petrol: #0f4c4a;
  --hero-gradient: linear-gradient(135deg, var(--navy) 0%, var(--petrol) 100%);
  --primary: #0f766e;
  --primary-dark: #0b5a54;
  --primary-soft: #e1eef4;
  --money: #0ea87a;
  --money-dark: #067a58;
  --money-soft: #e3f9f1;
  --accent: #b45309;
  --accent-soft: #fef3e2;
  --border: #dde3ec;
  --danger: #b91c1c;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 31, 58, 0.06), 0 8px 24px rgba(11, 31, 58, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 48px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 8px;
}

.hero {
  background: var(--hero-gradient);
  padding: 16px 16px 26px;
}

.hero-inner {
  max-width: 480px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.brand-mark {
  font-size: 1rem;
}

.hero-title {
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.22;
  margin: 0 0 4px;
}

.hero-lead {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.85rem;
  margin: 0;
  max-width: 34ch;
}

.hero-trust {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 8px 0 0;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-top: -14px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 4px 18px rgba(11, 31, 58, 0.1);
}

.topnav-inner {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  /* Se ajusta al contenido y se centra cuando los 5 botones caben; si no
     caben, el propio ancho del bloque queda topado al 100% del sticky bar
     y el overflow-x hace scroll — sin depender de un breakpoint fijo que
     pueda quedarse corto y cortar el último botón. */
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 16px;
  scrollbar-width: none;
}

.topnav-inner::-webkit-scrollbar {
  display: none;
}

.topnav a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  scroll-snap-align: start;
}

.topnav a.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.field {
  margin-bottom: 14px;
}

.field label,
.field .field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  font-size: 1.05rem;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 2.5px solid var(--primary);
  outline-offset: 2px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.preset-chip {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 34px;
}

.preset-chip.active {
  background: var(--money-soft);
  border-color: var(--money);
  color: var(--money-dark);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.segmented {
  display: flex;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 6px;
  min-height: 44px;
  border-radius: calc(var(--radius-md) - 3px);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
}

.segmented button.active {
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(11, 31, 58, 0.18);
}

.checkrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 10px 4px;
  font-size: 0.88rem;
  min-height: 44px;
  cursor: pointer;
}

.checkrow input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

details.advanced {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

details.advanced summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  list-style: none;
  padding: 4px 0;
}

details.advanced summary::-webkit-details-marker {
  display: none;
}

details.advanced summary .chevron {
  display: inline-block;
  transition: transform 0.15s ease;
}

details.advanced[open] summary .chevron {
  transform: rotate(180deg);
}

details.advanced .advanced-body {
  padding-top: 12px;
}

.btn {
  display: block;
  width: 100%;
  border: none;
  background: var(--navy);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn:active {
  background: var(--primary-dark);
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

.result-hero {
  text-align: center;
  padding: 6px 0 14px;
}

.result-hero .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-hero .value {
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--navy);
  margin: 2px 0;
  letter-spacing: -0.01em;
}

.result-hero .value.money {
  color: var(--money-dark);
}

.result-hero .sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.split-bar-wrap {
  margin: 10px 0 16px;
}

.split-bar-caption {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.split-bar-caption strong {
  color: var(--money-dark);
  font-weight: 700;
}

.split-bar {
  height: 14px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  display: flex;
}

.split-bar .fill-neto {
  background: linear-gradient(90deg, var(--money) 0%, var(--money-dark) 100%);
  height: 100%;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.result-tile {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 12px;
}

.result-tile .t-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.result-tile .t-value {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 2px;
}

.breakdown {
  margin-top: 6px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

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

.breakdown-row .name {
  color: var(--text-muted);
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
}

.breakdown-row .val {
  font-weight: 700;
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: right;
}

.breakdown-row .val.money,
.result-tile .t-value.money {
  color: var(--money-dark);
}

.pill {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.notice {
  display: flex;
  gap: 8px;
  background: var(--accent-soft);
  color: #7c2d12;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.8rem;
  margin-top: 12px;
}

.notice.warn {
  background: #fef2f2;
  color: var(--danger);
}

.disclaimer {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

.footer {
  display: block;
  max-width: 480px;
  margin: 8px auto 0;
  padding: 0 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.compare-vs {
  text-align: center;
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: -2px 0 2px;
}

.diff-positive {
  color: var(--money-dark);
}

.diff-negative {
  color: var(--danger);
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.related-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
}

.related-icon {
  font-size: 1.1rem;
  flex: 0 0 auto;
}

.related-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
}

.related-desc {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.hidden {
  display: none !important;
}

@media (min-width: 560px) {
  .container {
    max-width: 640px;
    padding-top: 24px;
  }

  .hero {
    padding: 22px 16px 34px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-inner {
    max-width: 640px;
  }

  .two-col.two-col-desktop {
    grid-template-columns: 1fr 1fr;
  }
}
