/* Theme variables */
:root {
  color-scheme: light dark;
  --font-mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ok: #257447;
  --caution: #96711a;
  --unsafe: #a12b2b;
  --tile-filter: none;
  font-family: var(--font-mono);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-color: #050505;
  --bg: #050505;
  --panel: #080808;
  --panel-strong: #101010;
  --surface: #0d0d0d;
  --text: #f5f5f5;
  --muted: #b7b7b7;
  --subtle: #7f7f7f;
  --line: rgba(255, 255, 255, 0.22);
  --line-strong: rgba(255, 255, 255, 0.52);
  --inverse: #050505;
  --status-bg: rgba(255, 255, 255, 0.035);
  --map-bg: #060606;
  --grid-line: rgba(255, 255, 255, 0.055);
  --ok: #7fd39b;
  --caution: #d8b44d;
  --unsafe: #ff7474;
}

:root[data-theme="light"] {
  color-scheme: light;
  --theme-color: #f4f3ee;
  --bg: #f4f3ee;
  --panel: #ffffff;
  --panel-strong: #f7f7f3;
  --surface: #ededE8;
  --text: #050505;
  --muted: #3f3f3f;
  --subtle: #6c6c6c;
  --line: rgba(0, 0, 0, 0.2);
  --line-strong: rgba(0, 0, 0, 0.55);
  --inverse: #ffffff;
  --status-bg: rgba(0, 0, 0, 0.035);
  --map-bg: #d8d8d0;
  --grid-line: rgba(0, 0, 0, 0.055);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

/* Main layout */
.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr) minmax(0, auto);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--bg);
}

.command-bar {
  padding-top: env(safe-area-inset-top);
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(210px, 1.2fr) minmax(138px, 0.7fr) minmax(220px, 1fr) minmax(128px, 0.62fr) auto auto;
  align-items: stretch;
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
}

.brand-block,
.command-readout,
.theme-toggle {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.brand-block strong,
.command-readout strong,
.theme-toggle strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-block strong {
  font-size: 1.08rem;
}

.command-code,
.command-readout span,
.theme-toggle span,
.eyebrow,
.label,
.section-code,
.metric span,
.detail-grid dt,
.envelope-label {
  color: var(--subtle);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.command-readout-wide strong {
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
}

.theme-toggle {
  min-width: 92px;
  border: 0;
  border-right: 0;
  border-left: 1px solid var(--line-strong);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
}

.mode-toggle {
  min-width: 112px;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: -4px;
  background: var(--panel-strong);
}

/* Simple mode */
.simple-panel {
  display: grid;
  gap: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
}

.simple-header {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-strong);
}

.simple-decision {
  display: grid;
  gap: 4px;
  padding-left: 10px;
  border-left: 4px solid var(--subtle);
}

.simple-decision[data-level="ok"] {
  border-left-color: var(--ok);
}

.simple-decision[data-level="caution"] {
  border-left-color: var(--caution);
}

.simple-decision[data-level="unsafe"] {
  border-left-color: var(--unsafe);
}

.simple-decision span,
.simple-card span {
  color: var(--subtle);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.simple-decision strong {
  color: var(--text);
  font-size: clamp(2.2rem, 7vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.95;
  text-transform: uppercase;
}

.simple-decision p,
.simple-card p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.28;
}

.simple-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.simple-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 104px;
  padding: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.simple-card:hover,
.simple-card:focus-visible,
.simple-aircraft-row:hover,
.simple-aircraft-row:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: -3px;
}

.simple-card strong {
  min-width: 0;
  color: var(--text);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.simple-card em {
  justify-self: start;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 4px 5px;
  text-transform: uppercase;
}

.simple-card em[data-level="ok"] {
  border-color: var(--ok);
  color: var(--ok);
}

.simple-card em[data-level="caution"] {
  border-color: var(--caution);
  color: var(--caution);
}

.simple-card em[data-level="unsafe"] {
  border-color: var(--unsafe);
  color: var(--unsafe);
}

.simple-aircraft-list {
  display: grid;
  border-top: 1px solid var(--line-strong);
}

.simple-aircraft-row {
  display: grid;
  grid-template-columns: minmax(72px, 1.1fr) repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  min-height: 40px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--status-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.62rem;
  padding: 6px 10px;
  text-align: left;
  text-transform: uppercase;
}

.simple-aircraft-row strong,
.simple-aircraft-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root[data-view-mode="pro"] .simple-panel {
  display: none;
}

:root[data-view-mode="simple"] .mobile-summary,
:root[data-view-mode="simple"] .panel-header,
:root[data-view-mode="simple"] .selected-card,
:root[data-view-mode="simple"] .card {
  display: none;
}

.map-shell {
  min-height: 0;
  position: relative;
  height: 100%;
  width: 100%;
  background: var(--map-bg);
}

.map-shell::after {
  position: absolute;
  right: 12px;
  bottom: 26px;
  z-index: 450;
  color: var(--subtle);
  content: "MAP / LIVE";
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  pointer-events: none;
}

.map-controls {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  z-index: 650;
  display: flex;
  max-width: min(760px, calc(100% - 24px));
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.layer-drawer {
  display: contents;
}

.layer-drawer-toggle,
.layer-drawer-header,
.mobile-theme-toggle {
  display: none;
}

.layer-drawer-header {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--subtle);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.layer-drawer-header button,
.mobile-inspect-card-header button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0 10px;
  text-transform: uppercase;
}

.map-control-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  color: var(--text);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 0 9px;
  pointer-events: auto;
  text-transform: uppercase;
}

.map-control-button[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--inverse);
}

