/* Compteur — direction « Registre ». Tout passe par les jetons ; aucune couleur en dur ailleurs. */

@font-face { font-family: 'Bitter'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/bitter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/source-sans-3-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/source-sans-3-latin-600-normal.woff2') format('woff2'); }

:root {
  --papier: #f5f1e3;
  --feuille: #fffdf5;
  --encre: #1b2a4a;
  --encre-2: #4a5670;
  --marge: #b3261e;
  --ligne: #cbd5c5;
  --ok: #1f6b3a;

  --serif: 'Bitter', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius: 2px;
  --tap: 48px;
  --maxw: 880px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #161b2a;
    --feuille: #1e2538;
    --encre: #ede8d6;
    --encre-2: #b4bdd0;
    --marge: #ff8f86;
    --ligne: #34405a;
    --ok: #7fd49a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
}
:focus-visible { outline: 3px solid var(--marge); outline-offset: 2px; }

.page { max-width: var(--maxw); margin: 0 auto; padding: var(--s4) var(--s4) var(--s7); display: flex; flex-direction: column; gap: var(--s6); min-height: 100dvh; }

/* En-tête */
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-bottom: var(--s3); border-bottom: 2px solid var(--encre); }
.brand { display: flex; align-items: center; gap: var(--s3); font-family: var(--serif); font-weight: 700; font-size: 1.5rem; color: var(--encre); text-decoration: none; }
.brand svg { width: 36px; height: 36px; flex: none; }
.top nav a { color: var(--encre-2); font-weight: 600; text-decoration: none; padding: var(--s2) var(--s2); }
.top nav a:hover { color: var(--encre); text-decoration: underline; }

/* Typographie */
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.12; margin: 0; }
h1 { font-size: clamp(2.1rem, 8.5vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
p { margin: 0; }
.lede { font-size: 1.2rem; color: var(--encre-2); max-width: 36em; margin-top: var(--s4); }
.small { font-size: 0.9375rem; color: var(--encre-2); }

/* La feuille : papier clair, marge rouge à gauche (les filets viennent des tableaux, pas d'un fond ligné) */
.feuille {
  position: relative;
  background: var(--feuille);
  border: 1px solid var(--encre);
  border-radius: var(--radius);
  padding: var(--s5) var(--s4) var(--s5) var(--s6);
}
.feuille::before { content: ''; position: absolute; top: 0; bottom: 0; left: 18px; width: 2px; background: var(--marge); }
.feuille > * + * { margin-top: var(--s4); }

/* Chiffres clés */
.chiffres { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.chiffre b { display: block; font-family: var(--serif); font-size: clamp(2rem, 9vw, 3rem); line-height: 1; }
.chiffre span { display: block; margin-top: var(--s1); color: var(--encre-2); font-weight: 600; }
.chiffre .err { font-weight: 400; }

/* Sélecteur de période */
.periode { display: inline-flex; border: 1px solid var(--encre); border-radius: var(--radius); overflow: hidden; }
.periode button { min-width: var(--tap); min-height: 44px; padding: 0 var(--s3); background: transparent; border: 0; color: var(--encre); font: inherit; font-weight: 600; cursor: pointer; }
.periode button + button { border-left: 1px solid var(--encre); }
.periode button[aria-pressed='true'] { background: var(--encre); color: var(--feuille); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--encre-2); font-size: 0.9375rem; padding: 0 var(--s2) var(--s1) 0; }
td { padding: var(--s1) var(--s2) var(--s1) 0; vertical-align: middle; border-top: 1px solid var(--ligne); }
td.n, th.n { text-align: right; padding-right: 0; white-space: nowrap; }
td.cle { overflow-wrap: anywhere; }
.jour { white-space: nowrap; color: var(--encre-2); }

/* Pointage */
.pointage { display: block; height: 28px; }
.pointage line { stroke: var(--encre); stroke-width: 2; stroke-linecap: round; }
.pointage line.barre { stroke: var(--marge); }
.legende { font-size: 0.9375rem; color: var(--encre-2); }

/* Barres fines (pages, sources) */
.barre { height: 4px; background: var(--encre); border-radius: 2px; margin-top: 4px; }

.deux { display: grid; gap: var(--s6); grid-template-columns: 1fr; }
@media (min-width: 760px) { .deux { grid-template-columns: 1fr 1fr; } }

/* Preuves de vie privée */
.preuves { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.preuves li { padding-left: var(--s5); position: relative; }
.preuves li::before { content: '\2713'; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.jamais li::before { content: '\2715'; color: var(--marge); }
.tampon { display: inline-block; border: 2px solid var(--marge); color: var(--marge); padding: 2px var(--s3); font-family: var(--serif); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; transform: rotate(-2deg); border-radius: var(--radius); }

pre, code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.9375rem; }
pre { margin: 0; padding: var(--s3) var(--s4); background: var(--papier); border: 1px solid var(--encre); border-radius: var(--radius); overflow-x: auto; }

/* États */
.etat { padding: var(--s5) 0; color: var(--encre-2); }
.etat.erreur { color: var(--marge); font-weight: 600; }

.pied { margin-top: auto; padding-top: var(--s5); border-top: 2px solid var(--encre); display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; font-size: 0.9375rem; color: var(--encre-2); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
