:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --primary: #4338ca;
  --primary-hover: #3730a3;
  --primary-soft: #eef2ff;
  --accent: #047857;
  --accent-soft: #ecfdf5;
  --warn: #b45309;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --max-w: 960px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--primary-hover);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 1000;
  font-weight: 600;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-badge {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.site-nav {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0 1rem;
  border-top: 1px solid var(--border);
}

.site-nav.is-open {
  display: flex;
}

.site-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  .header-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
  .site-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    border-top: none;
    padding: 0;
    gap: 0.35rem;
  }
}

/* Main */
main {
  flex: 1;
  padding: 1.5rem 0 3rem;
}

.breadcrumbs {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* Hero & Tool Card */
.hero {
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.18;
  margin: 0 0 0.65rem;
  letter-spacing: -0.025em;
}

.hero-lead {
  font-size: 1.08rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 68ch;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .card {
    padding: 1.75rem;
  }
}

/* Forms */
.calc-form {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .calc-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-weight: 700;
  font-size: 0.92rem;
}

.field input,
.field select {
  min-height: 46px;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(67, 56, 202, 0.25);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 46px;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text);
}

/* Results */
.results-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.results-panel[hidden] {
  display: none;
}

.highlight-box {
  background: var(--primary-soft);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.highlight-number {
  font-size: clamp(2.1rem, 6vw, 3.2rem);
  font-weight: 900;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.highlight-sub {
  font-size: 1rem;
  color: var(--text);
  margin-top: 0.35rem;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.milestone-banner {
  background: var(--accent-soft);
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  font-weight: 600;
}

/* Share bar */
.share-box {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
}

.share-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0 0 0.65rem;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.share-btn:hover {
  background: #e2e8f0;
  color: var(--text);
}

.share-wa {
  background: #16a34a;
  color: #fff;
  border-color: #15803d;
}

.share-wa:hover {
  background: #15803d;
  color: #fff;
}

.share-x {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.share-x:hover {
  background: #1e293b;
  color: #fff;
}

.share-fb {
  background: #1d4ed8;
  color: #fff;
  border-color: #1e40af;
}

.share-fb:hover {
  background: #1e40af;
  color: #fff;
}

/* AdSense Placeholder - Compliant, clear separation & label, zero CLS */
.ad-container {
  margin: 1.75rem 0;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.ad-placeholder-box {
  font-size: 0.85rem;
  color: #64748b;
}

/* Editorial Content & Grids */
.prose h2 {
  font-size: 1.45rem;
  margin: 1.75rem 0 0.65rem;
  line-height: 1.25;
}

.prose h3 {
  font-size: 1.15rem;
  margin: 1.35rem 0 0.45rem;
}

.prose p {
  margin: 0 0 1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.1rem;
  padding-left: 1.35rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.link-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.link-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  color: var(--text);
}

.link-card-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  color: var(--primary);
}

.link-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq-item p {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-alt);
  font-weight: 700;
}

.error-msg {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1.5rem;
}

.footer-title {
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Cookie Banner (AEPD / RGPD symmetrical buttons) */
.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 720px;
  margin: 0 auto;
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
  z-index: 200;
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner a {
  color: #93c5fd;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.cookie-btn {
  min-height: 42px;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1.5px solid #475569;
  background: #1e293b;
  color: #fff;
}

.cookie-btn:hover {
  background: #334155;
}

.cookie-btn-accept {
  background: #4f46e5;
  border-color: #6366f1;
}

.cookie-btn-accept:hover {
  background: #4338ca;
}

.progress-wrap {
  width: 100%;
  height: 10px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.1rem;
  border: 1px solid var(--border);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}
