/* Bona & Bally — suivi de chantier
   Identité éditoriale suisse : papier blanc cassé, encre noire, un seul accent
   terre cuite pour l'urgence. Filets fins pour les répétitions, filets d'encre
   pour l'ossature des sections. Chiffres et dates en chasse fixe tabulaire —
   registre « plan d'architecte ». */

:root {
    /* Surfaces et encres */
    --papier:      #FBFAF8;
    --surface:     #FFFFFF;
    --encre:       #111111;
    --texte:       #33312E; /* 11.6:1 sur papier — AAA */
    --gris:        #6B6B6B; /*  5.1:1 sur papier — AA */
    --filet:       #E3E0DA;

    /* Accents — tous AA sur --papier */
    --terre:       #B14A25; /* 5.2:1 — retard, urgence */
    --terre-fond:  #F8EFEA;
    --ambre:       #9A6A16; /* 4.5:1 — échéance proche */
    --ambre-fond:  #FAF4E8;
    --vert:        #2F6B45; /* 6.1:1 — fait, atteint */
    --vert-fond:   #EDF3EE;

    /* Mesures */
    --maxw:        1180px;
    --gouttiere:   clamp(20px, 4vw, 48px);
    --radius:      2px;

    /* Graisses */
    --sans:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --display: "Inter Display", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono:    "Noto Sans Mono", "DejaVu Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--texte);
    background: var(--papier);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Focus visible partout : la navigation clavier doit rester lisible. */
:focus-visible {
    outline: 2px solid var(--terre);
    outline-offset: 2px;
    border-radius: var(--radius);
}

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Lien d'évitement, révélé au focus clavier. */
.saut-contenu {
    position: absolute; left: -9999px; top: 0; z-index: 10;
    background: var(--encre); color: var(--papier);
    padding: 10px 16px; font-size: 13px;
}
.saut-contenu:focus { left: 0; }

/* Chasse fixe pour tout ce qui se lit en colonne : dates, écarts, compteurs. */
.mono, .stat-valeur, .compteur, .ligne-jours, .tableau .num,
.entete-date, .frise-date, .mail-meta {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.meta { color: var(--gris); font-size: 13px; }
.retard { color: var(--terre); }
.ok { color: var(--vert); }
.attention { color: var(--ambre); }
.vide { color: var(--gris); padding: 20px 0; }

/* ============================== Navigation ============================== */

.nav {
    background: var(--papier);
    border-bottom: 1px solid var(--encre);
    position: sticky; top: 0; z-index: 5;
}
.nav-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--gouttiere);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px 32px;
    flex-wrap: wrap;
}
.marque {
    display: flex; align-items: baseline; gap: 10px;
    padding: 20px 0 16px;
    white-space: nowrap;
}
.marque-nom {
    font-family: var(--display);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -.01em;
    color: var(--encre);
}
.marque:hover { text-decoration: none; }
.marque-sub {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .06em;
    color: var(--gris);
    text-transform: uppercase;
}
.nav-liens {
    display: flex; align-items: baseline; gap: 26px; flex-wrap: wrap;
}
.nav-liens a {
    font-size: 13px;
    color: var(--gris);
    padding: 4px 0;
    border-bottom: 1px solid transparent;
    transition: color .12s, border-color .12s;
}
.nav-liens a:hover { color: var(--encre); text-decoration: none; }
.nav-liens a.actif {
    color: var(--encre);
    border-bottom-color: var(--terre);
}
.form-inline { display: inline; }

/* ============================== Structure ============================== */

.page {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: clamp(32px, 5vw, 64px) var(--gouttiere) 80px;
    width: 100%;
    flex: 1;
}
.pied {
    border-top: 1px solid var(--filet);
    color: var(--gris);
    font-size: 12px;
}
.pied-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 20px var(--gouttiere);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px 24px;
    flex-wrap: wrap;
}
/* Signature discrète : le logo porte la marque, le texte reste en gris de méta. */
.pied-signature {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gris);
    white-space: nowrap;
}
.pied-signature img {
    display: block;
    border-radius: 3px;
}
.pied-signature-nom {
    color: var(--gris);
    transition: color .15s ease;
}
.pied-signature-nom em { font-style: normal; }
.pied-signature:hover { text-decoration: none; }
.pied-signature:hover .pied-signature-nom { color: var(--encre); }

