/* Bloomline Halifax Harbour prototype.
   Dark satellite-map look: dark satellite map, floating dark panels,
   round icon buttons, green active tab. Tokens live in :root. */

@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2"); }

:root {
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --water: #0a2748;
  --panel: rgba(15, 26, 40, 0.88);
  --panel-raised: rgba(27, 41, 59, 0.94);
  --line: rgba(255, 255, 255, 0.14);
  --text: #eaf0f8;
  --muted: #a4b5ca;
  --green: #0f9d4c;
  --green-hi: #17b85c;
  --amber: #f6b73c;
  --focus: #8fd0ff;
  --r-panel: 16px;
  --r-ctl: 12px;
  --pad: 14px;
  --edge: 16px;
  --blur: blur(12px) saturate(1.2);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--water);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
/* author display rules (flex etc.) would otherwise override the hidden attribute and leave invisible panels eating clicks */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; background: var(--water); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.map { position: fixed; inset: 0; }
.map .maplibregl-canvas { outline: none; }
.map.is-selecting, .map.is-selecting .maplibregl-canvas { cursor: crosshair; touch-action: none; }
.maplibregl-ctrl-attrib { background: rgba(10, 20, 32, 0.7) !important; color: var(--muted) !important; font-family: var(--font); }
.maplibregl-ctrl-attrib a { color: var(--text) !important; }

/* ---------- shared panel ---------- */
.panel {
  background: var(--panel);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px var(--pad) 4px; }
