/* ===== Tokens ===== */
:root {
  --bg: #EFEEE3;
  --surface: #FFFFFF;
  --ink: #26312A;
  --ink-soft: #5B6B5F;
  --line: #DAD6C6;
  
  /* ==== NOUVELLE PALETTE PRINCIPALE ==== */
  --primary: #50B6DB;
  --primary-light: #7EC8E3;
  --primary-dark: #267FA9;
  --primary-ink: #FFFFFF;
  
  --accent: #FFD000;
  --accent-light: #FFE066;
  --accent-dark: #E6B800;
  --accent-soft: #FFF8E1;
  --accent-fg: #8B4513;
  
  /* ==== Autres couleurs ==== */
  --warn: #A23B2E;
  --warn-soft: #F5DAD3;
  --success: #4CAF50;
  --info: #2196F3;
  --bg-hover: #E8E6DA;
  --bg-panel: #FDFBFA;
  --text: #26312A;
  --text-strong: #1A231C;
  --text-muted: #6B7A6F;
  --border: #DAD6C6;
  --danger: #A23B2E;
  --danger-bg: #F5DAD3;

  --font-display: "Fraunces", serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ===== LOGO & BRAND ENHANCEMENTS ===== */
/* Logo: assiette avec couverts - couleurs principales: bleu #50B6DB, jaune #FFD000 */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(80, 182, 219, 0.1), rgba(255, 208, 0, 0.08));
  border-radius: 50%; /* Forme d'assiette */
  border: 1px solid rgba(255, 208, 0, 0.15);
  padding: 6px;
  transition: all 0.3s ease;
  color: var(--accent);
  position: relative;
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 208, 0, 0.1);
  pointer-events: none;
}

.brand-mark:hover {
  transform: scale(1.08) rotate(2deg);
  background: linear-gradient(135deg, rgba(80, 182, 219, 0.15), rgba(255, 208, 0, 0.12));
  box-shadow: 0 4px 12px rgba(255, 208, 0, 0.2);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  animation: pulse-soft 3s ease-in-out infinite, float 6s ease-in-out infinite;
  transition: transform 0.3s ease;
}

.brand-mark:hover svg {
  transform: scale(1.05);
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2px) rotate(1deg); }
}

.brand h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand h1::after {
  content: "🍽️";
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  font-size: 0.8em;
  opacity: 0.8;
}

.tagline {
  margin: 4px 0 0;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  position: relative;
  padding-left: 12px;
}

.tagline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 3px;
  background: var(--primary-dark);
  border-radius: 50%;
}

/* ===== BUTTONS ENHANCEMENTS ===== */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 2px 4px rgba(80, 182, 219, 0.15);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(80, 182, 219, 0.2);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(255, 208, 0, 0.2);
}

.btn-accent:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(255, 208, 0, 0.25);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--primary-light);
  color: var(--primary-dark);
}

/* ===== CARDS ENHANCEMENTS ===== */
.menu-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s ease;
}

.menu-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
}

.menu-card:hover {
  box-shadow: 0 8px 25px rgba(80, 182, 219, 0.15);
  transform: translateY(-3px);
}

.menu-card-titre h3 {
  position: relative;
  padding-bottom: 8px;
}

.menu-card-titre h3::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background: var(--primary);
}

/* ===== TOOLBAR ENHANCEMENTS ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
}

#recherche, #filtre-categorie {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

#recherche:focus, #filtre-categorie:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(80, 182, 219, 0.1);
}

.toolbar-spacer {
  flex: 1;
}

/* ===== TABLE WRAP ENHANCEMENTS ===== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ===== SECTION LABEL ENHANCEMENTS ===== */
.section-label {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-label span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary-dark);
  border: 1px solid var(--primary-dark);
  border-radius: 20px;
  padding: 2px 8px;
  background: rgba(80, 182, 219, 0.1);
}

