:root {
  --ink: #1a2332;
  --ink-2: #4a5568;
  --ink-3: #8a94a6;
  --line: rgba(0,0,0,0.09);
  --card: rgba(255,255,255,0.97);
  --accent: #1a6bb5;
  --gas: #1a6bb5;
  --oil: #c75000;
  --lng: #0e9aa7;
  --crit: #c0392b;
  --high: #e67e22;
  --med: #d4a017;
  --low: #7f8c8d;
  --ok: #1e8a4c;
  --shadow: 0 2px 12px rgba(0,0,0,0.12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f5f5f0; color: var(--ink); overflow: hidden; }
#map { position: absolute; inset: 0; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.mt { margin-top: 12px; }

/* ── Top bar ── */
.topbar {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 1001;
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.brand-title { font-weight: 650; font-size: 15px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.ticker { flex: 1; display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.ticker::-webkit-scrollbar { display: none; }
.tick { display: flex; flex-direction: column; font-size: 11px; line-height: 1.25; white-space: nowrap; padding: 0 10px; border-left: 1px solid var(--line); }
.tick b { font-size: 13px; font-variant-numeric: tabular-nums; }
.tick .lbl { color: var(--ink-3); }
.tick .up { color: var(--crit); }
.tick .down { color: var(--ok); }
.regions { display: flex; gap: 4px; }
.regions button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 9px; font-size: 12px; color: var(--ink-2); }
.regions button:hover { background: #eef4fb; color: var(--ink); }

/* ── Panels ── */
.panel { position: absolute; z-index: 1000; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); backdrop-filter: blur(8px); font-size: 12px; }
.panel.left { top: 76px; left: 10px; width: 230px; max-height: calc(100vh - 96px); overflow-y: auto; padding: 12px 14px; }
.panel.right { top: 76px; right: 10px; width: 380px; bottom: 20px; display: flex; flex-direction: column; overflow: hidden; }
.panel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-2); margin-bottom: 6px; }
.panel-toggle { display: none; }

.layer-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; cursor: pointer; line-height: 1.6; }
.layer-row input { accent-color: var(--accent); }
.layer-row .count { margin-left: auto; color: var(--ink-3); font-size: 11px; }
.sw { width: 22px; display: inline-flex; justify-content: center; align-items: center; flex-shrink: 0; }
.sw-line { width: 22px; height: 3px; border-radius: 2px; }
.sw-dash { width: 22px; height: 0; border-top: 3px dashed; }
.sw-circle { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,0.25); }
.sw-field { width: 13px; height: 13px; border-radius: 50%; border: 2px dashed; }
.sw-diamond { width: 10px; height: 10px; transform: rotate(45deg); border: 1.5px solid rgba(0,0,0,0.25); }
.sw-hex { width: 12px; height: 12px; clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); }
.sw-tri { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--crit); }
.status-legend .row { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tabs button { flex: 1; background: none; border: none; padding: 10px 0; font-size: 12.5px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-body { overflow-y: auto; padding: 12px 14px 16px; flex: 1; line-height: 1.55; }

.situation { background: #fff6f4; border: 1px solid #f3d2cc; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; color: #4a2a25; font-size: 12px; }
.situation b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--crit); margin-bottom: 3px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 9px; font-size: 11px; color: var(--ink-2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.event { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.event:hover .ev-title { color: var(--accent); }
.ev-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.ev-title { font-weight: 600; font-size: 13px; margin: 2px 0 3px; color: var(--ink); }
.ev-sum { color: var(--ink-2); font-size: 12px; }
.sev { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.conf { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; padding: 0 5px; border-radius: 3px; background: #eef1f5; color: var(--ink-2); }
.conf.unverified { background: #fff1d6; color: #8a5a00; }
.sources { font-size: 11px; margin-top: 4px; color: var(--ink-3); }
.sources a { margin-right: 8px; }
.empty { color: var(--ink-3); font-style: italic; padding: 12px 0; }

/* Chokepoint monitor */
.cp { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.cp-head { display: flex; align-items: center; gap: 8px; }
.cp-name { font-weight: 600; font-size: 13px; }
.pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 1px 6px; border-radius: 4px; color: #fff; }
.cp-stats { display: flex; gap: 14px; margin: 4px 0; font-size: 11.5px; color: var(--ink-2); }
.cp-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.delta-down { color: var(--crit); font-weight: 600; }
.delta-up { color: var(--ok); font-weight: 600; }
.spark { display: block; width: 100%; height: 42px; }
.note { font-size: 11px; color: var(--ink-3); margin-top: 8px; }

/* Scenario */
.sc-list label { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; cursor: pointer; }
.sc-list input { accent-color: var(--crit); }
.sc-list .live { font-size: 10px; color: var(--crit); font-weight: 700; text-transform: uppercase; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 10px; font-size: 12px; }
.btn.primary { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn-row { display: flex; gap: 6px; margin: 8px 0 12px; flex-wrap: wrap; }
.impact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.kpi { background: #f6f7f9; border-radius: 8px; padding: 8px 10px; }
.kpi .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .k { font-size: 11px; color: var(--ink-3); }
.kpi.bad .v { color: var(--crit); }
.sc-section { margin-top: 12px; }
.sc-section h5 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-2); margin-bottom: 4px; }
.sc-section ul { padding-left: 16px; }
.sc-section li { margin: 2px 0; }
.warn { color: #8a5a00; }

/* Detail */
.back { background: none; border: none; color: var(--accent); font-size: 12px; margin-bottom: 8px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; margin-bottom: 6px; background: #eef1f5; color: var(--ink-2); }
.detail h3 { font-size: 15px; margin-bottom: 6px; }
.detail .body { color: #444; }
.geo { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: #444; font-size: 11.8px; }
.geo b, .statusbox b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.statusbox { border-radius: 8px; padding: 8px 10px; margin: 6px 0 10px; font-size: 12px; border-left: 4px solid; background: #fafafa; }

/* Scenario bar */
.scenario-bar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1001; background: var(--crit); color: #fff; padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 12.5px; display: flex; gap: 12px; align-items: center; }
.scenario-bar button { background: rgba(255,255,255,0.2); color: #fff; border: none; border-radius: 5px; padding: 3px 8px; }

/* Map marker animations */
.pulse { border-radius: 50%; animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--pc, rgba(192,57,43,0.6)); } 70% { box-shadow: 0 0 0 14px rgba(0,0,0,0); } 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } }
.leaflet-popup-content-wrapper, .leaflet-tooltip { border-radius: 6px !important; }
.leaflet-tooltip { font-size: 12px; }
.leaflet-control-zoom { margin-top: 76px !important; margin-right: 400px !important; }

@media (max-width: 1100px) {
  .regions { display: none; }
  .panel.right { width: 340px; }
  .leaflet-control-zoom { margin-right: 360px !important; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
  .brand-title { font-size: 13px; }
  .ticker { order: 3; flex-basis: 100%; }
  .panel.left { top: auto; bottom: calc(45vh + 16px); width: auto; max-height: 40vh; padding: 0; }
  .panel.left .panel-body { display: none; padding: 10px 12px; }
  .panel.left.open .panel-body { display: block; }
  .panel-toggle { display: block; background: none; border: none; padding: 6px 12px; font-weight: 600; font-size: 12px; }
  .panel.right { top: auto; left: 10px; right: 10px; width: auto; height: 45vh; bottom: 10px; }
  .leaflet-control-zoom { display: none; }
  .scenario-bar { bottom: calc(45vh + 20px); }
}

/* Pump prices */
.fuel-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.fuel-table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); font-weight: 600; padding: 4px 4px; border-bottom: 1px solid var(--line); }
.fuel-table td { padding: 4px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.fuel-table tr[data-fuel] { cursor: pointer; }
.fuel-table tr[data-fuel]:hover td { background: #f6f8fb; }
.fuel-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fuel-table small { color: var(--ink-3); }
.heat { display: inline-block; min-width: 42px; text-align: center; border-radius: 4px; padding: 0 4px; font-weight: 600; color: #3a0d09; }
details summary { cursor: pointer; margin: 6px 0; }
.tabs button { font-size: 12px; }

.situation summary { list-style: none; cursor: pointer; }
.situation summary::-webkit-details-marker { display: none; }
.situation .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.situation .clamp::after { content: ''; }
.situation:not([open]) summary::after { content: 'Read more ▾'; display: block; color: var(--crit); font-size: 11px; margin-top: 3px; font-weight: 600; }
.situation[open] .clamp { display: none; }
.situation[open] summary::after { content: 'Show less ▴'; display: block; color: var(--crit); font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.situation[open] .full { order: -1; }

/* Credit + about link on the map */
.credit { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.credit a { color: var(--ink-2); font-weight: 600; text-decoration: none; }
.credit a:hover { color: var(--accent); text-decoration: underline; }
.topbar .about-link { font-size: 12px; color: var(--ink-2); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; white-space: nowrap; background: #fff; }
.topbar .about-link:hover { background: #eef4fb; color: var(--ink); }

/* Embed mode (?embed=1): map only, with a link back to the full site */
body.embed .topbar, body.embed .panel, body.embed .scenario-bar, body.embed .leaflet-control-zoom { display: none !important; }
.embed-badge { position: absolute; left: 10px; bottom: 22px; z-index: 1001; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.embed-badge span { color: var(--accent); }

/* Document pages (about.html) */
body.doc { overflow: auto; background: #f7f7f3; }
.doc-wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; line-height: 1.65; font-size: 15px; color: #2a3140; }
.doc-back { font-size: 13px; color: var(--accent); text-decoration: none; }
.doc h1 { font-size: 30px; margin: 14px 0 8px; color: var(--ink); letter-spacing: -0.3px; }
.doc h2 { font-size: 19px; margin: 36px 0 10px; color: var(--ink); scroll-margin-top: 16px; }
.doc .lede { font-size: 17px; color: var(--ink-2); }
.doc ul { padding-left: 20px; }
.doc li { margin: 6px 0; }
.doc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.doc-stats .kpi { background: #fff; border: 1px solid var(--line); }
.doc-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.doc-toc a { font-size: 12.5px; text-decoration: none; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: #fff; }
.doc-toc a:hover { color: var(--accent); border-color: var(--accent); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.doc-table th, .doc-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.doc-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-3); background: #fafafa; }
.doc-table td:last-child { white-space: nowrap; color: var(--ink-2); }
.log-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.log-meta { font-size: 12px; color: var(--ink-3); }
.log-kind { text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; padding: 1px 6px; border-radius: 4px; background: #eef1f5; color: var(--ink-2); }
.log-kind.data { background: #e6f2fb; color: #1a5a8a; }
.log-kind.policy { background: #fdf0e3; color: #8a4a00; }
.log-head { font-weight: 600; color: var(--ink); margin: 2px 0; }
.log-entry ul { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }
.doc-foot { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
@media (max-width: 640px) {
  .doc-stats { grid-template-columns: repeat(2, 1fr); }
  .doc h1 { font-size: 25px; }
  .doc-table td:last-child { white-space: normal; }
}

/* Generated answer pages */
.site-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; max-width: 960px; margin: 0 auto; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.site-nav .brand { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 15px; }
.site-nav nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-nav nav a { color: var(--ink-2); text-decoration: none; font-size: 13.5px; }
.site-nav nav a:hover { color: var(--accent); }
body.doc .doc-wrap { max-width: 820px; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-3); font-weight: 700; display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.answer { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 14px 16px; margin: 14px 0 8px; }
.answer p { margin: 0 0 6px; }
.answer .q { font-weight: 700; color: var(--ink); }
.fact-table, .data-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-size: 14px; margin: 8px 0; }
.fact-table th, .fact-table td, .data-table th, .data-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.fact-table th { width: 55%; font-weight: 500; color: var(--ink-2); }
.data-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-3); background: #fafafa; }
.data-table td small { color: var(--ink-3); }
.chart { margin: 10px 0 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 10px 4px; }
.chart svg { width: 100%; height: 110px; display: block; }
.chart figcaption { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 8px 0; }
.faq summary { font-weight: 600; cursor: pointer; color: var(--ink); }
.faq p { margin: 6px 0 0; }
.ev { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ev-h { font-size: 16px; margin: 2px 0 4px; color: var(--ink); }
.ev p { margin: 4px 0; }
.dir { list-style: none; padding: 0; }
.dir li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.dir li span { color: var(--ink-2); }
.near small { color: var(--ink-3); }
.more { margin-top: 28px; font-size: 14px; }
.pill.ok { background: var(--ok); }
.sources { font-size: 12.5px; }
@media (max-width: 640px) { .data-table { font-size: 12.5px; display: block; overflow-x: auto; } .site-nav nav { gap: 10px; } }
