:root{--vert:#2e7d32}
*{box-sizing:border-box}
html,body{height:100%;margin:0;font:13px/1.45 system-ui,Segoe UI,sans-serif;color:#222}
#app{display:flex;height:100%}
#sidebar{width:330px;min-width:330px;height:100%;overflow:auto;background:#fafafa;border-right:1px solid #e0e0e0;padding:0 14px 14px}
#map{flex:1;height:100%}
header h1{font-size:19px;margin:14px 0 .1em;color:var(--vert)}
header h1.brand{margin:12px 0 8px;line-height:0;font-size:0}   /* le h1 porte le logo : pas d'espace texte */
.logo{display:block;width:100%;max-width:300px;height:auto}     /* logo transparent, remplit le header */
header .tag{margin:.1em 0 .4em;color:#666;font-size:11.5px}
section{border-top:1px solid #eee;padding:10px 0}
h2{font-size:12.5px;margin:.1em 0 .5em;color:#33691e;text-transform:uppercase;letter-spacing:.3px}
select{width:100%;padding:5px;border:1px solid #ccc;border-radius:5px;background:#fff;font:inherit}
label.lyr{display:flex;align-items:center;gap:6px;margin:3px 0;cursor:pointer}
label.lyr i{width:14px;height:14px;display:inline-block;border:1px solid #0002;border-radius:2px}
.info{margin-top:6px;font-size:12px}
.info table{border-collapse:collapse;width:100%;margin-top:4px}
.info td,.info th{border:1px solid #eaeaea;padding:2px 5px;text-align:right}
.info td:first-child,.info th:first-child{text-align:left}
.info thead th{background:#f1f8e9}
.legend{display:flex;flex-wrap:wrap;gap:8px 12px;margin:2px 0 6px;font-size:11.5px}
.legend i{width:13px;height:13px;display:inline-block;vertical-align:-2px;margin-right:4px;border-radius:2px}
.legend .st-produite{background:rgba(46,125,50,.35);border:1px solid #2e7d32}
.legend .st-en_cours{background:rgba(251,192,45,.5);border:1px solid #f57f17}
.legend .st-a_produire{background:rgba(120,144,156,.18);border:1px dashed #607d8b}
.legend .st-erreur{background:rgba(198,40,40,.4);border:1px solid #b71c1c}
.queue{margin:4px 0 0;padding-left:20px}
.queue li{margin:1px 0}
#queuePanel{border-left:3px solid #cfd8dc;padding-left:8px;color:#546e7a}
.btns{display:flex;gap:8px;margin-top:6px}
button{flex:1;padding:6px;border:1px solid #bbb;border-radius:5px;background:#fff;cursor:pointer;font:inherit}
button:hover:not(:disabled){background:#eef7ee;border-color:var(--vert)}
button:disabled{opacity:.5;cursor:default}
pre{background:#263238;color:#e0f2e9;padding:8px;border-radius:5px;font-size:11px;white-space:pre-wrap;word-break:break-all;margin-top:6px}
footer{border-top:1px solid #eee;padding-top:8px;margin-top:4px}
.muted{color:#888;font-size:11px;margin:.35em 0 0}
/* dalle en cours de calcul : pulsation translucide */
@keyframes pulse{0%,100%{opacity:.35}50%{opacity:.75}}
.tile-encours{animation:pulse 1.2s ease-in-out infinite}
.leaflet-container{background:#dfe6e9}
/* fenetre de consentement reseau */
.modal{position:fixed;inset:0;z-index:3000;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center}
.modal[hidden]{display:none}
.modal-box{background:#fff;max-width:520px;margin:16px;padding:20px 22px;border-radius:10px;box-shadow:0 8px 40px rgba(0,0,0,.4);max-height:90vh;overflow-y:auto;overscroll-behavior:contain}
.modal-box h2{margin:.1em 0 .5em;color:var(--vert);font-size:17px}
.modal-box ul{margin:.4em 0;padding-left:1.2em}
.modal-box li{margin:.25em 0}
.modal-btns{display:flex;gap:10px;margin:14px 0 6px;flex-wrap:wrap}
.modal-btns button{flex:1;min-width:200px;padding:9px}
button.primary{background:var(--vert);color:#fff;border-color:var(--vert)}
button.primary:hover:not(:disabled){background:#255d27;color:#fff}
#netState a{color:#33691e;cursor:pointer;text-decoration:underline}
/* contrôles segmentés */
.seg-group{display:inline-flex;border:1px solid #cfcfcf;border-radius:6px;overflow:hidden}
.seg{flex:0 0 auto;border:0;border-right:1px solid #e0e0e0;border-radius:0;background:#fff;padding:5px 12px;cursor:pointer;font:inherit;color:#333}
.seg:last-child{border-right:0}
.seg:hover:not(.active){background:#eef7ee}
.seg.active{background:var(--vert);color:#fff}
.opt{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:7px 0;font-size:12px}
#selectPanel{margin-top:6px;padding-top:6px;border-top:1px dashed #e0e0e0}

/* Détail du temps par étape (dépliant sous « dernier calcul ») */
.etapes{margin-top:4px}
.etapes summary{cursor:pointer;color:#33691e;font-size:11.5px}
.etapes .note{font-size:10.5px;margin:.25em 0}
.etape{display:flex;align-items:center;gap:6px;font-size:11px;margin:2px 0}
.etape .lbl{flex:0 0 42%}
.etape .bar{flex:1;height:8px;background:#eef2ea;border-radius:4px;overflow:hidden}
.etape .bar i{display:block;height:100%;background:var(--vert,#558b2f)}
.etape .v{flex:0 0 auto;color:#555;white-space:nowrap}

/* Toast de fin de calcul (repli si les notifications navigateur ne sont pas autorisées) */
.toast-fin{position:fixed;right:16px;bottom:16px;z-index:9999;max-width:320px;
  background:#1b5e20;color:#fff;padding:12px 16px;border-radius:8px;
  box-shadow:0 2px 10px rgba(0,0,0,.3);font-size:14px;line-height:1.35;
  animation:toastIn .2s ease-out}
@keyframes toastIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* Journal des calculs (lien + modal + tableau triable) */
.jlink{display:inline-block;margin:.35em 0;color:#33691e;cursor:pointer;text-decoration:underline;font-size:12px}
.jlink:hover{color:var(--vert)}
.modal-box.modal-large{max-width:920px;width:94vw}
.jbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:6px 0}
.jbar button:not(.seg){flex:0 0 auto;padding:5px 12px}
#journalTable .jsum{margin:.2em 0 .4em}
#journalTable .jwrap{max-height:60vh;overflow:auto;border:1px solid #e6e6e6;border-radius:6px}
#journalTable table{border-collapse:collapse;width:100%;font-size:11.5px}
#journalTable th,#journalTable td{border:1px solid #eee;padding:3px 8px;text-align:right;white-space:nowrap}
#journalTable td.jl,#journalTable th.jl{text-align:left}
#journalTable thead th{position:sticky;top:0;background:#f1f8e9;z-index:1}
#journalTable th.jth{cursor:pointer;user-select:none}
#journalTable th.jth:hover{background:#e8f3d6}
#journalTable tbody tr:nth-child(even){background:#fafafa}

/* Journal — carte Synthèse (perf + projection, lecture client) */
.jsyn{margin:2px 0 10px}
.jsyn-row{display:flex;gap:10px;flex-wrap:wrap;margin:6px 0}
.jcard{flex:1 1 140px;background:#f1f8e9;border:1px solid #dcedc8;border-radius:8px;padding:8px 10px;text-align:center}
.jbig{font-size:20px;font-weight:700;color:#1b5e20;line-height:1.1}
.jbig2{font-size:26px;font-weight:700;color:#1b5e20;margin:2px 0}
.jlbl{font-size:11px;color:#5a6b55;margin-top:2px}
.jwhere,.jproj{margin:10px 0 2px}
.jwlbl{font-size:12px;font-weight:600;color:#33691e;margin-bottom:4px}
.jbar2{display:flex;height:22px;border-radius:6px;overflow:hidden;font-size:11px;color:#fff}
.jbar2 span{display:flex;align-items:center;justify-content:center;white-space:nowrap;min-width:0;overflow:hidden}
.jbar2 .jch{background:#2e7d32}
.jbar2 .jas{background:#9ccc65;color:#1b3a10}
.jnote{font-size:10.5px;margin:.3em 0 0}
.jproj{background:#fbfaf3;border:1px solid #eee6c8;border-radius:8px;padding:8px 10px}

/* Journal — barre décomposée (4 parts) */
.jbar2 .jp1{background:#1565c0}   /* téléchargement = réseau */
.jbar2 .jp2{background:#2e7d32}   /* rastérisation = CPU */
.jbar2 .jp3{background:#7cb342}   /* calcul = CPU */
.jbar2 .jp4{background:#c5e1a5;color:#33500f}  /* assemblage */
.jbar2 .jp5{background:#ef6c00}   /* publication : serielle, souvent dominante */

/* Journal — détail brut repliable + jeu affiché en surbrillance */
.jdetails{margin-top:10px;border-top:1px solid var(--line,#e0e6d6)}
.jdetails > summary{cursor:pointer;padding:9px 0;color:#33691e;font-size:12px;list-style:none;user-select:none}
.jdetails > summary::-webkit-details-marker{display:none}
.jdetails > summary::before{content:"▸ ";color:#8a9a7c}
.jdetails[open] > summary::before{content:"▾ "}
#journalTable tr.jhi td{background:#e8f5e9;font-weight:600}

/* Bouton d'export de la fusion : un lien de telechargement qui doit se lire comme un bouton. */
.pbtn{display:inline-block;padding:.35em .7em;border:1px solid #bbb;border-radius:5px;
  background:#f5f5f5;color:#222;text-decoration:none;font-size:inherit;cursor:pointer}
.pbtn:hover{background:#e8e8e8}
.pfusion .popts{display:flex;gap:.4em;flex-wrap:wrap;align-items:center}
