:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #10203a;
  --muted: #5a6b85;
  --primary: #1f6feb;
  --border: #dbe3ef;
  --success: #0f7b3c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1080px;
  margin: 24px auto 60px;
  padding: 0 16px;
}

header { margin-bottom: 16px; }
h1 { margin: 0 0 8px; font-size: 1.8rem; }
.subtitle { margin: 0; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
}

h2, h3 { margin-top: 0; }

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 10px;
}

@media (min-width: 1024px) {
  #calc-form .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  #calc-form #fixed-rate-box.grid,
  #calc-form #arm-rate-box.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #calc-form .primary-calc-cta {
    max-width: 420px;
  }
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

input, select, button {
  border: 1px solid #c6d0df;
  border-radius: 8px;
  font: inherit;
  padding: 8px 10px;
}

button {
  margin-top: 6px;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
}

.primary-calc-cta {
  width: 100%;
  margin-top: 12px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 12px 14px;
  background: linear-gradient(180deg, #1f6feb 0%, #1755b8 100%);
  box-shadow: 0 8px 18px rgba(31, 111, 235, 0.28);
}

.primary-calc-cta:hover {
  filter: brightness(1.03);
}

.hidden { display: none; }

.error {
  min-height: 1.2rem;
  color: #b42318;
  margin: 8px 0 0;
}

.summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.metric .label { color: var(--muted); font-size: 0.85rem; }
.metric .value { font-weight: 700; margin-top: 4px; }

.impact-good { color: var(--success); font-weight: 700; }

.impact-kpi-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.impact-kpi-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #f8fbff;
}

.impact-kpi-card .label {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.impact-kpi-card .value {
  font-size: 1rem;
  font-weight: 700;
}

.impact-kpi-card-wide {
  grid-column: 1 / -1;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.offer-link {
  display: block;
  text-decoration: none;
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
  font-weight: 600;
}

.offer-link:hover {
  background: #eef5ff;
}

.sponsored-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b4f00;
  background: #fff4ce;
  border: 1px solid #f3d58a;
  border-radius: 999px;
  padding: 3px 10px;
  margin: 0 0 8px;
}

.affiliate-disclosure {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.disclaimer-box {
  border-left: 4px solid #f59e0b;
}

.publisher-status {
  color: #1f2937;
  margin: 0;
}

.state-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.state-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #f9fbff;
}

.small-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer {
  max-width: 1080px;
  margin: 0 auto 40px;
  padding: 0 16px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: right;
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; }

thead th {
  position: sticky;
  top: 0;
  background: #f0f4fa;
}

code { background: #eef3fa; padding: 2px 4px; border-radius: 4px; }

/* Cookie banner */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  background: #111827;
  color: #f9fafb;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  display: none;
}
.cookie-banner-visible { display: block; }
.cookie-banner-text { margin: 0 0 10px; line-height: 1.4; font-size: 0.93rem; }
.cookie-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cookie-btn {
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}
.cookie-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.cookie-btn-secondary { background: #1f2937; color: #fff; }
.cookie-settings-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  background: #1f6feb;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31, 111, 235, 0.35);
}
@media (min-width: 900px) {
  .cookie-banner { left: auto; right: 16px; max-width: 520px; }
}
