:root {
  --chaux: #eff0ea;     /* mur chaulé : fond */
  --pierre: #d9dcd3;    /* pierre : traits et surfaces calmes */
  --cave: #232b2a;      /* ardoise de cave : texte et actions */
  --penicillium: #3e7c70; /* bleu-vert de la croûte : ce qui va bien */
  --cire: #b3261e;      /* cire rouge : ce qui demande de l'attention */
  --pate: #e6c65a;      /* paraffine : repère discret */
  --muted: #5a6562;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chaux);
  color: var(--cave);
  font: 1rem/1.5 var(--font);
  padding-bottom: 5rem;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 2rem; font-weight: 700; margin-bottom: .75rem; }
h2 { font-size: 1.35rem; font-weight: 700; margin: 2.25rem 0 .75rem; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 .75rem; max-width: 62ch; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

:focus-visible { outline: 3px solid var(--penicillium); outline-offset: 2px; }

/* Barre de navigation : en bas sur téléphone, en haut sur grand écran */
.bar {
  position: fixed; inset: auto 0 0 0; z-index: 5;
  display: flex; align-items: center; gap: .5rem;
  background: var(--cave); color: var(--chaux);
  padding: .25rem .5rem calc(.25rem + env(safe-area-inset-bottom));
}
.bar[hidden] { display: none; }
.brand { display: none; font: 700 1.1rem var(--font-display); text-decoration: none; }
.bar nav { display: flex; flex: 1; justify-content: space-around; }
.bar nav a {
  flex: 1; text-align: center; text-decoration: none; padding: .75rem .25rem; min-height: 44px;
  border-radius: 6px; font-size: .9rem;
}
.bar nav a[aria-current="page"] { background: rgba(239, 240, 234, .14); font-weight: 650; }
.bar .quiet { display: none; }

main { max-width: 52rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; outline: none; }

@media (min-width: 720px) {
  body { padding-bottom: 0; }
  .bar { position: static; padding: .5rem 1.25rem; gap: 1.5rem; }
  .brand { display: block; }
  .bar nav { flex: 0 1 auto; justify-content: flex-start; gap: .25rem; }
  .bar nav a { flex: 0 0 auto; padding: .5rem .9rem; font-size: 1rem; }
  .bar .quiet { display: block; margin-left: auto; }
  main { padding-top: 2rem; }
}

/* Boutons et champs */
button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: 44px; padding: .5rem 1rem; border-radius: 6px; cursor: pointer;
  border: 1.5px solid var(--cave); background: transparent;
}
button.primary { background: var(--cave); color: var(--chaux); }
button.danger { border-color: var(--cire); color: var(--cire); }
button.quiet { border-color: transparent; color: inherit; text-decoration: underline; min-height: 36px; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  min-height: 44px; padding: .45rem .6rem; width: 100%;
  background: #fbfbf8; border: 1.5px solid var(--pierre); border-radius: 6px;
}
textarea { min-height: 7rem; resize: vertical; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.field { margin-bottom: .75rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.row > * { flex: 1 1 9rem; }
.row > .fixed { flex: 0 0 auto; }

/* Listes : des lignes séparées par un trait, pas des cartes */
.list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--pierre); }
.list > li { border-bottom: 1.5px solid var(--pierre); padding: .75rem 0; }
.item { display: flex; align-items: center; gap: .75rem; }
.item .grow { flex: 1; min-width: 0; }
.item .name { font-weight: 650; }

.check {
  flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.2rem;
}
.check:hover { background: var(--penicillium); border-color: var(--penicillium); color: var(--chaux); }
.late { color: var(--cire); font-weight: 650; }
.tag { display: inline-block; font-size: .8rem; padding: .05rem .5rem; border-radius: 99px; background: var(--pierre); }

.notice { border-left: 5px solid var(--pate); background: #f6f1dc; padding: .6rem .9rem; margin: .75rem 0; border-radius: 0 6px 6px 0; }
.notice.warn { border-left-color: var(--cire); background: #f6e3e1; }
.notice ul { margin: .25rem 0 0; padding-left: 1.1rem; }

.empty { padding: 1.25rem 0; }

details { margin: .75rem 0; }
summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; }

/* Ruban des 14 jours : la pièce maîtresse de l'écran de planification */
.ribbon { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: .75rem 0; }
@media (min-width: 720px) { .ribbon { grid-template-columns: repeat(14, 1fr); } }
.day {
  min-height: 56px; padding: .25rem 0; border-radius: 6px; border: 1.5px dashed var(--pierre);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15;
  background: transparent; color: var(--muted);
}
.day .dow { font-size: .75rem; }
.day .num { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.day.fit { border: 1.5px solid var(--penicillium); background: #dfece8; color: var(--cave); }
.day.picked { border-color: var(--cire); background: var(--cire); color: var(--chaux); }
.day:disabled { opacity: 1; }

/* Tableau de disponibilité */
table { border-collapse: collapse; width: 100%; max-width: 26rem; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1.5px solid var(--pierre); }
td input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; }

#toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); z-index: 10;
  background: var(--cave); color: var(--chaux); padding: .6rem 1rem; border-radius: 6px; max-width: 90vw;
  opacity: 0; pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.error { background: var(--cire); }
@media (min-width: 720px) { #toast { bottom: 1.5rem; } }
@media (prefers-reduced-motion: no-preference) { #toast { transition: opacity .2s; } }

.login { max-width: 26rem; margin: 3rem auto; }
.login h1 { margin-bottom: .5rem; }
