/* X-Axis Region Lens — styles
   Palette: navy #003366 (brand), orange #E47A49 (brand accent), deep ink backgrounds */
:root {
  --ink-900: #060d18;
  --ink-800: #0b1626;
  --ink-700: #112238;
  --ink-600: #1a3050;
  --navy: #003366;
  --orange: #E47A49;
  --orange-soft: rgba(228, 122, 73, .18);
  --text: #e8eef7;
  --text-dim: #9fb0c6;
  --text-faint: #6b7d95;
  --line: rgba(255,255,255,.08);
  --ok: #2ECC71; --warn: #F4C542; --bad: #FF6B6B; --info: #4FA3E3;
  --radius: 14px;
  --sidebar-w: 340px;
  --lens-w: 400px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --panel: rgba(11,22,38,.96);
  --attrib: rgba(6,13,24,.75);
}
/* Light theme (default): white panels, navy text, positron basemap */
body.light {
  --ink-900: #eef2f7; --ink-800: #ffffff; --ink-700: #f3f6fa; --ink-600: #e3e9f2;
  --text: #0b1626; --text-dim: #4a5a70; --text-faint: #7a8aa0; --line: rgba(0,51,102,.12);
  --orange-soft: rgba(228,122,73,.14); --panel: rgba(255,255,255,.97); --attrib: rgba(255,255,255,.8);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font); color: var(--text); background: var(--ink-900);
  display: grid; grid-template-rows: 56px 1fr; grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "top top" "side map"; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
h2 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); margin: 0 0 10px; font-weight: 600; }
h2 small { text-transform: none; letter-spacing: 0; color: var(--text-faint); font-weight: 400; margin-left: 6px; }

/* Top bar */
.topbar { grid-area: top; display: flex; align-items: center; gap: 18px; padding: 0 18px; background: linear-gradient(180deg, var(--ink-800), var(--ink-900)); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--navy); position: relative; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.brand-mark::before { content: ""; position: absolute; inset: 6px; border: 2.5px solid var(--orange); border-radius: 50%; }
.brand-mark::after { content: ""; position: absolute; left: 11px; top: 11px; width: 4px; height: 4px; background: var(--orange); border-radius: 50%; }
.brand-text { font-size: 16px; letter-spacing: .01em; }
.brand-text strong { font-weight: 700; }
.tagline { margin: 0; color: var(--text-dim); font-size: 13px; flex: 1; }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text-dim); font-size: 15px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.07); color: var(--text); }
.only-mobile { display: none; }

/* Sidebar */
.sidebar { grid-area: side; background: var(--ink-800); border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; z-index: 10; }
.search { position: relative; display: flex; gap: 6px; }
.search input { flex: 1; height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--ink-700); color: var(--text); font-size: 14px; outline: none; }
.search input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.search button { width: 44px; border-radius: 11px; border: none; background: var(--orange); color: #fff; font-size: 18px; font-weight: 700; }
.search-results { position: absolute; top: 48px; left: 0; right: 0; list-style: none; margin: 0; padding: 6px; background: var(--ink-700); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 16px 40px rgba(0,0,0,.45); z-index: 30; max-height: 280px; overflow: auto; }
.search-results li { padding: 9px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text-dim); }
.search-results li:hover { background: rgba(255,255,255,.06); color: var(--text); }
.search-results li b { color: var(--text); font-weight: 600; display: block; }
.block { padding-top: 4px; }
.hint { font-size: 12px; color: var(--text-faint); margin: 10px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--ink-700); color: var(--text-dim); font-size: 13px; display: inline-flex; align-items: center; gap: 7px; }
.chip .flag { font-size: 14px; }
.chip:hover, .chip.active { border-color: var(--orange); color: var(--text); background: var(--orange-soft); }
.toggle { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; font-size: 13.5px; cursor: pointer; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle input { margin-top: 3px; accent-color: var(--orange); }
.toggle small { display: block; color: var(--text-faint); font-size:12px; margin-top: 2px; }
.watch-list { list-style: none; margin: 0; padding: 0; }
.watch-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--ink-700); margin-bottom: 6px; font-size: 13px; cursor: pointer; }
.watch-list li:hover { background: var(--ink-600); }
.watch-list li.empty { background: none; color: var(--text-faint); cursor: default; font-size: 12.5px; padding: 0; }
.watch-list button { border: 0; background: none; color: var(--text-faint); font-size: 14px; }
.watch-list button:hover { color: var(--bad); }
.side-foot { margin-top: auto; font-size:12px; color: var(--text-faint); line-height: 1.5; border-top: 1px solid var(--line); padding-top: 12px; }
.side-foot p { margin: 0 0 6px; }

