
/* =========================================================
   CADEAUX EN FAMILLE
   Feuille de style principale — version unifiée
   Thème : papier, tomate, vert profond et safran
   Navigation mobile compacte et sans débordement
   ========================================================= */

/* 1. VARIABLES */
:root {
  color-scheme: light;

  --paper: #F4EBD8;
  --paper-light: #FFFDF7;
  --paper-warm: #EFE2CB;

  --text: #302C27;
  --text-soft: #625B50;
  --muted: #817767;

  --tomato: #D94332;
  --tomato-hover: #B93226;
  --coral: #E87560;

  --green: #315B43;
  --green-hover: #244832;

  --saffron: #E9B949;
  --saffron-soft: #F8EDC9;

  --danger: #A93226;
  --danger-soft: #FBE9E4;

  --success-soft: #E7F0E4;

  --border: #E1D4BD;
  --border-strong: #CBB99A;

  --shadow-soft:
    0 3px 0 rgba(75, 58, 35, 0.035),
    0 12px 28px rgba(75, 58, 35, 0.07);

  --shadow-lift:
    0 5px 0 rgba(75, 58, 35, 0.045),
    0 18px 35px rgba(75, 58, 35, 0.12);

  --radius-card: 18px;
  --radius-control: 11px;

  --font-body:
    "DM Sans", "Avenir Next", Avenir, "Segoe UI", sans-serif;

  --font-display:
    "Fraunces", Georgia, "Times New Roman", serif;

  --mobile-nav-height: 62px;
}

/* 2. RÉINITIALISATION */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;

  color: var(--text);
  background-color: var(--paper);
  background-image: radial-gradient(
    rgba(91, 72, 43, 0.075) 0.65px,
    transparent 0.65px
  );
  background-size: 8px 8px;

  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
}

img {
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--paper-light);
  background: var(--green);
}

/* 3. TYPOGRAPHIE */
h1,
h2,
h3,
h4 {
  margin: 0 0 0.65em;
  color: var(--green);
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2.1rem, 4.8vw, 3.55rem);
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

h3 {
  font-size: clamp(1.2rem, 2.3vw, 1.55rem);
}

h4 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

strong,
b {
  font-weight: 750;
}

small,
.muted,
.text-muted {
  color: var(--muted);
}

a {
  color: var(--tomato);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--tomato-hover);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(49, 91, 67, 0.45);
  outline-offset: 3px;
}

/* 4. EN-TÊTE */
header.topbar {
  position: relative;
  z-index: 100;
  isolation: isolate;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;

  min-height: 112px;
  padding: 24px clamp(20px, 5vw, 72px);

  overflow: visible;

  background: var(--paper-light);
  border-bottom: 1px solid var(--border);
}

header.topbar::before {
  position: absolute;
  top: -90px;
  right: 7%;
  z-index: -1;

  width: 210px;
  height: 170px;

  content: "";
  pointer-events: none;

  background: var(--saffron);
  border-radius: 48% 52% 65% 35% / 38% 45% 55% 62%;
  opacity: 0.22;
  transform: rotate(-14deg);
}

header.topbar > div:first-child {
  min-width: 0;
}

header.topbar h1,
header.topbar .brand-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.5vw, 2.45rem);
  letter-spacing: -0.035em;
}

header.topbar p {
  margin: 5px 0 0;
  color: var(--text-soft);
}

/* 5. MENU BURGER */
header.topbar .user-menu {
  position: relative;
  z-index: 110;

  flex: 0 0 auto;
  margin-left: auto;
  overflow: visible;
}

.burger-button {
  position: relative;
  z-index: 112;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 46px;
  min-width: 46px;
  min-height: 46px;
  padding: 0;

  color: var(--green);
  background: var(--paper-light);
  border: 1px solid var(--green);
  border-radius: 50%;

  font-size: 1.15rem;
  line-height: 1;
}

.burger-button:hover {
  color: var(--paper-light);
  background: var(--green);
  border-color: var(--green);
  box-shadow: none;
}

