/* Bharat Idea Grid - global styles.
   Colours, radii and motion live as tokens on :root and flip with [data-theme].
   Load order in index.html: leaflet.css, MapLibre (CDN), MarkerCluster,
   this file, then placecard.css. */
:root {
  --accent: #b9ff66;
  --canvas: #090b10;
  --surface: #121722;
  --raised: #171b24;
  --text: #f5f7fb;
  --muted: #98a2b3;
  --border: #2a3343;
  --danger: #ff7b88;
  --shadow: 0 18px 50px #0005;
  --radius: 18px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --airport: #63a5ff;
  --port: #6ee7c7;
  --energy: #ffc76b;
  --rail: #cf9cff;
}
html[data-theme="light"] {
  --canvas: #f2f5f2;
  --surface: #fff;
  --raised: #f7f9f7;
  --text: #14181f;
  --muted: #697386;
  --border: #d8ded8;
  --shadow: 0 18px 50px #1633191a;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  background: var(--canvas);
  color: var(--text);
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
}
button,
select {
  color: inherit;
}
/* Header bar: brand, global search, command trigger, theme picker. */
.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
  position: relative;
  z-index: 1000;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 270px;
}
.brandmark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: #0b1206;
  font-weight: 900;
  font-size: 20px;
}
.brand span:last-child {
  display: flex;
  flex-direction: column;
}
.brand small {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  margin-top: 2px;
}
.search {
  max-width: 560px;
  flex: 1;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 13px;
  display: flex;
  align-items: center;
  padding: 0 13px;
  gap: 9px;
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quiet,
.theme-label,
select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.theme-label {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 3px 3px 10px;
}
.theme-label select {
  border: 0;
  padding: 7px;
  background: transparent;
}
.modebar {
  height: 54px;
  padding: 8px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
}
.modebar > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modebar b {
  color: var(--muted);
  font-weight: 500;
}
.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 99px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
}
.segmented,
.basemap {
  display: flex;
  border: 1px solid var(--border);
  background: var(--canvas);
  border-radius: 12px;
  padding: 3px;
}
.segmented button,
.basemap button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 9px;
}
.segmented button.active,
.basemap button.active {
  background: var(--accent);
  color: #111;
  font-weight: 800;
}
.app-shell {
  height: calc(100vh - 124px);
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 0;
}
.app-shell.drawer-open {
  grid-template-columns: 340px minmax(0, 1fr) 340px;
}
/* Left rail: layer filters with the coverage note pinned at the bottom. */
.rail {
  background: var(--canvas);
  border-right: 1px solid var(--border);
  overflow: auto;
  padding: 18px;
}
.rail-head small,
.drawer small,
.table-head small,
.dialog-head small {
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 800;
}
.rail-head h1 {
  font-size: 26px;
  margin: 7px 0;
}
.rail-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 18px;
}
/* Category cards: per-category accent via --cat, accordion plus independent
   visibility switch. */
.category {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 15px;
  margin: 0 0 9px;
  overflow: hidden;
  transition: 0.3s var(--ease);
}
.cat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 68px;
}
.cat-expand {
  border: 0;
  background: none;
  text-align: left;
  padding: 12px 10px 12px 14px;
  color: inherit;
  display: flex;
  gap: 10px;
  align-items: center;
}
.cat-expand i {
  width: 9px;
  height: 32px;
  border-radius: 99px;
  background: var(--cat);
}
.cat-expand b,
.cat-expand small {
  display: block;
}
.cat-expand small {
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
}
/* iOS-style visibility switch; state is carried on aria-checked. */
.switch {
  width: 50px;
  height: 28px;
  border: 0;
  border-radius: 99px;
  background: var(--border);
  margin-right: 12px;
  position: relative;
  padding: 0;
}
.switch:before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  transition: 0.25s var(--ease);
}
.switch[aria-checked="true"] {
  background: var(--accent);
}
.switch[aria-checked="true"]:before {
  transform: translateX(22px);
  background: #121;
}
.cat-detail {
  display: none;
  padding: 0 16px 15px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.category.open .cat-detail {
  display: block;
  animation: enter 0.35s var(--ease);
}
.cat-detail a {
  color: var(--accent);
}
/* Standing caveat that this is a curated seed, not a national inventory. */
.coverage {
  border-top: 1px solid var(--border);
  padding: 18px 3px;
  margin-top: 18px;
}
.coverage span,
.coverage b {
  display: block;
}
.coverage span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.coverage p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
/* Main workspace: the map and the three table views share this shell. */
.workspace,
.map-view,
#map,
.table-view {
  min-width: 0;
  height: 100%;
}
.map-view {
  position: relative;
}
.leaflet-container {
  background: #0d1522;
  font-family: inherit;
}
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--surface) 88%, transparent) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a {
  color: var(--text) !important;
}
.marker-dot {
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 10px #0007;
}
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}
.marker-cluster div {
  background: var(--accent);
  color: #111;
  font-weight: 900;
}
/* Auto-generated legend; app.js rebuilds it whenever layer state changes. */
.legend {
  position: absolute;
  z-index: 500;
  left: 18px;
  bottom: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 13px;
  box-shadow: var(--shadow);
  font-size: 12px;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}
