:root{
  --bg:#0b1220;
  --paper:#ffffff;
  --ink:#0b1220;
  --muted:#52607a;
  --stroke:rgba(0,0,0,.10);
  --shadow:0 16px 40px rgba(0,0,0,.18);
  --r:16px;

  --red:#e53935;
  --orange:#fb8c00;
  --brown:#6d4c41;
  --purple:#8e24aa;
  --blue:#1e88e5;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--ink);
  background: linear-gradient(180deg, #0b1220 0%, #0c1830 55%, #0b1220 100%);
}


@page{
  size: A4 landscape;
  margin: 10mm;
}

@media print{
  /* fond blanc, pas d’habillage */
  body{ background:#fff !important; }
  .page{ max-width:none; margin:0; padding:0; }

  /* on cache les boutons / notes */
  .header, .actions, .smallnote{ display:none !important; }

  /* PAGE 1 : la carte doit tenir en A4 paysage */
  .card{ box-shadow:none !important; break-inside: avoid; page-break-inside: avoid; }
  .map-wrap{ height: 170mm !important; }  /* ajuste 165–175mm si besoin */
  #map{ height: 170mm !important; }

  /* IMPORTANT: forcer Leaflet à ne pas “déborder” */
  .leaflet-control-container{ break-inside: avoid; page-break-inside: avoid; }

  /* PAGE 2 : annexes */
  .annex{
    display:block !important;
    page-break-before: always;  /* le saut est ici (plus besoin du div pagebreak) */
  }
}

/* ===== PAGE FRAME ===== */
.page{
  max-width: 1280px;
  margin: 18px auto;
  padding: 0 14px 18px;
}

.header{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--r);
  padding: 14px 16px;
  color: #eef3ff;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
}

.brand{
  display:flex; gap:12px; align-items:center;
}
.brand-badge{
  width:44px; height:44px; border-radius: 14px;
  background: radial-gradient(circle at 25% 25%, rgba(255,255,255,.75), rgba(255,255,255,.12));
  border:1px solid rgba(255,255,255,.14);
  display:grid; place-items:center;
}
.brand-badge i{font-size:22px}
.brand h1{
  font-size: 16px; margin:0; font-weight: 700; letter-spacing:.2px;
}
.brand .sub{
  font-size: 12px; opacity:.86; margin-top:2px;
}

.header .meta{
  text-align:right;
  font-size:12px;
  opacity:.9;
  line-height: 1.35;
}

.layout{
  margin-top: 14px;
  display:grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
}

.card{
  background: var(--paper);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  overflow:hidden;
}

.map-wrap{
  position:relative;
  height: 720px;
}

#map{height:100%; width:100%}

.side{
  padding: 14px;
}
.side h2{
  margin: 0 0 10px;
  font-size: 14px;
}
.filters{
  display:flex; flex-wrap:wrap; gap:8px;
  margin-bottom: 10px;
}
.pill{
  border:1px solid var(--stroke);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  background: #fbfcff;
  cursor:pointer;
  user-select:none;
}
.pill.active{
  border-color: rgba(30,136,229,.35);
  color: #0b2c5e;
  background: rgba(30,136,229,.10);
}

.list{
  border-top: 1px dashed rgba(0,0,0,.12);
  margin-top: 10px;
  padding-top: 10px;
  max-height: 560px;
  overflow:auto;
}
.item{
  display:flex; gap:10px;
  padding: 10px 8px;
  border-radius: 12px;
}
.item:hover{background: rgba(30,136,229,.06)}
.item .n{
  width: 26px; height: 26px;
  border-radius: 10px;
  display:grid; place-items:center;
  background: rgba(0,0,0,.06);
  font-weight:700;
  font-size: 12px;
}
.item .txt{flex:1}
.item .txt .t{
  font-weight: 700;
  font-size: 13px;
}
.item .txt .s{
  margin-top:2px;
  font-size: 12px;
  color: var(--muted);
}
.item .tag{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--muted);
  white-space: nowrap;
  height: fit-content;
}

/* ===== Leaflet legend (FA icons) ===== */
.map-legend{
  background:#fff;
  padding: 12px 12px;
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  border:1px solid rgba(0,0,0,.10);
  font-size: 12px;
  line-height: 1.35;
}
.legend-title{font-weight:800; margin-bottom: 8px}
.legend-item{
  display:flex; align-items:center; gap:10px;
  margin: 6px 0;
}
.legend-item i{font-size: 16px; width: 18px; text-align:center}