#user-menu-dropdown,
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  z-index: 111;

  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;

  width: max-content;
  min-width: 175px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 90px);

  margin: 0;
  padding: 8px;
  overflow-x: hidden;
  overflow-y: auto;

  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-lift);
}

#user-menu-dropdown[hidden],
.user-menu-dropdown[hidden] {
  display: none !important;
}

#user-menu-dropdown button,
.user-menu-dropdown button {
  display: flex;
  align-items: center;
  justify-content: flex-start;

  width: 100%;
  min-width: 0;
  min-height: 42px;
  flex: 0 0 auto;

  margin: 0;
  padding: 10px 12px;

  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 9px;

  text-align: left;
  white-space: nowrap;
}

#user-menu-dropdown button:hover,
.user-menu-dropdown button:hover {
  color: var(--green);
  background: var(--paper);
  box-shadow: none;
}

/* Compatibilité avec d'autres menus */
.dropdown,
.user-dropdown {
  position: relative;
  overflow: visible;
}

.dropdown-menu,
.user-dropdown-menu,
.menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  z-index: 111;

  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;

  width: max-content;
  min-width: 175px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 90px);

  margin: 0;
  padding: 8px;
  overflow-y: auto;

  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-lift);
}

.dropdown-menu button,
.user-dropdown-menu button,
.menu-dropdown button,
.dropdown-menu a,
.user-dropdown-menu a,
.menu-dropdown a {
  display: flex;
  align-items: center;
  justify-content: flex-start;

  width: 100%;
  min-height: 42px;
  flex: 0 0 auto;

  margin: 0;
  padding: 10px 12px;

  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 9px;

  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-menu button:hover,
.user-dropdown-menu button:hover,
.menu-dropdown button:hover,
.dropdown-menu a:hover,
.user-dropdown-menu a:hover,
.menu-dropdown a:hover {
  color: var(--green);
  background: var(--paper);
  box-shadow: none;
}

/* 6. NAVIGATION PRINCIPALE — ORDINATEUR */
.main-tabs {
  position: relative;
  z-index: 1;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  width: min(calc(100% - 40px), 620px);
  min-width: 0;
  margin: 18px auto 0;
  padding: 5px;

  background: rgba(255, 253, 247, 0.75);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.main-tab {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 6px;

  min-width: 0;
  min-height: 38px;
  padding: 7px 12px;

  color: var(--green);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;

  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.main-tab:hover {
  background: rgba(255, 250, 240, 0.8);
  border-color: var(--border);
  box-shadow: none;
}

.main-tab.active {
  color: var(--paper-light);
  background: var(--green);
  border-color: var(--green);
}

.main-tab.active:hover {
  background: var(--green-hover);
}

.tab-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* 7. CONTENU PRINCIPAL */
.page-container {
  width: min(1120px, calc(100% - 48px));
  min-width: 0;
  margin: 0 auto;
  padding: 34px 0 56px;
}

.main-content {
  min-width: 0;
}

.page-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-heading h1,
.section-heading h1,
.page-heading h2,
.section-heading h2 {
  margin-bottom: 0;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--text-soft);
}

.panel {
  min-width: 0;
  margin: 0 0 24px;
  padding: clamp(22px, 3vw, 32px);

  background: rgba(255, 253, 247, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel h2:first-child,
.panel h3:first-child {
  margin-top: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

/* 8. ÉVÉNEMENTS */
.event-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;

  margin: 0;
  padding: 0;
  list-style: none;
}

.event-item {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  min-width: 0;
  padding: 20px;
  overflow: hidden;

  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 7px;
  box-shadow: 0 3px 0 rgba(75, 58, 35, 0.035);
}

.event-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;

  width: 5px;
  content: "";
  background: var(--tomato);
}

.event-item:nth-child(3n + 2)::before {
  background: var(--green);
}

.event-item:nth-child(3n)::before {
  background: var(--saffron);
}

.event-item > * {
  min-width: 0;
}

.event-item h3,
.event-item h4 {
  margin: 0 0 5px;
  color: var(--text);
}

.event-item p {
  margin: 0;
  color: var(--text-soft);
}

.event-date,
.event-item time {
  color: var(--tomato);
  font-weight: 750;
}

/* 9. LISTES ET CARTES CADEAUX */
.gift-list,
.gift-items,
.gift-grid {
  min-width: 0;
}

.gift-list {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.gift-list:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.gift-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.gift-grid.cards-view {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gift-grid.list-view {
  grid-template-columns: minmax(0, 1fr);
}

.gift-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;

  min-width: 0;
  padding: 20px;

  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 7px;
  box-shadow: 0 3px 0 rgba(75, 58, 35, 0.035);

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.gift-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
}

.gift-card h3,
.gift-card h4 {
  margin: 0 0 7px;
  color: var(--text);
}

.gift-card p {
  margin: 0 0 8px;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.gift-card > * {
  min-width: 0;
}

.gift-card .gift-info,
.gift-card .gift-details {
  flex: 1;
  min-width: 0;
}

.gift-grid.cards-view .gift-card {
  flex-direction: column;
  min-height: 190px;
}

.gift-grid.cards-view .gift-card .gift-actions {
  width: 100%;
  margin-top: auto;
}

.gift-grid.list-view .gift-card {
  align-items: center;
}

.gift-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;

  flex-shrink: 0;
  margin-left: auto;
}

.gift-actions button {
  width: auto;
  margin: 0;
}

.gift-price,
.price {
  color: var(--green);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.gift-status,
.status-label,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;

  width: fit-content;
  padding: 4px 9px;

  color: var(--green);
  background: var(--success-soft);
  border-radius: 999px;

  font-size: 0.78rem;
  font-weight: 750;
}

.gift-card:nth-child(3n + 2) {
  border-top: 3px solid var(--saffron);
}

.gift-card:nth-child(3n) {
  border-top: 3px solid var(--coral);
}

.gift-card:nth-child(3n + 1) {
  border-top: 3px solid var(--green);
}

.empty-state,
.empty-list {
  padding: 28px;
  color: var(--text-soft);
  background: rgba(255, 253, 247, 0.65);
  border: 1px dashed var(--border-strong);
  border-radius: 15px;
  text-align: center;
}

/* 10. ADMINISTRATION DES MEMBRES */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;

  margin: 0;
  padding: 0;
  list-style: none;
}

.user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  min-width: 0;
  padding: 14px 16px;

  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.user-list li span {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.user-list li .user-name {
  flex: 1;
  min-width: 0;
}

.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 8px;
}

.user-actions button {
  width: auto;
  white-space: nowrap;
}

/* 11. BOUTONS */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: 43px;
  padding: 10px 17px;

  color: var(--paper-light);
  background: var(--tomato);
  border: 1px solid transparent;
  border-radius: 999px;

  font-weight: 750;
  line-height: 1.3;
  text-align: center;

  transition:
    color 0.18s,
    background 0.18s,
    border-color 0.18s,
    box-shadow 0.18s,
    transform 0.18s;
}

button:hover {
  background: var(--tomato-hover);
  box-shadow: 0 4px 0 rgba(185, 50, 38, 0.12);
}

button:active {
  transform: translateY(1px);
}

button.secondary-button,
.secondary-button {
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
}

button.secondary-button:hover,
.secondary-button:hover {
  color: var(--paper-light);
  background: var(--green);
  border-color: var(--green);
  box-shadow: none;
}

button.danger-button,
.danger-button {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc7bb;
}

button.danger-button:hover,
.danger-button:hover {
  color: #fffaf0;
  background: var(--danger);
  border-color: var(--danger);
}

button.tertiary-button {
  color: var(--green);
  background: transparent;
  border-color: transparent;
}

button.tertiary-button:hover {
  background: var(--paper);
  box-shadow: none;
}

#refresh-button {
  min-width: 112px;
}

/* Sélecteur liste/cartes */
.view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;

  background: var(--paper-warm);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.view-toggle button {
  min-height: 35px;
  padding: 7px 13px;

  color: var(--green);
  background: transparent;
  border: 0;
  border-radius: 999px;

  font-size: 0.88rem;
  font-weight: 750;
}

.view-toggle button:hover {
  background: rgba(255, 250, 240, 0.75);
  box-shadow: none;
}

.view-toggle button.active {
  color: var(--paper-light);
  background: var(--green);
}

/* 12. CONNEXION */
.auth-container {
  position: relative;
  isolation: isolate;

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 100vh;
  padding: 36px 18px;
  overflow: hidden;
}

.auth-container::before,
.auth-container::after {
  position: fixed;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.auth-container::before {
  top: -70px;
  left: -65px;

  width: 230px;
  height: 250px;

  background: var(--tomato);
  border-radius: 40% 60% 58% 42% / 48% 38% 62% 52%;
  transform: rotate(-20deg);
}

.auth-container::after {
  right: -75px;
  bottom: -85px;

  width: 270px;
  height: 240px;

  background: var(--saffron);
  border-radius: 54% 46% 38% 62% / 42% 55% 45% 58%;
  transform: rotate(16deg);
}

.auth-panel {
  position: relative;

  width: 100%;
  max-width: 460px;
  padding: clamp(28px, 5vw, 44px);

  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: 23px 18px 24px 17px;
  box-shadow:
    0 8px 0 rgba(75, 58, 35, 0.035),
    0 22px 55px rgba(75, 58, 35, 0.12);
}

.auth-panel::before {
  position: absolute;
  top: -9px;
  right: 28px;

  width: 56px;
  height: 18px;

  content: "";
  background: var(--coral);
  border-radius: 3px;
  transform: rotate(4deg);
}

.auth-panel h1 {
  margin-bottom: 12px;
  font-size: clamp(2.15rem, 5vw, 2.8rem);
}

.auth-panel > p {
  margin-bottom: 26px;
}

/* 13. FORMULAIRES */
form {
  width: 100%;
}

label {
  display: block;
  margin: 17px 0 7px;

  color: var(--green);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  min-height: 47px;
  padding: 11px 14px;

  color: var(--text);
  background: var(--paper-light);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  outline: none;

  transition:
    border-color 0.18s,
    box-shadow 0.18s,
    background 0.18s;
}

textarea {
  min-height: 115px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #a39b89;
}

input:focus,
textarea:focus,
select:focus {
  background: #fffefb;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(49, 91, 67, 0.12);
}

input[type="checkbox"],
input[type="radio"] {
  display: inline-block;
  width: auto;
  min-height: auto;
  accent-color: var(--tomato);
}

input[type="checkbox"] + label,
input[type="radio"] + label {
  display: inline;
  margin-left: 6px;
}

form button {
  margin-top: 20px;
  margin-right: 7px;
}

.auth-panel form button[type="submit"] {
  width: 100%;
  min-height: 49px;
  margin-top: 24px;
}

/* 14. MESSAGES ET ALERTES */
.error-message,
.success-message,
.notice,
.message {
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
}

.error-message {
  color: #8e2b20;
  background: var(--danger-soft);
  border: 1px solid #efc7bb;
}

.success-message {
  color: var(--green);
  background: var(--success-soft);
  border: 1px solid #c6d6c6;
}

.notice,
.message {
  color: #625237;
  background: var(--saffron-soft);
  border: 1px solid #ead99d;
}

/* 15. CHARGEMENT ET PIED DE PAGE */
.loading {
  display: grid;
  place-items: center;

  min-height: 100vh;
  padding: 24px;

  color: var(--muted);
  font-size: 1rem;
}

.version-footer {
  padding: 18px 12px;
  color: #89816f;
  font-size: 0.78rem;
  text-align: center;
}

hr {
  height: 1px;
  margin: 24px 0;
  background: var(--border);
  border: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  color: var(--green);
  font-weight: 750;
}

/* 16. TABLETTES */
@media (max-width: 900px) {
  .gift-grid.cards-view {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .event-list {
    grid-template-columns: 1fr;
  }

  .page-container {
    width: min(calc(100% - 36px), 760px);
  }
}

/* 17. MOBILES */
@media (max-width: 700px) {
  header.topbar {
    min-height: 100px;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    overflow: visible;
  }

  header.topbar > div:first-child {
    flex: 1 1 200px;
    min-width: 0;
  }

  header.topbar .user-menu {
    position: relative;
    z-index: 110;
    flex: 0 0 auto;
    margin-left: auto;
    overflow: visible;
  }

  header.topbar::before {
    right: -70px;
  }

  #user-menu-dropdown,
  .user-menu-dropdown {
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    max-width: calc(100vw - 24px);
  }

  .page-container {
    width: calc(100% - 28px);
    padding-top: 22px;
    padding-bottom: 24px;
  }

  .panel {
    padding: 21px;
    border-radius: 15px;
  }

  .page-heading,
  .section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .event-list,
  .gift-grid.cards-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .event-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .user-list li {
    flex-direction: row;
    align-items: center;
  }

  .user-actions {
    flex-wrap: wrap;
  }

  .user-actions button {
    width: auto;
  }

  /* Navigation mobile : la hauteur est contrôlée ici uniquement */
  .main-tabs {
    position: fixed;
    z-index: 1000;

    top: auto;
    right: 0;
    bottom: 0;
    left: 0;

    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    gap: 2px;

    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;

    padding: 5px 6px;
    padding-bottom: calc(5px + env(safe-area-inset-bottom));

    box-sizing: border-box;
    overflow: hidden;

    background: var(--paper-light);
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: 0 -4px 16px rgba(75, 58, 35, 0.08);
  }

  .main-tabs .main-tab {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;

    width: 0;
    min-width: 0;
    max-width: 100%;
    height: 46px;
    min-height: 46px;

    margin: 0;
    padding: 3px 1px;

    box-sizing: border-box;
    overflow: hidden;

    color: var(--green);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    box-shadow: none;

    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .main-tabs .main-tab.active {
    color: var(--paper-light);
    background: var(--green);
    border-color: var(--green);
  }

  .main-tabs .main-tab:hover {
    box-shadow: none;
  }

  .main-tabs .tab-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;

    margin: 0;
    font-size: 17px;
    line-height: 1;
  }

  .main-tabs .main-tab svg,
  .main-tabs .main-tab img {
    display: block;
    flex: 0 0 auto;

    width: 17px;
    height: 17px;
    max-width: 17px;
    max-height: 17px;
  }

  body {
    padding-bottom:
      calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }

  .view-toggle {
    display: flex;
    width: 100%;
  }

  .view-toggle button {
    flex: 1;
  }

  .gift-grid.list-view .gift-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .gift-grid.list-view .gift-actions {
    width: 100%;
    margin-left: 0;
  }
}

/* 18. PETITS MOBILES */
@media (max-width: 420px) {
  h1 {
    font-size: 1.9rem;
  }

  .page-container {
    width: calc(100% - 18px);
  }

  .panel {
    padding: 16px;
  }

  .page-heading,
  .section-heading {
    flex-direction: column;
  }

  .section-heading > button,
  .page-heading > button {
    width: 100%;
  }

  .gift-card {
    padding: 16px;
  }

  .user-list li {
    gap: 8px;
    padding: 11px;
  }

  .user-list li .user-name {
    overflow-wrap: anywhere;
  }

  .user-actions {
    gap: 6px;
  }

  .user-actions button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.84rem;
  }

  .gift-actions button,
  form button {
    width: 100%;
    margin-right: 0;
  }

  .burger-button {
    width: 44px;
    min-width: 44px;
  }

  #user-menu-dropdown,
  .user-menu-dropdown {
    max-width: calc(100vw - 18px);
  }

  .auth-container::before {
    top: -115px;
    left: -115px;
  }

  .auth-container::after {
    right: -130px;
    bottom: -130px;
  }
}

/* 19. TRÈS PETITS MOBILES */
@media (max-width: 360px) {
  .main-tabs {
    gap: 1px;
    padding-right: 4px;
    padding-left: 4px;
  }

  .main-tabs .main-tab {
    padding-right: 0;
    padding-left: 0;
    font-size: 9px;
  }

  .main-tabs .tab-icon {
    font-size: 16px;
  }

  .panel {
    padding: 13px;
  }
}

/* 20. ACCESSIBILITÉ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* =========================================
   CORRECTION ROBUSTE — NAVIGATION MOBILE
   ========================================= */

@media screen and (max-width: 700px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    overflow-x: clip;
  }

  #app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: clip;
  }

  .main-tabs {
    position: fixed !important;
    z-index: 9999 !important;

    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    margin: 0 !important;
    box-sizing: border-box !important;

    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px !important;

    padding: 6px 8px !important;
    padding-bottom: calc(6px + env(safe-area-inset-bottom)) !important;

    overflow: hidden !important;
  }

  .main-tabs .main-tab {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    height: 46px !important;
    min-height: 0 !important;
    max-height: 46px !important;

    margin: 0 !important;
    padding: 3px 1px !important;

    box-sizing: border-box !important;
    overflow: hidden !important;

    font-size: 10px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    text-align: center !important;
  }

  .main-tabs .tab-icon {
    display: block !important;
    flex: 0 0 auto !important;
    font-size: 18px !important;
    line-height: 1.2 !important;
    margin: 0 0 2px !important;
  }

  .page-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .panel,
  .gift-list,
  .gift-card,
  .event-item {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom)) !important;
  }
}



