:root {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --brand: #dc2626;
  --border: #e2e8f0;
  --green-bg: #dcfce7;
  --green-text: #166534;
  --red-bg: #fee2e2;
  --red-text: #991b1b;
  --c-today: #475569;
  --c-init: #c2410c;
  --c-ind: #2563eb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap { width: min(1040px, 94vw); margin: 0 auto; padding: 28px 0 56px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.site-title { font-size: 1.1rem; font-weight: 800; color: var(--brand); text-decoration: none; }
.lang-switch { display: flex; gap: 6px; }
.lang-switch a {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; font-weight: 600; text-decoration: none;
}
.lang-switch a[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.hero { margin-bottom: 20px; }
.eyebrow { color: var(--brand); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.15; margin: 6px 0 8px; letter-spacing: -0.02em; }
.initiative-name { font-weight: 600; margin: 0 0 8px; }
.intro { color: var(--muted); margin: 0; max-width: 70ch; }

.grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.grid > *, .info > * { min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 1.1rem; margin: 0 0 14px; }
.card h3 { font-size: 0.95rem; margin: 18px 0 6px; }
.muted { color: var(--muted); font-size: 0.875rem; margin: -8px 0 10px; }

.field { display: block; margin-bottom: 14px; }
.label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.hint, .help { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 4px; }
.help { margin: -4px 0 14px; }

.money { display: flex; align-items: center; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; background: #fff; }
.money:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.money input { flex: 1; min-width: 0; border: 0; padding: 10px 12px; font: inherit; font-size: 1.05rem; font-weight: 600; outline: none; }
.unit { padding: 0 10px; color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

input[type="range"] { width: 100%; accent-color: var(--brand); }

.seg { display: flex; border: 1px solid #cbd5e1; border-radius: 10px; overflow: hidden; }
.seg button {
  flex: 1; border: 0; background: #fff; padding: 8px 6px; font: inherit; font-size: 0.85rem;
  color: var(--muted); cursor: pointer; border-left: 1px solid #e2e8f0;
}
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--brand); color: #fff; font-weight: 600; }
.seg button:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: -4px 0 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.check .label { margin-bottom: 0; }
.check .hint { margin-top: 2px; }

.actions { display: flex; gap: 14px; margin-top: 6px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--muted); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }
.tile { border: 1px solid var(--border); border-top: 4px solid var(--c-today); border-radius: 12px; padding: 12px; }
.tile.t-init { border-top-color: var(--c-init); }
.tile.t-ind { border-top-color: var(--c-ind); }
.tile-title { font-size: 0.85rem; font-weight: 700; }
.tile-amount { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; margin: 4px 0; font-variant-numeric: tabular-nums; }
.tile-sub, .tile-when { color: var(--muted); font-size: 0.75rem; }
.tile-when { margin-top: 2px; font-style: italic; }
.delta { display: inline-block; font-size: 0.78rem; font-weight: 700; border-radius: 6px; padding: 1px 6px; background: #f1f5f9; color: var(--muted); margin-bottom: 4px; }
.delta.down { background: var(--green-bg); color: var(--green-text); }
.delta.up { background: var(--red-bg); color: var(--red-text); }

.penalty { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: #f8fafc; font-size: 0.9rem; }
.penalty.is-penalty { background: #fff7ed; }
.penalty.is-bonus { background: #f0fdf4; }

.details { margin-top: 14px; }
.details summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.details table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.85rem; }
.details td { padding: 7px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.details td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.details tr.charged td { font-weight: 700; }
.details tr.total td { font-weight: 700; color: var(--c-init); }
.details .sub { color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.note { color: var(--muted); font-size: 0.78rem; margin: 8px 0 0; }
.error { color: var(--red-text); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.8rem; margin-bottom: 6px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #e2e8f0; stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .axis { fill: var(--muted); font-size: 12px; }
.line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.line.c-today, .dot.c-today { stroke: var(--c-today); }
.line.c-init, .dot.c-init { stroke: var(--c-init); }
.line.c-ind, .dot.c-ind { stroke: var(--c-ind); }
.dot { fill: #fff; stroke-width: 2.5; }
.chart .you { stroke: #94a3b8; stroke-dasharray: 3 3; }
.chart .you-label { fill: var(--muted); font-size: 11px; font-weight: 600; }

.info { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .info { grid-template-columns: minmax(0, 1fr); } }
.info .card { margin-bottom: 0; }
.prose p, .prose li { font-size: 0.9rem; color: #1e293b; }
.prose ul { padding-left: 18px; margin: 0; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--brand); }

footer { margin-top: 28px; text-align: center; color: var(--muted); font-size: 0.8rem; }
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }
.footer-row { margin-bottom: 4px; }
