/* Escapade — mise en page mobile d'abord : texte 17 px, champs 52 px, boutons 48 px. */
:root {
  --bg: #f6f3ec;
  --paper: #fffdf8;
  --fg: #22261f;
  --muted: #5f6659;
  --line: #e2ddd0;
  --accent: #2f6b4f;        /* vert sapin */
  --accent-ink: #ffffff;
  --accent-soft: #e2efe6;
  --warm: #b4572e;          /* braise */
  --warm-soft: #f6e3d8;
  --maybe: #8a6d12;
  --maybe-soft: #f5ecc9;
  --danger: #a3342a;
  --r: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151813; --paper: #1e221c; --fg: #e9ece4; --muted: #a3ab9b; --line: #343a30;
    --accent: #7cc49d; --accent-ink: #10221a; --accent-soft: #23362b;
    --warm: #e79a74; --warm-soft: #3c2a20; --maybe: #e2c25b; --maybe-soft: #3a3320;
    --danger: #f08a7f; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.5 var(--font);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
body.no-tabs { padding-bottom: 32px; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.top {
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 12px; min-height: 56px;
}
.top .back { text-decoration: none; font-size: 1.4rem; line-height: 1; padding: 8px 8px 8px 0; }
.top .title { flex: 1; min-width: 0; }
.top .title b { display: block; font-family: var(--display); font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .title span { font-size: .85rem; color: var(--muted); }

main { max-width: 42rem; margin: 0 auto; padding: 20px 16px; display: grid; gap: 24px; }
section { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; box-shadow: var(--shadow); min-width: 0; }
.card.tight { padding: 12px 14px; }
.cards { display: grid; gap: 10px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* Formulaires */
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
label .hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  font: inherit; font-size: 17px; color: var(--fg); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 52px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px;
}
form.stack { display: grid; gap: 14px; }
.two { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 48px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

.btn {
  font: inherit; font-weight: 650; font-size: 1rem; border: 0; border-radius: 10px; cursor: pointer;
  min-height: 48px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--line); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: .92rem; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; text-decoration: underline; padding: 8px 0; cursor: pointer; min-height: 40px; }
.linkbtn.danger { color: var(--danger); }

details.add { background: var(--paper); border: 1.5px dashed var(--line); border-radius: var(--r); }
details.add[open] { border-style: solid; }
details.add > summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 650; color: var(--accent); min-height: 52px; display: flex; align-items: center; gap: 8px; }
details.add > summary::-webkit-details-marker { display: none; }
details.add > summary::before { content: "+"; font-size: 1.3rem; line-height: 1; }
details.add[open] > summary::before { content: "−"; }
details.add > form { padding: 0 16px 16px; }
details.edit > summary { list-style: none; cursor: pointer; }
details.edit > summary::-webkit-details-marker { display: none; }

.flash { border-radius: var(--r); padding: 12px 16px; background: var(--accent-soft); }
.flash.err { background: var(--warm-soft); color: var(--fg); }
.field-err { color: var(--danger); font-weight: 500; font-size: .9rem; }

/* Puces de choix (jour, créneau) */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--paper); color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; font-weight: 600; font-size: .95rem;
}
.chip[aria-current="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* Compteurs */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; font-family: var(--display); }
.stat span { font-size: .85rem; color: var(--muted); }
.count { font-variant-numeric: tabular-nums; font-weight: 650; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill.warm { background: var(--warm-soft); color: var(--warm); }
.pill.maybe { background: var(--maybe-soft); color: var(--maybe); }

/* Présences */
.fam-head { font-family: var(--display); font-size: 1.05rem; margin-top: 4px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 8px 8px 14px; }
.person .who { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.person .who small { color: var(--muted); }
.tri { display: flex; gap: 6px; flex: none; }
.tri button {
  width: 48px; height: 48px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg);
  font: inherit; font-size: 1.2rem; font-weight: 700; color: var(--muted); cursor: pointer;
}
.tri button[aria-pressed="true"][data-s="yes"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tri button[aria-pressed="true"][data-s="no"] { background: var(--warm); border-color: var(--warm); color: #fff; }
.tri button[aria-pressed="true"][data-s="maybe"] { background: var(--maybe-soft); border-color: var(--maybe); color: var(--maybe); }
.me-tag { font-size: .75rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; margin-left: 4px; }

/* Grille récapitulative */
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
table.grid { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
table.grid th:first-child, table.grid td:first-child { text-align: left; position: sticky; left: 0; background: var(--paper); }
table.grid thead th { font-weight: 650; color: var(--muted); font-size: .8rem; }

/* Courses */
.item { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px 6px 14px; min-height: 56px; }
.item form.tick { display: contents; }
.item .tickbtn { width: 32px; height: 32px; flex: none; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; font-size: 1.1rem; color: var(--accent-ink); }
.item.done .tickbtn { background: var(--accent); border-color: var(--accent); }
.item .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item.done .what b { text-decoration: line-through; color: var(--muted); }
.item .what small { display: block; color: var(--muted); }

/* Repas */
.meal { display: grid; gap: 8px; }
.meal .menu { white-space: pre-line; }
.meal .empty { color: var(--muted); font-style: italic; }

/* Comptes */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--accent); font-weight: 650; }
.neg { color: var(--warm); font-weight: 650; }

/* Barre d'onglets */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--paper); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a { text-decoration: none; color: var(--muted); display: grid; justify-items: center; gap: 2px; padding: 8px 2px 10px; font-size: .74rem; font-weight: 600; min-height: 60px; }
nav.tabs a svg { width: 24px; height: 24px; }
nav.tabs a[aria-current="page"] { color: var(--accent); }

.hero { display: grid; gap: 8px; }
.empty-state { text-align: center; padding: 28px 16px; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.invite { display: grid; gap: 10px; background: var(--accent-soft); border-radius: var(--r); padding: 16px; }
.invite code { font-size: .85rem; word-break: break-all; background: var(--paper); border-radius: 8px; padding: 8px 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 700px) {
  nav.tabs { max-width: 42rem; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 16px; left: 16px; right: 16px; }
}
