/*
 * Reanimatiecertificaat signature ("the register that keeps watch").
 * Load after kit.css + themes/reanimatiecertificaat.css (+ signature/safety.css for .zs-picto).
 * Elements: expiry timeline (register preview as hero), coverage per location against the RI&E minimum,
 * AED check card, state chip. Positions are percentages computed by the server; no JavaScript needed.
 */

/* ---------- State chip ---------- */
.rc-state { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 600; padding: .05rem .5rem; border-radius: var(--zs-radius-sm); white-space: nowrap; color: var(--rc-ok); background: #e3f1e9; }
.rc-state::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.rc-state.is-soon { color: var(--rc-soon); background: var(--rc-soon-bg); }
.rc-state.is-expired { color: var(--rc-expired); background: var(--rc-expired-bg); }

/* ---------- Expiry timeline: one row per certificate ----------
 * <div class="rc-timeline" style="--today: 18%">  axis months in .rc-timeline__axis, label in .rc-timeline__today
 * row: <div class="rc-row" style="--from: 0%; --to: 42%"> + notches style="--at: 30%" (90/30/7 days before expiry)
 */
.rc-timeline { position: relative; background: var(--zs-surface); border: 2px solid var(--zs-ink); border-radius: var(--zs-radius); padding: .9rem 1rem 1rem; }
.rc-timeline__head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--zs-ink); padding-bottom: .6rem; margin-bottom: .4rem; }
.rc-timeline__head h2 { font-size: 1.3rem; }
.rc-timeline__head p { margin: 0; font-size: .85rem; color: var(--zs-muted); }
.rc-row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) var(--state-w, 11.5rem); gap: .2rem 1rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--zs-line); }
.rc-row:last-of-type { border-bottom: 0; }
.rc-row__who strong { display: block; font-weight: 600; line-height: 1.2; }
.rc-row__who span { font-size: .8rem; color: var(--zs-muted); }
.rc-track { position: relative; height: .9rem; background: var(--zs-surface-alt); border-radius: 2px; }
.rc-track__bar { position: absolute; top: 0; bottom: 0; left: var(--from); width: calc(var(--to) - var(--from)); background: var(--rc-ok); border-radius: 2px; }
.rc-row.is-soon .rc-track__bar { background: var(--rc-soon); }
.rc-row.is-expired .rc-track__bar { background: var(--rc-expired); }
.rc-track__notch { position: absolute; top: -.2rem; bottom: -.2rem; left: var(--at); width: 2px; margin-left: -1px; background: var(--zs-surface); }
/* Today line: drawn in every track at --today (set once on .rc-timeline), so it reads as one line. */
.rc-track::after { content: ""; position: absolute; top: -.5rem; bottom: -.5rem; left: var(--today); border-left: 2px dashed var(--zs-ink); }
.rc-timeline__today { position: relative; grid-column: 2; height: 1.1rem; font-size: .75rem; font-weight: 600; }
.rc-timeline__today span { position: absolute; left: var(--today); transform: translateX(-50%); white-space: nowrap; }
.rc-timeline__axis { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) var(--state-w, 11.5rem); gap: 1rem; font-size: .75rem; color: var(--zs-muted); margin-top: .3rem; }
.rc-timeline__axis ol { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; grid-column: 2; }
.rc-timeline__legend { font-size: .78rem; color: var(--zs-muted); margin: .6rem 0 0; }
.rc-row .rc-state { justify-self: start; }
@media (max-width: 40rem) {
  .rc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .rc-row .rc-track { grid-column: 1 / -1; grid-row: 2; }
  .rc-timeline__axis { display: none; }
}

/* ---------- Coverage per location: one cell per required BHV'er ---------- */
.rc-coverage { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.rc-location { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem 1rem; align-items: baseline; padding-bottom: 1rem; border-bottom: 1px solid var(--zs-line); }
.rc-location h3 { font-size: 1.15rem; }
.rc-location__count { font: 700 1.1rem/1 var(--zs-font-display); font-variant-numeric: tabular-nums; }
.rc-location__count small { font: 400 .85rem var(--zs-font-body); color: var(--zs-muted); }
.rc-cells { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.rc-cells li { width: 2.2rem; height: 1.4rem; border-radius: 2px; background: var(--rc-ok); }
.rc-cells li.is-soon { background: var(--rc-soon); }
.rc-cells li.is-gap { background: transparent; border: 2px dashed var(--rc-expired); }
.rc-cells li.is-extra { background: color-mix(in srgb, var(--rc-ok) 45%, var(--zs-surface)); }
.rc-location__note { grid-column: 1 / -1; margin: 0; font-size: .88rem; color: var(--zs-muted); }
.rc-location__note b { color: var(--rc-expired); }

/* ---------- AED check card: 12 monthly checks + parts with expiry ---------- */
.rc-aed { background: var(--zs-surface); border: 2px solid var(--zs-ink); border-radius: var(--zs-radius); }
.rc-aed__head { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border-bottom: 2px solid var(--zs-ink); }
.rc-aed__head h3 { font-size: 1.2rem; }
.rc-aed__head p { margin: 0; font-size: .85rem; color: var(--zs-muted); }
.rc-months { list-style: none; margin: 0; padding: .9rem 1rem .5rem; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; text-align: center; font-size: .72rem; color: var(--zs-muted); }
.rc-months li::before { content: ""; display: block; aspect-ratio: 1; max-height: 2rem; margin: 0 auto .2rem; border-radius: 3px; background: var(--rc-ok); }
.rc-months li.is-missed::before { background: var(--rc-expired-bg); box-shadow: inset 0 0 0 2px var(--rc-expired); }
.rc-months li.is-due::before { background: transparent; box-shadow: inset 0 0 0 2px var(--zs-ink); }
.rc-months li.is-future::before { background: var(--zs-surface-alt); }
.rc-parts { margin: 0; padding: .3rem 1rem .9rem; display: grid; gap: .4rem; }
.rc-parts div { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border-top: 1px solid var(--zs-line); padding-top: .4rem; }
.rc-parts dt { font-weight: 600; }
.rc-parts dd { margin: 0; white-space: nowrap; display: flex; gap: .6rem; align-items: center; font-variant-numeric: tabular-nums; }
@media (max-width: 30rem) { .rc-parts div { flex-wrap: wrap; } .rc-parts dd { width: 100%; justify-content: space-between; } }