/* En-tête de page : titre éditorial, actions à droite. */
.entete {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px 32px;
    flex-wrap: wrap;
    margin-bottom: clamp(28px, 4vw, 44px);
}
.entete-texte { max-width: 720px; }
h1 {
    font-family: var(--display);
    font-size: clamp(28px, 3.4vw, 42px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -.022em;
    color: var(--encre);
}
.entete-meta {
    margin-top: 10px;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--gris);
}
.entete-desc {
    margin-top: 14px;
    max-width: 640px;
    color: var(--texte);
}
.entete-actions {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    padding-bottom: 4px;
}

/* Section : le filet d'encre fait l'ossature, le filet gris ne fait que répéter. */
.bloc { margin-bottom: clamp(36px, 5vw, 60px); }
.titre-bloc {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--encre);
    padding-top: 10px;
    margin-bottom: 4px;
}
.titre-bloc-texte {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--gris);
}
.titre-bloc .compteur {
    font-size: 12px;
    color: var(--gris);
}

/* ============================== Rappels ============================== */

/* Bandeau de synthèse : le retard d'abord, en gros, en chasse fixe. */
.synthese {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px 40px;
    flex-wrap: wrap;
    border-top: 1px solid var(--encre);
    padding-top: 18px;
    margin-bottom: clamp(32px, 5vw, 56px);
}
.synthese-principal { display: flex; align-items: baseline; gap: 14px; }
.synthese-chiffre {
    font-family: var(--display);
    font-size: clamp(44px, 7vw, 76px);
    font-weight: 500;
    line-height: .9;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    color: var(--encre);
}
.synthese-chiffre.zero { color: var(--gris); }
.synthese-chiffre.grave { color: var(--terre); }
.synthese-libelle {
    font-size: 15px;
    color: var(--texte);
    max-width: 15ch;
    line-height: 1.3;
}
.synthese-secondaire {
    display: flex; gap: 28px; flex-wrap: wrap;
}
.synthese-item {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--gris);
}
.synthese-item b {
    color: var(--encre);
    font-weight: 500;
}

/* Ligne de rappel : titre, contexte, écart à droite en chasse fixe. */
.ligne {
    display: flex;
    align-items: baseline;
    gap: 8px 20px;
    padding: 14px 0 14px 14px;
    border-bottom: 1px solid var(--filet);
    border-left: 2px solid transparent;
    flex-wrap: wrap;
}
.ligne:hover { background: var(--surface); }
.ligne.grave { border-left-color: var(--terre); }
.ligne-corps { flex: 1 1 320px; min-width: 0; }
.ligne-titre {
    font-size: 16px;
    font-weight: 500;
    color: var(--encre);
    display: block;
}
.ligne-titre:hover { text-decoration: underline; }
.ligne-meta {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    color: var(--gris);
}
.ligne-cote {
    display: flex; align-items: baseline; gap: 16px;
    flex-shrink: 0; flex-wrap: wrap;
}
.ligne-jours {
    font-size: 17px;
    font-weight: 500;
    color: var(--gris);
}
.ligne-jours.grave { color: var(--terre); }
.ligne-jours.proche { color: var(--ambre); }
.ligne-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.legende {
    display: flex; gap: 18px; flex-wrap: wrap;
    font-size: 12px; color: var(--gris);
    margin-bottom: 8px;
}

/* ============================== Statuts ============================== */

/* Pastille discrète plutôt qu'une puce encadrée : plus calme, plus lisible. */
.statut {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 11px; font-weight: 500;
    text-transform: uppercase; letter-spacing: .08em;
    white-space: nowrap;
    color: var(--gris);
}
.statut-point {
    width: 6px; height: 6px; flex-shrink: 0;
    background: var(--gris);
}
.s-avenir .statut-point { background: var(--filet); box-shadow: inset 0 0 0 1px var(--gris); }
.s-encours { color: var(--encre); }
.s-encours .statut-point { background: var(--encre); }
.s-retard { color: var(--terre); }
.s-retard .statut-point { background: var(--terre); }
.s-echeance { color: var(--ambre); }
.s-echeance .statut-point { background: var(--ambre); }
.s-fait, .s-atteint { color: var(--vert); }
.s-fait .statut-point, .s-atteint .statut-point { background: var(--vert); }

.etiquette {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--gris);
    border: 1px solid var(--filet);
    padding: 1px 7px;
    white-space: nowrap;
}

