/* Thème : une façade d'immeuble la nuit. Chaque créneau est une fenêtre qui
   s'allume d'autant plus fort que le groupe est nombreux à être dispo. */
:root {
  --night: #1b1838;
  --panel: #252148;
  --panel-2: #2e2958;
  --line: #3d3770;
  --window: #2f2a5c;
  --text: #efecff;
  --muted: #a7a2d1;
  --lamp: #ffc857;
  --lamp-ink: #3a2600;
  --go: #5fe3b0;
  --go-ink: #04261a;
  --danger: #ff7d8a;
  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 20px;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --night: #ecE9f7;
    --panel: #ffffff;
    --panel-2: #f4f1fc;
    --line: #d6d0ee;
    --window: #e2ddf3;
    --text: #1e1a3d;
    --muted: #615b8c;
    --lamp: #f5a623;
    --lamp-ink: #2e1c00;
    --go: #1fa774;
    --go-ink: #ffffff;
    --danger: #c9354a;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  min-height: 100dvh;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); max-width: 70ch; margin: 0.25rem 0 1rem; }
.error { color: var(--danger); margin: 0; min-height: 1.2em; }
.mt { margin-top: 2.5rem; }
.stack { display: grid; gap: 0.9rem; }
.stack-lg { display: grid; gap: 1.6rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.emoji-row { grid-template-columns: 5.5rem 1fr; }
:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }

/* ---------- champs et boutons ---------- */
label { display: grid; gap: 0.3rem; font-weight: 700; font-size: 0.92rem; }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 0.6rem 0.7rem; width: 100%; min-width: 0;
}
input[type=color] { padding: 0.15rem; width: 3rem; height: 2.4rem; }
.color-field { display: flex; align-items: center; gap: 0.6rem; }
.btn {
  font: 700 0.95rem var(--font-body); color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.6rem 1.1rem; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--lamp); color: var(--lamp-ink); border-color: var(--lamp); }