/* Boot progress and tile-failure pill over the map. */
.map-status {
  position: absolute;
  z-index: 500;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 8px 14px;
  font-size: 12px;
  box-shadow: var(--shadow);
}
.map-status.ready {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s 1s;
}
/* Legacy record drawer, kept as the fallback when placecard.js is absent. */
.drawer {
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: auto;
  position: relative;
  opacity: 0;
  transform: translateX(20px);
}
.drawer.open {
  opacity: 1;
  transform: none;
  transition: 0.35s var(--ease);
}
#closeDrawer {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--raised);
  border-radius: 50%;
  font-size: 22px;
}
.drawer #drawerContent {
  padding: 58px 24px 24px;
}
.drawer h2 {
  font-size: 28px;
  line-height: 1.1;
}
.drawer p {
  color: var(--muted);
  line-height: 1.55;
}
/* Source/OSM/verified/coordinates grid inside the legacy drawer. */
.record-meta {
  display: grid;
  gap: 8px;
  margin: 24px 0;
}
.record-meta div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.record-meta span {
  color: var(--muted);
}
.source-link {
  display: block;
  padding: 13px;
  border-radius: 12px;
  background: var(--accent);
  color: #111;
  text-decoration: none;
  text-align: center;
  font-weight: 900;
}
/* Places, SEZ and GDDP tables. */
.table-view {
  overflow: auto;
  background: var(--canvas);
  padding: 24px;
}
.table-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
}
.table-head h2 {
  margin: 6px 0 14px;
}
.table-scroll {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}
th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
td button {
  border: 1px solid var(--border);
  background: var(--raised);
  border-radius: 9px;
  padding: 7px 9px;
}
/* Mobile filter button and shared dialog chrome. */
.filter-fab,
.mobile-close {
  display: none;
}
dialog {
  width: min(900px, calc(100vw - 32px));
  max-height: 88vh;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(5px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
  margin: 5px 0;
}
.dialog-head button {
  border: 0;
  background: none;
  font-size: 28px;
}
/* About & Sources dialog typography and source cards. */
.docs {
  padding: 10px 26px 30px;
  line-height: 1.65;
}
.docs h3 {
  margin-top: 26px;
}
.docs p,
.docs li {
  color: var(--muted);
}
.docs a {
  color: var(--accent);
}
.source-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin: 10px 0;
}
.source-card b {
  display: block;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
button:active {
  transform: scale(0.97);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
/* Mobile layout: rail becomes a slide-over sheet, tables and map reflow. */
@media (max-width: 900px) {
  .topbar {
    height: 62px;
    padding: 8px 12px;
  }
  .brand {
    min-width: 0;
  }
  .brand span:last-child small {
    display: none;
  }
  .search {
    display: none;
  }
  .topbar nav .quiet {
    display: none;
  }
  .modebar {
    height: 52px;
    padding: 7px 10px;
  }
  .modebar > div:first-child {
    display: none;
  }
  .app-shell,
  .app-shell.drawer-open {
    height: calc(100vh - 114px);
    display: block;
  }
  .rail {
    position: fixed;
    z-index: 1600;
    inset: 0 8% 0 0;
    transform: translateX(-105%);
    transition: 0.4s var(--ease);
    box-shadow: var(--shadow);
    padding-top: 22px;
  }
  .rail.mobile-open {
    transform: none;
  }
  .mobile-close {
    display: block;
    position: absolute;
    right: 15px;
    top: 15px;
    border: 0;
    background: none;
    color: inherit;
    font-size: 26px;
  }
  .drawer {
    position: fixed;
    z-index: 1500;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(58vh, 520px);
    border-radius: 22px 22px 0 0;
    transform: translateY(105%);
    border: 1px solid var(--border);
  }
  .drawer.open {
    transform: none;
  }
  .filter-fab {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 14px;
    bottom: 24px;
    border: 0;
    background: var(--accent);
    color: #111;
    font-weight: 900;
    padding: 12px 16px;
    border-radius: 99px;
    box-shadow: var(--shadow);
  }
  .filter-fab span {
    font-weight: 500;
    margin-left: 7px;
  }
  .legend {
    left: auto;
    right: 10px;
    bottom: 20px;
    max-width: 180px;
  }
  .table-view {
    padding: 14px;
  }
  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }
  .theme-label {
    font-size: 0;
  }
  .theme-label select {
    font-size: 12px;
  }
  .brand b {
    font-size: 14px;
  }
  .brandmark {
    width: 36px;
    height: 36px;
  }
  .basemap button,
  .segmented button {
    padding: 6px 10px;
  }
}
/* Reduced motion: entrance animation and transitions off. */
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
html[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(0.58) saturate(0.72) contrast(1.08);
}
html[data-theme="light"] .leaflet-tile-pane {
  filter: none;
}
/* Command palette (Ctrl/Cmd+K): trigger, modal, grouped options. */
.command-trigger {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 9px 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.command-trigger kbd,
.command-dialog kbd {
  font: inherit;
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--raised);
  padding: 3px 6px;
  border-radius: 6px;
  box-shadow: 0 1px 0 var(--border);
}
.command-dialog {
  width: min(620px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 90px #0008;
}
.command-dialog::backdrop {
  background: #1119;
  backdrop-filter: blur(7px);
}
.command-shell {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
}
.command-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 4px;
}
.crumb {
  font-size: 11px;
  color: var(--muted);
  background: var(--raised);
  padding: 4px 7px;
  border-radius: 6px;
}
.command-head button {
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--muted);
  font-size: 11px;
  border-radius: 6px;
  padding: 5px 8px;
}
.command-search {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.command-search input {
  width: 100%;
  font-size: 16px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.command-list {
  max-height: min(460px, 60vh);
  overflow: auto;
  padding: 8px;
}
.command-group-label {
  font-size: 11px;
  color: var(--muted);
  padding: 10px 11px 6px;
}
.command-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  text-align: left;
  padding: 10px 11px;
  border-radius: 10px;
  gap: 4px;
}
.command-option:hover,
.command-option.active {
  background: var(--raised);
}
.command-option .cmd-icon {
  color: var(--muted);
  font-size: 17px;
}
.command-option small {
  color: var(--muted);
  font-size: 11px;
}
.command-empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}
.command-foot {
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  color: var(--muted);
  font-size: 11px;
}
.command-foot kbd {
  margin-right: 3px;
}
.cmd-check {
  color: var(--accent);
  font-weight: 900;
}
@media (max-width: 900px) {
  .command-trigger span {
    display: none;
  }
  .command-trigger {
    padding: 8px;
  }
  .command-trigger kbd {
    font-size: 0;
  }
  .command-trigger kbd:after {
    content: "⌕";
    font-size: 17px;
  }
  .command-dialog {
    margin-top: 12vh;
  }
  .command-foot {
    justify-content: center;
  }
  .topbar nav {
    margin-left: auto;
  }
}
.status-chip {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 99px;
  font-size: 11px;
  white-space: nowrap;
}
.status-chip.verified {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}
.status-chip.unverified {
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: var(--danger);
}
@media (max-width: 900px) {
  #sezView table {
    table-layout: fixed;
    min-width: 0;
  }
  #sezView th,
  #sezView td {
    padding: 10px 8px;
    overflow-wrap: anywhere;
  }
  #sezView th:nth-child(2),
  #sezView td:nth-child(2),
  #sezView th:nth-child(4),
  #sezView td:nth-child(4) {
    display: none;
  }
  #sezView th:nth-child(1) {
    width: 42%;
  }
  #sezView th:nth-child(3) {
    width: 25%;
  }
  #sezView th:nth-child(5) {
    width: 33%;
  }
  .status-chip {
    white-space: normal;
  }
}
.cat-expand .cat-symbol {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--cat) 22%, transparent);
  color: var(--cat);
  font-style: normal;
  font-weight: 900;
}
.marker-dot {
  display: grid;
  place-items: center !important;
  background: var(--marker) !important;
  color: #10151d;
  font-size: 12px;
  font-weight: 900;
}
.legend i {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #10151d;
  font-style: normal;
  font-weight: 900;
  font-size: 11px;
}
.category:nth-child(1) {
  --cat: #ffd166 !important;
}
.category:nth-child(2) {
  --cat: #ff8d4d !important;
}
.category:nth-child(3) {
  --cat: #ff7b88 !important;
}
.category:nth-child(4) {
  --cat: #2bd9ff !important;
}
.leaflet-marker-icon .marker-dot {
  box-shadow: 0 2px 8px #0008;
  border: 2px solid #fff;
  border-radius: 7px;
  line-height: 1;
}
.legend {
  flex-wrap: wrap;
}
.legend i {
  background: var(--c) !important;
  border: 1px solid color-mix(in srgb, var(--c) 60%, #fff);
}
/* Louis Outlier reference adaptation: compact portfolio-style chrome, metrics and map search. */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}
.breadcrumb strong {
  color: var(--text);
  font-weight: 650;
}
.breadcrumb b {
  font-weight: 400;
}
.breadcrumb em {
  font-style: normal;
  color: var(--muted);
  padding-left: 6px;
}
.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: 88px minmax(0, 1fr);
  background: var(--canvas);
}
.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--canvas);
}
.metric {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 14px;
  min-width: 0;
}
.metric small {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.metric b {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 7px;
}
.metric b span {
  font-size: 20px;
}
.metric em {
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
}
.map-view,
.table-view {
  min-height: 0;
}
.map-search {
  position: absolute;
  z-index: 600;
  right: 16px;
  top: 14px;
  width: min(240px, 42%);
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
}
.map-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.rail {
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.category {
  border-radius: 10px;
}
.modebar {
  box-shadow: 0 1px 0 var(--border);
}
.segmented,
.basemap {
  border-radius: 9px;
}
.segmented button,
.basemap button {
  border-radius: 7px;
}
.drawer {
  box-shadow: -12px 0 28px #0002;
}
.drawer.open {
  border-left: 1px solid var(--border);
}
@media (max-width: 760px) {
  .workspace {
    display: block;
  }
  .overview-strip {
    display: none;
  }
  .map-search {
    right: 10px;
    top: 10px;
    width: 185px;
  }
  .topbar .search {
    display: none;
  }
  .breadcrumb {
    display: none;
  }
  .modebar {
    overflow: hidden;
  }
  .segmented,
  .basemap {
    white-space: nowrap;
  }
  .metric {
    padding: 9px;
  }
}
/* Final shell split: Louis-inspired header/sidebar/footer; HeyNemo-inspired map workspace. */
.app-shell {
  grid-template-rows: minmax(0, 1fr) 38px;
}
.rail,
.workspace,
.drawer {
  grid-row: 1;
}
.app-footer {
  grid-row: 2;
  grid-column: 1/-1;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
  color: var(--muted);
}
.app-footer span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}
.app-footer button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 650;
}
.workspace {
  display: block;
}
.overview-strip {
  display: none;
}
.sidebar-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  margin: 0 0 12px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.sidebar-tabs button {
  border: 0;
  border-radius: 6px;
  padding: 8px 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.sidebar-tabs button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px #0002;
}
.map-place-label {
  position: absolute;
  z-index: 550;
  left: 18px;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 11px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.map-place-label small {
  letter-spacing: 0.14em;
  font-size: 9px;
  color: var(--muted);
}
.map-place-label b {
  font-size: 12px;
}
.map-status {
  top: 65px;
}
.rail-head small {
  letter-spacing: 0.13em;
}
.categories {
  padding-bottom: 10px;
}
@media (max-width: 760px) {
  .app-shell,
  .app-shell.drawer-open {
    height: calc(100vh - 114px);
    display: grid;
    grid-template-rows: minmax(0, 1fr) 34px;
  }
  .workspace {
    grid-row: 1;
  }
  .app-footer {
    grid-row: 2;
    grid-column: 1;
    gap: 12px;
    overflow: hidden;
    white-space: nowrap;
  }
  .app-footer span:nth-last-child(-n + 2) {
    display: none;
  }
  .map-place-label {
    display: none;
  }
  .map-search {
    top: 10px;
  }
  .rail {
    grid-row: 1/3;
  }
  .drawer {
    grid-row: 1/3;
  }
}
@media (max-width: 760px) {
  .app-shell,
  .app-shell.drawer-open {
    grid-template-columns: minmax(0, 1fr);
  }
  .workspace {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }
  .app-footer {
    width: 100%;
  }
  .map-view,
  #map {
    width: 100%;
  }
}