/* =========================================
   HEADER FIXE SUR MOBILE
   Le menu inférieur reste inchangé
   ========================================= */

@media screen and (max-width: 700px) {
  header.topbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;

    width: 100% !important;
    min-height: 100px;
    margin: 0 !important;

    box-sizing: border-box;
    z-index: 9998 !important;
  }

  /* Décale le contenu sous le header fixe */
  #main-content {
    padding-top: 122px !important;
  }

  /* Conserve le contenu accessible au-dessus du menu inférieur */
  body {
    padding-bottom:
      calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)) !important;
  }
}



/* ==========================================
   BILLY — FENÊTRE ET BOUTONS UNIFIÉS
   ========================================== */

#billy-tour-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 20000 !important;
  pointer-events: none !important;
}

#billy-tour-overlay .billy-tour-shade {
  display: none !important;
}

/* Fenêtre */
#billy-tour-overlay .billy-tour-dialog {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;

  width: min(340px, 30vw) !important;
  min-width: 280px !important;
  max-width: 360px !important;
  max-height: calc(100dvh - 40px) !important;

  margin: 0 0 0 auto !important;
  padding: 18px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  gap: 8px !important;

  color: #302c27 !important;
  background: #fffdf7 !important;
  border: 1px solid #e1d4bd !important;
  border-radius: 16px !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16) !important;

  pointer-events: auto !important;
}

