/* ===== Suivi Chantiers — design system Aqua'Bio =====
   Épuré, aéré, ombres douces — mobile-first. */
:root {
  --bleu: #085a9c; --bleu2: #0a72c2; --cyan: #66c6f5; --accent: #e63946; --ok: #0d9488; --warn: #e9c46a;
  --fond: #f2f9fb; --carte: #ffffff; --texte: #16283a; --gris: #6b7a8c; --bord: #e6ecf2;
  --radius: 16px;
  --ombre: 0 1px 2px rgba(8, 42, 74, .05), 0 10px 30px -12px rgba(8, 42, 74, .10);
  --ombre-haute: 0 2px 6px rgba(8, 42, 74, .08), 0 18px 44px -14px rgba(8, 42, 74, .18);
  --transition: .16s cubic-bezier(.4, 0, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Arial, sans-serif;
  background: var(--fond); color: var(--texte); padding-bottom: 84px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--bleu2); text-decoration: none; transition: color var(--transition); }
h1 { font-size: 1.45rem; margin: 1rem 0 .9rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.02rem; margin: 1.5rem 0 .6rem; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: .93rem; margin: .9rem 0 .45rem; font-weight: 650; }

.container { max-width: 1100px; margin: 0 auto; padding: 14px 16px 48px; }