/* Theme-complete surfaces */
html {
  color-scheme: dark;
}
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
}
html[data-theme="dark"] {
  --canvas: #090d14;
  --surface: #111827;
  --raised: #182235;
  --text: #f7f9fc;
  --muted: #aeb9ca;
  --border: #344258;
  --shadow: 0 18px 50px #0008;
}
html[data-theme="light"] {
  --canvas: #f3f6f3;
  --surface: #ffffff;
  --raised: #edf2ed;
  --text: #111820;
  --muted: #5f6c7c;
  --border: #cfd8d0;
  --shadow: 0 18px 50px #16331920;
}
input,
select,
button {
  accent-color: var(--accent);
}
select option {
  background: var(--surface);
  color: var(--text);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}
.leaflet-bar {
  border-color: var(--border) !important;
}
.table-scroll,
.rail,
.drawer,
.docs,
.command-list {
  scrollbar-color: var(--border) var(--canvas);
}
tbody tr:hover {
  background: var(--raised);
}
th {
  background: var(--raised);
  color: var(--muted);
}
td,
th {
  border-color: var(--border);
}
html[data-theme="dark"] .map-search,
html[data-theme="dark"] .map-place-label,
html[data-theme="dark"] .legend {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}
.airport-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}
.airport-metrics > div {
  padding: 9px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.airport-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.airport-metrics small,
.airport-metrics > a {
  grid-column: 1/-1;
}
.search input:focus,
.map-search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#map3d {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.three-d-control {
  position: absolute;
  z-index: 500;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  width: min(260px, 60vw);
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  font: 600 12px system-ui;
}
.three-d-control span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}
.three-d-control input {
  width: 100%;
  accent-color: var(--accent);
}
#threeDToggle[aria-pressed="true"] {
  background: var(--accent);
  color: #101510;
  font-weight: 800;
}
.map-view.is-3d #map {
  visibility: hidden;
}
.map-view.is-3d .legend {
  display: none;
}
@media (max-width: 700px) {
  .three-d-control {
    top: 62px;
    left: 12px;
    transform: none;
    width: 180px;
  }
  .map-view.is-3d .map-search {
    top: 116px;
  }
}
#threeDDisclaimer {
  font-size: 10px;
  color: var(--muted);
  max-width: 270px;
  line-height: 1.2;
}
@media (max-width: 900px) {
  #threeDDisclaimer {
    display: none;
  }
  .map-view.is-3d ~ * #threeDDisclaimer {
    display: block;
  }
}
.legend-toggle {
  display: none;
}
@media (max-width: 760px) {
  html,
  body {
    height: var(--app-height, 100dvh);
    min-height: 0;
    overscroll-behavior: none;
  }
  .topbar {
    height: 58px;
    gap: 8px;
    padding: 7px 10px;
  }
  .brand {
    flex: 1;
    max-width: 190px;
  }
  .brandmark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }
  .brand b {
    font-size: 13px;
    white-space: nowrap;
  }
  .topbar nav {
    gap: 5px;
  }
  .theme-label {
    max-width: 92px;
  }
  .theme-label select {
    max-width: 76px;
    padding: 6px 3px;
  }
  .command-trigger {
    width: 38px;
    height: 38px;
  }
  .modebar {
    height: 82px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 36px 36px;
    gap: 4px;
    padding: 5px 8px;
    overflow: visible;
  }
  .segmented,
  .basemap {
    width: 100%;
    min-width: 0;
    display: grid;
    padding: 2px;
    gap: 2px;
  }
  .segmented {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .basemap {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .segmented button,
  .basemap button {
    padding: 6px 2px;
    min-width: 0;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    touch-action: manipulation;
  }
  .app-shell,
  .app-shell.drawer-open {
    height: calc(var(--app-height, 100dvh) - 140px);
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) 30px;
  }
  .workspace,
  .map-view,
  #map,
  #map3d {
    min-height: 0;
    height: 100%;
    touch-action: pan-x pan-y;
  }
  .app-footer {
    height: 30px;
    padding: 0 10px;
    font-size: 10px;
    gap: 8px;
  }
  .app-footer button {
    margin-left: auto;
  }
  .app-footer span:not(:first-child) {
    display: none !important;
  }
  .map-search {
    top: 8px;
    right: 8px;
    width: min(180px, 58vw);
    height: 36px;
    font-size: 12px;
    z-index: 650;
  }
  .map-search input {
    font-size: 16px;
  }
  .leaflet-control-zoom {
    margin-top: 8px !important;
    margin-left: 8px !important;
  }
  .filter-fab {
    left: 10px;
    bottom: 39px;
    padding: 10px 14px;
    font-size: 12px;
    z-index: 750;
  }
  .legend-toggle {
    display: block;
    position: absolute;
    z-index: 720;
    right: 10px;
    bottom: 39px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 9px 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 11px;
    font-weight: 750;
    color: var(--text);
  }
  .legend {
    right: 10px;
    left: 10px;
    bottom: 78px;
    max-width: none;
    max-height: min(46vh, 330px);
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 10px;
    font-size: 10px;
    z-index: 710;
  }
  .legend.mobile-collapsed {
    display: none;
  }
  .legend span {
    min-width: 0;
    line-height: 1.15;
  }
  .legend i {
    flex: 0 0 20px;
  }
  .drawer {
    height: min(66dvh, 560px);
    max-width: 100%;
    overflow: auto;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .drawer #drawerContent {
    padding: 52px 18px 24px;
  }
  .drawer h2 {
    font-size: 22px;
  }
  .record-meta div {
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  .rail {
    inset: 0 3% 0 0;
    width: auto;
    max-width: 390px;
    padding: 18px 14px calc(24px + env(safe-area-inset-bottom));
    touch-action: pan-y;
  }
  .rail-head h1 {
    font-size: 23px;
  }
  .cat-row {
    min-height: 60px;
  }
  .cat-expand {
    min-width: 0;
  }
  .cat-expand span {
    min-width: 0;
  }
  .cat-expand b,
  .cat-expand small {
    overflow-wrap: anywhere;
  }
  .table-view {
    height: 100%;
    padding: 10px;
    overflow: auto;
  }
  .table-head {
    align-items: start;
    gap: 8px;
  }
  .table-head h2 {
    font-size: 20px;
  }
  .table-head p {
    font-size: 11px;
  }
  .table-scroll {
    min-width: 0;
  }
  table {
    font-size: 11px;
  }
  th,
  td {
    padding: 9px 7px;
    overflow-wrap: anywhere;
  }
  .three-d-control {
    top: 52px;
    left: 8px;
    width: 160px;
    padding: 8px 10px;
  }
  .map-view.is-3d .map-search {
    top: 8px;
  }
}
@media (max-width: 360px) {
  .brand {
    max-width: 155px;
  }
  .theme-label {
    max-width: 78px;
  }
  .segmented button,
  .basemap button {
    font-size: 10px;
  }
  .map-search {
    width: 160px;
  }
  .legend {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 761px) {
  .legend-toggle {
    display: none !important;
  }
}
.version-stamp {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
  font-size: 9px;
  letter-spacing: 0.04em;
}

/* Lucide tab-bar icons (ISC) - local assets/icons/, inlined with currentColor so they inherit theme color; no glyph can tofu */
.segmented button,
.basemap button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.segmented button .tb-ico,
.basemap button .tb-ico {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

/* Lucide icon sizing per context (icons inherit color via currentColor) */
.ic {
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
}
.glyph-ico {
  display: inline-flex;
  align-items: center;
}
.glyph-ico .ic {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
#closeDrawer .ic,
.dialog-head button .ic,
.mobile-close .ic {
  width: 20px;
  height: 20px;
}
.cat-symbol .ic {
  width: 16px;
  height: 16px;
}
.marker-dot .ic {
  width: 58% !important;
  height: 58% !important;
}
.legend i .ic {
  width: 12px;
  height: 12px;
}
.cmd-icon .ic {
  width: 16px;
  height: 16px;
}
.cmd-check .ic {
  width: 14px;
  height: 14px;
}
.leaflet-tooltip .ic {
  width: 12px;
  height: 12px;
  vertical-align: -1.5px;
}
