/* ============================================================
   VARIABLES — Charte graphique AMA Care
   ============================================================ */
:root {
    /* Couleurs principales (extraites du logo) */
    --color-green-dark:  #1a7a4a;
    --color-green-light: #4cba6e;
    --color-blue-dark:   #1a5f8a;
    --color-blue-light:  #3a9fd4;

    /* Neutres */
    --color-white:       #ffffff;
    --color-bg:          #f4f7f9;
    --color-text:        #2c3e50;
    --color-text-muted:  #7f8c8d;
    --color-border:      #dce3e8;

    /* Sémantiques */
    --color-success:     #4cba6e;
    --color-warning:     #f39c12;
    --color-danger:      #e74c3c;

    /* Survol de ligne (tableaux, cartes cliquables) — répété en dur
       à plusieurs endroits avant, centralisé ici */
    --color-hover-row:   #f8fbff;
}

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

/* html ET body : sur Safari iOS, overflow-x:hidden posé seulement sur body
   ne suffit pas — un débordement quelque part peut quand même élargir toute
   la largeur de mise en page (et donc tous les calculs de grilles en %),
   donnant une page qui semble "zoomée" avec du contenu coupé à droite. */
html {
    overflow-x: hidden;
}

body {
    font-family: system-ui, Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================================
   BOUTON PRIMAIRE — dégradé vert → bleu (sens du logo)
   ============================================================ */
.btn-primary {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--color-green-light), var(--color-blue-light));
    color: var(--color-white);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-green-dark), var(--color-blue-dark));
}

.btn-primary:disabled {
    background: var(--color-border);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.btn-danger {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 6px;
    background: var(--color-danger);
    color: var(--color-white);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-secondary {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-white);
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

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

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

/* ============================================================
   SQUELETTE DASHBOARD — sidebar, topbar, cartes stats, panneaux
   Partagé par les 3 espaces (soignant/institution/modérateur) : un
   seul jeu de règles ici, chaque espace ne définit plus que sa
   couleur d'accent via --sidebar-accent (voir soignant.css /
   institution.css / moderateur.css)
   ============================================================ */
.dashboard-body {
    margin: 0;
    font-family: system-ui, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--sidebar-accent, var(--color-blue-dark));
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
}

.sidebar-logo {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo img {
    width: 130px;
    height: auto;
    border-radius: 8px;
}

.sidebar-role {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--sidebar-role-label, rgba(255,255,255,0.7));
    padding: 1rem 1.25rem 0.5rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.5rem 0.75rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 500;
}

.nav-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

/* La flèche s'affiche uniquement sur l'item actif */
.nav-arrow {
    margin-left: auto;
    opacity: 0.7;
}

.sidebar-bottom {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.nav-logout {
    color: rgba(255,255,255,0.6);
}

.nav-logout:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

/* Overlay sombre derrière la sidebar ouverte (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* --- Contenu principal --- */
.dashboard-main {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- Topbar --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--color-bg);
    padding-bottom: 0.5rem;
    margin-bottom: -0.5rem;
}

/* min-width:0 est nécessaire : sans ça, un flex item refuse de
   rétrécir sous la largeur de son contenu (titre/sous-titre) et
   fait déborder toute la page horizontalement sur petit écran —
   c'était la cause du rendu mobile cassé */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.topbar-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 0.2rem;
}

.topbar-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* Chip cliquable vers le profil — avatar + nom, fond blanc distinct du
   fond gris du topbar pour bien indiquer que c'est un élément interactif */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    padding: 0.35rem 1rem 0.35rem 0.35rem;
    border-radius: 50px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.topbar-user:hover {
    border-color: var(--color-blue-light);
    box-shadow: 0 4px 12px rgba(26, 95, 138, 0.15);
    transform: translateY(-1px);
}

.topbar-user:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Petit chevron qui indique qu'il y a une action derrière ce chip */
.topbar-user::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
    transform: rotate(45deg);
    margin-left: 0.1rem;
    transition: border-color 0.15s ease;
}

