/* =========================================================================
   Carte du bar — identité visuelle
   Ambiance : salle tamisée, lumière chaude laiton/whisky sur fond sombre.
   Signature : points de conduite (pointillés) entre l'article et son prix.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&display=swap');

:root {
  --ink:      #15110c;   /* fond, salle plongée dans la pénombre */
  --ink-2:    #1d1710;   /* fond alternatif */
  --surface:  #221a12;   /* cartes / panneaux relevés */
  --surface-2:#2b2117;
  --line:     #3a2e22;   /* filets chauds */
  --line-2:   #4a3a2b;
  --cream:    #f3e8d6;   /* texte principal, blanc cassé chaud */
  --muted:    #a8957c;   /* texte secondaire, tan estompé */
  --amber:    #e3a552;   /* accent laiton — prix, actions, état actif */
  --amber-dk: #b97f34;
  --gold:     #f0cf86;   /* marqueur premium */
  --danger:   #d9774e;
  --ok:       #7faf6f;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radius: 4px;
  --maxw: 760px;
}

/* L'attribut hidden doit toujours l'emporter, même sur les éléments à display défini (.btn, etc.) */
[hidden] { display: none !important; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(120% 90% at 50% -10%, #251c12 0%, var(--ink) 55%) fixed;
  color: var(--cream);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---- En-tête -------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(21, 17, 12, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.35rem, 4vw, 1.9rem);
  letter-spacing: 0.01em;
  color: var(--cream);
  text-decoration: none;
  line-height: 1;
}
.brand .glass { color: var(--amber); }

.staff-link {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.staff-link:hover { color: var(--cream); border-color: var(--line-2); }

/* ---- Navigation des catégories -------------------------------------- */

.catnav {
  position: sticky; top: 57px; z-index: 20;
  background: rgba(21, 17, 12, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.catnav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex; gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.catnav-inner::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  transition: all 0.18s;
}
.cat-chip:hover { color: var(--cream); border-color: var(--line-2); }
.cat-chip.active {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 600;
}

/* ---- Mise en page principale ---------------------------------------- */

main { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 5rem; }

.intro { text-align: center; margin: 1.5rem 0 3rem; }
.intro h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 7vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.intro p { color: var(--muted); margin-top: 0.75rem; font-size: 0.95rem; }

/* ---- Sections de catégorie ------------------------------------------ */

.category { margin-bottom: 3.25rem; scroll-margin-top: 120px; }
.cat-head {
  display: flex; align-items: baseline; gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.cat-head h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--amber);
  white-space: nowrap;
}
.cat-head .rule { flex: 1; height: 1px; background: var(--line); }
.cat-head .count { color: var(--muted); font-size: 0.78rem; }

/* ---- Article -------------------------------------------------------- */

.item { padding: 1rem 0; border-bottom: 1px solid rgba(58, 46, 34, 0.5); }
.item:last-child { border-bottom: none; }
.item.unavailable { opacity: 0.45; }

.item-line {
  display: flex; align-items: baseline; gap: 0.5rem;
  font-family: var(--serif);
}
.item-title {
  font-weight: 500;
  font-size: 1.18rem;
  color: var(--cream);
}
.item.premium .item-title { color: var(--gold); }
.item-title.has-desc { cursor: pointer; }
.item-title.has-desc:hover { color: var(--amber); }
.premium-mark {
  color: var(--gold);
  font-size: 0.7em;
  margin-right: 0.4rem;
  vertical-align: 0.18em;
}

/* Points de conduite — la signature de la carte */
.leader {
  flex: 1;
  border-bottom: 2px dotted var(--line-2);
  transform: translateY(-0.32em);
  min-width: 1.5rem;
}
.price {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--amber);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Plusieurs déclinaisons (quantités) */
.variants { margin-top: 0.55rem; display: flex; flex-direction: column; gap: 0.35rem; }
.variant-line { display: flex; align-items: baseline; gap: 0.5rem; }
.variant-label {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}
.variant-line .leader { transform: translateY(-0.28em); }
.variant-line .price { font-size: 0.95rem; }

.item-desc {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.5rem;
  max-width: 52ch;
}

.recipe-toggle {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--amber-dk);
  background: none; border: none; padding: 0;
}
.recipe-toggle:hover { color: var(--amber); }
.recipe-body {
  margin-top: 0.5rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border-left: 2px solid var(--amber-dk);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.88rem;
  color: var(--cream);
}
.premium-tag {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold);
  border: 1px solid rgba(240, 207, 134, 0.35);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  margin-left: 0.6rem;
  vertical-align: 0.18em;
}

/* ---- États génériques ----------------------------------------------- */

.empty, .loading {
  text-align: center; color: var(--muted);
  padding: 4rem 1rem; font-size: 0.95rem;
}

.footer {
  text-align: center; color: var(--muted);
  font-size: 0.78rem; padding: 2rem 1rem;
  border-top: 1px solid var(--line);
}

/* =========================================================================
   Formulaires / pages staff (connexion + admin)
   ========================================================================= */

.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2rem;
}
.auth-brand {
  display: inline-block; margin-bottom: 1.25rem;
  font-family: var(--serif); font-size: 1.5rem;
}
.card h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: 1.6rem; margin-bottom: 0.4rem;
}
.card .sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.4rem; }
.field { margin-bottom: 1.1rem; }
input, select, textarea {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  transition: border-color 0.18s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--amber);
}
textarea { resize: vertical; min-height: 70px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--amber); color: var(--ink);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  font-weight: 600; font-size: 0.9rem;
  padding: 0.65rem 1.1rem;
  transition: background 0.18s, border-color 0.18s, opacity 0.18s;
}
.btn:hover { background: #eab366; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.ghost {
  background: transparent; color: var(--cream); border-color: var(--line-2);
}
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(217,119,78,0.5); }
.btn.danger:hover { background: rgba(217,119,78,0.12); }
.btn.sm { padding: 0.4rem 0.7rem; font-size: 0.8rem; }

.msg { font-size: 0.85rem; margin-top: 0.9rem; min-height: 1.2em; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.switch-link { margin-top: 1.25rem; font-size: 0.85rem; color: var(--muted); text-align: center; }
.switch-link a { color: var(--amber); text-decoration: none; }
.switch-link a:hover { text-decoration: underline; }

/* ---- En-tête admin -------------------------------------------------- */

.admin-top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(21,17,12,0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.admin-top-inner {
  max-width: 1000px; margin: 0 auto; padding: 0.85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}
.admin-top .brand { font-size: 1.3rem; }
.admin-who { font-size: 0.82rem; color: var(--muted); }
.admin-who strong { color: var(--cream); font-weight: 500; }
.admin-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.admin-main { max-width: 1000px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }

/* Barre d'accès rapide aux autres espaces (sous l'en-tête admin) */
.admin-nav {
  max-width: 1000px; margin: 0 auto; padding: 0.75rem 1.25rem 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}

.tabs { display: flex; gap: 0.4rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; color: var(--muted);
  padding: 0.7rem 0.4rem; font-size: 0.9rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--cream); border-bottom-color: var(--amber); font-weight: 600; }
.tab:hover { color: var(--cream); }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.section-head h2 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; }

/* Table admin */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 500;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 0.7rem 0.75rem; border-bottom: 1px solid rgba(58,46,34,0.5); vertical-align: middle; }
.tbl tr:hover td { background: rgba(43,33,23,0.4); }
.tbl .actions-cell { display: flex; gap: 0.4rem; justify-content: flex-end; }
.role-pill {
  display: inline-block; font-size: 0.72rem; padding: 0.18rem 0.55rem;
  border-radius: 999px; letter-spacing: 0.04em;
}
.role-user { background: rgba(168,149,124,0.15); color: var(--muted); }
.role-bar_admin { background: rgba(227,165,82,0.16); color: var(--amber); }
.role-administrateur { background: rgba(240,207,134,0.16); color: var(--gold); }
.cat-badge {
  display: inline-block; font-size: 0.72rem; padding: 0.18rem 0.55rem;
  border-radius: var(--radius); background: var(--surface-2); color: var(--muted);
  text-transform: capitalize;
}
.dot-prem { color: var(--gold); }

.hint { color: var(--muted); font-size: 0.82rem; margin-bottom: 1.25rem; }

/* Barre de filtres (gestion de la carte) */
.filters {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
  margin-bottom: 1rem; padding: 0.75rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: rgba(43,33,23,0.35);
}
.filters .f-search { flex: 1 1 200px; min-width: 160px; }
.filters select { flex: 0 0 auto; width: auto; }
.filters .f-reset { margin-left: auto; }
.filters-info { color: var(--muted); font-size: 0.8rem; margin: -0.4rem 0 0.9rem; }