/* Bouton de fermeture X : petit et fixe */
#billy-tour-overlay .billy-tour-close {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  z-index: 2 !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;

  margin: 0 !important;
  padding: 0 !important;

  color: #625b50 !important;
  background: #f4ebd8 !important;
  border: 0 !important;
  border-radius: 50% !important;
  box-shadow: none !important;

  font-size: 20px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  flex: 0 0 28px !important;
}

/* Texte */
#billy-tour-overlay .billy-tour-dialog h1,
#billy-tour-overlay .billy-tour-dialog h2,
#billy-tour-overlay .billy-tour-dialog p {
  color: #302c27 !important;
  opacity: 1 !important;
}

#billy-tour-overlay .billy-tour-progress {
  margin: 0 32px 0 0 !important;
  color: #817767 !important;
  font-size: 0.78rem !important;
}

#billy-tour-overlay .billy-tour-copy h2 {
  margin: 0 28px 6px 0 !important;
  font-size: 1.2rem !important;
}

#billy-tour-overlay .billy-tour-text {
  margin: 0 !important;
  font-size: 0.9rem !important;
  line-height: 1.45 !important;
}

#billy-tour-overlay .billy-tour-image {
  width: 76px !important;
  height: 76px !important;
  flex: 0 0 76px !important;
  object-fit: contain !important;
}