.topbar-user:hover::after {
    border-color: var(--color-blue-dark);
}

/* Avatar circulaire avec initiales — dégradé vert → bleu, léger liseré
   pour se détacher du fond blanc du chip */
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-green-dark), var(--color-blue-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--color-white), 0 0 0 3px var(--color-border);
    overflow: hidden;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bloc photo de profil des 3 pages "profil" (soignant/institution/modérateur) —
   centralisé ici plutôt que dupliqué dans chaque template (2026-08-09) */
.profil-photo-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.profil-photo-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--color-blue-dark);
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    flex-shrink: 0;
    overflow: hidden;
}

.profil-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
}

/* --- Burger — visible uniquement sous 1024px --- */
.burger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    flex-shrink: 0;
}

.burger span {
    display: block;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

/* --- Cartes statistiques --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem 1.25rem 1.1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Empêche le libellé/valeur de forcer la carte à s'élargir à côté de
   l'icône quand l'espace se resserre (même logique que .topbar-left) */
.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin: 0 0 0.4rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 0.25rem;
    line-height: 1;
}

.stat-sub {
    font-size: 0.8rem;
    margin: 0;
    font-weight: 500;
}

.stat-sub--warning { color: var(--color-warning); }
.stat-sub--success { color: var(--color-success); }
.stat-sub--muted   { color: var(--color-text-muted); }

/* Icônes colorées dans les cartes */
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon--green  { background: rgba(76,186,110,0.12);  color: var(--color-green-dark); }
.stat-icon--blue   { background: rgba(26, 95,138,0.12);  color: var(--color-blue-dark);  }
.stat-icon--teal   { background: rgba(58,159,212,0.12);  color: var(--color-blue-light); }
.stat-icon--orange { background: rgba(243,156, 18,0.12); color: var(--color-warning);    }

/* --- Grille de panneaux génériques --- */
.panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ============================================================
   RESPONSIVE DASHBOARD — breakpoints 1024px (tablette) et 600px (mobile)
   ============================================================ */
@media (max-width: 1024px) {

    /* Sidebar cachée par défaut, glisse depuis la gauche */
    .sidebar {
        transform: translateX(-240px);
        transition: transform 0.25s ease;
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Le contenu principal prend toute la largeur */
    .dashboard-main {
        margin-left: 0;
        padding: 1.25rem;
    }

    /* Burger visible */
    .burger {
        display: flex;
    }

    /* Stats : 2 colonnes sur tablette */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Panneaux : 1 colonne */
    .panels-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {

    /* Stats : 1 colonne sur mobile */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-main {
        padding: 1rem;
    }

    /* Masque le nom, ne garde que l'avatar — sinon burger + titre +
       nom complet ne tiennent jamais sur une largeur de téléphone */
    .topbar-user .user-name {
        display: none;
    }

    .topbar-user {
        padding: 0.35rem;
    }
}

/* ============================================================
   PANNEAUX (cards génériques) — partagé par les 3 espaces, avant
   dupliqué à l'identique dans soignant.css/institution.css/moderateur.css
   ============================================================ */
.panel {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin: 0 0 1rem;
}

/* Badge "X en attente" */
.badge-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-warning);
    background: rgba(243,156,18,0.12);
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
}

/* ============================================================
   BARRES DE PROGRESSION
   ============================================================ */
.progress-group {
    margin-bottom: 1.25rem;
}

.progress-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.progress-label {
    font-size: 0.85rem;
    color: var(--color-text);
}

.progress-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.progress-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-fill--green { background: var(--color-green-dark); }
.progress-fill--blue  { background: var(--color-blue-dark);  }

/* ============================================================
   ACTIVITÉ RÉCENTE
   ============================================================ */
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.activity-dot--green  { background: var(--color-green-dark); }
.activity-dot--blue   { background: var(--color-blue-dark);  }
.activity-dot--orange { background: var(--color-warning);    }

.activity-text {
    font-size: 0.88rem;
    color: var(--color-text);
    margin: 0 0 0.15rem;
}