/* En-tête de groupe de catégorie dans la table admin */
.tbl tr.cat-group td {
  background: var(--surface-2); color: var(--amber);
  font-family: var(--serif); font-size: 0.95rem; letter-spacing: 0.02em;
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line);
}
.tbl tr.cat-group td .grp-count { color: var(--muted); font-family: var(--sans); font-size: 0.8rem; }

/* Flèches de réordonnancement */
.reorder { display: inline-flex; align-items: center; gap: 4px; margin-right: 0.5rem; vertical-align: middle; }
.reorder .updown { display: inline-flex; flex-direction: column; gap: 2px; }
.reorder button {
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--muted); border-radius: 3px; cursor: pointer;
  width: 22px; height: 16px; line-height: 1; font-size: 0.7rem; padding: 0;
}
.reorder button:hover:not(:disabled) { color: var(--amber); border-color: var(--amber-dk); }
.reorder button:disabled { opacity: 0.3; cursor: default; }

/* Poignée de glisser-déposer */
.drag-handle {
  cursor: grab; color: var(--muted); font-size: 1rem; line-height: 1;
  padding: 0.15rem 0.3rem; border-radius: 3px; user-select: none;
  touch-action: none;
}
.drag-handle:hover { color: var(--amber); background: var(--surface); }
.drag-handle:active { cursor: grabbing; }
tr.item-row.dragging { opacity: 0.45; background: var(--surface); }
tr.item-row.dragging td { border-color: var(--amber-dk); }
.title-cell { display: flex; align-items: center; }

/* Modale d'édition d'article */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10,8,5,0.7); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2rem 1rem; overflow-y: auto;
}
/* Correctif : respecter l'attribut hidden (sinon la modale reste ouverte en permanence). */
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 560px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 1.75rem;
}
.modal h2 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; margin-bottom: 1.25rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.1rem; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; color: var(--cream); }

.variant-edit { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.variant-edit input.v-label { flex: 1.4; }
.variant-edit input.v-price { flex: 1; }
.variant-edit .btn { flex: 0 0 auto; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Popups de shift (détail + édition) : boutons compacts et passage à la
   ligne, pour que les actions tiennent toujours en entier dans la largeur
   de la popup, même sur téléphone. */
#shift-detail .modal-actions,
#shift-modal .modal-actions { flex-wrap: wrap; gap: 0.4rem; }
#shift-detail .modal-actions .btn,
#shift-modal .modal-actions .btn { padding: 0.5rem 0.65rem; font-size: 0.82rem; white-space: nowrap; }

/* Bouton « Valider » : vert, cohérent avec le ✓ « validé ». */
.btn.ok { background: var(--ok); color: #0b2a12; border-color: var(--ok); }
.btn.ok:hover { background: #8fbf7f; }

@media (max-width: 520px) {
  .row2 { grid-template-columns: 1fr; }
  .tbl thead { display: none; }
  .tbl td.hide-sm { display: none; }
  /* Popups du planning sur téléphone : plus étroites, centrées à l'écran et
     défilables à l'intérieur si l'écran est court. */
  #shift-modal, #shift-detail { align-items: center; padding: 1rem; }
  #shift-modal .modal, #shift-detail .modal {
    width: 88%; max-width: 330px; padding: 1.25rem;
    max-height: calc(100vh - 2rem); overflow-y: auto;
  }
  /* Autres popups (heures, congés) : centrées, à la largeur de l'écran,
     défilables à l'intérieur si l'écran est court. */
  #entry-modal, #leave-modal, #prod-modal { align-items: center; padding: 1rem; }
  #entry-modal .modal, #leave-modal .modal, #prod-modal .modal {
    padding: 1.25rem; max-height: calc(100vh - 2rem); overflow-y: auto;
  }
}

/* Barre de navigation : sur mobile, elle passe à la ligne au lieu de
   déborder horizontalement (ce qui décalait les popups hors de l'écran). */
@media (max-width: 560px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 0.5rem; }
  .top-links {
    flex-wrap: wrap; width: 100%; gap: 0.3rem 0.4rem; justify-content: flex-start;
  }
  .top-links .staff-link, .top-links .nav-group-btn {
    font-size: 0.72rem; padding: 0.4rem 0.6rem;
  }
}

/* =========================================================================
   Ajouts Meeple : triangle de description, ingrédients, colonnes bières,
   gestion des catégories, page recettes
   ========================================================================= */

/* Liens de l'en-tête public */
.top-links { display: flex; gap: 0.5rem; align-items: center; }

/* Triangle qui pivote — bascule de description */
.tri-btn {
  background: none; border: none; padding: 0.15rem; margin-left: 0.5rem;
  cursor: pointer; line-height: 0; vertical-align: -0.12em;
}
.tri { width: 0.7rem; height: 0.7rem; display: inline-block;
  transition: transform 0.22s ease; transform: rotate(0deg); transform-origin: 50% 50%; }
.tri path { fill: var(--muted); transition: fill 0.15s; }
.tri-btn:hover .tri path { fill: var(--amber); }
.tri-btn.active .tri { transform: rotate(90deg); }
.tri-btn.active .tri path { fill: var(--amber); }
.tri-inline { display: inline-block; line-height: 0; }
.tri-inline .tri { width: 0.65rem; height: 0.65rem; vertical-align: -0.05em; }
.tri-inline .tri path { fill: var(--amber); }

/* Ingrédients affichés sous le titre */
.item-ingredients {
  margin-top: 0.25rem;
  color: var(--muted); font-size: 0.9rem; font-style: italic; line-height: 1.4;
}

/* Bières : quantités en colonnes côte à côte */
.qty-columns { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.qty-col {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  min-width: 4.5rem; padding: 0.4rem 0.7rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(43,33,23,0.35);
}
.qty-size { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.02em; }
.qty-price { font-family: var(--serif); color: var(--amber); font-size: 1.05rem; }

/* Description révélée */
.item-desc[hidden] { display: none; }
.item-desc {
  margin-top: 0.4rem;
  border-left: 2px solid var(--amber-dk);
  padding-left: 0.75rem;
}

/* ---- Admin : panneau de gestion des catégories ---------------------- */
.cat-manager {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(43,33,23,0.3); margin-bottom: 1.75rem; padding: 0 1rem;
}
.cat-manager > summary {
  cursor: pointer; padding: 0.85rem 0; font-weight: 600;
  color: var(--cream); list-style-position: inside;
}
.cat-manager .hint-inline { color: var(--muted); font-weight: 400; font-size: 0.82rem; }
.cat-add { display: flex; gap: 0.5rem; padding-bottom: 0.85rem; }
.cat-add input { flex: 1; }
.cat-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0; border-top: 1px solid rgba(58,46,34,0.5);
}
.cat-row-label { flex: 1; color: var(--cream); }
.cat-row-actions { display: flex; gap: 0.4rem; }
.cat-row:last-child { padding-bottom: 0.9rem; }

/* ---- Page recettes -------------------------------------------------- */
#recipes { margin-top: 1.5rem; }

/* Barre d'outils : filtres à gauche, bouton tout ouvrir/fermer à droite */
.recipe-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-top: 1.25rem;
}
.recipe-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.recipe-filter {
  font: inherit; font-size: 0.9rem; cursor: pointer;
  padding: 0.4rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.recipe-filter:hover { color: var(--cream); border-color: var(--amber-dk); }
.recipe-filter.active {
  color: var(--ink); background: var(--amber); border-color: var(--amber);
}
.toggle-all {
  font: inherit; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
  padding: 0.4rem 0.9rem; border-radius: var(--radius);
  border: 1px solid var(--amber-dk); background: transparent; color: var(--amber);
  transition: color 0.15s, background 0.15s;
}
.toggle-all:hover { color: var(--ink); background: var(--amber); }

/* Sections par catégorie */
.recipe-cat-section { margin-top: 2rem; }
.recipe-cat-title {
  font-family: var(--serif); font-weight: 500; font-size: 1.4rem; color: var(--amber);
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--line);
}

/* Liste sur une seule colonne */
.recipe-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.1rem; }
.recipe-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}

/* En-tête cliquable : nom + triangle */
.recipe-head-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; padding: 0.85rem 1.2rem; font: inherit;
}
.recipe-head-btn:hover { background: rgba(227,165,82,0.06); }
.recipe-card-title {
  font-family: var(--serif); font-weight: 500; font-size: 1.15rem; color: var(--cream);
}
.recipe-head-btn .tri { flex: none; width: 0.8rem; height: 0.8rem; transition: transform 0.22s ease; }
.recipe-head-btn .tri path { fill: var(--muted); transition: fill 0.15s; }
.recipe-head-btn:hover .tri path { fill: var(--amber); }
.recipe-head-btn.active .tri { transform: rotate(90deg); }
.recipe-head-btn.active .tri path { fill: var(--amber); }