/* ===== Cartouche map overlay ===== */
.cartouche{
  position:absolute;
  left: 14px;
  bottom: 14px;
  background:#ffffff;
  border-radius: 14px;
  border:1px solid rgba(0,0,0,.10);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  padding: 10px 12px;
  min-width: 320px;
}
.cartouche .title{font-weight: 800; font-size: 13px}
.cartouche .row{display:flex; justify-content:space-between; gap:12px; margin-top:6px; font-size: 11px; color: var(--muted)}
.cartouche .row b{color: var(--ink)}

/* ===== Footer actions ===== */
.actions{
  display:flex; gap:10px; justify-content:flex-end;
  margin-top: 12px;
}
.btn{
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.10);
  color:#eef3ff;
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:700;
  font-size: 13px;
}
.btn:hover{background: rgba(255,255,255,.16)}
.btn.primary{
  background: rgba(30,136,229,.30);
  border-color: rgba(30,136,229,.35);
}

.smallnote{
  margin-top: 10px;
  color: rgba(238,243,255,.78);
  font-size: 12px;
}

/* ===== PRINT (A4 paysage) ===== */
/*
@media print{
  body{background:#fff}
  .page{max-width:none; margin:0; padding:0}
  .header, .actions, .smallnote{display:none !important}
  .layout{grid-template-columns: 1fr 320px; gap: 10px; margin:0}
  .card{box-shadow:none}
  .map-wrap{height: 520px}
}
*/


/* ====== FULL WIDTH MAP MODE ====== */
.layout{display:block !important; margin-top:14px;}
.map-wrap{height: 760px;}
/* hide annex by default on screen; can be toggled */
.annex{margin-top:14px; padding:14px; display:none;}
.pagebreak{display:none; height:0;}

/* Annex styles */
.annex-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  padding: 6px 2px 10px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.annex-title{font-weight:900; font-size:16px;}
.annex-sub{color:var(--muted); font-size:12px; margin-top:2px;}
.annex-meta{font-size:12px; color:var(--muted); text-align:right; line-height:1.35;}
.annex-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.annex-block{
  border:1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  padding: 12px;
  background: #fbfcff;
}
.annex-block h3{
  margin:0 0 10px;
  font-size: 13px;
  font-weight: 900;
}
.legend2{display:grid; grid-template-columns: 1fr 1fr; gap:8px}
.legend2-item{display:flex; gap:10px; align-items:center; font-size:12px; color:var(--ink)}
.legend2-item i{font-size:16px; width:18px; text-align:center}

.table{
  width:100%;
  border-collapse: collapse;
  font-size:12px;
}
.table th, .table td{
  border:1px solid rgba(0,0,0,.10);
  padding: 8px 10px;
  vertical-align:top;
}
.table th{
  background: rgba(0,0,0,.03);
  font-weight:900;
}
.table .num{font-weight:900; text-align:center}
.table .nm{font-weight:800}
.table .tp{color:var(--muted); font-size:11px; margin-top:2px}
.table .coord{color:var(--muted); font-variant-numeric: tabular-nums;}

/* PRINT: show annex on page 2 */
/*
@media print{
  .pagebreak{display:block; page-break-before: always;}
  .annex{display:block !important;}
  .smallnote{display:none !important;}
  .map-wrap{height: 520px;}
}
*/

/* Marker with number */
.mk{
  position:relative;
  width:30px;height:30px;
  display:flex;align-items:center;justify-content:center;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.18));
}
.mk i{font-size:18px;line-height:1}
.mk .mk-num{
  position:absolute;
  right:-10px;
  top:-10px;
  min-width:22px;
  height:20px;
  padding:0 6px;
  display:flex;align-items:center;justify-content:center;
  background:#fff;
  border:1px solid rgba(0,0,0,.35);
  border-radius:999px;
  font-weight:900;
  font-size:11px;
  color:#111827;
}

/* Print: keep map on page 1 and avoid cutting */
/*
@media print{
  .card, .map-wrap, #map{ break-inside: avoid; page-break-inside: avoid; }
  .map-wrap{ height: 160mm !important; } 
  .header{ break-after: avoid; page-break-after: avoid; }
}
*/
