/* À table ! — palette « nappe de jardin » : vert sauge, encre forêt, une couleur par type de plat */
:root {
  --paper:  #EEF1EA;
  --surface:#FFFFFF;
  --ink:    #1F2A22;
  --muted:  #5B695F;
  --herb:   #2F5D3A;
  --herb-2: #244A2E;
  --line:   #CFD8CC;
  --danger: #A33A2B;
  --radius-s: 6px;
  --radius-l: 14px;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans:  "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
}
a { color: var(--herb); text-underline-offset: 2px; }
a:hover { color: var(--herb-2); }
:focus-visible { outline: 3px solid var(--herb); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
.section-title { margin-top: 2.5rem; }
.muted { color: var(--muted); font-size: .92em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- En-tête ---------- */
header.site {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem;
  max-width: 1100px; margin: 0 auto; padding: 1.25rem 1.25rem .5rem;
}
.brand { font-family: var(--serif); font-size: 1.6rem; color: var(--ink); text-decoration: none; }
header nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: baseline; }
header nav a { color: var(--ink); text-decoration: none; padding-bottom: 2px; border-bottom: 2px solid transparent; }
header nav a[aria-current="page"], header nav a:hover { border-bottom-color: var(--herb); }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
footer.site { text-align: center; color: var(--muted); font-size: .9rem; padding: 2rem 1rem 3rem; }

/* ---------- Messages ---------- */
.flash { padding: .75rem 1rem; border-radius: var(--radius-s); margin: 0 0 1rem; background: var(--surface); border-left: 4px solid var(--herb); }
.flash-error { border-left-color: var(--danger); }
.errors { background: #FBEDEA; border-left: 4px solid var(--danger); border-radius: var(--radius-s); padding: .75rem 1rem .75rem 2rem; margin: 0 0 1.25rem; }
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-l); padding: 1.5rem; }

/* ---------- Formulaires ---------- */
.stack { display: grid; gap: .9rem; }
.row2 { display: grid; gap: .9rem; grid-template-columns: 1fr 1fr; }
label { display: grid; gap: .3rem; font-weight: 500; font-size: .95rem; }
label .muted { font-weight: 400; }
input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  padding: .6rem .7rem; background: #FAFBF8;
  border: 1px solid var(--line); border-radius: var(--radius-s);
}
input:focus, select:focus, textarea:focus { border-color: var(--herb); outline: 2px solid color-mix(in srgb, var(--herb) 30%, transparent); }
.btn {
  font: 600 1rem var(--sans); cursor: pointer;
  background: var(--herb); color: #fff; border: 0; border-radius: 999px;
  padding: .7rem 1.3rem; justify-self: start;
}
.btn:hover { background: var(--herb-2); }
.btn-quiet { background: transparent; color: var(--herb); box-shadow: inset 0 0 0 1.5px var(--herb); }
.btn-quiet:hover { background: var(--herb); color: #fff; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--herb); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
button.link.danger, .danger { color: var(--danger); }
form.inline { display: inline; }
.actions { display: flex; gap: 1rem; align-items: center; }
.narrow { max-width: 30rem; margin: 2rem auto; }

/* ---------- Liste des dates ---------- */
.dates { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.date-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 1.25rem; align-items: center;
  background: var(--surface); border-radius: var(--radius-l); padding: 1rem 1.25rem;
  color: inherit; text-decoration: none; border: 1px solid transparent;
}
.date-card:hover { border-color: var(--herb); }
.cal {
  display: grid; place-items: center; width: 4.2rem; padding: .35rem 0 .45rem;
  border-radius: var(--radius-s); background: var(--herb); color: #fff; font-size: .85rem; line-height: 1.1;
}
.cal b { font: 400 1.9rem/1 var(--serif); }
.date-body { display: grid; gap: .1rem; }
.date-body strong { font: 400 1.3rem var(--serif); }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; background: var(--paper); color: var(--muted); }
.tag-ok { background: #DCEBD8; color: var(--herb-2); }
.past { padding-left: 1.2rem; }
.past li { margin-bottom: .3rem; }

/* ---------- Page d'une date ---------- */
.event-head { max-width: 46rem; margin-bottom: 2rem; }
.event-when { color: var(--herb); font-weight: 600; margin: 0 0 .3rem; }
.event-where { font-size: 1.1rem; margin: -.2rem 0 .8rem; }
.event-desc { background: var(--surface); border-radius: var(--radius-s); padding: .8rem 1rem; margin-bottom: .8rem; max-width: 40rem; }

.event-layout, .profile-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 2rem; align-items: start; }