.activity-time {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin: 0;
}

.activity-empty {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* ============================================================
   TABLEAU GÉNÉRIQUE
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: var(--color-hover-row);
}

/* Mobile : le tableau devient une pile de "cartes" (une par ligne) au lieu
   de scroller horizontalement — chaque <td> passe en display:block avec
   son label (attribut data-label posé dans le template) affiché via
   ::before, sauf la 1re cellule (identité, sert d'en-tête de carte) et la
   dernière (actions, déjà lisible sans label) */
@media (max-width: 600px) {
    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--color-border);
        border-radius: 10px;
        overflow: hidden;
    }

    .data-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .data-table td {
        padding: 0.65rem 0.9rem;
        border-bottom: 1px solid var(--color-border);
    }

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

    /* 1re cellule (avatar + nom) : en-tête de carte, pas de label */
    .data-table td:first-child {
        background: var(--color-bg);
        font-weight: 600;
    }

    /* Cellules avec data-label : label à gauche, valeur à droite */
    .data-table td[data-label] {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }

    .data-table td[data-label]::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        color: var(--color-text-muted);
        flex-shrink: 0;
    }
}

/* Ligne nom + avatar dans le tableau */
.user-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 500;
}

/* Avatar petit (initiales dans le tableau) */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-green-dark), var(--color-blue-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Badges TYPE (Soignant / Institution) — "badge-pill" pour ne pas entrer
   en conflit avec .badge (rectangle/majuscules) défini plus haut */
.badge-pill {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-pill--green { background: rgba(76,186,110,0.15);  color: var(--color-green-dark); }
.badge-pill--blue  { background: rgba(26, 95,138,0.12);  color: var(--color-blue-dark);  }
.badge-pill--gray  { background: rgba(127,140,141,0.15); color: var(--color-text-muted); }
.badge-pill--red   { background: rgba(231,76,60,0.15);   color: var(--color-danger);     }
/* Mauve — rôle développeur (2026-08-05), seule utilisation de cette teinte,
   pas dans la charte graphique de base donc pas de variable --color-* dédiée */
.badge-pill--purple { background: rgba(155,89,182,0.15); color: #8e44ad; }

/* Badge statut "En attente" */
.status-pending {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-warning);
    background: rgba(243,156,18,0.12);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
}

.status-pending::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-warning);
}

/* --- Boutons Approuver / Refuser --- */
.btn-approve,
.btn-refuse {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid;
    background: transparent;
    transition: background 0.15s, color 0.15s;
}

.btn-approve {
    border-color: var(--sidebar-accent, var(--color-blue-dark));
    color: var(--sidebar-accent, var(--color-blue-dark));
}

.btn-approve:hover {
    background: var(--sidebar-accent, var(--color-blue-dark));
    color: #fff;
}

.btn-refuse {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.btn-refuse:hover {
    background: var(--color-danger);
    color: #fff;
}

.text-muted { color: var(--color-text-muted); }

/* Lien vers le détail du dossier */
.profil-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
}

.profil-link:hover {
    color: var(--sidebar-accent, var(--color-blue-dark));
    text-decoration: underline;
}

/* ============================================================
   PAGE DÉTAIL — styles génériques
   ============================================================ */

