/* =============================================
   Calendrier Familial — Feuille de style principale
   ============================================= */

/* --- Variables (thème clair) --- */
:root {
    --bg:          #f0f2f5;
    --bg-card:     #ffffff;
    --bg-header:   #ffffff;
    --bg-input:    #ffffff;
    --bg-hover:    #f5f7fa;
    --border:      #e2e8f0;
    --text:        #1a202c;
    --text-muted:  #718096;
    --text-light:  #a0aec0;
    --primary:     #667eea;
    --primary-dark:#5a67d8;
    --primary-light:#ebf4ff;
    --success:     #48bb78;
    --danger:      #f56565;
    --warning:     #ed8936;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
    --shadow:      0 4px 12px rgba(0,0,0,.10);
    --shadow-lg:   0 8px 30px rgba(0,0,0,.15);
    --radius-sm:   6px;
    --radius:      10px;
    --radius-lg:   16px;
    --radius-full: 9999px;
    --header-h:    64px;
    --transition:  .2s ease;
}

/* --- Thème sombre --- */
[data-theme="dark"] {
    --bg:          #0f1117;
    --bg-card:     #1a1d27;
    --bg-header:   #13151f;
    --bg-input:    #22253a;
    --bg-hover:    #222538;
    --border:      #2d3148;
    --text:        #e2e8f0;
    --text-muted:  #8892a4;
    --text-light:  #4a5568;
    --primary-light:#1a1f3c;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
    --shadow:      0 4px 12px rgba(0,0,0,.4);
    --shadow-lg:   0 8px 30px rgba(0,0,0,.5);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* =============================================
   HEADER
   ============================================= */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    height: var(--header-h);
    transition: background var(--transition), border-color var(--transition);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
}
.logo-icon { font-size: 1.4rem; }

.header-nav {
    display: flex;
    gap: .25rem;
    flex: 1;
}

.nav-link {
    padding: .45rem .85rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.icon-btn:hover { color: var(--text); background: var(--bg-hover); }

/* Thème */
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark  { display: block; }

/* Notifications */
.notif-wrapper { position: relative; }
.notif-badge {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}
.notif-badge.hidden { display: none; }

.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: .9rem;
}

.notif-read-all {
    background: none;
    border: none;
    color: var(--primary);
    font-size: .8rem;
    cursor: pointer;
    padding: 0;
}
.notif-read-all:hover { text-decoration: underline; }

.notif-list { max-height: 320px; overflow-y: auto; }

.notif-item {
    display: flex;
    gap: .75rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    cursor: pointer;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }

.notif-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.notif-msg  { font-size: .85rem; margin-bottom: .2rem; }
.notif-time { font-size: .75rem; color: var(--text-muted); }
.notif-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: .9rem; }

/* Profil */
.user-menu-wrapper { position: relative; }
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    transition: all var(--transition);
}
.user-menu-btn:hover { background: var(--bg-hover); }

.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.user-avatar-placeholder {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}
.user-dropdown.open { display: block; }

.user-dropdown-info {
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.user-dropdown-info strong { font-size: .9rem; }
.user-dropdown-info small  { color: var(--text-muted); font-size: .8rem; }

.user-dropdown hr { border: none; border-top: 1px solid var(--border); }

.dropdown-link {
    display: block;
    padding: .65rem 1rem;
    color: var(--text);
    font-size: .9rem;
    transition: background var(--transition);
}
.dropdown-link:hover { background: var(--bg-hover); text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* Menu hamburger (mobile) */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    width: 38px; height: 38px;
    padding: .6rem .55rem;
}
.menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: var(--transition);
}

/* =============================================
   MAIN LAYOUT
   ============================================= */

.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: calc(100vh - var(--header-h));
}

/* =============================================
   ALERTS (flash messages)
   ============================================= */

.alert {
    padding: .85rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
    animation: slideIn .3s ease;
}
.alert-error   { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }

[data-theme="dark"] .alert-error   { background: #2d1515; border-color: #742a2a; color: #fc8181; }
[data-theme="dark"] .alert-success { background: #1a2e20; border-color: #2f855a; color: #68d391; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover  { background: var(--bg-hover); color: var(--text); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover   { opacity: .9; color: #fff; }
.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-full     { width: 100%; }
.btn-sm       { padding: .4rem .8rem; font-size: .82rem; }
.btn-xs       { padding: .25rem .6rem; font-size: .78rem; }
.btn-icon     { padding: .5rem; }

/* =============================================
   FORMS
   ============================================= */

.form-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1.1rem;
}

label {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
}

.required { color: var(--danger); }

.field-hint {
    font-size: .78rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: .9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

textarea { resize: vertical; min-height: 80px; }

input[readonly] { background: var(--bg-hover); cursor: not-allowed; color: var(--text-muted); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-check { margin-bottom: .75rem; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    font-weight: 500;
    font-size: .9rem;
    user-select: none;
}
.checkbox-label input[type="checkbox"] { width: auto; cursor: pointer; }

.input-password-wrapper { position: relative; }
.input-password-wrapper input { padding-right: 2.5rem; }
.toggle-password {
    position: absolute;
    right: .7rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    max-width: 700px;
}

/* Sélecteur de couleur utilisateur (5 couleurs fixes) */
.user-color-picker {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}
.user-color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    cursor: pointer;
}
.user-color-option input { display: none; }
.user-color-swatch {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: border-color var(--transition), transform var(--transition);
}
.user-color-option.selected .user-color-swatch,
.user-color-option:hover .user-color-swatch {
    border-color: var(--text);
    transform: scale(1.15);
}
.user-color-label {
    font-size: .72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Sélecteur de couleur (ancien, gardé pour compatibilité) */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
input[type="color"] { width: 44px; height: 36px; padding: 2px; border-radius: var(--radius-sm); cursor: pointer; }

.color-presets {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}
.color-preset {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition);
}
.color-preset:hover { transform: scale(1.2); border-color: var(--text); }

/* Images profil (sélection) */
.profile-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: .5rem;
}
.profile-image-card {
    cursor: pointer;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
    aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
}
.profile-image-card input { display: none; }
.profile-image-card img { width: 100%; height: 100%; object-fit: cover; }
.profile-image-card.selected { border-color: var(--primary); transform: scale(1.05); }
.profile-image-card:hover { border-color: var(--primary); }
.no-image-placeholder { font-size: .75rem; color: var(--text-muted); text-align: center; padding: .5rem; }

/* Participants */
.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: .6rem;
}
.participant-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .75rem .5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: .8rem;
    font-weight: 500;
    text-align: center;
}
.participant-card input { display: none; }
.participant-card.selected { border-color: var(--primary); background: var(--primary-light); }
.participant-card:hover { border-color: var(--primary); }

.participant-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    overflow: hidden;
}
.participant-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Image courante */
.current-image {
    margin-bottom: .5rem;
}
.current-image img {
    max-width: 180px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: .3rem;
}
.image-preview img {
    max-width: 200px;
    border-radius: var(--radius);
    margin-top: .5rem;
    border: 1px solid var(--border);
}

/* =============================================
   PAGE STRUCTURE
   ============================================= */

.page-container { max-width: 1200px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-subtitle   { color: var(--text-muted); font-size: .9rem; }

/* =============================================
   CALENDAR
   ============================================= */

.calendar-page {}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.calendar-title {
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
}

.calendar-actions {
    display: flex;
    gap: .5rem;
}

.calendar-grid-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: visible;
    box-shadow: var(--shadow-sm);
    clip-path: inset(0 round var(--radius-lg));
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.weekday-label {
    padding: .65rem;
    text-align: center;
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: .4rem;
    min-height: 100px;
    position: relative;
    overflow: visible;
    transition: background var(--transition);
}
.calendar-cell:nth-child(7n)  { border-right: none; }
.calendar-cell--empty         { background: var(--bg); }
.calendar-cell:not(.calendar-cell--empty):hover { background: var(--bg-hover); cursor: default; }

.calendar-cell--today {
    background: var(--primary-light);
}
.calendar-cell--today .cell-day {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
}

.cell-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.cell-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
}

.event-pill {
    display: block;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: .72rem;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
    position: relative;
    z-index: 1;
    transition: opacity var(--transition);
}
.event-pill:hover { opacity: .85; }
.event-pill--birthday { letter-spacing: .02em; }

/* Barres multi-jours continues */
.event-pill--start {
    border-radius: 3px 0 0 3px;
    margin-right: calc(-0.4rem - 1px);
    padding-right: 0;
}
.event-pill--middle {
    border-radius: 0;
    margin-left: calc(-0.4rem - 1px);
    margin-right: calc(-0.4rem - 1px);
    padding-left: 2px;
    padding-right: 0;
}
.event-pill--end {
    border-radius: 0 3px 3px 0;
    margin-left: calc(-0.4rem - 1px);
    padding-left: 2px;
}

.event-more {
    font-size: .7rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 1px 4px;
    font-weight: 600;
}
.event-more:hover { color: var(--primary); }