/* Trois boutons dans la même rangée */
#billy-tour-overlay .billy-tour-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 6px !important;

  width: 100% !important;
  min-width: 0 !important;
  margin-top: 8px !important;
}

/* Style commun des trois boutons */
#billy-tour-overlay .billy-tour-actions > button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 34px !important;
  min-height: 34px !important;

  margin: 0 !important;
  padding: 5px 8px !important;
  box-sizing: border-box !important;

  border-radius: 8px !important;
  box-shadow: none !important;

  font-family: inherit !important;
  font-size: 0.76rem !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  text-align: center !important;
  white-space: nowrap !important;

  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Précédent : bouton secondaire */
#billy-tour-overlay .billy-tour-prev {
  color: #315b43 !important;
  background: #f4ebd8 !important;
  border: 1px solid #e1d4bd !important;
}

/* Suivant : bouton principal */
#billy-tour-overlay .billy-tour-next {
  color: #fffdf7 !important;
  background: #315b43 !important;
  border: 1px solid #315b43 !important;
}

/* Passer : bouton discret */
#billy-tour-overlay .billy-tour-skip {
  width: auto !important;
  padding: 5px 7px !important;
  color: #625b50 !important;
  background: transparent !important;
  border: 1px solid #d8cbb4 !important;
}

/* État désactivé */
#billy-tour-overlay .billy-tour-prev:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