/* ===== TOPbar ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  padding: 28px clamp(20px, 5vw, 56px) 0;
  border-bottom: 1px solid var(--line);
}

.tabs { display: flex; gap: 4px; }
.tab {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
}
.tab:hover {
  color: var(--ink);
  background: rgba(255, 208, 0, 0.05);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary-dark);
  font-weight: 600;
  background: rgba(80, 182, 219, 0.03);
}

/* ===== Layout ===== */
main { padding: 28px clamp(20px, 5vw, 56px) 80px; max-width: 1080px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: fade-in .25s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  background: #F7F6EF;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAF9F2; cursor: pointer; }
.qty { font-family: var(--font-mono); }
.categorie-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent-fg);
}
.dlc-proche { color: var(--warn); font-weight: 600; }
.etat-vide, .etat-vide-large {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 20px;
  font-size: 14px;
}
.etat-vide-large {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  margin-top: 20px;
}

/* ===== Banner ===== */
.banner {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.banner-info { background: var(--accent-soft); color: var(--accent-fg); border: 1px solid var(--accent-light); }

/* ===== Menu generator ===== */
.menu-generator {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-grow { flex: 1; min-width: 200px; }
.field-row { display: flex; gap: 12px; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.field input {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}

.field select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}

#nb-jours, #nb-personnes { width: 90px; }

.courses-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.courses-list li {
  display: flex;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.courses-list li:last-child { border-bottom: none; }
.courses-list .qte { font-family: var(--font-mono); color: var(--ink-soft); }

.statut-badge {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--primary-dark);
}

.apply-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.statut-texte { font-size: 13px; color: var(--ink-soft); margin: 0; }

/* ===== Modale ===== */
.modale-overlay {
  position: fixed; inset: 0;
  background: rgba(38,49,42,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modale {
  background: var(--surface);
  border-radius: 14px;
  padding: 26px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modale h2 { font-family: var(--font-display); margin: 0 0 18px; font-size: 20px; }
.modale .field { margin-bottom: 14px; }
.modale-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--primary-ink);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 60;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  th:nth-child(5), td:nth-child(5) { display: none; }
}

/* Fix pour masquer la modale quand hidden=true */
.modale-overlay[hidden] {
  display: none !important;
}

/* ===== Onglet Foyer ===== */
.foyer-container {
  max-width: 600px;
  margin: 0 auto;
}

.foyer-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink);
}

.foyer-description {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0;
}

.foyer-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.foyer-section {
  margin-bottom: 24px;
}

.foyer-section:last-child {
  margin-bottom: 0;
}

.foyer-section h3 {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  font-size: 18px;
}

.field-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 4px 0 0;
}

.foyer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* Foyer Sub Tabs */
.foyer-sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.foyer-sub-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}

.foyer-sub-tab:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.foyer-sub-tab.active {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.foyer-tab-content {
  display: block;
}

.foyer-tab-content[hidden] {
  display: none;
}

/* Foyer Members */
.foyer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.foyer-header .btn {
  margin-left: auto;
}

.foyer-membres-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.foyer-membres-header h3 {
  margin: 0;
  font-size: 18px;
}

.foyer-membres-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.foyer-membre-card,
.foyer-invitation-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow 0.15s;
}

.foyer-membre-card:hover,
.foyer-invitation-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.foyer-membre-info,
.foyer-invitation-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.foyer-membre-info strong,
.foyer-invitation-info strong {
  font-size: 15px;
  color: var(--ink);
}

.foyer-membre-info small,
.foyer-invitation-info small {
  font-size: 13px;
  color: var(--ink-soft);
}

.foyer-membre-role {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 4px;
}

.foyer-invitation-status {
  display: inline-block;
  padding: 2px 8px;
  background: var(--warning-bg);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--warning);
  margin-top: 4px;
}

.foyer-membre-actions,
.foyer-invitation-actions {
  display: flex;
  gap: 8px;
}

.foyer-membres-pending {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.foyer-membres-pending h4 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--ink);
}

