/* =============================================
   Agenda Famille — SG Créations
   Palette : beige / rosé / brun chaud
   Layout : sidebar à gauche (ordi) / barre en haut (mobile)
   ============================================= */

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #FBF7F4;
    --panel:     #FFFFFF;
    --ink:       #2C1810;
    --ink-soft:  #6B5249;
    --ink-mute:  #9C8478;
    --line:      #ECE2DB;
    --line-soft: #F3EAE4;
    --rose:      #C4736A;
    --rose-dk:   #B5635A;
    --rose-lt:   #E8BEB4;
    --brown:     #8A6450;
    --sidebar:   #2C1810;

    /* palette de couleurs proposées pour les membres / catégories */
    --c1:#C4736A; --c2:#5B8A72; --c3:#6A7FB5; --c4:#C9A24B;
    --c5:#A66BB0; --c6:#4FA3A8; --c7:#D98A5B; --c8:#7E8B96;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; font-weight: 600; line-height: 1.15; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 0.92rem; }

/* =============================================
   ÉCRANS D'AUTHENTIFICATION (login / signup)
   ============================================= */

.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: var(--sidebar);
    position: relative;
    overflow: hidden;
}
.auth-glow {
    position: absolute; border-radius: 50%; filter: blur(100px); pointer-events: none;
}
.auth-glow.g1 { width: 460px; height: 460px; background: var(--rose); top: -160px; left: -100px; opacity: .22; }
.auth-glow.g2 { width: 360px; height: 360px; background: var(--brown); bottom: -120px; right: -80px; opacity: .2; }

.auth-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 420px;
    background: var(--panel);
    border-radius: 22px;
    padding: 40px 34px;
    box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.auth-brand {
    font-size: .72rem; font-weight: 600; letter-spacing: 2.5px;
    text-transform: uppercase; color: var(--ink-mute); text-align: center; margin-bottom: 8px;
}
.auth-card h1 { font-size: 1.9rem; text-align: center; margin-bottom: 6px; }
.auth-card h1 em { font-style: italic; font-weight: 400; color: var(--rose); }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: .9rem; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line);
    border-radius: 12px; background: #FCFAF8; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px rgba(196,115,106,.14);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; border-radius: 50px; font-weight: 600; font-size: .9rem;
    padding: 12px 22px; transition: transform .18s, box-shadow .18s, background .18s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--rose-dk); color: #fff; box-shadow: 0 6px 20px rgba(181,99,90,.35); }
