/* Schnaps — identité tirée du blason de Strasbourg (d'argent à la bande de gueules).
   Angles droits, filets fins, rouge seulement là où il signifie quelque chose. */

:root {
  --rouge: #E20909;
  --rouge-fonce: #9A0606;
  --rouge-pale: #FCE9E9;
  --encre: #26292E;
  --gris: #6B6E73;
  --gris-clair: #9A9DA2;
  --filet: #D8D4CC;
  --filet-doux: #E7E3DC;
  --fond: #F6F4F0;
  --surface: #FFFFFF;
  --ok: #2F6B3A;

  --titre: 'Newsreader', Georgia, serif;
  --texte: 'Hanken Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--texte); font-size: 14px; color: var(--encre); background: var(--surface); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--titre); font-weight: 600; margin: 0; }
.chiffres { font-variant-numeric: tabular-nums; }
.muet { color: var(--gris); }
svg.ico { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7;
          stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Boutons et champs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--filet);
       background: var(--surface); color: var(--encre); font: 500 13px var(--texte); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--encre); }
.btn-principal { background: var(--rouge); border-color: var(--rouge); color: #fff; font-weight: 600; }
.btn-principal:hover { background: var(--rouge-fonce); border-color: var(--rouge-fonce); }
.btn-lien { border: 0; background: none; padding: 0; color: var(--rouge-fonce); font-weight: 600; cursor: pointer; font: 600 13px var(--texte); }
.btn-lien:hover { text-decoration: underline; }
.btn-danger:hover { border-color: var(--rouge); color: var(--rouge); }

label { display: block; font-size: 12px; color: var(--gris); margin: 0 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--filet); background: var(--surface);
  font: 14px var(--texte); color: var(--encre); border-radius: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--encre); outline-offset: -1px; }
textarea { resize: vertical; min-height: 64px; }
.champ { margin-bottom: 14px; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.alerte { padding: 9px 12px; margin-bottom: 14px; border: 1px solid var(--filet); border-radius: 5px; background: var(--fond); font-size: 13px; }
.alerte-error { border-color: var(--rouge); background: var(--rouge-pale); color: var(--rouge-fonce); }
.alerte-info { border-color: var(--ok); }

/* ---------- Écran de connexion ---------- */
.porte { min-height: 100%; display: grid; place-items: center; background: var(--fond); padding: 24px; }
.porte-carte { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--filet); padding: 32px 32px 24px; }
.porte-marque { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.porte-marque img { width: 34px; }
.porte-marque h1 { font-size: 34px; line-height: 1; }
.porte-onglets { display: flex; gap: 18px; border-bottom: 1px solid var(--filet); margin-bottom: 20px; }
.porte-onglets button { border: 0; background: none; padding: 0 0 8px; font: 500 13px var(--texte); color: var(--gris);
                        cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.porte-onglets button.actif { color: var(--encre); border-color: var(--rouge); font-weight: 600; }
.porte .btn-principal { width: 100%; justify-content: center; padding: 10px; }
.porte-pied { margin-top: 16px; font-size: 12.5px; text-align: center; }
[hidden] { display: none !important; }

/* ---------- Coque de l'application ---------- */
.coque { display: flex; height: 100vh; }
.barre { width: 196px; flex-shrink: 0; border-right: 1px solid var(--filet); display: flex; flex-direction: column; background: var(--surface); }
.marque { display: flex; align-items: center; gap: 10px; padding: 18px 18px 20px; text-decoration: none; }
.marque img { width: 24px; }
.marque span { font-family: var(--titre); font-weight: 600; font-size: 27px; line-height: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--gris); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--encre); background: var(--fond); }
.nav a.actif { color: var(--rouge); background: var(--rouge-pale); font-weight: 600; }
.nav .n { margin-left: auto; font-size: 12px; color: var(--gris-clair); font-variant-numeric: tabular-nums; }
.nav a.actif .n { color: var(--rouge); }
.aujourdhui { padding: 22px 18px 0; font-size: 13px; }
.etiquette { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--gris); margin-bottom: 8px; }
.aujourdhui li { list-style: none; padding: 4px 0; line-height: 1.3; }
.aujourdhui ul { margin: 0; padding: 0; }
.aujourdhui .retard { color: var(--rouge-fonce); }
.aujourdhui a { color: inherit; text-decoration: none; display: block; }
.aujourdhui a:hover { text-decoration: underline; }
.barre-pied { margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--filet); font-size: 12.5px; color: var(--gris); }
.barre-pied a { color: var(--gris); }
.barre-pied .qui { color: var(--encre); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }

.contenu { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entete { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--filet); }
.entete h2 { font-size: 28px; flex: 1; line-height: 1; }
.entete form { display: flex; gap: 8px; }
.recherche { display: flex; align-items: center; gap: 6px; border: 1px solid var(--filet); padding: 0 10px; color: var(--gris); }
.recherche input { border: 0; padding: 7px 0; width: 200px; outline: none; }
.page { padding: 20px; overflow: auto; flex: 1; }
.flashs { padding: 12px 20px 0; }

/* ---------- Tableaux de liste ---------- */
table.liste { width: 100%; border-collapse: collapse; }
table.liste th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--gris);
                 font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--encre); }
table.liste td { padding: 10px; border-bottom: 1px solid var(--filet-doux); vertical-align: top; }
table.liste tr:hover td { background: var(--fond); }
table.liste a { text-decoration: none; font-weight: 600; }
.statut { font-size: 11.5px; font-weight: 600; }
.statut-pending { color: var(--rouge-fonce); }
.statut-disabled { color: var(--gris-clair); }
.vide { padding: 36px 0; text-align: center; color: var(--gris); }

/* ---------- Fiches ---------- */
.fiche { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0 40px; align-content: start; }
.fiche-form { grid-column: 1; }
.fiche-actions { grid-column: 1; display: flex; gap: 10px; align-items: center; }
.fiche-actions form { margin-left: auto; }
.annexes { grid-column: 2; grid-row: 1 / span 2; }
.annexe { margin-bottom: 26px; }
.annexe h3 { font-size: 21px; padding-bottom: 6px; border-bottom: 1px solid var(--encre); margin-bottom: 8px; }
.annexe-liste { list-style: none; margin: 0 0 8px; padding: 0; }
.annexe-liste li { padding: 6px 0; border-bottom: 1px solid var(--filet-doux); }
.annexe-liste a { font-weight: 600; text-decoration: none; }
.annexe-liste a:hover { color: var(--rouge-fonce); }
.journal li { font-size: 13px; }
@media (max-width: 900px) { .fiche { grid-template-columns: 1fr; } .annexes { grid-column: 1; grid-row: auto; margin-top: 30px; } }