.foyer-invitations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Onglet Mes Menus ===== */
.menus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.menu-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.menu-card-titre {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-card-date {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

.menu-card-badge {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-jours {
  background: var(--primary);
  color: var(--primary-ink);
}

.badge-etapes {
  background: var(--primary-dark);
  color: var(--primary-ink);
}

.badge-applique {
  background: var(--accent);
  color: var(--primary-dark);
}

.menu-card-body {
  margin-bottom: 12px;
}

.menu-card-nb-courses {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

.menu-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.menu-card-footer .btn {
  padding: 8px 16px;
  font-size: 13px;
}

/* ===== Modale Menu ===== */
.modale-large {
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.modale-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modale-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
}

.modale-close {
  padding: 8px 12px;
  font-size: 14px;
}

.modale-body {
  padding: 0;
}

.modale-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modale-menu-section {
  margin-bottom: 24px;
}

.modale-menu-section:last-child {
  margin-bottom: 0;
}

.modale-menu-section h4 {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--ink);
}

.menu-detail-table {
  width: 100%;
  overflow-x: auto;
}

.menu-detail-table table {
  width: 100%;
  border-collapse: collapse;
}

.menu-detail-table th,
.menu-detail-table td {
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.menu-detail-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  background: #F7F6EF;
  white-space: nowrap;
}

.menu-detail-table tbody tr:last-child td {
  border-bottom: none;
}

/* Étapes de préparation */
.etapes-container {
  background: #F7F6EF;
  border-radius: 8px;
  padding: 16px;
}

.etapes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.etape-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.etape-item:last-child {
  border-bottom: none;
}

.etape-numero {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  min-width: 24px;
}

.etape-texte {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

.etape-plat-container {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.etape-plat-container:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.etape-plat-titre {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px 0;
  padding: 0;
}

/* Meta informations */
.menu-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

/* Apply actions */
.apply-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* Résultat header et meta */
.result-header {
  margin-bottom: 12px;
}

.result-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
}

.result-meta {
  font-size: 13px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
}

/* Résponsif pour les menus */
@media (max-width: 768px) {
  .menus-grid {
    grid-template-columns: 1fr;
  }
  
  .modale-large {
    max-width: 95vw;
    margin: 20px;
  }
  
  .menu-card-header {
    flex-direction: column;
    gap: 8px;
  }
  
  .menu-card-titre {
    align-items: flex-start;
  }
  
  .menu-card-badge {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   HEADER CONTROLS - Gestion des dropdowns utilisateur et foyer
   ========================================================================== */

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* User Menu */
.user-menu-container {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-menu-btn:hover {
  background: var(--bg-hover);
}

.user-menu-btn::after {
  content: "▼";
  font-size: 0.8em;
  opacity: 0.7;
}

.user-menu-btn .user-menu-avatar {
  font-size: 1.2em;
}

.user-menu-text {
  font-size: 0.9em;
}

.user-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  min-width: 220px;
  margin-top: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.user-menu-dropdown:not([hidden]) {
  display: block;
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}

.user-menu-header .user-menu-avatar {
  font-size: 1.5em;
}

.user-menu-info {
  flex: 1;
  min-width: 0;
}

.user-menu-info strong {
  display: block;
  font-size: 0.95em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-info small {
  display: block;
  color: var(--text-muted);
  font-size: 0.85em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-menu-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  background: var(--bg-panel);
}

.user-menu-list li {
  margin: 0;
}

.user-menu-list a,
.user-menu-list button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: var(--bg-panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.95em;
  text-decoration: none;
}

.user-menu-list a:hover,
.user-menu-list button:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: var(--bg-panel);
  color: var(--danger);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.95em;
  width: 100%;
}

.btn-logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Fermer les dropdowns */
.foyer-selector-dropdown[hidden],
.user-menu-dropdown[hidden] {
  display: none !important;
}

/* ===== MODALE DISCUTER AVEC LE CHEF ===== */
.modale-chat {
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modale-chat .modale-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modale-chat .modale-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message.chef {
  align-self: flex-start;
}

.chat-message .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.chat-message.user .avatar {
  background: var(--primary);
  color: var(--primary-ink);
}

.chat-message.chef .avatar {
  background: var(--accent-soft);
  color: var(--primary-dark);
}

.chat-message .content {
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
}

.chat-message.user .content {
  background: var(--primary);
  color: var(--primary-ink);
  border-bottom-right-radius: 4px;
}

.chat-message.chef .content {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.chat-message.chef .content p {
  margin: 0;
}

.chat-message.chef .content p:first-child {
  margin-bottom: 8px;
}

.chat-message.chef .content p:last-child {
  margin-top: 8px;
}

.chat-input-container {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: var(--primary-dark);
}

.chat-input::placeholder {
  color: var(--ink-soft);
}

.chat-input-container .btn {
  flex-shrink: 0;
  align-self: flex-end;
}

#btn-discuter-chef {
  display: flex;
  align-items: center;
  gap: 6px;
}
