:root {
  color-scheme: dark;
  --bg: #0c1322;
  --sidebar: #19273b;
  --surface: #141e30;
  --surface-raised: #1b2940;
  --surface-hover: #23334e;
  --surface-overlay: #141e30f2;
  --field: #0f192b;
  --text: #edf2fc;
  --muted: #a4b1c8;
  --accent: #c3f673;
  --accent-strong: #d2f99c;
  --on-accent: #203018;
  --accent-soft: #c3f67312;
  --accent-border: #c3f67340;
  --focus-ring: #c3f67326;
  --accent-secondary: #baa6f7;
  --violet-soft: #baa6f719;
  --success: #93d9b7;
  --success-soft: #93d9b717;
  --danger: #f4a7b5;
  --danger-soft: #f4a7b514;
  --border: #2b3a53;
  --border-soft: #223149;
  --card: var(--surface);
  --shadow: 0 12px 32px #0003;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.3; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--text);
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 40px;
  margin-top: 7px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--field);
  color: var(--text);
  outline: none;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
input:disabled { color: var(--muted); background: var(--surface-raised); }
input::placeholder { color: var(--muted); }
label { display: block; margin: 18px 0 0; font-size: 12px; font-weight: 550; line-height: 1.5; }
input[type=color] { width: 48px; height: 32px; padding: 3px; cursor: pointer; }
input[type=range] { height: 20px; margin-top: 10px; padding: 0; border: 0; background: transparent; box-shadow: none; accent-color: var(--accent); cursor: pointer; }
output { float: right; color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; }
.muted, .hint, .section-sub, .settings-subtitle { color: var(--muted); }
.hint { margin: 8px 0 12px; font-size: 11px; line-height: 1.6; }
.kicker { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.compact { font-size: 12px; }
.button-row, .input-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.button-row { margin-top: 14px; }
.button-row button { width: 100%; min-width: 0; font-size: 12px; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
.toggle input { appearance: none; position: relative; flex: none; width: 34px; min-width: 34px; height: 20px; margin: 0; padding: 0; border: 1px solid #445466; border-radius: 20px; background: #344354; cursor: pointer; }
.toggle input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::before { transform: translateX(14px); background: var(--on-accent); }

/* Airport launcher */
.launcher { max-width: 1320px; margin: 0 auto; padding: 48px 32px; }
.launcher-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.launcher-header h1 { margin: 0 0 9px; font-size: 32px; font-weight: 650; letter-spacing: -.035em; }
.launcher-heading > p:last-child { margin: 0; color: var(--muted); font-size: 14px; }
.status-strip { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 8px 11px; border: 1px solid var(--border-soft); border-radius: 20px; background: var(--surface); color: var(--muted); font-size: 11px; }
.status-dot { width: 6px; height: 6px; flex: none; background: var(--accent); border-radius: 50%; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.home-primary { display: grid; gap: 24px; min-width: 0; align-content: start; }
.home-sidebar { position: sticky; top: 24px; min-width: 0; }
#airport-controls { min-width: 0; margin: 0; padding: 0; border: 0; }
.workspace-access { margin: 18px 0; padding: 14px; border: 1px solid var(--accent-border); border-radius: 8px; background: var(--accent-soft); }
.workspace-access p { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.workspace-access button { min-height: 34px; color: var(--accent); font-size: 12px; }
.launcher.is-locked .status-dot { background: var(--muted); }
.launcher.is-locked #airport-controls { opacity: .55; }
.launcher-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.launcher-card { min-width: 0; padding: 26px; }
.launcher-card > h2 { margin-bottom: 7px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.launcher-card > p.muted { font-size: 12px; margin-bottom: 24px; }
.launcher-card label { font-size: 12px; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.search-row button { height: 40px; }
select[size] { height: 253px; padding: 6px; }
select[size] optgroup { color: var(--accent); font-size: 11px; font-style: normal; padding: 5px 0 2px; }
select[size] option { padding: 6px 8px; border-radius: 4px; color: var(--text); font-size: 12px; font-weight: 400; }
select[size] option:checked { background: var(--accent); color: var(--on-accent); }
#launch-siting { display: flex; justify-content: space-between; align-items: center; width: 100%; height: 42px; margin-top: 24px; }
.airport-preview { display: flex; flex-direction: column; border-left: 1px solid var(--border-soft); background: var(--field); }
.airport-code { margin: 8px 0 10px; color: var(--accent); font-size: 40px; font-weight: 650; line-height: 1.2; letter-spacing: -.025em; }
.airport-preview h2 { margin-bottom: 8px; font-size: 18px; font-weight: 600; }
.airport-preview > p.muted { margin-bottom: 0; font-size: 11px; }
.airport-details { margin: 20px 0 0; padding-top: 5px; border-top: 1px solid var(--border-soft); }
.airport-details > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; }
.airport-details dt { color: var(--muted); font-size: 11px; }
.airport-details dd { margin: 0; text-align: right; font-size: 11px; font-weight: 550; font-variant-numeric: tabular-nums; }
.module-description { margin-top: auto; padding-top: 22px; }
.module-description h3 { margin-bottom: 6px; color: var(--text); font-size: 12px; font-weight: 600; }
.module-description p { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* Siting workspace */
.siting-page { max-width: 1920px; margin: auto; padding: 18px 24px 24px; }
.site-header { display: flex; align-items: center; gap: 20px; min-height: 64px; padding: 11px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.site-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.workspace-label { font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
#active-airport { padding: 4px 8px; border: 1px solid var(--accent-border); border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 650; }
#preset-toolbar { margin-left: auto; }
.pill-button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; flex-shrink: 0; min-height: 34px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 550; }
.pill-button:hover { background: var(--surface-raised); color: var(--text); }
.pb-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 70px; padding: 18px 2px; }
.pb-hero h1 { margin: 0; font-size: 23px; font-weight: 600; letter-spacing: -.025em; }
.pb-hero .muted { max-width: 60%; text-align: right; font-size: 12px; }
.siting-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 20px; height: calc(100dvh - 178px); min-height: 570px; align-items: stretch; }
.map-column { display: flex; flex-direction: column; min-width: 0; }
.map-heading { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; flex-wrap: wrap; gap: 12px; min-height: 38px; margin-bottom: 10px; }
.section-title { margin: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.map-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.small-button { min-height: 34px; padding: 6px 11px; font-size: 12px; }
#tower-view { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
#tower-view:hover { background: var(--accent-soft); border-color: var(--accent); }
.map-shell { position: relative; flex: 1; min-height: 0; isolation: isolate; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--field); }
#map { position: absolute; inset: 0; }
.pick-status { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 550; width: max-content; max-width: 85%; padding: 10px 13px; border: 1px solid var(--accent-border); border-radius: 7px; background: var(--surface-overlay); color: var(--accent); font-size: 12px; box-shadow: var(--shadow); }
.settings-card { min-width: 0; height: 100%; padding: 20px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); scrollbar-width: thin; scrollbar-color: #425468 transparent; }
.settings-subtitle { margin: 5px 0 17px; font-size: 12px; }
.tabs { position: sticky; z-index: 4; top: -20px; display: flex; gap: 2px; overflow-x: auto; padding: 9px 0 0; border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: thin; scrollbar-color: #425468 transparent; }
.tabs button { flex: 1 0 auto; min-height: 39px; padding: 8px 7px; border: 0; border-bottom: 2px solid transparent; border-radius: 5px 5px 0 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 550; white-space: nowrap; }
.tabs button[aria-selected=true] { border-bottom-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tabs button:hover:not(:disabled) { background: var(--surface-raised); color: var(--text); }
.tab-panel { padding-top: 6px; }
.section-sub { margin: 12px 0 16px; font-size: 12px; line-height: 1.65; }
.spaced { margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--border); color: var(--text); font-weight: 600; }
.settings-card label:has(> input[type=color]) { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.settings-card input[type=color] { flex: none; margin: 0; }
.pick-button { width: 100%; margin-top: 12px; border-style: dashed; background: transparent; color: var(--accent); font-size: 12px; font-weight: 550; }
.pick-button[aria-pressed=true] { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
.stat { margin: 0; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.stat-label { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.stat-value { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 13px; font-weight: 550; line-height: 1.6; }
.stat .hint { margin: 7px 0 0; }
.camera-card { margin: 18px 0; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--field); }
.camera-card h3 { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.camera-card label { font-size: 11px; }
.camera-card .remove-camera { margin-top: 16px; color: var(--danger); background: transparent; font-size: 11px; }

/* Calculations, notices, and dialogs */
.notice { margin: 14px 0; padding: 13px; border: 1px solid var(--accent-border); border-radius: 7px; background: var(--accent-soft); color: var(--text); font-size: 12px; line-height: 1.65; }
.notice.warning { border-color: #dfb57745; background: #dfb5770b; color: #e5c89e; }
.notice.error { border-color: #df859545; background: #df85950c; color: #f1b2be; }
.notice strong { font-weight: 650; }
.mini-table-wrap { margin: 12px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 7px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 11px; line-height: 1.5; }
.mini-table th, .mini-table td { padding: 9px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
.mini-table th { background: var(--surface-raised); color: var(--muted); font-weight: 600; }
.mini-table tbody tr:last-child td { border-bottom: 0; }
.mini-table td:last-child { font-variant-numeric: tabular-nums; }
details { margin: 14px 0; }
summary { padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--field); font-size: 12px; font-weight: 550; list-style: none; cursor: pointer; }
summary::before { content: "▸"; margin-right: 9px; color: var(--muted); }
details[open] > summary::before { content: "▾"; }
.detail-body { margin-top: 8px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--field); font-size: 11px; line-height: 1.7; }
.detail-body p:last-child { margin-bottom: 0; }
.detail-body code { white-space: normal; overflow-wrap: anywhere; color: var(--text); font: inherit; }
.calc-line { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 12px; }
.calc-line strong { text-align: right; }
.result-title { margin: 22px 0 10px; color: var(--accent); font-size: 14px; font-weight: 600; }
.airport-source a { color: var(--accent); text-underline-offset: 3px; }
dialog { width: 400px; max-width: calc(100% - 32px); padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px #0007; }
dialog::backdrop { background: #03080dbd; backdrop-filter: blur(3px); }
dialog h2 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
dialog p { color: var(--muted); font-variant-numeric: tabular-nums; }
.toast { position: fixed; z-index: 10000; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); font-size: 13px; }

@media (min-width: 1600px) {
  .siting-workspace { grid-template-columns: minmax(0, 1fr) 450px; gap: 24px; }
  .settings-card { padding: 24px; }
  .tabs { top: -24px; }
  .tabs button { font-size: 12px; }
}
@media (max-width: 1180px) {
  .launcher { padding: 36px 24px; }
  .home-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; }
  .launcher-card { padding: 22px; }
  .launcher-grid { grid-template-columns: minmax(0, 1fr); }
  .airport-preview { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; border-left: 0; border-top: 1px solid var(--border-soft); }
  .airport-preview > .kicker { grid-column: 1 / -1; }
  .airport-preview .airport-code { grid-row: 2 / 4; align-self: center; margin: 0; }
  .airport-preview h2 { margin: 0 0 4px; }
  .airport-preview .airport-details { grid-column: 1 / -1; }
  .module-description { display: none; }
  .siting-workspace { grid-template-columns: minmax(0, 1fr) 370px; gap: 16px; }
  .settings-card { padding: 16px; }
  .tabs { top: -16px; }
  .site-header { gap: 14px; }
}
@media (max-width: 900px) {
  .launcher-header { align-items: start; flex-direction: column; gap: 18px; }
  .home-layout { grid-template-columns: minmax(0, 1fr); }
  .home-sidebar { position: static; }
  .launcher.is-locked .home-layout { display: flex; flex-direction: column; }
  .launcher.is-locked .home-sidebar { order: -1; width: 100%; }
  .launcher.is-locked .home-primary { width: 100%; }
  .launcher-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .airport-preview { display: flex; border-top: 0; border-left: 1px solid var(--border-soft); }
  .airport-preview .airport-code { align-self: start; margin: 8px 0 10px; }
  .airport-preview .airport-details { margin-top: 20px; }
  .siting-page { padding: 12px 16px 20px; }
  .site-header { flex-wrap: wrap; gap: 10px; }
  #preset-toolbar { order: 3; flex-basis: 100%; margin-left: 0; padding-top: 10px; border-top: 1px solid var(--border-soft); }
  .site-header .pill-button { margin-left: auto; }
  .siting-workspace { height: calc(100dvh - 230px); grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; }
  .pb-hero .muted { max-width: 55%; font-size: 11px; }
}
@media (max-width: 760px) {
  .launcher { padding: 28px 16px; }
  .launcher-header { margin-bottom: 24px; }
  .launcher-header h1 { font-size: 28px; }
  .launcher-heading > p:last-child { font-size: 13px; }
  .home-layout { gap: 20px; }
  .launcher-grid { grid-template-columns: minmax(0, 1fr); }
  .launcher-card { padding: 22px; }
  .airport-preview { display: grid; grid-template-columns: auto minmax(0, 1fr); border-top: 1px solid var(--border-soft); border-left: 0; }
  .airport-preview .airport-code { align-self: center; margin: 0; font-size: 34px; }
  .airport-preview h2 { font-size: 16px; }
  .airport-details { margin-top: 16px; }
  .siting-page { padding: 10px 12px 24px; }
  .site-header { padding: 12px; gap: 12px; }
  .site-brand { gap: 8px; }
  .workspace-label { font-size: 13px; }
  #active-airport { font-size: 10px; }
  .pill-button { min-height: 32px; padding: 6px 9px; font-size: 11px; }
  .pb-hero { display: block; padding: 21px 1px 18px; }
  .pb-hero h1 { font-size: 22px; }
  .pb-hero .muted { max-width: none; margin-top: 5px; text-align: left; }
  .siting-workspace { height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .map-shell { flex: none; height: 56dvh; min-height: 340px; }
  .settings-card { height: auto; min-height: 440px; padding: 18px; overflow: visible; }
  .tabs { top: 0; }
  .map-caption { font-size: 10px; }
}
@media (max-width: 400px) {
  .launcher { padding: 24px 12px; }
  .launcher-card { padding: 18px; }
  .site-brand { gap: 6px; }
  .workspace-label { font-size: 12px; }
  .site-header { padding: 10px; gap: 9px; }
  .site-header .pill-button { font-size: 10px; padding: 6px 7px; }
  .map-heading { gap: 8px; }
  .map-actions { gap: 5px; }
  .map-actions .small-button { padding: 6px 8px; font-size: 11px; }
  .settings-card { padding: 16px; }
  .tabs button { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
