/* KG Praxis — charte KG : noir & blanc, sobre, Inter. */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("inter-latin-600-normal.woff2") format("woff2"); }

:root {
  --encre: #0A0A0A; --fond: #FFFFFF; --gris: #6B6B6B; --gris-clair: #F4F4F4;
  --filet: #E2E2E2; --filigrane: #EFEFEF;
  --rouge: #B00020; --rouge-fond: #FDECEE; --ambre-fond: #FFF6E0; --vert-fond: #EEF6EF;
  --rayon: 6px; --nav: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 "Inter", -apple-system, "Segoe UI", Arial, sans-serif; color: var(--encre);
  background: var(--fond); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gris); margin: 28px 0 10px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.sous-titre { color: var(--gris); margin: 0 0 20px; }
.muet { color: var(--gris); }
.petit { font-size: 13px; }

/* Structure */
.app { display: flex; min-height: 100vh; }
.nav { width: var(--nav); background: var(--encre); color: #fff; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; padding: 22px 14px; }
.nav .marque { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; text-decoration: none; }
.nav .marque img { width: 40px; filter: invert(1); }
.nav .marque span { font-weight: 600; letter-spacing: 0.18em; font-size: 12px; text-transform: uppercase; }
.nav a.lien { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: var(--rayon);
  text-decoration: none; color: #BDBDBD; font-weight: 500; }
.nav a.lien:hover { color: #fff; background: #1C1C1C; }
.nav a.lien.actif { color: var(--encre); background: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .pied { margin-top: auto; font-size: 12px; color: #8A8A8A; padding: 8px; }
.nav .pied button { background: none; border: 0; color: #BDBDBD; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.contenu { margin-left: var(--nav); flex: 1; min-width: 0; }
.barre { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--filet); padding: 12px 32px; display: flex; gap: 12px; align-items: center; }
.barre form { flex: 1; max-width: 560px; }
.barre input[type=search] { width: 100%; }
.page { padding: 28px 32px 80px; max-width: 1180px; }

/* Éléments */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--encre); background: var(--encre);
  color: #fff; padding: 8px 14px; border-radius: var(--rayon); font: 500 14px "Inter", Arial, sans-serif;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #2A2A2A; }
.btn.sec { background: #fff; color: var(--encre); border-color: var(--filet); }
.btn.sec:hover { border-color: var(--encre); }
.btn.lien { background: none; border: 0; color: var(--gris); padding: 4px; text-decoration: underline; }
.btn.danger { background: #fff; color: var(--rouge); border-color: #F0C2C9; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }

input, select, textarea { font: 15px "Inter", Arial, sans-serif; color: var(--encre); border: 1px solid var(--filet);
  border-radius: var(--rayon); padding: 8px 10px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--encre); outline-offset: -1px; border-color: var(--encre); }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.champ { margin-bottom: 14px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.grille .large { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--filet); border-radius: var(--rayon); padding: 16px 18px 4px; margin: 0 0 18px; }
legend { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); padding: 0 6px; }

.carte { border: 1px solid var(--filet); border-radius: 10px; padding: 18px 20px; background: #fff; }
.cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 18px 0 8px; }
.chiffre { border: 1px solid var(--filet); border-radius: 10px; padding: 16px 18px; }
.chiffre b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.chiffre span { color: var(--gris); font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--gris);
  font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--encre); }
td { padding: 11px 10px; border-bottom: 1px solid var(--filet); vertical-align: top; }
tr.lien-ligne { cursor: pointer; }
tr.lien-ligne:hover td { background: var(--gris-clair); }
.ref { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

.pastille { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--filet); color: var(--gris); white-space: nowrap; }
.pastille.ouvert { color: var(--encre); border-color: var(--encre); }
.pastille.audience { background: var(--encre); color: #fff; border-color: var(--encre); }
.pastille.delai { color: var(--rouge); border-color: #F0C2C9; }

.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--filet); }
.liste li:last-child { border-bottom: 0; }
.date-bloc { width: 54px; flex: none; text-align: center; border: 1px solid var(--encre); border-radius: 8px; padding: 4px 0; }
.date-bloc b { display: block; font-size: 20px; line-height: 1.1; }
.date-bloc span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.fait { opacity: .45; text-decoration: line-through; }

.flash { padding: 11px 14px; border-radius: var(--rayon); margin-bottom: 12px; border: 1px solid var(--filet); }
.flash.ok { background: var(--vert-fond); border-color: #CFE5D2; }
.flash.erreur { background: var(--rouge-fond); border-color: #F0C2C9; color: #6E0014; font-weight: 500; }
.flash.attention { background: var(--ambre-fond); border-color: #F1DDA6; }
.alerte-conflit { border-left: 4px solid var(--rouge); background: var(--rouge-fond); padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; }
.alerte-attention { border-left: 4px solid #C79100; background: var(--ambre-fond); padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; }

.parties { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.partie { border: 1px solid var(--filet); border-radius: 8px; padding: 12px 14px; position: relative; }
.partie .role { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); }
.partie.client { border-color: var(--encre); }
.partie form { position: absolute; top: 6px; right: 6px; }

.suggestions { border: 1px solid var(--filet); border-radius: var(--rayon); margin-top: 4px; max-height: 240px; overflow: auto; }
.suggestions button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 8px 10px; cursor: pointer; font: inherit; }
.suggestions button:hover, .suggestions button.choisi { background: var(--gris-clair); }

/* Connexion */
.ecran-connexion { min-height: 100vh; display: grid; place-items: center; background: var(--fond);
  background-image: url("../img/kg-filigrane.svg"); background-repeat: no-repeat; background-position: 115% 50%; background-size: 60vh; }
.boite { width: min(400px, 92vw); padding: 36px 32px; border: 1px solid var(--filet); border-radius: 14px; background: #fff; }
.boite img.logo { width: 64px; display: block; margin-bottom: 18px; }
.boite .surtitre { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--gris); }
.qr { width: 200px; height: 200px; image-rendering: pixelated; border: 1px solid var(--filet); border-radius: 8px; }
code.secret { font-size: 13px; word-break: break-all; background: var(--gris-clair); padding: 6px 8px; border-radius: 4px; display: block; }

.etapes { counter-reset: e; padding: 0; list-style: none; }
.etapes li { counter-increment: e; padding: 6px 0 6px 34px; position: relative; }
.etapes li::before { content: counter(e); position: absolute; left: 0; top: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--encre); color: #fff; font-size: 12px; display: grid; place-items: center; }

.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--filet); margin: 18px 0; }
.onglets a { padding: 8px 12px; text-decoration: none; color: var(--gris); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.onglets a.actif { color: var(--encre); border-color: var(--encre); font-weight: 500; }
details.ajout > summary { list-style: none; cursor: pointer; display: inline-flex; }
details.ajout > summary::-webkit-details-marker { display: none; }
details.ajout[open] > summary { margin-bottom: 12px; }
.vide { color: var(--gris); padding: 18px 0; }

/* Mobile : navigation en bas */
@media (max-width: 860px) {
  .nav { inset: auto 0 0 0; width: auto; height: 64px; flex-direction: row; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; z-index: 20; }
  .nav .marque, .nav .pied, .lib-long { display: none; }
  .nav a.lien { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 8px; }
  .nav a.lien.actif { background: none; color: #fff; }
  .contenu { margin-left: 0; }
  .barre { padding: 10px 14px; }
  .page { padding: 18px 14px 100px; }
  .chiffres { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .chiffre { padding: 10px 12px; } .chiffre b { font-size: 22px; }
  table.reactif thead { display: none; }
  table.reactif tr { display: block; border-bottom: 1px solid var(--filet); padding: 8px 0; }
  table.reactif td { display: block; border: 0; padding: 2px 4px; }
  h1 { font-size: 22px; }
}
@media print { .nav, .barre, .actions, form { display: none !important; } .contenu { margin: 0; } }

/* Agenda : calendrier mois / semaine */
.cal-barre { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 12px; }
.cal-titre { margin: 0; font-size: 18px; letter-spacing: -0.01em; text-transform: none; color: var(--encre); flex: 1; }
.cal-barre details.ajout { margin: 0; }
.cal { border: 1px solid var(--filet); border-radius: var(--rayon); overflow: hidden; }
.cal-entete, .cal-semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-entete div { padding: 8px 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); border-bottom: 1px solid var(--filet); }
.cal-semaine + .cal-semaine { border-top: 1px solid var(--filet); }
.cal-jour { min-height: 112px; padding: 6px; border-left: 1px solid var(--filet); cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-jour:first-child { border-left: 0; }
.cal-jour:hover { background: #FAFAFA; }
.cal-jour.we { background: #FCFCFC; }
.cal-jour.hors .cal-num { color: #B5B5B5; }
.cal-num { font-size: 12px; font-weight: 500; color: var(--gris); padding: 2px 4px; align-self: flex-start; border-radius: 99px; }
.cal-jour.auj .cal-num { background: var(--encre); color: #fff; }
.cal-evt { display: block; font-size: 12px; line-height: 1.35; padding: 3px 6px; border-radius: 4px; text-decoration: none;
  background: var(--gris-clair); border-left: 3px solid var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-evt.audience { background: var(--encre); color: #fff; border-left-color: var(--encre); }
.cal-evt.delai { background: var(--rouge-fond); border-left-color: var(--rouge); }
.cal-evt.rdv { background: #fff; border: 1px solid var(--encre); border-left-width: 3px; }
.cal-evt.tache { background: var(--gris-clair); border-left-color: var(--gris); }
.cal-evt.fait { opacity: .45; text-decoration: line-through; }
.cal-dos { display: block; opacity: .75; font-size: 11px; }
.cal.semaine .cal-entete { display: none; }
.cal.semaine .cal-jour { min-height: 320px; }
.cal.semaine .cal-evt { white-space: normal; }
.cal-jsem { text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
@media (max-width: 860px) {
  .cal.mois .cal-jour { min-height: 64px; padding: 3px; }
  .cal.mois .cal-evt { font-size: 0; padding: 0; height: 6px; border-left-width: 0; }
  .cal.semaine .cal-semaine { grid-template-columns: 1fr; }
  .cal.semaine .cal-jour { min-height: 0; border-left: 0; border-top: 1px solid var(--filet); }
}

/* Factures : indicateurs et graphique */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 8px 0 4px; }
.kpi { border: 1px solid var(--filet); border-radius: var(--rayon); padding: 14px 16px; }
.kpi.alerte { border-color: #F0C2C9; background: var(--rouge-fond); }
.kpi-lib { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gris); }
.kpi-val { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.graphe { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; padding-bottom: 8px; }
.graphe-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.graphe-barres { height: 160px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.graphe-barres .b { width: 40%; max-width: 18px; border-radius: 3px 3px 0 0; min-height: 1px; }
.b.fac, .pt.fac { background: #CFCFCF; }
.b.enc, .pt.enc { background: var(--encre); }
.graphe-lib { font-size: 11px; color: var(--gris); }
.graphe-legende { grid-column: 1 / -1; color: var(--gris); }
.pt { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin: 0 4px 0 10px; }
