/* Espace administrateur - complete app.css */
body.admin { background: var(--fond); }

/* connexion */
.adm-connexion { max-width: 460px; margin: 70px auto; padding: 0 16px; }
.adm-connexion .carte { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.adm-connexion h1 { font-size: 26px; color: var(--vert-nuit); }
.adm-connexion p { margin: 0; color: var(--doux); }
#cx-etape-1, #cx-etape-2 { display: flex; flex-direction: column; gap: 12px; }
.adm-logo { height: 54px; width: auto; align-self: flex-start; }
.admin input:not([type=checkbox]):not([type=color]):not([type=range]), .admin select, .admin textarea { border: 1.5px solid var(--ligne); border-radius: 12px; padding: 10px 12px; background: #fff; font: inherit; color: var(--encre); min-width: 0; }
.admin input:focus, .admin select:focus, .admin textarea:focus { outline: none; border-color: var(--vert); }
.admin textarea { resize: vertical; width: 100%; }
.admin .code { font-size: 28px !important; font-weight: 800 !important; letter-spacing: .4em; text-align: center; }
.admin .erreur { color: var(--rouge-fonce); font-weight: 700; margin: 0; }
.admin .mode-test { padding: 10px 12px; border-radius: 10px; border: 1.5px dashed #e8a317; background: #fff6dd; color: #6b4e00 !important; font-weight: 700; }
.admin .mode-test a { color: var(--vert-fonce); font-weight: 800; }
.ligne-boutons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ligne-boutons .btn-lien:first-child { margin-right: auto; }

/* structure */
.adm { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.adm-menu { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; background: #fff; border-right: 1px solid var(--ligne); overflow-y: auto; }
.adm-marque { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--doux); font-weight: 700; font-size: 14px; padding: 0 6px; }
.adm-marque img { height: 46px; width: auto; align-self: flex-start; }
#onglets { display: flex; flex-direction: column; gap: 2px; }
#onglets button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; border-radius: 10px; background: none; cursor: pointer; font-weight: 700; color: var(--doux); text-align: left; }
#onglets button:hover { background: var(--vert-pale); color: var(--encre); }
#onglets button.actif { background: var(--vert-clair); color: var(--vert-fonce); }
.adm-moi { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 6px 0; border-top: 1px solid var(--ligne); }
#moi { font-size: 14px; color: var(--doux); word-break: break-all; padding: 0 10px 6px; }
.adm-contenu { padding: 26px 32px 60px; max-width: 1240px; width: 100%; }
.onglet { display: flex; flex-direction: column; gap: 18px; }
.onglet h1 { font-size: 30px; font-weight: 800; color: var(--vert-nuit); }
.titre-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.intro { margin: -6px 0 0; color: var(--doux); max-width: 820px; }
.carte h3 { font-size: 17px; margin: 0 0 8px; }
.bandeau { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 18px; border-radius: 12px; background: #fff6dd; border: 1.5px solid #f1d58a; color: #5a4300; font-size: 15px; }
.bandeau .ic { color: #b07d00; margin-top: 2px; }
.admin code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--vert-pale); padding: 1px 6px; border-radius: 6px; }

/* tuiles de chiffres */
.tuiles-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tuile-stat { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 16px; background: #fff; box-shadow: var(--ombre); }
.tuile-stat span { color: var(--doux); font-weight: 700; font-size: 14px; }
.tuile-stat b { font-size: 30px; font-weight: 800; color: var(--encre); line-height: 1.15; }
.tuile-stat small { color: var(--doux); font-size: 13px; }
.tuile-stat.alerte { box-shadow: 0 0 0 2px var(--rouge), var(--ombre); }

/* filtres, tableaux */
.filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filtres .recherche { flex: 1; min-width: 220px; max-width: 420px; }
.filtres .recherche input { border: none !important; padding: 10px 0 !important; }
.table-cadre { overflow-x: auto; background: #fff; border-radius: 16px; box-shadow: var(--ombre); }
.carte .table-cadre { box-shadow: none; border: 1px solid var(--ligne); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--doux); padding: 12px 14px; border-bottom: 1px solid var(--ligne); white-space: nowrap; background: #fbfcfb; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table .nb { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.cliquable { cursor: pointer; }
.table tr.cliquable:hover td { background: var(--vert-pale); }
.table .pastille { display: block; width: 28px; height: 28px; border-radius: 8px; }
.table .actions { text-align: right; white-space: nowrap; }
.vide-table { text-align: center; color: var(--doux); padding: 24px !important; }
.etat { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.etat.vert { background: var(--vert-clair); color: var(--vert-fonce); }
.etat.gris { background: #eef1f0; color: var(--doux); }
.etat.rouge { background: var(--rouge-clair); color: var(--rouge-fonce); }
.etat.orange { background: #fff1d6; color: #8a5a00; }

/* demandes */
.demande { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--ligne); }
.demande:last-child { border-bottom: none; }
.demande > div:first-child { display: flex; flex-direction: column; }
.demande small { color: var(--doux); }
.copie { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.copie code { padding: 8px 10px; word-break: break-all; flex: 1; min-width: 0; }

/* graphiques */
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.graphe { position: relative; width: 100%; }
.graphe svg { display: block; overflow: visible; }
.graphe .barre { fill: var(--vert); }
.graphe .grille { stroke: #e7ecea; stroke-width: 1; }
.graphe .axe { fill: var(--doux); font-size: 12px; font-family: var(--police); }
.graphe .cible { fill: transparent; cursor: default; }
.graphe .cible.survol { fill: rgba(15, 138, 100, .07); }
.vide-graphe { color: var(--doux); margin: 8px 0; }
.barres-h { display: flex; flex-direction: column; gap: 8px; }
.bh { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 15px; }
.bh-lib { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bh-lib > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bh-piste { height: 12px; background: #eef2f0; border-radius: 99px; overflow: hidden; }
.bh-barre { display: block; height: 100%; background: var(--vert); border-radius: 0 4px 4px 0; }
.bh-val { min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.pastille-mini { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .12); }
.infobulle { position: fixed; z-index: 60; pointer-events: none; padding: 8px 11px; border-radius: 10px; background: var(--vert-nuit); color: #fff; font-size: 14px; line-height: 1.35; box-shadow: var(--ombre-forte); }

/* relances */
.regles { display: flex; flex-direction: column; gap: 10px; }
.regle { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 16px; background: #fff; box-shadow: var(--ombre); flex-wrap: wrap; }
.regle.inactive .regle-corps { opacity: .6; }
.regle-corps { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 2px; }
.regle-corps b { font-size: 17px; }
.regle-corps small, .regle-objet { color: var(--doux); font-size: 14px; }
.ligne-champ { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ligne-champ input[type=email] { flex: 1; min-width: 220px; max-width: 380px; }
.petit-nombre { width: 84px; text-align: center; }
.a-confirmer { background: var(--rouge) !important; border-color: var(--rouge) !important; color: #fff !important; }
.variables { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--doux); }
.variables .puce { font-size: 13px; padding: 4px 10px; }
.apercu-email { border: 1px solid var(--ligne); border-radius: 12px; padding: 14px 16px; background: #fbfcfb; }
.apercu-titre { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--doux); font-weight: 700; margin-bottom: 8px; }
#rg-apercu p { margin: 0 0 10px; color: var(--encre); }
#rg-apercu mark { background: var(--vert-clair); color: var(--vert-fonce); border-radius: 4px; padding: 0 3px; }
.apercu-objet { font-weight: 800; margin-bottom: 10px; }
.apercu-bouton { display: inline-block; padding: 9px 16px; border-radius: 10px; background: var(--vert); color: #fff; font-weight: 700; margin-bottom: 10px; }
#rg-apercu .apercu-pied { font-size: 13px; color: var(--doux); }
.modale-large { width: min(720px, calc(100% - 32px)); }

/* avis */
.grille-avis .carte:first-child { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.grande-note { font-size: 46px; font-weight: 800; line-height: 1; }
.grande-note small { font-size: 20px; color: var(--doux); }
.etoiles-texte { color: #e8a317; font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
.grille-avis h2 { font-size: 17px; margin-bottom: 10px; }

/* nuancier */
.puces-gammes { display: flex; flex-wrap: wrap; gap: 6px; }
.hex { width: 130px; font-family: ui-monospace, Consolas, monospace; }
#tn-couleur { width: 54px; height: 44px; padding: 2px; border: 1.5px solid var(--ligne); border-radius: 10px; background: #fff; cursor: pointer; }

/* parametres */
.form-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.form-grille .interrupteur { align-self: end; }
.admin .champ > span { font-size: 14px; }
.estimation { padding: 12px 16px; border-radius: 12px; background: var(--vert-pale); }
.sous-titre { font-size: 16px; margin: 6px 0 4px; }
.tarifs { display: grid; grid-template-columns: minmax(150px, 1.2fr) repeat(3, minmax(0, 1fr)) minmax(130px, 1fr); gap: 8px 12px; align-items: center; margin: 10px 0 10px; }
.tarifs > b { font-size: 14px; }
.tarifs > b small { display: block; font-weight: 400; font-size: 12px; color: var(--doux); }
.tarif-total { font-weight: 800; color: var(--vert-fonce); }
.tarif-total small { display: block; font-weight: 400; font-size: 12px; color: var(--doux); }
@media (max-width: 900px) { .tarifs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .tarifs > span:first-child { display: none; } }
.tarifs input { width: 100%; }
.estimation p { margin: 0 0 6px; }
.interrupteurs { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.admins { list-style: none; margin: 4px 0 12px; padding: 0; display: flex; flex-direction: column; }
.admins li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--ligne); flex-wrap: wrap; }
.admins li small { color: var(--doux); margin-right: auto; }
.barre-enregistrer { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 16px; border-radius: 16px; background: #fff; box-shadow: var(--ombre-forte); }
#p-etat { color: var(--rouge-fonce); font-weight: 700; font-size: 15px; }

/* fiche visiteur */
.tiroir-large { width: min(620px, 100%); display: flex; flex-direction: column; gap: 12px; }
.tiroir-large h3 { font-size: 17px; margin: 10px 0 0; }
#vd-email { font-size: 20px; word-break: break-all; }
.vd-infos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.vd-infos div { display: flex; flex-direction: column; min-width: 0; }
.vd-infos span { font-size: 13px; color: var(--doux); }
.vd-infos b { overflow-wrap: anywhere; font-weight: 700; }
.carte-plate { box-shadow: none; border: 1px solid var(--ligne); display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.carte-plate p { margin: 0; }
.vd-teintes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vd-teinte { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--ligne); border-radius: 10px; min-width: 0; }
.vd-teinte .pastille { width: 34px; height: 34px; }
.vd-teinte > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.vd-teinte small { color: var(--doux); font-size: 13px; }
.vd-teinte .fois { margin-left: auto; white-space: nowrap; }
.vd-avis { margin: 0 0 8px; }
.vd-sims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.vd-sim { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--doux); border: 1px solid var(--ligne); border-radius: 10px; overflow: hidden; }
.vd-sim:hover { border-color: var(--vert); }
.vd-sim img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--ligne); }
.vd-sim small { padding: 0 6px 6px; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .adm-menu { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px; border-right: none; border-bottom: 1px solid var(--ligne); overflow-x: auto; }
  .adm-marque span, .adm-moi { display: none; }
  .adm-marque img { height: 34px; }
  #onglets { flex-direction: row; }
  #onglets button span { display: none; }
  #onglets button { padding: 10px; }
  .adm-contenu { padding: 16px 14px 60px; }
  .grille-2, .vd-teintes, .vd-infos { grid-template-columns: minmax(0, 1fr); }
  .onglet h1 { font-size: 24px; }
}