.map-control-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.map-control-button:hover,
.map-control-button:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: -3px;
}

.map-status-message {
  min-height: 36px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
  padding: 5px 8px;
  pointer-events: auto;
  text-transform: uppercase;
}

.layer-status {
  width: 100%;
  min-height: 28px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.25;
  padding: 5px 8px;
  pointer-events: auto;
  text-transform: uppercase;
}

.mobile-inspect-card {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 735;
  display: grid;
  max-height: 42dvh;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 97%, transparent);
  box-shadow: 0 0 0 1px var(--bg);
  overflow: hidden;
}

.mobile-inspect-card[hidden] {
  display: none;
}

.mobile-inspect-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 0 8px 0 10px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-strong);
}

.mobile-inspect-card-header span {
  color: var(--subtle);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-inspect-content {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
}

.mobile-inspect-title {
  display: grid;
  gap: 3px;
}

.mobile-inspect-title strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.mobile-inspect-title span,
.mobile-inspect-note {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.28;
}

.mobile-inspect-grid {
  display: grid;
  grid-template-columns: minmax(88px, 0.8fr) minmax(0, 1.2fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-size: 0.7rem;
}

.mobile-inspect-grid dt,
.mobile-inspect-grid dd {
  min-width: 0;
  margin: 0;
  padding: 6px 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mobile-inspect-grid dt {
  color: var(--subtle);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mobile-inspect-grid dd {
  color: var(--text);
  overflow-wrap: anywhere;
}

.weather-hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 640;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 93%, transparent);
  pointer-events: none;
}

.weather-hud-cell {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 6px 7px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.weather-hud-cell span {
  color: var(--subtle);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.weather-hud-cell strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.weather-hud-cell[data-level="ok"] {
  color: var(--ok);
}

.weather-hud-cell[data-level="caution"] {
  color: var(--caution);
}

.weather-hud-cell[data-level="unsafe"] {
  color: var(--unsafe);
}

.weather-hud-cell[data-level="ok"] strong,
.weather-hud-cell[data-level="caution"] strong,
.weather-hud-cell[data-level="unsafe"] strong {
  color: currentColor;
}

.weather-hud-status {
  border-left: 3px solid currentColor;
}

.sun-timeline {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(62px + env(safe-area-inset-bottom));
  z-index: 635;
  display: grid;
  grid-template-columns: minmax(172px, auto) minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 93%, transparent);
}

.sun-timeline-readout {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-right: 1px solid var(--line-strong);
}

.sun-timeline-readout span,
.sun-timeline-readout time {
  color: var(--subtle);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.sun-timeline-readout strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.sun-timeline-readout button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0 7px;
  text-transform: uppercase;
}

.sun-timeline-track {
  position: relative;
  min-width: 0;
  padding: 0 10px;
}

.sun-timeline-track input {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 36px;
  accent-color: var(--text);
  cursor: pointer;
}

.sun-timeline-markers {
  position: absolute;
  inset: 0 10px;
  pointer-events: none;
}

.sun-marker {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--line-strong);
}

.sun-marker::after {
  position: absolute;
  top: -2px;
  left: 3px;
  color: var(--subtle);
  content: attr(data-label);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

:root[data-zone-mode="color"] .sun-marker-sunrise,
:root[data-zone-mode="color"] .sun-marker-sunset,
:root[data-zone-mode="color"] .sun-marker-goldenMorningEnd,
:root[data-zone-mode="color"] .sun-marker-goldenEveningStart {
  background: #d8a34d;
}

.map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--map-bg);
}

.info-panel {
  z-index: 500;
  width: 100%;
  max-height: 56vh;
  overflow: auto;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line-strong);
  background: var(--panel);
}