.btn-primary:hover { box-shadow: 0 10px 28px rgba(181,99,90,.45); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--line-soft); transform: none; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .82rem; }
.btn-danger { background: #b5483f; color: #fff; }

.auth-tabs { display: flex; gap: 8px; background: var(--line-soft); padding: 5px; border-radius: 14px; margin-bottom: 24px; }
.auth-tabs button {
    flex: 1; border: none; background: transparent; padding: 9px; border-radius: 10px;
    font-weight: 600; font-size: .85rem; color: var(--ink-mute); transition: all .2s;
}
.auth-tabs button.active { background: var(--panel); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.type-choice { display: flex; gap: 12px; margin-bottom: 18px; }
.type-choice label {
    flex: 1; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 12px;
    text-align: center; cursor: pointer; transition: all .2s; font-size: .85rem; font-weight: 600; color: var(--ink-soft);
}
.type-choice input { display: none; }
.type-choice input:checked + .tc-inner { color: var(--rose-dk); }
.type-choice label:has(input:checked) { border-color: var(--rose); background: rgba(196,115,106,.07); }
.tc-emoji { display: block; font-size: 1.5rem; margin-bottom: 6px; }

.auth-switch { text-align: center; font-size: .85rem; color: var(--ink-soft); margin-top: 18px; }
.auth-switch a { color: var(--rose-dk); font-weight: 600; cursor: pointer; text-decoration: none; }

.auth-hint {
    margin-top: 18px; padding: 12px 14px; background: var(--line-soft);
    border-radius: 12px; font-size: .78rem; color: var(--ink-soft); line-height: 1.5;
}

.form-error { color: #b5483f; font-size: .82rem; margin-bottom: 12px; font-weight: 500; }
.field-hint { font-size: .76rem; color: var(--ink-mute); margin: 2px 0 14px; line-height: 1.45; }
.lbl-opt { font-weight: 400; color: var(--ink-mute); }

/* =============================================
   STRUCTURE APPLICATION (sidebar + contenu)
   ============================================= */

.layout { display: flex; min-height: 100vh; }

/* --- Sidebar (ordi) --- */
.sidebar {
    width: 256px; flex-shrink: 0;
    background: var(--sidebar); color: #fff;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-head { padding: 26px 22px 20px; }
.sidebar-brand { font-size: .68rem; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase; color: rgba(255,255,255,.4); }
.sidebar-title { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: #fff; margin-top: 4px; }
.sidebar-title em { font-style: italic; font-weight: 400; color: var(--rose-lt); }
.sidebar-space {
    margin-top: 14px; font-size: .8rem; color: rgba(255,255,255,.55);
    display: flex; align-items: center; gap: 8px;
}
.sidebar-space .badge { background: rgba(255,255,255,.1); padding: 2px 9px; border-radius: 20px; font-size: .68rem; font-weight: 600; }

.nav { flex: 1; padding: 10px 14px; overflow-y: auto; }
.nav-btn {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: transparent; border: none; color: rgba(255,255,255,.72);
    padding: 11px 14px; border-radius: 12px; font-size: .9rem; font-weight: 500;
    text-align: left; margin-bottom: 3px; transition: background .18s, color .18s;
}
.nav-btn .ico { font-size: 1.1rem; width: 22px; text-align: center; }
.nav-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-btn.active { background: rgba(196,115,106,.25); color: #fff; }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
/* Bouton Administration — réservé à l'admin, en bas */
.admin-btn {
    display: flex; align-items: center; gap: 12px; width: 100%;
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.85); padding: 10px 14px; border-radius: 12px;
    font-size: .86rem; font-weight: 600; margin-bottom: 12px; transition: background .18s;
}
.admin-btn:hover { background: rgba(255,255,255,.12); }
.admin-btn.active { background: rgba(196,115,106,.3); }

/* Zone connexion — pour tous, avec le nom de la personne connectée */
.connbox {
    display: flex; align-items: center; gap: 11px;
    background: rgba(0,0,0,.18); border-radius: 14px; padding: 10px 12px;
}
.conn-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: .95rem;
}
.conn-info { flex: 1; min-width: 0; }
.conn-name { font-size: .86rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-role { font-size: .7rem; color: rgba(255,255,255,.45); }
.conn-logout {
    background: transparent; border: none; color: rgba(255,255,255,.5);
    font-size: 1.1rem; padding: 4px; border-radius: 8px; transition: color .18s;
}
.conn-logout:hover { color: #fff; }

/* --- Contenu principal --- */
.content { flex: 1; min-width: 0; padding: 30px 36px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 24px; }
.page-head h2 { font-size: 1.8rem; }
.page-head .sub { color: var(--ink-soft); font-size: .9rem; margin-top: 2px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =============================================
   BARRE MOBILE (en haut) + défilement
   ============================================= */
.mobile-bar { display: none; }

/* =============================================
   CALENDRIER
   ============================================= */
.cal-toolbar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav button {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel); font-size: 1.1rem; color: var(--ink); transition: background .15s;
}
.cal-nav button:hover { background: var(--line-soft); }
.cal-month { font-family: 'Playfair Display', serif; font-size: 1.35rem; min-width: 210px; text-transform: capitalize; }
.view-switch { display: flex; gap: 4px; background: var(--line-soft); padding: 4px; border-radius: 12px; margin-left: auto; }
.view-switch button { border: none; background: transparent; padding: 7px 14px; border-radius: 9px; font-size: .82rem; font-weight: 600; color: var(--ink-mute); }
.view-switch button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,.06); }

.cal-grid { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7,1fr); background: var(--line-soft); }
.cal-weekdays div { padding: 10px 8px; text-align: center; font-size: .74rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-mute); }
.cal-days { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-cell {
    min-height: 108px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
    padding: 6px 7px; position: relative; cursor: pointer; transition: background .15s;
    display: flex; flex-direction: column; gap: 3px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: #FCF8F5; }
.cal-cell.other-month { background: #FAF6F2; }
.cal-cell.other-month .cell-num { color: var(--line); }
.cal-cell.today .cell-num { background: var(--rose-dk); color: #fff; }
.cell-num {
    font-size: .82rem; font-weight: 600; color: var(--ink-soft); width: 26px; height: 24px;
    display: flex; align-items: center; justify-content: center; border-radius: 8px; align-self: flex-end;
}
.cell-holiday-tag { position: absolute; top: 7px; left: 7px; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 1px 6px; border-radius: 20px; }
.cell-custody-stripe { position: absolute; top: 0; left: 0; bottom: 0; width: 5px; }

.evt {
    font-size: .72rem; font-weight: 600; color: #fff; padding: 2px 7px; border-radius: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.4;
    display: flex; align-items: center; gap: 4px;
}
.evt .evt-time { opacity: .8; font-weight: 500; font-size: .66rem; }
.evt-more { font-size: .68rem; color: var(--ink-mute); font-weight: 600; padding-left: 4px; }

/* Pastilles d'évènements (vue Mois sur mobile) */
.evt-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; align-content: flex-start; }
.evt-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Légende */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.legend-group { display: flex; flex-wrap: wrap; gap: 7px 14px; align-items: center; }
.legend-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--ink-mute); margin-right: 4px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--ink-soft); }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }

/* =============================================
   VUES JOUR / SEMAINE (grille horaire défilante)
   ============================================= */
.day-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

/* Bandeau "toute la journée" (évènements sans heure) */
.tg-allday { display: grid; background: var(--panel); border: 1px solid var(--line); border-bottom: none; }
.tg-allday-day { grid-template-columns: 58px 1fr; border-radius: 16px 16px 0 0; }
.tg-allday-week { grid-template-columns: 58px repeat(7, minmax(116px, 1fr)); border-radius: 16px 16px 0 0; }
.tg-ad-lbl { font-size: .66rem; font-weight: 700; text-transform: uppercase; color: var(--ink-mute); padding: 8px 6px; display: flex; align-items: center; justify-content: flex-end; text-align: right; border-right: 1px solid var(--line-soft); }
.tg-ad-items, .tg-ad-cell { padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; min-height: 34px; cursor: pointer; }
.tg-ad-cell { border-left: 1px solid var(--line-soft); }
.tg-ad-chip { font-size: .7rem; font-weight: 600; color: #fff; padding: 2px 8px; border-radius: 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tg-ad-empty { color: var(--line); font-size: .8rem; padding: 4px; }

/* En-tête de semaine (jours) */
.week-head { display: grid; grid-template-columns: 58px repeat(7, minmax(116px, 1fr)); background: var(--line-soft); border: 1px solid var(--line); border-bottom: none; border-radius: 16px 16px 0 0; }
.tg-allday-week { border-radius: 0; }
.wh-gutter { border-right: 1px solid var(--line-soft); }
.wh-cell { padding: 7px 4px 8px; text-align: center; border-left: 1px solid var(--line-soft); position: relative; }
.wh-day { font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--ink-mute); }
.wh-num { font-size: 1.15rem; font-weight: 700; color: var(--ink); margin-top: 2px; }
.wh-cell.today .wh-num { background: var(--rose-dk); color: #fff; width: 30px; height: 30px; line-height: 30px; border-radius: 50%; display: inline-block; margin-top: 1px; }
.wh-dot { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 16px; height: 4px; border-radius: 3px; }

/* Conteneur défilant de la grille horaire */
.tg-scroll { max-height: 560px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 16px 16px; }
.tg-body { display: grid; }
.tg-body-day { grid-template-columns: 58px 1fr; }
.tg-body-week { grid-template-columns: 58px repeat(7, minmax(116px, 1fr)); }
.tg-gutter { }
.tg-hr { font-size: .66rem; color: var(--ink-mute); text-align: right; padding-right: 8px; border-top: 1px solid var(--line-soft); box-sizing: border-box; }
.tg-col { position: relative; border-left: 1px solid var(--line-soft); cursor: pointer; }
.tg-evt { position: absolute; border-radius: 7px; color: #fff; font-size: .72rem; font-weight: 600; padding: 3px 6px; overflow: hidden; cursor: pointer; line-height: 1.25; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.tg-evt-t { font-size: .62rem; opacity: .85; display: block; font-weight: 500; }

/* Semaine défilante horizontalement sur petit écran */
.weekview { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 58px (gouttière) + 7 colonnes de 116px : garantit l'alignement en-tête/corps
   et déclenche le défilement horizontal quand l'écran est trop étroit */
.week-inner { min-width: 870px; }

/* Vue Liste */
.list-day { margin-bottom: 22px; }
.list-day-head { font-size: .9rem; font-weight: 700; color: var(--ink); margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-day.is-today .list-day-head { color: var(--rose-dk); }
.ld-tag { font-size: .66rem; font-weight: 700; color: #fff; padding: 2px 9px; border-radius: 20px; }
.list-evt { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 9px; cursor: pointer; transition: box-shadow .15s, transform .12s; }
.list-evt:hover { box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.list-evt:active { transform: scale(.99); }
.list-evt .bar { width: 5px; align-self: stretch; border-radius: 4px; flex-shrink: 0; }
.list-evt .le-main { flex: 1; min-width: 0; }
.list-evt .le-title { font-weight: 600; font-size: .95rem; }
.list-evt .le-meta { font-size: .8rem; color: var(--ink-mute); margin-top: 1px; }

/* =============================================
   CARTES & GRILLES (membres, etc.)
   ============================================= */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; position: relative; }
.card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.member-avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 1.05rem; flex-shrink: 0; }
.card-name { font-weight: 700; font-size: 1rem; }
.card-tag { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-mute); }
.card-row { display: flex; align-items: center; justify-content: space-between; font-size: .82rem; color: var(--ink-soft); padding: 4px 0; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; }
.icon-btn { background: var(--line-soft); border: none; border-radius: 9px; padding: 7px 11px; font-size: .8rem; color: var(--ink-soft); font-weight: 600; transition: background .15s; }
.icon-btn:hover { background: var(--line); }

.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--line-soft); padding: 4px 11px; border-radius: 20px; font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.pill { padding: 2px 9px; border-radius: 20px; font-size: .68rem; font-weight: 700; color: #fff; }

/* Sélecteur de couleur */
.color-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.color-swatch { width: 34px; height: 34px; border-radius: 10px; cursor: pointer; border: 3px solid transparent; transition: transform .12s; }
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }

/* =============================================
   ZONE VIDE / INFO
   ============================================= */
.empty { text-align: center; padding: 50px 20px; color: var(--ink-mute); }
.empty .emoji { font-size: 2.6rem; display: block; margin-bottom: 12px; }
.empty p { font-size: .92rem; margin-bottom: 16px; }

.info-box { background: rgba(196,115,106,.07); border: 1px solid rgba(196,115,106,.25); border-radius: 14px; padding: 14px 16px; font-size: .85rem; color: var(--ink-soft); margin-bottom: 18px; }
.info-box strong { color: var(--ink); }
.code-box { background: var(--sidebar); color: var(--rose-lt); font-family: monospace; font-size: 1rem; padding: 12px 16px; border-radius: 12px; letter-spacing: 2px; text-align: center; margin: 12px 0; font-weight: 700; }

/* =============================================
   MODALES
   ============================================= */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(44,24,16,.5); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
    animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--panel); border-radius: 20px; width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3);
    animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: translateY(16px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 0; }
.modal-head h3 { font-size: 1.4rem; }
.modal-close { background: var(--line-soft); border: none; width: 34px; height: 34px; border-radius: 10px; font-size: 1.1rem; color: var(--ink-soft); }
.modal-body { padding: 18px 24px 8px; }
.modal-foot { padding: 14px 24px 24px; display: flex; gap: 10px; justify-content: flex-end; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* Tableau admin */
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; font-size: .85rem; border-bottom: 1px solid var(--line-soft); }
.tbl th { background: var(--line-soft); font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-mute); }
.tbl tr:last-child td { border-bottom: none; }