/* Lien "Retour" */
.back-link {
    display: inline-block;
    font-size: 0.82rem;
    color: var(--sidebar-accent, var(--color-blue-dark));
    text-decoration: none;
    margin-bottom: 0.2rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Panel du haut : statut + boutons côte à côte */
.dossier-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Côté gauche : badge statut + date */
.dossier-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Badges de statut validé / refusé */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

.status-badge::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-badge--approved {
    color: var(--color-green-dark);
    background: rgba(76, 186, 110, 0.15);
}

.status-badge--approved::before {
    background: var(--color-green-dark);
}

.status-badge--refused {
    color: var(--color-danger);
    background: rgba(231, 76, 60, 0.12);
}

.status-badge--refused::before {
    background: var(--color-danger);
}

.status-badge--disabled {
    color: var(--color-text-muted);
    background: rgba(127, 140, 141, 0.12);
}

.status-badge--disabled::before {
    background: var(--color-text-muted);
}

/* Boutons grande taille */
.btn-lg {
    padding: 0.55rem 1.4rem;
    font-size: 0.9rem;
}

/* Grille 3 colonnes pour les infos */
.dossier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Liste définition */
.info-list {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.55rem 1rem;
    align-items: baseline;
}

.info-list dt {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.info-list dd {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text);
    font-weight: 500;
}

/* ============================================================
   FILTRES ET BOUTON OUTLINE
   ============================================================ */
.filters-bar {
    padding: 1rem 1.5rem;
}

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text-muted);
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.filter-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-btn:hover {
    border-color: var(--sidebar-accent, var(--color-blue-dark));
    color: var(--sidebar-accent, var(--color-blue-dark));
}

.filter-btn.active {
    background: var(--sidebar-accent, var(--color-blue-dark));
    border-color: var(--sidebar-accent, var(--color-blue-dark));
    color: #fff;
    font-weight: 600;
}

/* Bouton outline neutre */
.btn-outline {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    background: transparent;
    transition: border-color 0.15s, color 0.15s;
}

.btn-outline:hover {
    border-color: var(--sidebar-accent, var(--color-blue-dark));
    color: var(--sidebar-accent, var(--color-blue-dark));
}

