/* Thème clair aux couleurs des logos : bleu marine et rouge AERIA, vert Egis */
:root {
  --aeria: #25307a; --aeria-2: #3a47a3; --aeria-soft: #e9ecf8; --aeria-red: #e8452c; --egis: #8cb31c; --egis-dark: #5d7d0c; --egis-soft: #f1f7e1;
  --bg: #f2f4f8; --panel: #ffffff; --panel2: #f7f8fb; --line: #e1e5ee; --line2: #eef1f6; --text: #1a2142; --muted: #67718b;
  --accent: var(--aeria);
  --arr: #5d8a0e; --dep: #25307a; --ind: #8a93a8; --late: #d6331c; --early: #4f8a10;
  --shadow: 0 1px 2px rgba(26, 33, 66, 0.06), 0 1px 6px rgba(26, 33, 66, 0.05);
  --side: 176px; --top: 56px; --foot: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.35 "Segoe UI", system-ui, -apple-system, sans-serif; overflow: hidden; }
body { display: grid; grid-template: var(--top) 1fr var(--foot) / var(--side) 1fr; grid-template-areas: "top top" "side main" "foot foot"; }

/* ---------- En-tête ---------- */
#top { grid-area: top; position: relative; display: flex; align-items: center; gap: 16px; padding: 0 14px 3px 10px; background: #fff; min-width: 0; z-index: 10;
  box-shadow: 0 2px 8px rgba(26, 33, 66, 0.08); }
