:root {
    --fond: #f4f6f8;
    --carte: #ffffff;
    --texte: #1c1f26;
    --texte-doux: #6b7280;
    --accent: #2563eb;
    --accent-doux: #dbeafe;
    --bordure: #e5e7eb;
    --vert: #16a34a;
    --rouge: #dc2626;
    --rayon: 12px;
}

* { box-sizing: border-box; }

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

/* ---------- Login ---------- */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: var(--carte);
    padding: 40px;
    border-radius: var(--rayon);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-box h1 { margin-bottom: 4px; }
.sous-titre { color: var(--texte-doux); margin-top: 0; margin-bottom: 24px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-box label { font-size: 13px; color: var(--texte-doux); margin-top: 6px; }
.login-box input {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--bordure);
    font-size: 15px;
}
.login-box button {
    margin-top: 16px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.login-box button:hover { background: #1d4ed8; }
.alerte-erreur { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }
.alerte-info { background: #dbeafe; color: #1e3a8a; padding: 10px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }

/* ---------- Layout général ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #111827;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}
.sidebar .logo { font-size: 18px; font-weight: 700; padding: 0 20px 20px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 20px;
    font-size: 14px;
}
.sidebar nav a:hover { background: #1f2937; color: #fff; }
.sidebar nav a.actif { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar-user { padding: 16px 20px; border-top: 1px solid #1f2937; font-size: 13px; }
.lien-deconnexion { color: #f87171; text-decoration: none; display: inline-block; margin-top: 6px; }

.contenu { flex: 1; padding: 28px 32px; max-width: 1400px; }
.contenu h1 { margin-top: 0; }

/* ---------- Cartes / stats ---------- */
.cartes-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.carte-stat {
    background: var(--carte);
    border-radius: var(--rayon);
    padding: 18px 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    min-width: 160px;
    flex: 1;
}
.carte-stat .valeur { font-size: 28px; font-weight: 700; }
.carte-stat .libelle { font-size: 13px; color: var(--texte-doux); margin-top: 4px; }

.bloc {
    background: var(--carte);
    border-radius: var(--rayon);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.bloc h2 { margin-top: 0; font-size: 17px; }

/* ---------- Grille du mur ---------- */
.table-mur-wrapper { overflow-x: auto; }
table.table-mur { border-collapse: collapse; width: 100%; font-size: 13px; }
table.table-mur th, table.table-mur td {
    border: 1px solid var(--bordure);
    text-align: center;
    padding: 0;
    height: 34px;
    min-width: 34px;
}
table.table-mur th { background: #f1f5f9; font-weight: 600; }
table.table-mur th.grade-th { text-align: left; padding-left: 8px; background: #e2e8f0; min-width: 55px; }
table.table-mur td.cellule-voie {
    cursor: pointer;
    transition: transform 0.1s;
}
table.table-mur td.cellule-voie:hover { outline: 2px solid var(--accent); position: relative; z-index: 2; }
.pastille {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 10px;
    font-weight: 700;
}
td.faite .pastille { box-shadow: inset 0 0 0 3px #16a34a; }
.legende { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--texte-doux); }
.legende span.puce { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:4px; vertical-align:middle; }

/* ---------- Modale ---------- */
.overlay-modale {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: none; align-items: center; justify-content: center; z-index: 50;
}
.overlay-modale.ouverte { display: flex; }
.modale {
    background: #fff; border-radius: var(--rayon); padding: 24px;
    width: 100%; max-width: 460px; max-height: 85vh; overflow-y: auto;
}
.modale h3 { margin-top: 0; }
.modale .fermer { float: right; cursor: pointer; font-size: 20px; color: var(--texte-doux); }
.modale label { display:block; font-size: 13px; color: var(--texte-doux); margin-top: 10px; }
.modale input, .modale select, .modale textarea {
    width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--bordure); font-size: 14px; margin-top: 4px;
}
.modale textarea { resize: vertical; min-height: 60px; }
.modale button.principal {
    margin-top: 16px; width: 100%; padding: 11px; border: none; border-radius: 8px;
    background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; font-size: 14px;
}
.historique-item { border-top: 1px solid var(--bordure); padding: 8px 0; font-size: 13px; }
.historique-item .date { font-weight: 600; }
.historique-item .ressenti { color: var(--texte-doux); }

/* ---------- Listes / tableaux simples ---------- */
table.tableau-simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tableau-simple th, table.tableau-simple td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bordure); }
table.tableau-simple th { color: var(--texte-doux); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.badge {
    display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 700;
}

.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.form-inline > div { display: flex; flex-direction: column; }
.form-inline label { font-size: 12px; color: var(--texte-doux); margin-bottom: 4px; }
.form-inline input, .form-inline select {
    padding: 8px 10px; border-radius: 8px; border: 1px solid var(--bordure); font-size: 14px;
}
.btn { padding: 9px 16px; border-radius: 8px; border: none; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn:hover { background: #1d4ed8; }
.btn-danger { background: var(--rouge); }
.btn-secondaire { background: #e5e7eb; color: var(--texte); }

.chip-jour {
    display: inline-block; padding: 6px 12px; border-radius: 20px; background: var(--accent-doux); color: var(--accent);
    font-size: 13px; font-weight: 600; margin-right: 6px; text-decoration: none;
}