/* --- barre du haut --- */
.topbar {
  background-color: #0a72c2;
  background-image: linear-gradient(115deg, #0a72c2, #2fb1e8);
  color: #fff; display: flex; align-items: center; gap: 16px;
  padding: 12px 18px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 8px 28px -12px rgba(16, 140, 210, .5);
}
.brand { color: #fff; font-weight: 700; font-size: 1.02rem; white-space: nowrap; display: flex; align-items: center; gap: 10px; letter-spacing: -.01em; }
.brand img { height: 34px; background: #fff; border-radius: 9px; padding: 3px 9px; display: block; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.login-logo img { max-height: 76px; max-width: 230px; }
.topnav { display: none; gap: 2px; flex: 1; }
.topnav a { color: rgba(255, 255, 255, .82); padding: 8px 13px; border-radius: 999px; font-size: .9rem; font-weight: 500; transition: background var(--transition), color var(--transition); }
.topnav a.on { background: #fff; color: #0a72c2; font-weight: 700; box-shadow: 0 2px 8px rgba(6, 63, 111, .18); }
.topnav a:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userbox a { color: #fff; font-size: .9rem; opacity: .92; }
.uname { display: none; }
.btn-ghost { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .28); color: #fff; border-radius: 9px; padding: 5px 11px; cursor: pointer; font-size: 1rem; transition: background var(--transition); }
.btn-ghost:hover { background: rgba(255, 255, 255, .18); }

/* --- navigation basse (mobile) --- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(8, 42, 74, .08);
  display: flex; z-index: 50; padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 24px -12px rgba(8, 42, 74, .18);
}
.bottomnav a { flex: 1; text-align: center; padding: 9px 2px 7px; font-size: .66rem; font-weight: 500; color: var(--gris); display: flex; flex-direction: column; gap: 3px; transition: color var(--transition); }
.bottomnav a .ic { font-size: 1.3rem; line-height: 1.1; }
.bottomnav a.on { color: var(--bleu2); font-weight: 700; }

@media (min-width: 860px) and (max-width: 1279px) {
  .topbar { gap: 10px; padding: 12px 12px; }
  .topnav a { padding: 7px 9px; font-size: .82rem; }
  .brand { font-size: .95rem; }
}
@media (min-width: 860px) {
  body { padding-bottom: 0; }
  .topnav { display: flex; flex-wrap: wrap; }
  .uname { display: inline; }
  .bottomnav { display: none; }
  h1 { font-size: 1.7rem; }
  .container { padding: 20px 24px 60px; }
}

/* --- cartes, listes --- */
.card {
  background: var(--carte); border: 1px solid rgba(8, 42, 74, .05);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: var(--ombre);
}
.card h2:first-child { margin-top: 0; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--carte); border: 1px solid rgba(8, 42, 74, .05);
  border-radius: 14px; padding: 13px 16px; display: block; color: var(--texte);
  box-shadow: var(--ombre); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
a.item:hover, .item a:hover { border-color: rgba(10, 114, 194, .35); }
a.item:hover { transform: translateY(-1px); box-shadow: var(--ombre-haute); }
.item:active { transform: translateY(0); }
.item .t { font-weight: 650; letter-spacing: -.01em; }
.item .s { color: var(--gris); font-size: .84rem; margin-top: 3px; }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 860px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--carte); border: 1px solid rgba(8, 42, 74, .05); border-radius: var(--radius);
  padding: 18px 12px 15px; text-align: center; display: block; color: var(--texte);
  box-shadow: var(--ombre); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: linear-gradient(90deg, #22a8e0, #14c3a6); }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--ombre-haute); border-color: rgba(10, 114, 194, .35); }
.stat .n { font-size: 1.9rem; font-weight: 750; letter-spacing: -.03em; background: linear-gradient(120deg, #0a86d6, #14c3a6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .l { color: var(--gris); font-size: .78rem; font-weight: 500; margin-top: 2px; }

/* --- badges --- */
.badge { display: inline-block; padding: 2.5px 10px; border-radius: 999px; font-size: .72rem; font-weight: 650; letter-spacing: .01em; vertical-align: 1px; }
.b-prospect { background: #e3f1fc; color: #085a9c; }
.b-vendu, .b-termine { background: #d9f4ee; color: #0b7d70; }
.b-perdu { background: #fce5e7; color: #b02a35; }
.b-planifie { background: #fcf2d7; color: #92700f; }
.b-en_cours { background: #dcf3fd; color: #0a72c2; }
.b-maintenance { background: #ece6fb; color: #5b3fb8; }
.b-sav { background: #fdeade; color: #a24d1c; }
.b-a_completer { background: #fcf2d7; color: #92700f; }
.b-actif { background: #d9f4ee; color: #0b7d70; }
.b-inactif { background: #eaeff4; color: #6b7a8c; }

/* --- formulaires --- */
label { display: block; font-size: .76rem; font-weight: 650; color: var(--gris); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .05em; }
label label, label strong { text-transform: none; letter-spacing: 0; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=time], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--bord); border-radius: 11px; font-size: 16px;
  background: #fff; color: var(--texte); font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a8c' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bleu2); box-shadow: 0 0 0 4px rgba(10, 114, 194, .13); }
input[type=checkbox] { accent-color: var(--bleu2); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-block; background: linear-gradient(120deg, #14a5dc, #0a86d6); color: #fff; border: none;
  border-radius: 11px; padding: 12px 20px; font-size: .93rem; font-weight: 650; cursor: pointer; margin-top: 12px;
  font-family: inherit; letter-spacing: .01em;
  box-shadow: 0 3px 12px -3px rgba(16, 150, 215, .5);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -4px rgba(16, 150, 215, .6); filter: brightness(1.05); }
.btn:active { transform: translateY(0); filter: brightness(.97); }
.btn-ok { background: linear-gradient(120deg, #10a595, #14c3a6); box-shadow: 0 2px 10px -2px rgba(13, 148, 136, .45); }
.btn-ok:hover { box-shadow: 0 6px 18px -4px rgba(13, 148, 136, .55); }
.btn-danger { background: linear-gradient(120deg, #cf2f3c, #e63946); box-shadow: 0 2px 10px -2px rgba(230, 57, 70, .40); }
.btn-danger:hover { box-shadow: 0 6px 18px -4px rgba(230, 57, 70, .50); }
.btn-sm { padding: 7px 13px; font-size: .8rem; margin-top: 0; border-radius: 9px; }
.btn-line { background: #fff; color: var(--bleu); border: 1.5px solid rgba(8, 90, 156, .35); box-shadow: none; }
.btn-line:hover { border-color: var(--bleu2); background: #f4f9fd; box-shadow: none; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.inline { display: inline; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin: 12px 0; }

.alert { padding: 12px 16px; border-radius: 12px; margin: 12px 0; font-size: .9rem; box-shadow: var(--ombre); }
.a-err { background: #fce5e7; color: #b02a35; }
.a-ok { background: #d9f4ee; color: #0b7d70; }

/* --- tableaux --- */
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; color: var(--gris); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: 9px 9px; border-bottom: 1.5px solid var(--bord); }
.tbl td { padding: 11px 9px; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr { transition: background var(--transition); }
.tbl tr:hover td { background: #f7fafd; }
.tbl-wrap { overflow-x: auto; border-radius: 10px; }
.num { text-align: right; white-space: nowrap; }

/* --- photos --- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; margin: 10px 0; }
.photos a { position: relative; display: block; aspect-ratio: 1; border-radius: 13px; overflow: hidden; border: 1px solid rgba(8, 42, 74, .07); box-shadow: var(--ombre); transition: transform var(--transition), box-shadow var(--transition); }
.photos a:hover { transform: scale(1.03); box-shadow: var(--ombre-haute); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos form { position: absolute; top: 6px; right: 6px; }
.photos form button { background: rgba(10, 25, 40, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #fff; border: none; border-radius: 8px; padding: 3px 8px; cursor: pointer; font-size: .8rem; }
.photo-add { border: 2px dashed rgba(10, 114, 194, .3); background: #f8fbfe; border-radius: 13px; padding: 14px; text-align: center; transition: border-color var(--transition); }
.photo-add:hover { border-color: var(--bleu2); }
.photo-add input[type=file] { width: 100%; font-size: .85rem; }

/* --- planning --- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head .mois { font-weight: 750; font-size: 1.08rem; text-transform: capitalize; letter-spacing: -.01em; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: .68rem; color: var(--gris); font-weight: 700; padding: 5px 0; text-transform: uppercase; letter-spacing: .08em; }
.cal .day { background: var(--carte); border: 1px solid rgba(8, 42, 74, .05); border-radius: 11px; aspect-ratio: 1 / 1; min-height: 66px; padding: 4px; font-size: .72rem; box-shadow: 0 1px 2px rgba(8, 42, 74, .04); overflow: hidden; }
.cal .day .dn { color: var(--gris); font-size: .68rem; font-weight: 600; padding: 1px 3px; }
.cal .day.today { border: 2px solid var(--bleu2); box-shadow: 0 0 0 4px rgba(10, 114, 194, .10); }
.cal .day.today .dn { color: var(--bleu2); }
.cal .day.off { background: transparent; border: none; box-shadow: none; }
.cal .ev { display: block; border-radius: 6px; padding: 2.5px 6px; margin-top: 3px; color: #fff; font-size: .66rem; font-weight: 550; line-height: 1.3; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; transition: filter var(--transition); }
.cal .ev:hover { filter: brightness(1.12); }
.ev-planifie { background: linear-gradient(120deg, #b8890f, #d3a41e); }
.ev-en_cours { background: linear-gradient(120deg, #0a72c2, #22a8e0); }
.ev-termine { background: linear-gradient(120deg, #0b8377, #12ab97); }
.ev-maintenance { background: linear-gradient(120deg, #5b3fb8, #8465e0); }
.ev-sav { background: linear-gradient(120deg, #b3541e, #e0762f); }
.cal-list { margin-top: 18px; }
@media (min-width: 860px) { .cal .day { min-height: 96px; font-size: .8rem; padding: 6px; } .cal .ev { font-size: .73rem; } }
@media (max-width: 600px) { .cal { gap: 4px; } .cal .day { border-radius: 8px; padding: 2px; min-height: 44px; } .cal .day .dn { font-size: .6rem; } .cal .ev { font-size: .56rem; padding: 1.5px 4px; border-radius: 5px; margin-top: 2px; } }

/* --- comparaison matériel --- */
.compare-ok { color: var(--ok); font-weight: 700; }
.compare-diff { color: var(--accent); font-weight: 700; }

/* --- page connexion --- */
.login-wrap { min-height: 92vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1100px 500px at 70% -10%, rgba(102, 198, 245, .18), transparent 60%), var(--fond); }
.login-box { width: 100%; max-width: 390px; background: var(--carte); border: 1px solid rgba(8, 42, 74, .05); border-radius: 22px; padding: 34px 30px; box-shadow: var(--ombre-haute); }
.login-box h1 { text-align: center; margin-top: 8px; letter-spacing: -.02em; }
.login-logo { text-align: center; font-size: 2.4rem; }

/* --- éléments repliables --- */
details.box { border: 1px solid var(--bord); border-radius: 13px; padding: 12px 16px; margin: 12px 0; background: #fafcfe; transition: border-color var(--transition); }
details.box[open] { border-color: rgba(10, 114, 194, .28); }
details.box summary { cursor: pointer; font-weight: 650; color: var(--bleu2); }
details.box summary::-webkit-details-marker { color: var(--bleu2); }

/* Jauges de ressources (page Système) */
.jauge { background: #e9eef4; border-radius: 999px; height: 22px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(8, 42, 74, .08); }
.jauge-remplie { background: linear-gradient(90deg, #0a86d6, #14c3a6); height: 100%; color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: flex-end; padding-right: 9px; min-width: 36px; border-radius: 999px; transition: width .5s cubic-bezier(.4, 0, .2, 1); }
.jauge-alerte { background: linear-gradient(90deg, #b02a35, #e63946); }

/* Dossiers repliables (page Documents) */
/* Cartes repliables (fiches de contrôle) */
details.card > summary { cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: '▸'; display: inline-block; color: var(--bleu2); margin-right: 9px; font-size: 1.05rem; transition: transform var(--transition); }
details.card[open] > summary::before { transform: rotate(90deg); }

details.dossier { margin: 14px 0; }
details.dossier > summary {
  cursor: pointer; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; color: var(--texte);
  background: var(--carte); border: 1px solid rgba(8, 42, 74, .05); border-radius: var(--radius);
  padding: 15px 18px; list-style: none; box-shadow: var(--ombre);
  transition: box-shadow var(--transition), border-color var(--transition);
}
details.dossier > summary:hover { border-color: rgba(10, 114, 194, .3); }
details.dossier > summary::before { content: '▸'; display: inline-block; color: var(--bleu2); margin-right: 9px; transition: transform var(--transition); }
details.dossier[open] > summary::before { transform: rotate(90deg); }
details.dossier > summary::-webkit-details-marker { display: none; }
details.dossier[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: none; }
details.dossier > .card, details.dossier > .tbl-wrap.card { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; box-shadow: var(--ombre); }

.muted { color: var(--gris); font-size: .85rem; }
.sep { border: none; border-top: 1px solid var(--bord); margin: 18px 0; }
code { background: #eef3f8; border-radius: 6px; padding: 1px 6px; font-size: .85em; }

/* Apparition douce du contenu */
@media (prefers-reduced-motion: no-preference) {
  main.container > * { animation: apparition .28s cubic-bezier(.4, 0, .2, 1) both; }
  @keyframes apparition { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}


/* ===== Icônes vectorielles (remplacent les émojis) ===== */
.ico { width: 18px; height: 18px; stroke: #0a86d6; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3.5px; display: inline-block; flex: none; }
h1 .ico, h2 .ico { width: 34px; height: 34px; padding: 7px; background: linear-gradient(135deg, #dff4fe, #d2f6ef); border-radius: 11px; vertical-align: -9px; margin-right: 2px; }
details.box > summary .ico { width: 17px; height: 17px; stroke: currentColor; vertical-align: -3px; }
details.dossier > summary .ico { width: 29px; height: 29px; padding: 6px; background: linear-gradient(135deg, #dff4fe, #d2f6ef); border-radius: 9px; vertical-align: -9px; margin-right: 2px; }
.btn .ico { width: 15px; height: 15px; stroke: #fff; vertical-align: -2.5px; padding: 0; background: none; }
.btn-line .ico, .btn-ghost .ico { stroke: currentColor; }
.badge .ico { width: 12px; height: 12px; stroke: currentColor; vertical-align: -2px; }
.item .ico, .tbl .ico, p .ico, .s .ico, a .ico { padding: 0; }
.bottomnav .ic { display: flex; justify-content: center; }
.bottomnav .ic .ico { width: 23px; height: 23px; stroke: currentColor; vertical-align: 0; }
.alert .ico { stroke: currentColor; }
.stat .ico { stroke: currentColor; }

/* Les libellés avec case à cocher restent en casse normale */
label:has(input[type=checkbox]) { text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--texte); }

/* ===== Application complète : lien d'espace, sous-menu Chantiers, grille des droits ===== */
.lien-espace { border: 1px solid rgba(255, 255, 255, .38); border-radius: 999px; padding: 5px 12px; font-size: .82rem !important; font-weight: 600; white-space: nowrap; }
@media (max-width: 859px) { .topbar .lien-espace { display: none; } } /* sur téléphone : lien dans Mon compte */
.lien-espace:hover { background: rgba(255, 255, 255, .14); }
.sousnav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 14px; background: var(--carte); border-bottom: 1px solid var(--bord); scrollbar-width: none; }
.sousnav::-webkit-scrollbar { display: none; }
.sousnav a { flex: none; padding: 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 500; color: var(--gris); white-space: nowrap; }
.sousnav a.on { background: var(--bleu2); color: #fff; font-weight: 650; }
.droits-grille { display: grid; grid-template-columns: 1fr; gap: 4px 14px; align-items: center; }
.droits-grille label { margin: 8px 0 0; }
@media (min-width: 700px) { .droits-grille { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px 14px; } .droits-grille label { margin: 0; } }

/* ===== Thème sombre : clair par défaut (inchangé pour qui ne choisit rien) ; « sombre » ou « auto » au choix, mémorisé ===== */
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { color-scheme: dark;
  --fond: #0e1720; --carte: #16222e; --texte: #e6eef5; --gris: #94a6b8; --bord: #26384a; --bleu: #7cc4f5; --bleu2: #4aa8ea;
  --ombre: 0 1px 2px rgba(0, 0, 0, .4); --ombre-haute: 0 2px 8px rgba(0, 0, 0, .5); } }
:root[data-theme="sombre"] { color-scheme: dark;
  --fond: #0e1720; --carte: #16222e; --texte: #e6eef5; --gris: #94a6b8; --bord: #26384a; --bleu: #7cc4f5; --bleu2: #4aa8ea;
  --ombre: 0 1px 2px rgba(0, 0, 0, .4); --ombre-haute: 0 2px 8px rgba(0, 0, 0, .5); }
:root[data-theme="sombre"] .bottomnav { background: rgba(18, 28, 38, .94); border-top-color: rgba(255, 255, 255, .08); }
:root[data-theme="sombre"] input, :root[data-theme="sombre"] select, :root[data-theme="sombre"] textarea { background: #0f1a24; color: var(--texte); border-color: var(--bord); }
:root[data-theme="sombre"] .btn-line { background: transparent; color: var(--bleu); border-color: rgba(124, 196, 245, .45); }
:root[data-theme="sombre"] .btn-line:hover { background: rgba(124, 196, 245, .10); }
:root[data-theme="sombre"] .tbl tr:hover td { background: rgba(255, 255, 255, .04); }
:root[data-theme="sombre"] .photo-add { background: rgba(74, 168, 234, .07); }
:root[data-theme="sombre"] details.box { background: #121d28; }
:root[data-theme="sombre"] .jauge { background: #22303e; }
:root[data-theme="sombre"] code { background: #22303e; }
:root[data-theme="sombre"] .b-prospect, :root[data-theme="sombre"] .b-en_cours { background: rgba(74, 168, 234, .18); color: #9ed3fa; }
:root[data-theme="sombre"] .b-vendu, :root[data-theme="sombre"] .b-termine, :root[data-theme="sombre"] .b-actif, :root[data-theme="sombre"] .a-ok { background: rgba(20, 195, 166, .16); color: #7fe3d2; }
:root[data-theme="sombre"] .b-perdu, :root[data-theme="sombre"] .a-err { background: rgba(230, 57, 70, .18); color: #ff9aa2; }
:root[data-theme="sombre"] .b-planifie, :root[data-theme="sombre"] .b-a_completer { background: rgba(233, 196, 106, .16); color: #f0d58a; }
:root[data-theme="sombre"] .b-maintenance { background: rgba(140, 110, 240, .2); color: #c9b8ff; }
:root[data-theme="sombre"] .b-sav { background: rgba(224, 118, 47, .2); color: #ffc29c; }
:root[data-theme="sombre"] .b-inactif { background: #22303e; color: var(--gris); }
:root[data-theme="sombre"] .stat .n { background: linear-gradient(120deg, #5cb8f5, #3fe0c5); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="sombre"] .topnav a.on { background: #e6eef5; }
@media (prefers-color-scheme: dark) {
:root[data-theme="auto"] .bottomnav { background: rgba(18, 28, 38, .94); border-top-color: rgba(255, 255, 255, .08); }
:root[data-theme="auto"] input, :root[data-theme="auto"] select, :root[data-theme="auto"] textarea { background: #0f1a24; color: var(--texte); border-color: var(--bord); }
:root[data-theme="auto"] .btn-line { background: transparent; color: var(--bleu); border-color: rgba(124, 196, 245, .45); }
:root[data-theme="auto"] .btn-line:hover { background: rgba(124, 196, 245, .10); }
:root[data-theme="auto"] .tbl tr:hover td { background: rgba(255, 255, 255, .04); }
:root[data-theme="auto"] .photo-add { background: rgba(74, 168, 234, .07); }
:root[data-theme="auto"] details.box { background: #121d28; }
:root[data-theme="auto"] .jauge { background: #22303e; }
:root[data-theme="auto"] code { background: #22303e; }
:root[data-theme="auto"] .b-prospect, :root[data-theme="auto"] .b-en_cours { background: rgba(74, 168, 234, .18); color: #9ed3fa; }
:root[data-theme="auto"] .b-vendu, :root[data-theme="auto"] .b-termine, :root[data-theme="auto"] .b-actif, :root[data-theme="auto"] .a-ok { background: rgba(20, 195, 166, .16); color: #7fe3d2; }
:root[data-theme="auto"] .b-perdu, :root[data-theme="auto"] .a-err { background: rgba(230, 57, 70, .18); color: #ff9aa2; }
:root[data-theme="auto"] .b-planifie, :root[data-theme="auto"] .b-a_completer { background: rgba(233, 196, 106, .16); color: #f0d58a; }
:root[data-theme="auto"] .b-maintenance { background: rgba(140, 110, 240, .2); color: #c9b8ff; }
:root[data-theme="auto"] .b-sav { background: rgba(224, 118, 47, .2); color: #ffc29c; }
:root[data-theme="auto"] .b-inactif { background: #22303e; color: var(--gris); }
:root[data-theme="auto"] .stat .n { background: linear-gradient(120deg, #5cb8f5, #3fe0c5); -webkit-background-clip: text; background-clip: text; }
:root[data-theme="auto"] .topnav a.on { background: #e6eef5; }
}

/* ===== Module CA : filtres, indicateurs, graphique (palette validée : 3 séries, clair et sombre) ===== */
:root { --s-signe: #2a78d6; --s-facture: #eb6834; --s-encaisse: #1baf7a; --viz-grille: #e6ecf2; --viz-axe: #9aa8b7; --hausse: #0b7d70; --baisse: #b02a35; }
:root[data-theme="sombre"] { --s-signe: #3987e5; --s-facture: #d95926; --s-encaisse: #199e70; --viz-grille: #26384a; --viz-axe: #5d7185; --hausse: #7fe3d2; --baisse: #ff9aa2; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { --s-signe: #3987e5; --s-facture: #d95926; --s-encaisse: #199e70; --viz-grille: #26384a; --viz-axe: #5d7185; --hausse: #7fe3d2; --baisse: #ff9aa2; } }
.filtres-ligne { display: grid; grid-template-columns: 1fr; gap: 8px 12px; }
@media (min-width: 700px) { .filtres-ligne { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; } }
.filtres label { margin-top: 0; }
.periode-lib { align-self: center; font-size: .95rem; }
.kpis { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 10px; }
@media (min-width: 860px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--carte); border-radius: var(--radius); box-shadow: var(--ombre); padding: 16px 18px; min-width: 0; }
.kpi-t { font-weight: 650; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.kpi-v { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; margin: 4px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-s { color: var(--gris); font-size: .78rem; margin-bottom: 8px; }
.kpi-c { font-size: .82rem; padding-top: 6px; border-top: 1px solid var(--bord); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 2px 8px; font-variant-numeric: tabular-nums; }
.kpi-cl { color: var(--gris); flex-basis: 100%; }
.ecart { font-weight: 650; } .e-hausse { color: var(--hausse); } .e-baisse { color: var(--baisse); } .e-egal { color: var(--gris); }
.pastille { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; flex: none; }
.s-signe { background: var(--s-signe); } .s-facture { background: var(--s-facture); } .s-encaisse { background: var(--s-encaisse); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; max-width: 100%; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .85rem; color: var(--gris); margin: 0 0 6px; }
.viz-zone { position: relative; }
.viz-zone svg { width: 100%; height: auto; display: block; }
.viz-zone .grille { stroke: var(--viz-grille); stroke-width: 1; } .viz-zone .axe0 { stroke: var(--viz-axe); stroke-width: 1; }
.viz-zone .gradu { fill: var(--gris); font-size: 11px; font-family: inherit; } .viz-zone .gradu-on { fill: var(--texte); font-weight: 700; }
.f-signe { fill: var(--s-signe); } .f-facture { fill: var(--s-facture); } .f-encaisse { fill: var(--s-encaisse); }
.zone-survol { fill: transparent; } g.mois.survol .zone-survol { fill: rgba(127, 150, 175, .12); }
.viz-bulle { position: absolute; top: 4px; transform: translateX(-50%); background: var(--carte); color: var(--texte); border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre-haute); padding: 8px 12px; font-size: .8rem; pointer-events: none; display: flex; flex-direction: column; gap: 2px; white-space: nowrap; z-index: 5; font-variant-numeric: tabular-nums; }
.viz-bulle[hidden] { display: none; }
@media (max-width: 600px) { .viz-zone .gradu { font-size: 22px; } }
.barres { display: flex; flex-direction: column; gap: 8px; }
.barre-l { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; font-size: .85rem; }
.barre-n { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-z { height: 12px; } .barre { display: block; height: 12px; border-radius: 0 4px 4px 0; background: var(--s-signe); min-width: 2px; } .barre-autres { background: var(--viz-axe); }
.barre-v { font-variant-numeric: tabular-nums; white-space: nowrap; }
.conf { display: inline-block; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.classement-ligne { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--bord); }
@media (min-width: 860px) { .classement-ligne { grid-template-columns: minmax(0, 1fr) 210px 110px; align-items: center; } }
.grid2 > * { min-width: 0; }
.num.souple { white-space: normal; }

.carte-lien { display: block; color: inherit; } .carte-lien:hover { box-shadow: var(--ombre-haute); }
.kpis-compact { margin: 0; gap: 14px; } .kpis-compact .kpi-v { font-size: 1.35rem; }

@media (min-width: 860px) { .kpis.kpis-2 { grid-template-columns: repeat(2, 1fr); } }

/* ===== Trésorerie ===== */
@media (min-width: 860px) { .kpis.kpis-4 { grid-template-columns: repeat(4, 1fr); } }
.kpis-4 .kpi-v { font-size: 1.35rem; }
.l-solde { stroke: var(--s-signe); stroke-width: 2; } .p-solde { fill: var(--s-signe); stroke: var(--carte); stroke-width: 2; }
.ligne-mode { padding: 10px 0; border-top: 1px solid var(--bord); font-size: .9rem; }
.ech-ligne { display: grid; grid-template-columns: 90px minmax(0, 1fr) 90px; gap: 8px; }