/* ==========================================
   MOBILE — AU-DESSUS DE LA NAVIGATION
   ========================================== */

@media screen and (max-width: 700px) {
  #billy-tour-overlay {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 10px !important;
    padding-bottom: calc(
      var(--mobile-nav-height, 62px)
      + env(safe-area-inset-bottom, 0px)
      + 8px
    ) !important;
  }

  #billy-tour-overlay .billy-tour-dialog {
    width: min(100%, 360px) !important;
    min-width: 0 !important;
    max-width: 360px !important;
    max-height: min(38dvh, 300px) !important;

    margin: 0 auto !important;
    padding: 12px !important;
    gap: 7px !important;
    border-radius: 14px !important;
  }

  #billy-tour-overlay .billy-tour-image {
    width: 48px !important;
    height: 48px !important;
    flex-basis: 48px !important;
  }

  #billy-tour-overlay .billy-tour-copy h2 {
    font-size: 1rem !important;
  }

  #billy-tour-overlay .billy-tour-text {
    font-size: 0.8rem !important;
    line-height: 1.35 !important;
  }

  #billy-tour-overlay .billy-tour-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important;
    gap: 4px !important;
    margin-top: 5px !important;
  }

  #billy-tour-overlay .billy-tour-actions > button {
    height: 30px !important;
    min-height: 30px !important;
    padding: 4px 5px !important;
    font-size: 0.68rem !important;
    border-radius: 7px !important;
  }

  #billy-tour-overlay .billy-tour-skip {
    padding-right: 5px !important;
    padding-left: 5px !important;
    font-size: 0.66rem !important;
  }

  #billy-tour-overlay .billy-tour-close {
    top: 6px !important;
    right: 6px !important;
    width: 26px !important;
    min-width: 26px !important;
    max-width: 26px !important;
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    flex-basis: 26px !important;
  }
}