/* ---------- Tâches ---------- */
.bascule { display: flex; border: 1px solid var(--filet); }
.bascule a { padding: 6px 12px; text-decoration: none; color: var(--gris); font-weight: 500; font-size: 13px; }
.bascule a + a { border-left: 1px solid var(--filet); }
.bascule a.actif { background: var(--encre); color: #fff; }
.ajout-tache { display: grid; grid-template-columns: minmax(0, 1fr) 150px 200px 200px auto; gap: 8px; margin-bottom: 20px; }
.case { width: 16px; height: 16px; border: 1.5px solid var(--gris); background: var(--surface); cursor: pointer; padding: 0; display: block; }
.case:hover { border-color: var(--encre); }
.case.cochee { background: var(--encre); border-color: var(--encre);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='m5 12 4 4 10-10'/%3E%3C/svg%3E"); background-size: 12px; background-repeat: no-repeat; background-position: center; }
tr.faite td { color: var(--gris-clair); text-decoration: line-through; }
tr.faite td:first-child { text-decoration: none; }
.retard { color: var(--rouge-fonce); font-weight: 600; }
@media (max-width: 900px) { .ajout-tache { grid-template-columns: 1fr; } }

/* ---------- Tableau des affaires ---------- */
.espace-tableau { flex: 1; min-height: 0; display: flex; }
.tableau { flex: 1; min-width: 0; display: flex; gap: 10px; padding: 16px 20px; background: var(--fond); overflow-x: auto; align-items: flex-start; }
.colonne { flex: 0 0 236px; display: flex; flex-direction: column; max-height: 100%; }
.colonne-tete { display: flex; align-items: baseline; gap: 8px; padding: 9px 11px; margin-bottom: 8px; }
.colonne-tete b { font-weight: 700; font-size: 13px; }
.colonne-tete .n { font-size: 12px; opacity: .72; font-variant-numeric: tabular-nums; }
.colonne-tete .total { margin-left: auto; font-size: 12px; opacity: .85; }
.cartes { min-height: 80px; flex: 1; overflow-y: auto; padding-bottom: 20px; }
.cartes.survol { outline: 1px dashed var(--gris-clair); outline-offset: -1px; }
.carte { background: var(--surface); border: 1px solid #E1DDD5; border-radius: 5px; padding: 10px 11px; margin-bottom: 7px; cursor: pointer; }
.carte:hover { border-color: var(--gris-clair); }
.carte:focus-visible { outline: 2px solid var(--encre); outline-offset: 1px; }
.carte.ouverte { border-color: var(--rouge); box-shadow: 0 0 0 1px var(--rouge); }

/* ---------- Filtres et vue tableau des affaires ---------- */
.filtres-affaires { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 20px; border-bottom: 1px solid var(--filet); }
.filtres-affaires label { margin: 0; font-size: 13px; }
.filtres-affaires select { width: auto; padding: 6px 28px 6px 10px; font-size: 13px; border-radius: 0; }
.filtres-affaires .recherche input { width: 190px; }
.filtres-affaires select { max-width: 150px; }
.case-filtre { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.case-filtre input { width: auto; margin: 0; }
.tableau-liste { display: block; background: var(--surface); }
.liste-affaires th[data-tri] { cursor: pointer; user-select: none; white-space: nowrap; }
.liste-affaires th[aria-sort="ascending"]::after { content: " ↑"; }
.liste-affaires th[aria-sort="descending"]::after { content: " ↓"; }
.liste-affaires .num { text-align: right; }
.liste-affaires .fort { font-weight: 600; }
.liste-affaires td { white-space: nowrap; }
.liste-affaires td.fort { white-space: normal; min-width: 180px; }
tr.ligne-affaire { cursor: pointer; }
tr.ligne-affaire.ouverte td { background: var(--rouge-pale); }
tr.ligne-affaire.ouverte td:first-child { box-shadow: inset 2px 0 0 var(--rouge); }
.carte.urgente { box-shadow: inset 3px 0 0 var(--rouge); }
.carte.urgente.ouverte { box-shadow: inset 3px 0 0 var(--rouge), 0 0 0 1px var(--rouge); }
.requis { color: var(--rouge); }
.aide-transaction { margin: -8px 0 14px; }
.rappel-devis { margin: 8px 0; }
@media (max-width: 1500px) { .liste-affaires .col-ville { display: none; } }
.pastille-etape { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 600; }
@media (max-width: 700px) {
  .entete { flex-wrap: wrap; padding: 12px 16px; }
  .entete h2 { flex-basis: 100%; }
  .filtres-affaires { padding: 10px 16px; }
  .filtres-affaires .recherche { flex: 1 1 100%; }
  .filtres-affaires .recherche input { width: 100%; }
  .tableau-liste { padding: 12px 16px; }
}
.carte.tiree { opacity: .45; }
.carte-titre { font-weight: 600; font-size: 14px; line-height: 1.25; }
.carte-client { color: var(--gris); font-size: 12.5px; margin-top: 2px; }
.carte-pied { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; font-size: 12.5px; }
.carte-pied .retard { color: var(--rouge-fonce); font-weight: 600; }
.carte-pied .bientot { color: #8A6516; font-weight: 600; }

/* ---------- Panneau de détail ---------- */
.panneau { width: 360px; flex-shrink: 0; border-left: 1px solid var(--filet); overflow-y: auto; background: var(--surface); }
.panneau-corps { padding: 16px 20px 28px; }
.panneau-haut { display: flex; justify-content: space-between; align-items: center; }
.etiquette-etape { font-size: 11px; color: #8A6516; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.fermer { border: 0; background: none; color: var(--gris); cursor: pointer; padding: 4px; display: inline-flex; }
.fermer:hover { color: var(--encre); }
.panneau-titre { font-size: 30px; line-height: 1.05; margin: 4px 0 4px; }
.panneau-client a { color: var(--gris); }
.panneau-montant { font-size: 22px; font-weight: 600; margin: 14px 0 10px; }
.lignes { margin: 0 0 6px; }
.lignes > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--filet-doux); font-size: 13px; }
.lignes dt { color: var(--gris); }
.lignes dd { margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.lignes dd a { text-decoration: none; }
.lignes .btn-lien { display: inline-flex; align-items: center; gap: 5px; color: var(--rouge); text-decoration: none; }
.panneau-section { border-top: 1px solid var(--encre); margin-top: 18px; padding-top: 10px; }
.panneau-section h4, .panneau-section summary { font-family: var(--titre); font-size: 20px; font-weight: 600; margin: 0 0 8px; cursor: default; }
.panneau-section summary { cursor: pointer; list-style: none; }
.panneau-section summary::after { content: "+"; float: right; font-family: var(--texte); font-weight: 400; color: var(--gris); }
.panneau-section[open] summary::after { content: "–"; }
.panneau-section textarea { margin-bottom: 8px; }
.taches-panneau, .notes, .historique { list-style: none; margin: 0 0 10px; padding: 0; }
.taches-panneau li { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; }
.taches-panneau li span:last-child { margin-left: auto; font-size: 12px; }
.taches-panneau li.faite span:first-of-type { text-decoration: line-through; color: var(--gris-clair); }
.ajout-ligne { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.ajout-ligne input[type=text] { grid-column: 1 / -1; }
.notes li { padding: 8px 0; border-bottom: 1px solid var(--filet-doux); font-size: 13px; white-space: pre-wrap; }
.note-meta { font-size: 11.5px; margin-bottom: 2px; }
.historique li { font-size: 12.5px; padding: 4px 0; }
.supprimer-affaire { margin-top: 14px; }
.petit { font-size: 12.5px; }

/* ---------- Fenêtre « Nouvelle affaire » ---------- */
.dialogue { border: 1px solid var(--encre); padding: 0; width: min(480px, calc(100vw - 32px)); }
.dialogue::backdrop { background: rgba(38, 41, 46, .35); }
.dialogue form { padding: 20px 22px; }
.dialogue-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.dialogue-tete h3 { font-size: 26px; }
.dialogue-contact { width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.dialogue-contact.dialogue-fiche { width: min(1040px, calc(100vw - 32px)); padding: 20px 22px; }
.fenetre-fiche-tete { gap: 16px; }
.fenetre-fiche-tete h3 { flex: 1; }
.fenetre-fiche .annexes { max-height: none; }
.dialogue-fiche .dialogue-pied { border-top: 1px solid var(--filet-doux); padding-top: 14px; }
.dialogue-fiche .fenetre-supprimer { margin-right: auto; }
.dialogue-fiche form { padding: 0; }
@media (max-width: 900px) { .fenetre-fiche { grid-template-columns: 1fr; } .fenetre-fiche .annexes { grid-column: 1; grid-row: auto; margin-top: 20px; } }
.dialogue-pied { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.choix-client { position: relative; }
.cc-resultats { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; list-style: none; margin: -1px 0 0; padding: 0;
                background: var(--surface); border: 1px solid var(--encre); max-height: 240px; overflow-y: auto; }
.cc-resultats li { padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.cc-resultats li span { font-size: 12px; color: var(--gris); }
.cc-resultats li:hover, .cc-resultats li:focus { background: var(--rouge-pale); outline: none; }
.cc-aide { margin: 4px 0 0; }

/* ---------- Statistiques ---------- */
.stats { width: 100%; }
.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
.duo .bloc-graphique { display: flex; flex-direction: column; }
@media (max-width: 1180px) { .duo { grid-template-columns: 1fr; } }
.tuiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.tuile { border: 1px solid var(--filet); border-radius: 5px; padding: 14px 16px; }
.tuile-titre { font-size: 12.5px; color: var(--gris); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.tuile-valeur { font-family: var(--titre); font-size: 38px; font-weight: 600; line-height: 1.1; margin: 6px 0 2px; }
.tuile-detail { font-size: 13px; color: var(--gris); }
.pastille { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.bloc-graphique { margin-bottom: 32px; }
.bloc-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--encre); padding-bottom: 6px; margin-bottom: 6px; }
.bloc-tete h3 { font-size: 22px; }
.legende { display: flex; gap: 16px; font-size: 13px; }
.legende span { display: flex; align-items: center; gap: 6px; }
.graphique { position: relative; margin-top: 8px; }
.graphique svg { width: 100%; height: auto; display: block; }
.graphique .grille { stroke: var(--filet-doux); stroke-width: 1; }
.graphique .grille.base { stroke: var(--filet); }
.graphique .axe { font: 11px var(--texte); fill: var(--gris); font-variant-numeric: tabular-nums; }
.graphique .barre-gagne { fill: #C41E1E; }
.graphique .barre-perdu { fill: #4A7FB8; }
.graphique .cible { fill: transparent; }
.graphique g.mois.survol .cible { fill: var(--fond); }
.infobulle { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--encre); padding: 8px 10px; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.infobulle b { display: block; margin-bottom: 4px; }
.infobulle div { display: flex; align-items: center; gap: 6px; }
.vue-tableau { margin-top: 10px; font-size: 13px; }
.vue-tableau summary { cursor: pointer; color: var(--gris); }
td.d, th.d { text-align: right; }

.grille-cp { display: grid; grid-template-columns: 110px 1fr; gap: 0 12px; }
.panneau-marge { font-size: 13px; margin: -4px 0 10px; }
.carte-ville { color: var(--gris-clair); font-size: 12px; margin-top: 1px; }
.carte-france { height: 352px; border: 1px solid var(--filet); border-radius: 5px; margin-top: 8px; z-index: 0; }
.filtres-carte label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--encre); cursor: pointer; }
.pastille-creuse { background: #fff; border: 2px solid var(--encre); width: 10px; height: 10px; }
.bulle-carte { font: 13px var(--texte); min-width: 190px; }
.bulle-carte b { display: block; font-size: 14px; margin-bottom: 2px; }
.bulle-carte div { margin-top: 3px; font-variant-numeric: tabular-nums; }
.bulle-carte a { display: inline-block; margin-top: 8px; color: var(--rouge-fonce); font-weight: 600; }
.lignes .lien-adresse { color: var(--encre); text-decoration: underline; text-decoration-color: var(--filet); text-underline-offset: 3px; }
.lignes .lien-adresse:hover { text-decoration-color: var(--encre); }
/* Fond de carte en retrait : seuls les points d'affaire portent la couleur. */
.carte-france .leaflet-tile-pane { filter: grayscale(1) contrast(.85) brightness(1.08); }
.leaflet-container .bulle-carte a { color: var(--rouge-fonce); }
.epingle { background: none; border: 0; filter: drop-shadow(0 1px 1.5px rgba(38, 41, 46, .35)); }

/* ---------- Exercices (1er octobre au 30 septembre) ---------- */
.choix-exercice { display: flex; align-items: center; gap: 8px; }
.choix-exercice label { margin: 0; font-size: 13px; }
.choix-exercice select { width: auto; padding: 6px 28px 6px 10px; font-size: 13px; font-weight: 600; border-radius: 0; }
.bandeau-exercice { padding: 9px 20px; background: var(--rouge-pale); color: var(--rouge-fonce); font-size: 13px; border-bottom: 1px solid var(--filet); }
.bandeau-exercice a { font-weight: 600; margin-left: 6px; }
@media (max-width: 1000px) { .tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Fiche entreprise : SIRET et domaine ---------- */
.ligne-siret { display: flex; gap: 8px; }
.ligne-siret input { flex: 1; min-width: 0; }
.ligne-siret .btn { white-space: nowrap; }
.rattacher-domaine { margin-top: 14px; }
.rattacher-domaine p { margin: 0 0 6px; }
@media (max-width: 700px) { .ligne-siret { flex-direction: column; } }

/* ---------- Personnes : barre Google Contacts ---------- */
.barre-google { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 20px; border-bottom: 1px solid var(--filet); font-size: 13px; }
.barre-google > span:first-child { flex: 1 1 320px; }
.barre-google form { margin: 0; }
@media (max-width: 700px) { .barre-google { padding: 10px 16px; } }