.btn.go { background: var(--go); color: var(--go-ink); border-color: var(--go); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.btn.icon { width: 2.4rem; height: 2.4rem; padding: 0; display: grid; place-items: center; font-size: 1.2rem; }

/* ---------- connexion ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 16px; }
.login-card { width: min(100%, 26rem); }
.login-card h1 { font-size: clamp(2.2rem, 9vw, 3.2rem); font-weight: 800; margin: 1.25rem 0 0.5rem; }
.login-card form { margin-top: 1.5rem; }
.facade { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: 11rem; }
.facade i { aspect-ratio: 1; border-radius: 4px; background: var(--window); }
.facade i.on { background: var(--lamp); box-shadow: 0 0 14px color-mix(in oklab, var(--lamp) 55%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .facade i.on { animation: light-up 0.5s ease-out both; }
  .facade i.on:nth-child(2) { animation-delay: 0.1s; } .facade i.on:nth-child(4) { animation-delay: 0.35s; }
  .facade i.on:nth-child(5) { animation-delay: 0.2s; } .facade i.on:nth-child(7) { animation-delay: 0.5s; }
  .facade i.on:nth-child(10) { animation-delay: 0.3s; } .facade i.on:nth-child(11) { animation-delay: 0.6s; }
  .facade i.on:nth-child(12) { animation-delay: 0.45s; }
}
@keyframes light-up { from { background: var(--window); box-shadow: none; } }

/* ---------- structure ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 16px 0.5rem; max-width: 72rem; margin: 0 auto;
}
.brand { font-size: 1.35rem; font-weight: 800; }
.me-pill {
  display: flex; align-items: center; gap: 0.5rem; cursor: pointer;
  font: 700 0.95rem var(--font-body); color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.9rem 0.35rem 0.4rem;
}
.dot { width: 0.85rem; height: 0.85rem; border-radius: 50%; display: inline-block; flex: none; }
.me-pill .dot { width: 1.5rem; height: 1.5rem; }

.tabs {
  display: flex; gap: 0.25rem; padding: 0.5rem 16px; max-width: 72rem; margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  font: 700 0.95rem var(--font-body); color: var(--muted); background: none; border: 0;
  padding: 0.55rem 0.9rem; border-radius: 999px; cursor: pointer; display: flex; gap: 0.4rem; align-items: center;
}
.tabs button.active { color: var(--text); background: var(--panel-2); }
.tabs .mobile { display: none; }
.count { font: 700 0.72rem var(--font-body); background: var(--lamp); color: var(--lamp-ink); border-radius: 999px; padding: 0 0.4rem; min-width: 1.2rem; text-align: center; }
.content { max-width: 72rem; margin: 0 auto; padding: 1.25rem 16px 6rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
.week-nav { display: flex; align-items: center; gap: 0.5rem; }
.week-nav h2 { font-size: 1.25rem; min-width: 11ch; text-align: center; }

/* Sur téléphone : onglets en bas d'écran */
@media (max-width: 640px) {
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; justify-content: space-around;
    background: var(--panel); border-top: 1px solid var(--line); border-bottom: 0;
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
  }
  .tabs button { flex-direction: column; gap: 0.1rem; font-size: 0.72rem; padding: 0.35rem 0.4rem; border-radius: var(--radius-m); }
  .tabs button span { font-size: 1.2rem; }
  .tabs .mobile { display: flex; }
  .tabs .desk { display: none !important; }
  .tabs button { position: relative; }
  .tabs .count { position: absolute; top: 0; right: 0.1rem; }
  .me-pill .name { display: none; }
  .me-pill { padding: 0.35rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .week-nav { justify-content: space-between; }
}

.segmented { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.segmented button {
  font: 700 0.9rem var(--font-body); color: var(--muted); background: none; border: 0;
  padding: 0.45rem 0.9rem; border-radius: 999px; cursor: pointer; flex: 1; white-space: nowrap;
}
.segmented button[aria-checked=true] { background: var(--lamp); color: var(--lamp-ink); }

/* ---------- la façade (grille des créneaux) ---------- */
.grid-wrap { overflow-x: auto; margin: 0 -16px; padding: 0.25rem 16px 0.75rem; }
.grid {
  display: grid; grid-template-columns: 2.6rem repeat(7, minmax(3.6rem, 1fr));
  gap: 5px; min-width: 30rem; user-select: none; -webkit-user-select: none;
}
.grid .head { text-align: center; font-size: 0.85rem; color: var(--muted); padding-bottom: 0.25rem; line-height: 1.2; }
.grid .head b { display: block; color: var(--text); font-family: var(--font-display); font-size: 1rem; }
.grid .head.today b { color: var(--lamp); }
.grid .hour { font-size: 0.78rem; color: var(--muted); text-align: right; padding-right: 0.3rem; align-self: center; font-variant-numeric: tabular-nums; }
.grid .hour.night { color: color-mix(in oklab, var(--muted) 70%, var(--night)); }
.cell {
  --g: 0;
  position: relative; height: 2.2rem; border-radius: var(--radius-s); border: 0; padding: 0;
  font: 700 0.85rem var(--font-body); font-variant-numeric: tabular-nums; cursor: pointer;
  background: color-mix(in oklch, var(--lamp) calc(var(--g) * 100%), var(--window));
  color: var(--muted);
}
.cell.lit { color: var(--lamp-ink); }
.cell.blaze { box-shadow: 0 0 16px color-mix(in oklab, var(--lamp) 50%, transparent); }
.cell.past { opacity: 0.4; }
.cell .badge { position: absolute; top: -6px; right: -4px; font-size: 0.85rem; line-height: 1; }
.cell.mine::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: currentColor; }

/* Mode "remplir mes dispos" */
.grid.edit { touch-action: none; }
.grid.edit .cell { background: var(--window); color: transparent; }
.grid.edit .cell.on { background: var(--me, var(--lamp)); }
.grid.edit .cell.on.habit { background: color-mix(in oklab, var(--me, var(--lamp)) 65%, var(--window)); }
.grid.edit .cell.off-explicit { background: repeating-linear-gradient(135deg, var(--window) 0 6px, var(--panel) 6px 9px); }
.grid.edit .cell::after { display: none; }
.habits { grid-template-columns: 2.6rem repeat(7, minmax(3rem, 1fr)); }

.legend { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch { width: 1.1rem; height: 0.8rem; border-radius: 3px; display: inline-block; }

/* ---------- sessions / idées / jeux ---------- */
.day-group h3 { font-size: 1.05rem; color: var(--muted); font-weight: 700; margin-bottom: 0.6rem; }
.day-group h3 b { color: var(--text); }
.items { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem; display: grid; gap: 0.7rem; }
.item-head { display: flex; gap: 0.75rem; align-items: center; }
.item-head .emoji { font-size: 1.8rem; line-height: 1; }
.item-head h4 { margin: 0; font: 700 1.1rem var(--font-display); }
.item-head p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.status { margin-left: auto; font-size: 0.8rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.status.wait { background: var(--panel-2); color: var(--muted); }
.status.ok { background: var(--go); color: var(--go-ink); }
.status.full { background: var(--lamp); color: var(--lamp-ink); }

/* Jauge de remplissage : le repère indique le minimum de joueurs */
.gauge { position: relative; height: 0.6rem; border-radius: 999px; background: var(--window); }
.gauge .fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--muted); }
.gauge.ok .fill { background: var(--go); }
.gauge.full .fill { background: var(--lamp); }
.gauge .min { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; }
.gauge-label { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); margin-top: -0.35rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; padding: 0.15rem 0.6rem 0.15rem 0.3rem; background: var(--panel-2); border-radius: 999px; }
.chip.me { outline: 1px solid var(--muted); }
.note { margin: 0; font-size: 0.9rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.empty { border: 1px dashed var(--line); border-radius: var(--radius-m); padding: 1.5rem; color: var(--muted); max-width: 40rem; }
.empty strong { color: var(--text); display: block; font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 0.25rem; }

.game-list { display: grid; gap: 0.6rem; max-width: 44rem; }
.game-row { display: flex; align-items: center; gap: 0.9rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.75rem 1rem; }
.game-row .emoji { font-size: 1.6rem; }
.game-row h4 { margin: 0; font: 700 1.05rem var(--font-display); }
.game-row p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.game-row .btn { margin-left: auto; }

/* ---------- fenêtres ---------- */
dialog.sheet {
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--panel); color: var(--text);
  padding: 0; width: min(100% - 32px, 30rem); max-height: 90dvh;
}
dialog.sheet::backdrop { background: rgb(10 8 25 / 0.6); }
.sheet-body { padding: 1.1rem 1.25rem 1.4rem; display: grid; gap: 0.9rem; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sheet-section h4 { margin: 0 0 0.4rem; font: 700 0.95rem var(--font-body); color: var(--muted); }
@media (max-width: 640px) {
  dialog.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--radius-l) var(--radius-l) 0 0; border-bottom: 0; }
  .sheet-body { padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }
}

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--night); font-weight: 700; padding: 0.6rem 1.1rem; border-radius: 999px;
  transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); color: #fff; }
