@font-face { font-family: "Saira Stencil One"; src: url("fonts/saira-stencil-one-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --container: #174a8b;
  --container-deep: #103665;
  --container-soft: #e4ecf6;
  --yard: #f2b705;
  --fog: #e9eef0;
  --surface: #ffffff;
  --ink: #14222e;
  --muted: #52616e;
  --line: #d3dbe1;
  --field: #9fadb9;
  --free: #17664b;
  --overdue: #a93a22;
  --overdue-2: #842a17;
  --overdue-3: #5e1c0e;
  --radius: 8px;
  --stencil: "Saira Stencil One", Impact, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font: 16px/1.5 Archivo, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
}

[hidden] { display: none !important; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--container); color: #fff; padding: 20px 0; border-bottom: 5px solid var(--yard); }
.brand { display: flex; gap: 14px; align-items: center; }
.brand img { width: 52px; height: 52px; flex: none; border-radius: 9px; box-shadow: 0 0 0 1px rgb(255 255 255 / .28); }
.site-header h1 { margin: 0; font: 400 1.4rem/1.15 var(--stencil); letter-spacing: .01em; }
.site-header p { margin: 4px 0 0; color: #d5e2f1; font-size: .92rem; line-height: 1.35; }
.brand a { color: inherit; text-decoration: none; }

.layout { display: grid; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.inputs, .outputs, #results { display: grid; gap: 16px; align-content: start; min-width: 0; }

.card { background: var(--surface); border-radius: var(--radius); padding: 18px 16px; min-width: 0; box-shadow: 0 1px 2px rgb(20 34 46 / .1); }
.card h2 { margin: 0 0 14px; font-size: 1.08rem; font-weight: 700; letter-spacing: -.005em; }

.field { display: block; margin: 0 0 14px; padding: 0; border: 0; font-size: .875rem; font-weight: 600; min-width: 0; }
.field legend { padding: 0; margin-bottom: 5px; }

input[type=number], input[type=date], input[type=email], select {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 5px;
  padding: 8px 11px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--field);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
input:hover, select:hover { border-color: var(--container); }
input:disabled { background: var(--fog); color: var(--muted); border-color: var(--line); }
:focus-visible { outline: 3px solid var(--yard); outline-offset: 2px; }

.grid-2 { display: grid; gap: 0 12px; }

.segmented { display: flex; gap: 3px; flex-wrap: wrap; padding: 3px; background: var(--fog); border-radius: 8px; }
.segmented label { flex: 1 1 120px; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 42px; height: 100%; padding: 6px 10px; border-radius: 6px; font-weight: 600; text-align: center; color: var(--muted); }
.segmented label:hover span { color: var(--ink); }
.segmented input:checked + span { background: var(--container); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--yard); outline-offset: 1px; }

.check { display: flex; gap: 9px; align-items: flex-start; margin: 0 0 14px; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--container); }

.hint { margin: 0 0 12px; color: var(--muted); font-size: .875rem; }
.hint:empty { display: none; }

.template-note { margin: 0 0 14px; padding: 10px 12px; background: var(--container-soft); border-radius: 6px; font-size: .875rem; }
.template-note p { margin: 0 0 4px; }
.template-note p:last-child { margin-bottom: 0; }
.template-note .is-alert { font-weight: 600; color: var(--overdue); }

.rows { display: grid; gap: 8px; margin-bottom: 12px; }
.rows:empty { display: none; }
.row { display: grid; gap: 8px; align-items: end; }
.row-tier { grid-template-columns: 1fr 1fr 1.3fr 46px; }
.row-suspension { grid-template-columns: 1fr 46px; }
.row-suspension .dates { display: grid; gap: 8px; min-width: 0; }
.row .field { margin: 0; font-size: .8rem; }
.row input { padding-left: 8px; padding-right: 6px; }

button { font: inherit; font-weight: 600; min-height: 46px; border-radius: 6px; cursor: pointer; padding: 8px 16px; }
.btn-primary { background: var(--container); border: 1px solid var(--container); color: #fff; }
.btn-primary:hover { background: var(--container-deep); }
.btn-secondary { background: #fff; border: 1px solid var(--container); color: var(--container); }
.btn-secondary:hover { background: var(--container-soft); }
.btn-remove { background: #fff; border: 1px solid var(--field); color: var(--muted); padding: 0; width: 46px; font-size: 1.2rem; line-height: 1; }
.btn-remove:hover { color: var(--overdue); border-color: var(--overdue); }

#errors { margin: 0; padding-left: 20px; color: var(--muted); font-size: .92rem; }

/* Signature: the result is a painted container wall, and its ribs below are the days. */
.hero-card { padding: 0; overflow: hidden; }
.hero-wall {
  padding: 22px 16px 20px;
  text-align: center;
  color: #fff;
  background-image: repeating-linear-gradient(90deg, rgb(255 255 255 / .06) 0 12px, rgb(0 0 0 / .06) 12px 24px);
}
.hero-label { margin: 0; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }
.hero-date { margin: 4px 0 6px; font: 400 clamp(2.7rem, 13vw, 4.2rem)/1.05 var(--stencil); font-variant-numeric: tabular-nums; }
.hero-countdown { margin: 0; font-size: 1.1rem; font-weight: 600; }
.tone-ok { background-color: var(--free); }
.tone-warn { background-color: var(--yard); color: var(--ink); }
.tone-danger { background-color: var(--overdue); }

.day-strip-area { padding: 14px 16px 16px; }
.day-strip { display: flex; gap: 3px; height: 42px; }
.day-strip.is-dense { gap: 1px; }
.day { flex: 1 1 0; min-width: 0; max-width: 28px; border-radius: 2px; }
.day-free { background: var(--free); }
.day-excess-0 { background: var(--overdue); }
.day-excess-1 { background: var(--overdue-2); }
.day-excess-2 { background: var(--overdue-3); }
.day-suspended, .swatch-suspended { background: repeating-linear-gradient(135deg, var(--field) 0 3px, #fff 3px 6px); box-shadow: inset 0 0 0 1px var(--field); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: .84rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 2px; }
.swatch-free { background: var(--free); }
.swatch-excess { background: var(--overdue); }

.notice { margin: 0; padding: 12px 14px; background: #fdf4d3; border-left: 4px solid var(--yard); border-radius: 4px; font-size: .9rem; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.stat-value { display: block; font: 400 2.2rem/1.1 var(--stencil); font-variant-numeric: tabular-nums; }
.stat-label { display: block; font-size: .82rem; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table-scroll { max-height: 340px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: .76rem; font-weight: 600; color: var(--muted); background: var(--surface); position: sticky; top: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.is-suspended td { color: var(--muted); font-style: italic; }

.totals { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin: 14px 0; padding: 14px; background: var(--container); color: #fff; border-radius: 6px; }
.totals .stat-label { color: #d5e2f1; }
.totals strong { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.marginal { margin: 0; font-weight: 600; }

.sim-result { margin: 0; font-weight: 600; }
.sim-result:empty { display: none; }

.actions { display: grid; gap: 10px; }
.actions .hint { margin: 0; }
.alert-form { padding-top: 12px; border-top: 1px solid var(--line); }
.alert-form button { width: 100%; margin-bottom: 8px; }

.disclaimer { margin: 0; padding: 12px 14px; border-left: 4px solid var(--container); background: var(--container-soft); border-radius: 4px; font-size: .9rem; }

.site-footer { padding: 8px 0 24px; font-size: .9rem; }
.site-footer p { margin: 6px 0 0; color: var(--muted); font-size: .84rem; }
a { color: var(--container); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Privacy page */
.prose { max-width: 720px; padding-top: 20px; padding-bottom: 32px; }
.prose h2 { margin: 24px 0 8px; font-size: 1.1rem; }
.prose li { margin-bottom: 6px; }

@media (min-width: 520px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .row-suspension .dates { grid-template-columns: 1fr 1fr; }
  .actions { grid-template-columns: auto 1fr; justify-content: start; }
  .actions .hint, .alert-form { grid-column: 1 / -1; }
}

@media (min-width: 960px) {
  .site-header h1 { font-size: 1.8rem; }
  .brand img { width: 60px; height: 60px; }
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; padding-top: 24px; gap: 24px; }
}