/* Map */
#map { grid-area: map; position: relative; }
.maplibregl-ctrl-group { background: var(--ink-700) !important; border: 1px solid var(--line); box-shadow: none !important; }
.maplibregl-ctrl-group button { filter: invert(.85); }
.maplibregl-ctrl-attrib { background: var(--attrib) !important; color: var(--text-faint) !important; font-size:12px !important; }
.maplibregl-ctrl-attrib a { color: var(--text-dim) !important; }
.maplibregl-popup-content { background: var(--ink-700); color: var(--text); border-radius: 10px; font: 12.5px var(--font); box-shadow: 0 10px 30px rgba(0,0,0,.5); border: 1px solid var(--line); }
.maplibregl-popup-tip { border-top-color: var(--ink-700) !important; border-bottom-color: var(--ink-700) !important; }
.maplibregl-popup-close-button { color: var(--text-dim); font-size: 16px; }
.pop-src { display: block; color: var(--text-faint); font-size:12px; margin-top: 4px; }

.lens-marker { width: 18px; height: 18px; border-radius: 50%; background: var(--orange); border: 3px solid #fff; box-shadow: 0 0 0 6px var(--orange-soft), 0 6px 16px rgba(0,0,0,.5); }
.office-marker { width: 14px; height: 14px; border-radius: 4px; background: var(--navy); border: 2px solid var(--orange); box-shadow: 0 4px 12px rgba(0,0,0,.5); cursor: pointer; }

/* Status toast */
.status { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink-700); border: 1px solid var(--line); color: var(--text-dim); font-size: 12.5px; padding: 8px 14px; border-radius: 999px; z-index: 25; box-shadow: 0 10px 30px rgba(0,0,0,.4); }

/* Lens panel & drawer */
.lens, .drawer { position: absolute; top: 72px; right: 16px; bottom: 16px; width: var(--lens-w); background: var(--panel); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0,0,0,.55); z-index: 15; display: flex; flex-direction: column; overflow: hidden; }
.lens-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.lens-head h2 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 2px 0 2px; font-weight: 650; line-height: 1.25; }
.lens-kicker { margin: 0; font-size:12px; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); font-weight: 600; }
.lens-sub { margin: 0; font-size: 12px; color: var(--text-faint); font-family: var(--mono); }
.lens-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.pill { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text-dim); font-size: 13px; }
.pill:hover, .pill.active { border-color: var(--orange); color: var(--text); background: var(--orange-soft); }
.lens-body, .drawer-body { overflow-y: auto; padding: 8px 16px 16px; }

.card { border: 1px solid var(--line); border-radius: 12px; margin-top: 10px; background: rgba(255,255,255,.015); overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(255,255,255,.03); }
.card-head h3 { margin: 0; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.card-head .count { font-size:12px; color: var(--text-faint); font-family: var(--mono); }
.card-body { padding: 6px 12px 10px; }
.card.loading .card-body::after { content: "Fetching…"; display: block; color: var(--text-faint); font-size: 12px; padding: 6px 0; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.item { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; line-height: 1.4; cursor: default; }
.item:last-child { border-bottom: 0; }
.item.clickable { cursor: pointer; }
.item.clickable:hover { color: #fff; }
.item b { font-weight: 600; }
.item .meta { color: var(--text-dim); font-size: 12px; display: block; }
.item .dist { color: var(--text-faint); font-family: var(--mono); font-size:12px; margin-left: 6px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; padding: 6px 0 2px; }
.kv div { background: var(--ink-700); border-radius: 9px; padding: 8px 10px; }
.kv .k { font-size:12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.kv .v { font-size: 16px; font-weight: 650; margin-top: 2px; }
.kv .v small { font-size:12px; color: var(--text-dim); font-weight: 400; margin-left: 3px; }
.prov { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size:12px; color: var(--text-faint); font-family: var(--mono); }
.prov a { color: var(--text-dim); }
.badge { display: inline-block; font-size:12px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim); font-family: var(--mono); }
.badge.live { border-color: rgba(46,204,113,.5); color: var(--ok); }
.badge.stale { border-color: rgba(244,197,66,.5); color: var(--warn); }
.badge.static { color: var(--text-faint); }
.badge.off { border-color: rgba(255,107,107,.5); color: var(--bad); }
.note { font-size: 12px; color: var(--text-faint); padding: 6px 0; }
.sev { font-weight: 700; }
.sev-Extreme, .sev-Severe { color: var(--bad); } .sev-Moderate { color: var(--warn); } .sev-Minor { color: var(--info); }

.drawer-body h3 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); margin: 16px 0 6px; }
.drawer-body ul { margin: 0; padding: 0; list-style: none; }
.drawer-body li { font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--line); color: var(--text-dim); }
.drawer-body li b { color: var(--text); font-weight: 600; }
.drawer-body p { font-size: 12.5px; color: var(--text-faint); line-height: 1.5; }

