/* Map chrome uses the board palette; amber matches its existing warning color. */
:root { --amber: #C9A227; --map-top: 48px; }
@media (prefers-color-scheme: light) { :root { --amber: #C9A227; } }
#right { background: var(--ground); }
body.terminal #right { left: 360px; top: var(--map-top); bottom: 24px; }
body.terminal #left { width: 360px; top: var(--map-top); bottom: 24px; background: var(--panel); }
body.terminal #topbar { height: 48px; min-height: 48px; max-height: 48px; }
body.terminal #keys { width: 100%; height: 24px; background: var(--ground); border-top: 1px solid var(--rule); font-size: 9px; }
body.terminal #keys::after { content: 'm map · g globe · 0 reset'; float: right; color: var(--steel); }
body.terminal .tb-asof, body.terminal .tb-llm { display: none; }
body.terminal .tb-tools { flex: 1 1 auto; min-width: 0; }
body.terminal #ask-form { min-width: 100px; flex: 1 1 auto; margin-right: 4px; }
body.terminal #ask-input { width: 100%; max-width: 330px; font-size: 11px; }
body.terminal .tb-quotes { flex: 0 1 240px; }
#map-header { position: absolute; z-index: 2; top: 22px; left: 24px; right: 24px; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
#map-header .eyebrow { font-size: 9px; color: var(--muted); letter-spacing: .15em; }
#map-header h1 { font-family: var(--cond); font-size: 28px; font-weight: 500; line-height: 1.1; letter-spacing: -.025em; margin: 6px 0 9px; color: var(--ink); }
#map-status { font: 9px var(--mono); color: var(--muted); }
#map-status::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 7px; background: var(--ok); }
#map-status.delayed::before { background: var(--amber); }
.map-metrics { display: flex; gap: 24px; font: 8px var(--mono); letter-spacing: .13em; color: var(--muted); }
.map-metrics span { display: flex; flex-direction: column; gap: 4px; }
.map-metrics b { font: 26px var(--mono); letter-spacing: -.06em; color: var(--ink); }
.map-metrics span:first-child b { color: var(--flare); }
#map-tools { position: absolute; z-index: 3; top: 116px; left: 24px; display: flex; gap: 5px; }
#map-tools .tb-btn { padding: 7px 9px; background: var(--ground); font-size: 10px; }
#map-tools .tb-btn span { color: var(--muted); margin-left: 6px; font-size: 9px; }
#layer-panel { top: 114px; right: 24px; padding: 13px 13px 10px; width: 168px; max-width: none; background: color-mix(in srgb, var(--panel) 96%, transparent); box-shadow: none; }
#layer-panel > .eyebrow { font-size: 9px; letter-spacing: .15em; padding-bottom: 9px; border-bottom: 1px solid var(--rule); }
#layer-panel .toggles { margin-top: 7px; gap: 0; }
#layer-panel .toggles label { position: relative; min-height: 29px; font-family: var(--cond); font-size: 12px; gap: 8px; color: var(--ink); }
#layer-panel .toggles input { position: absolute; width: 100%; height: 100%; inset: 0; opacity: 0; cursor: pointer; }
#layer-panel .toggles label:focus-within { outline: 1px solid var(--steel); outline-offset: 3px; }
#layer-panel .toggles label:hover { color: var(--steel); }
#layer-panel .toggles .count { font-size: 9px; }
#layer-panel .layer-off { opacity: .45; }
#layer-panel .layer-stale .count { color: var(--amber); }
.map-glyph { width: 8px; height: 8px; display: inline-block; flex: 0 0 8px; border: 1px solid var(--layer-color); }
.glyph-circle, .glyph-storm { border-radius: 50%; }
.glyph-circle { background: var(--layer-color); }
.glyph-diamond { transform: rotate(45deg); }
.glyph-aircraft { width: 0; height: 0; border: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 9px solid var(--layer-color); }
.glyph-ship { transform: rotate(45deg); border-right: 0; border-bottom: 0; }
.glyph-pin { border-radius: 50% 50% 0 0; }
.map-legend { margin-top: 10px; padding-top: 11px; border-top: 1px solid var(--rule); font: 9px var(--mono); color: var(--muted); }
.map-legend > .eyebrow { font-size: 8px; }
.map-legend > div { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.map-legend i { width: 14px; height: 3px; display: inline-block; }
.legend-low { background: var(--steel); }.legend-mid { background: var(--amber); }.legend-high { background: var(--flare); }
.map-legend small { font-family: var(--sans); font-size: 9px; display: block; line-height: 1.5; }
#map-foot { left: 24px; bottom: 45px; background: transparent; border: 0; box-shadow: none; padding: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; font-size: 9px; pointer-events: none; }
#map-foot .eyebrow { font-size: 8px; }
#map-selected { grid-column: 1 / -1; grid-row: 1; font-family: var(--cond); text-transform: uppercase; letter-spacing: .09em; font-size: 12px; margin-bottom: 4px; }
#map-readout { position: absolute; bottom: 0; left: 0; right: 0; min-height: 25px; z-index: 2; display: flex; gap: 15px; padding: 7px 24px; border-top: 1px solid var(--rule); background: var(--ground); color: var(--muted); font: 8px var(--mono); pointer-events: none; }
#map-provider { margin-left: auto; }
#map-tooltip { position: absolute; z-index: 30; max-width: 265px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--rule); border-left: 2px solid var(--steel); pointer-events: none; }
#map-tooltip strong { display: block; font: 500 13px var(--cond); color: var(--ink); }
#map-tooltip span { display: block; font: 9px var(--mono); margin-top: 5px; color: var(--muted); }
#map .maplibregl-ctrl-bottom-right { bottom: 29px; right: 14px; }
#map .maplibregl-ctrl-bottom-left { bottom: 28px; left: 14px; }
#map .maplibregl-ctrl-scale { color: var(--muted); border-color: var(--muted); background: transparent; font: 8px var(--mono); }
#map .maplibregl-ctrl-group { border: 1px solid var(--rule); box-shadow: none; border-radius: 0; background: var(--panel); }
#map .maplibregl-ctrl-group button { border-color: var(--rule); width: 29px; height: 29px; }
#map .maplibregl-ctrl-icon { filter: invert(.7); }
#map .maplibregl-ctrl-attrib { background: var(--panel); color: var(--muted); border: 1px solid var(--rule); font-size: 9px; border-radius: 0; }
#map .maplibregl-ctrl-attrib a { color: var(--muted); }
#map .maplibregl-ctrl-attrib-button { filter: invert(.7); }
#map .maplibregl-popup { z-index: 25; }
#map .maplibregl-popup-content { width: 310px; max-width: min(340px, calc(100vw - 40px)); padding: 18px; border-top: 2px solid var(--flare); border-radius: 2px; box-shadow: 0 10px 40px color-mix(in srgb, var(--ground) 65%, transparent); }
#map .maplibregl-popup-close-button { right: 5px; top: 3px; width: 24px; height: 24px; font-size: 20px; }
.pop-eyebrow { display: flex; gap: 25px; text-transform: uppercase; letter-spacing: .13em; color: var(--flare); font: 9px var(--mono); margin-bottom: 12px; padding-right: 10px; }
.pop-eyebrow span { margin-left: auto; }
.pop-title { font: 500 18px/1.25 var(--cond); margin-bottom: 10px; }
.pop-meta { font: 9px/1.7 var(--mono); letter-spacing: .025em; }
.pop-detail { font: 11px/1.6 var(--sans); color: var(--muted); margin: 10px 0; }
.pop-link { display: inline-block; font: 10px var(--mono); margin-top: 15px; text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 3px; color: var(--steel); }
.pop-body > .sel-toggle { float: right; margin-top: 15px; width: 24px; height: 24px; font-size: 16px; }
body.map-hidden #board { display: block; }
body.map-hidden #right { position: fixed; inset: auto 0 24px auto; width: 0; height: 0; overflow: visible; }
body.map-hidden #right > :not(.dock) { display: none !important; }
body.map-hidden #left { position: fixed; top: var(--map-top); bottom: 24px; left: 0; right: 0; width: 100%; overflow: auto; border: 0; }
body.map-hidden #sit-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
body.map-hidden .card { border-right: 1px solid var(--rule); }
body.map-hidden .dock { position: fixed; top: 60px; right: 14px; bottom: 34px; max-width: calc(100vw - 28px); }
@media (max-width: 1100px) {
  body.terminal #left { width: 310px; } body.terminal #right { left: 310px; }
  body.terminal .tb-sources { display: none; } body.terminal .tb-quotes { flex-basis: 140px; }
  #map-header { left: 18px; right: 18px; } #map-tools { left: 18px; } #layer-panel { right: 18px; width: 156px; padding: 10px; }
  .map-metrics { gap: 16px; } .map-metrics b { font-size: 23px; }
  body.map-hidden #left { width: 100%; } body.map-hidden #right { left: auto; }
}
@media (max-width: 700px) {
  body.terminal #left { width: 260px; } body.terminal #right { left: 260px; }
  #layer-panel { top: auto; bottom: 100px; right: 10px; }
  .map-metrics { display: none; } #map-header h1 { font-size: 23px; }
  body.map-hidden #left { width: 100%; } body.map-hidden #right { left: auto; }
  #map-coordinates { display: none; }
}
@media (prefers-color-scheme: light) {
  #map .maplibregl-ctrl-icon, #map .maplibregl-ctrl-attrib-button { filter: none; }
}
@media (prefers-reduced-motion: reduce) { #map * { scroll-behavior: auto; } }
