/* ── Variables ───────────────────────────────────────── */

:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #dbeafe;
  --accent:         #380097;
  --success:        #059669;
  --success-light:  #d1fae5;
  --warning-light:  #fef9c3;
  --bg:             #f1f5f9;
  --card:           #ffffff;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --shadow:         0 4px 20px rgba(37, 99, 235, .07), 0 1px 4px rgba(0, 0, 0, .04);
  --shadow-sm:      0 1px 4px rgba(0, 0, 0, .06);
  --radius:         18px;
  --radius-sm:      10px;
}

/* ── Base ────────────────────────────────────────────── */

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

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(37, 99, 235, .09) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(124, 58, 237, .07) 0%, transparent 55%);
  min-height: 100vh;
  padding: 2.5rem 0 5rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
}

.container-main { max-width: 1200px; }

/* ── App header ──────────────────────────────────────── */

.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.app-header h1 {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .4rem;
}

.app-header .subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0;
}

/* ── Cards ───────────────────────────────────────────── */

.form-section,
.results-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.25rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, .9);
}

.results-section       { display: none; }
.results-section.show  { display: block; }

/* ── Section headings ────────────────────────────────── */

.section-heading {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1.5rem;
}

.section-heading .icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.results-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 2rem 0 1.1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Privacy notice ──────────────────────────────────── */

.privacy-notice {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  font-size: .875rem;
  color: #1e40af;
  margin-bottom: 1.75rem;
}

.privacy-notice .notice-icon { font-size: 1.1rem; line-height: 1.5; flex-shrink: 0; }
.privacy-notice a             { color: var(--primary); font-weight: 600; }
.privacy-notice code          { background: rgba(37,99,235,.12); border-radius: 4px; padding: .1em .35em; font-size: .83rem; }

.data-actions {
  display: flex;
  gap: .45rem;
  margin-top: .65rem;
  flex-wrap: wrap;
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid rgba(37, 99, 235, .3);
  color: var(--primary);
  border-radius: var(--radius-sm);
  padding: .35rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.btn-ghost:hover {
  background: rgba(37, 99, 235, .08);
  border-color: var(--primary);
}

/* ── Form fields ─────────────────────────────────────── */

.form-label {
  font-size: .78rem !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  text-transform: uppercase;
  letter-spacing: .45px;
  margin-bottom: .5rem !important;
}

.form-control,
.form-select {
  border-radius: var(--radius-sm) !important;
  border: 1.5px solid var(--border) !important;
  padding: .65rem 1rem !important;
  font-size: .95rem !important;
  font-weight: 500 !important;
  color: var(--text) !important;
  background-color: #f8fafc !important;
  transition: border-color .15s, box-shadow .15s !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, .13) !important;
  background-color: #fff !important;
  outline: none !important;
}

/* ── Calculate button ────────────────────────────────── */

.btn-calculate {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  border-radius: var(--radius-sm);
  padding: .8rem 2.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  letter-spacing: .2px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, .35);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}

.btn-calculate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, .42);
}

.btn-calculate:active { transform: translateY(0); }

/* ── Loading ─────────────────────────────────────────── */

.loading {
  display: none;
  text-align: center;
  padding: 3rem 2rem;
}

.loading p {
  color: var(--text-muted);
  margin-top: .75rem;
  font-size: .95rem;
}

/* ── Scenario sections ───────────────────────────────── */

.scenario-section {
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.scenario-section--featured {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.scenario-title {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.scenario-section--featured .scenario-title { color: #065f46; }

/* ── Stat boxes ──────────────────────────────────────── */

.stat-box {
  background: var(--card);
  padding: 1.2rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.stat-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

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

.stat-difference {
  display: inline-block;
  margin-top: .4rem;
  font-size: .73rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-light);
  padding: .15rem .6rem;
  border-radius: 999px;
}

.stat-difference:empty { display: none; }

/* ── Table ───────────────────────────────────────────── */

.table-container {
  max-height: 600px;
  overflow-y: auto;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.table-container::-webkit-scrollbar       { width: 6px; height: 6px; }
.table-container::-webkit-scrollbar-track { background: #f1f5f9; }
.table-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.table-container::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

table { font-size: .83rem; margin: 0 !important; }

thead { position: sticky; top: 0; z-index: 1; }

thead tr { background: linear-gradient(90deg, var(--primary) 0%, #1e40af 100%); }

thead th {
  color: rgba(255, 255, 255, .9) !important;
  padding: .85rem .9rem !important;
  font-size: .7rem !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .45px;
  border: none !important;
  white-space: nowrap;
}

tbody td {
  padding: .6rem .9rem !important;
  vertical-align: middle !important;
  border-color: #f1f5f9 !important;
}

tbody tr:hover { filter: brightness(.975); }

.type-monthly    { background: #fff; }
.type-additional { background: #fffbeb; }

.badge-type {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-monthly    { background: var(--primary-light); color: var(--primary-dark); }
.badge-additional { background: var(--warning-light); color: #92400e; }