@media (max-width: 640px) { .toast { bottom: 5.5rem; } }

/* Téléphone : la semaine entière tient dans l'écran */
@media (max-width: 640px) {
  .grid, .habits { grid-template-columns: 2.1rem repeat(7, minmax(0, 1fr)); gap: 3px; min-width: 0; }
  .grid .head { font-size: 0.75rem; }
  .grid .hour { font-size: 0.7rem; padding-right: 0.15rem; }
  .cell { height: 2rem; font-size: 0.78rem; }
}

/* ===================== Version 2 ===================== */

textarea { resize: vertical; line-height: 1.4; }
small.muted { font-weight: 400; font-size: 0.82rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.1rem; max-width: 44rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.75rem 1rem 1rem; margin: 0; display: grid; gap: 0.7rem; min-width: 0; }
legend { font-weight: 700; padding: 0 0.35rem; color: var(--muted); font-size: 0.9rem; }
details summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.dot.big { width: 2.2rem; height: 2.2rem; }

/* Cases à cocher */
.check { display: flex; align-items: flex-start; gap: 0.6rem; font-weight: 400; font-size: 0.95rem; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin: 0.15rem 0 0; accent-color: var(--lamp); flex: none; }
.check span { display: grid; gap: 0.1rem; }
.check.end { align-self: end; padding-bottom: 0.6rem; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.5rem; }

/* Connexion */
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.or { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.85rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Filtres */
.filters { display: grid; gap: 0.5rem; margin: 0.25rem 0 1.25rem; }
.pill {
  font: 700 0.85rem var(--font-body); color: var(--muted); background: var(--panel); cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem;
}
.pill.on { color: var(--text); border-color: var(--c, var(--lamp)); box-shadow: inset 0 0 0 1px var(--c, var(--lamp)); background: color-mix(in oklab, var(--c, var(--lamp)) 18%, var(--panel)); }
.tag {
  margin-left: auto; white-space: nowrap; font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px;
  background: color-mix(in oklab, var(--c, var(--muted)) 22%, transparent); color: var(--text);
}

/* Bandeau des événements au-dessus de la grille */
.grid-head { margin-bottom: 6px; }
.event-strip {
  display: grid; grid-template-columns: 2.6rem repeat(7, minmax(3.6rem, 1fr)); grid-auto-flow: row dense;
  gap: 4px 5px; min-width: 30rem; margin-bottom: 6px;
}
.strip-label { grid-column: 1; grid-row: 1; font-size: 0.85rem; text-align: right; padding-right: 0.3rem; align-self: center; }
.event-pill {
  display: flex; align-items: center; gap: 0.35rem; min-width: 0; cursor: pointer; text-align: left;
  font: 700 0.8rem var(--font-body); color: var(--text);
  background: color-mix(in oklab, var(--c) 30%, var(--panel)); border: 1px solid color-mix(in oklab, var(--c) 70%, transparent);
  border-radius: var(--radius-s); padding: 0.3rem 0.5rem;
}
.event-pill .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Cartes d'événement */
.item.event { border-left: 4px solid var(--c); }
.desc { margin: 0; font-size: 0.95rem; white-space: pre-line; }

/* Plus (téléphone) */
.more-list { display: grid; gap: 0.6rem; margin-top: 1rem; max-width: 30rem; }
.more-list button {
  display: flex; gap: 0.75rem; align-items: center; text-align: left; cursor: pointer;
  font: 700 1.05rem var(--font-body); color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-m); padding: 1rem;
}

