:root {
    --bleu: #0f3d5c;
    --bleu-clair: #1a6ea8;
    --bleu-tres-clair: #e8f2f9;
    --orange: #e8722c;
    --vert: #2e8b57;
    --rouge: #c0392b;
    --gris-fond: #f4f6f8;
    --gris-texte: #333;
    --gris-bordure: #dfe4e8;
    --blanc: #fff;
    --rayon: 10px;
    --ombre: 0 2px 8px rgba(15, 61, 92, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--gris-fond);
    color: var(--gris-texte);
}

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

/* ---- Barre latérale ---- */
.sidebar {
    width: 220px;
    background: var(--bleu);
    color: var(--blanc);
    padding: 24px 16px;
    flex-shrink: 0;
}

.sidebar h1 {
    font-size: 1.1rem;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar .sous-titre {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-bottom: 28px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--blanc);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: var(--rayon);
    margin-bottom: 4px;
    font-size: 0.92rem;
    opacity: 0.85;
}

.sidebar nav a:hover,
.sidebar nav a.actif {
    background: rgba(255,255,255,0.12);
    opacity: 1;
}

/* ---- Contenu principal ---- */
.contenu {
    flex: 1;
    padding: 28px 34px;
    max-width: 1100px;
}

.entete-page {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 10px;
}

.entete-page h2 { margin: 0; color: var(--bleu); font-size: 1.5rem; }
.entete-page p { margin: 4px 0 0; color: #667; font-size: 0.9rem; }

/* ---- Cartes ---- */
.carte {
    background: var(--blanc);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 20px 22px;
    margin-bottom: 20px;
    border: 1px solid var(--gris-bordure);
}

.grille-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    background: var(--blanc);
    border-radius: var(--rayon);
    border: 1px solid var(--gris-bordure);
    padding: 16px 18px;
    box-shadow: var(--ombre);
}

.stat .valeur { font-size: 1.8rem; font-weight: 700; color: var(--bleu); }
.stat .libelle { font-size: 0.82rem; color: #667; margin-top: 2px; }

/* ---- Formulaires ---- */
label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--bleu); }

input[type=text], input[type=tel], input[type=date], input[type=time],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--gris-bordure);
    border-radius: 7px;
    font-size: 0.92rem;
    margin-bottom: 14px;
    font-family: inherit;
}

textarea { resize: vertical; min-height: 80px; }

.champs-ligne { display: flex; gap: 14px; flex-wrap: wrap; }
.champs-ligne > div { flex: 1; min-width: 160px; }

button, .bouton {
    background: var(--bleu-clair);
    color: var(--blanc);
    border: none;
    padding: 10px 18px;
    border-radius: 7px;
    font-size: 0.92rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
}
button:hover, .bouton:hover { background: var(--bleu); }

.bouton-orange { background: var(--orange); }
.bouton-orange:hover { background: #c85e1e; }

/* ---- Tableaux / listes ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--gris-bordure); font-size: 0.88rem; }
th { color: var(--bleu); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}
.badge-normale { background: var(--bleu-tres-clair); color: var(--bleu-clair); }
.badge-urgente { background: #fdeee0; color: var(--orange); }
.badge-critique { background: #fbe5e2; color: var(--rouge); }
.badge-nouveau { background: #eaf5ee; color: var(--vert); }
.badge-traite { background: #eef1f3; color: #667; }
.badge-rdv_planifie { background: var(--bleu-tres-clair); color: var(--bleu-clair); }
.badge-propose { background: #f3e8fd; color: #8b3fd1; }

.reponse-ia {
    background: var(--bleu-tres-clair);
    border-left: 4px solid var(--bleu-clair);
    padding: 14px 16px;
    border-radius: 8px;
    white-space: pre-line;
    font-size: 0.92rem;
    line-height: 1.5;
}

.alerte-critique {
    background: #fbe5e2;
    border-left: 4px solid var(--rouge);
    padding: 14px 16px;
    border-radius: 8px;
    color: var(--rouge);
    font-weight: 600;
    margin-bottom: 14px;
}

.info-avertissement {
    background: #fff8e6;
    border-left: 4px solid #e0a800;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 18px;
}

/* ---- Agenda ---- */
.agenda-jour {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    align-items: flex-start;
}
.agenda-heure {
    width: 60px;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--bleu);
    padding-top: 10px;
}
.agenda-carte {
    flex: 1;
    background: var(--bleu-tres-clair);
    border-left: 4px solid var(--bleu-clair);
    border-radius: 8px;
    padding: 10px 14px;
}
.agenda-carte.termine { border-color: var(--vert); background: #eaf5ee; opacity: 0.75; }
.agenda-carte.annule { border-color: #aaa; background: #f0f0f0; opacity: 0.6; text-decoration: line-through; }
.agenda-carte.propose { border-color: #8b3fd1; background: #f3e8fd; }

.vide { color: #999; font-style: italic; padding: 12px 0; }

@media (max-width: 800px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .contenu { padding: 18px; }
}