/* Corps repliable */
.recipe-body { padding: 0 1.2rem 1.1rem; }
.recipe-body[hidden] { display: none; }
.recipe-card-body { color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.recipe-steps { margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.recipe-vessel {
  color: var(--amber); font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 0.4rem;
}
.recipe-ol {
  margin: 0; padding-left: 1.3rem;
  color: var(--cream); font-size: 0.9rem; line-height: 1.5;
}
.recipe-ol li { margin: 0.15rem 0; }

/* ---- Boutons de sélection de catégorie (modale d'article) ----------- */
.cat-select-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; }
/* Rangée de filtres par catégorie (vue Carte) */
.cat-filter-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; }
.cat-select-btn {
  font: inherit; font-size: 0.88rem; cursor: pointer;
  padding: 0.4rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.cat-select-btn:hover { color: var(--cream); border-color: var(--amber-dk); }
.cat-select-btn.active {
  color: var(--ink); background: var(--amber); border-color: var(--amber); font-weight: 500;
}

/* ---- Modale d'historique des modifications -------------------------- */
.history-body { max-height: 60vh; overflow-y: auto; margin: -0.25rem 0 0.25rem; }
.hist-entry {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--ink-2); padding: 0.8rem 0.95rem; margin-bottom: 0.7rem;
}
.hist-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.hist-action {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.12rem 0.5rem; border-radius: 4px; white-space: nowrap;
}
.hist-create { color: var(--ok); background: rgba(127,175,111,0.14); }
.hist-update { color: var(--amber); background: rgba(227,165,82,0.14); }
.hist-delete { color: var(--danger); background: rgba(217,119,78,0.14); }
.hist-meta { color: var(--muted); font-size: 0.82rem; }
.hist-detail { display: flex; flex-direction: column; gap: 0.3rem; }
.hist-diff {
  display: grid; grid-template-columns: 6.5rem 1fr auto 1fr; align-items: baseline;
  gap: 0.4rem; font-size: 0.86rem; line-height: 1.4;
}
.hist-field { color: var(--muted); }
.hist-from { color: var(--muted); text-decoration: line-through; opacity: 0.8; word-break: break-word; }
.hist-arrow { color: var(--amber); }
.hist-to { color: var(--cream); word-break: break-word; }
.hist-nochange { color: var(--muted); font-size: 0.86rem; font-style: italic; }

/* En dessous d'une certaine largeur, la diff passe en une colonne. */
@media (max-width: 560px) {
  .hist-diff { grid-template-columns: 1fr; }
  .hist-arrow { display: none; }
  .hist-from::after { content: ' →'; color: var(--amber); }
}

/* ---- Page inventaire ------------------------------------------------ */
#inventory { margin-top: 1.5rem; }
.inv-section { margin-top: 1.75rem; }
.inv-group-title {
  font-family: var(--serif); font-weight: 500; font-size: 1.35rem; color: var(--amber);
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); margin-bottom: 0.4rem;
}
.inv-list { display: flex; flex-direction: column; }
.inv-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 0.2rem; border-bottom: 1px solid var(--line);
  border-radius: 3px; transition: background-color 0.5s ease;
}
.inv-row .inv-label { color: var(--cream); font-size: 1rem; }
label.inv-label { cursor: pointer; flex: 1; }

/* Confirmation visuelle d'enregistrement */
.inv-row.saved { background-color: rgba(127,175,111,0.16); transition: background-color 0.05s; }
.inv-row.save-error { background-color: rgba(217,119,78,0.18); transition: background-color 0.05s; }

/* Compteur : − [valeur] + */
.inv-count { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.inv-step {
  width: 2.2rem; height: 2.2rem; flex: none; cursor: pointer;
  font-size: 1.3rem; line-height: 1; font-family: var(--sans);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--amber);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.inv-step:hover { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.inv-step:disabled { opacity: 0.4; cursor: not-allowed; }
.inv-step:disabled:hover { background: var(--surface); color: var(--amber); border-color: var(--line-2); }
.inv-qty {
  width: 3.4rem; height: 2.2rem; text-align: center;
  font-size: 1.05rem; font-family: var(--serif);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--ink-2); color: var(--cream);
  -moz-appearance: textfield;
}
.inv-qty::-webkit-outer-spin-button,
.inv-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Case à cocher (consommables) */
.inv-check {
  width: 1.5rem; height: 1.5rem; flex: none; cursor: pointer;
  accent-color: var(--amber);
}

/* ---- Inventaire : barre d'outils, admin ---------------------------- */
.inv-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem; }
.inv-save-status { font-size: 0.9rem; color: var(--muted); }
.inv-save-status.ok { color: var(--ok); }
.inv-save-status.err { color: var(--danger); }

.inv-remove {
  width: 2rem; height: 2.2rem; flex: none; cursor: pointer; margin-left: 0.3rem;
  font-size: 0.95rem; line-height: 1; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.inv-remove:hover { color: var(--ink); background: var(--danger); border-color: var(--danger); }

.inv-admin { margin-top: 2.5rem; padding-top: 0.5rem; }
.inv-add { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.8rem; }
.inv-add input[type="text"], .inv-add select {
  height: 2.4rem; padding: 0 0.7rem; font: inherit;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--ink-2); color: var(--cream);
}
.inv-add #new-label { flex: 1 1 12rem; }
.inv-add-msg { margin-top: 0.5rem; font-size: 0.9rem; min-height: 1.2em; }
.inv-add-msg.ok { color: var(--ok); }
.inv-add-msg.err { color: var(--danger); }

/* ---- Historique des inventaires ------------------------------------ */
.hist-inv-layout {
  display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 1.5rem;
  margin-top: 1.5rem; align-items: start;
}
.snap-list { display: flex; flex-direction: column; gap: 0.5rem; }
.snap-card {
  display: flex; flex-direction: column; gap: 0.25rem; width: 100%; text-align: left;
  cursor: pointer; padding: 0.7rem 0.85rem; font: inherit;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--cream);
  transition: border-color 0.12s, background 0.12s;
}
.snap-card:hover { border-color: var(--amber-dk); }
.snap-card.active { border-color: var(--amber); background: var(--ink-2); }
.snap-date { font-family: var(--serif); font-size: 1.02rem; }
.snap-meta { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--muted); font-size: 0.8rem; }
.snap-count { white-space: nowrap; }

.snap-detail {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 1.2rem 1.4rem; min-height: 8rem;
}
.snap-detail-head { border-bottom: 1px solid var(--line); padding-bottom: 0.7rem; margin-bottom: 0.3rem; }
.snap-detail-title { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; color: var(--amber); }
.snap-detail-sub { color: var(--muted); font-size: 0.88rem; margin-top: 0.2rem; }
.snap-row { justify-content: space-between; }
.snap-value { font-family: var(--serif); color: var(--cream); font-size: 1.02rem; }
.snap-value.ok { color: var(--ok); }
.snap-value.no { color: var(--muted); }

@media (max-width: 640px) {
  .hist-inv-layout { grid-template-columns: 1fr; }
}

/* Repère « synchronisé depuis la carte » sur une ligne d'inventaire */
.inv-auto {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 0.1rem 0.5rem; margin-left: 0.3rem; white-space: nowrap;
}
.inv-admin-note { color: var(--muted); font-size: 0.9rem; margin-top: 0.4rem; }

/* Bières exclues de l'inventaire */
.inv-excluded { margin-top: 1.5rem; }
.inv-sub { font-size: 0.95rem; color: var(--cream); margin-bottom: 0.6rem; }
.inv-excluded-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.excluded-chip {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0.35rem 0.35rem 0.8rem;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--ink-2);
  color: var(--muted); font-size: 0.9rem;
}

/* ---- Stock de référence & liste d'achats --------------------------- */
.ref-left { display: flex; flex-direction: column; gap: 0.1rem; }
.ref-hint { color: var(--muted); font-size: 0.8rem; }

.buy-summary { margin-top: 1.25rem; font-size: 0.95rem; padding: 0.7rem 1rem; border-radius: var(--radius); }
.buy-summary.need { color: var(--amber); background: rgba(227,165,82,0.10); border: 1px solid var(--amber-dk); }
.buy-summary.ok { color: var(--ok); background: rgba(127,175,111,0.10); border: 1px solid rgba(127,175,111,0.4); }