/* Compte */
.account-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; }
.account-head h4, .pin-form h4 { margin: 0; font: 700 1.1rem var(--font-display); }
.account-head p { margin: 0; }
.account-head .color-field { margin-left: auto; }
.copy-row { display: flex; gap: 0.5rem; }
.copy-row input { font-size: 0.85rem; color: var(--muted); }

/* Sondages */
.poll-options { display: grid; gap: 0.4rem; }
.poll-opt {
  position: relative; display: flex; align-items: center; gap: 0.6rem; overflow: hidden; cursor: pointer;
  font-weight: 400; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.55rem 0.7rem;
}
.poll-opt input { position: relative; z-index: 1; accent-color: var(--lamp); width: 1.1rem; height: 1.1rem; margin: 0; flex: none; }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in oklab, var(--lamp) 22%, transparent); transition: width 0.3s; }
.poll-opt .lbl, .poll-opt .n { position: relative; }
.poll-opt .n { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.poll-opt.win { border-color: var(--lamp); }
.poll-opt.win .lbl::after { content: ' 🏆'; }
.poll.closed .poll-opt { cursor: default; }
.options-box .opt-rows { display: grid; gap: 0.5rem; }
.opt-row { display: flex; gap: 0.5rem; align-items: center; }
.opt-row input[type=date] { flex: 1.3; }
.opt-row select, .opt-row input:not([type=date]) { flex: 1; }
.opt-row .btn.icon { flex: none; width: 2.2rem; height: 2.2rem; font-size: 0.9rem; }
@media (prefers-reduced-motion: reduce) { .poll-opt .bar { transition: none; } }

/* Administration */
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 1rem 0 1.25rem; }
.admin-nav button {
  font: 700 0.9rem var(--font-body); color: var(--muted); background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.9rem;
}
.admin-nav button[aria-selected=true] { color: var(--lamp-ink); background: var(--lamp); border-color: var(--lamp); }
.table-wrap { overflow-x: auto; }
.perm-table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
.perm-table th { text-align: left; color: var(--muted); font-size: 0.85rem; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
.perm-table th:not(:first-child), .perm-table td:not(:first-child) { text-align: center; width: 7rem; }
.perm-table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent); }
.perm-table input { width: 1.15rem; height: 1.15rem; accent-color: var(--lamp); }
.panel .toolbar { margin: 0; }
.cat-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-row {
  display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font: 700 0.92rem var(--font-body); color: var(--text);
  background: color-mix(in oklab, var(--c) 18%, var(--panel-2)); border: 1px solid color-mix(in oklab, var(--c) 60%, transparent);
  border-radius: 999px; padding: 0.35rem 0.85rem 0.35rem 0.6rem;
}
.cat-row .muted { font-weight: 400; font-size: 0.82rem; }
.member-list { display: grid; gap: 0.6rem; max-width: 56rem; }
.member-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem 0.9rem; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.75rem 1rem;
}
.member-row h4 { margin: 0; font: 700 1rem var(--font-display); }
.member-row p { margin: 0; font-size: 0.85rem; }
.member-row select { width: auto; }
.member-row .actions { grid-column: 2 / -1; }
.member-row .tag { margin-left: 0; }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; max-width: 50rem; }
.log li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; }

.game-row { border-left: 4px solid var(--c, var(--line)); }