/* Billy insiste sur le changement de mot de passe */
@keyframes billy-password-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
  }

  50% {
    opacity: 0.45;
    box-shadow: 0 0 0 6px rgba(220, 53, 69, 0.25);
  }
}

.billy-password-reminder {
  animation: billy-password-pulse 0.8s ease-in-out infinite;
  border: 2px solid #dc3545 !important;
  color: #dc3545 !important;
  font-weight: bold;
}



/* Billy : ajustement mobile uniquement pour l'étape 6/6 */
@media screen and (max-width: 600px) {

  #billy-tour-overlay.billy-tour-last-step {
    align-items: flex-start !important;
    justify-content: center !important;

    padding: 8px !important;
    padding-top: max(8px, env(safe-area-inset-top)) !important;
    padding-bottom: calc(
      var(--mobile-nav-height, 62px)
      + env(safe-area-inset-bottom, 0px)
      + 8px
    ) !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-dialog {
    position: relative !important;

    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 420px !important;

    max-height: 38dvh !important;
    margin: 0 auto !important;
    padding: 10px !important;
    gap: 6px !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-image {
    width: 40px !important;
    height: 40px !important;
    min-height: 0 !important;
    flex: 0 0 40px !important;
    object-fit: contain !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-progress {
    margin: 0 28px 2px 0 !important;
    font-size: 11px !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-copy h2 {
    margin: 0 26px 4px 0 !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-text {
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    grid-template-columns: none !important;
    gap: 5px !important;
    margin-top: 5px !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-actions > button {
    width: auto !important;
    min-width: 0 !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 5px 8px !important;
    font-size: 11px !important;
    white-space: normal !important;
  }

  #billy-tour-overlay.billy-tour-last-step .billy-tour-close {
    top: 5px !important;
    right: 5px !important;
  }
}


/* Billy : première étape uniquement, centrée avec arrière-plan flouté */
#billy-tour-overlay.billy-tour-first-step {
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  background: rgba(15, 23, 42, 0.42) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  backdrop-filter: blur(6px) !important;
}

#billy-tour-overlay.billy-tour-first-step .billy-tour-dialog {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: min(100%, 460px) !important;
  min-width: 0 !important;
  max-width: 460px !important;
  max-height: 80dvh !important;
  margin: auto !important;
  padding: 24px !important;
  gap: 14px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  border-radius: 22px !important;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28) !important;
}

#billy-tour-overlay.billy-tour-first-step .billy-tour-image {
  width: 100px !important;
  height: 100px !important;
  min-height: 0 !important;
  flex: 0 0 100px !important;
  object-fit: contain !important;
}

