/* =========================================================
   Pano'froid — couleurs tirées du logo
   Nuit (ciel du logo) · Fourgon (bleu du camion) · Corail (lettrage) · Crème (nuages)
   ========================================================= */
:root {
    --nuit: #0F213E;
    --nuit-2: #1A3156;
    --nuit-3: #2A4470;
    --fourgon: #32A7C7;
    --fourgon-fonce: #1E7B98;
    --fourgon-pale: #DDF1F7;
    --corail: #F47B57;
    --corail-pale: #FDE4DA;
    --creme: #FBEBD6;
    --givre: #EDF3F7;
    --blanc: #FFFFFF;
    --encre: #13233F;
    --gris: #5B6A80;
    --bord: #D9E3EC;
    --rouge: #C2412D;
    --vert: #1E8A5A;

    --f-titre: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
    --f-texte: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;

    --r-panneau: 22px;
    --r-champ: 12px;
    --lat: 236px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--givre);
    color: var(--encre);
    font: 16px/1.5 var(--f-texte);
    -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-family: var(--f-titre); line-height: 1.1; letter-spacing: .01em; }
h1 { font-size: 2.2rem; font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
.sous { color: var(--gris); font-size: .95rem; }

:focus-visible { outline: 3px solid var(--fourgon); outline-offset: 2px; }

.ico {
    width: 22px; height: 22px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Boutons & champs ---------- */

.btn {
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    border: 1.5px solid var(--bord);
    background: var(--blanc);
    color: var(--encre);
    border-radius: 999px;
    padding: .6rem 1.15rem;
    font: 600 .95rem var(--f-texte);
    cursor: pointer;
    min-height: 44px;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { border-color: var(--nuit-3); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; }
.btn.primaire { background: var(--fourgon); border-color: var(--fourgon); color: var(--nuit); font-weight: 700; }
.btn.primaire:hover { background: #4BB6D3; }
.btn.nuit { background: var(--nuit); border-color: var(--nuit); color: var(--blanc); }
.btn.corail { background: var(--corail); border-color: var(--corail); color: var(--nuit); font-weight: 700; }
.btn.danger { color: var(--rouge); border-color: #F1C9C1; }
.btn.petit { padding: .3rem .8rem; min-height: 34px; font-size: .88rem; }
.btn.large { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

.btn-icone {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; border-radius: 50%;
    border: 1.5px solid var(--bord); background: var(--blanc); color: var(--encre);
    cursor: pointer;
}
.btn-icone .ico { width: 18px; height: 18px; }
.btn-icone:disabled { opacity: .35; cursor: default; }

label {
    display: flex; flex-direction: column; gap: .3rem;
    font-size: .88rem; font-weight: 600; color: var(--gris);
    margin-bottom: .9rem; flex: 1;
}
label.case { flex-direction: row; align-items: center; gap: .55rem; color: var(--encre); font-weight: 500; }
label.case input { width: 20px; height: 20px; min-height: 0; accent-color: var(--fourgon-fonce); }

input, select, textarea {
    font: 500 1rem var(--f-texte);
    color: var(--encre);
    padding: .6rem .8rem;
    border: 1.5px solid var(--bord);
    border-radius: var(--r-champ);
    background: var(--blanc);
    min-height: 46px;
    width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fourgon); box-shadow: 0 0 0 3px var(--fourgon-pale); }
input:disabled, select:disabled { background: var(--givre); }

.ligne { display: flex; gap: .75rem; }
.ligne > label { min-width: 0; }
.espace { flex: 1; }

/* ---------- Ciel étoilé (repris du logo) ---------- */

.ciel, .panneau.ciel {
    background-color: var(--nuit);
    background-image:
        radial-gradient(1.5px 1.5px at 12% 18%, rgba(251, 235, 214, .75) 50%, transparent 52%),
        radial-gradient(1px 1px at 72% 9%, rgba(251, 235, 214, .6) 50%, transparent 52%),
        radial-gradient(2px 2px at 86% 42%, rgba(251, 235, 214, .5) 50%, transparent 52%),
        radial-gradient(1px 1px at 33% 64%, rgba(251, 235, 214, .55) 50%, transparent 52%),
        radial-gradient(1.5px 1.5px at 58% 82%, rgba(251, 235, 214, .45) 50%, transparent 52%),
        radial-gradient(1px 1px at 8% 92%, rgba(251, 235, 214, .5) 50%, transparent 52%);
    background-size: 220px 260px;
}

/* ---------- Écran d'attente : le logo qui se balance dans la nuit ---------- */

.lobby {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 52%, #1A1520 0%, #0E0F14 55%, #0B0C10 100%);
    transition: opacity .6s ease .1s, visibility 0s linear .7s;
}
.lobby-halo {
    position: absolute; left: 50%; top: 50%; width: 340px; height: 340px; margin: -170px 0 0 -170px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 123, 87, .22) 0%, rgba(244, 123, 87, .06) 45%, transparent 70%);
    animation: lobby-halo 2.4s ease-in-out infinite;
}
.lobby-logo {
    position: relative;
    width: 104px; height: 104px; padding: 6px;
    border-radius: 30px;
    background: #0B0C10;
    border: 3px solid #E9C9A0;
    box-shadow: 0 0 0 1px rgba(233, 201, 160, .25), 0 18px 40px rgba(0, 0, 0, .55), 0 0 60px rgba(244, 123, 87, .25);
    animation: lobby-balance 2.4s ease-in-out infinite;
    transition: transform .6s cubic-bezier(.5, -.4, .6, 1.2), opacity .45s ease .1s;
}
.lobby-logo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
.lobby-points { position: absolute; left: 0; right: 0; top: calc(50% + 92px); display: flex; justify-content: center; gap: 8px; }
.lobby-points i {
    width: 7px; height: 7px; border-radius: 50%; background: #E9C9A0; opacity: .25;
    animation: lobby-point 1.2s ease-in-out infinite;
}
.lobby-points i:nth-child(2) { animation-delay: .2s; }
.lobby-points i:nth-child(3) { animation-delay: .4s; }

/* Sortie : le logo s'envole et la nuit s'efface sur la page */
.lobby.sortie { opacity: 0; visibility: hidden; pointer-events: none; }
.lobby.sortie .lobby-logo { animation: none; transform: translateY(-30px) scale(1.25) rotate(4deg); opacity: 0; }
.lobby.sortie .lobby-points { opacity: 0; transition: opacity .2s; }

@keyframes lobby-balance {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}
@keyframes lobby-halo {
    0%, 100% { transform: scale(.9); opacity: .7; }
    50% { transform: scale(1.08); opacity: 1; }
}
@keyframes lobby-point {
    0%, 100% { opacity: .25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    .lobby-logo, .lobby-halo, .lobby-points i { animation: none; }
    .lobby-logo { transform: rotate(-4deg); }
}

/* ---------- Connexion : lettres ballon 3D qui rebondissent ---------- */

/* Pas d'effet « élastique » quand on tire la page trop haut ou trop bas (iPhone) :
   sinon on voyait une autre couleur de fond apparaître au-dessus et en dessous */
html { overscroll-behavior: none; }
html.sur-login, html.sur-login body { background: #FCE6D8; }
html.sur-login body::before { display: none; }

.login {
    position: fixed; left: 0; right: 0; z-index: 30;
    top: var(--visible-haut, 0px);
    height: var(--visible-hauteur, 100%);
    overflow-y: auto; overscroll-behavior: none; -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column;
    padding: 0 16px max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(170deg, #FBEBD6 0%, #FCE3D6 35%, #E1F1F8 100%);
}
.login-scene { position: relative; flex: 1 1 auto; min-height: 260px; margin: 0 -16px; }
#login-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; touch-action: manipulation; }

/* Titre de secours (affiché tant que la 3D n'est pas prête, ou si elle n'est pas possible) */
.login-titre {
    position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
    margin: 0; padding: 0 1rem; text-align: center;
    font: 800 clamp(3.4rem, 18vw, 6rem)/.9 var(--f-titre); letter-spacing: .02em;
    color: var(--corail);
    text-shadow: 0 2px 0 #E2643F, 0 5px 0 #C9583A, 0 14px 22px rgba(201, 88, 58, .3);
    transition: opacity .5s ease;
    pointer-events: none;
}
.login-astuce {
    position: absolute; left: 0; right: 0; top: max(18px, env(safe-area-inset-top));
    margin: 0; text-align: center;
    font-size: .82rem; font-weight: 600; color: #8A6A5C;
    opacity: 0; transition: opacity .5s ease .8s; pointer-events: none;
}
.login-titre { opacity: 0; }
.login.sans-3d .login-titre { opacity: 1; }
.login.scene-prete .login-titre { opacity: 0; }
.login.scene-prete .login-astuce { opacity: 1; }

.login-carte {
    position: relative; z-index: 2;
    width: 100%; max-width: 440px; margin: 0 auto;
    display: flex; flex-direction: column; gap: 13px;
    padding: 26px 22px 22px;
    border-radius: 36px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .97) 0%, rgba(250, 246, 242, .97) 100%);
    box-shadow: 0 -8px 40px rgba(15, 33, 62, .08), 0 26px 50px rgba(15, 33, 62, .12), inset 0 6px 0 rgba(255, 255, 255, .9);
}
.login-tete { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.login-tete h1 { font-size: 2.15rem; line-height: 1.05; }
.login-tete .sous { color: #56627A; }
.login-champ {
    flex: 0 0 auto; flex-direction: row; align-items: center; gap: 12px;
    height: 54px; margin: 0; padding: 0 8px 0 18px;
    border-radius: 999px; background: #F3F1F0;
    box-shadow: inset 0 2px 6px rgba(15, 33, 62, .07), 0 1px 0 #FFFFFF;
    transition: box-shadow .2s;
}
.login-champ:first-of-type { margin-top: 4px; }
.login-champ:focus-within { box-shadow: 0 0 0 2px var(--fourgon), inset 0 2px 6px rgba(15, 33, 62, .06); }
.login-champ > svg { width: 20px; height: 20px; fill: #5A6680; flex-shrink: 0; }
.login-champ input {
    flex: 1; min-width: 0; min-height: 0; height: 100%;
    border: 0; background: transparent; padding: 0; box-shadow: none !important;
    font: 500 1rem var(--f-texte); color: var(--encre);
}
.login-champ input::placeholder { color: #8C92A8; }
.login-champ input:focus { outline: none; }
.login-oeil {
    width: 44px; height: 44px; flex-shrink: 0;
    display: grid; place-items: center;
    border: 0; border-radius: 999px; background: transparent; color: #5A6680; cursor: pointer;
}
.login-oeil svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-oeil:hover, .login-oeil[aria-pressed="true"] { color: var(--nuit); }
.login-aide { margin: -2px 6px 0; text-align: right; font-size: .82rem; font-weight: 600; color: #2B7F99; }
.login-btn {
    margin-top: 4px; height: 56px; border: 0; border-radius: 999px; cursor: pointer;
    background: linear-gradient(90deg, #F47B57 0%, #F6A07E 45%, #5DBAD6 100%);
    color: #FFFFFF; font: 700 1.12rem var(--f-texte);
    text-shadow: 0 1px 2px rgba(15, 33, 62, .25);
    box-shadow: 0 12px 24px rgba(244, 123, 87, .3), inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -4px 8px rgba(15, 33, 62, .1);
    transition: filter .2s, transform .1s;
}
.login-btn:hover { filter: brightness(1.06); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { filter: grayscale(.4); opacity: .7; cursor: default; }
.lecteur { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Petits écrans en hauteur (clavier ouvert, iPhone SE) : scène plus basse */
@media (max-height: 640px) { .login-scene { min-height: 190px; } }

/* Ordinateur : la scène occupe tout l'écran, la carte se place à droite */
@media (min-width: 900px) {
    .login { flex-direction: row; align-items: center; justify-content: flex-end; padding: 32px 6vw; }
    .login-scene { position: absolute; inset: 0; margin: 0; }
    .login-titre { right: calc(440px + 6vw); font-size: clamp(5rem, 10vw, 9rem); }
    .login-astuce { right: calc(440px + 6vw); top: auto; bottom: 12vh; }
    .login-carte { margin: 0; padding: 34px 30px 30px; }
}

/* ---------- Structure ---------- */

.app { min-height: 100vh; }

.lat {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
}
.lat .lat-logo, .lat .lat-deco { display: none; }

.nav { display: flex; flex: 1; }
.nav-btn {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    border: 0; background: none;
    padding: .6rem .2rem .55rem;
    color: rgba(251, 235, 214, .62);
    font: 600 .7rem var(--f-texte);
    cursor: pointer;
    position: relative;
}
.nav-btn.actif { color: var(--blanc); }
.nav-btn.actif .ico { color: var(--corail); }

.principal { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

.haut {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem 1rem;
    padding-top: max(.55rem, env(safe-area-inset-top));
    background: var(--nuit);
    color: var(--blanc);
}
.haut-logo { height: 40px; width: auto; }
.puce-user { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: .92rem; }
.avatar {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--corail); color: var(--nuit);
    font: 800 .95rem var(--f-titre); letter-spacing: .03em;
}
.puce-user #nom-utilisateur { display: none; }

.contenu { max-width: 1180px; margin: 0 auto; padding: 1.1rem 1rem 1.5rem; }

@media (min-width: 900px) {
    .lat {
        top: 0; right: auto; width: var(--lat);
        flex-direction: column;
        padding: 1.2rem .9rem 1rem;
    }
    .lat .lat-logo { display: block; padding: 0 .4rem 1.4rem; }
    .lat-logo img { width: 100%; height: auto; }
    .nav { flex-direction: column; gap: .25rem; flex: 1; }
    .nav-btn, .lat-deco {
        flex: 0 0 auto;
        flex-direction: row; gap: .8rem;
        padding: .75rem .95rem;
        border-radius: 14px;
        font-size: .98rem; text-align: left;
    }
    .lat .lat-deco { display: flex; border: 0; background: none; color: rgba(251, 235, 214, .62); cursor: pointer; }
    .nav-btn:hover, .lat-deco:hover { color: var(--blanc); background: rgba(255, 255, 255, .05); }
    .nav-btn.actif { background: var(--nuit-2); }
    .nav-btn.actif::before {
        content: ""; position: absolute; left: -.9rem; top: 22%; bottom: 22%;
        width: 4px; border-radius: 0 4px 4px 0; background: var(--corail);
    }

    .principal { margin-left: var(--lat); padding-bottom: 0; }
    .haut { background: transparent; color: var(--encre); padding: 1.1rem 2rem 0; position: static; }
    .haut-logo { display: none; }
    .puce-user {
        background: var(--blanc); border: 1.5px solid var(--bord);
        padding: .3rem .9rem .3rem .3rem; border-radius: 999px;
    }
    .puce-user #nom-utilisateur { display: inline; }
    .contenu { padding: 1rem 2rem 2.5rem; }
}

/* ---------- En-tête de page ---------- */

.page-tete {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: .75rem 1rem; margin-bottom: 1.25rem;
}
.page-tete .sous { margin-top: .2rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.mois-nav {
    display: inline-flex; align-items: center; gap: .5rem;
    background: var(--blanc); border: 1.5px solid var(--bord);
    border-radius: 999px; padding: .25rem;
}
.mois-nav .btn-icone { border: 0; width: 34px; height: 34px; }
.mois-nav span { font: 700 1.05rem var(--f-titre); min-width: 8.5em; text-align: center; text-transform: capitalize; }

/* ---------- Panneaux ---------- */

.panneau {
    background: var(--blanc);
    border-radius: var(--r-panneau);
    padding: 1.25rem;
    margin-bottom: 1rem;
    min-width: 0;
}
.panneau-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.panneau-tete .sous { font-size: .88rem; }
.lien {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--fourgon-fonce); font: 700 .9rem var(--f-texte);
}
.lien:hover { text-decoration: underline; }

/* ---------- Tableau de bord ---------- */

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi {
    border-radius: 18px; padding: 1rem 1.1rem 1.05rem;
    display: flex; flex-direction: column; gap: .15rem; min-width: 0;
}
.kpi-lib { font-weight: 600; font-size: .9rem; color: var(--nuit-3); }
.kpi strong { font: 800 2.3rem/1.05 var(--f-titre); letter-spacing: .01em; }
.kpi-pied { font-size: .85rem; color: var(--gris); }
.kpi-fourgon { background: var(--fourgon-pale); }
.kpi-corail { background: var(--corail-pale); }
.kpi-creme { background: var(--creme); }
.kpi-blanc { background: var(--blanc); }
.kpi-pied.alerte { color: #A2452A; font-weight: 600; }

.grille-tb { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grille-tb > .panneau { margin-bottom: 0; }

@media (min-width: 700px) {
    .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
    .grille-tb { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
    .grille-tb.egale { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

/* Graphique en barres : heures par jour */
.graph { position: relative; height: 220px; display: flex; gap: 0; padding-left: 34px; }
.graph-grille { position: absolute; inset: 0 0 22px 0; pointer-events: none; }
.graph-grille div {
    position: absolute; left: 0; right: 0; border-top: 1px dashed #E1E8EF;
}
.graph-grille span {
    position: absolute; left: 0; top: -.6rem;
    font-size: .72rem; color: var(--gris); font-variant-numeric: tabular-nums;
}
.graph-col {
    flex: 1; min-width: 0; position: relative;
    display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
    padding: 0 1px 22px; cursor: default;
}
.graph-barre {
    width: min(70%, 18px); min-height: 0;
    background: var(--fourgon);
    border-radius: 4px 4px 0 0;
}
.graph-col.aujourdhui .graph-barre { background: var(--corail); }
.graph-col.weekend::before {
    content: ""; position: absolute; inset: 0 0 22px; background: rgba(15, 33, 62, .035);
}
.graph-col:hover .graph-barre { background: var(--fourgon-fonce); }
.graph-col.aujourdhui:hover .graph-barre { background: #E2643F; }
.graph-x {
    position: absolute; bottom: 0; font-size: .72rem; color: var(--gris);
    font-variant-numeric: tabular-nums;
}
.graph-bulle {
    position: absolute; bottom: calc(100% - 22px); left: 50%; transform: translate(-50%, -6px);
    background: var(--nuit); color: var(--blanc);
    padding: .3rem .6rem; border-radius: 10px;
    font-size: .8rem; font-weight: 600; white-space: nowrap;
    opacity: 0; pointer-events: none; z-index: 2;
}
.graph-col:hover .graph-bulle, .graph-col:focus-visible .graph-bulle { opacity: 1; }
.graph-col:first-child .graph-bulle { left: 0; transform: translate(0, -6px); }
.graph-col:last-child .graph-bulle { left: auto; right: 0; transform: translate(0, -6px); }

/* Panneau nuit : fiches de paie manquantes */
.panneau-nuit { color: var(--creme); display: flex; flex-direction: column; gap: .9rem; }
.panneau-nuit h2 { color: var(--blanc); }
.panneau-nuit .sous { color: rgba(251, 235, 214, .72); }
.panneau-nuit .grand {
    font: 800 3.2rem/1 var(--f-titre); color: var(--corail);
}
.puces { display: flex; flex-wrap: wrap; gap: .4rem; }
.puces span {
    background: var(--nuit-2); color: var(--creme);
    border-radius: 999px; padding: .25rem .7rem; font-size: .85rem; font-weight: 600;
}
.panneau-nuit .btn { align-self: flex-start; margin-top: auto; }

/* Barres horizontales : chantiers / employés */
.barres { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; }
.barres li { min-width: 0; }
.barres-tete { display: flex; justify-content: space-between; gap: .75rem; font-size: .92rem; margin-bottom: .3rem; }
.barres-tete span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.barres-tete strong { font-variant-numeric: tabular-nums; }
.barres-piste { height: 8px; background: var(--givre); border-radius: 999px; }
.barres-val { height: 100%; background: var(--fourgon); border-radius: 999px; min-width: 6px; }
.barres.nuit .barres-val { background: var(--nuit-3); }
.separateur { border: 0; border-top: 1px solid var(--bord); margin: 1.25rem 0; }

/* ---------- Semaine (employé) ---------- */

.semaine-nav {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    margin-bottom: .9rem;
}
.semaine-nav .titre { text-align: center; }
.semaine-nav .titre strong { display: block; font: 700 1.3rem var(--f-titre); }
.semaine-nav .titre span { color: var(--gris); font-size: .88rem; }

.total-semaine {
    border-radius: var(--r-panneau);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    color: var(--creme);
}
.total-semaine .lib { font-weight: 600; }
.total-semaine .lib small { display: block; color: rgba(251, 235, 214, .7); font-weight: 500; font-size: .85rem; }
.total-semaine strong { font: 800 2.8rem/1 var(--f-titre); color: var(--corail); }

.jour { background: var(--blanc); border-radius: 18px; padding: .8rem 1rem; margin-bottom: .6rem; border: 1.5px solid transparent; }
.jour.aujourdhui { border-color: var(--fourgon); }
.jour-entete { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.jour-entete h3 { font-size: 1.12rem; }
.jour-entete .droite { display: flex; align-items: center; gap: .6rem; }
.jour-entete .total { font: 700 1.1rem var(--f-titre); }
.jour.vide { background: transparent; border: 1.5px dashed var(--bord); }
.jour.vide .jour-entete h3 { color: var(--gris); font-weight: 600; }

.saisie {
    display: flex; justify-content: space-between; align-items: center; gap: .75rem;
    width: 100%;
    margin-top: .6rem; padding: .65rem .8rem;
    background: var(--givre); border: 0; border-left: 4px solid var(--fourgon); border-radius: 12px;
    font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.saisie:hover { background: var(--fourgon-pale); }
.saisie .chantier { font-weight: 700; }
.saisie .details { display: block; color: var(--gris); font-size: .88rem; }
.saisie .duree { font: 700 1.15rem var(--f-titre); white-space: nowrap; }
.saisie.verrou { border-left-color: var(--corail); }

.badge {
    display: inline-block; font-size: .72rem; font-weight: 700;
    padding: .1rem .5rem; border-radius: 999px;
    background: var(--corail-pale); color: #A2452A; margin-left: .35rem; vertical-align: middle;
}
.badge.ok { background: var(--fourgon-pale); color: var(--fourgon-fonce); }
.badge.off { background: var(--givre); color: var(--gris); }

/* ---------- Tableaux ---------- */

.barre-filtres { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.barre-filtres > label { margin-bottom: 0; min-width: 150px; flex: 0 1 200px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.25rem; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .7rem .6rem; text-align: left; border-bottom: 1px solid var(--givre); white-space: nowrap; }
th { color: var(--gris); font-weight: 600; font-size: .82rem; }
tbody tr.cliquable { cursor: pointer; }
tbody tr.cliquable:hover { background: var(--givre); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-bottom: 0; padding-top: .9rem; }
.td-nom { display: flex; align-items: center; gap: .55rem; font-weight: 600; }
.mini-avatar {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--nuit); color: var(--creme);
    font: 700 .75rem var(--f-titre);
}

.resume { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.resume .pastille {
    background: var(--blanc); border-radius: 999px;
    padding: .35rem .9rem; font-size: .9rem;
}
.resume .pastille strong { font-family: var(--f-titre); font-size: 1.05rem; }

/* ---------- Listes ---------- */

.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .8rem 0; border-bottom: 1px solid var(--givre);
}
.liste li:last-child { border-bottom: 0; }
.liste .gauche { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.liste .principal-txt { font-weight: 700; }
.liste .secondaire { color: var(--gris); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.liste .boutons { display: flex; gap: .4rem; flex-shrink: 0; }
.doc-ico {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--corail-pale); color: #A2452A;
}
.doc-ico .ico { width: 20px; height: 20px; }

.vide-msg { color: var(--gris); text-align: center; padding: 1.75rem 0; }

/* ---------- Dialogues ---------- */

dialog {
    border: 0; border-radius: var(--r-panneau); padding: 0;
    width: min(480px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    color: var(--encre);
    box-shadow: 0 24px 60px rgba(15, 33, 62, .35);
}
dialog::backdrop { background: rgba(15, 33, 62, .55); }
dialog form { padding: 1.4rem; }
dialog h2 { margin-bottom: 1rem; }
.actions { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.info { color: #A2452A; font-size: .9rem; margin: 0 0 .5rem; }
.info:empty, .duree-calc:empty { display: none; }
.duree-calc { margin: 0 0 .75rem; font: 700 1.15rem var(--f-titre); color: var(--fourgon-fonce); }

/* ---------- Toast ---------- */

.toast {
    position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(16px);
    background: var(--nuit); color: var(--blanc);
    padding: .75rem 1.2rem; border-radius: 14px;
    font-weight: 600; max-width: calc(100vw - 32px);
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.erreur { background: var(--rouge); }
@media (min-width: 900px) { .toast { bottom: 2rem; left: calc(50% + var(--lat) / 2); } }

@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; }
}

/* ---------- Tableau de bord par employé ---------- */

.choix-employe { width: auto; min-width: 210px; border-radius: 999px; min-height: 44px; font-weight: 600; }
.retour { display: inline-flex; align-items: center; gap: .2rem; margin-bottom: .6rem; }
.retour .ico { width: 18px; height: 18px; }
.profil { display: flex; align-items: center; gap: .9rem; }
.grand-avatar { width: 58px; height: 58px; font-size: 1.4rem; }
.kpi strong.statut-ok { color: var(--vert); font-size: 2rem; }
.kpi strong.statut-attente { color: #A2452A; font-size: 2rem; }

.barres-lien {
    display: block; width: 100%; text-align: left;
    background: none; border: 0; padding: .25rem; margin: -.25rem; border-radius: 10px;
    font: inherit; color: inherit; cursor: pointer;
}
.barres-lien:hover { background: var(--givre); }
.barres-lien:hover .barres-tete span { text-decoration: underline; }

.puces button {
    background: var(--nuit-2); color: var(--creme); border: 0; cursor: pointer;
    border-radius: 999px; padding: .25rem .7rem; font: 600 .85rem var(--f-texte);
}
.puces button:hover { background: var(--nuit-3); }

button.pastille { border: 0; font: inherit; font-size: .9rem; color: inherit; cursor: pointer; }
button.pastille:hover { background: var(--fourgon-pale); }

td.retour-ligne { white-space: normal; min-width: 160px; }

@media (max-width: 699px) {
    .kpi strong.statut-ok, .kpi strong.statut-attente { font-size: 1.5rem; }
    .choix-employe { width: 100%; }
}

/* ---------- Saisie employé ---------- */

.formulaire-saisie { max-width: 560px; }
.confirmation {
    max-width: 560px;
    display: flex; flex-direction: column; gap: .2rem;
    border-radius: var(--r-panneau); padding: 1rem 1.25rem; margin-bottom: 1rem;
    color: var(--creme);
}
.confirmation strong { font: 700 1.35rem var(--f-titre); color: var(--fourgon); }

/* ---------- Tickets (employé) ---------- */

.prise-photo { max-width: 560px; display: grid; gap: .75rem; }
.prise-photo label.btn { margin: 0; flex-direction: row; color: inherit; font-size: 1rem; }
.prise-photo label.btn.primaire { color: var(--nuit); }
.gros-bouton { min-height: 64px; font-size: 1.1rem !important; }
.gros-bouton .ico { width: 26px; height: 26px; }
.astuce { text-align: center; font-size: .88rem; }
.apercu-ticket { max-width: 560px; }
.apercu-ticket img { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: var(--givre); border-radius: 14px; margin-bottom: .75rem; }

/* ---------- Notes de frais (admin) ---------- */

.segments { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.segments button {
    border: 1.5px solid var(--bord); background: var(--blanc); color: var(--encre);
    border-radius: 999px; padding: .4rem .9rem; font: 600 .9rem var(--f-texte); cursor: pointer;
}
.segments button span { color: var(--gris); font-weight: 700; margin-left: .2rem; }
.segments button.actif { background: var(--nuit); border-color: var(--nuit); color: var(--blanc); }
.segments button.actif span { color: var(--corail); }

.liste-tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.carte-ticket {
    display: flex; gap: .85rem; width: 100%; text-align: left;
    background: var(--givre); border: 1.5px solid transparent; border-radius: 16px;
    padding: .6rem; font: inherit; color: inherit; cursor: pointer;
}
.carte-ticket:hover { border-color: var(--fourgon); }
.carte-ticket img { width: 64px; height: 80px; object-fit: cover; border-radius: 10px; background: var(--bord); flex-shrink: 0; }
.ct-corps { display: flex; flex-direction: column; gap: .2rem; min-width: 0; flex: 1; }
.ct-haut { display: flex; justify-content: space-between; gap: .5rem; }
.ct-haut strong:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-montant { font: 700 1.2rem var(--f-titre); white-space: nowrap; }
.ct-bas { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.ct-bas .badge { margin-left: 0; }
.ct-alerte { display: inline-flex; align-items: center; gap: .25rem; color: #A2452A; font-size: .82rem; }
.ct-alerte .ico { width: 15px; height: 15px; }

.panneau-nuit label.clair { color: rgba(251, 235, 214, .8); }
.panneau-nuit label.case.clair { color: var(--creme); }

/* Dialogue de vérification */
dialog.dlg-large { width: min(980px, calc(100vw - 24px)); }
.ticket-grille { display: grid; gap: 1.25rem; }
.ticket-photo { display: block; background: var(--nuit); border-radius: 16px; overflow: hidden; }
.ticket-photo img { display: block; width: 100%; max-height: 42vh; object-fit: contain; }
@media (min-width: 800px) {
    .ticket-grille { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
    .ticket-photo img { max-height: 72vh; height: 100%; }
}
.tva-bloc { margin-bottom: .9rem; }
.tva-tete { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; font-weight: 600; color: var(--gris); margin-bottom: .35rem; }
.tva-ligne { display: grid; grid-template-columns: 110px minmax(0, 1fr) 38px; gap: .5rem; align-items: center; margin-bottom: .45rem; }
.ht-calc {
    display: flex; justify-content: space-between; align-items: baseline;
    background: var(--givre); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .5rem;
    font-weight: 600; color: var(--gris);
}
.ht-calc strong { font: 700 1.3rem var(--f-titre); color: var(--encre); }
.ht-calc strong.negatif { color: var(--rouge); }

/* =========================================================
   Planning, chantiers, compteurs
   ========================================================= */

.deux-colonnes { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .deux-colonnes { grid-template-columns: minmax(0, 560px) minmax(0, 1fr); align-items: start; } }
.kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.indice { margin: -.5rem 0 .8rem; font-size: .85rem; color: var(--fourgon-fonce); }
.indice:empty { display: none; }
.choix-chantier-ticket { margin-bottom: .25rem; }



/* Toast avec bouton */
.toast.avec-action { display: flex; align-items: center; gap: .9rem; pointer-events: auto; }
.toast-action {
    background: var(--corail); color: var(--nuit); border: 0; border-radius: 999px;
    padding: .35rem .8rem; font: 700 .85rem var(--f-texte); cursor: pointer;
}

.segments.compact { margin: 0; }
.segments.compact button { padding: .35rem .8rem; }

/* --- Planning admin --- */
.pl-palette { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .8rem 1rem; }
.pl-jetons { display: flex; flex-wrap: wrap; gap: .45rem; }
.pl-jeton {
    display: inline-flex; align-items: center; gap: .4rem;
    background: color-mix(in srgb, var(--c, var(--fourgon)) 22%, white);
    border: 1.5px solid var(--c, var(--fourgon));
    border-radius: 999px; padding: .3rem .8rem; font-weight: 600; font-size: .88rem;
    cursor: grab; user-select: none;
}
.pl-jeton.employe { background: var(--givre); border-color: var(--bord); padding: .2rem .8rem .2rem .2rem; }
.pl-jeton:active { cursor: grabbing; }

.pl-cadre { padding: 0; overflow: hidden; }
.pl-grille {
    display: grid;
    grid-template-columns: 210px repeat(var(--jours), minmax(58px, 1fr));
    overflow-x: auto;
    min-width: 0;
}
.pl-coin, .pl-jour {
    position: sticky; top: 0; z-index: 2; background: var(--blanc);
    border-bottom: 1px solid var(--bord); padding: .7rem .4rem .6rem;
}
.pl-coin { left: 0; z-index: 3; font: 700 1.05rem var(--f-titre); padding-left: 1rem; display: flex; flex-direction: column; }
.pl-coin span { font: 500 .8rem var(--f-texte); color: var(--gris); text-transform: capitalize; }
.pl-jour { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.pl-jour span { font-size: .72rem; color: var(--gris); font-weight: 600; }
.pl-jour strong { font: 700 1.05rem var(--f-titre); }
.pl-jour.we { background: #F7FAFC; }
.pl-jour.auj strong { background: var(--nuit); color: var(--blanc); border-radius: 8px; padding: 0 .4rem; }
.pl-jour em {
    font-style: normal; font-size: .66rem; font-weight: 700; color: var(--corail);
}
.pl-tete-ligne {
    position: sticky; left: 0; z-index: 1; background: var(--blanc);
    border-bottom: 1px solid var(--givre); border-left: 4px solid var(--c, transparent);
    padding: .55rem .8rem; min-height: 58px;
    display: flex; flex-direction: column; justify-content: center; gap: .1rem; min-width: 0;
}
.pl-tete-ligne strong { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-tete-ligne span { font-size: .76rem; color: var(--gris); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-tete-ligne.employe { flex-direction: row; align-items: center; justify-content: flex-start; gap: .55rem; border-left: 0; }
.pl-tete-ligne .badge { margin-left: 0; align-self: flex-start; }

.pl-case {
    position: relative; min-height: 58px;
    border-bottom: 1px solid var(--givre); border-left: 1px dashed #E8EEF3;
    display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
    padding: 9px 0; cursor: pointer;
}
.pl-case.we { background: #F9FBFC; }
.pl-case.auj { background: color-mix(in srgb, var(--corail) 7%, white); }
.pl-case.auj::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--corail); opacity: .35; pointer-events: none; }
.pl-case.survol { outline: 2px dashed var(--fourgon); outline-offset: -3px; background: var(--fourgon-pale); }
/* Barre continue sur les jours qui se suivent (comme la frise de référence) */
.pl-case.plein::before {
    content: ""; position: absolute; left: 0; right: 0; top: 9px; bottom: 9px;
    background: var(--c); z-index: 0;
}
.pl-case.plein.debut::before { left: 5px; border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.pl-case.plein.fin::before { right: 5px; border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.pl-case.plein.debut { padding-left: 9px; }

.pl-avatar {
    position: relative; z-index: 1;
    display: inline-grid; place-items: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--blanc); color: var(--nuit);
    border: 2px solid var(--c);
    font: 800 .72rem var(--f-titre); cursor: grab; margin-left: 2px;
}
.pl-bloc {
    position: relative; z-index: 1; flex: 1; align-self: stretch;
    display: flex; align-items: center; padding: 0 .55rem;
    font: 700 .85rem var(--f-texte); color: var(--nuit);
    white-space: nowrap; overflow: visible; cursor: grab;
}
.pl-retirer {
    position: absolute; top: -6px; right: -6px; z-index: 2;
    width: 18px; height: 18px; border-radius: 50%; border: 0;
    background: var(--nuit); color: var(--blanc); font-size: .75rem; line-height: 1;
    display: none; cursor: pointer;
}
.pl-bloc .pl-retirer { top: 50%; right: 4px; transform: translateY(-50%); }
.pl-avatar:hover .pl-retirer, .pl-bloc:hover .pl-retirer { display: block; }
@media (hover: none) { .pl-retirer { display: block; } }

/* --- Planning employé --- */
.liste-planning { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; max-width: 640px; }
.jour-planning { display: flex; gap: .8rem; align-items: stretch; }
.jp-date {
    width: 54px; flex-shrink: 0; border-radius: 14px; background: var(--blanc);
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .4rem 0;
}
.jp-date strong { font-size: .75rem; color: var(--gris); text-transform: uppercase; }
.jp-date span { font: 800 1.4rem var(--f-titre); }
.jour-planning.aujourdhui .jp-date { background: var(--nuit); color: var(--blanc); }
.jour-planning.aujourdhui .jp-date strong { color: var(--corail); }
.jp-chantier {
    flex: 1; border-radius: 14px; padding: .7rem .9rem;
    background: color-mix(in srgb, var(--c) 22%, white); border-left: 5px solid var(--c);
    display: flex; flex-direction: column; gap: .1rem; min-width: 0;
}
.jp-chantier span { font-size: .86rem; color: var(--nuit-3); }
.jp-avec { font-weight: 600; }
.jp-note { font-style: italic; }
.jp-vide { flex: 1; border: 1.5px dashed var(--bord); border-radius: 14px; display: flex; align-items: center; padding: 0 .9rem; color: var(--gris); }

/* --- Chantiers --- */
.grille-chantiers { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.carte-chantier {
    display: flex; flex-direction: column; gap: .45rem; text-align: left;
    background: var(--blanc); border: 1.5px solid transparent; border-top: 5px solid var(--c);
    border-radius: var(--r-panneau); padding: 1rem 1.1rem; font: inherit; color: inherit; cursor: pointer;
}
.carte-chantier:hover { border-color: var(--c); }
.cc-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.cc-tete strong { font: 700 1.2rem var(--f-titre); }
.cc-tete .badge { margin-left: 0; flex-shrink: 0; }
.cc-chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; background: var(--givre); border-radius: 12px; padding: .6rem .7rem; }
.cc-chiffres span { display: flex; flex-direction: column; font: 700 1rem var(--f-titre); }
.cc-chiffres small { font: 600 .72rem var(--f-texte); color: var(--gris); }
.cc-chiffres .positif { color: var(--vert); }
.cc-chiffres .negatif { color: var(--rouge); }

.kpi-positif { background: #DFF3E8; }
.kpi-positif strong { color: var(--vert); }
.kpi-negatif { background: #FBE1DC; }
.kpi-negatif strong { color: var(--rouge); }
.barres-val.corail { background: var(--corail); }

.depot-fichier { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; margin-bottom: .75rem; }
.depot-fichier > label.btn { margin: 0; flex-direction: row; color: var(--encre); font-size: .95rem; }
.depot-fichier .montant { margin: 0; flex: 0 1 160px; }
.montant-fichier { width: 110px; min-height: 34px; padding: .3rem .5rem; font-size: .9rem; }
.liste li.cliquable { cursor: pointer; }
.liste li.cliquable:hover { background: var(--givre); }

.pastille-chantier {
    display: inline-block; font-size: .78rem; font-weight: 700; color: var(--nuit);
    background: color-mix(in srgb, var(--c) 25%, white); border-radius: 999px; padding: 0 .5rem;
}

.compteur-form { margin: 1rem 0 .4rem; }
.compteur-form .libelle { flex: 1 1 240px; }

.pl-case.plein:not(.debut)::before { left: -1px; }
.pl-titre {
    position: absolute; left: .55rem; top: 50%; transform: translateY(-50%);
    width: calc(var(--n, 1) * 100% - 1.8rem);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
}

/* =========================================================
   Calendrier continu (planning admin)
   ========================================================= */

.cal-palette { flex-direction: column; align-items: stretch; gap: .5rem; }
.cal-palette-ligne { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.cal-palette-ligne > .sous { width: 70px; flex-shrink: 0; }

.cal-cadre { padding: .5rem 0 1rem; }
.cal-plus { display: flex; margin: .4rem auto .8rem; }
.cal-cadre > .btn.cal-plus { width: calc(100% - 2rem); margin: 1rem; }

.cal-entete {
    position: sticky; top: 0; z-index: 4;
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--blanc); border-bottom: 1px solid var(--bord);
    padding: .5rem 0;
}
@media (max-width: 899px) { .cal-entete { top: 72px; } }
.cal-entete span { text-align: center; font-weight: 700; font-size: .8rem; color: var(--gris); text-transform: uppercase; letter-spacing: .03em; }
.cal-entete span.we { color: #9AA7B6; }

.cal-mois { padding: 1.4rem 1rem .5rem; border-top: 3px solid var(--nuit); }
.cal-mois:first-of-type { border-top: 0; }
.cal-mois h2 { text-transform: capitalize; font-size: 1.6rem; }
.cal-mois h2 span { color: var(--gris); font-weight: 600; }

.cal-semaine {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: 30px repeat(var(--lignes), 34px) minmax(22px, 1fr);
    min-height: 104px;
    border-top: 1px solid var(--givre);
}
.cal-jour {
    border-left: 1px solid var(--givre); cursor: pointer; position: relative;
}
.cal-jour:first-child { border-left: 0; }
.cal-jour.we { background: #F8FAFC; }
.cal-jour.impair:not(.we) { background: #FCFDFE; }
.cal-jour.auj { background: color-mix(in srgb, var(--corail) 8%, white); }
.cal-jour:hover { background: var(--givre); }
.cal-jour.survol { outline: 2px dashed var(--fourgon); outline-offset: -3px; background: var(--fourgon-pale); }
.cal-num {
    position: absolute; top: 5px; left: 8px;
    font: 700 .92rem var(--f-titre); color: var(--nuit-3);
}
.cal-jour.auj .cal-num { background: var(--nuit); color: var(--blanc); border-radius: 8px; padding: 0 .45rem; left: 6px; }
.cal-jour.we .cal-num { color: #9AA7B6; }

.cal-barre {
    position: relative; z-index: 2;
    margin: 3px 4px; min-width: 0;
    display: flex; align-items: center; gap: .4rem;
    padding: 0 .35rem 0 .7rem;
    background: var(--c); color: var(--nuit);
    border: 0; border-radius: 999px;
    font: 700 .82rem var(--f-texte); text-align: left; cursor: pointer;
    box-shadow: 0 1px 0 rgba(15, 33, 62, .08);
}
.cal-barre:hover { filter: brightness(1.04); box-shadow: 0 0 0 2px var(--nuit); }
.cal-barre.survol { box-shadow: 0 0 0 3px var(--nuit); }
.cal-barre.suite-g { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-barre.suite-d { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cb-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-avatars { display: flex; flex-shrink: 0; }
.cb-av {
    display: inline-grid; place-items: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--blanc); color: var(--nuit);
    border: 2px solid var(--c);
    font: 800 .62rem var(--f-titre);
    margin-left: -6px;
}
.cb-av:first-child { margin-left: 0; }
.cb-av.plus { background: var(--nuit); color: var(--blanc); }
@media (max-width: 699px) {
    .cal-barre { padding: 0 .3rem; font-size: .7rem; }
    .cb-avatars { display: none; }
    .cal-num { font-size: .78rem; left: 4px; }
}

/* Dialogues planning */
.choix-personnes { border: 1.5px solid var(--bord); border-radius: var(--r-champ); padding: .5rem .8rem .2rem; margin: 0 0 .9rem; }
.choix-personnes legend { font-size: .88rem; font-weight: 600; color: var(--gris); padding: 0 .3rem; }
#affecter-personnes { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 .8rem; }
label.case.personne { margin-bottom: .55rem; }
.titre-chantier { border-left: 6px solid var(--c, var(--fourgon)); padding-left: .6rem; margin-bottom: .2rem !important; }
.bj-liste { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: .45rem; }
.bj-liste li { display: flex; gap: .8rem; align-items: baseline; }
.bj-liste li > strong { width: 72px; flex-shrink: 0; white-space: nowrap; text-transform: capitalize; }
.bj-personnes { display: flex; flex-wrap: wrap; gap: .35rem; }
.bj-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    background: var(--givre); border-radius: 999px; padding: .2rem .3rem .2rem .7rem; font-size: .88rem; font-weight: 600;
}
.bj-chip em { font-weight: 400; color: var(--gris); }
.bj-chip button {
    width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--blanc); color: var(--rouge);
    cursor: pointer; font-weight: 700; line-height: 1;
}
.bj-periode { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .6rem; }

/* Planning : jours passés, lecture seule, heures saisies */
.cal-jour.passe:not(.auj) .cal-num { opacity: .55; }
.cal-jour.passe:not(.we):not(.auj) { background: #F7F9FB; }
.cal-jour.lecture { cursor: default; }
.cal-jour.lecture:hover { background: inherit; }
.cal-cadre > .btn.cal-plus:first-child { width: calc(100% - 2rem); margin: .5rem 1rem 1rem; }
.bj-adresse { display: flex; align-items: center; gap: .4rem; color: var(--gris); margin: .2rem 0 0; }
.bj-adresse svg { width: 16px; height: 16px; }
.bj-chip.fait { background: color-mix(in srgb, var(--fourgon) 18%, white); }
.bj-chip:not(:has(button)) { padding-right: .7rem; }
.bj-ok { color: var(--fourgon); font-weight: 800; margin-right: .1rem; }
.bj-legende { font-size: .82rem; margin-top: -.4rem; }

/* =========================================================
   Bons d'intervention SAV
   ========================================================= */
.form-bon textarea { width: 100%; resize: vertical; }
.bon-attestation {
    background: var(--creme, #FBEBD6); border-left: 4px solid var(--corail);
    border-radius: 12px; padding: .8rem 1rem; margin: .2rem 0 1rem;
}
.bon-attestation strong { display: flex; align-items: center; gap: .45rem; font: 700 1rem var(--f-titre); color: var(--nuit); }
.bon-attestation strong .ico { width: 20px; height: 20px; }
.bon-attestation p { margin: .3rem 0 0; font-size: .92rem; color: var(--nuit-3, #33465F); }
.signature-zone { position: relative; margin: .2rem 0 1.1rem; }
.sig-tete { display: flex; justify-content: space-between; align-items: baseline; font-size: .88rem; font-weight: 600; color: var(--gris); margin-bottom: .35rem; }
#sig-canvas {
    display: block; width: 100%; height: 200px;
    background: #fff; border: 2px dashed var(--bord); border-radius: 14px;
    touch-action: none; cursor: crosshair;
}
.sig-aide {
    position: absolute; left: 0; right: 0; top: 55%; text-align: center; margin: 0;
    color: #A7B3C2; font-size: .95rem; pointer-events: none;
}
.sig-aide[hidden] { display: none; }
.confirmation .btn { margin-top: .6rem; align-self: flex-start; }
.erreur-envoi { color: #A2452A !important; font-size: .82rem; }
.alerte-config { display: flex; gap: .8rem; align-items: flex-start; border-left: 4px solid var(--corail); }
.alerte-config .ico { width: 22px; height: 22px; color: var(--corail); flex-shrink: 0; }
.alerte-config strong { display: block; }
.alerte-config span { color: var(--gris); font-size: .92rem; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

/* Bons SAV : validation avant envoi */
.badge.attente { background: var(--creme); color: #8A5A12; }
.facultatif { font-weight: 400; color: var(--gris); }
dialog.dlg-large { width: min(760px, calc(100vw - 2rem)); }
#envoi-apercu { width: 100%; height: 440px; border: 1px solid var(--bord); border-radius: 12px; background: var(--givre); margin: .4rem 0 1rem; }
.envoi-ouvrir { display: none; margin: .4rem 0 1rem; }
@media (max-width: 699px) {
    #envoi-apercu { display: none; }
    .envoi-ouvrir { display: flex; }
}
.puces-email { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.4rem 0 .9rem; }
.puces-email:empty { display: none; }
.puce-email {
    border: 1.5px solid var(--bord); background: var(--blanc); border-radius: 999px;
    padding: .25rem .75rem; font: 600 .85rem var(--f-texte); color: var(--nuit); cursor: pointer;
}
.puce-email:hover { border-color: var(--fourgon); background: var(--fourgon-pale); }

.corriger-bon { border: 1.5px solid var(--bord); border-radius: var(--r-champ); padding: .6rem .9rem; margin: 0 0 1rem; }
.corriger-bon summary { cursor: pointer; font-weight: 700; color: var(--nuit); }
.corriger-bon[open] summary { margin-bottom: .8rem; }
.corriger-bon .btn { margin-bottom: .3rem; }
#dlg-envoi-bon { max-height: calc(100vh - 2rem); overflow-y: auto; }

/* =========================================================
   Planning — vue Semaine (identique admin / employés)
   ========================================================= */
.ps-barre { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1rem; }
.ps-titre { display: flex; flex-direction: column; line-height: 1.15; min-width: 11em; text-align: center; }
.ps-titre strong { font: 800 1.15rem var(--f-titre); color: var(--nuit); }
.ps-titre span { color: var(--gris); font-size: .9rem; }
.ps-aller { flex: 0 0 38px; position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; margin: 0;
    border: 1.5px solid var(--bord); border-radius: 12px; cursor: pointer; color: var(--nuit); }
.ps-aller .ico { width: 18px; height: 18px; }
.ps-aller input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; padding: 0; }

.ps-grille {
    display: grid; gap: .75rem; margin-bottom: 1rem;
    grid-template-columns: repeat(var(--colonnes), minmax(0, 1fr));
}
@media (max-width: 899px) { .ps-grille { grid-template-columns: 1fr; } }

.ps-jour {
    background: var(--blanc); border-radius: var(--r-panneau); padding: .8rem;
    display: flex; flex-direction: column; gap: .55rem; min-height: 140px;
    border: 2px solid transparent; transition: border-color .15s;
}
.ps-jour header { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; padding: 0 .2rem .35rem;
    border-bottom: 1px solid var(--givre); }
.ps-jour header strong { font: 800 1.02rem var(--f-titre); color: var(--nuit); }
.ps-jour header span { color: var(--gris); font-size: .9rem; }
.ps-jour header em { margin-left: auto; font-style: normal; font-size: .75rem; font-weight: 700;
    background: var(--corail); color: var(--nuit); padding: .05rem .5rem; border-radius: 999px; }
.ps-jour.auj { border-color: var(--corail); }
.ps-jour.passe { opacity: .72; }
.ps-jour.survol { border-color: var(--fourgon); border-style: dashed; }
.ps-cartes { display: flex; flex-direction: column; gap: .5rem; }
.ps-rien { margin: .3rem .2rem; color: #A7B3C2; font-size: .9rem; }

.ps-carte {
    position: relative; cursor: pointer;
    background: color-mix(in srgb, var(--c) 14%, white);
    border-left: 5px solid var(--c); border-radius: 12px; padding: .55rem .65rem .6rem;
    transition: box-shadow .15s, transform .15s;
}
.ps-carte:hover, .ps-carte:focus-visible { box-shadow: 0 4px 14px rgba(15, 33, 62, .12); outline: none; }
.ps-carte.survol { box-shadow: 0 0 0 3px var(--nuit); }
.ps-carte.avec-moi { box-shadow: inset 0 0 0 2px var(--c); }
.ps-nom { font: 700 .95rem/1.25 var(--f-titre); color: var(--nuit); }
.ps-ville { font-size: .8rem; color: var(--gris); margin-top: .05rem; }
.ps-personnes { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.ps-pers {
    display: inline-flex; align-items: center; gap: .2rem;
    background: var(--blanc); color: var(--nuit); border-radius: 999px;
    padding: .15rem .55rem; font-size: .82rem; font-weight: 600;
    box-shadow: 0 0 0 1px rgba(15, 33, 62, .08);
}
.ps-pers[draggable="true"] { cursor: grab; }
.ps-pers.moi { background: var(--nuit); color: var(--blanc); }
.ps-pers.libre { background: var(--givre); color: var(--gris); box-shadow: none; }
.ps-ok { font-style: normal; color: var(--fourgon-fonce, #1E7E99); font-weight: 800; }
.ps-pers.moi .ps-ok { color: var(--ciel, #32A7C7); }
.ps-note { margin-top: .4rem; font-size: .8rem; color: #8A5A12; background: rgba(255, 255, 255, .7);
    border-radius: 8px; padding: .2rem .45rem; }
.ps-libres { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .8rem; color: var(--gris); }
.ps-libres > span:first-child { margin-right: .1rem; }
.ps-ajouter {
    margin-top: auto; display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
    border: 1.5px dashed var(--bord); background: transparent; border-radius: 10px;
    padding: .35rem; color: var(--gris); font: 600 .85rem var(--f-texte); cursor: pointer;
}
.ps-ajouter .ico { width: 16px; height: 16px; }
.ps-ajouter:hover { border-color: var(--fourgon); color: var(--fourgon-fonce, #1E7E99); background: var(--fourgon-pale); }
body.ps-glisse .ps-jour { border-color: var(--bord); border-style: dashed; }

.ps-legende h2, .ma-semaine h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.ps-legende ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; align-items: start;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.ps-legende li { display: grid; grid-template-columns: 12px 1fr; column-gap: .55rem; cursor: pointer; padding: .35rem .5rem; border-radius: 8px; }
.ps-legende li .lg-info { grid-column: 2; }
.ps-legende li:hover { background: var(--givre); }
.lg-pastille { width: 12px; height: 12px; border-radius: 4px; background: var(--c); margin-top: .3rem; }
.lg-nom { font-weight: 700; color: var(--nuit); }
.lg-info { color: var(--gris); font-size: .85rem; }

/* Employé : résumé de sa semaine */
.ma-semaine ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.ma-semaine li { display: grid; grid-template-columns: 6.2em 1fr; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: 10px; }
.ms-detail { display: flex; flex-direction: column; border-left: 4px solid var(--c); padding: .15rem .6rem;
    background: color-mix(in srgb, var(--c) 14%, white); border-radius: 0 10px 10px 0; }
.ms-detail strong { color: var(--nuit); font-size: .95rem; line-height: 1.25; }
.ma-semaine li.auj { background: color-mix(in srgb, var(--corail) 12%, white); }
.ms-jour { width: 4.2em; font-weight: 700; color: var(--nuit); }
.ms-chantier { font-weight: 700; color: var(--nuit); padding: .1rem .6rem; border-radius: 999px;
    background: color-mix(in srgb, var(--c) 22%, white); border-left: 4px solid var(--c); }
.ms-ville, .ms-vide { color: var(--gris); font-size: .88rem; }

/* Vue Mois : prénoms lisibles dans les barres */
.cb-noms { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 600; font-size: .76rem; background: rgba(255, 255, 255, .75); border-radius: 999px; padding: .05rem .45rem; }
.cal-barre .cb-nom { flex: 0 1 auto; }
.cal-barre.avec-moi { box-shadow: 0 0 0 2px var(--nuit); }
@media (max-width: 699px) { .cb-noms { display: none; } }

.ms-jour { line-height: 1.2; }

/* Semaine complète : 7 colonnes, week-end grisé */
.ps-jour.we { background: #F6F8FB; }
.ps-jour.we header strong { color: var(--gris); }
@media (min-width: 900px) and (max-width: 1400px) {
    .ps-grille { gap: .5rem; }
    .ps-jour { padding: .6rem .5rem; }
    .ps-carte { padding: .5rem .5rem .55rem; }
    .ps-nom { font-size: .88rem; }
    .ps-pers { font-size: .78rem; padding: .12rem .45rem; }
}
@media (min-width: 900px) { .ps-grille { grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .75fr)); } }
.ps-jour, .ps-carte { min-width: 0; }
.ps-nom { overflow-wrap: anywhere; hyphens: auto; }

/* =========================================================
   Correctifs iPhone / téléphone
   ========================================================= */
/* Safari iOS donne une largeur minimale aux champs date/heure : ils débordaient des cartes */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] {
    -webkit-appearance: none; appearance: none;
    display: block; min-width: 0; max-width: 100%;
    text-align: left; line-height: 1.3;
}
input::-webkit-date-and-time-value { text-align: left; }
.ligne > label { flex: 1 1 0; }



/* =========================================================
   Refonte « Givre » — fond givré, cartes en verre dépoli,
   barre de navigation sombre éclairée par des phares de camion
   ========================================================= */
:root {
    --fond: #E7ECF1;
    --verre: rgba(255, 255, 255, .72);
    --verre-bord: rgba(255, 255, 255, .95);
    --ombre: 0 8px 24px rgba(15, 33, 62, .06);
    --sombre: linear-gradient(160deg, #18243B 0%, #0E1626 100%);
    --phare: #FFD98A;
    --phare-clair: #FFF1D0;
    --r-panneau: 24px;
}

html, body { background: var(--fond); }
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(420px 420px at -5% 0%, rgba(50, 167, 199, .22), transparent 70%),
        radial-gradient(480px 480px at 105% 45%, rgba(244, 123, 87, .14), transparent 70%),
        radial-gradient(400px 400px at 10% 100%, rgba(255, 255, 255, .9), transparent 70%);
}

/* Cartes en verre */
.panneau, .jour, .resume .pastille, .mois-nav, .puce-user {
    background: var(--verre);
    border: 1px solid var(--verre-bord);
    box-shadow: var(--ombre);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.jour { border-radius: 20px; }
.jour.aujourdhui { border: 1.5px solid var(--fourgon); }
.jour.vide { background: rgba(255, 255, 255, .3); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.saisie, .carte-ticket { background: rgba(237, 243, 247, .85); }
.btn, .btn-icone, .segments button { border-color: rgba(15, 33, 62, .1); }
.btn:not(.primaire):not(.nuit):not(.corail) { background: rgba(255, 255, 255, .85); }
dialog { border-radius: 26px; }

/* Cartes sombres (anciennement « ciel étoilé ») — le login garde ses étoiles */
.panneau.ciel, .total-semaine.ciel, .confirmation.ciel {
    position: relative; overflow: hidden;
    background: var(--sombre); border: 0;
    box-shadow: 0 18px 36px rgba(15, 33, 62, .28);
}
.panneau.ciel::before, .total-semaine.ciel::before, .confirmation.ciel::before {
    content: ""; position: absolute; right: -50px; top: -70px; width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(50, 167, 199, .35), transparent 70%); pointer-events: none;
}
.panneau.ciel > *, .total-semaine.ciel > *, .confirmation.ciel > * { position: relative; }
.puces span, .puces button { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .08); }

/* Indicateurs : le premier devient la grande carte sombre, les autres en verre */
.kpi { border-radius: 22px; background: var(--verre); border: 1px solid var(--verre-bord); box-shadow: var(--ombre); }
.kpi::before { content: ""; width: 10px; height: 10px; border-radius: 50%; margin-bottom: .35rem; background: var(--bord); }
.kpi-fourgon::before { background: var(--fourgon); }
.kpi-corail::before { background: var(--corail); }
.kpi-creme::before { background: #F2C063; }
.kpi-positif::before { background: var(--vert); }
.kpi-negatif::before { background: var(--rouge); }
.kpis:not(.kpis-2) > .kpi:first-child {
    background: var(--sombre); border: 0; color: var(--blanc);
    box-shadow: 0 18px 36px rgba(15, 33, 62, .28);
    position: relative; overflow: hidden;
}
.kpis:not(.kpis-2) > .kpi:first-child::after {
    content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%;
    background: radial-gradient(circle, rgba(50, 167, 199, .35), transparent 70%); pointer-events: none;
}
.kpis:not(.kpis-2) > .kpi:first-child .kpi-lib,
.kpis:not(.kpis-2) > .kpi:first-child .kpi-pied { color: #A9B6CF; }
.kpis:not(.kpis-2) > .kpi:first-child::before { background: var(--phare); box-shadow: 0 0 10px 2px rgba(255, 200, 110, .7); }
@media (max-width: 699px) {
    .kpis:not(.kpis-2) > .kpi:first-child { grid-column: 1 / -1; padding: 1.25rem 1.3rem; }
    .kpis:not(.kpis-2) > .kpi:first-child strong { font-size: 3.4rem; }
}

/* ---------- En-tête : salutation, verre dépoli ---------- */
.haut {
    background: rgba(231, 236, 241, .8);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    color: var(--encre);
    padding: .6rem 1rem;
    padding-top: max(.6rem, env(safe-area-inset-top));
}
.haut-logo {
    width: 46px; height: 46px; object-fit: cover; border-radius: 15px;
    background: var(--nuit); box-shadow: 0 6px 16px rgba(15, 33, 62, .18);
}
.haut-salut { display: flex; flex-direction: column; min-width: 0; }
.haut-salut small { font-size: .82rem; color: var(--gris); }
.haut-salut small::first-letter { text-transform: uppercase; }
.haut-salut strong { font: 800 1.6rem/1 var(--f-titre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.puce-user { background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---------- Barre de navigation (téléphone) ---------- */
.lat {
    left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    padding: 0; height: 70px;
    border-radius: 26px; overflow: hidden;
    background: linear-gradient(180deg, #1A2335 0%, #0D131F 100%);
    box-shadow: 0 18px 40px rgba(15, 33, 62, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.nav { position: relative; }
.nav-btn {
    justify-content: center; padding: 0 .1rem 6px; min-width: 0;
    color: #8D98AD; transition: color .35s ease, filter .35s ease;
}
.nav-btn .lib-long { display: none; }
.nav-btn.actif { color: var(--phare-clair); filter: drop-shadow(0 0 6px rgba(255, 214, 140, .85)); }
.nav-btn.actif .ico { color: var(--phare); }
.nav-btn.en-plus { display: none; }

.phare {
    position: absolute; left: 0; top: 0; bottom: 0; width: 20%;
    pointer-events: none; opacity: 0;
    transition: transform .5s cubic-bezier(.45, 1.45, .45, 1), width .3s ease, height .3s ease, opacity .3s;
}
.phare-cone {
    position: absolute; left: -8%; right: -8%; top: 0; bottom: 4px;
    clip-path: polygon(36% 100%, 64% 100%, 100% 0, 0 0);
    background: linear-gradient(0deg, rgba(255, 222, 150, .55) 0%, rgba(255, 222, 150, .16) 55%, rgba(255, 222, 150, 0) 100%);
    filter: blur(2px);
}
.phare-led {
    position: absolute; left: 50%; bottom: 0; width: 46px; margin-left: -23px; height: 3px;
    border-radius: 3px 3px 0 0; background: var(--phare); box-shadow: 0 0 12px 3px rgba(255, 200, 110, .85);
}
.phare-feux { position: absolute; left: 50%; bottom: 5px; width: 34px; margin-left: -17px; display: flex; justify-content: space-between; }
.phare-feux i {
    width: 9px; height: 5px; border-radius: 50%;
    background: #FFF4D6; box-shadow: 0 0 8px 3px rgba(255, 214, 140, .9);
}
@media (prefers-reduced-motion: reduce) { .phare { transition: opacity .3s; } }

.principal { padding-bottom: calc(100px + env(safe-area-inset-bottom)); overflow-x: clip; }
.toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* Feuille « Plus » */
dialog.feuille {
    margin: auto auto 0; width: 100%; max-width: 520px;
    border-radius: 28px 28px 0 0;
    padding: .6rem 1rem calc(1rem + env(safe-area-inset-bottom));
    background: #F4F6F8;
}
.feuille-poignee { display: block; width: 44px; height: 5px; border-radius: 5px; background: #C9D3DD; margin: 0 auto .9rem; }
.plus-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: .9rem; }
.plus-case {
    display: flex; flex-direction: column; align-items: center; gap: .4rem;
    padding: 1rem .4rem; border-radius: 20px; cursor: pointer;
    background: var(--blanc); border: 1px solid var(--verre-bord); box-shadow: var(--ombre);
    font: 600 .88rem var(--f-texte); color: var(--encre); text-align: center;
}
.plus-case .ico { width: 26px; height: 26px; color: var(--fourgon-fonce); }
.plus-case.actif { background: var(--nuit); color: var(--phare-clair); }
.plus-case.actif .ico { color: var(--phare); }

/* ---------- Ordinateur : barre latérale sombre, faisceau horizontal ---------- */
@media (min-width: 900px) {
    .lat {
        left: 16px; top: 16px; bottom: 16px; right: auto; height: auto;
        width: var(--lat); border-radius: 28px;
        padding: 1.2rem .9rem 1rem;
    }
    .lat .lat-logo { padding: 0 .3rem 1.2rem; }
    .lat-logo img { border-radius: 16px; }
    .nav { gap: .2rem; }
    .nav-btn, .lat-deco { justify-content: flex-start; padding: .75rem .95rem; }
    .nav-btn .lib-long { display: inline; }
    .nav-btn .lib-court, .nav-plus { display: none !important; }
    .nav-btn.en-plus { display: flex; }
    .nav-btn.actif { background: transparent; }
    .nav-btn.actif::before { content: none; }
    .nav-btn:hover, .lat-deco:hover { color: var(--blanc); background: rgba(255, 255, 255, .04); }
    .lat .lat-deco { color: #8D98AD; }

    .phare { left: -.9rem; right: -.9rem; top: 0; bottom: auto; width: auto; height: 48px; }
    /* Même phare que la barre du téléphone, tourné d'un quart : les deux feux au bord gauche
       du menu, la lumière qui s'ouvre vers la droite sur l'onglet ouvert */
    .phare-cone {
        left: 4px; right: 0; top: -6px; bottom: -6px;
        clip-path: polygon(0 36%, 0 64%, 100% 100%, 100% 0);
        background: linear-gradient(90deg, rgba(255, 222, 150, .55) 0%, rgba(255, 222, 150, .16) 55%, rgba(255, 222, 150, 0) 100%);
    }
    .phare-led {
        left: 0; bottom: auto; top: 50%; width: 3px; height: 38px; margin: -19px 0 0;
        border-radius: 0 3px 3px 0;
    }
    .phare-feux {
        display: flex; flex-direction: column;
        left: 5px; bottom: auto; top: 50%; width: auto; height: 34px; margin: -17px 0 0;
    }
    .phare-feux i { width: 5px; height: 9px; }

    .principal { margin-left: calc(var(--lat) + 16px); padding-bottom: 0; }
    .haut { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 1.4rem 2rem 0; }
    .haut-logo { display: none; }
    .haut-salut strong { font-size: 2rem; }
    .puce-user { background: var(--verre); border: 1px solid var(--verre-bord); box-shadow: var(--ombre); }
    .toast { bottom: 2rem; left: calc(50% + (var(--lat) + 16px) / 2); }
}

/* ---------- Listes : les boutons passent sous le nom sur téléphone (Employés…) ---------- */
.liste .gauche > div { min-width: 0; }
@media (max-width: 699px) {
    .liste li { flex-wrap: wrap; }
    .liste .gauche { flex: 1 1 100%; }
    .liste .boutons { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
}

/* Petite aide sous un champ de formulaire */
label .aide { display: block; margin-top: .3rem; font-size: .78rem; font-weight: 400; color: var(--gris); line-height: 1.35; }

/* Saisie d'heures : journée sur plusieurs chantiers */
.saisie-multi { align-self: flex-start; margin: -.4rem 0 .9rem; font-size: .9rem; }
.saisie-parts { margin-bottom: .9rem; padding: .8rem; border-radius: 16px; background: rgba(50, 167, 199, .08); border: 1px solid rgba(50, 167, 199, .2); }
.saisie-parts-titre { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .5rem; }
.part { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.part select[data-p-chantier] { flex: 1; min-width: 0; }
.part select[data-p-duree] { width: 6.2rem; flex-shrink: 0; }
.part-reste { width: 6.2rem; flex-shrink: 0; text-align: center; font-weight: 700; padding: .55rem 0; border-radius: 12px; background: rgba(255, 255, 255, .7); }
.part-reste.negatif, .part-aide .negatif { color: var(--rouge); }
.part-aide { margin: .2rem 0 .4rem; font-size: .82rem; }

/* Chantier : main-d'œuvre par employé */
.mo-table .num { text-align: right; white-space: nowrap; }
.mo-taux { display: inline-flex; align-items: center; gap: .3rem; }
.mo-taux input { width: 6rem; min-height: 38px; padding: .3rem .5rem; text-align: right; }
.mo-manque td:first-child { color: #B4581F; font-weight: 700; }
.mo-manque .mo-taux input { border-color: #F2C063; background: #FFF8EA; }
.mo-table tfoot td { font-weight: 700; border-top: 2px solid var(--bord); }

/* Employé : portée d'un changement de coût horaire */
.cout-portee { border: 1px solid #F2C063; background: #FFF8EA; border-radius: 14px; padding: .6rem .8rem .2rem; margin: -.3rem 0 .9rem; }
.cout-portee legend { font-weight: 700; font-size: .88rem; padding: 0 .3rem; }
.cout-portee .case { align-items: flex-start; font-size: .88rem; margin-bottom: .5rem; }
.cout-portee .case span { line-height: 1.35; }

/* ---------- Visionneuse (PDF et images dans l'appli) ---------- */

dialog.dlg-visio {
    width: min(1000px, calc(100vw - 16px));
    height: calc(100dvh - 16px); max-height: none;
    overflow: hidden;
}
dialog.dlg-visio[open] { display: flex; flex-direction: column; }
.visio-barre {
    display: flex; align-items: center; gap: .5rem;
    padding: .7rem .9rem; border-bottom: 1px solid var(--bord); flex-shrink: 0;
}
.visio-barre strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visio-pages {
    flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch;
    background: var(--givre); padding: 8px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.visio-pages canvas, .visio-pages img { max-width: 100%; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(15, 33, 62, .15); }
.visio-pages iframe { width: 100%; flex: 1; border: 0; background: #fff; }

/* Ticket envoyé en PDF : vignette à la place de la photo */
.ct-pdf, .ticket-pdf {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--bord); color: var(--gris); font-weight: 700; border-radius: 10px;
}
.ct-pdf { width: 64px; height: 80px; flex-shrink: 0; font-size: .85rem; }
.ticket-pdf { min-height: 180px; color: #fff; background: transparent; font-size: 1.6rem; gap: .3rem; }
.ticket-pdf[hidden] { display: none; }
.ticket-pdf small { font-size: .85rem; font-weight: 500; opacity: .8; }
button.ticket-photo { width: 100%; border: 0; padding: 0; cursor: zoom-in; font: inherit; }

/* ---------- Fiche de renseignements, formulaires en blocs ---------- */

.fiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem 1.5rem; margin: 0; }
.fiche dt { font-size: .82rem; font-weight: 600; color: var(--gris); margin-bottom: .15rem; }
.fiche dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.fiche dd .sous { font-weight: 400; }
fieldset.bloc-form { border: 1px solid var(--bord); border-radius: 16px; padding: .9rem 1rem .3rem; margin: 0 0 1rem; min-width: 0; }
fieldset.bloc-form legend { font-weight: 700; padding: 0 .4rem; }
.segments.deux { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-bottom: .8rem; }
.segments.deux label { flex-direction: row; align-items: center; gap: .45rem; margin: 0; color: var(--encre); font-weight: 600; }
.segments.deux input { width: 18px; height: 18px; min-height: 0; accent-color: var(--fourgon-fonce); }
p.aide { font-size: .85rem; color: var(--gris); margin: 0 0 .7rem; }

/* ---------- Rentabilité ---------- */

.bandeau-info { background: var(--creme); border-radius: 14px; padding: .7rem 1rem; margin: 0 0 1rem; font-size: .92rem; }
.table.cascade td { padding-top: .55rem; padding-bottom: .55rem; }
.table.cascade td:first-child { white-space: normal; }
.table.cascade tr.total td { font-weight: 800; border-top: 2px solid var(--encre); }
.table .num.positif { color: var(--vert); }
.table .num.negatif { color: var(--rouge); }
.sous-titre { font-size: .9rem; font-weight: 700; color: var(--gris); margin: .8rem 0 .2rem; }
.page-actions .mois-nav { margin: 0; }

/* ---------- Planning : palette et glisser-déposer au doigt ---------- */

.ps-palette { display: flex; flex-direction: column; gap: .5rem; padding-top: .8rem; padding-bottom: .8rem; }
.pp-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.pp-titre { font-size: .82rem; font-weight: 700; color: var(--gris); min-width: 5.2em; }
.pp-chantier {
    font-size: .85rem; font-weight: 600; padding: .2rem .65rem; border-radius: 999px; cursor: grab;
    background: color-mix(in srgb, var(--c) 22%, #fff); border: 1px solid color-mix(in srgb, var(--c) 55%, #fff);
}
.ps-palette .sous { font-size: .82rem; margin: 0; }
.ps-palette .ps-pers { font-size: .85rem; padding: .2rem .65rem; }
.ps-carte[draggable="true"] { cursor: grab; }
[draggable="true"] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.ps-fantome {
    position: fixed; z-index: 1000; pointer-events: none; margin: 0;
    transform: translate(-50%, -60%) rotate(-2deg) scale(1.05); opacity: .92;
    box-shadow: 0 12px 28px rgba(15, 33, 62, .35);
}

/* ---------- Pastilles de nouveautés sur les onglets ---------- */

.nav-btn, .plus-case { position: relative; }
.nav-btn[data-pastille]::after, .plus-case[data-pastille]::after {
    content: attr(data-pastille);
    position: absolute; top: 4px; left: calc(50% + 6px);
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--corail); color: #fff; font: 700 .68rem/18px var(--f-texte); text-align: center;
    box-shadow: 0 0 0 2px var(--nuit);
}
@media (min-width: 900px) {
    .nav-btn[data-pastille]::after { top: 50%; left: auto; right: 14px; transform: translateY(-50%); }
}

/* ---------- Messages ---------- */

.chat { display: grid; gap: 1rem; }
.chat .panneau { margin-bottom: 0; }
.chat-liste { padding: .5rem; display: flex; flex-direction: column; gap: .15rem; align-self: start; }
.chat-conv {
    display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
    border: 0; background: none; padding: .6rem .7rem; border-radius: 14px; cursor: pointer; font: inherit; color: inherit;
}
.chat-conv:hover, .chat-conv.actif { background: var(--givre); }
.chat-conv-corps { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-conv-corps .secondaire { color: var(--gris); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-nonlus {
    min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; flex-shrink: 0;
    background: var(--corail); color: #fff; font-weight: 700; font-size: .78rem; line-height: 22px; text-align: center;
}
.chat-fil-cadre { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: calc(100dvh - 250px); min-height: 340px; }
.chat-tete { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-bottom: 1px solid var(--bord); }
.chat-fil { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .45rem; }
.chat-jour { align-self: center; font-size: .78rem; font-weight: 600; color: var(--gris); margin: .5rem 0 .2rem; text-transform: capitalize; }
.chat-msg { max-width: min(78%, 560px); padding: .5rem .8rem .35rem; border-radius: 16px; display: flex; flex-direction: column; }
.chat-msg p { margin: 0; overflow-wrap: anywhere; }
.chat-msg.gauche { align-self: flex-start; background: var(--givre); border-bottom-left-radius: 5px; }
.chat-msg.droite { align-self: flex-end; background: var(--fourgon-pale); border-bottom-right-radius: 5px; }
.chat-auteur { font-size: .76rem; font-weight: 700; color: var(--fourgon-fonce); }
.chat-heure { font-size: .7rem; color: var(--gris); align-self: flex-end; }
.chat-form { display: flex; align-items: flex-end; gap: .5rem; padding: .7rem; border-top: 1px solid var(--bord); }
.chat-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; margin: 0; }
.chat-form .btn { flex-shrink: 0; }
@media (max-width: 899px) {
    .chat-admin.fil-ouvert .chat-liste { display: none; }
    .chat-admin:not(.fil-ouvert) .chat-vide { display: none; }
}
@media (min-width: 900px) {
    .chat-admin { grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); }
    .chat-retour { display: none; }
    .chat-fil-cadre { height: calc(100dvh - 210px); }
}

/* ---------- Menu latéral : tient sur les écrans peu hauts ---------- */
/* Avec Messages et Rentabilité, le menu dépassait de l'écran sur un portable : il se resserre,
   et défile s'il ne tient toujours pas. */

@media (min-width: 900px) {
    .nav {
        min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
        margin: 0 -.9rem; padding: 0 .9rem; /* toute la largeur du menu : le faisceau du phare n'est pas coupé */
        scrollbar-width: none; /* pas de barres de défilement : la molette ou le doigt suffisent */
    }
    .nav::-webkit-scrollbar { display: none; }
    /* Le menu occupe désormais toute la largeur : le phare part du bord gauche, sans dépasser */
    .phare { left: 0; right: 0; }
    .lat .lat-logo, .lat .lat-deco { flex-shrink: 0; }
}
@media (min-width: 900px) and (max-height: 860px) {
    .nav { gap: .05rem; }
    .nav-btn, .lat-deco { padding: .52rem .95rem; }
    .lat .lat-logo { padding-bottom: .7rem; text-align: center; }
    .lat-logo img { width: auto; max-width: 100%; max-height: 110px; }
}
@media (min-width: 900px) and (max-height: 640px) {
    .lat .lat-logo { display: none; }
}

/* =========================================================
   Rentabilité expliquée : cascade + lignes dépliables
   ========================================================= */
.explic-phrase { margin: 0 0 1rem; line-height: 1.55; font-size: 1rem; }
.explic-phrase .negatif { color: var(--rouge); }

/* Cascade horizontale : chaque ligne part de là où la précédente s'est arrêtée */
.wf { display: flex; flex-direction: column; gap: .35rem; }
.wf-ligne { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 7.5rem; align-items: center; gap: .7rem; }
.wf-lib { font-size: .9rem; font-weight: 600; }
.wf-piste { position: relative; height: 26px; border-radius: 8px; background: rgba(15, 33, 62, .04); }
.wf-piste i { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; background: var(--corail); }
.wf-zero { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--encre); opacity: .35; }
.wf-ligne.plus .wf-piste i { background: var(--fourgon); }
.wf-ligne.moins .wf-piste i { background: #F29A7D; }
.wf-ligne.total .wf-piste i { background: var(--nuit); }
.wf-ligne.total.negatif .wf-piste i { background: var(--rouge); }
.wf-ligne.total .wf-lib, .wf-ligne.total .wf-val { font-weight: 800; }
.wf-ligne.total { padding-top: .35rem; border-top: 1px dashed var(--bord); }
.wf-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .92rem; }
.wf-ligne.total.negatif .wf-val { color: var(--rouge); }
@media (max-width: 699px) {
    .wf-ligne { grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .6rem; }
    .wf-piste { grid-column: 1 / -1; grid-row: 2; height: 18px; }
    .wf-lib { font-size: .85rem; }
}

/* Lignes dépliables : ce que c'est, comment c'est calculé, le détail */
.explic { border: 1px solid var(--bord); border-radius: 16px; background: rgba(255, 255, 255, .6); margin-bottom: .5rem; }
.explic > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; }
.explic > summary::-webkit-details-marker { display: none; }
.explic > summary::after { content: "+"; margin-left: .2rem; font-weight: 700; color: var(--gris); width: 1rem; text-align: center; }
.explic[open] > summary::after { content: "–"; }
.explic-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    background: var(--creme); font-weight: 800; font-size: .85rem; }
.explic-total { background: var(--nuit); color: var(--blanc); border-color: transparent; }
.explic-total .explic-num { background: rgba(255, 255, 255, .12); color: var(--phare); }
.explic-total > summary::after { color: #A9B6CF; }
.explic-total .explic-val.positif { color: #9FE3B5; }
.explic-total .explic-val.negatif { color: #FFB3A6; }
.explic-total .explic-corps { color: #DCE3EE; }
.explic-lib { flex: 1; min-width: 0; font-weight: 700; }
.explic-val { white-space: nowrap; font-variant-numeric: tabular-nums; }
.explic-corps { padding: 0 1rem 1rem 3.1rem; font-size: .92rem; line-height: 1.5; }
.explic-corps p { margin: 0 0 .6rem; }
.explic-calcul { color: var(--gris); }
.explic-total .explic-calcul { color: #A9B6CF; }
.explic-table { font-size: .86rem; }
.explic-table tfoot td { font-weight: 700; border-top: 2px solid var(--bord); }
.explic-liste { list-style: none; margin: .2rem 0 0; padding: 0; }
.explic-liste li { display: grid; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr) auto; gap: .8rem; align-items: baseline;
    padding: .45rem 0; border-bottom: 1px solid var(--bord); }
.explic-liste li > strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.explic-liste li > span:nth-child(2) { color: var(--gris); }
.explic-liste .explic-somme { border-bottom: 0; border-top: 2px solid var(--bord); font-weight: 700; }
@media (max-width: 699px) {
    .explic-corps { padding-left: 1rem; }
    .explic-liste li { grid-template-columns: minmax(0, 1fr) auto; }
    .explic-liste li > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; font-size: .84rem; }
}

.bon-a-savoir ul { margin: .4rem 0 0; padding-left: 1.1rem; line-height: 1.55; font-size: .92rem; }
.bon-a-savoir li { margin-bottom: .3rem; }
@media (max-width: 699px) {
    /* Montants sur une seule ligne dans les petites cartes (le « € » ne tombe plus en dessous) */
    .kpis:not(.kpis-2) > .kpi:not(:first-child) strong { font-size: clamp(1.3rem, 6.2vw, 1.9rem); white-space: nowrap; }
    .kpis:not(.kpis-2) > .kpi:first-child strong { font-size: clamp(2.2rem, 11vw, 3.4rem); white-space: nowrap; }
    .explic > summary { padding: .7rem .8rem; gap: .55rem; font-size: .95rem; }
}

/* Salaires du mois (coût réel par employé) */
.salaires-liste li { display: flex; flex-wrap: nowrap; padding: .6rem 0; align-items: center; justify-content: space-between; gap: .75rem; }
.salaires-liste li > div { flex: 1 1 auto; min-width: 0; }
label.salaire-champ { display: flex; flex-direction: row; align-items: center; gap: .35rem; margin: 0; flex: 0 0 auto; font-weight: 600; }
label.salaire-champ input { width: 7.5rem; text-align: right; }
#dlg-salaires .salaires-liste { max-height: 60vh; overflow-y: auto; margin: .5rem 0 1rem; }