@media (max-width: 640px) {
  .event-strip { grid-template-columns: 2.1rem repeat(7, minmax(0, 1fr)); gap: 3px; min-width: 0; }
  .event-pill { font-size: 0.72rem; padding: 0.25rem 0.35rem; }
  .event-pill.one { justify-content: center; }
  .event-pill.one .t { display: none; }
  .member-row { grid-template-columns: auto 1fr; }
  .member-row select, .member-row > .tag { grid-column: 2; justify-self: start; }
  .log li { grid-template-columns: 1fr; gap: 0; }
  .account-head .color-field { margin-left: 0; }
  .check-list { grid-template-columns: 1fr; }
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.panel .segmented { display: flex; width: 100%; max-width: 26rem; }
.panel .segmented button { white-space: normal; }
.copy-row input { flex: 1; min-width: 0; }
.copy-row .btn { flex: none; }

/* ===================== Version 3 : deux espaces ===================== */


.topbar { flex-wrap: wrap; }
.top-actions { display: flex; align-items: center; gap: 0.5rem; }
.bell { position: relative; background: var(--panel); }
.bell .count { position: absolute; top: -4px; right: -4px; }
.space-switch { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-right: auto; margin-left: 1rem; }
.space-switch button {
  font: 700 0.92rem var(--font-body); color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 0.4rem 0.9rem; border-radius: 999px; white-space: nowrap;
}
.space-switch button[aria-checked=true] { background: var(--lamp); color: var(--lamp-ink); }
@media (max-width: 640px) {
  .space-switch { order: 3; margin: 0.5rem 0 0; width: 100%; }
  .space-switch button { flex: 1; }
  .brand { font-size: 1.15rem; }
}

/* Connexion */
.login-switch { display: flex; width: 100%; margin-top: 1.5rem; }
.login-switch button { white-space: normal; }
.join-choice { gap: 0.5rem; }
.join-card {
  display: flex; gap: 0.7rem; align-items: flex-start; cursor: pointer; font-weight: 400;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0.7rem 0.8rem;
}
.join-card:has(input:checked) { border-color: var(--lamp); box-shadow: inset 0 0 0 1px var(--lamp); }
.join-card input { accent-color: var(--lamp); margin-top: 0.25rem; width: auto; flex: none; }
.join-card > span { display: grid; gap: 0.1rem; }

/* Formulaires */
.sheet.wide { width: min(100% - 32px, 38rem); }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.address-row { display: flex; gap: 0.5rem; align-items: end; }
.address-row label { flex: 1; }
.address-row .btn { flex: none; }
.poster-field { display: flex; gap: 1rem; align-items: center; }
.poster-field img { width: 5.5rem; height: 7.5rem; object-fit: cover; border-radius: var(--radius-s); border: 1px solid var(--line); }
.file-btn { cursor: pointer; }
.row-between { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }
.row-between .note { flex: 1 1 16rem; }
.mt-s { margin-top: 1.5rem; margin-bottom: 0.6rem; }
@media (max-width: 640px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 label:last-child { grid-column: 1 / -1; }
  .address-row { flex-direction: column; align-items: stretch; }
}

/* Cartes */
.map { border-radius: var(--radius-m); border: 1px solid var(--line); overflow: hidden; background: var(--panel-2); z-index: 0; }
.big-map { height: min(68vh, 34rem); }
.pick-map { height: 15rem; }
.mini-map { height: 10rem; }
@media (prefers-color-scheme: dark) { .map .leaflet-tile-pane { filter: brightness(0.82) saturate(0.85); } }
.map-pin { background: none; border: 0; }
.map-pin span {
  display: grid; place-items: center; width: 34px; height: 34px; font-size: 17px;
  background: color-mix(in oklab, var(--c) 85%, white); border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
}
.map-pin b {
  position: absolute; top: -8px; right: -10px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: #1b1838; color: #fff; font: 700 11px/18px var(--font-body); text-align: center;
}
.map-pop { display: grid; gap: 0.25rem; font: 0.9rem var(--font-body); min-width: 11rem; }
.map-pop .btn { margin-top: 0.35rem; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }

/* Cartes de soirée */
.item.party { grid-template-columns: 1fr; cursor: pointer; border-top: 3px solid var(--c); }
.item.party.has-poster { grid-template-columns: 5.5rem 1fr; align-items: start; }
.item.party:focus-visible { outline: 3px solid var(--lamp); }
.poster-thumb { width: 5.5rem; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-s); }
.party-main { display: grid; gap: 0.6rem; min-width: 0; }
.party-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.party-meta .tag { margin-left: 0; }
.tag.hot { background: color-mix(in oklab, var(--lamp) 28%, transparent); }
.faces { display: inline-flex; margin-left: 0.4rem; vertical-align: middle; }
.faces .dot { width: 1rem; height: 1rem; border: 2px solid var(--panel); margin-left: -0.3rem; }
.btn.whatsapp { background: #25d366; border-color: #25d366; color: #052e16; }
.btn.small.whatsapp { padding: 0.35rem 0.8rem; }

/* Fiche d'une soirée */
.poster-full { width: 100%; max-height: 26rem; object-fit: contain; background: var(--panel-2); border-radius: var(--radius-m); }
.facts { display: grid; gap: 0.25rem; }
.facts p { margin: 0; }
.facts a { color: var(--lamp); }
.me-box { display: grid; gap: 0.75rem; background: var(--panel-2); border-radius: var(--radius-m); padding: 0.9rem; }
.me-box .segmented { display: flex; width: 100%; }
.callout { background: color-mix(in oklab, var(--lamp) 16%, var(--panel)); border: 1px solid color-mix(in oklab, var(--lamp) 55%, transparent); border-radius: var(--radius-m); padding: 0.75rem 0.9rem; }
.callout .btn { margin-left: 0.4rem; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.person { display: flex; gap: 0.6rem; align-items: flex-start; }
.person .dot { margin-top: 0.3rem; }
.person p { margin: 0.1rem 0 0; font-size: 0.9rem; }
.person .btn { margin-top: 0.35rem; }

/* Notifications */
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; max-height: 60vh; overflow-y: auto; }
.notif-list a { display: grid; gap: 0.1rem; color: var(--text); text-decoration: none; padding: 0.6rem 0.7rem; border-radius: var(--radius-s); background: var(--panel-2); }
.notif-list .unread a { box-shadow: inset 3px 0 0 var(--lamp); }
.notif-list span { color: var(--muted); font-size: 0.9rem; }
.notif-list time { color: var(--muted); font-size: 0.78rem; }
.empty-li { color: var(--muted); padding: 0.5rem 0; }

/* Espaces et demandes */
.space-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.space-row:last-child { border-bottom: 0; }
.space-row .tag { margin-left: auto; }
.space-row.join input { flex: 1 1 12rem; width: auto; }
.requests { margin-bottom: 1.5rem; max-width: 56rem; }
.member-row.pending { border-color: var(--lamp); }
.member-row.pending p { margin: 0.2rem 0 0; }
.empty.big { max-width: 34rem; display: grid; gap: 0.5rem; }
.empty.big p { margin: 0; }
@media (max-width: 640px) { dialog.sheet.wide { width: 100%; max-width: 100%; } }
.sheet .segmented { display: flex; width: 100%; }
.sheet .segmented button { white-space: normal; line-height: 1.2; }
dialog.sheet { overflow-x: hidden; }
#recap-text { font-size: 0.9rem; }


/* =====================================================================
   Espace Soirées : style « galerie »
   Fonds neutres, contrastes francs, typographie serrée, angles plus droits.
   Les affiches sont présentées comme des tirages encadrés ; sans affiche,
   la date devient l'image.
   ===================================================================== */
:root[data-space=parties] {
  --night: #f5f5f7;     /* fond */
  --panel: #ffffff;     /* surfaces */
  --panel-2: #f5f5f7;
  --line: #d2d2d7;      /* filets */
  --window: #e8e8ed;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --lamp: #1d1d1f;      /* action principale : noir franc */
  --lamp-ink: #ffffff;
  --accent: #0066cc;    /* liens et sélection */
  --go: #0066cc;
  --go-ink: #ffffff;
  --danger: #d70015;
  --radius-s: 4px;
  --radius-m: 10px;
  --radius-l: 14px;
  --font-display: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-space=parties] {
    --night: #000000;
    --panel: #1c1c1e;
    --panel-2: #2c2c2e;
    --line: #3a3a3c;
    --window: #2c2c2e;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --lamp: #f5f5f7;
    --lamp-ink: #000000;
    --accent: #2997ff;
    --go: #2997ff;
    --go-ink: #000000;
    --danger: #ff453a;
    color-scheme: dark;
  }
}
:root[data-space=parties] body { font-family: var(--font-body); -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }
:root[data-space=parties] h1, :root[data-space=parties] h2, :root[data-space=parties] h3, :root[data-space=parties] h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.022em; }
:root[data-space=parties] h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; }
:root[data-space=parties] :focus-visible { outline-color: var(--accent); }