/* Mobile */
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; grid-template-areas: "top" "map"; }
  .tagline { display: none; }
  .only-mobile { display: inline-grid; }
  #btn-menu { display: none; }
  .sidebar { position: absolute; top: auto; left: 0; right: 0; bottom: 0; height: 44vh; z-index: 30; transition: height .25s ease; border-right: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25); padding-top: 0; }
  .sidebar.open { height: 86vh; }
  .sidebar.collapsed { height: 46px; overflow: hidden; }
  .sheet-handle { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 2; background: var(--ink-800); padding: 12px 14px 8px; margin: 0 -16px 8px; cursor: pointer; font-size: 12.5px; color: var(--text-dim); border-bottom: 1px solid var(--line); }
  .sheet-handle::before { content: ""; position: absolute; left: 50%; top: 5px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
  .sheet-handle b { color: var(--text); font-weight: 600; }
  .map-pill { display: block; }
  .lens, .drawer { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 70vh; z-index: 40; }
  :root { --lens-w: auto; }
}

/* Area view list */
.area-list { list-style: none; margin: 8px 0 10px; padding: 0; }
.area-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; color: var(--text-dim); }
.area-row:last-child { border-bottom: 0; }
.area-row .area-label { flex: 1; }
.area-row .area-count { font-family: var(--mono); font-size:12px; color: var(--text); }
.area-row.loading .area-count { animation: pulse 1.2s infinite; }
.area-row.off { color: var(--text-faint); }
.area-row.off .area-count { color: var(--bad); }
.pill.small { height: 30px; font-size: 12px; }

/* Walkthrough */
.tour { position: fixed; inset: 0; z-index: 100; }
.tour-spot { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(3,8,16,.72), 0 0 0 3px var(--orange); transition: all .3s ease; pointer-events: none; }
.tour-spot.none { left: 50%; top: 50%; width: 0; height: 0; box-shadow: 0 0 0 9999px rgba(3,8,16,.78); border-radius: 50%; }
.tour-card { position: absolute; width: min(400px, calc(100vw - 32px)); background: var(--ink-800); border: 1px solid rgba(228,122,73,.5); border-radius: 16px; padding: 20px 20px 16px; box-shadow: 0 30px 70px rgba(0,0,0,.6); transition: all .3s ease; }
.tour-step { margin: 0 0 6px; font-size:12px; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); font-weight: 600; }
.tour-card h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.25; }
.tour-card p#tour-text { margin: 0 0 16px; color: var(--text-dim); font-size: 14px; line-height: 1.55; }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-dots { flex: 1; display: flex; gap: 5px; justify-content: center; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-600); display: inline-block; }
.tour-dots i.on { background: var(--orange); }

.tagline .back { margin-left: 14px; color: var(--orange); font-size: 12.5px; }
.rl-hover .maplibregl-popup-content { padding: 8px 10px; pointer-events: none; }

/* Status pill over the map, mirrors the In view note (shown on phones where the sidebar is a sheet) */
.map-pill { position: absolute; left: 10px; top: 66px; z-index: 25; max-width: calc(100% - 70px); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
body.light .icon-btn:hover, body.light .search-results li:hover, body.light .pill:hover { background: rgba(0,51,102,.06); }
body.light .card { background: rgba(0,51,102,.02); }
@media (min-width: 901px) { .map-pill { display: none; } }

/* v2: place card tabs, what changed badges */
.lens-tabs { display:flex; gap:4px; margin:0 0 10px; border-bottom:1px solid var(--line); position:sticky; top:0; background:var(--panel, var(--ink-800)); z-index:2; padding-bottom:6px; }
.lens-tabs button { flex:1; border:0; background:transparent; color:var(--dim); font:inherit; font-size:12px; padding:7px 2px; border-radius:8px; cursor:pointer; white-space:nowrap; }
.lens-tabs button.on { background:var(--orange-soft, rgba(228,122,73,.16)); color:var(--text); font-weight:600; }
.lens-tabs button small { display:inline-block; margin-left:4px; font-size:12px; color:var(--orange); font-weight:700; }
.new-badge { font-size:12px; font-weight:700; color:#fff; background:var(--orange); border-radius:5px; padding:1px 5px; margin-left:6px; }
.pop-new { display:block; margin-top:3px; font-size:12px; font-weight:700; color:var(--orange); }
.area-row .area-count + .new-badge { margin-left:4px; }
@media (max-width: 900px) { .lens-tabs button { font-size:12px; padding:7px 0; } }
