/* Carrosserie SaaS — CSS maison, pas de build. Charte : #1F3A5F / #F28C28 */
:root {
  --bleu: #1F3A5F;
  --accent: #F28C28;
  --fond: #F7F8FA;
  --texte: #1B1F24;
  --gris: #6B7280;
  --bord: #DFE3E8;
  --blanc: #FFFFFF;
  --radius: 8px;
  --ombre: 0 1px 3px rgba(27, 31, 36, .09), 0 1px 2px rgba(27, 31, 36, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fond); color: var(--texte); font-size: 16px; line-height: 1.5;
}
a { color: var(--bleu); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; color: var(--bleu); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .9rem; }
.muted { color: var(--gris); font-size: .9rem; }
.center { text-align: center; }
.mt { margin-top: 1.2rem; } .mb { margin-bottom: 1.2rem; }

/* Mise en page publique */
.entete-pub { background: var(--bleu); color: #fff; padding: .9rem 1rem; }
.entete-pub a { color: #fff; text-decoration: none; font-weight: 600; }
.contenu { max-width: 720px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.contenu-large { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.carte { background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--radius);
  padding: 1.1rem; margin-bottom: 1.1rem; box-shadow: var(--ombre); }
.carte h2 { margin-top: 0; }
.pied { text-align: center; color: var(--gris); font-size: .85rem; padding: 1.5rem 1rem 2.5rem; }

/* Formulaires */
fieldset { border: 0; padding: 0; margin: 0 0 1.4rem; }
legend { font-weight: 700; color: var(--bleu); font-size: 1.1rem; padding: 0 0 .5rem; }
label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=password], input[type=color], select, textarea {
  width: 100%; padding: .7rem .75rem; border: 1px solid var(--bord); border-radius: var(--radius);
  font: inherit; background: #fff; color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 96px; resize: vertical; }
.champ { margin-bottom: .95rem; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.grille-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 .9rem; }
@media (max-width: 560px) { .grille-2, .grille-3 { grid-template-columns: 1fr; } }
.aide { font-size: .85rem; color: var(--gris); margin-top: .25rem; }
.erreur-champ { color: #B42318; font-size: .87rem; margin-top: .25rem; }
.consentement { display: flex; gap: .6rem; align-items: flex-start; }
.consentement input { width: 22px; height: 22px; margin-top: .15rem; flex: 0 0 auto; }
.consentement label { font-weight: 400; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .75rem 1.3rem; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-principal { background: var(--accent); color: #fff; }
.btn-principal:hover { background: #d97b1c; }
.btn-secondaire { background: #fff; color: var(--bleu); border-color: var(--bord); }
.btn-secondaire:hover { background: #F0F2F5; }
.btn-danger { background: #fff; color: #B42318; border-color: #F1C7C2; }
.btn-bloc { width: 100%; }
.btn-petit { min-height: 36px; padding: .35rem .7rem; font-size: .88rem; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Alertes */
.alerte { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .95rem; }
.alerte-erreur { background: #FEF3F2; border: 1px solid #F1C7C2; color: #912018; }
.alerte-succes { background: #ECFDF3; border: 1px solid #A9E3BF; color: #05603A; }
.alerte-info { background: #EFF6FF; border: 1px solid #BFD9F7; color: #1849A9; }

/* Badges */
.badge { display: inline-block; padding: .16rem .55rem; border-radius: 999px; font-size: .78rem;
  font-weight: 700; white-space: nowrap; }
.badge-bleu { background: #E3F0FF; color: #1849A9; }
.badge-violet { background: #F0EBFF; color: #5925DC; }
.badge-orange { background: #FFF2E2; color: #B54708; }
.badge-vert { background: #E6F6EC; color: #05603A; }
.badge-rouge { background: #FEF0EF; color: #912018; }
.badge-gris { background: #EEF0F3; color: #4B5563; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .6rem .55rem; border-bottom: 1px solid var(--bord); font-size: .93rem;
  vertical-align: middle; }
th { background: #F2F4F7; color: var(--bleu); font-size: .82rem; text-transform: uppercase;
  letter-spacing: .02em; }
.num { text-align: right; white-space: nowrap; }
.table-enveloppe { overflow-x: auto; border: 1px solid var(--bord); border-radius: var(--radius); }
tr.ligne-ia td { background: #FCFAFF; }

/* Blocs photo du formulaire */
.blocs-photo { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 560px) { .blocs-photo { grid-template-columns: 1fr; } }
.bloc-photo { border: 1px dashed var(--bord); border-radius: var(--radius); padding: .8rem; background: #fff; }
.bloc-photo.rempli { border-style: solid; border-color: #A9E3BF; }
.bloc-photo h3 { font-size: .98rem; margin-bottom: .2rem; }
.bloc-photo input[type=file] { width: 100%; margin-top: .5rem; font-size: .9rem; }
.apercu { width: 100%; max-height: 170px; object-fit: cover; border-radius: 6px; margin-top: .55rem; display: none; }
.progression { height: 8px; background: var(--bord); border-radius: 999px; overflow: hidden; margin: .4rem 0 1rem; }
.progression > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* Galerie admin */
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; }
.galerie figure { margin: 0; }
.galerie img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--bord);
  cursor: zoom-in; display: block; }
.galerie figcaption { font-size: .8rem; color: var(--gris); margin-top: .2rem; }
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 94vw; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
dialog img { max-width: 92vw; max-height: 82vh; display: block; }
dialog::backdrop { background: rgba(0,0,0,.7); }
.dialog-barre { display: flex; justify-content: space-between; align-items: center; padding: .5rem .7rem;
  background: #fff; gap: 1rem; }

/* Admin : sidebar */
.appli { display: flex; min-height: 100vh; align-items: stretch; }
.barre-laterale { width: 230px; flex: 0 0 230px; background: var(--bleu); color: #fff; padding: 1rem .8rem; }
.barre-laterale .marque { font-weight: 700; font-size: 1.05rem; margin-bottom: 1.2rem; display: block;
  color: #fff; text-decoration: none; }
.barre-laterale nav a, .barre-laterale nav button { display: block; width: 100%; text-align: left;
  color: #DCE6F2; text-decoration: none; padding: .6rem .7rem; border-radius: 6px; margin-bottom: .2rem;
  background: none; border: 0; font: inherit; cursor: pointer; }
.barre-laterale nav a:hover, .barre-laterale nav button:hover { background: rgba(255,255,255,.12); color: #fff; }
.barre-laterale nav a.actif { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.principal { flex: 1 1 auto; min-width: 0; padding: 1.2rem 1.4rem 3rem; }
.bouton-menu { display: none; }
@media (max-width: 860px) {
  .appli { display: block; }
  .barre-laterale { width: auto; flex: none; }
  .barre-laterale nav { display: none; }
  .barre-laterale nav.ouvert { display: block; }
  .bouton-menu { display: inline-block; background: rgba(255,255,255,.15); color: #fff; border: 0;
    border-radius: 6px; padding: .45rem .8rem; font: inherit; cursor: pointer; float: right; }
  .principal { padding: 1rem .8rem 3rem; }
}

/* Compteurs */
.compteurs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.2rem; }
@media (max-width: 720px) { .compteurs { grid-template-columns: repeat(2, 1fr); } }
.compteur { background: #fff; border: 1px solid var(--bord); border-radius: var(--radius); padding: .8rem 1rem; }
.compteur b { display: block; font-size: 1.7rem; color: var(--bleu); line-height: 1.1; }
.compteur span { font-size: .85rem; color: var(--gris); }

.deux-colonnes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 1.1rem; }
@media (max-width: 1000px) { .deux-colonnes { grid-template-columns: 1fr; } }
.barre-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.ligne-filtres { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.ligne-filtres .champ { margin-bottom: 0; }
.totaux { margin-left: auto; text-align: right; }
.totaux div { display: flex; justify-content: space-between; gap: 2rem; padding: .18rem 0; }
.totaux .ttc { font-weight: 700; font-size: 1.15rem; color: var(--bleu); border-top: 1px solid var(--bord);
  margin-top: .3rem; padding-top: .35rem; }
.encart-ia { background: #F6F2FF; border: 1px solid #DCCDFB; border-radius: var(--radius); padding: .7rem .9rem;
  margin-bottom: .8rem; font-size: .93rem; }
.matrice td, .matrice th { padding: .25rem; }

/* Lignes de devis (cartes, admin) */
.lignes-devis { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.ligne-devis { background: #fff; border: 1px solid var(--bord); border-radius: var(--radius); padding: .8rem .9rem; }
.ligne-devis-ia { background: #FCFAFF; border-color: #E4D9FA; }
.ligne-devis-entete { display: flex; align-items: center; gap: .5rem; min-height: 30px; margin-bottom: .5rem; }
.ligne-devis-entete:empty { display: none; }
.ligne-devis-rangee { display: flex; flex-wrap: wrap; gap: .6rem .7rem; }
.ligne-devis-rangee--bas { margin-top: .5rem; align-items: flex-end; }
.ligne-devis-rangee--haut .champ-zone { flex: 2 1 190px; min-width: 190px; }
.ligne-devis-rangee--haut .champ-type { flex: 1 1 130px; min-width: 130px; }
.ligne-devis-rangee--haut .champ-action { flex: 2 1 190px; min-width: 190px; }
.ligne-devis-rangee--bas .champ-severite { flex: 1 1 120px; min-width: 120px; }
.ligne-devis-rangee--bas .champ-prix { flex: 1 1 110px; min-width: 110px; }
.ligne-devis-rangee--bas .champ-commentaire { flex: 3 1 180px; min-width: 180px; }
.ligne-devis .champ { margin-bottom: 0; }
.ligne-devis .champ label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em;
  color: var(--gris); margin-bottom: .2rem; }
.ligne-devis select, .ligne-devis input[type=text] { width: 100%; }
.champ-suffixe { position: relative; }
.champ-suffixe input { padding-right: 1.9rem; text-align: right; }
.champ-suffixe .suffixe { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%);
  color: var(--gris); font-size: .9rem; pointer-events: none; }
.ligne-devis-suppr { flex: 0 0 auto; margin-left: auto; width: 30px; height: 30px;
  border-radius: 999px; border: 1px solid #F1C7C2; background: #fff; color: #B42318; font-size: 1.2rem;
  line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.ligne-devis-suppr:hover { background: #FEF3F2; }
@media (max-width: 720px) {
  .ligne-devis-rangee--haut .champ-zone, .ligne-devis-rangee--haut .champ-type,
  .ligne-devis-rangee--haut .champ-action, .ligne-devis-rangee--bas .champ-severite,
  .ligne-devis-rangee--bas .champ-prix, .ligne-devis-rangee--bas .champ-commentaire {
    flex-basis: 100%;
  }
}
.matrice input { padding: .35rem; text-align: right; min-width: 74px; }
.matrice th.zone, .matrice td.zone { text-align: left; white-space: nowrap; font-weight: 600; font-size: .85rem; }
.qr { background: #fff; padding: 1rem; display: inline-block; border: 1px solid var(--bord); border-radius: var(--radius); }
.qr svg { width: 220px; height: 220px; }
code.url { display: block; background: #F2F4F7; padding: .65rem .8rem; border-radius: 6px; word-break: break-all;
  font-size: .9rem; margin-bottom: .8rem; }

/* Devis client imprimable */
.devis { max-width: 800px; margin: 1.5rem auto; background: #fff; border: 1px solid var(--bord);
  border-radius: var(--radius); padding: 2rem; }
.devis-entete { display: flex; justify-content: space-between; gap: 1.5rem; border-bottom: 2px solid var(--bleu);
  padding-bottom: 1rem; margin-bottom: 1.3rem; }
.devis-entete img { max-height: 70px; max-width: 200px; }
.devis-blocs { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1.3rem; }
@media (max-width: 620px) { .devis-entete, .devis-blocs { display: block; } }
.devis h1 { font-size: 1.35rem; }
.mentions { font-size: .82rem; color: var(--gris); white-space: pre-line; margin-top: 1.2rem; }
.actions-devis { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.5rem; }
@media print {
  .no-print, .entete-pub, .actions-devis { display: none !important; }
  body { background: #fff; }
  .devis { border: 0; margin: 0; padding: 0; max-width: none; }
}