/* ============================== Boutons ============================== */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 36px;
    padding: 7px 15px;
    font-family: var(--sans);
    font-size: 13px;
    letter-spacing: .01em;
    color: var(--encre);
    background: var(--surface);
    border: 1px solid var(--encre);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, color .12s, border-color .12s;
}
.btn:hover { background: var(--encre); color: var(--papier); text-decoration: none; }
.btn-primaire { background: var(--encre); color: var(--papier); }
.btn-primaire:hover { background: var(--surface); color: var(--encre); }
.btn-danger { border-color: var(--terre); color: var(--terre); }
.btn-danger:hover { background: var(--terre); color: var(--surface); }
.btn-petit { min-height: 30px; padding: 4px 11px; font-size: 12px; }
.btn-large { width: 100%; min-height: 42px; font-size: 14px; }

.lien-btn {
    background: none; border: 0; padding: 0;
    font-family: var(--sans); font-size: 13px;
    color: var(--gris); cursor: pointer;
    text-align: left;
}
.lien-btn:hover { color: var(--encre); text-decoration: underline; text-underline-offset: 2px; }
.lien-btn.danger { color: var(--terre); }

/* ============================== Formulaires ============================== */

label, .label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--texte);
    margin-bottom: 5px;
}
.label-note { color: var(--gris); font-weight: 400; }

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="date"], input[type="number"],
input[type="search"], select, textarea {
    width: 100%;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.4;
    color: var(--encre);
    background: var(--surface);
    border: 1px solid var(--filet);
    border-radius: var(--radius);
    padding: 9px 12px;
    transition: border-color .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--gris); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--encre);
    box-shadow: 0 0 0 1px var(--encre);
}
textarea { resize: vertical; min-height: 76px; }
select { cursor: pointer; }
::placeholder { color: var(--gris); opacity: 1; }

.form { display: block; }
.form-etroit { max-width: 560px; }
.form > .label, .form > label { margin-top: 20px; }
.form > .label:first-child, .form > label:first-child { margin-top: 0; }

.rangee {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}
.rangee-champ { min-width: 160px; }
.rangee-champ.grandir { flex: 1 1 220px; }
.rangee .label { margin-bottom: 5px; }

.actions-form {
    margin-top: 28px;
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.form-en-ligne {
    display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
    margin-top: 14px;
}
.form-en-ligne .champ-libre { flex: 1 1 220px; min-width: 0; }

/* ============================== Tableaux ============================== */

/* Sur mobile le tableau défile au lieu de pousser la page. */
.tableau-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--filet);
}
.tableau {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}
.tableau th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--gris);
    padding: 9px 12px;
    border-bottom: 1px solid var(--encre);
    white-space: nowrap;
}
.tableau td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--filet);
    vertical-align: top;
}
.tableau tbody tr:hover td { background: var(--surface); }
.tableau .num { text-align: right; white-space: nowrap; }
.tableau .actions { text-align: right; white-space: nowrap; }
.tableau tr.rang-retard td:first-child { box-shadow: inset 2px 0 0 var(--terre); }
.cellule-titre { font-weight: 500; color: var(--encre); }
.cellule-note { display: block; margin-top: 3px; font-size: 13px; color: var(--gris); }

/* ============================== Onglets ============================== */

.onglets {
    display: flex; gap: 26px;
    border-bottom: 1px solid var(--filet);
    margin-bottom: 28px;
}
.onglets a {
    font-size: 13px;
    color: var(--gris);
    padding: 9px 0 12px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.onglets a:hover { color: var(--encre); text-decoration: none; }
.onglets a.actif { color: var(--encre); border-bottom-color: var(--terre); }

/* ============================== Frise des jalons ============================== */

.frise {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--encre);
    padding: 0;
}
.frise-item {
    flex: 1 0 176px;
    position: relative;
    padding: 22px 20px 16px 0;
    border-right: 1px solid var(--filet);
}
.frise-item:last-child { border-right: 0; }
.frise-point {
    position: absolute; top: -5px; left: 0;
    width: 9px; height: 9px;
    background: var(--papier);
    border: 1px solid var(--gris);
}
.frise-fait .frise-point { background: var(--vert); border-color: var(--vert); }
.frise-retard .frise-point { background: var(--terre); border-color: var(--terre); }
.frise-titre { font-size: 14px; font-weight: 500; color: var(--encre); }
.frise-fait .frise-titre { color: var(--gris); text-decoration: line-through; }
.frise-date {
    font-size: 12px;
    color: var(--gris);
    margin: 4px 0 10px;
}
.frise-etat { font-size: 12px; }
.frise-actions { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }

/* ============================== Message (relance) ============================== */

