/* Réserves CADEI — charte CADEI Conseils (Barlow, bleu document, marine) */
@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(../fonts/barlow-400.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(../fonts/barlow-600.woff2) format('woff2'); }
@font-face { font-family: Barlow; font-weight: 700; font-display: swap; src: url(../fonts/barlow-700.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --fond-page: #f5f6f8; --surface: #fefefe; --blanc: #ffffff; --fond-alterne: #eef1f5;
  --encre: #1b2430; --marine: #152238; --texte-2: #566171; --trait: #dde2e8; --trait-fort: #c3cad4; --piste: #e6eaf0;
  --bleu: #2563c9; --vert: #34c77b; --vert-fonce: #1f9d63; --vert-texte: #14663f; --vert-fond: #e3f5ec;
  --orange: #a8500a; --orange-texte: #7a3e00; --orange-fond: #fde6c4;
  --r8: 8px; --r10: 10px; --r12: 12px; --r16: 16px;
  --haut: env(safe-area-inset-top, 0px); --bas: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond-page); color: var(--encre); font-family: Barlow, Arial, sans-serif; font-size: 16px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: var(--bleu); }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- structure ---------- */
.entete { position: sticky; top: 0; z-index: 20; background: var(--blanc); border-bottom: 1px solid var(--trait); padding: calc(8px + var(--haut)) 12px 8px; }
.entete-l { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 8px; min-height: 48px; }
.entete .titre { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entete .titre b { font-size: 18px; font-weight: 600; color: var(--marine); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete .titre span { font-size: 13px; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete .logo { height: 40px; width: auto; }
.btn-icone { width: 44px; height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--texte-2); border-radius: var(--r10); background: var(--blanc); cursor: pointer; color: var(--marine); text-decoration: none; padding: 0; }
.btn-icone.sans-bord { border-color: transparent; }
.pastille-sync { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--trait-fort); background: var(--blanc); font-size: 13px; font-weight: 600; color: var(--marine); cursor: pointer; white-space: nowrap; }
.pastille-sync.hors { background: var(--orange-fond); border-color: var(--orange-fond); color: var(--orange-texte); }
.pastille-sync .point { width: 8px; height: 8px; border-radius: 50%; background: var(--vert-fonce); }
.pastille-sync.hors .point { background: var(--orange-texte); }
.pastille-sync.envoi .point { background: var(--bleu); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

main { max-width: 1200px; margin: 0 auto; padding: 16px 16px calc(32px + var(--bas)); display: flex; flex-direction: column; gap: 16px; }
main.etroit { max-width: 640px; }
.pile { display: flex; flex-direction: column; gap: 12px; }
.rangee { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.entre { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grille2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }

/* ---------- typographie ---------- */
h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 600; color: var(--marine); }
h2 { margin: 0; font-size: 20px; font-weight: 600; color: var(--marine); }
h3 { margin: 0; font-size: 17px; font-weight: 600; color: var(--marine); }
.sur-titre { font-size: 13px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--bleu); }
.discret { color: var(--texte-2); font-size: 14px; }
.petit { font-size: 13px; }
.gras { font-weight: 600; }
.a-completer { color: var(--orange); font-weight: 600; }
p { margin: 0; }

/* ---------- cartes, encadrés ---------- */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r12); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.carte.lien { cursor: pointer; text-decoration: none; color: inherit; padding: 14px 16px; gap: 8px; }
.carte.lien:hover { border-color: var(--trait-fort); }
.carte.action { border-top: 6px solid var(--vert); }
.carte.alerte { border-top: 6px solid var(--orange-texte); }
.info { background: var(--fond-alterne); border-radius: var(--r10); padding: 10px 12px; font-size: 15px; }
.attention { background: var(--orange-fond); color: var(--orange-texte); border-radius: var(--r12); padding: 12px 14px; font-size: 14px; }
.succes { background: var(--vert-fond); color: var(--vert-texte); border: 2px solid var(--vert); border-radius: var(--r12); padding: 12px 14px; font-size: 15px; }
.erreur-txt { color: #a12a2a; font-size: 14px; font-weight: 600; }

/* ---------- statuts ---------- */
.badge { display: inline-block; font-size: 13px; font-weight: 600; line-height: 1.2; padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.s-A_LEVER { background: var(--fond-alterne); color: var(--marine); border-color: var(--trait-fort); }
.s-CONTESTEE { background: var(--blanc); color: var(--orange-texte); border-color: var(--orange-texte); }
.s-LEVEE_DECLAREE { background: var(--orange-fond); color: var(--orange-texte); border-color: var(--orange-fond); }
.s-VISEE_MOE { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.s-LEVEE { background: var(--vert-fond); color: var(--vert-texte); border-color: var(--vert); }
.s-ANNULEE { background: var(--blanc); color: var(--texte-2); border-color: var(--trait-fort); text-decoration: line-through; }
.badge.attente { background: var(--blanc); color: var(--bleu); border: 1px dashed var(--bleu); }
.retard { color: #a12a2a; font-weight: 600; }

/* ---------- boutons ---------- */
.btn { min-height: 48px; padding: 0 18px; border-radius: var(--r12); border: 0; background: var(--bleu); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center; }
.btn.sec { background: var(--blanc); color: var(--marine); border: 1px solid var(--marine); }
.btn.ok { background: var(--vert-texte); }
.btn.marine { background: var(--marine); }
.btn.petit { min-height: 40px; font-size: 15px; padding: 0 14px; }
.btn.large { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--trait); color: var(--texte-2); border-color: var(--trait); cursor: not-allowed; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* ---------- formulaires ---------- */
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > label, .champ > .lbl { font-size: 15px; font-weight: 600; color: var(--marine); }
.champ input, .champ select, .champ textarea, input.ctl, select.ctl { width: 100%; min-height: 44px; border: 1px solid var(--texte-2); border-radius: var(--r10); padding: 8px 12px; background: var(--blanc); font-size: 16px; }
.champ textarea { resize: vertical; min-height: 88px; line-height: 1.4; }
.code-acces { font-size: 22px !important; letter-spacing: 2px; text-transform: uppercase; text-align: center; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: var(--fond-alterne); border-radius: var(--r12); padding: 4px; }
.seg button { min-height: 44px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--texte-2); font-size: 15px; font-weight: 600; cursor: pointer; padding: 0 6px; }
.seg.filtres { grid-auto-columns: max-content; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.seg.filtres button { white-space: nowrap; padding: 0 12px; }
.seg button[aria-pressed="true"] { background: var(--blanc); color: var(--marine); border-color: var(--trait-fort); }
.case { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.35; cursor: pointer; }
.case input { width: 20px; height: 20px; flex-shrink: 0; margin: 1px 0 0; }

/* ---------- indicateurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r12); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.kpi b { font-size: 28px; line-height: 1.1; font-weight: 700; color: var(--marine); }
.kpi span { font-size: 14px; color: var(--texte-2); }
.kpi.orange { background: var(--orange-fond); border-color: var(--orange-fond); } .kpi.orange b, .kpi.orange span { color: var(--orange-texte); }
.kpi.bleu { border-color: var(--bleu); } .kpi.bleu b { color: var(--bleu); }
.kpi.vert { background: var(--vert-fond); border: 2px solid var(--vert); } .kpi.vert b, .kpi.vert span { color: var(--vert-texte); }
.kpi.conteste { border-color: var(--orange-texte); } .kpi.conteste b, .kpi.conteste span { color: var(--orange-texte); }
.barre { height: 10px; background: var(--piste); border-radius: 4px; overflow: hidden; flex: 1; min-width: 60px; }
.barre i { display: block; height: 10px; background: var(--vert-fonce); border-radius: 4px; }

/* ---------- réserves ---------- */
.res-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.res-num { font-size: 14px; font-weight: 600; color: var(--texte-2); }
.res-titre { font-size: 17px; line-height: 1.3; font-weight: 600; color: var(--marine); }
.res-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--texte-2); }
.details { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r12); padding: 4px 16px; }
.details div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--trait); font-size: 15px; }
.details div:last-child { border-bottom: 0; }
.details dt { color: var(--texte-2); margin: 0; } .details dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- photos ---------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r10); overflow: hidden; background: var(--fond-alterne); border: 1px solid var(--trait); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--texte-2); text-align: center; padding: 0; cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.vide { border-style: dashed; border-color: var(--texte-2); cursor: default; }
.photo .suppr { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(21,34,56,.85); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.photo .doc { padding: 8px; font-weight: 600; color: var(--marine); }
.ajout-photo { min-height: 88px; border: 1px solid var(--texte-2); border-radius: var(--r10); background: var(--blanc); color: var(--marine); font-size: 15px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; }
.ajout-photo.requis { border: 2px dashed var(--bleu); color: var(--bleu); }
.comparatif { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.comparatif figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.comparatif .photos { grid-template-columns: 1fr; }
.comparatif figcaption { font-size: 13px; color: var(--texte-2); }

/* ---------- plans et pastilles ---------- */
.plan-zone { position: relative; overflow: auto; max-height: 72vh; border: 1px solid var(--trait-fort); border-radius: var(--r12); background: var(--blanc); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.plan-zone.plan-mini { height: 240px; max-height: none; }
.plan-toile { position: relative; min-width: 100%; }
.plan-toile.pointeur { cursor: crosshair; }
.plan-cadre { position: relative; width: 100%; height: 0; background: var(--fond-alterne); }
.plan-cadre img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.plan-cadre.vide::after { content: 'Plan non disponible hors ligne'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--texte-2); font-size: 14px; }
.pastille { position: absolute; transform: translate(-50%, -50%); min-width: 28px; height: 28px; padding: 0 4px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; line-height: 1; color: #fff; background: var(--marine); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); text-decoration: none; z-index: 2; }
.pastille.s-A_LEVER { background: #c2410c; color: #fff; }
.pastille.s-CONTESTEE { background: #fff; color: var(--orange-texte); border-color: var(--orange-texte); }
.pastille.s-LEVEE_DECLAREE { background: var(--orange-fond); color: var(--orange-texte); border-color: var(--orange-texte); }
.pastille.s-VISEE_MOE { background: var(--bleu); color: #fff; }
.pastille.s-LEVEE { background: var(--vert-texte); color: #fff; }
.pastille.s-ANNULEE { background: #fff; color: var(--texte-2); border-color: var(--trait-fort); text-decoration: line-through; }
.pastille.choix { background: #d0312d; color: #fff; min-width: 34px; height: 34px; border-radius: 17px; font-size: 13px; z-index: 3; }
.pastille.focus { outline: 3px solid #d0312d; outline-offset: 2px; z-index: 3; }
.pastille.statique { position: static; transform: none; min-width: 18px; height: 18px; border-width: 2px; box-shadow: none; display: inline-block; vertical-align: middle; }
.legende { display: inline-flex; align-items: center; gap: 6px; color: var(--texte-2); }
.plan-outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plan-outils .btn.petit[data-z] { min-width: 44px; font-size: 20px; padding: 0 10px; }
.plan-vignette { width: 88px; height: 62px; border: 1px solid var(--trait); border-radius: var(--r8); overflow: hidden; background: var(--fond-alterne); flex-shrink: 0; }
.plan-vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- historique ---------- */
.histo { display: flex; flex-direction: column; gap: 12px; padding: 0 4px; }
.histo-l { display: flex; gap: 12px; }
.histo-l .pt { width: 10px; height: 10px; margin-top: 6px; flex-shrink: 0; border-radius: 50%; background: var(--marine); }
.histo-l .pt.attente { background: var(--blanc); border: 2px solid var(--bleu); }
.histo-l b { font-size: 15px; font-weight: 600; display: block; }
.histo-l .txt { font-size: 15px; background: var(--fond-alterne); border-radius: 8px; padding: 6px 10px; margin-top: 4px; white-space: pre-wrap; }

/* ---------- tableaux ---------- */
.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tab { width: 100%; border-collapse: collapse; font-size: 15px; }
table.tab th { text-align: left; color: var(--texte-2); font-size: 14px; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--trait-fort); white-space: nowrap; }
table.tab td { padding: 10px; vertical-align: middle; }
table.tab tr:nth-child(even) td { background: var(--fond-alterne); }
table.tab tr.clic { cursor: pointer; }
table.tab tr.clic:hover td { background: #e4e9f1; }
table.tab .num { text-align: right; }
table.tab input.ctl, table.tab select.ctl { min-height: 40px; padding: 6px 8px; font-size: 15px; }

/* ---------- superpositions ---------- */
.voile { position: fixed; inset: 0; z-index: 50; background: rgba(21, 34, 56, .55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.feuille { background: var(--surface); border-radius: var(--r16); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: var(--bas); }
@media (min-width: 700px) { .voile { align-items: center; } }
.loupe { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.loupe img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.loupe button { position: absolute; top: calc(12px + var(--haut)); right: 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + var(--bas)); z-index: 70; background: var(--marine); color: #fff; padding: 12px 18px; border-radius: var(--r12); font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.code-genere { font-size: 28px; font-weight: 700; letter-spacing: 3px; color: var(--marine); text-align: center; background: var(--fond-alterne); border-radius: var(--r12); padding: 14px; user-select: all; }
.apercu-pdf { width: 100%; height: 70vh; border: 1px solid var(--trait-fort); border-radius: var(--r12); background: var(--blanc); }

/* ---------- connexion ---------- */
.connexion { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: calc(32px + var(--haut)) 20px calc(24px + var(--bas)); gap: 24px; max-width: 460px; margin: 0 auto; }
.connexion .cadre-logo { align-self: center; background: var(--blanc); border: 1px solid var(--trait); border-radius: var(--r10); padding: 12px 20px; }
.connexion .cadre-logo img { height: 104px; display: block; }
.demo-codes button { justify-content: space-between; width: 100%; }

@media (min-width: 900px) {
  main { padding: 24px 24px 48px; }
  h1 { font-size: 32px; }
  .fiche-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .seulement-mobile { display: none !important; }
}
@media (max-width: 599px) { .entete .logo { display: none; } .pastille-sync { padding: 0 8px; } .col-opt { display: none; } .pastille-sync .long { display: none; } }
@media (min-width: 600px) { .col-mob { display: none; } .pastille-sync .court { display: none; } }
@media (max-width: 899px) { .seulement-large { display: none !important; } }
@media print { .entete, .pastille-sync, .btn { display: none !important; } }
