/* ============================================================
   Cockpit — feuille de style commune
   À déployer sous : assets/css/app.css

   Une seule feuille pour toute l'application. Les couleurs
   arrivent en variables, injectées par layout.php depuis les
   paramètres : modifier une teinte ne demande aucune retouche ici.

   Palette par défaut vérifiée au contraste WCAG :
     encre #0b1220 sur blanc ........ 18,7:1
     encre secondaire #4a5568 ....... 7,5:1
     bleu d'action #1c5cab .......... 6,6:1
     vert d'écart #006300 ........... 7,5:1
     rouge d'écart #d03b3b .......... 4,8:1
   Le doré précédent plafonnait à 2,1:1, sous le seuil de 4,5:1.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--plane);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); }

/* ============================================================
   MENU LATÉRAL
   Tiroir coulissant sur mobile, colonne fixe à partir de 1200px.
   ============================================================ */
.nav-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--nav-bg); color: #fff; border: none;
    padding: 10px 16px; border-radius: 8px; cursor: pointer;
    font-size: 14px; font-weight: 600; font-family: inherit;
}

.nav-overlay {
    position: fixed; inset: 0; background: rgba(11, 18, 32, .5);
    opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 272px;
    background: var(--nav-bg); color: var(--nav-ink);
    transform: translateX(-100%); transition: transform .22s ease;
    z-index: 50; display: flex; flex-direction: column;
    overflow-y: auto; overscroll-behavior: contain;
}
.sidebar.open { transform: translateX(0); }