.mail {
    border: 1px solid var(--filet);
    background: var(--surface);
    max-width: 720px;
}
.mail-tete {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap;
    padding: 13px 16px;
    border-bottom: 1px solid var(--encre);
}
.mail-sujet { font-weight: 500; color: var(--encre); }
.mail-meta { font-size: 12px; color: var(--gris); }
.mail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mail-corps {
    padding: 18px 16px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    color: var(--texte);
}
.variables code {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--filet);
    padding: 1px 6px;
    white-space: nowrap;
}
.deux-colonnes {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(300px, 1fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
}

/* ============================== Flash ============================== */

.flash {
    padding: 13px var(--gouttiere);
    font-size: 14px;
    border-bottom: 1px solid var(--filet);
}
.flash-inner { max-width: var(--maxw); margin: 0 auto; }
.flash-ok { background: var(--vert-fond); color: var(--vert); }
.flash-erreur { background: var(--terre-fond); color: var(--terre); }

/* ============================== Bandeau ============================== */

/* Note de service : une règle en place, pas une alerte. Le filet d'encre à
   gauche la distingue d'un message d'erreur sans crier. */
.bandeau {
    border: 1px solid var(--filet);
    border-left: 2px solid var(--encre);
    background: var(--surface);
    padding: 12px 16px;
    margin-bottom: 22px;
    max-width: 720px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--texte);
}
.bandeau-titre {
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gris);
    margin-bottom: 4px;
}
.bandeau-alerte { border-left-color: var(--terre); background: var(--terre-fond); }
.bandeau-alerte .bandeau-titre { color: var(--terre); }
.bandeau code {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--papier);
    border: 1px solid var(--filet);
    padding: 1px 5px;
    white-space: nowrap;
}

/* ============================== Connexion ============================== */

/* Pas de héros photographique ni de dégradé : une page, un geste. */
.page-nu { padding: 0; max-width: none; }
.connexion {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    padding: clamp(32px, 6vw, 72px) var(--gouttiere);
    background:
        radial-gradient(60% 45% at 100% 0%, rgba(177, 74, 37, .05), transparent 70%),
        var(--papier);
}
.connexion-boite {
    width: 100%;
    max-width: 372px;
    margin: 0 auto;
}
.connexion-marque { margin-bottom: 8px; }
.connexion-marque-nom {
    font-family: var(--display);
    font-size: clamp(24px, 5vw, 30px);
    font-weight: 500;
    letter-spacing: -.02em;
    color: var(--encre);
    display: block;
}
.connexion-marque-sub {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--gris);
}
.connexion-titre {
    border-top: 1px solid var(--encre);
    margin-top: 22px;
    padding-top: 18px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--gris);
    margin-bottom: 22px;
}
.connexion-boite .form > label { margin-top: 18px; }
.connexion-boite .form > label:first-child { margin-top: 0; }
.connexion-pied {
    margin-top: 30px;
    padding-top: 16px;
    border-top: 1px solid var(--filet);
    font-size: 12px;
    color: var(--gris);
    line-height: 1.6;
}
.connexion-aide {
    margin-top: 18px;
    font-size: 12px;
    color: var(--gris);
}
.alerte-cookie {
    margin: 0 0 22px;
    padding: 12px 14px;
    background: var(--terre-fond);
    border-left: 2px solid var(--terre);
    font-size: 13px;
    line-height: 1.5;
    color: var(--texte);
}
.alerte-cookie b { color: var(--terre); }

/* ============================== Responsive ============================== */

@media (max-width: 820px) {
    .deux-colonnes { grid-template-columns: 1fr; }
    .entete { align-items: flex-start; }
}

@media (max-width: 620px) {
    body { font-size: 15px; }
    .nav-inner { padding-bottom: 4px; }
    .marque { padding: 16px 0 4px; }
    .nav-liens { gap: 8px 18px; padding-bottom: 10px; }
    .page { padding-top: 28px; padding-bottom: 56px; }
    .ligne { padding-left: 12px; }
    .ligne-cote { gap: 10px; }
    .synthese { gap: 20px; }
    .synthese-secondaire { gap: 20px; }
    .rangee { gap: 16px; }
    .rangee-champ { flex: 1 1 100%; min-width: 0; }
    .actions-form { flex-direction: column; align-items: stretch; }
    .actions-form .btn { width: 100%; }
    .mail-tete { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

@media print {
    .nav, .pied, .entete-actions, .form-inline { display: none; }
    body { background: #fff; }
}