/* Barre du haut et onglets, façon barre de navigation translucide */
:root[data-space=parties] .topbar, :root[data-space=parties] .tabs { max-width: 72rem; }
:root[data-space=parties] #app > .topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in oklab, var(--night) 82%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); max-width: none; padding-left: max(16px, calc((100% - 72rem) / 2 + 16px)); padding-right: max(16px, calc((100% - 72rem) / 2 + 16px)); padding-bottom: 0.75rem; }
:root[data-space=parties] .brand { font-size: 1.15rem; font-weight: 600; }
:root[data-space=parties] .tabs { border-bottom-color: var(--line); gap: 1.25rem; }
:root[data-space=parties] .tabs button { border-radius: 0; padding: 0.7rem 0; color: var(--muted); font: 500 0.95rem var(--font-body); box-shadow: inset 0 -2px 0 transparent; }
:root[data-space=parties] .tabs button.active { background: none; color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
:root[data-space=parties] .tabs button span { display: none; }
:root[data-space=parties] .count { background: var(--accent); color: #fff; }
@media (max-width: 640px) {
  :root[data-space=parties] .tabs { background: color-mix(in oklab, var(--panel) 85%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); gap: 0; }
  :root[data-space=parties] .tabs button { padding: 0.45rem 0.4rem; box-shadow: none; font-size: 0.72rem; }
  :root[data-space=parties] .tabs button span { display: block; font-size: 1.15rem; filter: grayscale(1); opacity: 0.7; }
  :root[data-space=parties] .tabs button.active span { filter: none; opacity: 1; }
  :root[data-space=parties] .tabs button.active { color: var(--accent); }
}

/* Boutons, champs, pastilles : angles plus droits */
:root[data-space=parties] .btn { border-radius: 8px; font: 500 0.95rem var(--font-body); padding: 0.6rem 1.15rem; border-color: var(--line); background: var(--panel); }
:root[data-space=parties] .btn.small { padding: 0.4rem 0.8rem; font-size: 0.86rem; }
:root[data-space=parties] .btn.primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); }
:root[data-space=parties] .btn.go { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-space=parties] .btn.ghost { background: transparent; }
:root[data-space=parties] .btn.whatsapp { background: transparent; border-color: var(--line); color: var(--text); }
:root[data-space=parties] .btn.whatsapp::before { content: ''; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #25d366; margin-right: 0.45rem; display: inline-block; }
:root[data-space=parties] .btn.icon { border-radius: 50%; }
:root[data-space=parties] .me-pill { border-radius: 999px; background: var(--panel); }
:root[data-space=parties] input, :root[data-space=parties] select, :root[data-space=parties] textarea { border-radius: 8px; background: var(--panel); border-color: var(--line); }
:root[data-space=parties] label { font-weight: 500; }
:root[data-space=parties] .pill { border-radius: 8px; font: 500 0.86rem var(--font-body); background: var(--panel); color: var(--text); padding: 0.4rem 0.8rem; }
:root[data-space=parties] .pill.on { background: var(--text); color: var(--night); border-color: var(--text); box-shadow: none; }
:root[data-space=parties] .tag { border-radius: 4px; background: var(--panel-2); font-weight: 500; }
:root[data-space=parties] .segmented, :root[data-space=parties] .space-switch { border-radius: 9px; background: var(--window); border-color: transparent; padding: 2px; }
:root[data-space=parties] .segmented button, :root[data-space=parties] .space-switch button { border-radius: 7px; font-weight: 500; color: var(--text); }
:root[data-space=parties] .segmented button[aria-checked=true], :root[data-space=parties] .space-switch button[aria-checked=true] { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12), 0 0 0 0.5px rgb(0 0 0 / 0.04); }
:root[data-space=parties] .chips.filter { gap: 0.4rem; }