/* Le menu : chaque type de plat est une bande colorée, comme un rond de serviette */
.menu, .repertoire { background: var(--surface); border-radius: var(--radius-l); padding: 1.5rem 1.5rem .5rem; }
.missing { background: #FFF6DC; border-radius: var(--radius-s); padding: .6rem .9rem; margin: 0 0 1.25rem; }
.course { position: relative; padding: 0 0 1.25rem 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.course:last-child { border-bottom: 0; }
.course::before {
  content: ""; position: absolute; left: 0; top: .15rem; bottom: 1.25rem;
  width: 5px; border-radius: 3px; background: var(--c);
}
.course.is-empty::before { background: repeating-linear-gradient(var(--c) 0 6px, transparent 6px 11px); }
.course h3 { display: flex; align-items: baseline; gap: .5rem; color: var(--c); margin-bottom: .4rem; }
.course .count {
  font: 600 .8rem var(--sans); color: #fff; background: var(--c);
  min-width: 1.5rem; text-align: center; padding: .05rem .4rem; border-radius: 999px;
}
.course.is-empty .count { background: var(--line); color: var(--muted); }
.course ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.course li { display: grid; }
.course li strong { font-weight: 600; }
.details { color: var(--ink); font-size: .95rem; }
.who { color: var(--muted); font-size: .9rem; }
.course-empty { color: var(--muted); font-style: italic; margin: 0; }

.side { display: grid; gap: 1.25rem; }
.panel { background: var(--surface); border-radius: var(--radius-l); padding: 1.25rem 1.4rem; margin: 0; }
.panel-join { box-shadow: inset 0 0 0 2px var(--herb); }
.mine { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .5rem; }
.mine li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.chip { font-size: .78rem; font-weight: 600; color: #fff; background: var(--c); padding: .1rem .5rem; border-radius: 999px; margin-right: .3rem; white-space: nowrap; }
.add-dish { padding-top: 1rem; border-top: 1px solid var(--line); }
.comment-form { margin: 1.5rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.guests, .plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.guests li { display: grid; }
.quote { font-style: italic; color: var(--muted); }
.diet { font-size: .88rem; color: var(--herb-2); }

/* ---------- Tables admin ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius-l); margin-bottom: 2rem; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
tr.is-past td { color: var(--muted); }
.row-actions { white-space: nowrap; }
.row-actions > * + * { margin-left: .9rem; }

/* ---------- Statistiques ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; margin: 1.5rem 0; }
.filters label { min-width: 14rem; }
.kpis { list-style: none; padding: 0; margin: 0 0 1.5rem; display: flex; flex-wrap: wrap; gap: .75rem; }
.kpis li { background: var(--surface); border-radius: var(--radius-l); padding: .8rem 1.2rem; color: var(--muted); }
.kpis b { display: block; font: 400 1.9rem/1.1 var(--serif); color: var(--ink); }

.stats-table th, .stats-table td { vertical-align: middle; }
.stats-table .num { text-align: center; }
.stats-table thead th { font-size: .88rem; line-height: 1.25; }
.stats-table thead th.type { box-shadow: inset 0 -4px 0 var(--c); min-width: 6.5rem; }
.stats-table tbody th, .stats-table tfoot th { color: var(--ink); font-weight: 500; }
.stats-table tbody th a { color: inherit; }
.stats-table tbody th a:hover { color: var(--herb); }
.stats-table tfoot td, .stats-table tfoot th { font-weight: 600; border-top: 2px solid var(--line); }
a.sort { color: inherit; text-decoration: none; }
a.sort:hover { color: var(--herb); text-decoration: underline; }
th[aria-sort] { color: var(--ink); }
.cell-n {
  display: inline-block; min-width: 2rem; padding: .1rem .5rem; border-radius: 999px;
  font-weight: 600; background: color-mix(in srgb, var(--c) 20%, #fff); box-shadow: inset 0 0 0 1px var(--c);
}
.zero { color: var(--muted); opacity: .55; }
tr.is-idle th, tr.is-idle td { color: var(--muted); }
tr.is-selected th, tr.is-selected td { background: #E4EDE0; }
.bar { display: flex; gap: 2px; min-width: 9rem; height: .75rem; border-radius: 999px; overflow: hidden; background: var(--paper); }
.bar span { background: var(--c); min-width: 3px; }

.stats-detail { margin-top: 1rem; scroll-margin-top: 1rem; }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; }
.detail-head h2 { margin-bottom: .2rem; }

/* ---------- Parties de jeu ---------- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
a.btn { display: inline-block; text-decoration: none; }
a.btn:hover { color: #fff; }

.type-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; }
.type-filter a {
  --c: var(--herb);
  font-size: .88rem; font-weight: 600; text-decoration: none; color: var(--ink);
  padding: .25rem .75rem; border-radius: 999px; background: var(--surface);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent);
}
.type-filter a:hover { box-shadow: inset 0 0 0 1.5px var(--c); }
.type-filter a[aria-current] { background: var(--c); color: #fff; box-shadow: none; }

.game-card .cal { background: var(--c); }
.game-card:hover { border-color: var(--c); }
.game-card .chip { margin: 0; }

.manage { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: baseline; margin-top: .6rem; padding: .6rem .9rem; background: var(--surface); border-radius: var(--radius-s); }
.guests .tag { margin-left: .3rem; vertical-align: middle; }
button.link.small { font-size: .85rem; justify-self: start; }

.narrow.wide { max-width: 40rem; }
.type-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.type-pick legend { font-weight: 500; font-size: .95rem; margin-bottom: .4rem; padding: 0; }
.type-pick label { display: block; font-weight: 600; font-size: .9rem; cursor: pointer; }
.type-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.type-pick span {
  display: inline-block; padding: .35rem .85rem; border-radius: 999px; background: #FAFBF8;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 50%, transparent);
}
.type-pick label:hover span { box-shadow: inset 0 0 0 1.5px var(--c); }
.type-pick input:checked + span { background: var(--c); color: #fff; box-shadow: none; }
.type-pick input:focus-visible + span { outline: 3px solid var(--c); outline-offset: 2px; }
.danger-zone { margin-top: 1.5rem; text-align: right; }

.type-row { display: flex; gap: .6rem; align-items: center; }
.type-row input[name="label"] { min-width: 10rem; }
input[type="color"] { width: 2.8rem; height: 2.4rem; padding: .2rem; flex: none; cursor: pointer; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .event-layout, .profile-layout, .admin-layout { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .date-card { grid-template-columns: auto 1fr; }
  .date-card .tag { grid-column: 2; justify-self: start; }
}

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