/* Squachouffe booking system — ambiance « taverne de forêt » : bois sombre, bière, mousse,
   rouge du bonnet pour les actions. Mode clair si l'appareil le demande. */

:root {
  --ground: #1D1611; --surface: #2A2019; --raised: #352820; --deep: #15100C;
  --line: #3D2F25; --line2: #4A392C; --text: #F3E9DA; --muted: #C4B39C; --faint: #A8977F;
  --beer: #E3A23B; --beer-ink: #2A1A0E; --foam: #F3E9DA; --action: #D7372F; --action-ink: #FFFFFF;
  --ok: #9CCB72; --ko: #F08A6B; --note: #E6D8C3;
  --display: "Fraunces", Georgia, serif; --body: "Work Sans", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --ground: #F6EFE3; --surface: #FFFFFF; --raised: #F1E6D4; --deep: #EFE4D2;
    --line: #E2D3BC; --line2: #D3C0A3; --text: #2A1A0E; --muted: #6B5440; --faint: #7A6048;
    --foam: #FBF6EC; --action: #C02F28; --ok: #3F7A1E; --ko: #B23A1E; --note: #4A3A2C;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 16px/1.45 var(--body); }
a { color: var(--beer); }
@media (prefers-color-scheme: light) { a { color: #8A5A10; } }
h1, h2, h3 { margin: 0; }
h2 { font: 800 22px/1.2 var(--display); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--beer); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─── Habillage ─────────────────────────────────────────────────────────────────────── */

.app { min-height: 100vh; display: flex; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font: 800 22px var(--display); }

.top { position: relative; background: var(--beer); color: var(--beer-ink); padding: 18px 16px 34px; border-bottom: 8px solid var(--foam); }
.top::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px;
  background: radial-gradient(circle at 12px 14px, var(--foam) 11px, transparent 11.5px) 0 0 / 24px 14px repeat-x;
}
.top h1 { margin-top: 14px; font: 800 30px/1.08 var(--display); }
.top .sub { margin: 6px 0 0; font-weight: 500; }
.top-brand .brand { font-size: 20px; }

.content { width: 100%; max-width: 1100px; padding: 18px 16px 100px; display: flex; flex-direction: column; gap: 16px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: var(--deep); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); text-decoration: none; font-size: 12px; font-weight: 500;
}
.tabs a.on { color: var(--beer); }
@media (prefers-color-scheme: light) { .tabs a.on { color: #8A5A10; } }

@media (min-width: 700px) {
  .top { padding: 26px 40px 44px; }
  .top h1 { font-size: 40px; }
  .content { padding: 28px 40px 110px; }
  .tabs a { min-height: 72px; font-size: 13px; }
}
@media (min-width: 1100px) {
  .tabs, .top-brand { display: none; }
  .side {
    display: flex; flex-direction: column; gap: 6px; width: 260px; flex: none; padding: 28px 18px;
    background: var(--deep); border-right: 1px solid var(--line);
  }
  .side .brand { padding: 0 8px 22px; }
  .side nav { display: flex; flex-direction: column; gap: 4px; }
  .side nav a {
    display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 12px;
    color: var(--muted); text-decoration: none; font-weight: 500;
  }
  .side nav a.on { background: var(--surface); color: var(--beer); }
  .side .who { margin-top: auto; padding: 18px 8px 0; font-size: 14px; color: var(--faint); }
  .top { padding: 34px 48px 52px; }
  .top h1 { margin-top: 0; font-size: 46px; }
  .content { padding: 36px 48px 48px; }
}

/* ─── Blocs ─────────────────────────────────────────────────────────────────────────── */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lbl { font: 600 13px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.big { font: 800 20px var(--display); color: var(--beer); }
@media (prefers-color-scheme: light) { .big { color: #8A5A10; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid2.wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }
.block { display: block; }
.center { text-align: center; }
.note { margin: 0; padding: 12px 14px; background: var(--raised); border-radius: 12px; color: var(--note); font-size: 15px; }
.banner { flex-direction: row; flex-wrap: wrap; align-items: center; border-color: var(--beer); }
.flash { margin: 0; padding: 12px 16px; border-radius: 12px; font-weight: 500; }
.flash.ok { background: var(--raised); color: var(--ok); }
.flash.error, .error { color: var(--ko); }
.error { margin: 0; font-weight: 500; }
.prose p { margin: 0; line-height: 1.55; }

.btn, .btn2 {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 14px; font-weight: 600; font-size: 17px; text-decoration: none; cursor: pointer;
}
.btn { background: var(--action); color: var(--action-ink); border: 0; }
.btn2 { background: transparent; color: var(--text); border: 1.5px solid var(--line2); }
.btn.small, .btn2.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn2.danger { color: var(--ko); border-color: var(--ko); }
.btn2.armed { background: var(--ko); color: var(--ground); }
.btn:disabled, .btn2:disabled { opacity: .6; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  border-radius: 12px; border: 1.5px solid var(--line2); background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.pinned { color: var(--beer); border-color: var(--beer); }

.state { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: var(--faint); font-weight: 600; }
.state .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.state.on { color: var(--ok); }
.state.bad { color: var(--ko); }
.state.small { min-height: 0; padding: 0; font-size: 14px; }
button.state { cursor: pointer; border: 1.5px solid var(--line2); }

.seg { display: flex; gap: 6px; padding: 5px; background: var(--deep); border-radius: 16px; }
.seg button { flex: 1; min-height: 46px; border: 0; border-radius: 12px; background: transparent; color: var(--faint); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--raised); color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line2); font-weight: 500; }
.chip.pick { cursor: pointer; color: var(--text); }

.rows, .results, .partners, .list, .found { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: baseline; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .day { width: 78px; flex: none; font: 800 18px var(--display); }
.rows .what { font-weight: 600; }
.results li { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; }
.results li svg { flex: none; margin-top: 2px; }
.results .ok svg { color: var(--ok); }
.results .ko svg { color: var(--ko); }

.partners li { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.partners .pname, .list .pname, .found .pname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--beer); color: var(--beer-ink); font-size: 14px; font-weight: 700; }
.partners .spare .num { background: var(--line2); color: var(--text); }
.row-actions { display: flex; gap: 6px; }

.list li, .found li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child, .found li:first-child { border-top: 0; }
.card.list { padding: 6px 20px; gap: 0; }
.av { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--raised); color: var(--beer); font: 800 17px var(--display); }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 15px; font-weight: 600; color: var(--note); }
input:not([type=checkbox]), select {
  width: 100%; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line2);
  background: var(--deep); color: var(--text); font-size: 17px;
}
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--action); }
.slot { display: flex; gap: 10px; align-items: center; }
.slot select { flex: 1; }
.search { display: flex; gap: 10px; }
.search input { flex: 1; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; }
.inline input { flex: 1 1 200px; width: auto; }
.linkbox { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--raised); border-radius: 14px; }
.linkbox p { margin: 0; }
.hint { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 15px; color: var(--note); }
.hint svg { flex: none; color: var(--beer); margin-top: 2px; }

