/* Jetons de couleur : papier bleuté et encre indigo, comme une grille d'agenda du sommeil. */
:root {
  --paper: #edeff7;
  --surface: #f8f9fd;
  --ink: #1b2450;
  --muted: #5c6690;
  --line: #c9cee6;
  --kept: #2f3f9e;
  --simulated: #9aa5e0;
  --lost: #c2382b;
  --corrupt: #d98a00;
  --cell: 0.875rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12162b;
    --surface: #1a2040;
    --ink: #e6e9fa;
    --muted: #9ea7d0;
    --line: #38406e;
    --kept: #8e9bff;
    --simulated: #4d5aa8;
    --lost: #ff7a6b;
    --corrupt: #f0b440;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1.25rem calc(2.5rem + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
}

main { max-width: 40rem; margin: 0 auto; }

h1 { margin: 0 0 0.75rem; font-size: 1.125rem; font-weight: 600; color: var(--muted); }
h2 { margin: 2.5rem 0 0.75rem; font-size: 1rem; font-weight: 600; }

/* Le verdict est la phrase la plus importante de la page. */
.verdict { margin: 0; font-size: 1.625rem; line-height: 1.25; font-weight: 600; text-wrap: balance; }
.verdict[data-tone="bad"] { color: var(--lost); }
.verdict[data-tone="warn"] { color: var(--corrupt); }

/* Grille : une ligne par stockage, une colonne par jour, le plus récent à droite. */
.grid-scroll { overflow-x: auto; padding-bottom: 0.5rem; }
.grid { display: grid; grid-template-columns: max-content 1fr; gap: 0.375rem 0.75rem; align-items: center; width: max-content; }
.grid-label { font-size: 0.875rem; position: sticky; left: 0; background: var(--paper); padding-right: 0.25rem; }
.grid-row { display: flex; gap: 2px; }

.cell { display: inline-block; flex: none; width: var(--cell); height: var(--cell); border-radius: 2px; }
.cell[data-state="kept"] { background: var(--kept); }
.cell[data-state="simulated"] { background: var(--simulated); }
.cell[data-state="lost"] { background: var(--lost); }
.cell[data-state="corrupt"] { background: var(--corrupt); }
.cell[data-state="unopened"] { box-shadow: inset 0 0 0 1px var(--line); }

.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.5rem 0 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 0.375rem; }

.stores { margin: 1.25rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.stores li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.625rem 0; border-bottom: 1px solid var(--line); }
.stores .detail { color: var(--muted); text-align: right; }
.stores .detail[data-tone="bad"] { color: var(--lost); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

button {
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--ink);
  border-radius: 0.375rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.danger { border-color: var(--lost); color: var(--lost); }
button:focus-visible { outline: 3px solid var(--kept); outline-offset: 2px; }

.status { min-height: 1.5rem; margin: 0.75rem 0 0; color: var(--muted); }

textarea {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  background: var(--surface);
  color: var(--ink);
  font: 0.8125rem/1.4 ui-monospace, Menlo, Consolas, monospace;
}
