*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #1a6b9a;
  --brand-light: #4dadd9;
  --brand-dark:  #0d4a6e;
  --bg:          #f8f9fa;
  --surface:     #ffffff;
  --border:      #dee2e6;
  --text:        #212529;
  --muted:       #6c757d;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(0,0,0,.08);
  --max-width:   900px;
  --green:       #2e7d32;
  --green-bg:    #e8f5e9;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Ad slots ─────────────────────────────────────────────── */
.ad-slot { width: 100%; }
.ad-slot--top {
  min-height: 90px;
  background: #f1f1f1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.ad-slot--inline { min-width: 300px; min-height: 250px; flex-shrink: 0; }
.ad-placeholder { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ad-placeholder--box {
  width: 300px; height: 250px; background: #f1f1f1;
  border: 1px dashed var(--border); display: flex;
  align-items: center; justify-content: center;
  font-size: .75rem; color: var(--muted);
}

/* ── Layout ─────────────────────────────────────────────── */
main { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1rem 4rem; }
header { margin-bottom: 1.75rem; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; color: var(--brand-dark); margin-bottom: .4rem; }
h2 { font-size: 1.1rem; font-weight: 600; color: var(--brand-dark); margin-bottom: 1rem; }
.subtitle { color: var(--muted); font-size: .95rem; }
.optional { font-weight: 400; color: var(--muted); font-size: .85rem; }

/* ── Cards ──────────────────────────────────────────────── */
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow); margin-bottom: 1.25rem;
}

/* ── Form grid ──────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.field-group { display: flex; flex-direction: column; gap: .35rem; }
.field-group label { font-weight: 600; font-size: .9rem; }

/* ── Input with suffix (kg) ─────────────────────────────── */
.input-suffix-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}
.input-suffix-wrapper:focus-within {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(77,173,217,.2);
}
.input-suffix-wrapper input {
  flex: 1;
  border: none;
  background: transparent;
  padding: .5rem .75rem;
  font-size: .95rem;
  color: var(--text);
  min-width: 0;
}
.input-suffix-wrapper input:focus { outline: none; }
.input-suffix {
  padding: .5rem .65rem;
  background: #eef2f5;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  user-select: none;
}

select, input[type="number"] {
  padding: .5rem .75rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .95rem; background: var(--bg); color: var(--text);
  width: 100%;
}
select:focus, input:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(77,173,217,.2); }

/* ── Radio group ────────────────────────────────────────── */
.radio-group { display: flex; gap: 1rem; }
.radio-label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .95rem; cursor: pointer; font-weight: 500;
}
.radio-label input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; }

.field-note { font-size: .8rem; color: var(--muted); }

/* ── Buttons ────────────────────────────────────────────── */
button {
  padding: .7rem 2rem; border: none; border-radius: 6px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: background .15s, transform .1s;
}
button:active { transform: scale(.98); }
#calc-btn { background: var(--brand); color: #fff; width: 100%; }
#calc-btn:hover { background: var(--brand-dark); }

/* ── Results layout ─────────────────────────────────────── */
.results-row {
  display: flex; gap: 1.5rem; align-items: flex-start;
  flex-wrap: wrap; margin-bottom: 1.25rem;
}

/* ── Chart card ─────────────────────────────────────────── */
.chart-card {
  flex: 1; min-width: 300px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.chart-wrapper { position: relative; width: 100%; }
.chart-legend {
  display: flex; gap: 1.25rem; margin-top: .75rem;
  font-size: .8rem; color: var(--muted);
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: .4rem; }
.legend-item--avg { color: var(--brand-dark); font-weight: 600; }
.legend-line {
  display: inline-block; width: 24px; height: 2px;
  background: var(--brand);
}
.legend-line--solid { background: var(--brand); }
.legend-line--dashed {
  background: none;
  border-top: 2px dashed rgba(77,173,217,.8);
}

/* ── Milestones ─────────────────────────────────────────── */
.milestones-row { margin-bottom: 1.25rem; }
.milestone-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.milestone-table { margin-bottom: 1rem; }
.ms-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.ms-row:last-child { border-bottom: none; }
.ms-row--header {
  font-weight: 700; font-size: .8rem; text-transform: uppercase;
  color: var(--muted); letter-spacing: .04em;
}

.goal-info {
  background: var(--green-bg);
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .9rem;
  color: var(--green);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.disclaimer {
  font-size: .8rem; color: var(--muted); line-height: 1.6;
  border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .25rem;
}

/* ── Validation ─────────────────────────────────────────── */
.error { color: #c0392b; font-size: .85rem; margin-top: .3rem; }
.invalid { border-color: #c0392b !important; }

/* ── FAQ ────────────────────────────────────────────────── */
.faq { margin-top: 2.5rem; }
details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .75rem;
}
details[open] { box-shadow: var(--shadow); }
summary {
  cursor: pointer; font-weight: 600; font-size: .95rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
summary::after { content: "+"; font-size: 1.2rem; color: var(--brand); }
details[open] summary::after { content: "−"; }
details p { margin-top: .75rem; color: var(--muted); font-size: .9rem; line-height: 1.7; }

/* ── Footer ─────────────────────────────────────────────── */
footer { text-align: center; padding: 1.5rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .results-row { flex-direction: column; }
  .ad-slot--inline { min-width: 100%; }
  .ad-placeholder--box { width: 100%; }
  .ms-row { grid-template-columns: 80px 1fr 1fr; font-size: .8rem; }
}