.buy-row.need { border-left: 3px solid var(--amber); padding-left: 0.6rem; }
.buy-nums { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; justify-content: flex-end; }
.buy-cell { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.buy-need {
  font-family: var(--serif); color: var(--ink); background: var(--amber);
  border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.9rem; white-space: nowrap;
}
.buy-ok { color: var(--ok); font-size: 0.85rem; white-space: nowrap; }

/* ==================================================================== */
/* Carte compacte — version « bar à jeux »                              */
/* ==================================================================== */
.cc {
  /* Couleurs de pions de joueurs (accents par catégorie / événement) */
  --pl-red:    #c96f5a;
  --pl-blue:   #7093b8;
  --pl-yellow: #d7ba5e;
  --pl-green:  #7faf6f;
  --pl-purple: #a583b8;
  --pl-teal:   #6aaea1;
}
.cc-c-red    { --pl: var(--pl-red); }
.cc-c-blue   { --pl: var(--pl-blue); }
.cc-c-yellow { --pl: var(--pl-yellow); }
.cc-c-green  { --pl: var(--pl-green); }
.cc-c-purple { --pl: var(--pl-purple); }
.cc-c-teal   { --pl: var(--pl-teal); }

.cc-topbar .topbar-inner { gap: 0.6rem; justify-content: flex-start; }
.cc-tagline {
  color: var(--muted); font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.18em; transform: translateY(2px);
}

/* ---- Navigation par pastilles (pions) ------------------------------- */
.cc-nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; gap: 0.45rem; overflow-x: auto; scrollbar-width: none;
  padding: 0.55rem 1rem; background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.cc-nav::-webkit-scrollbar { display: none; }
.cc-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; flex: none;
  padding: 0.3rem 0.75rem 0.3rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--cream); text-decoration: none; font-size: 0.85rem;
  transition: border-color 0.15s, background 0.15s;
}
.cc-chip:hover { border-color: var(--pl); }
.cc-chip.active { border-color: var(--pl); background: var(--ink-2); }
.cc-chip-meeple { width: 13px; height: 13px; fill: var(--pl); }

/* ---- Événements : main de cartes à jouer ---------------------------- */
.cc-main { max-width: 1060px; margin: 0 auto; padding: 1.4rem 1.25rem 4rem; }
.cc-eyebrow {
  color: var(--muted); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.2em; margin: 0.3rem 0 0.7rem;
}
.cc-hand {
  display: flex; gap: 0.55rem; overflow-x: auto; padding: 0.6rem 0.4rem 1rem;
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.cc-hand::-webkit-scrollbar { display: none; }
.cc-card {
  position: relative; flex: none; width: 108px; aspect-ratio: 5 / 7;
  scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.3rem; padding: 0.6rem 0.45rem;
  background: linear-gradient(160deg, var(--surface) 0%, var(--ink-2) 100%);
  border: 1px solid var(--line-2); border-radius: 9px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}
/* légère rotation alternée : une main de cartes posée sur la table */
.cc-card:nth-child(6n+1) { transform: rotate(-2.4deg) translateY(2px); }
.cc-card:nth-child(6n+2) { transform: rotate(1.6deg); }
.cc-card:nth-child(6n+3) { transform: rotate(-1.1deg) translateY(3px); }
.cc-card:nth-child(6n+4) { transform: rotate(2.2deg) translateY(1px); }
.cc-card:nth-child(6n+5) { transform: rotate(-1.8deg); }
.cc-card:nth-child(6n)   { transform: rotate(1.2deg) translateY(2px); }
.cc-card-suit { position: absolute; top: 6px; left: 7px; }
.cc-suit-meeple { width: 11px; height: 11px; fill: var(--pl); }
.cc-card-icon svg { width: 34px; height: 34px; color: var(--pl); fill: var(--pl); }
.cc-card-icon svg[class] { fill: var(--pl); }
.cc-dancers { display: inline-flex; align-items: flex-end; }
.cc-dancer { width: 22px; height: 22px; fill: var(--pl); }
.cc-dancer.a { transform: rotate(-14deg) translateY(-2px); }
.cc-dancer.b { transform: rotate(12deg) translateX(-4px); }
.cc-card-name {
  font-family: var(--serif); font-size: 0.92rem; color: var(--cream);
  text-align: center; line-height: 1.15;
}
.cc-card-sub {
  color: var(--muted); font-size: 0.62rem; text-align: center; line-height: 1.25;
}
.cc-events-note { color: var(--muted); font-size: 0.78rem; margin: 0 0 0.6rem; }

@media (prefers-reduced-motion: no-preference) {
  .cc-card { transition: transform 0.18s ease, border-color 0.18s ease; }
  .cc-card:hover { transform: rotate(0) translateY(-4px); border-color: var(--pl); }
}

/* ---- Carte compacte -------------------------------------------------- */
#cc-menu { columns: 2 430px; column-gap: 3rem; margin-top: 0.8rem; }
.cc-section { break-inside: avoid-column; margin: 0 0 1.6rem; }
.cc-cat {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--serif); font-weight: 500; font-size: 1.15rem; color: var(--cream);
  padding-bottom: 0.35rem; margin-bottom: 0.35rem;
  border-bottom: 2px solid var(--pl);
  break-after: avoid-column;
}
.cc-cat-meeple { width: 15px; height: 15px; fill: var(--pl); flex: none; }

.cc-list { list-style: none; margin: 0; padding: 0; }
.cc-item { padding: 0.42rem 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.cc-item:last-child { border-bottom: none; }

.cc-line {
  display: flex; align-items: baseline; width: 100%; gap: 0.45rem;
  background: none; border: none; padding: 0; margin: 0; text-align: left;
  font: inherit; color: inherit;
}
button.cc-line { cursor: pointer; }
.cc-name { font-size: 0.98rem; color: var(--cream); flex: none; max-width: 70%; }
.cc-item.premium .cc-name { color: var(--gold); }
button.cc-line:hover .cc-name { color: var(--amber); }
.cc-more {
  display: inline-block; margin-left: 0.35rem; color: var(--muted);
  font-size: 0.7rem; transition: transform 0.15s;
}
.cc-item.open .cc-more { transform: rotate(90deg); }
.cc-dots { flex: 1; border-bottom: 1px dotted var(--line-2); transform: translateY(-3px); min-width: 14px; }
.cc-price { flex: none; color: var(--amber); font-size: 0.92rem; white-space: nowrap; }
.cc-vlabel { color: var(--muted); font-size: 0.78rem; }
.cc-vsep { color: var(--line-2); }

.cc-ing {
  color: var(--muted); font-size: 0.8rem; line-height: 1.35; margin: 0.15rem 0 0;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.cc-item.open .cc-ing { -webkit-line-clamp: unset; }
.cc-desc {
  color: var(--cream); opacity: 0.88; font-size: 0.85rem; line-height: 1.45;
  margin: 0.3rem 0 0.1rem; padding-left: 0.7rem; border-left: 2px solid var(--pl, var(--amber));
}

.cc-alt-link { color: var(--muted); }
.cc-alt-link:hover { color: var(--amber); }

@media (max-width: 560px) {
  .cc-main { padding: 1rem 0.9rem 3.5rem; }
  .cc-name { max-width: 62%; }
  .cc-card { width: 98px; }
}

/* ---- Champ mot de passe : bouton afficher / masquer ------------------ */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 2.9rem; }
.pw-eye {
  position: absolute; top: 50%; right: 0.45rem; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--muted); transition: color 0.12s, border-color 0.12s;
}
.pw-eye:hover { color: var(--amber); }
.pw-eye:focus-visible { outline: none; border-color: var(--amber-dk); color: var(--amber); }
.pw-eye svg { width: 18px; height: 18px; display: block; }

