/* SDA Antananarivo — thème CUA (bleu et jaune du blason de la Commune) */
:root {
  --bleu: #2A468F;
  --bleu-vif: #1F3878;
  --marine: #14234D;
  --marine-2: #0C1633;
  --jaune: #FEF201;
  --jaune-doux: #FFF9A8;
  --fond: #F3F5FA;
  --encre: #18213A;
  --gris: #5F6884;
  --trait: #DDE2EE;
  --carte: #FFFFFF;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(20,35,77,.06), 0 6px 18px rgba(20,35,77,.07);
  --side: 272px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
img { max-width: 100%; }

/* ---------- Barre latérale ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 30; overflow-y: auto;
  background: linear-gradient(180deg, var(--marine), var(--marine-2));
  color: #E6EBF7; padding: 18px 14px 20px; display: flex; flex-direction: column;
  border-right: 4px solid var(--jaune);
}
.brand { display: flex; gap: 12px; align-items: center; color: #fff; padding: 4px 6px 18px; text-decoration: none !important; }
.brand img { border-radius: 14px; background: #fff; padding: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.brand span { display: grid; line-height: 1.15; }
.brand strong { font-size: 17px; letter-spacing: .2px; }
.brand small { color: #AEBBE0; font-size: 11.5px; margin-top: 3px; }
.nav-group { margin: 16px 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: #8C9BCB; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 2px 0;
  border-radius: 12px; color: #D6DDF2; font-weight: 500; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item .lbl { flex: 1; }
.nav-item .cnt { font-size: 12px; color: #AEBBE0; font-variant-numeric: tabular-nums; }
.nav-item .nav-logo { flex: none; border-radius: 8px; background: #fff; padding: 2px; opacity: .78; transition: opacity .15s; }
.nav-item:hover .nav-logo { opacity: 1; }
.nav-item.active { background: var(--jaune); color: var(--marine); font-weight: 650; box-shadow: 0 4px 14px rgba(0,0,0,.28); }
.nav-item.active .nav-logo { opacity: 1; }
.nav-item.active .cnt { color: var(--marine); font-weight: 700; }
.side-foot { margin: auto 8px 0; padding-top: 22px; font-size: 11.5px; color: #8C9BCB; line-height: 1.5; }

/* ---------- Barre haute mobile ---------- */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.topbar { display: none; }
.scrim { display: none; }

.main { margin-left: var(--side); padding: 26px 32px 56px; max-width: calc(1320px + var(--side)); }

/* ---------- Composants ---------- */
.card { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 20px 22px; }
.card h2 { font-size: 17px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.note { color: var(--gris); font-size: 12.5px; margin: 12px 0 0; }
.page-h { margin: 4px 0 20px; }
.page-h h1 { font-size: 27px; display: flex; align-items: center; gap: 12px; }
.page-h p { color: var(--gris); margin: 6px 0 0; max-width: 78ch; }
.crumb { margin: 0 0 6px !important; font-size: 13.5px; }
.h-logo { border-radius: 10px; background: #fff; padding: 3px; border: 1px solid var(--trait); flex: none; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 11px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap;
}
.btn-primary { background: var(--bleu); color: #fff; }
.btn-primary:hover { background: var(--bleu-vif); }
.btn-line { background: #fff; color: var(--encre); border-color: var(--trait); }
.btn-line:hover { border-color: var(--bleu); color: var(--bleu); }
.btn-light { background: var(--jaune); color: var(--marine); }
.btn-light:hover { background: #FFF75A; }
.btn-ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.5); }
.btn-ghost:hover { background: rgba(255,255,255,.25); }

.dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid; vertical-align: -1px; }
.dot.lg { width: 18px; height: 18px; border-radius: 6px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; background: color-mix(in srgb, var(--tc, #ddd) 45%, #fff); border: 1px solid color-mix(in srgb, var(--tc, #ddd) 70%, #888); }

/* ---------- Accueil ---------- */
.hero { border-radius: 20px; background-size: cover; background-position: center 40%; color: #fff; padding: 44px 40px; box-shadow: var(--ombre); }
.hero-in { max-width: 680px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; margin: 0 0 10px; color: var(--jaune); }
.hero h1 { font-size: 34px; letter-spacing: -.3px; }
.lead { font-size: 16.5px; margin: 14px 0 22px; color: #F2FAF5; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 18px 0; }
.kpi {
  position: relative; display: grid; gap: 2px; padding: 16px 18px; background: #fff; border: 1px solid var(--trait);
  border-radius: var(--rayon); box-shadow: var(--ombre); color: var(--encre); text-decoration: none !important; overflow: hidden;
  border-top: 5px solid var(--c);
}
.kpi:hover { transform: translateY(-2px); transition: transform .15s; }
.kpi-n { font-size: 30px; font-weight: 750; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi-l { font-weight: 600; }
.kpi-s { color: var(--gris); font-size: 12.5px; }

.grid2 { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.facts { display: grid; gap: 12px; margin: 0 0 18px; }
.facts div { border-left: 5px solid var(--jaune); box-shadow: -1px 0 0 var(--marine); padding-left: 12px; }
.facts dt { font-size: 24px; font-weight: 750; }
.facts dd { margin: 0; color: var(--gris); }
.sect-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sect-list li { display: flex; align-items: center; gap: 10px; }
.sect-list span { flex: 1; }
.sect-list em { font-style: normal; color: var(--gris); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.b-l { overflow-wrap: anywhere; line-height: 1.25; }
.b-t { height: 10px; background: #E7EBF5; border-radius: 999px; overflow: hidden; }
.b-t i { display: block; height: 100%; border-radius: 999px; }
.b-n { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.b-n small { color: var(--gris); font-weight: 400; }

/* ---------- Tableaux ---------- */
.tscroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--trait); white-space: nowrap; }
.tbl thead th { white-space: normal; line-height: 1.2; vertical-align: bottom; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--gris); background: #F8F9FD; position: sticky; top: 0; }
.tbl thead th a { color: inherit; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover { background: #F6F8FD; }
.tbl-data td { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; }
.nil { color: #A4ABC2; }
.empty { text-align: center; color: var(--gris); padding: 26px !important; }
.tcard { padding: 0; overflow: hidden; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; color: var(--gris); font-size: 13.5px; }
.pg { display: flex; gap: 8px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; padding: 14px; }
.fld { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; background: #fff; border: 1px solid var(--trait); border-radius: 11px; color: var(--gris); }
.fld.grow { flex: 1 1 260px; }
.fld input, .fld select { border: 0; outline: 0; background: transparent; font: inherit; color: var(--encre); width: 100%; }
.fld:focus-within { border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(42,70,143,.15); }

/* ---------- Carte ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.map-box { background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); overflow: hidden; }
.map { display: block; width: 100%; height: auto; }
.map-bg { fill: #EEF1F7; }
.map .sect { fill-opacity: .36; stroke-width: 1.6; stroke-opacity: .9; pointer-events: none; }
.map .cell { fill: transparent; pointer-events: all; cursor: zoom-in; }
.map .cell:hover { fill: rgba(42,70,143,.10); stroke: var(--bleu); stroke-width: 1.5; stroke-dasharray: 6 4; }
.map .f { pointer-events: none; }
.map a .f { pointer-events: auto; cursor: pointer; }
.map .ln { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.map .lay-reseau .ln { stroke: #8A97B5; stroke-width: 1.1; stroke-opacity: .9; }
.map .lay-caniveaux .ln { stroke: #3B9AD9; stroke-width: 1.8; }
.map .lay-primaire .ln { stroke: #2A468F; stroke-width: 3.2; }
.map .lay-regards .pt { fill: #14234D; fill-opacity: .8; }
.map .lay-ouvrages .pt { fill: #C99A00; stroke: #fff; stroke-width: 1; }
.map .lay-desordres .pt { fill: #D62F2F; stroke: #fff; stroke-width: .8; }
.map a:hover .f { stroke: #FF9F1C; stroke-width: 3.4; }
.map .hi.ln { stroke: #FF9F1C !important; stroke-width: 6 !important; }
.map .hi.pt { fill: #FF9F1C !important; stroke: #1E2A26 !important; stroke-width: 2.2 !important; }
.map .sect-label { text-anchor: middle; font: 700 17px system-ui, sans-serif; fill: #1E2A26; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 4px; pointer-events: none; }
.map .scale rect { fill: rgba(255,255,255,.85); }
.map .scale path { fill: none; stroke: #1E2A26; stroke-width: 2; }
.map .scale text { font: 600 13px system-ui, sans-serif; fill: #1E2A26; }
.map-small { max-height: 420px; }

.map-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.tool { display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 12px; font-size: 18px; font-weight: 700; border-radius: 11px; background: #fff; border: 1px solid var(--trait); color: var(--encre); text-decoration: none !important; }
.tool:hover { border-color: var(--bleu); color: var(--bleu); background: #EEF2FB; }
.map-tools .sep { width: 1px; height: 24px; background: var(--trait); margin: 0 4px; }
.zf { margin-left: auto; color: var(--gris); font-variant-numeric: tabular-nums; font-size: 13px; }
.map-side { display: grid; gap: 14px; }
.chk { display: flex; align-items: center; gap: 9px; padding: 6px 0; cursor: pointer; }
.chk input { accent-color: var(--bleu); width: 16px; height: 16px; }
.chk em { margin-left: auto; font-style: normal; color: var(--gris); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 22px; height: 10px; border-radius: 3px; background: var(--c); }
.sw-regards, .sw-desordres { width: 10px; height: 10px; border-radius: 50%; }
.sw-ouvrages { width: 10px; height: 10px; border-radius: 2px; }
.map-side .btn { width: 100%; justify-content: center; margin-top: 10px; }
.jump { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.jump a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--encre); font-weight: 500; }
.jump a:hover { background: #EEF1F8; text-decoration: none; }

/* ---------- Fiche objet ---------- */
.obj-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.props { margin: 0; display: grid; }
.props div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--trait); }
.props dt { color: var(--gris); }
.props dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.props .vide dd { color: #A4ABC2; font-weight: 400; }
.obj-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 4px; }
.obj-layout .pager { padding: 12px 0 0; }

/* ---------- Secteurs / à propos ---------- */
.sect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.sect-card { border-top: 5px solid var(--ss); display: grid; gap: 12px; align-content: start; }
.sect-card header { display: flex; justify-content: space-between; align-items: center; }
.sect-card h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.area { color: var(--gris); font-size: 13px; }
.mini { list-style: none; margin: 0; padding: 0; }
.mini a { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--encre); border-bottom: 1px dashed var(--trait); }
.mini a span { flex: 1; }
.mini a:hover { color: var(--bleu); text-decoration: none; }
.plan img { width: 100%; max-width: 640px; height: auto; border-radius: 10px; display: block; margin: 0 auto; }
.prose h2 { margin-top: 18px; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 20px; margin: 0; display: grid; gap: 8px; }
.prose code { background: #EEF1F8; padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.logo-preview img { border-radius: 16px; box-shadow: var(--ombre); }

/* ---------- Mobile / tablette ---------- */
@media (max-width: 1100px) {
  .grid2, .map-layout, .obj-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; height: 56px;
    padding: 0 14px; background: var(--marine); color: #fff; border-bottom: 3px solid var(--jaune);
  }
  .menu-btn { display: grid; cursor: pointer; }
  .menu-btn img { width: 40px; height: 40px; border-radius: 11px; background: #fff; padding: 2px; display: block; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; width: min(84vw, 300px); }
  .nav-toggle:checked ~ .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.45); }
  .main { margin-left: 0; padding: 18px 14px 44px; }
  .hero { padding: 28px 22px; }
  .hero h1 { font-size: 26px; }
  .page-h h1 { font-size: 23px; }
}
@media print {
  .sidebar, .topbar, .map-tools, .filters, .pager { display: none !important; }
  .main { margin: 0; padding: 0; }
}