/* Sections par jour */
:root[data-space=parties] .day-group h3 { font: 600 1.4rem/1.2 var(--font-display); color: var(--muted); margin-bottom: 1rem; letter-spacing: -0.02em; }
:root[data-space=parties] .day-group h3 b { color: var(--text); font-weight: 700; }
:root[data-space=parties] .stack-lg { gap: 2.75rem; }
:root[data-space=parties] .items { grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); gap: 1.25rem; }

/* Carte d'une soirée : la galerie */
:root[data-space=parties] .item { border-radius: var(--radius-l); border: 0; background: var(--panel); box-shadow: none; padding: 0; overflow: hidden; }
:root[data-space=parties] .item.party { display: flex; flex-direction: column; gap: 0; cursor: pointer; border-top: 0; }
:root[data-space=parties] .item.party:hover .party-media img { transform: scale(1.015); }
.party-media {
  position: relative; aspect-ratio: 4 / 3; background: var(--window);
  display: grid; place-items: center; overflow: hidden;
}
.party-media img {
  position: absolute; inset: 0; margin: auto;
  width: auto; height: auto; max-width: calc(100% - 3rem); max-height: calc(100% - 2.8rem); display: block;
  border-radius: 2px; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 12px 28px -8px rgb(0 0 0 / 0.35);
  transition: transform 0.4s ease;
}
.party-media.no-poster { align-content: center; gap: 0; }
.big-day { font: 700 clamp(4rem, 9vw, 5.5rem)/0.9 var(--font-display); letter-spacing: -0.05em; color: var(--text); }
.big-month { font: 500 1.1rem var(--font-display); color: var(--muted); letter-spacing: 0; }
.party-main { display: grid; gap: 0.35rem; padding: 1.1rem 1.25rem 1.25rem; }
.kicker { margin: 0; display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.cat-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c); }
.party-title { margin: 0; font-size: 1.3rem; line-height: 1.2; }
.party-sub { margin: 0; color: var(--muted); font-size: 0.95rem; }
.party-price { margin: 0.15rem 0 0; font-weight: 600; font-size: 0.95rem; }
.party-people { margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; }
.party-people b { color: var(--text); margin-right: 0.25rem; }
.party-looking { margin: 0; font-size: 0.86rem; font-weight: 500; color: var(--accent); }
:root[data-space=parties] .party-main .actions { margin-top: 0.75rem; }
:root[data-space=parties] .faces .dot { border-color: var(--panel); }
@media (prefers-reduced-motion: reduce) { .party-media img { transition: none; } }