#billy-tour-overlay.billy-tour-first-step .billy-tour-copy h2 {
  font-size: 24px !important;
  line-height: 1.25 !important;
  margin: 0 28px 10px 0 !important;
}

#billy-tour-overlay.billy-tour-first-step .billy-tour-text {
  font-size: 16px !important;
  line-height: 1.5 !important;
  margin: 0 !important;
}

#billy-tour-overlay.billy-tour-first-step .billy-tour-progress {
  font-size: 13px !important;
  margin: 0 28px 6px 0 !important;
}

#billy-tour-overlay.billy-tour-first-step .billy-tour-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 10px !important;
}

#billy-tour-overlay.billy-tour-first-step .billy-tour-actions > button {
  min-height: 42px !important;
  padding: 10px 16px !important;
  font-size: 14px !important;
}

/* Mobile : la première étape reste grande et centrée */
@media screen and (max-width: 600px) {
  #billy-tour-overlay.billy-tour-first-step {
    padding: 14px !important;
  }

  #billy-tour-overlay.billy-tour-first-step .billy-tour-dialog {
    width: 100% !important;
    max-width: 420px !important;
    max-height: 78dvh !important;
    padding: 20px !important;
    gap: 12px !important;
  }

  #billy-tour-overlay.billy-tour-first-step .billy-tour-image {
    width: 84px !important;
    height: 84px !important;
    flex-basis: 84px !important;
  }

  #billy-tour-overlay.billy-tour-first-step .billy-tour-copy h2 {
    font-size: 22px !important;
  }

  #billy-tour-overlay.billy-tour-first-step .billy-tour-text {
    font-size: 15px !important;
  }
}