/* ---- Page « Mon profil » -------------------------------------------- */
.profile-main { max-width: 620px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
.profile-card { margin-top: 1.5rem; text-align: left; }
.profile-h2 {
  font-family: var(--serif); font-weight: 500; font-size: 1.2rem; color: var(--amber);
  padding-bottom: 0.5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.profile-card .btn { margin-top: 0.4rem; }
.profile-card .msg { min-height: 1.2em; margin-top: 0.6rem; }

/* Bouton présenté comme un lien (barre de navigation) */
.linkish {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
}

/* ---- Achats : rappel de l'inventaire de référence -------------------- */
.inv-source {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem;
  margin-top: 1.25rem; padding: 0.6rem 0.9rem;
  border: 1px solid var(--line-2); border-left: 3px solid var(--amber);
  border-radius: var(--radius); background: var(--surface);
  font-size: 0.9rem;
}
.inv-source-label { color: var(--muted); }
.inv-source-date { color: var(--cream); font-family: var(--serif); font-size: 1rem; }
.inv-source-by { color: var(--muted); }
.inv-source.none { border-left-color: var(--line-2); color: var(--muted); }

/* ---- Achats : mail de commande --------------------------------------- */
.order-bar { margin-top: 1rem; }
.order-modal { max-width: 620px; text-align: left; }
.order-modal h2 {
  font-family: var(--serif); font-weight: 500; font-size: 1.25rem; color: var(--amber);
  margin-bottom: 1rem;
}
.order-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.order-modal textarea {
  width: 100%; font: inherit; font-size: 0.92rem; line-height: 1.5; resize: vertical;
  padding: 0.6rem 0.7rem; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--ink-2); color: var(--cream);
}
.order-hint { color: var(--muted); font-size: 0.82rem; margin-top: 0.4rem; }
.order-modal .msg { min-height: 1.2em; margin-top: 0.4rem; }
@media (max-width: 520px) {
  .order-fields { grid-template-columns: 1fr; }
}

/* ---- Stock de référence : nom de commande --------------------------- */
.ref-block { border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.ref-block:last-child { border-bottom: none; }
.ref-block .inv-row { border-bottom: none; padding-bottom: 0.2rem; }
.ord-field { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.2rem 0.35rem; }
.ord-cap {
  color: var(--muted); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; white-space: nowrap;
}
.ord-input {
  flex: 1; min-width: 0; height: 1.9rem; padding: 0 0.55rem; font: inherit; font-size: 0.88rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--ink-2); color: var(--cream);
}
.ord-input:focus { outline: none; border-color: var(--amber-dk); }
.ord-input::placeholder { color: var(--muted); opacity: 0.6; }

/* Rôles multiples (tableau admin) */
.roles-cell { display: flex; flex-wrap: wrap; gap: 0.25rem 0.8rem; }
.role-check { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--cream); cursor: pointer; white-space: nowrap; }
.role-check input { cursor: pointer; }
.role-check input:disabled { cursor: default; }

/* ==================================================================== */
/* Jeux de société — ludothèque (/jeux.html)                            */
/* ==================================================================== */
.games-main { max-width: 1000px; margin: 0 auto; padding: 0 1.25rem 5rem; }

.games-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.7rem;
  padding: 0.9rem 1rem; margin-bottom: 0.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.gf { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.72rem; color: var(--muted); }
.gf span { text-transform: uppercase; letter-spacing: 0.08em; }
.gf select {
  font: inherit; font-size: 0.9rem; color: var(--cream); background: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 0.4rem 0.6rem; min-width: 8.5rem;
}
.gf select:focus { outline: none; border-color: var(--amber-dk); }
.games-filters .btn { align-self: flex-end; }
.games-filters #add-game { margin-left: auto; }

.games-count { color: var(--muted); font-size: 0.85rem; margin: 0.4rem 0 1rem; }

#games-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.8rem; }
.game-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.55rem;
}
.game-card.is-hidden { opacity: 0.6; border-style: dashed; }
.game-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.game-titles { min-width: 0; }
.game-title { font-family: var(--serif); font-weight: 500; font-size: 1.06rem; color: var(--cream); margin: 0; line-height: 1.2; }
.game-badge {
  display: inline-block; margin-left: 0.5rem; font-family: var(--sans); font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--amber); vertical-align: middle;
  border: 1px solid var(--amber-dk); border-radius: 999px; padding: 0.05rem 0.45rem;
}
.game-subtitle { color: var(--muted); font-size: 0.82rem; margin: 0.15rem 0 0; }
.game-actions { display: flex; gap: 0.3rem; flex: none; }
.icon-btn {
  background: none; border: 1px solid var(--line-2); border-radius: 6px;
  color: var(--muted); cursor: pointer; width: 1.9rem; height: 1.9rem; font-size: 0.9rem;
  display: inline-flex; align-items: center; justify-content: center; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--amber); border-color: var(--amber-dk); }