/* liseré tricolore repris des logos : marine (AERIA), rouge (avion AERIA), vert (Egis) */
#top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--aeria) 0 62%, var(--aeria-red) 62% 81%, var(--egis) 81% 100%); }
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; flex: none; height: 100%; }
.logo-aeria { display: inline-flex; align-items: center; height: 42px; }
.logo-aeria img { height: 100%; width: auto; display: block; mix-blend-mode: multiply; }
.by-egis { display: inline-flex; align-items: flex-end; gap: 5px; height: 42px; padding: 0 0 4px 12px; border-left: 1px solid var(--line); }
.by-egis span { font-size: 11px; font-style: italic; font-weight: 600; color: var(--muted); line-height: 1; padding-bottom: 3px; }
.by-egis img { height: 20px; width: auto; display: block; mix-blend-mode: multiply; }
.brand-text { padding-left: 12px; border-left: 1px solid var(--line); line-height: 1.2; }
.brand-text b { display: block; font-size: 13px; letter-spacing: 0.4px; color: var(--aeria); }
.brand-text small { display: block; color: var(--muted); font-size: 10.5px; }
@media (max-width: 1350px) { .brand-text { display: none; } }
#tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; min-width: 0; align-self: stretch; align-items: center; }
#tabs a { position: relative; color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; font-size: 12.5px; font-weight: 500; }
#tabs a:hover { background: var(--aeria-soft); color: var(--aeria); }
#tabs a.on { background: var(--aeria); color: #fff; font-weight: 600; box-shadow: inset 0 -3px 0 var(--aeria-red); }
.side-toggle { background: #fff; border: 1px solid var(--line); color: var(--aeria); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; flex: none; font-weight: 700; }
.logout { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 8px; color: var(--aeria); text-decoration: none; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; background: #fff; }
.logout .who { color: var(--muted); font-weight: 500; padding-right: 8px; border-right: 1px solid var(--line); }
.logout:hover { border-color: var(--aeria-red); color: var(--aeria-red); }
.side-toggle:hover { border-color: var(--aeria); background: var(--aeria-soft); }

/* ---------- Colonne des filtres ---------- */
#side { grid-area: side; position: relative; isolation: isolate; overflow-y: auto; padding: 8px 6px; display: flex; flex-direction: column; gap: 6px; background: #fff; border-right: 1px solid var(--line); }
#side .panel { box-shadow: none; background: rgba(255, 255, 255, 0.82); }
/* Filigrane : le récepteur ADS-B (feeder) en dessin au crayon, encre marine AERIA, très atténué, sous les filtres */
#side::after { content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; height: min(62%, 330px); pointer-events: none;
  background: url("img/feeder-sketch.png") center bottom / contain no-repeat; opacity: 0.13;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 35%); mask-image: linear-gradient(to bottom, transparent 0, #000 35%); }
body.side-collapsed { grid-template-columns: 0 1fr; }
body.side-collapsed #side { display: none; }
#main { grid-area: main; position: relative; overflow: hidden; }

/* ---------- Pied de page ---------- */
#foot { grid-area: foot; display: flex; gap: 20px; justify-content: space-between; align-items: center; padding: 0 12px; color: #dfe3f5; font-size: 11px; background: var(--aeria); }
#foot > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#foot { overflow: hidden; }
@media (max-width: 1100px) { #foot #meta { display: none; } }
#foot #pbi::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--egis); margin-right: 7px; vertical-align: 0; }

/* ---------- Panneaux ---------- */
.page { position: absolute; inset: 0; display: grid; gap: 7px; padding: 7px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; box-shadow: var(--shadow); }
.panel-title { display: flex; align-items: center; gap: 6px; padding: 4px 8px; font-weight: 600; font-size: 11.5px; color: var(--aeria); border-bottom: 1px solid var(--line2); background: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-title::before { content: ""; flex: none; width: 3px; height: 11px; border-radius: 2px; background: var(--aeria-red); }
.panel-info { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 11px; }
.panel-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.kpi { padding: 4px 10px; justify-content: center; border-top: 3px solid var(--aeria); }
.kpi-label { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 21px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--aeria); }
.kpi-sub { color: var(--muted); font-size: 11px; }
.kpi.arr { border-top-color: var(--egis); } .kpi.arr .kpi-value { color: var(--arr); }
.kpi.dep { border-top-color: var(--aeria-red); } .kpi.dep .kpi-value { color: var(--dep); }
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; min-height: 0; }
#side .kpi .kpi-value { font-size: 16px; } #side .kpi { padding: 3px 7px; border-top-width: 2px; } #side .kpi-sub { display: none; }
.kpi-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- Filtres ---------- */
input, select { font: inherit; color: var(--text); }
.slicer-search { margin: 3px 4px 1px; padding: 2px 6px; font-size: 11.5px; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; }
.slicer-search:focus, .textfilter input:focus, .range input:focus { outline: none; border-color: var(--aeria-2); box-shadow: 0 0 0 2px var(--aeria-soft); background: #fff; }
.slicer-list { overflow-y: auto; flex: 1; padding: 1px 3px 3px; }
.slicer-item { display: flex; justify-content: space-between; gap: 6px; padding: 1px 5px; border-radius: 3px; cursor: pointer; font-size: 11.5px; line-height: 1.35; }
.slicer-item:hover { background: var(--aeria-soft); }
.slicer-item.on { background: var(--aeria); color: #fff; } .slicer-item.on .slicer-count { color: #cdd3f0; }
.slicer-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slicer-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 10.5px; }
.slicer-clear { margin-left: auto; display: none; background: none; border: 0; color: var(--aeria-red); cursor: pointer; font-weight: 700; }
.slicer-clear.show { display: inline; }
.textfilter input, .range input, select { padding: 6px 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; }
.textfilter .panel-body { padding: 3px 5px; } .textfilter input { width: 100%; padding: 3px 6px; font-size: 12px; }
.range { display: flex; align-items: center; gap: 4px; padding: 3px 5px; } .range input[type=number] { width: 0; flex: 1; padding: 2px 4px; font-size: 12px; }
.range input[type=checkbox], .chk input { accent-color: var(--aeria); }
.alt { padding: 2px 2px 4px; }
.chk { display: flex; align-items: center; gap: 6px; padding: 3px 8px; cursor: pointer; }
.day-list { padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.chip { background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 4px; padding: 2px 4px; font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--aeria-2); color: var(--aeria); } .chip.on { background: var(--aeria); border-color: var(--aeria); color: #fff; }
.row { display: flex; gap: 4px; padding: 2px 5px; flex-wrap: wrap; align-items: center; }
.btn { background: #fff; border: 1px solid var(--line); color: var(--aeria); border-radius: 5px; padding: 6px 10px; cursor: pointer; font: inherit; font-weight: 600; }
.btn:hover { border-color: var(--aeria); background: var(--aeria-soft); } .btn.sm { padding: 1px 6px; font-size: 11px; }
.hint { color: var(--muted); font-size: 11px; margin: 4px 8px; }
.no-alt-note { display: none; color: var(--aeria-red); }
body.no-alt .no-alt-note { display: block; }
body.no-alt .alt .range, body.no-alt .alt .row, body.no-alt .alt .chk { opacity: 0.4; pointer-events: none; }
input[type=range] { margin: 4px 8px; accent-color: var(--aeria); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow: auto; flex: 1; }
table { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--aeria-soft); text-align: left; padding: 3px 6px; font-weight: 600; color: var(--aeria); cursor: pointer; white-space: nowrap; border-bottom: 1px solid #d5dbef; z-index: 1; }
td { padding: 2px 6px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
tbody tr:nth-child(even) td { background: #fafbfd; }
th.num, td.num { text-align: right; }
tr.clickable { cursor: pointer; } tbody tr:hover td { background: var(--aeria-soft); } tr.on td, tbody tr.on:nth-child(even) td { background: var(--aeria); color: #fff; }
.badge { padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.arr { background: var(--egis-soft); color: var(--arr); } .badge.dep { background: var(--aeria-soft); color: var(--dep); } .badge.ind { background: #eef0f4; color: var(--ind); }
.late { color: var(--late); font-weight: 600; } .early { color: var(--early); }

/* ---------- Graphiques et cartes ---------- */
.chart-box { position: absolute; inset: 4px; }
.map-box { position: absolute; inset: 0; background: #dfe4ec; }
.pt-canvas { position: absolute; inset: 0; z-index: 450; pointer-events: none; }
.map-tip { position: absolute; z-index: 1000; display: none; pointer-events: none; background: #fff; color: var(--text); border: 1px solid var(--line); border-top: 3px solid var(--aeria); border-radius: 6px; padding: 6px 9px; font-size: 12px; min-width: 170px; box-shadow: 0 6px 18px rgba(26, 33, 66, 0.18); }
.map-tip strong { color: var(--aeria); }
.map-tip div { display: flex; justify-content: space-between; gap: 12px; } .map-tip span { color: var(--muted); }
.map-legend { position: absolute; z-index: 800; left: 8px; bottom: 22px; background: rgba(255, 255, 255, 0.94); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 11px; display: none; min-width: 160px; box-shadow: 0 4px 12px rgba(26, 33, 66, 0.15); }
.map-legend b { color: var(--aeria); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.map-legend .grad { height: 8px; border-radius: 3px; margin: 4px 0 2px; } .map-legend .grad-l { display: flex; justify-content: space-between; color: var(--muted); }
.map-legend .sub { color: var(--muted); margin-top: 3px; }
.pk-label { color: #ffd166; font-size: 10px; font-weight: 700; text-align: center; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.leaflet-container { font: inherit; }
.leaflet-bar a, .leaflet-control-layers { color: var(--aeria) !important; }
.clock { font-size: 28px; font-weight: 700; padding: 8px; font-variant-numeric: tabular-nums; color: var(--aeria); }
.panel label { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; color: var(--muted); }
.panel label.chk { flex-direction: row; color: var(--text); }

/* ---------- Écran de chargement ---------- */
#loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: #fff; z-index: 5000; color: var(--muted); }
#loading::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: linear-gradient(90deg, var(--aeria) 0 62%, var(--aeria-red) 62% 81%, var(--egis) 81% 100%); }
.loading-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo-aeria.lg { height: 110px; }
.by-egis.lg { height: 34px; border-left: 0; padding: 0; align-items: center; gap: 8px; }
.by-egis.lg span { font-size: 14px; padding: 0; } .by-egis.lg img { height: 30px; }
.loading-title { color: var(--aeria); font-weight: 600; letter-spacing: 0.6px; font-size: 13px; text-transform: uppercase; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--aeria-soft); border-top-color: var(--aeria); border-right-color: var(--aeria-red); border-bottom-color: var(--egis); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #cfd5e3; border-radius: 4px; } ::-webkit-scrollbar-thumb:hover { background: #aab3c9; }