@media (max-width: 600px) {
    .filters-form {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 1024px) {
    .dossier-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dossier-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .dossier-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   TITRES DE SECTION
   ============================================================ */
h1, h2, h3 {
    color: var(--color-green-dark);
}

/* ============================================================
   MESSAGES FLASH DJANGO
   ============================================================ */
.messages {
    padding: 1rem;
}

/* Définition unique (avant : dupliquée avec une forme différente dans
   soignant.css/institution.css/moderateur.css, ce qui donnait un rendu
   différent des messages flash selon la page) */
.alert {
    padding: 0.85rem 1.25rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
}

.alert--success { background: #d6f0e0; border-color: var(--color-success); color: var(--color-green-dark); }
.alert--error   { background: #fde8e8; border-color: var(--color-danger);  color: var(--color-danger); }
.alert--warning { background: #fef3dc; border-color: var(--color-warning); color: #7a5000; }
.alert--info    { background: #d6eaf8; border-color: var(--color-blue-dark); color: var(--color-blue-dark); }

/* ============================================================
   BADGES — Étiquettes de statut / catégorie
   ============================================================ */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Variantes de couleur */
.badge-paye        { background: var(--color-success); color: white; }
.badge-non-paye    { background: var(--color-warning); color: white; }
.badge-echue       { background: var(--color-danger); color: white; }
.badge-confirme    { background: var(--color-success); color: white; }
.badge-mrs         { background: var(--color-blue-dark); color: white; }
.badge-hopital     { background: var(--color-blue-light); color: white; }
.badge-pmr         { background: var(--color-green-dark); color: white; }
.badge-autre       { background: var(--color-text-muted); color: white; }
.badge-active      { background: var(--color-success); color: white; }
.badge-inactive    { background: var(--color-text-muted); color: white; }
.badge-standby     { background: var(--color-warning); color: white; }
.badge-signalement { background: var(--color-blue-light); color: white; }

/* Statuts de mission */
.badge-disponible  { background: var(--color-blue-dark); color: white; }
.badge-attribuee   { background: var(--color-success); color: white; }
.badge-terminee    { background: var(--color-text-muted); color: white; }
.badge-expiree     { background: var(--color-warning); color: white; }
.badge-annulee     { background: var(--color-danger); color: white; }

/* Badge neutre "type de poste" (Infirmier/Aide-soignant) — avant dupliqué
   à l'identique dans soignants/dashboard.html et institutions/dashboard.html,
   absent des pages détail mission qui l'utilisent aussi */
.badge-type {
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: 0.7rem;
}

/* ============================================================
   NOTIFICATIONS FLASH — toast en haut de page, auto-disparition
   ============================================================ */
.toast-container {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 90%;
    max-width: 480px;
}

.toast {
    padding: 0.9rem 1.25rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s, transform 0.25s;
}

.toast.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--success {
    background: #d6f0e0;
    border-color: var(--color-success);
    color: var(--color-green-dark);
}

.toast--error {
    background: #fde8e8;
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.toast--warning {
    background: #fef3dc;
    border-color: var(--color-warning);
    color: #7a5000;
}

@media (max-width: 768px) {
    .toast-container {
        width: 94%;
        top: 0.75rem;
    }
}

/* ============================================================
   MODALE DE CONFIRMATION — remplace les confirm() natifs
   ============================================================ */
.modal-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.modal-confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-confirm-box {
    background: var(--color-white);
    border-radius: 12px;
    padding: 1.75rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
    transform: translateY(-16px) scale(0.97);
    transition: transform 0.2s;
}

.modal-confirm-overlay.active .modal-confirm-box {
    transform: translateY(0) scale(1);
}

.modal-confirm-message {
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
}

.modal-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 480px) {
    .modal-confirm-box {
        padding: 1.25rem;
    }

    .modal-confirm-actions {
        flex-direction: column-reverse;
    }

    .modal-confirm-actions button {
        width: 100%;
    }
}

/* ============================================================
   MODALE "PLUS D'INFORMATIONS" MISSION — remplace la bulle au survol
   (inutilisable au doigt sur tablette/mobile) par un bouton cliquable qui
   ouvre la description dans cette même modale, identique sur tous les
   écrans. Même famille visuelle que la modale de confirmation ci-dessus.
   Injectée en JS par static/js/mission-details.js.
   ============================================================ */
.modal-mission-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.modal-mission-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-mission-box {
    position: relative;
    background: var(--color-white);
    border-radius: 12px;
    padding: 1.75rem;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
    transform: translateY(-16px) scale(0.97);
    transition: transform 0.2s;
}

.modal-mission-overlay.active .modal-mission-box {
    transform: translateY(0) scale(1);
}

.modal-mission-fermer {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.modal-mission-fermer:hover {
    color: var(--color-text);
}

.modal-mission-titre {
    margin: 0 1.5rem 1rem 0;
    color: var(--color-green-dark);
    font-size: 1.05rem;
}

.modal-mission-description,
.modal-mission-commentaire {
    margin: 0 0 0.75rem 0;
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.modal-mission-description:last-child,
.modal-mission-commentaire:last-child {
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .modal-mission-box {
        padding: 1.25rem;
    }
}

/* Wrapper générique pour empêcher un tableau de faire déborder toute la
   page sur mobile — seul le tableau scrolle horizontalement, pas la page.
   Donne aussi un rendu cohérent (bordure, coins arrondis, en-tête teinté,
   survol de ligne) à tous les tableaux qui l'utilisent (dossiers, factures,
   historique, tarifs...), sans avoir à le redéfinir dans chaque template. */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-white);
}

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

.table-wrapper th {
    background: var(--color-bg);
}

.table-wrapper tbody tr:hover {
    background: var(--color-hover-row);
}

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

/* Mode lecture seule des pages de profil (point client 2026-07-19) — les
   champs restent lisibles (pas le gris délavé par défaut du navigateur)
   tant que le bouton "Modifier" n'a pas été cliqué. */
.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background: var(--color-bg);
    color: var(--color-text);
    cursor: default;
}

/* Détail mission (soignant + institution) — avant dupliqué à l'identique
   dans les 2 templates */
.mission-detail-info {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.mission-detail-info .info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--color-text);
}

/* Documents (soignant + institution) — avant dupliqué à l'identique
   dans les 2 templates, media query 600px incluse */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.doc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    flex-wrap: wrap;
    gap: 1rem;
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.doc-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(26, 95, 138, 0.12);
    color: var(--color-blue-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.doc-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.2rem;
}

.doc-status {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.doc-status--valide {
    color: var(--color-success);
}

.doc-status--attente {
    color: var(--color-warning);
}

.doc-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.doc-upload-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doc-upload-form input[type="file"] {
    font-size: 0.8rem;
    max-width: 180px;
}

@media (max-width: 600px) {
    .doc-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .doc-actions {
        width: 100%;
    }

    .doc-upload-form {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* Dashboard soignant/institution — compteurs, cartes missions, "missions
   à venir/pourvues" — avant dupliqué à l'identique dans les 2 templates.
   Ce qui reste propre à chaque rôle (bulle de description, sur quels
   éléments elle apparaît) reste dans le <style> local de chaque dashboard. */
.info-message {
    background: #d7ecf7;
    border-left: 4px solid var(--color-blue-dark);
}

/* Couleur selon l'importance de l'annonce (choisie par le modérateur) */
.info-message--important {
    background: #fde8c7;
    border-left: 4px solid var(--color-warning);
}

.info-message--urgent {
    background: #fad9d5;
    border-left: 4px solid var(--color-danger);
}

.badge-primary--important {
    background: var(--color-warning);
}

.badge-primary--urgent {
    background: var(--color-danger);
}

.badge-importance--important {
    background: var(--color-warning);
    color: white;
}

.badge-importance--urgent {
    background: var(--color-danger);
    color: white;
}

/* Carrousel générique (annonces des dashboards, tarifs de la page
   présentation institution...) */
.carousel {
    position: relative;
    margin-bottom: 1.5rem;
}

.carousel-track {
    overflow: hidden;
    border-radius: 12px;
}

.carousel-track > div {
    display: flex;
    transition: transform 0.3s ease;
}

.carousel-slide {
    flex: 0 0 100%;
    min-width: 0;
    margin-bottom: 0;
}

.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-blue-dark);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.carousel-prev { left: -14px; }
.carousel-next { right: -14px; }

/* Sous 600px, les flèches restent DANS le cadre du carrousel au lieu de
   déborder de 14px de chaque côté — sur mobile il n'y a pas la marge
   de respiration du desktop, et le débordement finissait collé au bord
   de l'écran (parfois à moitié hors champ). */
@media (max-width: 600px) {
    .carousel-prev { left: 6px; }
    .carousel-next { right: 6px; }
}

.carousel.carousel--single .carousel-prev,
.carousel.carousel--single .carousel-next,
.carousel.carousel--single .carousel-dots {
    display: none;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    cursor: pointer;
}

.carousel-dot--active {
    background: var(--color-blue-dark);
}

.badge-primary {
    background: var(--color-blue-dark);
    color: white;
}

.badge-new {
    background: var(--color-warning);
    color: white;
}

.badge-confirmed {
    background: var(--color-success);
    color: white;
}

.counters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.counter-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    border-top: 4px solid var(--sidebar-accent, var(--color-blue-dark));
}

.counter-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--sidebar-accent, var(--color-blue-dark));
    margin-bottom: 0.5rem;
}

.counter-label {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.missions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 1.5rem;
}

.mission-card {
    position: relative;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--color-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.mission-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.mission-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.info-row svg {
    flex-shrink: 0;
}

.upcoming-missions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .missions-grid {
        grid-template-columns: 1fr;
    }

    .counter-value {
        font-size: 2.5rem;
    }
}

/* Formulaire profil (soignant + modérateur) — avant dupliqué à l'identique
   dans les 2 templates. Institution garde son propre .form-row/.form-group
   (mise en page auto-fit différente, pas un doublon de celui-ci). */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-group input {
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-white);
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-blue-dark);
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   FOOTER — RGPD / Mentions légales / Contact (toutes les pages)
   ============================================================ */
.site-footer {
    text-align: center;
    padding: 1.25rem 1rem 0.5rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.site-footer-links a {
    color: var(--color-blue-dark);
    text-decoration: none;
}

.site-footer-links a:hover {
    text-decoration: underline;
}

.site-footer-sep {
    color: var(--color-border);
}

.site-footer-copy {
    margin: 0;
}
