:root {
  --bleu: #1971c2; --bleu-fonce: #0b3d66; --fond: #f4f6f9; --carte: #ffffff;
  --texte: #212529; --gris: #868e96; --vert: #2f9e44; --rouge: #e03131;
  --ombre: 0 1px 4px rgba(0,0,0,.09);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--fond);
       color: var(--texte); font-size: 15px; }
a { color: var(--bleu); }

.topbar { display: flex; align-items: center; gap: 18px;
  background: linear-gradient(90deg, #0b3d66 0%, #14507f 60%, #1971c2 100%);
  color: #fff; padding: 0 18px; height: 54px; position: sticky; top: 0; z-index: 1100;
  box-shadow: 0 2px 10px rgba(11,61,102,.35); flex-wrap: wrap; }
.brand { font-weight: 600; white-space: nowrap; }
.brand .logo { background: var(--bleu); border-radius: 6px; padding: 3px 8px;
  margin-right: 6px; font-weight: 800; letter-spacing: 1px; }
.brand .subtitle { color: #9ec5e8; font-weight: 400; font-size: 12px; margin-left: 8px; }
.topbar nav { display: flex; gap: 2px; flex: 1; }
.topbar nav a { color: #cfe2f3; text-decoration: none; padding: 6px 12px; border-radius: 6px;
  font-size: 14px; }
.topbar nav a:hover { background: rgba(255,255,255,.12); }
.topbar nav a.active { background: var(--bleu); color: #fff; }
.userbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.userbox .user { color: #9ec5e8; }
.btn-sm { background: rgba(255,255,255,.14); color: #fff; text-decoration: none;
  border-radius: 6px; padding: 4px 9px; font-size: 12.5px; border: none; cursor: pointer; }
.btn-sm:hover { background: rgba(255,255,255,.26); }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }
main.fullscreen { padding: 0; max-width: none; }

h1 { font-size: 22px; margin: 4px 0 14px; color: var(--bleu-fonce); }
h2 { font-size: 17px; margin: 18px 0 8px; color: var(--bleu-fonce); }
.muted { color: var(--gris); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin-bottom: 18px; }
.card { background: var(--carte); border-radius: 10px; padding: 14px 16px;
  box-shadow: var(--ombre); }
.card .big { font-size: 26px; font-weight: 700; color: var(--bleu-fonce); }
.card .lbl { font-size: 12.5px; color: var(--gris); margin-top: 2px; }
.card.accent { border-left: 4px solid var(--bleu); }

.panel { background: var(--carte); border-radius: 10px; padding: 16px 18px;
  box-shadow: var(--ombre); margin-bottom: 16px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px;
  background: var(--carte); border-radius: 10px; overflow: hidden; box-shadow: var(--ombre); }
table.data th { background: var(--bleu); color: #fff; text-align: left; padding: 8px 10px;
  font-weight: 600; font-size: 12.5px; }
table.data td { padding: 7px 10px; border-top: 1px solid #e9ecef; vertical-align: top; }
table.data tr:hover td { background: #f1f7fd; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total td { font-weight: 700; background: #e7f0fa; }

.badge { display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 11.5px;
  color: #fff; font-weight: 600; }
.pos { color: var(--vert); font-weight: 700; }
.neg { color: var(--rouge); font-weight: 700; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 8px; background: #fff; color: var(--texte);
  text-decoration: none; box-shadow: var(--ombre); font-size: 13.5px; }
.tabs a.active { background: var(--bleu); color: #fff; }

input[type=number], input[type=text], select, textarea {
  border: 1px solid #ced4da; border-radius: 6px; padding: 6px 8px; font-size: 13.5px;
  font-family: inherit; background: #fff; }
input[type=number] { width: 110px; text-align: right; }
button.btn { background: var(--bleu); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 14px; cursor: pointer; }
button.btn:hover { background: #1864ab; }
button.btn.secondary { background: #868e96; }
button.btn.danger { background: var(--rouge); }

.login-wrap { min-height: calc(100vh - 54px); display: flex; align-items: center;
  justify-content: center; }
.login-box { background: #fff; padding: 36px 42px; border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.12); text-align: center; max-width: 420px; }
.google-btn { display: inline-flex; align-items: center; gap: 10px; background: #fff;
  border: 1px solid #ced4da; border-radius: 8px; padding: 10px 22px; font-size: 15px;
  cursor: pointer; text-decoration: none; color: var(--texte); font-weight: 600; }
.google-btn:hover { background: #f1f3f5; }
.error { background: #ffe3e3; color: #c92a2a; border-radius: 8px; padding: 10px 14px;
  margin-bottom: 14px; font-size: 13.5px; }

/* ---- carte ---- */
#map { position: fixed; inset: 54px 0 0 0; }
.map-side { position: fixed; top: 66px; right: 12px; width: 330px; max-height: calc(100vh - 90px);
  overflow-y: auto; background: rgba(255,255,255,.97); border-radius: 12px;
  box-shadow: 0 2px 14px rgba(0,0,0,.18); z-index: 1000; padding: 12px 14px; font-size: 13px; }
.map-side h3 { margin: 4px 0 8px; font-size: 14.5px; color: var(--bleu-fonce); }
.map-side .zrow { display: flex; align-items: center; gap: 6px; padding: 4px 2px;
  border-top: 1px solid #eee; cursor: pointer; }
.map-side .zrow:hover { background: #f1f7fd; }
.map-side .dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.map-side .zname { flex: 1; }
.map-side .zsurf { color: var(--gris); font-size: 12px; white-space: nowrap; }
.leaflet-popup-content { font-size: 12.5px; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: 13px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.gal-grid img { width: 100%; border-radius: 10px; box-shadow: var(--ombre); }
.prompt-card { position: relative; }
.prompt-card pre { white-space: pre-wrap; font-size: 12px; background: #f1f3f5;
  border-radius: 8px; padding: 10px; font-family: Consolas, monospace; }
.copy-btn { position: absolute; top: 10px; right: 10px; }
.formula { background: #eef4fb; border-left: 4px solid var(--bleu); border-radius: 6px;
  padding: 10px 14px; font-size: 13px; margin: 8px 0; }
details summary { cursor: pointer; color: var(--bleu); font-size: 13px; }
.map-side details { margin-bottom: 6px; border-top: 1px solid #e9ecef; padding-top: 6px; }
.map-side details summary { color: var(--bleu-fonce); font-size: 13.5px; padding: 2px 0; }
.layerlist { padding: 4px 0 2px; }
.layerlist .lrow { display: block; padding: 2.5px 2px; font-size: 12.8px; cursor: pointer;
  border-radius: 5px; }
.layerlist .lrow:hover { background: #f1f7fd; }
.layerlist .lrow input { margin-right: 6px; vertical-align: middle; }

/* ---- embellissements ---- */
.card { transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(11,61,102,.14); }
.hero { border-radius: 14px; padding: 34px 34px 26px; color: #fff; margin-bottom: 18px;
  background-size: cover; background-position: center 40%;
  box-shadow: 0 6px 24px rgba(11,61,102,.25); }
.hero h1 { color: #fff; margin: 0 0 6px; font-size: 26px; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.hero p { margin: 0; max-width: 760px; color: #e7f0fa; font-size: 14.5px;
  text-shadow: 0 1px 4px rgba(0,0,0,.45); }
.hero .hero-kpis { display: flex; gap: 22px; margin-top: 16px; flex-wrap: wrap; }
.hero .hero-kpis div { background: rgba(255,255,255,.14); backdrop-filter: blur(3px);
  border-radius: 10px; padding: 8px 16px; }
.hero .hero-kpis b { font-size: 20px; display: block; }
.hero .hero-kpis span { font-size: 12px; color: #d8e8f7; }
.btn-lien { display: inline-block; background: var(--bleu); color: #fff; text-decoration: none;
  border-radius: 8px; padding: 8px 16px; font-size: 13.5px; margin-right: 8px; }
.btn-lien:hover { background: #1864ab; }
.fig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.fig-grid figure { margin: 0; }
.fig-grid img { width: 100%; border-radius: 10px; box-shadow: var(--ombre); }
.fig-grid figcaption { font-size: 12.5px; color: #495057; margin-top: 6px; line-height: 1.5; }
.imgband { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 18px; }
.imgband a { display: block; border-radius: 12px; overflow: hidden; position: relative;
  box-shadow: var(--ombre); }
.imgband img { width: 100%; height: 130px; object-fit: cover; display: block;
  transition: transform .25s ease; }
.imgband a:hover img { transform: scale(1.05); }
.imgband .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 10px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: 12px; }
.zone-illu { float: right; width: 220px; margin: 0 0 10px 14px; border-radius: 10px;
  box-shadow: var(--ombre); }
@media (max-width: 720px) { .zone-illu { float: none; width: 100%; margin: 0 0 10px; } }

/* ---- suivi ---- */
.taskrow { display: flex; align-items: center; gap: 8px; padding: 5px 4px;
  border-top: 1px solid #f1f3f5; }
.taskrow:hover { background: #f8fbff; }
.tstatus { border: none; background: none; cursor: pointer; font-size: 15px; padding: 0 2px; }
.ttitle { flex: 1; font-size: 13.5px; cursor: default; }
.ttitle.done { text-decoration: line-through; color: var(--gris); }
.tdue { font-size: 11px; color: #e8590c; background: #fff4e6; border-radius: 10px;
  padding: 1px 8px; white-space: nowrap; }
.tdel { border: none; background: none; color: #ced4da; cursor: pointer; font-size: 13px; }
.tdel:hover { color: var(--rouge); }
.noterow { border: 1px solid #e9ecef; border-radius: 10px; padding: 8px 12px;
  margin-bottom: 8px; background: #fcfdfe; }
.notehead { display: flex; align-items: center; gap: 8px; font-size: 12px;
  margin-bottom: 4px; }
.notehead .ndel { margin-left: auto; }
.notebody { font-size: 13.5px; white-space: pre-wrap; }

/* ---- contacts ---- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px; margin-bottom: 18px; }
.contact-card { background: var(--carte); border-radius: 10px; padding: 12px 14px;
  box-shadow: var(--ombre); }
.contact-notes { font-size: 12.5px; color: #495057; background: #f8f9fa;
  border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px; }
.cf-grid input, .cf-grid select { width: 100%; }