/* Fiche d'une soirée */
:root[data-space=parties] dialog.sheet { border: 0; border-radius: var(--radius-l); box-shadow: 0 30px 80px rgb(0 0 0 / 0.35); }
:root[data-space=parties] dialog.sheet::backdrop { background: rgb(0 0 0 / 0.45); backdrop-filter: blur(6px); }
:root[data-space=parties] .sheet-body { padding: 1.4rem 1.5rem 1.6rem; gap: 1.1rem; }
.detail-title { font-size: 1.6rem !important; line-height: 1.15; }
.poster-frame {
  margin: 0; background: var(--panel-2); border-radius: var(--radius-m);
  padding: clamp(1rem, 4vw, 2rem); display: grid; place-items: center;
}
.poster-frame img {
  max-width: 100%; max-height: 28rem; object-fit: contain; display: block; border-radius: 2px; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 18px 40px -12px rgb(0 0 0 / 0.4);
}
.spec { margin: 0; display: grid; border-top: 1px solid var(--line); }
.spec > div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.spec dt { color: var(--muted); font-size: 0.9rem; }
.spec dd { margin: 0; font-weight: 500; }
.spec a { color: var(--accent); text-decoration: none; }
.spec a:hover { text-decoration: underline; }
@media (max-width: 640px) { .spec > div { grid-template-columns: 6rem 1fr; } }
:root[data-space=parties] .me-box { border-radius: var(--radius-m); background: var(--panel-2); }
:root[data-space=parties] .me-box .segmented { background: var(--window); }
:root[data-space=parties] .callout { border-radius: var(--radius-m); background: color-mix(in oklab, var(--accent) 10%, var(--panel)); border-color: color-mix(in oklab, var(--accent) 35%, transparent); }
:root[data-space=parties] .sheet-section h4 { font: 600 1rem var(--font-display); color: var(--text); }
:root[data-space=parties] .mini-map, :root[data-space=parties] .map { border-radius: var(--radius-m); border-color: var(--line); }

/* Autres écrans de l'espace */
:root[data-space=parties] .panel, :root[data-space=parties] .member-row, :root[data-space=parties] .game-row, :root[data-space=parties] .more-list button { border-radius: var(--radius-m); border-color: transparent; }
:root[data-space=parties] .empty { border-radius: var(--radius-m); border-color: var(--line); background: var(--panel); }
:root[data-space=parties] .poll-opt { border-radius: 8px; }
:root[data-space=parties] .poll-opt .bar { background: color-mix(in oklab, var(--accent) 14%, transparent); }
:root[data-space=parties] .poll-opt.win { border-color: var(--accent); }
:root[data-space=parties] .admin-nav button { border-radius: 8px; font-weight: 500; }
:root[data-space=parties] .admin-nav button[aria-selected=true] { background: var(--text); color: var(--night); border-color: var(--text); }
:root[data-space=parties] .toast { border-radius: 10px; }
:root[data-space=parties] .map-pin span { background: var(--panel); border: 2px solid var(--text); font-size: 15px; }
:root[data-space=parties] .map-pin b { background: var(--accent); }
:root[data-space=parties] .notif-list a { border-radius: 8px; }
:root[data-space=parties] .notif-list .unread a { box-shadow: inset 3px 0 0 var(--accent); }
:root[data-space=parties] .poster-field img { border-radius: 2px; box-shadow: 0 6px 16px -6px rgb(0 0 0 / 0.35); border: 0; }

:root[data-space=parties] .pill { display: inline-flex; align-items: center; gap: 0.4rem; }
:root[data-space=parties] .pill.on .cat-dot { box-shadow: 0 0 0 1.5px var(--night); }
@media (max-width: 640px) {
  .party-media.no-poster { aspect-ratio: 2 / 1; }
  .big-day { font-size: 3.5rem; }
  :root[data-space=parties] .chips.filter { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  :root[data-space=parties] .pill { flex: none; }
}

/* Image d'un événement (espace Jeux) */
.event-image { margin: -1rem -1rem 0.2rem; background: var(--panel-2); border-radius: var(--radius-m) var(--radius-m) 0 0; display: grid; place-items: center; padding: 1rem; overflow: hidden; }
.item.event .event-image { margin-left: calc(-1rem - 4px); }
.event-image img { max-width: 100%; max-height: 16rem; object-fit: contain; display: block; border-radius: 3px; box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.5); }
