:root {
  --navy: #0b2a4a;
  --blue: #0054a4;
  --green: #4d8c2e;
  --ink: #1b1f24;
  --muted: #5a6572;
  --line: #d9dee3;
  --bg: #f4f6f8;
  --card: #ffffff;
  --focus: #ffbf47;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: "Segoe UI", Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.topbar { display: flex; align-items: center; justify-content: space-between; background: var(--navy); color: #fff; padding: 10px 20px; border-bottom: 4px solid var(--green); }
.brand-org { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; opacity: .9; }
.topbar h1 { margin: 2px 0 0; font-size: 22px; font-weight: 600; }
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 4px; padding: 7px 12px; font-size: 14px; cursor: pointer; text-decoration: none; }
.nav-btn.is-active, .nav-btn:hover { background: #fff; color: var(--navy); }

.layout { display: grid; grid-template-columns: 300px 1fr 0px; height: calc(100vh - 66px); }
.layout.has-detail { grid-template-columns: 300px 1fr 400px; }
.sidebar { overflow-y: auto; background: var(--card); border-right: 1px solid var(--line); padding: 12px; }
.panel { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
.year-row { display: flex; align-items: center; justify-content: space-between; }
.year-out { font-size: 28px; font-weight: 700; color: var(--blue); }
input[type=range] { width: 100%; }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.checks label { display: block; padding: 3px 0; cursor: pointer; }
.btn-small { background: var(--blue); color: #fff; border: 0; border-radius: 4px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.btn-small:hover { background: #003f7d; }
select { width: 100%; padding: 6px; font-size: 14px; border: 1px solid var(--line); border-radius: 4px; }

.legend { margin-top: 8px; font-size: 13px; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.swatch { width: 18px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,.15); flex: none; }
.swatch.line { height: 4px; border: 0; }
.swatch.dashed { height: 0; border-top: 3px dashed #777; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.cards-3 { grid-template-columns: 1fr 1fr 1fr; }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.card-value { font-size: 20px; font-weight: 700; color: var(--navy); }
.card-label { font-size: 12px; color: var(--muted); }

.content { position: relative; min-width: 0; }
.map { position: absolute; inset: 0; }
.table-view { position: absolute; inset: 0; overflow: auto; padding: 18px 24px; background: #fff; }
.table-view h2 { margin: 0 0 4px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
th { background: var(--bg); position: sticky; top: 0; }
td.num, th.num { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.detail { overflow-y: auto; background: var(--card); border-left: 1px solid var(--line); padding: 14px 16px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.detail h2 { margin: 2px 0 6px; font-size: 19px; }
.detail h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 4px; }
.detail .cards { margin-bottom: 4px; }
.detail .takeaway { margin: 6px 0 8px; }
.btn-close { background: transparent; border: 1px solid var(--line); border-radius: 4px; font-size: 20px; line-height: 1; padding: 2px 8px; cursor: pointer; }
.phase-pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #e8eef5; color: var(--navy); font-weight: 600; }
.takeaway { background: #eef6ea; border-left: 4px solid var(--green); padding: 8px 10px; border-radius: 4px; margin: 8px 0 12px; line-height: 1.4; }

.modal { position: fixed; inset: 0; background: rgba(11,42,74,.55); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 8px; max-width: 1100px; width: 100%; max-height: 90vh; overflow: auto; padding: 18px 22px; }
.modal-card h2 { margin: 0 0 10px; }
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.story { border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.story h3 { margin: 0 0 6px; font-size: 16px; color: var(--navy); }
.story p { margin: 0 0 8px; line-height: 1.4; }

.maplibregl-popup-content { font-family: inherit; font-size: 13px; padding: 10px 12px; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.visually-hidden { position: absolute; left: -9999px; }
@media (max-width: 1100px) { .layout, .layout.has-detail { grid-template-columns: 260px 1fr; } .detail { grid-column: 1 / -1; } }