/* Légende */
.calendar-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: .75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.legend-item { display: flex; align-items: center; gap: .4rem; font-size: .83rem; }
.legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* =============================================
   MODAL
   ============================================= */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.75rem;
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: modalIn .25s ease;
    max-height: 90vh;
    overflow-y: auto;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.modal-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }

/* Contenu de la modale événement */
.event-modal-header {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1rem;
}
.event-modal-color {
    width: 14px; height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}
.event-modal-title { font-size: 1.2rem; font-weight: 700; }
.event-modal-image {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    max-height: 200px;
    object-fit: cover;
}
.event-modal-meta { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.event-meta-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: .88rem;
    color: var(--text-muted);
}
.event-meta-icon { flex-shrink: 0; }
.event-modal-desc { font-size: .9rem; color: var(--text-muted); margin-bottom: 1rem; white-space: pre-wrap; }
.event-modal-participants { margin-top: .75rem; }
.event-modal-participants-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .5rem; }
.event-modal-avatars { display: flex; gap: .4rem; flex-wrap: wrap; }
.event-participant-chip {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .5rem;
    border-radius: var(--radius-full);
    font-size: .78rem;
    font-weight: 600;
    color: #fff;
}
.event-modal-actions { display: flex; gap: .5rem; margin-top: 1.25rem; }

/* =============================================
   AUTH
   ============================================= */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo-icon { font-size: 3rem; display: block; margin-bottom: .5rem; }
.auth-logo h1  { font-size: 1.4rem; font-weight: 800; margin-bottom: .25rem; }
.auth-logo p   { color: var(--text-muted); font-size: .9rem; }

.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-form .form-group { margin-bottom: 1.1rem; }

/* =============================================
   ADMIN — STATS
   ============================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-icon  { font-size: 2rem; margin-bottom: .5rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1rem; font-weight: 700; }

/* Event list */
.event-list { padding: .5rem 0; }
.event-list-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.25rem;
    transition: background var(--transition);
}
.event-list-item:hover { background: var(--bg-hover); }
.event-list-color { width: 4px; height: 36px; border-radius: 2px; flex-shrink: 0; }
.event-list-info { flex: 1; }
.event-list-info strong { display: block; font-size: .88rem; }
.event-list-info small  { color: var(--text-muted); font-size: .78rem; }

/* Log list */
.log-list { padding: .5rem 0; }
.log-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
}
.log-icon { font-size: 1rem; flex-shrink: 0; }
.log-content { flex: 1; }
.log-label { font-size: .85rem; font-weight: 600; display: block; }
.log-actor { font-size: .78rem; color: var(--text-muted); }
.log-date  { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; }

/* Admin nav cards */
.admin-nav-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.admin-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.admin-nav-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.admin-nav-icon { font-size: 1.8rem; }

/* =============================================
   TABLE
   ============================================= */

.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: .87rem;
}
.data-table thead th {
    padding: .85rem 1rem;
    text-align: left;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}