.panel-title { margin: 0; font-size: 15px; font-weight: 600; }
.panel-body { padding: 8px var(--pad) var(--pad); }
.muted { color: var(--muted); }
.icon { width: 20px; height: 20px; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: 16px;
  padding: var(--edge); pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.left-stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; max-width: 440px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 22px 8px 12px;
  border-radius: 999px; background: var(--panel-raised); border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  font-size: 26px; font-weight: 600; letter-spacing: 0.04em; color: var(--text); text-decoration: none;
}
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-h { background: linear-gradient(135deg, #1fa7e8, #14c45a); -webkit-background-clip: text; background-clip: text; color: transparent; }

.status { width: 100%; font-size: 12px; }
.status summary { display: flex; align-items: center; gap: 8px; padding: 9px var(--pad); cursor: pointer; list-style: none; font-weight: 500; }
.status summary::-webkit-details-marker { display: none; }
.status summary .chev { margin-left: auto; transition: transform 0.15s; }
.status[open] summary .chev { transform: rotate(180deg); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); flex: none; }
.status-body { padding: 0 var(--pad) 12px; color: var(--muted); }
.status-body p { margin: 0 0 6px; }
.status-body p:last-child { margin-bottom: 0; }

.dates { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-ctl); background: var(--panel-raised); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.date-tab { min-width: 78px; padding: 9px 14px; border: 0; border-radius: 9px; background: transparent; font-weight: 500; font-size: 15px; cursor: pointer; white-space: nowrap; }
.date-tab:hover { background: rgba(255, 255, 255, 0.08); }
.date-tab[aria-selected="true"] { background: var(--green); color: #fff; }
.date-tab small { display: block; margin-top: -2px; font-size: 10px; font-weight: 400; opacity: 0.75; }

.actions { display: flex; gap: 10px; align-items: center; position: relative; }
.round-btn {
  position: relative; display: grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: var(--panel-raised); cursor: pointer;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.round-btn:hover, .round-btn[aria-expanded="true"] { background: #2a3f58; }
.round-btn .icon { width: 24px; height: 24px; }
.badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.lang-btn { width: auto; border-radius: 26px; padding: 0 14px; gap: 6px; font-size: 13px; font-weight: 500; display: inline-flex; }
.lang-btn .icon { width: 18px; height: 18px; }

.menu { position: absolute; top: 60px; right: 0; z-index: 25; width: 270px; padding: 6px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.menu-item:hover { background: rgba(255, 255, 255, 0.08); }
.menu-item[aria-checked="true"] { background: rgba(23, 184, 92, 0.18); }
.menu-item .icon { width: 18px; height: 18px; color: var(--green-hi); }
.menu-sep { margin: 6px 6px 4px; border: 0; border-top: 1px solid var(--line); }
.menu-label { padding: 4px 12px; font-size: 12px; color: var(--muted); }
.seg { display: flex; gap: 4px; padding: 0 6px 6px; }
.seg button { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: transparent; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- dock: zone card + legend ---------- */
.dock { display: contents; }
.zone-card { position: fixed; z-index: 15; left: var(--edge); bottom: 28px; width: 330px; max-height: calc(100vh - 290px); overflow: auto; }
.legend { position: fixed; z-index: 15; right: var(--edge); bottom: 34px; width: 232px; }
.legend .panel-body { padding-top: 4px; }
.legend-title { margin: 0; padding: 12px var(--pad) 2px; font-size: 15px; font-weight: 600; }
.legend-rows { list-style: none; margin: 0; padding: 4px 0 0; }
.legend-row { display: grid; grid-template-columns: 14px 1fr auto; column-gap: 10px; align-items: center; padding: 6px 0; }
.legend-row .swatch { width: 12px; height: 12px; border-radius: 50%; }
.legend-row .name { font-weight: 500; line-height: 1.2; }
.legend-row .range { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.legend-row .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0 8px; }
.types-title { margin: 0 0 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.types summary { list-style: none; }
.types summary::-webkit-details-marker { display: none; }
.types summary::after { content: " \25BE"; }
.types[open] summary::after { content: " \25B4"; }
.type-row { display: grid; grid-template-columns: 18px 1fr auto; column-gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.type-row input { appearance: none; width: 16px; height: 16px; margin: 0; border-radius: 4px; border: 2px solid var(--green-hi); background: transparent; display: grid; place-items: center; cursor: pointer; }
.type-row input:checked { background: var(--green-hi); }
.type-row input:checked::after { content: ""; width: 8px; height: 4px; margin-top: -2px; border-left: 2px solid #06210f; border-bottom: 2px solid #06210f; transform: rotate(-45deg); }
.type-row .label { font-weight: 500; }
.type-row .label span { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.type-row .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.footnote { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

.zone-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px var(--pad) 0; }
.zone-code { padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-size: 12px; font-weight: 600; }
.zone-name { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.25; }
.zone-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.stat { min-width: 0; }
.stat b { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 3px; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat b small { font-size: 10px; font-weight: 400; color: var(--muted); }
.stat span { font-size: 11px; color: var(--muted); }
.share-label { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.share-bar { display: flex; height: 10px; overflow: hidden; border-radius: 5px; background: rgba(255, 255, 255, 0.1); }
.share-bar i { display: block; height: 100%; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); cursor: pointer; font-weight: 500; }
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.btn .icon { width: 16px; height: 16px; }
.btn.grow { flex: 1; }

.zone-list { list-style: none; margin: 0; padding: 0; }
.zone-list button { display: grid; grid-template-columns: 14px 1fr auto; column-gap: 10px; align-items: center; width: 100%; padding: 8px 6px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.zone-list button:hover { background: rgba(255, 255, 255, 0.08); }
.zone-list .swatch { width: 12px; height: 12px; border-radius: 50%; }
.zone-list .val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { margin: 0 0 6px; font-size: 12px; color: var(--muted); }

/* ---------- closures table ---------- */
.closures { position: fixed; z-index: 15; right: var(--edge); top: 92px; max-height: calc(100vh - 132px); width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column; }
.closures .panel-body { overflow: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 2px; }
.tbl thead th { font-weight: 600; font-size: 12px; color: var(--muted); position: sticky; top: 0; background: var(--panel-raised); }
.tbl th.today, .tbl td.today { background: rgba(23, 184, 92, 0.1); }
.sev { display: inline-flex; gap: 2px; }
.sev i { width: 9px; height: 14px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); }
.sev i.on { background: #ef4444; }
.ok { color: #46d07a; } .no { color: #ff6b6b; }
.ok .icon, .no .icon { width: 18px; height: 18px; }
.empty { padding: 10px 2px; color: var(--muted); }

/* ---------- overlays: alerts + about ---------- */
.overlay { position: fixed; z-index: 30; top: 88px; right: var(--edge); width: min(430px, calc(100vw - 32px)); max-height: calc(100vh - 110px); display: flex; flex-direction: column; }
.overlay .panel-body { overflow: auto; }
.overlay h2:focus { outline: none; }
body.has-overlay .legend, body.has-overlay .closures { visibility: hidden; }
.alert-card { margin: 0 0 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border-left: 4px solid var(--c, #888); }
.alert-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 600; }
.pill { padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--c, #888); color: #1b1200; }
.alert-card p { margin: 0 0 8px; }
.about p { margin: 0 0 10px; }
.about h3 { margin: 14px 0 4px; font-size: 13px; font-weight: 600; }
.about dl { margin: 0; }
.about dt { margin-top: 8px; font-weight: 500; }
.about dd { margin: 0; color: var(--muted); font-size: 13px; }
.about ul { margin: 0 0 10px; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* ---------- map furniture ---------- */
.zone-pill {
  padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(14, 24, 37, 0.78); color: #fff; font-weight: 600; font-size: 13px; line-height: 1; cursor: pointer;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  transition: transform 0.12s, background 0.12s;
}
.zone-pill:hover { transform: scale(1.08); background: rgba(14, 24, 37, 0.95); }
.zone-pill.is-selected { background: var(--green); border-color: var(--green-hi); }
.tip { position: fixed; z-index: 40; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgba(8, 14, 22, 0.92); border: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
.tip b { font-weight: 600; }
.tip small { display: block; color: var(--muted); font-size: 11px; }
.select-rect { position: absolute; z-index: 5; border: 2px solid #1ee05a; background: rgba(30, 224, 90, 0.1); pointer-events: none; }
.trend { position: fixed; z-index: 35; width: 380px; max-width: calc(100vw - 24px); }
.trend svg { display: block; width: 100%; height: auto; }
.trend .panel-head { padding-bottom: 0; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: #3a1620; border: 1px solid #ef4444; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  :root { --edge: 10px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .left-stack { grid-column: 1; grid-row: 1; min-width: 0; max-width: 100%; gap: 8px; }
  .actions { grid-column: 2; grid-row: 1; gap: 5px; }
  .dates { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .date-tab { flex: 1; min-width: 0; padding: 7px 4px; font-size: 14px; }
  .brand { font-size: 18px; padding: 5px 14px 5px 8px; gap: 6px; }
  .brand-mark { width: 22px; height: 22px; }
  .round-btn { width: 38px; height: 38px; }
  .round-btn .icon { width: 19px; height: 19px; }
  .lang-btn { height: 38px; padding: 0 9px; font-size: 12px; }
  .lang-btn .icon { display: none; }
  .badge { min-width: 17px; height: 17px; font-size: 10px; top: -4px; right: -4px; }
  .status { font-size: 12px; }
  .menu { top: 46px; right: 0; width: min(270px, calc(100vw - 20px)); }
  .dock { position: fixed; z-index: 15; left: var(--edge); right: var(--edge); bottom: 24px; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
  .dock > * { flex: none; }
  .zone-card, .legend { position: static; width: auto; max-height: none; }
  .legend-title { padding-top: 10px; }
  .legend-rows { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .legend-row { padding: 4px 0; }
  .legend-row .count { display: none; }
  .closures { top: auto; bottom: 24px; left: var(--edge); right: var(--edge); width: auto; max-height: 52vh; }
  .overlay { top: 108px; left: var(--edge); right: var(--edge); width: auto; max-height: calc(100vh - 140px); }
  .trend { left: 12px !important; right: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Ghana additions ---------- */
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand { font-size: 22px; }
.tool-switch { padding: 7px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tool-switch:hover { background: #2a3f58; }
.mode-btn[aria-pressed="true"] { background: #7c2d12; border-color: #fb923c; }
.primary { background: var(--green) !important; border-color: var(--green) !important; color: #fff; }
.primary:hover { background: var(--green-hi) !important; }
.search, .field { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.07); color: var(--text); font: inherit; margin-bottom: 6px; }
.search::placeholder { color: var(--muted); }
select.field option { color: #111; }
.sub { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.kpi { padding: 2px 9px; border-radius: 999px; background: rgba(239,68,68,.2); color: #fecaca; font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: rgba(96,165,250,.16); color: #cfe3ff; font-size: 12px; font-weight: 500; }
.chip .icon { width: 13px; height: 13px; }
.level-banner { padding: 9px 11px; border-radius: 10px; border-left: 4px solid var(--c); background: rgba(255,255,255,.07); margin-bottom: 8px; }
.level-banner b { display: block; font-size: 15px; font-weight: 600; }
.level-banner span { font-size: 12.5px; color: var(--text); }
.drivers { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.drivers th { text-align: left; font-weight: 400; color: var(--muted); padding: 4px 8px 4px 0; vertical-align: top; }
.drivers td { text-align: right; font-weight: 600; padding: 4px 0; }
.drivers td small { display: block; font-weight: 400; color: var(--muted); font-size: 10.5px; }
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 8px 0; }
.stat { display: flex; flex-direction: column; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.06); }
.stat b { font-size: 15px; font-weight: 600; }
.code-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.13); font-size: 11px; font-weight: 600; margin-bottom: 2px; }
.zone-head-x { align-items: flex-start; }
.zone-head-x .hint { margin: 0; }
.hint.strong { color: var(--text); font-weight: 500; }
.stat-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.table-key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.table-key span { display: inline-flex; align-items: center; gap: 5px; }
.table-key .stat-dot { width: 10px; height: 10px; }
.tbl td small { text-align: left; }
.form label { display: block; margin: 8px 0 4px; font-size: 12px; color: var(--muted); }
.seg.flat { padding: 0; flex-wrap: wrap; }
.seg.flat button { flex: 1 0 auto; color: var(--text); }
.sms { margin: 12px 0 6px; padding: 10px 12px; border-radius: 12px 12px 12px 3px; background: #15372a; }
.sms small { color: #9fe3bd; font-size: 11px; }
.sms p { margin: 2px 0 0; font-size: 13.5px; }
.warn { padding: 8px 10px; border-radius: 10px; background: rgba(245,158,11,.15); color: #fde68a; font-size: 12.5px; margin: 0 0 8px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 8px 0; font-size: 12.5px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; text-align: right; } .facts dd b { font-weight: 600; }
.sub-h { margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.spark-row { display: grid; grid-template-columns: 74px 1fr; align-items: center; font-size: 12px; color: var(--muted); }
.spark { width: 100%; height: 30px; }
.zone-card { max-height: calc(100vh - 165px); }
.status:not([open]) ~ * { }
.zone-list button .sub { margin-top: -1px; }
.zone-list button { color: var(--text); }
.zone-pill { font-size: 12px; padding: 5px 9px; }
@media (max-width: 760px) {
  .brand { font-size: 17px; }
  .tool-switch { display: none; }
  .mode-btn { padding: 0 8px; }
  .mode-btn .icon-wrap { display: none !important; }
  .dock { max-height: 40vh; bottom: 26px; }
  .zone-card .hint { display: none; }
  .legend .footnote { display: none; }
  .date-tab { font-size: 12.5px; }
  .date-tab small { font-size: 9px; }
  .overlay { top: 96px; }
}