.courts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; justify-items: center; padding-top: 8px; }
.court {
  position: relative; width: 100%; max-width: 60px; height: 50px; border-radius: 12px; border: 1.5px solid var(--line2);
  background: var(--deep); color: var(--muted); font-weight: 600; font-size: 17px; cursor: pointer;
}
.court.on { background: var(--beer); border-color: var(--beer); color: var(--beer-ink); }
.rank { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--action); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }

.wait { display: inline-flex; align-items: center; gap: 6px; color: var(--beer); font-weight: 600; }
@media (prefers-color-scheme: light) { .wait { color: #8A5A10; } }

/* ─── Pages sans menu (connexion, invitation) ───────────────────────────────────────── */

.bare { max-width: 520px; margin: 0 auto; padding: 40px 16px 48px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.bare h1 { font: 800 32px/1.1 var(--display); text-align: center; }
.bare .card { width: 100%; }
.logo { width: min(300px, 70vw); height: auto; }
.lbl .small { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Choix d'une personne : suggestions sous le champ, lignes larges pour le doigt */
.picker { position: relative; display: flex; flex-direction: column; gap: 6px; }
.picker-icon { position: absolute; left: 14px; top: 15px; color: var(--faint); pointer-events: none; }
.picker input { padding-left: 44px; }
.suggest { list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1.5px solid var(--line2); border-radius: 14px; max-height: 50vh; overflow-y: auto; }
.suggest-item {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; font-size: 16px; cursor: pointer;
}
.suggest-item:hover, .suggest-item:focus-visible { background: var(--raised); }
.suggest-item svg { color: var(--beer); flex: none; }
.warn { color: var(--beer); }
@media (prefers-color-scheme: light) { .warn { color: #8A5A10; } }
.chip.warned { border-color: var(--beer); }
.icon-btn.money { font-weight: 700; font-size: 17px; }
.icon-btn.warned { color: var(--beer); border-color: var(--beer); }

/* Disponibilités sous chaque heure */
.slot-block { display: flex; flex-direction: column; gap: 6px; }
.avail { margin: 0; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.avail p, p.avail { margin: 0; display: flex; align-items: center; gap: 6px; }
.avail.ok { color: var(--ok); }
.avail.ko > p { color: var(--ko); }
.avail .chips { align-items: center; }
.form.subtle { padding: 14px; background: var(--raised); border-radius: 14px; }