.data-table tbody td {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.row-inactive { opacity: .55; }

.user-cell { display: flex; align-items: center; gap: .6rem; }
.table-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.table-avatar-placeholder {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .8rem;
}
.table-actions { display: flex; gap: .4rem; }
.color-swatch { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: var(--radius-full);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-admin    { background: #faf5ff; color: #6b46c1; }
.badge-user     { background: var(--bg-hover); color: var(--text-muted); }
.badge-active   { background: #f0fff4; color: #276749; }
.badge-inactive { background: #fff5f5; color: #c53030; }

[data-theme="dark"] .badge-admin    { background: #2d1d5a; color: #b794f4; }
[data-theme="dark"] .badge-user     { background: var(--bg-hover); }
[data-theme="dark"] .badge-active   { background: #1a2e20; color: #68d391; }
[data-theme="dark"] .badge-inactive { background: #2d1515; color: #fc8181; }

/* Log actions */
.log-action-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border-radius: var(--radius-full);
    font-size: .78rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text);
}

/* =============================================
   LOGS PAGE
   ============================================= */

.filter-form { margin-bottom: 1rem; }
.select-filter {
    padding: .5rem .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: .9rem;
    cursor: pointer;
}

.log-date-cell { white-space: nowrap; font-size: .82rem; color: var(--text-muted); }
.log-details { max-width: 250px; }
.detail-tag {
    display: inline-block;
    padding: .1rem .4rem;
    background: var(--bg-hover);
    border-radius: 4px;
    font-size: .75rem;
    margin: 1px;
}

/* Pagination */
.pagination { display: flex; gap: .4rem; margin-top: 1rem; }
.page-link {
    padding: .4rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: var(--text);
    text-decoration: none;
    transition: all var(--transition);
}
.page-link:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =============================================
   PROFILE IMAGES ADMIN
   ============================================= */

.upload-card { margin-bottom: 1.5rem; max-width: 100%; }
.upload-card h2 { margin-bottom: 1rem; font-size: 1rem; font-weight: 700; }

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    color: var(--text-muted);
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone label { cursor: pointer; }

#uploadPreview {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
#previewImg { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }

.profile-images-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}
.profile-image-admin-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
.profile-image-admin-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.profile-image-admin-card.inactive { opacity: .5; }
.inactive-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
}
.profile-image-actions {
    display: flex;
    gap: .4rem;
    padding: .5rem;
    background: var(--bg-hover);
    justify-content: center;
    flex-wrap: wrap;
}

/* =============================================
   EMPTY STATES
   ============================================= */

.empty-state-box {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: .9rem;
}
.empty-state { text-align: center; padding: 1.5rem; color: var(--text-muted); font-size: .88rem; }

/* =============================================
   RESPONSIVE — TABLETTE
   ============================================= */

@media (max-width: 1024px) {
    .dashboard-grid  { grid-template-columns: 1fr; }
    .admin-nav-cards { grid-template-columns: 1fr 1fr 1fr; }
}

/* =============================================
   RESPONSIVE — MOBILE
   ============================================= */

/* =============================================
   NAVIGATION MOBILE (barre du bas)
   ============================================= */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 110;
    padding: .4rem 0;
    padding-bottom: calc(.4rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 16px rgba(0,0,0,.08);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    flex: 1;
    padding: .35rem .5rem;
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition);
    line-height: 1;
}
.bottom-nav-item:hover, .bottom-nav-item.active { color: var(--primary); text-decoration: none; }
.bottom-nav-item svg { flex-shrink: 0; }

.bottom-nav-add {
    flex-shrink: 0;
}
.bottom-nav-add-icon {
    width: 48px; height: 48px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    font-weight: 300;
    box-shadow: 0 4px 12px rgba(102,126,234,.4);
    margin-bottom: -8px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.bottom-nav-add:hover .bottom-nav-add-icon {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(102,126,234,.5);
}

.bottom-notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    min-width: 16px; height: 16px;
    border-radius: 99px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
}

/* =============================================
   PANNEAU DE JOUR (bottom sheet mobile)
   ============================================= */

.day-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 200;
    backdrop-filter: blur(2px);
}
.day-sheet-overlay.open { display: block; }

.day-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    z-index: 201;
    padding: 0 1rem 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.32,.72,0,1);
    box-shadow: 0 -4px 30px rgba(0,0,0,.15);
}
.day-sheet.open { transform: translateY(0); }

.day-sheet-handle {
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: .75rem auto .5rem;
    flex-shrink: 0;
    cursor: grab;
}

.day-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem 0 .75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.day-sheet-date {
    font-size: 1rem;
    font-weight: 700;
}

.day-sheet-body {
    overflow-y: auto;
    flex: 1;
    padding-top: .5rem;
}

.day-sheet-event {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem .5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    border-radius: var(--radius);
    transition: background var(--transition);
}
.day-sheet-event:hover { background: var(--bg-hover); }
.day-sheet-event:last-child { border-bottom: none; }

.day-sheet-event-color {
    width: 5px;
    min-height: 36px;
    border-radius: 3px;
    flex-shrink: 0;
}
.day-sheet-event-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.day-sheet-event-info strong { font-size: .92rem; }
.day-sheet-time { font-size: .78rem; color: var(--text-muted); }
.day-sheet-loc  { font-size: .78rem; color: var(--text-muted); }
.day-sheet-empty { text-align: center; padding: 2rem; color: var(--text-muted); font-size: .9rem; }

/* =============================================
   RESPONSIVE — ACTIVATION MOBILE (≤ 768px)
   ============================================= */