.game-facts { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.game-fact {
  font-size: 0.78rem; color: var(--cream); background: var(--ink-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.6rem;
}
.game-fact.cat { color: var(--amber); border-color: var(--amber-dk); }
.game-meta { color: var(--muted); font-size: 0.78rem; margin: 0; line-height: 1.4; }

.game-modal { max-width: 620px; }
.game-modal .gm-msg { color: var(--danger); font-size: 0.85rem; margin: 0.5rem 0 0; }
@media (max-width: 520px) { .games-filters #add-game { margin-left: 0; } }

/* ==================================================================== */
/* Liste de courses (/bar/courses.html, /bar/courses-faire.html)        */
/* ==================================================================== */
.courses-main { max-width: 820px; margin: 0 auto; padding: 0 1.25rem 5rem; }

.courses-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.2rem; }
.courses-tab {
  padding: 0.5rem 1rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 0.9rem;
}
.courses-tab.active { color: var(--ink); background: var(--amber); border-color: var(--amber); }
.courses-tab:not(.active):hover { color: var(--cream); border-color: var(--line-2); }

.courses-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.7rem;
  padding: 0.9rem 1rem; margin-bottom: 0.8rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.courses-toolbar .gf { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.72rem; color: var(--muted); }
.courses-toolbar .gf span { text-transform: uppercase; letter-spacing: 0.08em; }
.courses-toolbar input, .courses-toolbar select {
  font: inherit; font-size: 0.9rem; color: var(--cream); background: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 0.4rem 0.6rem;
}
.courses-toolbar .btn { align-self: flex-end; }
#save-list { margin-left: auto; }
.btn.active { background: var(--amber); color: var(--ink); border-color: var(--amber); }

.courses-hint {
  background: var(--ink-2); border: 1px dashed var(--line-2); border-radius: 6px;
  padding: 0.6rem 0.8rem; font-size: 0.85rem; color: var(--muted);
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
}
.courses-summary { color: var(--muted); font-size: 0.85rem; margin: 0.4rem 0 1rem; }

.course-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.8rem; border: 1px solid var(--line); border-radius: 6px;
  margin-bottom: 0.4rem; background: var(--surface);
}
.course-row.has-qty { border-color: var(--amber-dk); background: rgba(227,165,82,0.06); }
.course-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.course-name { color: var(--cream); font-size: 0.95rem; }
.course-sub { color: var(--muted); font-size: 0.76rem; }

.course-qty { display: flex; align-items: center; gap: 0.3rem; flex: none; }
.course-qty input {
  width: 3.2rem; text-align: center; font: inherit; color: var(--cream);
  background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 0.3rem;
}
.row-order { display: flex; flex-direction: column; gap: 0.15rem; flex: none; }
.icon-btn {
  background: none; border: 1px solid var(--line-2); border-radius: 6px; color: var(--muted);
  cursor: pointer; min-width: 1.9rem; height: 1.7rem; font-size: 0.85rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover:not(:disabled) { color: var(--amber); border-color: var(--amber-dk); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* Faire les courses */
.shop-row .shop-check { width: 1.4rem; height: 1.4rem; flex: none; cursor: pointer; accent-color: var(--amber); }
.shop-qty { flex: none; color: var(--amber); font-weight: 600; font-size: 0.95rem; }
.shop-row.picked { opacity: 0.55; }
.shop-row.picked .course-name { text-decoration: line-through; }

.save-toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  padding: 0.6rem 1.1rem; border-radius: 999px; font-size: 0.9rem; z-index: 60;
  background: var(--ok); color: #0f1a0c; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.save-toast.err { background: var(--danger); color: #2a0f08; }

@media (max-width: 520px) {
  #save-list { margin-left: 0; }
  .course-sub { font-size: 0.72rem; }
}

/* Journal des courses */
.journal-row { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--line); }
.journal-badge { flex: none; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.journal-badge.act-save { color: var(--amber); border-color: var(--amber-dk); }
.journal-badge.act-pick { color: var(--ok); border-color: rgba(127,175,111,0.5); }
.journal-badge.act-delete { color: var(--danger); border-color: rgba(217,119,78,0.5); }
.journal-body { display: flex; flex-direction: column; min-width: 0; }
.journal-detail { color: var(--cream); font-size: 0.9rem; }
.journal-meta { color: var(--muted); font-size: 0.76rem; }

/* Mercuriale (gestion) */
.merc-row { display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem; padding: 0.55rem 0.8rem; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 0.4rem; background: var(--surface); }
.merc-name { color: var(--cream); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.merc-actions { display: flex; align-items: center; gap: 0.5rem; }
.merc-dots { display: inline-flex; align-items: center; gap: 0.4rem; margin-left: 0.2rem; }
.merc-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.merc-dot-room { background: #4a90d9; }   /* pièce définie */
.merc-dot-aisle { background: #e3c84f; }  /* rayon défini */
/* anciennes classes conservées pour compatibilité */
.merc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.merc-price { flex: none; color: var(--amber); font-size: 0.9rem; white-space: nowrap; }
.gm-msg { color: var(--danger); font-size: 0.85rem; margin: 0.5rem 0 0; }

/* Glisser-déposer */
.drag-handle { flex: none; cursor: grab; color: var(--muted); font-size: 1.2rem; padding: 0 0.2rem; user-select: none; }
.course-row.dragging { opacity: 0.5; }
.course-row.drag-over { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }

/* Produits désactivés + badge "hors catalogue" */
.merc-row.inactive, .course-row.inactive { opacity: 0.5; }
.course-badge {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 0.05rem 0.4rem; vertical-align: middle;
}
.merc-toggle { flex: none; white-space: nowrap; }
/* La poignée ne doit pas déclencher le défilement pendant le glissé tactile */
.drag-handle { touch-action: none; }

/* Pièces & rayons */
.rangement-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.rangement-col h2 { font-family: var(--serif); font-weight: 500; font-size: 1.1rem; color: var(--amber); margin: 0 0 0.6rem; }
.rangement-col h2 .course-sub { font-family: var(--sans); font-size: 0.75rem; }
.courses-toolbar.compact { padding: 0.6rem 0.8rem; gap: 0.5rem; }
.courses-toolbar.compact input { flex: 1; font: inherit; font-size: 0.9rem; color: var(--cream); background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 0.4rem 0.6rem; }
.rangement-name { flex: 1; min-width: 0; font: inherit; font-size: 0.92rem; color: var(--cream); background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 0.35rem 0.5rem; }

/* En-tête de groupe (pièce / rayon) */
.group-header {
  font-family: var(--serif); font-weight: 500; font-size: 0.95rem; color: var(--amber);
  margin: 1rem 0 0.4rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--amber-dk);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.group-header:first-child { margin-top: 0; }
@media (max-width: 620px) { .rangement-grid { grid-template-columns: 1fr; } }

/* Rangement : sous-liste des produits d'une catégorie (dépliée) */
.expand-btn { flex: none; min-width: 2.6rem; font-variant-numeric: tabular-nums; }
.expand-btn.open { color: var(--amber); border-color: var(--amber-dk); }
.rangement-items {
  margin: 0.15rem 0 0.6rem 1.8rem;
  padding: 0.3rem 0.4rem;
  border-left: 2px solid var(--amber-dk);
  display: flex; flex-direction: column; gap: 0.25rem;
}
.item-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 6px;
}
.item-row .drag-handle { font-size: 1.05rem; }
.item-name { flex: 1; min-width: 0; color: var(--cream); font-size: 0.86rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty.small { padding: 0.4rem 0.5rem; font-size: 0.82rem; }

/* ==================================================================== */
/* Barre de navigation groupée (menus déroulants)                       */
/* ==================================================================== */
.nav-group { position: relative; display: inline-block; }
.nav-group-btn {
  font: inherit; cursor: pointer; color: var(--muted);
  background: none; border: none; padding: 0.2rem 0.3rem;
  display: inline-flex; align-items: center; gap: 0.25rem;
}
.nav-group-btn:hover, .nav-group-btn.active { color: var(--cream); }
.nav-group-btn .caret { font-size: 0.7em; opacity: 0.8; transition: transform .15s; }
.nav-group.open .nav-group-btn .caret { transform: rotate(180deg); }
.nav-group-btn.active { color: var(--amber); }

.nav-dropdown {
  position: absolute; top: 100%; left: 0; z-index: 70;
  min-width: 13rem; margin-top: 0.35rem;
  background: var(--ink-2); border: 1px solid var(--line-2);
  border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.45);
  padding: 0.3rem; display: none; flex-direction: column; gap: 0.1rem;
}
.nav-group.open .nav-dropdown { display: flex; }
@media (hover: hover) { .nav-group:hover .nav-dropdown { display: flex; } }
.nav-dropdown a {
  display: block; padding: 0.45rem 0.7rem; border-radius: 6px;
  color: var(--cream); text-decoration: none; font-size: 0.9rem; white-space: nowrap;
}
.nav-dropdown a:hover { background: var(--surface); color: var(--amber); }
.nav-dropdown a.active { color: var(--amber); background: rgba(227,165,82,0.1); }
.top-links .staff-link.active { color: var(--amber); }

/* Hub admin : boutons groupés */
.admin-nav-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.admin-nav-group {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  padding-top: 0.5rem; margin-top: 0.3rem; border-top: 1px solid var(--line);
}
.admin-nav-label {
  flex: 0 0 100%; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--amber); margin-bottom: 0.1rem;
}
.admin-nav { flex-direction: column; align-items: stretch; }

/* Filtres mercuriale (sans pièce / sans rayon) */
.merc-filter {
  display: inline-flex; align-items: center; gap: 0.35rem; align-self: flex-end;
  font-size: 0.85rem; color: var(--cream); white-space: nowrap; cursor: pointer;
  padding: 0.4rem 0.2rem;
}
.merc-filter input { cursor: pointer; accent-color: var(--amber); }

/* ---------------- Matériel (matos.html) ---------------- */
.matos-card {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.7rem 0.8rem; margin-bottom: 0.6rem;
}
.matos-card.dragging { opacity: 0.5; }
.matos-card.drag-over { border-color: var(--amber); }
.matos-card .drag-handle { align-self: center; }
.matos-thumb {
  flex: none; width: 60px; height: 80px; border-radius: 6px; overflow: hidden;
  background: var(--ink-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.matos-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.matos-thumb-empty { font-size: 0.65rem; color: var(--muted); text-align: center; padding: 0 0.2rem; }
.matos-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.matos-name { font-weight: 600; color: var(--cream); }
.matos-supplier { font-size: 0.82rem; color: var(--amber); }
.matos-desc { font-size: 0.85rem; color: var(--muted); white-space: pre-wrap; }
.matos-card .matos-edit { align-self: center; flex: none; }

/* Modale : édition de la photo */
.matos-photo-edit { display: flex; gap: 0.9rem; align-items: flex-start; }
.matos-photo-preview {
  flex: none; width: 90px; height: 120px; border-radius: 6px; overflow: hidden;
  background: var(--ink-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.matos-photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.matos-photo-preview span { font-size: 0.7rem; color: var(--muted); }
.matos-photo-actions { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.matos-photo-actions label.btn { margin: 0; }
.matos-photo-note { font-size: 0.78rem; color: var(--muted); margin: 0; }

/* ---------------- Matériel : page de consultation (accordéon) ---------------- */
.matos-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 0.5rem; overflow: hidden;
}
.matos-item.open { border-color: var(--amber); }
.matos-toggle {
  width: 100%; display: flex; align-items: center; gap: 0.6rem;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 0.75rem 0.9rem; color: var(--cream); font: inherit;
}
.matos-toggle:hover { background: var(--ink-2); }
.matos-caret { flex: none; color: var(--amber); width: 1rem; }
.matos-toggle .matos-title { font-weight: 600; }
.matos-toggle .matos-supplier { margin-left: auto; font-size: 0.82rem; color: var(--amber); }
.matos-collapse { padding: 0 0.9rem 0.9rem; }
.matos-collapse .matos-desc { color: var(--muted); white-space: pre-wrap; margin: 0.2rem 0 0.7rem; }
.matos-photo {
  display: block; width: 100%; max-width: 300px; height: auto;
  border-radius: 8px; border: 1px solid var(--line);
}
.matos-nophoto { color: var(--muted); font-size: 0.85rem; font-style: italic; margin: 0.2rem 0 0; }

/* ---------------- Planning (planning.html) ---------------- */
.plan-weekbar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin: 0.4rem 0 1rem; padding: 0.5rem 0.6rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.plan-weeklabel { display: flex; flex-direction: column; line-height: 1.15; min-width: 9rem; text-align: center; }
.plan-weeklabel strong { color: var(--cream); }
.plan-weekrange { font-size: 0.8rem; color: var(--muted); }
#wk-prev, #wk-next { font-size: 1.2rem; padding: 0.1rem 0.7rem; }
.plan-pub-status {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.plan-pub-status.draft { color: var(--amber); border: 1px solid var(--amber-dk); }
.plan-pub-status.published { color: var(--ok); border: 1px solid var(--ok); }
.worked-field { border-top: 1px solid var(--line); padding-top: 0.8rem; margin-top: 0.4rem; }
.worked-field > label { color: var(--amber); }

#plan-days {
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  overflow-x: auto;              /* 7 jours sur une ligne, défilement si écran étroit */
  padding-bottom: 0.3rem;
}
/* Pages du planning : la barre de nav peut passer à la ligne (évite tout
   débordement horizontal de la page quelle que soit la largeur). */
.plan-page .top-links { flex-wrap: wrap; justify-content: flex-end; }

/* Sur grand écran (ordi / tablette) : page du planning plus large et 7 jours
   affichés d'un coup, sans défilement horizontal. */
@media (min-width: 820px) {
  .plan-main { max-width: 1240px; }
  .plan-page .topbar-inner { max-width: 1240px; }
  #plan-days { grid-template-columns: repeat(7, minmax(0, 1fr)); overflow-x: visible; }
  /* Grille : resserrée pour tenir sur la largeur sans défilement horizontal. */
  .plan-grid { min-width: 0; font-size: 0.8rem; }
  .plan-grid th, .plan-grid td { padding: 0.35rem 0.4rem; }
  .plan-grid-person { white-space: normal; }
}
.time-input { font-variant-numeric: tabular-nums; }
.plan-day {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.plan-day-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); background: var(--ink-2);
}
.plan-day-name { font-weight: 600; color: var(--cream); }
.plan-day-date { font-size: 0.8rem; color: var(--muted); }
.plan-day-body { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.plan-day-body.editable { cursor: pointer; }
.plan-empty { color: var(--muted); text-align: center; font-size: 0.85rem; padding: 0.4rem 0; }
.plan-add { margin: 0 0.5rem 0.5rem; }

.plan-shift {
  background: var(--ink-2); border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 6px; padding: 0.4rem 0.55rem; cursor: pointer;
}
.plan-shift:hover { border-color: var(--amber); }
.plan-shift.propose { border-left-style: dashed; opacity: 0.9; }
.plan-shift-main { display: flex; align-items: center; gap: 0.4rem; }
.plan-person { font-weight: 600; color: var(--cream); }

/* Pastilles de statut : ? proposé, ✓ validé, ! problème signalé. */
.plan-status-wrap { display: inline-flex; gap: 0.25rem; margin-left: auto; }
.plan-status {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  font-size: 0.72rem; font-weight: 700; line-height: 1; flex: none;
}
.plan-status.st-propose { background: var(--amber); color: var(--ink); }
.plan-status.st-valide  { background: var(--ok); color: #0b2a12; }
.plan-status.st-flag    { background: var(--danger); color: #fff; }
.plan-status.st-worked  { background: var(--ink-2); color: var(--amber); border: 1px solid var(--amber); }
.plan-status.st-worked svg { width: 72%; height: 72%; display: block; }
.plan-cell-shift .plan-status { width: 0.95rem; height: 0.95rem; font-size: 0.68rem; vertical-align: middle; }
.plan-badge {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--amber-dk); color: #000; border-radius: 4px; padding: 0.05rem 0.3rem;
}
.plan-shift-sub { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.15rem; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; }
.plan-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; flex: none; }
.plan-time { color: var(--cream); }
.plan-note { font-size: 0.8rem; color: var(--muted); font-style: italic; margin-top: 0.2rem; }

.plan-modal-day { color: var(--amber); font-weight: 600; margin: 0 0 0.6rem; }

/* Réglages */
.modal-wide { max-width: 640px; }
.plan-set-block { margin-bottom: 1.2rem; }
.plan-set-block h3 { margin: 0 0 0.5rem; color: var(--cream); font-size: 1rem; }
.plan-set-list { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.5rem; }
.plan-set-row { display: flex; gap: 0.35rem; align-items: center; }
.plan-set-row input[type="text"] { flex: 1; min-width: 5rem; }
.plan-set-row input[type="time"] { width: 7rem; }
.plan-set-row input[type="color"] { width: 2.5rem; padding: 0; height: 2rem; }
.plan-set-add { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.plan-set-add input[type="text"] { flex: 1; min-width: 7rem; }
.plan-set-add input[type="time"] { width: 7rem; }

/* ---------------- Planning : vue grille ---------------- */
.plan-grid-wrap { overflow-x: auto; }
.plan-grid { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 0.85rem; }
.plan-grid th, .plan-grid td {
  border: 1px solid var(--line); padding: 0.4rem 0.5rem; vertical-align: top; text-align: left;
}
.plan-grid thead th {
  background: var(--ink-2); color: var(--cream); position: sticky; top: 0; z-index: 2; text-align: center;
}
.plan-grid-day { display: block; font-weight: 600; }
.plan-grid-date { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 400; }
.plan-grid-corner { text-align: left; }
.plan-grid-person {
  background: var(--surface); color: var(--cream); font-weight: 600; white-space: nowrap;
  position: sticky; left: 0; z-index: 1;
}
.plan-grid td { background: var(--ink); }
.plan-grid-total { text-align: center; color: var(--amber); font-weight: 600; white-space: nowrap; }
thead .plan-grid-total { color: var(--cream); }
.plan-grid-empty { color: var(--line-2); }
.plan-cell-shift {
  display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 0.1rem 0.35rem; margin: 0.1rem 0.1rem 0 0; color: var(--cream);
}
.plan-cell-shift.propose { border-style: dashed; opacity: 0.85; }
.plan-grid td:has(.plan-cell-shift) { white-space: normal; }
/* Grille éditable (éditeurs) */
.plan-cell-shift { cursor: pointer; touch-action: none; }
.plan-cell-shift:hover { border-color: var(--amber); }
.plan-grid-dayhead.editable, .plan-grid-cell.editable { cursor: pointer; }
.plan-grid-dayhead.editable:hover { background: var(--ink-2); }
.plan-grid-cell.editable:hover { outline: 1px solid var(--line-2); outline-offset: -1px; }
.plan-grid .col-drop { background: rgba(200,150,62,0.18) !important; }
.plan-grid-hint { text-align: center; color: var(--muted); font-style: italic; padding: 0.8rem; }

/* Contrats à faire */
.ct-table { border-collapse: collapse; width: 100%; }
.ct-table th, .ct-table td { border: 1px solid var(--line); padding: 0.55rem 0.7rem; text-align: left; vertical-align: top; }
.ct-table thead th { background: var(--ink-2); color: var(--cream); font-weight: 600; }
.ct-person { background: var(--surface); color: var(--cream); font-weight: 600; white-space: nowrap; }
.ct-periods { background: var(--ink); }
.ct-period { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.15rem 0; }
.ct-period + .ct-period { border-top: 1px dashed var(--line); margin-top: 0.15rem; padding-top: 0.4rem; }
.ct-range { color: var(--cream); }
.ct-days { color: var(--amber); font-weight: 600; font-size: 0.82rem; white-space: nowrap; }

/* ---------------- Planning : glisser-déposer des shifts ---------------- */
.plan-shift { touch-action: none; }                 /* le pointer-drag prime sur le scroll */
.plan-shift.dragging { opacity: 0.4; }
.plan-day.drop-target { outline: 2px dashed var(--amber); outline-offset: -2px; }
.plan-ghost {
  position: fixed; z-index: 3000; pointer-events: none; transform: translate(-50%, -50%);
  opacity: 0.9; box-shadow: 0 6px 18px rgba(0,0,0,.5);
  background: var(--ink-2); border: 1px solid var(--amber); border-left: 3px solid var(--amber);
  border-radius: 6px; padding: 0.4rem 0.55rem; max-width: 220px;
}
.plan-chooser {
  position: fixed; z-index: 3100; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.plan-chooser button {
  background: none; border: none; color: var(--cream); text-align: left;
  padding: 0.5rem 0.9rem; border-radius: 5px; cursor: pointer; font: inherit; white-space: nowrap;
}
.plan-chooser button:hover { background: var(--ink-2); }
.plan-chooser button.cancel { color: var(--muted); }

/* Compteur de personnes par jour (planning) */
.plan-day-count { font-size: 0.72rem; color: var(--amber); font-weight: 600; margin-left: 0.4rem; }
.plan-grid-count { display: block; font-size: 0.72rem; color: var(--amber); font-weight: 600; margin-top: 2px; }

/* Planning : signalements & fiche de shift */
.plan-flag { font-size: 0.72rem; color: #e06666; font-weight: 700; margin-left: auto; }
.plan-cell-flag { color: #e06666; font-weight: 700; }
.sd-info { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.4rem 0 0.9rem; font-size: 0.9rem; }
.sd-info .sd-k { display: inline-block; min-width: 5.5rem; color: var(--muted); }
.sd-flags-block { border-top: 1px solid var(--line); padding-top: 0.7rem; margin-top: 0.3rem; }
.sd-h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--cream); }
.sd-flags { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.sd-noflag { color: var(--muted); font-size: 0.85rem; }
.sd-flag { background: var(--ink-2); border: 1px solid var(--line); border-left: 3px solid #e06666; border-radius: 6px; padding: 0.4rem 0.55rem; }
.sd-flag.resolved { border-left-color: var(--ok); opacity: 0.7; }
.sd-flag-text { color: var(--cream); font-size: 0.88rem; white-space: pre-wrap; }
.sd-flag-meta { color: var(--muted); font-size: 0.75rem; margin-top: 0.2rem; }
.sd-flag .sd-flag-res { margin-top: 0.35rem; }
.sd-flag-add { display: flex; flex-direction: column; gap: 0.4rem; }
.sd-flag-add textarea { width: 100%; min-height: 3.2rem; resize: vertical; }
.sd-flag-add .btn { align-self: flex-start; }

/* Badge « MDP à redéfinir » (admin comptes) */
.badge-warn { display: inline-block; font-size: 0.7rem; font-weight: 600; color: #000; background: var(--amber); border-radius: 4px; padding: 0.05rem 0.35rem; margin-left: 0.3rem; vertical-align: middle; }

/* ---------------- Heures travaillées ---------------- */
.hours-total { font-weight: 600; color: var(--amber); white-space: nowrap; }
.hours-dur { color: var(--muted); font-size: 0.85rem; margin: 0.1rem 0 0.6rem; }
.hours-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 0.6rem; overflow: hidden; }
.hours-day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0.5rem 0.7rem; background: var(--ink-2); border-bottom: 1px solid var(--line); }
.hours-day-head span:first-child { font-weight: 600; color: var(--cream); text-transform: capitalize; }
.hours-day-total { color: var(--amber); font-weight: 600; font-size: 0.9rem; }
.hours-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 0.6rem; align-items: center; padding: 0.45rem 0.7rem; border-top: 1px solid var(--line); }
.hours-row:first-of-type { border-top: none; }
.hours-time { color: var(--cream); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hours-dur-cell { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.hours-note { color: var(--muted); font-size: 0.85rem; font-style: italic; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bilan : cellules d'heures décimales */
.hb-cell { text-align: center; font-variant-numeric: tabular-nums; color: var(--cream); }
.hb-grid tfoot th, .hb-grid tfoot td { background: var(--ink-2); font-weight: 600; border-top: 2px solid var(--line-2); }
.hb-foot .plan-grid-person { color: var(--cream); }

/* Sélecteur de date maison (page Heures) */
.date-picker { position: relative; }
.date-display { cursor: pointer; }
.date-cal { margin-top: 0.4rem; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 0.5rem; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.cal-title { font-weight: 600; color: var(--cream); text-transform: capitalize; }
.cal-nav { background: none; border: none; color: var(--cream); cursor: pointer; font-size: 1.15rem; padding: 0.1rem 0.6rem; border-radius: 5px; }
.cal-nav:hover { background: var(--ink-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wdh { text-align: center; font-size: 0.72rem; color: var(--muted); padding: 0.2rem 0; text-transform: capitalize; }
.cal-day { background: var(--ink-2); border: 1px solid var(--line); color: var(--cream); border-radius: 5px; padding: 0.4rem 0; cursor: pointer; font: inherit; }
.cal-day:hover { border-color: var(--amber); }
.cal-day.today { outline: 1px solid var(--amber); outline-offset: -1px; }
.cal-day.sel { background: var(--amber); color: #000; font-weight: 600; border-color: var(--amber); }
.cal-empty { visibility: hidden; }

/* Bilan des heures : cellules cliquables + détail */
.hb-cell[data-uid] { cursor: pointer; }
.hb-cell[data-uid]:hover { background: var(--ink-2); }
.hc-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.7rem; }
.hc-row { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 0.5rem; align-items: center; background: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.55rem; }
.hc-empty { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.7rem; }

/* Dupliquer la semaine */
.dup-src { color: var(--muted); font-size: 0.88rem; margin: 0.2rem 0 0.8rem; }
.dup-target { display: flex; align-items: center; gap: 0.6rem; }
.dup-target-label { display: flex; flex-direction: column; line-height: 1.15; text-align: center; min-width: 11rem; }
.dup-target-label strong { color: var(--cream); }

/* Planning : bouton Ajouter en haut de colonne + filtre personne */
.plan-day .plan-add { margin: 0 0.5rem 0.5rem; }
.plan-person-filter { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.plan-person-filter select { max-width: 11rem; }

/* Congés */
.leave-row { display: grid; grid-template-columns: auto 1fr auto; gap: 0.6rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.55rem 0.75rem; margin-bottom: 0.5rem; }
.leave-dates { font-weight: 600; color: var(--cream); white-space: nowrap; }
.leave-meta { color: var(--muted); font-size: 0.85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Filigrane des congés dans le planning */
.plan-leave { margin: 0 0.5rem 0.5rem; padding: 0.3rem 0.5rem; font-size: 0.74rem; font-style: italic; color: var(--muted); border-top: 1px dashed var(--line); opacity: 0.8; }

/* Tous les congés : étiquette personne */
.leave-person { font-weight: 600; color: var(--amber); }

/* Congés : ligne en flex (gère 3 ou 4 colonnes) + congé en cours */
.leave-row { display: flex; flex-wrap: wrap; align-items: center; }
.leave-row .leave-dates { white-space: nowrap; }
.leave-row .leave-meta { flex: 1 1 8rem; }
.leave-row .icon-btn { margin-left: auto; }
.leave-current { border-left: 3px solid var(--amber); }

/* Tous les congés : onglets boutons + vues mois / bilan */
button.courses-tab { background: none; font: inherit; cursor: pointer; }
.cg-month { margin-bottom: 1rem; }
.cg-month-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0.3rem 0.2rem; border-bottom: 1px solid var(--line-2); margin-bottom: 0.4rem; }
.cg-month-head span:first-child { font-weight: 600; color: var(--cream); }
.cg-month-total { font-size: 0.82rem; color: var(--amber); }
.cg-bilan { width: 100%; }
.cg-bilan .num { text-align: center; font-variant-numeric: tabular-nums; }
.cg-bilan .cg-days { color: var(--amber); font-weight: 600; }
.cg-bilan tfoot th { background: var(--ink-2); border-top: 2px solid var(--line-2); }

/* ===== Bilan des heures (cumul des shifts réalisés) ===== */
#bl-wrap { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 5rem; }
.bl-person { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.bl-person-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .7rem .95rem; background: var(--ink-2); border-bottom: 1px solid var(--line); }
.bl-person-name { margin: 0; font-family: var(--serif); font-size: 1.08rem; color: var(--cream); }
.bl-person-total { font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-person-hm { color: var(--muted); font-weight: 400; font-size: .85em; }
.bl-shifts { display: flex; flex-direction: column; }
.bl-shift { display: grid; grid-template-columns: auto minmax(8rem,1.4fr) auto auto 1fr; align-items: center;
  gap: .6rem; padding: .5rem .95rem; border-top: 1px solid var(--line); cursor: pointer; }
.bl-shift:first-child { border-top: none; }
.bl-shift:hover { background: var(--ink-2); }
.bl-shift .bl-cb { width: 1.05rem; height: 1.05rem; accent-color: var(--amber); cursor: pointer; }
.bl-day { text-transform: capitalize; color: var(--cream); }
.bl-planned { color: var(--muted); font-variant-numeric: tabular-nums; }
.bl-real { color: var(--cream); font-variant-numeric: tabular-nums; }
.bl-dur { text-align: right; color: var(--cream); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bl-dur strong { color: var(--amber); }
.bl-shift-empty .bl-real, .bl-shift-empty .bl-dur { opacity: .62; }
.bl-none-tag { color: var(--danger); font-style: italic; font-size: .9em; }

.bl-sticky { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  display: flex; align-items: baseline; gap: .7rem; z-index: 40;
  background: var(--amber); color: var(--ink); padding: .6rem 1.1rem; border-radius: 999px;
  box-shadow: 0 6px 22px rgba(0,0,0,.4); }
.bl-sticky-label { font-weight: 600; }
.bl-sticky-total { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.bl-sticky-sub { color: var(--ink); opacity: .72; font-size: .9rem; }

@media (max-width: 620px) {
  .bl-shift { grid-template-columns: auto 1fr auto; row-gap: .15rem; }
  .bl-planned { grid-column: 2; font-size: .85rem; }
  .bl-real { grid-column: 2; font-size: .9rem; }
  .bl-dur { grid-column: 3; grid-row: 1 / span 3; align-self: center; }
  .bl-day { grid-column: 2; grid-row: 1; }
}

/* ===== Faire les courses : sélecteur Inventaire / Liste ===== */
.mode-toggle { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 1rem; flex-wrap: wrap; }
.mode-toggle .mode-sub { color: var(--muted); font-size: 0.9rem; margin-left: 0.25rem; }

/* ===== Bilan des heures : filtre par type de contrat (admin) ===== */
.bl-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.9rem; margin: 0 0 1rem; }
.bl-filter-label { color: var(--muted); font-size: 0.9rem; }
.bl-cf-item { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--cream); cursor: pointer; white-space: nowrap; }
.bl-cf-item input { accent-color: var(--amber); cursor: pointer; }