/* Instrument modules */
.panel-header,
.card-heading,
.restriction-meta,
.aircraft-meta,
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header {
  align-items: flex-start;
  padding: 14px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel);
}

.panel-actions {
  align-items: flex-start;
}

.mobile-summary,
.mobile-sheet-close {
  display: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.05rem;
  line-height: 1.15;
  text-transform: uppercase;
}

h2 {
  flex: 1;
  min-width: 0;
  font-size: 0.93rem;
  line-height: 1.15;
  text-transform: uppercase;
}

h3 {
  font-size: 0.88rem;
  line-height: 1.25;
  text-transform: uppercase;
}

.selected-card,
.card {
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
}

.selected-card {
  padding: 14px;
}

.card {
  display: grid;
  gap: 0;
}

.card-heading {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
}

.section-code {
  min-width: 44px;
  color: var(--text);
}

.coords {
  margin-top: 8px;
  color: var(--text);
  font-size: clamp(1.16rem, 4vw, 1.72rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.position-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.content-muted,
.muted {
  color: var(--muted);
  line-height: 1.45;
}

.content-muted {
  padding: 12px 14px;
}

.module-status {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: baseline;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--status-bg);
}

.module-status span,
.compact-row-label,
.module-details summary,
.inline-details summary {
  color: var(--subtle);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.module-status strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.module-status p {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.wx-risk-legend {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 3px 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--status-bg);
}

.wx-risk-legend span {
  color: var(--subtle);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.wx-risk-legend strong {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.wx-risk-legend p {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
  text-transform: uppercase;
}

.status-pill,
.badge {
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 4px 6px;
  text-transform: uppercase;
}

.badge-ok {
  border-color: var(--ok);
  color: var(--ok);
}

.badge-caution {
  border-color: var(--caution);
  color: var(--caution);
}

.badge-unsafe {
  border-color: var(--unsafe);
  color: var(--unsafe);
}

.badge-muted {
  color: var(--muted);
}

.weather-grid,
.sun-grid,
.detail-grid,
.envelope-list,
.compact-row-list,
.restriction-list,
.aircraft-list {
  display: grid;
}

.compact-row {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(68px, auto) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-left: 3px solid currentColor;
  border-bottom: 1px solid var(--line);
}

.compact-row-ok {
  color: var(--ok);
}

.compact-row-caution {
  color: var(--caution);
}

.compact-row-unsafe {
  color: var(--unsafe);
}

.compact-row-value {
  color: var(--text);
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-align: right;
}

.compact-row .inline-details {
  grid-column: 1 / -1;
}

.weather-grid,
.sun-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.metric {
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--status-bg);
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.envelope-row {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-left: 3px solid currentColor;
  border-bottom: 1px solid var(--line);
}

.envelope-ok {
  color: var(--ok);
}

.envelope-caution {
  color: var(--caution);
}

.envelope-unsafe {
  color: var(--unsafe);
}

.envelope-main {
  min-width: 0;
  color: inherit;
}

.envelope-main strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.envelope-detail {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  padding-left: 17px;
}

.restriction-item,
.aircraft-item {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.restriction-meta,
.aircraft-meta {
  align-items: flex-start;
}

.detail-grid {
  grid-template-columns: 96px 1fr;
  gap: 0;
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.detail-grid dt,
.detail-grid dd {
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-grid dd {
  color: var(--text);
  overflow-wrap: anywhere;
}

.raw-text {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.raw-details {
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.raw-details summary,
.module-details summary,
.inline-details summary {
  cursor: pointer;
  padding: 7px 0 0;
  color: var(--text);
}

.raw-details .raw-text {
  padding-top: 8px;
}

.module-details {
  border-bottom: 1px solid var(--line);
  padding: 0 14px 8px;
}

.module-details summary {
  padding: 9px 0 2px;
}

.inline-details {
  color: var(--muted);
}

.inline-details summary {
  padding: 4px 0 0;
}

.inline-details .raw-text {
  padding-top: 5px;
}

.compact-list {
  margin-top: 6px;
  border-top: 1px solid var(--line);
}

.disclaimer {
  border-top: 1px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.78rem;
  line-height: 1.4;
  text-transform: uppercase;
}

/* Map overlays and Leaflet chrome */
.leaflet-container {
  background: var(--map-bg);
  font-family: var(--font-mono);
}

.leaflet-tile {
  filter: var(--tile-filter);
}

.leaflet-control-zoom a,
.leaflet-control-attribution {
  border-radius: 0 !important;
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--line-strong) !important;
  font-family: var(--font-mono) !important;
}

.leaflet-control-attribution a {
  color: var(--text) !important;
}

.leaflet-interactive:focus,
.leaflet-interactive:focus-visible {
  outline: none;
}

.selected-crosshair {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid var(--text);
  background: transparent;
}

.current-crosshair {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1px dashed var(--text);
  background: color-mix(in srgb, var(--panel) 30%, transparent);
}

.current-crosshair::before,
.current-crosshair::after {
  position: absolute;
  background: var(--text);
  content: "";
}

.current-crosshair::before {
  left: 50%;
  top: 5px;
  width: 1px;
  height: 30px;
}

.current-crosshair::after {
  left: 5px;
  top: 50%;
  width: 30px;
  height: 1px;
}

.current-location-marker {
  background: transparent;
  border: 0;
}

.selected-crosshair::before,
.selected-crosshair::after {
  position: absolute;
  background: var(--text);
  content: "";
}

.selected-crosshair::before {
  left: 50%;
  top: -8px;
  width: 1px;
  height: 50px;
}

.selected-crosshair::after {
  left: -8px;
  top: 50%;
  width: 50px;
  height: 1px;
}

.aircraft-marker {
  background: transparent;
  border: 0;
}

.aircraft-marker-arrow {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 20px solid var(--text);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.75));
  transform-origin: 50% 60%;
}

.aircraft-marker-warning .aircraft-marker-arrow {
  border-bottom-color: var(--unsafe);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 0 !important;
  border: 1px solid var(--line-strong);
  background: var(--panel) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

.leaflet-popup-content {
  margin: 9px 10px !important;
  font-family: var(--font-mono);
}

.map-popup {
  min-width: 190px;
}

.map-popup p {
  color: var(--subtle);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-popup strong {
  display: block;
  margin: 3px 0 7px;
  font-size: 0.82rem;
  line-height: 1.2;
  text-transform: uppercase;
}

.map-popup dl {
  display: grid;
  grid-template-columns: 62px 1fr;
  margin: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.map-popup dt,
.map-popup dd {
  margin: 0;
  padding: 4px 5px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
}

.map-popup dt {
  color: var(--subtle);
  text-transform: uppercase;
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 450px);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .command-bar {
    grid-column: 1 / -1;
  }

  .map-shell {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    height: 100%;
  }

  .info-panel {
    grid-column: 2;
    grid-row: 2;
    max-height: none;
    height: 100%;
    border-top: 0;
    border-left: 1px solid var(--line-strong);
  }
}

@media (max-width: 899px) {
  .command-bar {
    grid-template-columns: 1fr 1fr;
  }

  .brand-block,
  .command-readout,
  .theme-toggle {
    min-height: 54px;
    border-bottom: 1px solid var(--line);
  }

  .command-readout-wide {
    grid-column: 1 / -1;
  }

  .app-shell {
    overflow: auto;
    grid-template-rows: auto auto auto;
  }

  .map-shell {
    height: 54vh;
    min-height: 330px;
  }

  .info-panel {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .app-shell {
    position: relative;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .command-bar {
    min-height: 40px;
    grid-template-columns: minmax(112px, 1fr) minmax(70px, auto) minmax(56px, auto) minmax(74px, auto);
    border-bottom-color: var(--line-strong);
  }

  .brand-block,
  .command-readout,
  .theme-toggle {
    min-height: 44px;
    padding: 5px 7px;
    border-bottom: 0;
  }

  .brand-block span,
  .command-readout span,
  .theme-toggle span {
    display: none;
  }

  .brand-block strong,
  .command-readout strong,
  .theme-toggle strong {
    font-size: 0.78rem;
    letter-spacing: 0;
  }

  .command-readout-wide {
    display: none;
  }

  #themeToggle {
    display: none;
  }

  .theme-toggle {
    min-width: 46px;
    justify-items: center;
    border-left: 0;
  }

  .mode-toggle {
    min-width: 72px;
  }

  .theme-toggle:not(.mode-toggle) strong {
    font-size: 0;
  }

  .theme-toggle:not(.mode-toggle) strong::after {
    content: "◐";
    font-size: 1rem;
  }

  .mode-toggle strong {
    font-size: 0.68rem;
  }

  .map-shell {
    grid-row: 2;
    height: auto;
    min-height: 0;
  }

  .map-shell::after {
    bottom: calc(118px + env(safe-area-inset-bottom));
    font-size: 0.6rem;
  }

  .map-controls {
    top: calc(8px + env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    max-width: none;
    gap: 5px;
  }

  .layer-drawer-toggle {
    display: inline-grid;
  }

  .layer-drawer {
    position: absolute;
    top: calc(8px + env(safe-area-inset-top));
    right: 8px;
    z-index: 760;
    width: min(286px, calc(100vw - 16px));
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: none;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line-strong);
    background: color-mix(in srgb, var(--panel) 98%, transparent);
    overflow-y: auto;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
  }

  .layer-drawer.is-open {
    display: grid;
  }

  .layer-drawer-header {
    display: flex;
    min-height: 44px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
  }

  .layer-drawer .map-control-button,
  .mobile-theme-toggle {
    width: 100%;
    min-height: 44px;
    justify-content: start;
  }

  .mobile-theme-toggle {
    display: inline-grid;
  }

  .map-controls > .layer-status {
    display: none;
  }

  .map-control-button,
  .map-status-message {
    min-height: 40px;
    font-size: 0.64rem;
    padding-left: 8px;
    padding-right: 8px;
  }

  .map-status-message {
    width: 100%;
  }

  .layer-status {
    min-height: 32px;
    font-size: 0.58rem;
    line-height: 1.2;
    padding: 4px 6px;
  }

  .weather-hud {
    left: 8px;
    right: 8px;
    bottom: calc(58px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sun-timeline {
    left: 8px;
    right: 8px;
    bottom: calc(136px + env(safe-area-inset-bottom));
    grid-template-columns: 1fr;
  }

  .sun-timeline-readout {
    min-height: 40px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    padding: 4px 6px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sun-timeline-readout strong {
    font-size: 0.64rem;
  }

  .sun-timeline-readout time,
  .sun-timeline-readout span,
  .sun-timeline-readout button {
    min-height: 34px;
    font-size: 0.56rem;
  }

  .sun-timeline-track {
    padding: 0 8px;
  }

  .sun-timeline-track input {
    height: 40px;
  }

  .sun-marker::after {
    display: none;
  }

  .weather-hud-cell {
    min-height: 36px;
    gap: 2px;
    padding: 5px 4px;
  }

  .weather-hud-cell span {
    font-size: 0.56rem;
    letter-spacing: 0.04em;
  }

  .weather-hud-cell strong {
    font-size: clamp(0.68rem, 2.65vw, 0.84rem);
  }

  .info-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 700;
    max-height: calc(100dvh - 42px);
    border-top: 1px solid var(--line-strong);
    background: color-mix(in srgb, var(--panel) 96%, transparent);
  }

  :root[data-view-mode="simple"] .info-panel {
    max-height: min(36dvh, 286px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  :root[data-view-mode="simple"] .weather-hud {
    bottom: calc(min(36dvh, 286px) + 8px + env(safe-area-inset-bottom));
  }

  .map-shell.inspect-card-open .weather-hud {
    display: none;
  }

  :root[data-view-mode="simple"] .mobile-inspect-card {
    bottom: calc(min(36dvh, 286px) + 8px + env(safe-area-inset-bottom));
  }

  :root[data-view-mode="simple"] .sun-timeline {
    display: none;
  }

  :root[data-view-mode="simple"] .simple-header {
    padding: 8px 10px;
  }

  :root[data-view-mode="simple"] .simple-decision {
    gap: 2px;
  }

  :root[data-view-mode="simple"] .simple-decision strong {
    font-size: 1.72rem;
  }

  :root[data-view-mode="simple"] .simple-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :root[data-view-mode="simple"] .simple-card {
    min-height: 68px;
    gap: 3px;
    padding: 7px 8px;
  }

  :root[data-view-mode="simple"] .simple-card strong {
    font-size: 0.78rem;
  }

  :root[data-view-mode="simple"] .simple-card p {
    font-size: 0.62rem;
  }

  :root[data-view-mode="simple"] .simple-card em {
    font-size: 0.54rem;
    padding: 3px 4px;
  }

  .simple-aircraft-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaflet-control-zoom {
    display: none;
  }

  .mobile-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--panel);
  }

  .mobile-tile {
    min-height: 45px;
    display: grid;
    align-content: center;
    gap: 3px;
    padding: 7px 9px;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    text-align: left;
    cursor: pointer;
  }

  .mobile-tile:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

  .mobile-tile:last-child {
    border-right: 0;
  }

  .mobile-tile span {
    color: var(--subtle);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
  }

  .mobile-tile strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: clamp(0.66rem, 2.55vw, 0.92rem);
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .info-panel:not(.is-expanded) {
    overflow: hidden;
  }

  .info-panel:not(.is-expanded) .panel-header,
  .info-panel:not(.is-expanded) .selected-card,
  .info-panel:not(.is-expanded) .card,
  .info-panel:not(.is-expanded) .disclaimer {
    display: none;
  }

  .info-panel.is-expanded {
    display: block;
    max-height: min(62dvh, calc(100dvh - 40px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .info-panel.is-expanded .mobile-summary {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .mobile-sheet-close {
    display: inline-grid;
    min-height: 40px;
    align-items: center;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0 9px;
    text-transform: uppercase;
  }

  .panel-header,
  .selected-card,
  .card-heading,
  .restriction-item,
  .aircraft-item {
    padding-left: 10px;
    padding-right: 10px;
  }

  .panel-header {
    position: sticky;
    top: calc(45px + env(safe-area-inset-bottom));
    z-index: 1;
  }

  .selected-card {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .coords {
    font-size: 1.08rem;
  }

  .position-meta {
    font-size: 0.62rem;
  }

  .card-heading {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .content-muted {
    padding: 10px;
  }

  .module-status {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 8px 10px;
  }

  .module-status strong {
    font-size: 0.84rem;
  }

  .module-status p {
    font-size: 0.68rem;
  }

  .wx-risk-legend {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 7px 10px;
  }

  .wx-risk-legend span {
    font-size: 0.6rem;
  }

  .wx-risk-legend strong,
  .wx-risk-legend p {
    font-size: 0.64rem;
  }

  .weather-grid,
  .sun-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    padding: 8px 10px;
  }

  .metric strong {
    font-size: 0.94rem;
  }

  .envelope-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px 10px;
  }

  .envelope-label {
    font-size: 0.62rem;
  }

  .envelope-main strong {
    font-size: 0.98rem;
  }

  .envelope-detail {
    padding-left: 0;
    font-size: 0.72rem;
  }

  .detail-grid {
    grid-template-columns: 82px 1fr;
    font-size: 0.74rem;
  }

  .detail-grid dt,
  .detail-grid dd {
    padding: 5px 6px;
  }

  .raw-details summary,
  .module-details summary,
  .inline-details summary,
  .raw-text {
    font-size: 0.7rem;
  }

  .compact-row {
    grid-template-columns: minmax(72px, 1fr) minmax(52px, auto) auto;
    gap: 5px;
    padding: 7px 10px;
  }

  .compact-row-label {
    font-size: 0.58rem;
  }

  .compact-row-value {
    font-size: 0.82rem;
  }

  .module-details {
    padding-left: 10px;
    padding-right: 10px;
  }

  .disclaimer {
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    font-size: 0.68rem;
  }
}

@media (max-width: 899px) and (orientation: landscape) {
  .app-shell {
    height: 100dvh;
    grid-template-columns: minmax(0, 1fr) minmax(270px, 34vw);
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .command-bar {
    grid-column: 1 / -1;
    min-height: 40px;
    grid-template-columns: minmax(120px, 1fr) minmax(68px, auto) minmax(56px, auto) minmax(74px, auto);
  }

  .brand-block,
  .command-readout,
  .theme-toggle {
    min-height: 40px;
    padding: 5px 7px;
    border-bottom: 0;
  }

  .command-readout-wide,
  #themeToggle {
    display: none;
  }

  .map-shell {
    grid-column: 1;
    grid-row: 2;
    height: 100%;
    min-height: 0;
  }

  .info-panel,
  :root[data-view-mode="simple"] .info-panel {
    position: relative;
    grid-column: 2;
    grid-row: 2;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 500;
    height: 100%;
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--line-strong);
    overflow-y: auto;
  }

  :root[data-view-mode="simple"] .simple-header {
    padding: 9px 10px;
  }

  :root[data-view-mode="simple"] .simple-grid {
    grid-template-columns: 1fr;
  }

  :root[data-view-mode="simple"] .simple-card {
    min-height: 64px;
  }

  .map-controls {
    top: calc(8px + env(safe-area-inset-top));
    left: 8px;
    right: auto;
    max-width: min(250px, 46vw);
  }

  .map-control-button,
  .map-status-message {
    min-height: 40px;
    font-size: 0.64rem;
  }

  .layer-drawer-toggle {
    display: inline-grid;
  }

  .layer-drawer {
    position: absolute;
    top: calc(8px + env(safe-area-inset-top));
    right: 8px;
    z-index: 760;
    width: min(250px, 38vw);
    max-height: calc(100% - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: none;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line-strong);
    background: color-mix(in srgb, var(--panel) 98%, transparent);
    overflow-y: auto;
    pointer-events: auto;
  }

  .layer-drawer.is-open {
    display: grid;
  }

  .layer-drawer-header {
    display: flex;
    min-height: 44px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 6px;
  }

  .layer-drawer .map-control-button,
  .mobile-theme-toggle {
    width: 100%;
    min-height: 44px;
    justify-content: start;
  }

  .mobile-theme-toggle {
    display: inline-grid;
  }

  .weather-hud {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sun-timeline,
  :root[data-view-mode="simple"] .sun-timeline {
    display: none;
  }

  .mobile-inspect-card {
    left: auto;
    right: 8px;
    top: 58px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: min(300px, 42vw);
    max-height: none;
  }

  .map-shell.inspect-card-open .weather-hud {
    display: none;
  }

  .leaflet-control-zoom {
    display: none;
  }
}

@media (min-width: 769px) and (max-width: 899px) and (orientation: portrait) {
  .command-bar {
    min-height: 44px;
    grid-template-columns: minmax(160px, 1fr) minmax(82px, auto) minmax(132px, auto) minmax(66px, auto) 58px;
  }

  .brand-block,
  .command-readout,
  .theme-toggle {
    min-height: 44px;
    padding: 6px 8px;
    border-bottom: 0;
  }

  .brand-block strong,
  .command-readout strong,
  .theme-toggle strong {
    font-size: 0.8rem;
  }

  .command-readout-wide {
    grid-column: auto;
  }

  .map-shell {
    height: 62dvh;
  }
}

@media (max-width: 460px) {
  .weather-grid,
  .sun-grid {
    grid-template-columns: 1fr;
  }

  .envelope-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .envelope-detail {
    padding-left: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
