:root{
  --bg0:#070a12;
  --bg1:#0b1020;
  --panel:rgba(16,22,35,.82);
  --panel2:rgba(16,22,35,.92);
  --border:rgba(255,255,255,.08);
  --text:#e8eefc;
  --muted:rgba(232,238,252,.70);
  --accent:#2e6bff;

  --c-total:#ff4d4d;
  --c-filtrant:#ffb020;
  --c-manif:#a855f7;
  --c-ralent:#22c55e;
  --c-leve:#9ca3af;
}

*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background: radial-gradient(1200px 600px at 25% 35%, #0d1632 0%, var(--bg0) 70%);
  color:var(--text);
}

#map{
  height:100vh;
  width:100vw;
}

/* Top bar */
#topbar{
  position:fixed;
  top:12px;
  left:12px;
  right:12px;
  z-index:1200;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
  background:linear-gradient(180deg, rgba(9,14,25,.85), rgba(9,14,25,.55));
  border:1px solid var(--border);
  border-radius:14px;
  backdrop-filter: blur(10px);
}

#title{
  font-weight:700;
  letter-spacing:.2px;
}
#subtitle{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
}

#legend{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:center;
}

.legend-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  cursor:pointer;
  user-select:none;
  transition:.15s ease;
}
.legend-item:hover{ transform:translateY(-1px); }
.legend-item.active{
  border-color:rgba(46,107,255,.45);
  box-shadow:0 0 0 3px rgba(46,107,255,.15);
}

.dot{
  width:10px;height:10px;border-radius:999px;
  display:inline-block;
}
.dot.total{ background:var(--c-total); }
.dot.filtrant{ background:var(--c-filtrant); }
.dot.manif{ background:var(--c-manif); }
.dot.ralent{ background:var(--c-ralent); }
.dot.leve{ background:var(--c-leve); }

#btnRefresh{
  background:rgba(255,255,255,.06);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:12px;
  padding:8px 12px;
  cursor:pointer;
}
#btnRefresh:hover{ border-color:rgba(255,255,255,.16); }

/* Sidebar → à droite */
#sidebar{
  position:fixed;
  top:86px;
  right:12px;
  left:auto;
  z-index:1100;
  width:360px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 110px);
  overflow:auto;

  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 55px rgba(0,0,0,.45);
}

#sidebar h3{
  margin:0 0 10px 0;
  font-size:15px;
}
.hint{
  color:var(--muted);
  font-size:12px;
  margin-bottom:10px;
}

.field{ margin-bottom:10px; }
.field label{
  font-size:12px;
  color:var(--muted);
  display:block;
  margin-bottom:6px;
}
input,select,textarea{
  width:100%;
  background:rgba(255,255,255,.05);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:10px;
  padding:10px 10px;
  outline:none;
}
textarea{ min-height:72px; resize:vertical; }

button.primary{
  width:100%;
  background:linear-gradient(180deg, #3574ff, #225bdf);
  border:0;
  color:white;
  border-radius:12px;
  padding:12px 12px;
  font-weight:700;
  cursor:pointer;
}
button.primary:hover{ filter:brightness(1.05); }

.small{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
}

/* Turnstile box */
#turnstileBox{
  margin-top:10px;
  padding:10px;
  border-radius:12px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--border);
}

.notice{
  margin-top:10px;
  padding:10px;
  border-radius:12px;
  border:1px solid rgba(255,170,0,.25);
  background:rgba(255,170,0,.08);
  color:rgba(255,240,210,.92);
  font-size:12px;
}

.error{
  margin-top:10px;
  padding:10px;
  border-radius:12px;
  border:1px solid rgba(255,90,90,.25);
  background:rgba(255,90,90,.08);
  color:rgba(255,210,210,.95);
  font-size:12px;
}