@media (max-width: 768px) {
    /* Bottom nav visible */
    .bottom-nav { display: flex; }
    .app-main   { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

    /* Header compact */
    .header-inner { padding: 0 .75rem; gap: .5rem; }
    .header-nav   { display: none; }
    .user-name    { display: none; }
    .user-menu-btn {
        padding: .2rem;
        border: none;
        background: none;
        border-radius: 50%;
    }
    .user-menu-btn svg { display: none; }

    /* Notification dropdown : largeur adaptée */
    .notif-dropdown {
        width: min(340px, calc(100vw - 1.5rem));
        right: -.25rem;
    }

    /* Modale : bottom sheet */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-box {
        border-radius: 20px 20px 0 0;
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        margin: 0;
        padding: 1.5rem 1.25rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
        animation: modalSlideUp .3s cubic-bezier(.32,.72,0,1);
    }
    @keyframes modalSlideUp {
        from { transform: translateY(40px); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    /* Calendrier */
    .calendar-toolbar { flex-direction: row; flex-wrap: wrap; gap: .5rem; }
    .calendar-title   { font-size: 1rem; min-width: 130px; }
    .calendar-cell    { min-height: 72px; padding: .25rem; }
    .cell-day         { width: 22px; height: 22px; font-size: .75rem; }
    .weekday-label    { font-size: .65rem; padding: .4rem .1rem; }
    .event-pill       { font-size: .65rem; }
    .event-pill--start  { margin-right: calc(-0.25rem - 1px); }
    .event-pill--middle { margin-left: calc(-0.25rem - 1px); margin-right: calc(-0.25rem - 1px); }
    .event-pill--end    { margin-left: calc(-0.25rem - 1px); }

    /* Admin */
    .stats-grid      { grid-template-columns: 1fr 1fr; }
    .admin-nav-cards { grid-template-columns: 1fr 1fr; }
    .dashboard-grid  { grid-template-columns: 1fr; }

    /* Formulaires */
    .form-row     { grid-template-columns: 1fr; }
    .form-card    { padding: 1.25rem; max-width: 100%; }
    .form-actions { flex-direction: column; gap: .5rem; }
    .form-actions .btn { width: 100%; justify-content: center; }

    /* Tableaux : scroll horizontal fluide */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: .82rem;
    }

    /* Boutons : taille tactile minimum */
    .btn    { min-height: 40px; }
    .btn-sm { min-height: 36px; }

    /* Swatches couleur plus grands au toucher */
    .user-color-swatch { width: 42px; height: 42px; }
    .user-color-label  { font-size: .68rem; }
}

/* =============================================
   RESPONSIVE — PETIT MOBILE (≤ 480px)
   ============================================= */

@media (max-width: 480px) {
    /* Header minimal */
    .header-inner { padding: 0 .5rem; gap: .25rem; }
    .logo-text    { display: none; }
    .app-main     { padding: .75rem; padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

    /* Calendrier : cellules très compactes */
    .calendar-toolbar { justify-content: space-between; gap: .25rem; }
    .calendar-title   { font-size: .85rem; min-width: 105px; }
    .calendar-cell    { min-height: 48px; padding: .15rem .1rem; }
    .cell-day         { width: 19px; height: 19px; font-size: .68rem; margin-bottom: .15rem; }
    .weekday-label    { font-size: .58rem; padding: .3rem .05rem; letter-spacing: 0; }

    /* Pills → petits points colorés (tap sur la cellule ouvre le day sheet) */
    .cell-events {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px;
        justify-content: center;
        margin-top: 1px;
    }
    .event-pill {
        width: 6px !important;
        height: 6px !important;
        min-width: 6px;
        border-radius: 50% !important;
        padding: 0 !important;
        font-size: 0 !important;
        overflow: hidden;
        flex-shrink: 0;
        margin: 0 !important;
        line-height: 0;
    }
    .event-more { display: none !important; }

    /* Admin */
    .stats-grid      { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .stat-card       { padding: 1rem .75rem; }
    .stat-value      { font-size: 1.6rem; }
    .stat-icon       { font-size: 1.5rem; }
    .admin-nav-cards { grid-template-columns: 1fr; }
    .admin-nav-card  {
        flex-direction: row;
        justify-content: flex-start;
        padding: .85rem 1rem;
        gap: .75rem;
    }
    .admin-nav-icon  { font-size: 1.4rem; }

    /* Auth */
    .auth-card      { padding: 1.75rem 1.25rem; }
    .auth-logo-icon { font-size: 2.2rem; }

    /* Pagination compacte */
    .pagination { gap: .2rem; flex-wrap: wrap; }
    .page-link  { padding: .35rem .55rem; font-size: .78rem; }

    /* Modale : padding serré */
    .modal-box { padding: 1.25rem 1rem; }
    .event-modal-title { font-size: 1.05rem; }
}

/* =============================================
   UTILITAIRES
   ============================================= */

.hidden { display: none !important; }
code { background: var(--bg-hover); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }