/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #12161f;
  --text-muted: #5b6472;
  --text-faint: #8891a0;

  --primary: #10234f;
  --primary-hover: #0a1836;
  --accent: #1d4ed8;
  --accent-soft: #eaf0fe;

  --success: #0f7a3d;
  --success-soft: #eaf7ef;
  --danger: #b3261e;
  --danger-soft: #fdecec;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-weight: 700; }
::selection { background: var(--accent-soft); color: var(--primary); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--primary); color: #fff;
  z-index: 9999; border-radius: var(--radius-sm); font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 760px; }

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
}
.logo { font-weight: 800; font-size: 1.05rem; color: var(--primary); letter-spacing: -0.01em; }
.header-badge {
  font-size: .78rem; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: .3rem .65rem; border-radius: 999px;
}

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding: 2.75rem 0 1.5rem; }
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); color: var(--primary); }
.hero-subtitle { margin-top: .6rem; font-size: 1.05rem; color: var(--text-muted); max-width: 46ch; }

/* =============================================================
   6. Tool section / layout grid
   ============================================================= */
.tool-section { padding-bottom: 2rem; }

.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (min-width: 960px) {
  .layout-grid { grid-template-columns: 1.15fr 0.85fr; gap: 1.5rem; }
  .col-result { position: sticky; top: 1.25rem; }
}

.col-form, .col-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}
@media (min-width: 540px) { .col-form, .col-result { padding: 2rem; } }

.col-title { font-size: 1.15rem; color: var(--primary); margin-bottom: 1.25rem; }

/* =============================================================
   7. Form fields
   ============================================================= */
.field-group {
  border: 0;
  padding: 0 0 1.5rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--border);
}
.field-group:last-of-type { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.field-group legend {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-faint); padding: 0; margin-bottom: 1rem;
}

.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 540px) { .field-row { grid-template-columns: 1fr 1fr; } }

label, .field-label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .4rem; }

input[type="text"], input[type="number"], input[type="date"] {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: .8rem .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
  min-height: 48px;
}
input:hover { border-color: #c7cdd6; }
input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder { color: var(--text-faint); }

.input-suffix { position: relative; }
.input-suffix input { padding-right: 2.4rem; }
.input-suffix .suffix {
  position: absolute; right: .95rem; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-weight: 600; pointer-events: none;
}

.help { font-size: .84rem; color: var(--text-muted); margin-top: .4rem; }
.field-error {
  font-size: .84rem; color: var(--danger); margin-top: .4rem; min-height: 0;
  display: none;
}
.field-error.is-visible { display: block; }
.field.has-error input { border-color: var(--danger); background: var(--danger-soft); }

/* Radio pills */
.radio-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.radio-pill {
  position: relative; display: inline-flex; align-items: center;
  padding: .65rem 1.1rem; border: 1.5px solid var(--border); border-radius: 999px;
  cursor: pointer; font-weight: 600; font-size: .92rem; background: var(--bg);
  transition: all .15s var(--ease-out); min-height: 44px;
}
.radio-pill input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.radio-pill:has(input:checked) {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.radio-pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Reason cards */
.reason-options { display: grid; grid-template-columns: 1fr; gap: .6rem; }
@media (min-width: 540px) { .reason-options { grid-template-columns: 1fr 1fr; } }
.reason-card {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; background: var(--bg); transition: all .15s var(--ease-out);
  font-weight: 600; font-size: .92rem; min-height: 48px;
}
.reason-card input { accent-color: var(--primary); width: 18px; height: 18px; flex-shrink: 0; }
.reason-card:has(input:checked) { border-color: var(--primary); background: var(--accent-soft); }
.reason-info {
  margin-top: 1rem; padding: .9rem 1rem; background: var(--bg);
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .88rem; color: var(--text-muted); line-height: 1.55;
}

/* Extra pagas dynamic rows */
.extra-paga-row {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1rem; margin-bottom: .85rem; background: var(--bg);
}
.extra-paga-row:last-child { margin-bottom: 0; }
.extra-paga-row .row-title { font-weight: 700; font-size: .85rem; margin-bottom: .75rem; color: var(--primary); }

/* Buttons */
.btn-primary {
  display: block; width: 100%; text-align: center;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 1.02rem;
  padding: 1rem 1.5rem; border-radius: var(--radius-sm);
  transition: background .15s var(--ease-out), transform .1s var(--ease-out);
  min-height: 52px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.99); }
.btn-calculate { margin-top: .5rem; }

.privacy-note { text-align: center; font-size: .8rem; color: var(--text-faint); margin-top: .85rem; }

/* =============================================================
   8. Result panel
   ============================================================= */
.result-empty { color: var(--text-muted); }
.result-empty p { font-size: .95rem; }

.result-total-card {
  display: flex; flex-direction: column; gap: .3rem;
  background: var(--primary); color: #fff;
  border-radius: var(--radius-md); padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.result-total-label { font-size: .85rem; font-weight: 600; opacity: .85; }
.result-total-amount { font-family: var(--mono); font-size: clamp(1.8rem, 5vw, 2.3rem); font-weight: 700; letter-spacing: -0.02em; }
.result-orientative { font-size: .78rem; opacity: .75; }

.result-breakdown h3, .result-explanation h3, .legal-notice h3, .legal-sources h3, .severance-card h3 {
  font-size: .95rem; color: var(--primary); margin-bottom: .75rem;
}

.breakdown-list { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1.5rem; }
.breakdown-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: .55rem; border-bottom: 1px dashed var(--border);
  font-size: .92rem;
}
.breakdown-row dt { color: var(--text-muted); }
.breakdown-row dd { font-family: var(--mono); font-weight: 600; }
.breakdown-row.total-row { border-bottom: none; padding-top: .3rem; font-weight: 700; font-size: 1rem; }

.result-severance { margin-bottom: 1.5rem; }
.severance-card {
  background: var(--success-soft); border: 1px solid #cfead9;
  border-radius: var(--radius-md); padding: 1.1rem 1.25rem;
}
.severance-card.no-severance { background: var(--bg); border-color: var(--border); }
.severance-amount { font-family: var(--mono); font-weight: 700; font-size: 1.3rem; color: var(--success); margin: .3rem 0; }
.severance-note { font-size: .85rem; color: var(--text-muted); line-height: 1.55; }
.grand-total-row {
  display: flex; justify-content: space-between; margin-top: .9rem; padding-top: .9rem;
  border-top: 1px solid #cfead9; font-weight: 700;
}

.result-explanation { margin-bottom: 1.5rem; font-size: .88rem; color: var(--text-muted); line-height: 1.6; }
.result-explanation p { margin-bottom: .6rem; }
.result-explanation strong { color: var(--text); }

.legal-notice, .legal-sources { margin-bottom: 1.25rem; font-size: .84rem; color: var(--text-muted); }
.legal-notice { background: var(--bg); border-radius: var(--radius-md); padding: 1rem 1.1rem; }
.legal-notice p { margin-bottom: .5rem; }
.legal-notice p:last-child { margin-bottom: 0; }
.legal-sources ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .3rem; }

/* =============================================================
   9. Ad slots
   ============================================================= */
.ad-slot {
  max-width: 1160px; margin: 2rem auto; padding: 1.25rem;
  border: 1px dashed #c7cdd6; border-radius: var(--radius-md);
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  background: var(--surface);
}
.ad-label { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }

/* =============================================================
   10. SEO content & FAQ
   ============================================================= */
.seo-content, .faq-section { padding: 2rem 0; }
.seo-content h2, .faq-section h2 { font-size: 1.35rem; color: var(--primary); margin: 1.75rem 0 .75rem; }
.seo-content h2:first-child { margin-top: 0; }
.seo-content p { color: var(--text-muted); margin-bottom: .5rem; }

.faq-section details {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.faq-section summary {
  cursor: pointer; font-weight: 600; font-size: .98rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after { content: "+"; font-size: 1.3rem; color: var(--text-faint); font-weight: 400; }
.faq-section details[open] summary::after { content: "\2212"; }
.faq-section details p { margin-top: .6rem; color: var(--text-muted); font-size: .92rem; }

/* =============================================================
   11. Footer
   ============================================================= */
.site-footer {
  background: var(--primary); color: rgba(255,255,255,0.85);
  padding: 2.25rem 0; margin-top: 1rem;
}
.site-footer .logo { color: #fff; }
.footer-brand p { font-size: .85rem; margin-top: .5rem; max-width: 46ch; opacity: .8; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: 1.5rem; }
.footer-links a { font-size: .85rem; opacity: .85; transition: opacity .15s var(--ease-out); }
.footer-links a:hover { opacity: 1; text-decoration: underline; }

/* =============================================================
   12. Responsive breakpoints reference
   ============================================================= */
@media (min-width: 540px)  { /* large phone / small tablet */ }
@media (min-width: 720px)  { /* tablet portrait */ }
@media (min-width: 960px)  { /* tablet landscape / small laptop */ }
@media (min-width: 1280px) { /* laptop / desktop */ }

/* =============================================================
   13. Reduced motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