.sidebar-head {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.sidebar-head .app-name { font-size: 17px; font-weight: 700; color: #fff; }
.sidebar-head .app-sub { font-size: 13px; color: var(--nav-muted); margin-top: 2px; }
.sidebar-head .brand-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }

.nav-group { padding: 16px 12px 4px; }
.nav-group-title {
    font-size: 11px; font-weight: 700; letter-spacing: .09em;
    text-transform: uppercase; color: var(--nav-muted);
    padding: 0 12px 8px;
}
.nav-link {
    display: block; padding: 11px 14px; border-radius: 8px;
    color: var(--nav-ink); text-decoration: none; font-size: 14.5px;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.active { background: var(--brand); color: #fff; font-weight: 600; }

.sidebar-foot { margin-top: auto; padding: 14px 20px 20px; }
.sidebar-foot button {
    width: 100%; padding: 11px; border-radius: 8px; cursor: pointer;
    background: rgba(255, 255, 255, .1); color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
    font-family: inherit; font-size: 14px; font-weight: 600;
}
.sidebar-foot button:hover { background: rgba(255, 255, 255, .17); }

@media (min-width: 1200px) {
    .sidebar { transform: translateX(0); }
    .nav-toggle, .nav-overlay { display: none; }
    .page { margin-left: 272px; }
}

/* ============================================================
   EN-TÊTE ET CONTENU
   ============================================================ */
.topbar {
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: 14px 22px; display: flex; align-items: center;
    gap: 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 19px; font-weight: 700; }
.topbar .spacer { margin-left: auto; }
.topbar .who { font-size: 13px; color: var(--ink-2); text-align: right; }
.topbar .who strong { display: block; color: var(--ink); }

.container { max-width: 1320px; margin: 26px auto; padding: 0 22px; }
.page-intro { margin-bottom: 24px; }
.page-intro h2 { font-size: 23px; font-weight: 700; }
.page-intro p { color: var(--ink-2); margin-top: 4px; }

/* ============================================================
   CARTES
   ============================================================ */
.card, .section, .form-section, .tool, .activity-box, .table-section,
.template-section, .budget-card, .picker {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 22px; margin-bottom: 20px;
}
.card h2, .section-title, .form-title, .table-title {
    font-size: 16px; font-weight: 700; color: var(--ink);
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.tool h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.desc, .section-subtitle { font-size: 13px; color: var(--ink-2); margin-bottom: 16px; }
.hint, .help-text { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ============================================================
   TUILES DE CHIFFRES CLÉS
   ============================================================ */
.stats-grid, .tiles {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px; margin-bottom: 26px;
}
.tile {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 20px;
}
.tile .v {
    font-size: 27px; font-weight: 700; color: var(--brand);
    line-height: 1.15; letter-spacing: -.02em;
}
.tile .k { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.tile .n { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Cartes d'accès rapide */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.quick {
    display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: 12px; padding: 20px; text-decoration: none; color: inherit;
}
.quick:hover { border-color: var(--brand); }
.quick .ic { font-size: 22px; }
.quick .t { font-weight: 700; margin-top: 10px; }
.quick .d { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-row, .grid, .tools {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px; margin-bottom: 16px;
}
.tools { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.form-group, .fg { display: flex; flex-direction: column; margin-bottom: 14px; }
label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
    color: var(--ink); background: var(--card);
    border: 1px solid var(--line-strong); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand);
}
input[type=color] { height: 46px; padding: 5px; cursor: pointer; }
textarea { resize: vertical; }

.button-group, .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
/* « button.btn » a été RETIRÉ de cette liste, et il ne faut pas le
   remettre.

   Il ajoutait un sélecteur d'élément, donc une spécificité de plus
   (0,1,1) que toutes les variantes qui suivent (0,1,0). Sur un
   <button class="btn btn-secondary btn-small">, c'était donc la règle
   de base qui gagnait : bordure transparente, et le padding des gros
   boutons. Une vingtaine de boutons de l'application — « Retirer »,
   « Suppr. », « Réactiver », « Tester la connexion » — s'affichaient
   ainsi sans leur cadre et à la mauvaise taille, alors que les MÊMES
   classes posées sur un <a> rendaient correctement. D'où des paires
   dépareillées côte à côte.

   Le sélecteur d'élément n'était pas nécessaire : n'importe quelle
   règle d'auteur l'emporte sur la feuille du navigateur, quelle que
   soit sa spécificité. */
.btn, .btn-primary, .btn-submit {
    display: inline-block; text-align: center; text-decoration: none;
    padding: 11px 20px; border: 1px solid transparent; border-radius: 8px;
    font-size: 14.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.btn-primary, .btn-submit, .btn-validate { background: var(--brand); color: #fff; }
.btn-primary:hover, .btn-submit:hover, .btn-validate:hover { filter: brightness(1.1); }
.btn-secondary, .back-btn, .btn-export {
    background: var(--card); color: var(--ink); border-color: var(--line-strong);
}
.btn-secondary:hover, .back-btn:hover, .btn-export:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger {
    background: transparent; color: var(--bad);
    border-color: currentColor; padding: 6px 13px; font-size: 13px;
}
.btn-small { padding: 6px 13px; font-size: 13px; }

/* ============================================================
   TABLEAUX
   ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 11px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th {
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
    background: var(--plane); border-bottom: 1px solid var(--line-strong);
}
tbody tr:hover { background: var(--plane); }
tr.strong td { font-weight: 700; background: var(--plane); }
td.value-cell, .value { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Écarts : la couleur ne porte jamais seule l'information,
   le signe et la flèche restent lisibles en cas de daltonisme. */
.pos, .delta-pos { color: var(--good); font-weight: 600; font-variant-numeric: tabular-nums; }
.neg, .delta-neg { color: var(--bad);  font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-pos::before { content: '▲ '; font-size: .85em; }
.delta-neg::before { content: '▼ '; font-size: .85em; }

/* ============================================================
   MESSAGES
   ============================================================ */
/* pre-line : un compte rendu sur plusieurs lignes reste lisible ;
   les messages d'une seule ligne, eux, ne changent pas. */
.alert { padding: 14px 16px; border-radius: 9px; margin-bottom: 20px; border: 1px solid; font-size: 14px; white-space: pre-line; }
.alert-success { background: #eaf6ea; color: #14532d; border-color: #bfe3c4; }
.alert-error   { background: #fdecec; color: #7f1d1d; border-color: #f5c2c2; }
.alert-info    { background: #eaf1fb; color: #14375f; border-color: #c3d8f3; }
.alert-warn    { background: #fdf3e3; color: #703c0a; border-color: #f2ddb9; }

.badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-ok    { background: #eaf6ea; color: #14532d; }
.badge-draft { background: #fdf3e3; color: #703c0a; }
.status-badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; }

.empty-state { text-align: center; padding: 34px 20px; color: var(--muted); }

/* ============================================================
   ONGLETS (outils, budgets)
   ============================================================ */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.tab-btn {
    padding: 10px 18px; border: 1px solid var(--line-strong); background: var(--card);
    border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
    font-family: inherit; color: var(--ink-2);
}
.tab-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Zone de résultat des calculateurs */
.res { margin-top: auto; padding: 14px; background: var(--plane); border-radius: 9px; border: 1px solid var(--line); }
.res-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; }
.res-line strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.res-line.highlight { border-top: 1px solid var(--line-strong); margin-top: 5px; padding-top: 9px; font-size: 15px; }
.res-line.highlight strong { color: var(--brand); }
.res-line.good strong { color: var(--good); }
.res-line.bad strong { color: var(--bad); }
.res-empty { font-size: 13px; color: var(--muted); font-style: italic; }
.wide { grid-column: 1 / -1; }

/* ============================================================
   DIVERS
   ============================================================ */
.brand-logo {
    height: 34px; width: auto; max-width: 150px; object-fit: contain;
    background: #fff; padding: 3px 6px; border-radius: 5px;
}
.layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1150px) { .layout { grid-template-columns: 1.35fr 1fr; align-items: start; } }

.modal { display: none; position: fixed; inset: 0; background: rgba(11,18,32,.55); z-index: 60; }
.modal.active { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-content {
    background: var(--card); border-radius: 12px; padding: 26px;
    width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; position: relative;
}
.close-btn { position: absolute; top: 14px; right: 18px; font-size: 26px; cursor: pointer; color: var(--muted); }

@media (max-width: 640px) {
    .container { padding: 0 16px; margin: 18px auto; }
    .card, .section, .form-section, .tool { padding: 18px; }
    .topbar { padding: 12px 16px; }
    table { font-size: 13px; }
    th, td { padding: 8px 7px; }
}

/* ------------------------------------------------------------
   Graphiques
   Le SVG est produit par PHP, sans script ni bibliothèque : il
   s'affiche donc aussi bien à l'impression et hors ligne. Les
   info-bulles sont des <title> natifs, d'où l'absence de règle
   ici pour les dessiner.
   ------------------------------------------------------------ */
.chart-h {
    font-size: 13px; font-weight: 600; color: var(--ink-2);
    margin: 22px 0 10px; letter-spacing: .01em;
}
.chart-h:first-of-type { margin-top: 4px; }
.chart { max-width: 720px; margin: 0 auto; }

/* Page Graphiques : la courbe prend toute la largeur disponible.
   Le SVG porte en attribut un max-width égal à sa largeur naturelle —
   ce qui convient à un graphique glissé dans une colonne, et bride
   justement celui qu'on vient regarder en grand. Le !important est ici
   nécessaire : il s'agit d'écraser un style posé sur l'élément, qui
   l'emporte sur toute règle de feuille. */
.chart-grand { max-width: 100% !important; width: 100%; }
.chart text { font-variant-numeric: tabular-nums; }
/* Seuls les objets porteurs d'une info-bulle sont groupés : la
   règle ne touche donc que ce qui est survolable. */
.chart g:hover > rect,
.chart g:hover > path,
.chart g:hover > polyline { opacity: .78; }
.chart-tab { margin-top: 14px; }
.chart-tab > summary {
    cursor: pointer; font-size: 13px; color: var(--ink-2);
    padding: 6px 0; user-select: none;
}
.chart-tab > summary:hover { color: var(--ink); }
.chart-tab table { margin-top: 8px; }

/* Colonne de montants : alignée à droite, chiffres de même chasse,
   et jamais coupée en deux lignes — « 81 100,00 € » réparti sur
   trois lignes est illisible dans une carte étroite. */
td.num, th.num {
    text-align: right; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------
   Un tableau plus large que sa carte
   ------------------------------------------------------------------
   Le récapitulatif mensuel du recalcul porte deux colonnes par poste :
   douze colonnes de chiffres, que même un grand écran ne tient pas
   toujours. Sans ce cadre, le tableau déborde de la carte et pousse la
   page entière vers la droite — on perd la navigation en même temps
   que la lisibilité. Ici il défile seul, dans sa carte. */
.table-large { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-large > table { min-width: 100%; width: max-content; }
.table-large th, .table-large td { white-space: nowrap; }

/* ------------------------------------------------------------------
   La zone de dépôt des fichiers
   ------------------------------------------------------------------
   Le champ natif est ÉTIRÉ, transparent, sur toute la surface : c'est
   lui qui reçoit le clic et le dépôt, et le navigateur fait le travail.
   Rien n'est réimplémenté en JavaScript, donc rien ne se casse — ni la
   tabulation, ni le sélecteur du système, ni le dépôt.

   Conséquence à ne pas oublier : la liste des fichiers choisis vit
   DEHORS, sous la zone. Placée dedans, elle serait recouverte par le
   champ et ses croix deviendraient inatteignables. */
.depot {
    position: relative;
    border: 2px dashed var(--line-strong);
    border-radius: 12px;
    background: #fbfcfe;
    transition: border-color .12s, background .12s;
}
.depot:hover { border-color: var(--brand); background: #f7f9ff; }
.depot-survol {
    border-color: var(--brand); background: #eef3ff;
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .03);
}
.depot-rempli { border-style: solid; border-color: var(--line-strong); background: var(--card); }

.depot-coeur { padding: 22px 16px; text-align: center; pointer-events: none; }
.depot-icone { font-size: 22px; line-height: 1; color: var(--brand); margin-bottom: 8px; }
.depot-titre { font-size: 14px; font-weight: 600; color: var(--ink); }
.depot-ou { font-weight: 400; color: var(--ink-2); }
.depot-consigne { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Le champ par-dessus tout, invisible mais bien là. « opacity: 0 »
   et non « display: none » : un champ retiré du rendu ne reçoit plus
   ni clic, ni dépôt, ni focus clavier. */
input[type=file].depot-champ {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    padding: 0; margin: 0; border: 0; background: none;
    opacity: 0; cursor: pointer;
}
/* Le contour de focus doit rester visible : c'est le seul repère de
   celui qui navigue au clavier. */
input[type=file].depot-champ:focus-visible + .depot-coeur,
.depot:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

.depot-liste { margin-top: 10px; }
.depot-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border: 1px solid var(--line);
    border-radius: 8px; background: var(--card);
    margin-bottom: 6px; font-size: 13px;
}
.depot-item-ko { border-color: var(--bad); background: #fff7f7; }
.depot-nom {
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--ink);
}
.depot-taille {
    flex: 0 0 auto; color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.depot-pourquoi { flex: 0 0 auto; color: var(--bad); font-size: 12px; }
.depot-retirer {
    flex: 0 0 auto;
    width: 24px; height: 24px; padding: 0;
    border: 1px solid var(--line-strong); border-radius: 6px;
    background: var(--card); color: var(--ink-2);
    font-size: 16px; line-height: 1; cursor: pointer;
}
.depot-retirer:hover { border-color: var(--bad); color: var(--bad); }
.depot-bilan { font-size: 12px; color: var(--muted); margin-top: 4px; }
.depot-bilan-ko { color: var(--bad); font-weight: 600; }

@media (max-width: 640px) {
    .depot-coeur { padding: 16px 12px; }
    .depot-pourquoi { display: none; }   /* la bordure rouge suffit à l'écran étroit */
}

/* ------------------------------------------------------------------
   Listes repliables d'un rapprochement.

   Les quatre listes de détail déroulées d'un bloc faisaient une page de
   plusieurs mètres : pour relire l'écart en haut après avoir regardé
   une ligne, il fallait remonter au travers de deux mille autres.

   Elles se replient donc, et leur titre porte ce qu'il faut pour
   décider d'ouvrir : le nombre de lignes et, quand il y a de l'argent
   en jeu, le montant. Les deux listes qui demandent une décision sont
   ouvertes d'emblée ; les deux autres, qui n'apprennent rien d'autre
   que « c'est normal », restent fermées.
   ------------------------------------------------------------------ */
.liste-detail > summary {
    cursor: pointer; user-select: none; list-style: none;
    display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
    padding: 2px 0 2px 22px; position: relative;
}
.liste-detail > summary::-webkit-details-marker { display: none; }
/* Le chevron est dessiné plutôt que pris dans une police : il tourne à
   l'ouverture, ce qui dit l'état sans qu'on ait à lire. */
.liste-detail > summary::before {
    content: ''; position: absolute; left: 2px; top: .55em;
    width: 0; height: 0; border-left: 6px solid var(--ink-2);
    border-top: 5px solid transparent; border-bottom: 5px solid transparent;
    transition: transform .15s ease; transform-origin: 25% 50%;
}
.liste-detail[open] > summary::before { transform: rotate(90deg); }
/* Le h2 d'une carte porte un filet sous le texte. Rendu en ligne dans
   un titre repliable, ce filet s'arrête au milieu de la ligne, juste
   avant le décompte : il ne souligne plus rien et ressemble à un
   défaut. On le retire ici, et nulle part ailleurs. */
.liste-detail > summary h2 {
    display: inline; margin: 0; border: 0; padding-bottom: 0;
}
.liste-detail > summary .compte {
    font-size: 13px; color: var(--muted); white-space: nowrap;
}
.liste-detail > summary:hover .compte { color: var(--ink-2); }

/* Un bouton qui agit comme un lien : la suppression tient dans une
   colonne d'actions au milieu de vrais liens, et doit leur ressembler
   sans se faire passer pour anodine. */
.lien-danger {
    background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
    color: var(--bad); text-decoration: underline;
}
.lien-danger:hover { opacity: .78; }

/* ------------------------------------------------------------------
   Le détail d'une journée, ouvert d'un clic sur sa date.

   Savoir que l'écart est le 10 ne sert à rien si l'on ne peut pas voir
   lesquelles. La ligne de détail est repliée par défaut — trente
   journées dépliées redonneraient la page-fleuve qu'on vient de
   supprimer.
   ------------------------------------------------------------------ */
tr.jour-ouvrable { cursor: pointer; }
tr.jour-ouvrable:hover > td { background: #f4f6f9; }
tr.jour-ouvrable .chevron {
    display: inline-block; color: var(--muted); font-size: 11px;
    transition: transform .15s ease; margin-right: 2px;
}
tr.jour-detail { display: none; }
tr.jour-detail.ouvert { display: table-row; }
tr.jour-detail > td { background: #fbfcfd; padding: 14px 10px; }
.jour-colonnes {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}
.jour-colonnes h4 {
    font-size: 13px; font-weight: 700; margin: 0 0 8px;
    padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.jour-colonnes h4 .hint { font-weight: 400; margin-left: 6px; }
/* Les montants en colonnes : vingt lignes tiennent alors sur quatre
   centimètres au lieu de vingt, et l'œil compare au lieu de défiler. */
ul.montants {
    list-style: none; margin: 0; padding: 0;
    columns: 110px; column-gap: 16px;
}
ul.montants li {
    font-variant-numeric: tabular-nums; font-size: 13px;
    padding: 1px 0; break-inside: avoid;
}
/* Le point de vente, à l'intérieur d'une colonne. Discret : c'est un
   repère, pas un titre — le titre de la colonne dit déjà de quel côté
   on est. Mais il porte son compte et son total, parce que c'est
   justement ce qu'on vient chercher. */
.pdv-sous-titre {
    font-size: 12px; font-weight: 600; margin: 10px 0 4px;
    color: var(--text-2, #5b6472);
}
.pdv-sous-titre:first-child { margin-top: 0; }
.pdv-sous-titre .hint { font-weight: 400; margin-left: 4px; }
ul.montants + .pdv-sous-titre { margin-top: 12px; }

/* ------------------------------------------------------------------
   L'état des données (tableau de bord)
   Un tableau de phrases, pas de chiffres : tout est aligné à gauche,
   et le détail peut aller à la ligne. Le nom de l'hôtel ne se coupe
   pas, et la colonne d'état non plus — ce sont les deux repères.
   ------------------------------------------------------------------ */
.etat-cadre { overflow-x: auto; }
.etat-table th, .etat-table td { text-align: left; vertical-align: top; white-space: normal; }
.etat-table td:first-child { white-space: nowrap; font-weight: 600; }
.etat-table td:nth-child(2) { white-space: nowrap; color: var(--muted); }
.etat-table td:nth-child(3) { white-space: nowrap; }
.etat-table td:last-child { width: 100%; }
.etat-table td:last-child a { text-decoration: none; }
.etat-table td:last-child a:hover { text-decoration: underline; }
.etat-table tr.etat-ok td:last-child strong { font-weight: 500; }
.etat-table .hint { margin-top: 0; }
/* Sur un téléphone, quatre colonnes ne tiennent pas : chaque ligne
   devient un petit bloc — hôtel, puis « source · état », puis le
   détail. Même contenu, même ordre. */
@media (max-width: 720px) {
    .etat-table thead { display: none; }
    .etat-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .etat-table tr:hover { background: transparent; }
    .etat-table td { display: inline; padding: 0; border: 0; white-space: normal; }
    .etat-table td:first-child { display: block; margin: 8px 0 4px; font-size: 15px; }
    .etat-table td:first-child:empty { display: none; }
    .etat-table td:nth-child(2)::after { content: " · "; }
    .etat-table td:last-child { display: block; margin-top: 3px; }
}

/* ------------------------------------------------------------------
   Décade : le choix de la période tient sur une ligne, les exports
   sont dans le titre de la même carte, et les listes de dates des
   bandeaux sont repliées — le bandeau dit combien, la liste dit
   lesquelles, et l'on n'ouvre la seconde que pour aller les saisir.
   ------------------------------------------------------------------ */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { flex: 1 1 150px; display: flex; flex-direction: column; margin: 0; }
.filters .field:last-child { flex: 0 0 auto; }
.filters .field > label { margin-bottom: 6px; }
.card h2 .titre-actions { float: right; display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.card h2 .titre-actions .btn { padding: 6px 12px; font-size: 13px; }
.alert .dates-pliees { margin-top: 6px; }
.alert .dates-pliees > summary { cursor: pointer; font-weight: 600; text-decoration: underline; list-style: none; }
.alert .dates-pliees > summary::-webkit-details-marker { display: none; }
.alert .dates-pliees[open] > summary { margin-bottom: 4px; }
table.compacte th, table.compacte td { padding: 7px 11px; }
.pf-mois { margin-top: 10px; }
.pf-mois > summary { margin-bottom: 8px; }
.pf-mois:not([open]) > summary { margin-bottom: 0; }
@media (max-width: 720px) {
    .card h2 .titre-actions { float: none; display: flex; margin-top: 8px; }
}

/* La liste des migrations (admin) : des phrases, pas des chiffres. */
table.migrations th, table.migrations td { text-align: left; white-space: normal; vertical-align: top; }
table.migrations td:first-child, table.migrations td:nth-child(3), table.migrations td:nth-child(4) { white-space: nowrap; }
table.migrations td:nth-child(2) { width: 100%; }
@media (max-width: 720px) {
    table.migrations td:first-child { white-space: normal; }
}

/* ------------------------------------------------------------------
   Les écarts à expliquer (cartes) : une ligne par transaction seule,
   et dans la dernière colonne soit la justification posée, soit le
   formulaire pour la poser — raison, commentaire, un bouton.
   ------------------------------------------------------------------ */
table.justif th, table.justif td { text-align: left; white-space: normal; vertical-align: top; }
table.justif td.num { text-align: right; }
table.justif tr.justif-source td { background: var(--plane); padding-top: 12px; }
table.justif tr.expliquee td { color: var(--muted); }
table.justif tr.expliquee td.num { color: var(--muted); }
table.justif tr.a-traiter td:last-child { background: #fff8e6; }
table.justif td:last-child { width: 42%; }
.justif-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.justif-form select { width: auto; flex: 0 1 160px; min-width: 110px; padding: 5px 6px; font-size: 13px; }
.justif-form input[type=text] { width: auto; flex: 1 1 100px; min-width: 80px; max-width: 170px; padding: 5px 6px; font-size: 13px; }
.justif-form .btn-small { padding: 5px 10px; white-space: nowrap; }
table.justif td { padding-top: 6px; padding-bottom: 6px; }
table.justif td:last-child { width: 44%; }
table.justif td:nth-child(5) { min-width: 130px; }
.justif-badge { display: inline; }
.justif-badge.a_traiter strong { color: #9a6700; }
.justif-actions { margin-left: 6px; white-space: nowrap; }
.btn-link { background: transparent; border: none; color: var(--muted); text-decoration: underline; padding: 4px 6px; }
@media (max-width: 720px) {
    table.justif thead { display: none; }
    table.justif tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
    table.justif td { display: inline-block; border: 0; padding: 2px 6px 2px 0; }
    table.justif td:last-child { display: block; width: auto; margin-top: 4px; }
    table.justif tr.justif-source td { display: block; }
}

/* Maintenance : le statut d'un contrôle, et le formulaire replié d'une visite */
.mt-statut { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.mt-visite-row > td { background: var(--plane); padding: 12px 14px; }
.mt-visite-form { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 8px 12px; align-items: end; }
.mt-visite-form .mt-visite-titre { grid-column: 1 / -1; }
.mt-visite-form label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; margin: 0; gap: 4px; }
.mt-visite-form .mt-large { grid-column: span 2; }
.mt-visite-form input, .mt-visite-form select { padding: 6px 8px; font-size: 13px; width: 100%; }
.mt-visite-form .mt-visite-boutons { grid-column: 1 / -1; display: flex; gap: 8px; }
@media (max-width: 720px) { .mt-visite-form { grid-template-columns: 1fr 1fr; } }
table.mt-cal th, table.mt-cal td { text-align: left; white-space: normal; vertical-align: top; }
table.mt-cal td:first-child { min-width: 140px; }
table.mt-cal td:nth-child(2) { min-width: 150px; }
table.mt-cal td:nth-child(3) { white-space: nowrap; }
table.mt-cal td:last-child { min-width: 110px; }
.mt-visite-form { position: relative; }

/* ============================================================
   DASHBOARD RM
   ============================================================ */
.rm-cadre { max-height: 78vh; overflow: auto; }
table.rm-table { font-size: 12px; white-space: nowrap; }
table.rm-table th, table.rm-table td { padding: 5px 7px; text-align: right; }
table.rm-table thead th { position: sticky; top: 0; background: var(--card); z-index: 2; }
table.rm-table thead tr.rm-groupes th { top: 0; }
table.rm-table thead tr:nth-child(2) th { top: 29px; }
table.rm-table th.rm-g { text-align: center; border-bottom: 2px solid var(--line); border-left: 1px solid var(--line); color: var(--ink-2); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
table.rm-table td.rm-fixe, table.rm-table th.rm-fixe { position: sticky; left: 0; background: var(--card); z-index: 1; text-align: left; }
table.rm-table thead th.rm-fixe { z-index: 3; }
table.rm-table tr.rm-we td { background: #f7f8fb; }
table.rm-table tr.rm-we td.rm-fixe { background: #f7f8fb; }
table.rm-table tr.rm-auj td { border-top: 2px solid var(--brand); }
table.rm-table td.rm-ev { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
table.rm-table td.rm-comm { white-space: normal; min-width: 180px; max-width: 320px; }
table.rm-table .rm-mention { color: var(--muted); font-style: italic; font-size: 11px; }
.rm-to-plein { background: #dff4e3; } .rm-to-haut { background: #eef8e6; } .rm-to-moyen { background: #fff6dc; } .rm-to-bas { background: #fde9e4; }
.rm-crayon { text-decoration: none; color: var(--muted); margin-left: 4px; }
.rm-comm-form { display: flex; flex-direction: column; gap: 4px; }
.rm-comm-form input { padding: 4px 6px; font-size: 12px; }
table.rm-lectures td, table.rm-lectures th { text-align: center; }
table.rm-lectures tr.rm-refus td { opacity: .7; }
.rm-etat .tile .k strong { color: var(--ink); }
@media (max-width: 700px) { .rm-cadre { max-height: none; } }

/* ============================================================
   CAISSE
   ============================================================ */
.cs-cadre { max-height: 78vh; overflow: auto; }
table.cs-table { font-size: 12px; white-space: nowrap; }
table.cs-table th, table.cs-table td { padding: 5px 7px; text-align: right; }
table.cs-table thead th { position: sticky; top: 0; background: var(--card); z-index: 2; }
table.cs-table thead tr:nth-child(2) th { top: 29px; }
table.cs-table th.cs-g { text-align: center; border-bottom: 2px solid var(--line); border-left: 1px solid var(--line); color: var(--ink-2); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
table.cs-table td.cs-fixe, table.cs-table th.cs-fixe { position: sticky; left: 0; background: var(--card); z-index: 1; text-align: left; }
table.cs-table thead th.cs-fixe { z-index: 3; }
table.cs-table tr.cs-we td { background: #f7f8fb; }
table.cs-table tr.cs-absent td { color: var(--muted); }
table.cs-table tr.cs-total td { font-weight: 700; border-top: 2px solid var(--line); background: #f3f5f9; }
table.cs-table td.cs-lib { min-width: 180px; }
table.cs-table .cs-autres { white-space: normal; max-width: 220px; display: inline-block; text-align: right; }
.cs-lib-form { display: flex; gap: 4px; }
.cs-lib-form input { padding: 3px 6px; font-size: 12px; width: 150px; }

/* ============================================================
   CARTES — LE VERDICT EN TROIS QUESTIONS, LE DÉTAIL REPLIÉ
   ============================================================ */
details.cb-detail { margin: 0 0 22px; }
details.cb-detail > summary { list-style: none; cursor: pointer; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 22px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
details.cb-detail > summary::-webkit-details-marker { display: none; }
details.cb-detail > summary::before { content: '▸'; color: var(--muted); font-size: 14px; }
details.cb-detail[open] > summary::before { content: '▾'; }
details.cb-detail > summary h2 { display: inline; margin: 0; font-size: 17px; }
details.cb-detail > summary .compte { font-size: 13px; color: var(--muted); }
details.cb-detail[open] > summary { margin-bottom: 16px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
details.cb-detail > .card:first-of-type { border-top-left-radius: 0; border-top-right-radius: 0; }
table.cb-questions { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.cb-questions td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: top; font-size: 15px; text-align: left; }
table.cb-questions td.cb-picto { width: 34px; font-size: 18px; text-align: center; }
table.cb-questions tr.cb-q-ko td { background: #fff6f4; }
table.cb-questions tr.cb-q-ok td { background: #f3faf4; }
table.cb-questions tr.cb-q-non td { color: var(--muted); }
.card.cb-verdict .actions .btn { margin-right: 6px; }

/* ============================================================
   ACCUEIL — une carte par marque, à ses couleurs
   La couleur principale (--m) est lisible en texte sur blanc ; l'accent
   (--m2) ne sert qu'au filet du haut.
   ============================================================ */
.marques { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; margin-bottom: 22px; }
.marque-carte {
    display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    border-top: 5px solid var(--m); padding: 16px 18px 12px; color: var(--ink); text-decoration: none;
    box-shadow: inset 0 3px 0 -1px var(--m2);
}
.marque-carte:hover { border-color: var(--m); }
.marque-tete { display: flex; align-items: center; gap: 10px; min-height: 34px; flex-wrap: wrap; }
.marque-tete .badge { margin-left: auto; }
.marque-nom { font-weight: 800; font-size: 16px; color: var(--m); }
.marque-logo { height: 58px; max-width: 150px; width: auto; display: block; object-fit: contain; }
.marque-grand { font-size: 30px; font-weight: 800; color: var(--m); margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.marque-grand small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.marque-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.marque-table td { padding: 5px 0; border-bottom: 1px solid var(--line); text-align: left; }
.marque-table td.num { text-align: right; padding-left: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.marque-table tr.sep td { color: var(--ink-2); }
.marque-table th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; padding: 0 0 4px; border-bottom: 1px solid var(--line-strong); background: none; text-align: left; }
.marque-table th.num { text-align: right; padding-left: 10px; }
.marque-pied { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.a-traiter-liste { list-style: none; margin: 0; padding: 0; }
.a-traiter-liste li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); }
.a-traiter-liste li:last-child { border-bottom: none; }
.a-traiter-liste a { font-weight: 600; }

/* ============================================================
   MENU — la recherche
   ============================================================ */
.nav-search { padding: 4px 16px 10px; }
.nav-search input {
    width: 100%; padding: 8px 11px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.08); color: #fff; font: inherit; font-size: 13.5px;
}
.nav-search input::placeholder { color: var(--nav-muted); }
.nav-search input:focus { outline: 2px solid rgba(255,255,255,.45); outline-offset: 1px; }

/* ============================================================
   TABLEAUX — l'en-tête reste visible en faisant défiler
   Un grand tableau défile dans son cadre (au plus les trois quarts de
   l'écran), et ses en-têtes restent en haut.
   ============================================================ */
.table-large { max-height: 78vh; overflow: auto; }
.table-large thead th { position: sticky; top: 0; z-index: 2; background: var(--plane); }
.table-large thead tr:nth-child(2) th { top: 38px; }

/* Productivité : un jour à plus de 10 % de son repère */
td.prod-bien { background: #e8f5e9; color: #14532d; font-weight: 600; }
td.prod-mal  { background: #fdecec; color: #8a1c1c; font-weight: 600; }

/* Coût du personnel : un ratio jusqu'à 10 % au-dessus de l'objectif */
.pc-limite { color: #b45309; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================================
   MENU — par métier, repliable, plus lisible (novembre 2026)
   Une colonne d'icônes, une colonne de texte ; le texte en blanc
   cassé plutôt qu'en gris ; la rubrique de la page ouverte dépliée,
   les autres repliées sur leur titre.
   ============================================================ */
.sidebar { --nav-ink: #e6eaf2; --nav-muted: #a3aec2; }
.nav-group { padding: 4px 10px; }
.nav-group:first-of-type { padding-top: 8px; }
.nav-group-title {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left;
    font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--nav-muted); padding: 9px 12px; border-radius: 8px;
}
.nav-group-title:disabled { cursor: default; }
.nav-group.pliable .nav-group-title:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group-title .ico { width: 22px; text-align: center; font-size: 15px; letter-spacing: 0; }
.nav-group-title .txt { flex: 1; }
.nav-group-title .chev { font-size: 18px; line-height: 1; transition: transform .15s; color: var(--nav-muted); }
.nav-group.ouvert .nav-group-title .chev { transform: rotate(90deg); }
.nav-group.ouvert .nav-group-title, .nav-group.a-actif .nav-group-title { color: #fff; }
.nav-group.pliable .nav-items { display: none; padding: 2px 0 6px; }
.nav-group.pliable.ouvert .nav-items, .sidebar.recherche .nav-group .nav-items { display: block; }
.nav-link {
    display: flex; align-items: center; gap: 10px; position: relative;
    padding: 8px 12px; margin: 1px 0; border-radius: 8px; font-size: 15px; line-height: 1.3;
    color: var(--nav-ink);
}
.nav-group.pliable .nav-link { padding-left: 20px; }
.nav-link .ico { width: 22px; flex: 0 0 22px; text-align: center; font-size: 16px; }
.nav-link .txt { flex: 1; min-width: 0; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav-link .fav { opacity: 0; font-size: 14px; color: var(--nav-muted); padding: 0 2px; cursor: pointer; transition: opacity .1s; }
.nav-link:hover .fav, .nav-link .fav:focus { opacity: 1; }
.nav-link .fav:hover { color: #fde68a; }
.nav-link .fav.on { opacity: 1; color: #fbbf24; }
.nav-group[data-id="favoris"] .nav-link .fav.on { opacity: 0; }
.nav-group[data-id="favoris"] .nav-link:hover .fav.on { opacity: 1; }
.nav-fav-info { margin: -4px 16px 6px; font-size: 12.5px; color: #fde68a; }
.nav-search input { font-size: 14px; padding: 9px 11px; }

/* Écran moyen (900 à 1199 px) : le menu se réduit à une colonne
   d'icônes, et s'ouvre en entier au survol. */
@media (min-width: 900px) and (max-width: 1199px) {
    .sidebar { transform: translateX(0); width: 64px; overflow-x: hidden; transition: width .18s ease; }
    .page { margin-left: 64px; }
    .nav-toggle, .nav-overlay { display: none; }
    .sidebar:not(:hover):not(.open) .txt,
    .sidebar:not(:hover):not(.open) .chev,
    .sidebar:not(:hover):not(.open) .fav,
    .sidebar:not(:hover):not(.open) .app-sub,
    .sidebar:not(:hover):not(.open) .nav-search,
    .sidebar:not(:hover):not(.open) .sidebar-foot,
    .sidebar:not(:hover):not(.open) .brand-row { display: none; }
    .sidebar:not(:hover):not(.open) .app-name { font-size: 0; }
    .sidebar:not(:hover):not(.open) .nav-group.pliable .nav-items { display: none; }
    .sidebar:not(:hover):not(.open) .nav-group.a-actif .nav-items { display: block; }
    .sidebar:not(:hover):not(.open) .nav-link, .sidebar:not(:hover):not(.open) .nav-group-title { padding-left: 10px; padding-right: 10px; }
    .sidebar:hover, .sidebar.open { width: 272px; box-shadow: 0 0 24px rgba(0,0,0,.35); }
}