/* aperçu import CSV */
.preview-wrap { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; }
.drop-zone { border: 2px dashed var(--line); border-radius: 16px; padding: 36px 20px; text-align: center; color: var(--ink-mute); transition: all .2s; cursor: pointer; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--rose); background: rgba(196,115,106,.05); color: var(--rose-dk); }
.drop-zone .emoji { font-size: 2.2rem; display: block; margin-bottom: 8px; }

/* =============================================
   RESPONSIVE — bascule mobile : barre en haut + défilement
   ============================================= */
@media (max-width: 860px) {
    .layout { flex-direction: column; }

    .sidebar {
        width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
        flex-direction: column;
    }
    .sidebar-head { padding: 14px 18px 10px; display: flex; align-items: center; justify-content: space-between; }
    .sidebar-title { font-size: 1.2rem; margin-top: 0; }
    .sidebar-brand { display: none; }
    .sidebar-space { margin-top: 0; }

    /* navigation horizontale défilante */
    .nav {
        display: flex; gap: 6px; padding: 6px 12px 10px; overflow-x: auto;
        -webkit-overflow-scrolling: touch; flex: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav-btn { flex-direction: column; gap: 3px; padding: 8px 12px; white-space: nowrap; margin-bottom: 0; font-size: .72rem; min-width: 64px; }
    .nav-btn .ico { font-size: 1.25rem; }
    .nav-btn .label { font-size: .68rem; }

    /* En haut sur mobile : connexion compacte + admin dans le header */
    .sidebar-foot {
        border-top: none; border-bottom: 1px solid rgba(255,255,255,.08);
        padding: 4px 12px 10px; display: flex; gap: 8px; align-items: center;
    }
    .connbox { flex: 1; padding: 7px 10px; }
    .conn-avatar { width: 32px; height: 32px; font-size: .82rem; }
    .admin-btn { width: auto; margin-bottom: 0; padding: 9px 12px; }
    .admin-btn .label { display: none; }

    .content { padding: 18px 14px 50px; }
    .page-head h2 { font-size: 1.4rem; }

    /* Entête : actions sur toute la largeur, faciles à toucher */
    .page-head { gap: 12px; }
    .head-actions { width: 100%; }
    .head-actions > * { flex: 1; min-width: 0; }
    #member-filter, #add-evt { min-height: 44px; }

    .cal-cell { min-height: 72px; padding: 4px; }
    .cal-month { min-width: auto; font-size: 1.1rem; flex: 1; }
    .cal-weekdays div { font-size: .62rem; padding: 7px 2px; }
    .cards { grid-template-columns: 1fr; }
    .field-row { flex-direction: column; gap: 0; }

    /* Barre d'outils du calendrier : nav + mois sur une ligne, sélecteur de vue dessous */
    .cal-toolbar { gap: 10px; }
    .cal-nav { gap: 6px; }
    .cal-nav button { width: 40px; height: 40px; }
    #today-btn { width: auto; }
    .view-switch { width: 100%; margin-left: 0; }
    .view-switch button { flex: 1; padding: 9px 8px; font-size: .8rem; min-height: 40px; }
    .tg-scroll { max-height: 64vh; }

    /* Vue Liste plus aérée */
    .list-evt { padding: 14px; }

    /* Évite le zoom auto d'iOS au focus des champs (texte < 16px) */
    input, select, textarea,
    .field input, .field select, .field textarea { font-size: 16px; }
}

@media (max-width: 480px) {
    .cal-cell { min-height: 60px; }
    .cell-num { width: 22px; height: 22px; font-size: .74rem; }
    .evt-dot { width: 6px; height: 6px; }
}

/* =============================================
   AJOUTS version Cloudflare (Google + espaces)
   ============================================= */
.gbtn-wrap { display: flex; justify-content: center; margin: 8px 0 4px; min-height: 44px; }
.auth-loading { text-align: center; color: var(--ink-mute); font-size: .85rem; padding: 10px; }

/* Sélecteur d'espace dans la sidebar */
.space-switch { margin-top: 12px; }
.space-switch select {
    width: 100%; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.15);
    border-radius: 10px; padding: 8px 10px; font-size: .82rem; font-weight: 600;
}
.space-switch select option { color: #2C1810; }

/* Avatar photo Google */
.conn-pic { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }

/* Listes d'accès / invitations */
.section-title { font-size: 1.05rem; margin: 26px 0 12px; }
.pending { opacity: .7; font-style: italic; }

@media (max-width: 860px) {
    .space-switch { margin-top: 8px; }
    .space-switch select { font-size: .78rem; padding: 6px 8px; }
}

