:root {
  --bg: #0f1218;
  --surface: #1a1f2a;
  --surface-2: #222836;
  --card: #1a1f2a;
  --line: #2c3444;
  --line-soft: rgba(255, 255, 255, 0.08);
  --ink: #e8edf5;
  --muted: #9aa6b8;
  --brand: #1c1f24;
  --brand-2: #12141a;
  --accent: #b8ad86;
  --accent-soft: #3a372c;
  --gold: #b8ad86;
  --gold-2: #9a916e;
  --gold-dim: rgba(184, 173, 134, 0.14);
  --ok: #3ecf8e;
  --warn: #e0a04a;
  --bad: #f07167;
  --info: #6cb6e0;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
  scroll-padding-top: 8.5rem;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0.01em;
}
[hidden] {
  display: none !important;
}
body {
  background-attachment: fixed;
}
a { color: var(--info); text-decoration: none; }
button { font-family: inherit; }

.wrap {
  width: min(1280px, calc(100% - 2.2rem));
  margin: 0 auto;
  max-width: 100%;
  min-width: 0;
}

.shell-header {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-right: clamp(10px, 3vw, 16px);
  padding-bottom: 6px;
  padding-left: clamp(10px, 3vw, 16px);
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #fff;
  text-align: center;
  overflow: hidden;
}
.shell-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("photos/header-bg.png") center 38% / cover no-repeat;
  opacity: 0.05;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 100%);
}
.shell-header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 1;
}
.shell-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: min(100%, 40rem);
  min-width: 0;
  gap: 8px;
  padding: 0;
  margin: 0 auto;
  text-align: center;
}
.shell-brand > div {
  width: 100%;
  text-align: center;
}
.shell-logo {
  height: 148px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}
.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}
.shell-brand-dept {
  margin: 0;
  max-width: 100%;
  color: #cbd5e1;
  font-size: clamp(0.78rem, 2.6vw, 1rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.shell-brand-title {
  margin: 0;
  max-width: 100%;
  font-size: clamp(1.22rem, 5vw, 1.72rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.01em;
}
.kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.shell-header-ranges {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.15rem;
  padding: 16px clamp(10px, 3vw, 16px) 12px;
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  border-bottom: 2px solid var(--accent);
}
.jump {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.1rem;
  width: 100%;
  max-width: 52rem;
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.jump::-webkit-scrollbar { display: none; }
.jump a {
  flex: 0 0 auto;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border-radius: 8px;
  white-space: nowrap;
}
.jump a:hover,
.jump a:focus-visible {
  color: var(--gold);
  outline: none;
}
.jump a.is-on {
  color: var(--gold);
  background: var(--accent-soft);
}
.logout-btn {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 60;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(18, 20, 26, 0.88);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 650;
  min-height: 2.15rem;
  cursor: pointer;
  white-space: nowrap;
}
.logout-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.logout-btn.is-scrolled {
  display: none;
}
body:has(.gate.is-open) .shell-header,
body:has(.gate.is-open) .shell-header-ranges,
body:has(.gate.is-open) .logout-btn,
body:has(.gate.is-open) #appMain,
body:has(.gate.is-open) .photo-editor {
  display: none !important;
}
body:not(.is-brief-edit) .export-btn,
body:not(.is-brief-edit) .photo-edit-btn {
  display: none !important;
}
body:has(.gate.is-open) {
  overflow: hidden;
}
.stamp {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.ranges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.18rem;
}
.ranges button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
}
.ranges button.is-on {
  background: var(--accent-soft);
  color: var(--accent);
}

.hero {
  padding: 1.4rem 0 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
#appMain {
  zoom: 0.9;
}
#sec-calls,
#sec-pilots,
#sec-training,
#sec-coverage,
#sec-airspace {
  margin-top: 0.95rem;
}
.photo-show {
  position: relative;
  width: 100%;
  height: 14.5rem;
  overflow: hidden;
  background: #0a0c10;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.photo-show-slides {
  position: absolute;
  inset: 0;
}
.photo-show img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
}
.photo-show img.is-on {
  opacity: 1;
}
.photo-edit-btn {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(18, 20, 26, 0.82);
  color: var(--gold);
  border-radius: 8px;
  padding: 0.32rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.photo-edit-btn:hover {
  border-color: var(--gold);
  background: var(--accent-soft);
}
.photo-editor {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(8, 10, 14, 0.72);
}
.photo-editor[hidden] {
  display: none !important;
}
.photo-editor-card {
  width: min(920px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1.15rem;
}
.photo-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.photo-editor-head h2 {
  margin: 0;
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.photo-editor-hint {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.photo-focus-stage {
  position: relative;
  width: 100%;
  height: 16rem;
  margin-bottom: 0.85rem;
  overflow: hidden;
  border-radius: 10px;
  background: #0a0c10;
  cursor: crosshair;
}
.photo-focus-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.photo-focus-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.photo-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.65rem;
}
.photo-tile {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.photo-tile.is-on {
  border-color: var(--gold);
}
.photo-tile img {
  width: 100%;
  height: 5.4rem;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.photo-tile-bar {
  display: flex;
  gap: 0.2rem;
  padding: 0.28rem;
}
.photo-tile-bar button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  min-height: 1.7rem;
  cursor: pointer;
}
.photo-tile-bar button:hover {
  color: var(--gold);
}
.photo-tile-bar .is-remove:hover {
  color: var(--bad);
}
.photo-editor-actions {
  margin-top: 0.95rem;
}
.photo-editor-actions .gate-btn {
  width: auto;
  min-width: 10rem;
  margin-top: 0;
  padding: 0.55rem 0.95rem;
}
.live-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.live-chip {
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  min-height: 64px;
}
.live-chip .l {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.live-chip .v {
  margin-top: 0.2rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.live-chip.is-ok .v { color: var(--ok); }
.live-chip.is-warn .v { color: var(--warn); }
.live-chip.is-bad .v { color: var(--bad); }

.now-line {
  color: var(--muted);
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
}
.card-take {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
  line-height: 1.4;
}
.card-head {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin: 0;
}
.card-head > h2,
.card-head > div:not(.card-filters) > h2 {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
  line-height: 1.2;
  padding-top: 0.08rem;
}
.card-head > .card-filters,
.card-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-left: auto;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
  flex: 0 1 auto;
}
.filter-field > span {
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.2;
}
.filter-field select,
.filter-field input[type="date"],
.filter-select {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.38rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 650;
  min-height: 2.15rem;
  min-width: 9.5rem;
  max-width: 16rem;
  width: max-content;
}
.filter-field select:focus,
.filter-field input[type="date"]:focus,
.filter-select:focus {
  outline: 0;
  border-color: var(--accent);
}
.card-head > div:not(.card-filters) {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.kpis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.kpis-head > h2 {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 750;
  line-height: 1.2;
  padding-top: 0.08rem;
}
.export-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.38rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 650;
  min-height: 2.15rem;
  cursor: pointer;
  white-space: nowrap;
}
.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin: 0;
}
.kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.75rem 0.65rem;
  box-shadow: var(--shadow);
  min-height: 4.75rem;
  height: 4.75rem;
}
.kpi .l {
  color: var(--gold);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 650;
  line-height: 1.2;
}
.kpi .n {
  font-size: 1.55rem;
  font-weight: 750;
  margin-top: 0.18rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.kpi .s {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
}

.grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1.15rem;
  margin-bottom: 0;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 1.15rem;
  margin-bottom: 0;
}
.card {
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.05rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card h2 {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 750;
}
.card canvas {
  width: 100%;
  height: 240px;
  display: block;
}
#pilotChart {
  height: auto;
  min-height: 200px;
}
.chart-wide {
  margin-bottom: 0;
}
.chart-wide canvas {
  height: 340px;
  cursor: crosshair;
}
.card .chart-frame canvas {
  cursor: crosshair;
}
.chart-frame {
  position: relative;
  overflow: visible;
}
.chart-frame canvas {
  display: block;
  overflow: visible;
}
.chart-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.card > .chart-block + .split,
.card > .chart-block + .table-scroll,
.card > .chart-block + .train-split,
.card > .chart-block + .grid-2 {
  margin-top: 0.55rem;
}
.busy-banner {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--ink);
  margin: 0 0 0.75rem;
}
.chart-tip {
  position: absolute;
  z-index: 4;
  min-width: 160px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.7rem 0.5rem;
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 0.82rem;
}
.chart-tip .t {
  color: var(--gold);
  font-weight: 750;
  margin-bottom: 0.28rem;
}
.chart-tip .r {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.08rem 0;
  align-items: center;
}
.chart-tip .r span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.chart-tip .dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  flex: 0 0 auto;
}
.chart-hint {
  color: var(--muted);
  font-size: 0.72rem;
  margin: 0.45rem 0 0;
}
.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.sw {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 99px;
  margin-right: 0.35rem;
}

.bar-row, .rank-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.9rem;
}
.bar-row:last-child, .rank-row:last-child { border-bottom: 0; }
.rank {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.78rem;
}
.bar-track {
  height: 7px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  margin-top: 0.28rem;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
}
.muted { color: var(--muted); }
.tiny { font-size: 0.75rem; color: var(--muted); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
th {
  text-align: left;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 650;
  padding: 0.45rem 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
th.is-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.is-sortable:hover,
th.is-sortable:focus-visible {
  color: var(--gold);
  outline: none;
}
th.is-sortable::after {
  content: "\2195";
  display: inline-block;
  margin-left: 0.28em;
  font-size: 0.78em;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.28;
  vertical-align: 0.05em;
}
th.is-sortable[aria-sort="ascending"]::after {
  content: "\25B2";
  opacity: 1;
  color: var(--gold);
}
th.is-sortable[aria-sort="descending"]::after {
  content: "\25BC";
  opacity: 1;
  color: var(--gold);
}
td {
  padding: 0.42rem 0.55rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
tr.is-gap td {
  color: var(--warn);
}
.cover-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}
.cover-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.cover-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  display: inline-block;
}
.cover-swatch.is-out { background: #b8ad86; }
.cover-swatch.is-shift { background: #9aa6b8; }
.cover-swatch.is-gap { background: #c45c54; }
.cover-swatch.is-thin { background: #e0a04a; }
.cover-swatch.is-partial { background: #4f8f72; }
.cover-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.cover-heat-block {
  margin-top: 1.35rem;
  margin-bottom: 1.6rem;
}
.airspace-stack {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.air-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
.air-kpis > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}
.air-kpis .l {
  color: var(--gold);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}
.air-kpis .n {
  margin-top: 0.2rem;
  font-size: 1.28rem;
  font-weight: 750;
}
.air-note {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.cover-heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.cover-heat {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}
.cover-heat th, .cover-heat td {
  padding: 0.55rem 0.35rem;
  text-align: center;
  border: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 700;
}
.cover-heat th {
  background: transparent;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 650;
}
.cover-heat td {
  height: 2.6rem;
  color: #f3f4f6;
}
.cover-heat td.is-hot { color: #14161c; }
.cover-heat td.is-empty { background: transparent; border-color: transparent; }
.table-scroll {
  max-height: 22rem;
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(0,0,0,0.12);
  flex: 1;
  min-height: 0;
}
.table-scroll-sm { max-height: 16.5rem; }
#coverTable { max-height: 22rem; }
#coverTable thead th,
#flightTable thead th,
#airDetectTable thead th,
#airSmhTable thead th,
#airSafetyTable thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
}
#flightTable,
#airDetectTable,
#airSmhTable,
#airSafetyTable {
  max-height: 18rem;
}
.table-fit {
  max-height: none;
  overflow: hidden;
}
#callTypes {
  padding: 0.15rem 0.65rem 0.35rem;
}
#callTypes .rank-row:first-child { padding-top: 0.45rem; }
#callTypes .rank-row:last-child { padding-bottom: 0.4rem; }
.table-scroll table { margin: 0; }
.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--line);
}
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 99px;
}
.split {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.55fr);
  gap: 1rem;
  margin: 0;
  align-items: stretch;
}
.split-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.split-col > .subhead,
.split-col > .list-meta {
  flex: 0 0 2.15rem;
  display: flex;
  align-items: center;
}
.split-col > .scroll-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
.split-col > .scroll-wrap > .table-scroll {
  height: auto;
  max-height: none;
}
.scroll-wrap {
  position: relative;
  min-width: 0;
}
.scroll-more {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  z-index: 3;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 750;
  color: var(--gold);
  padding: 1.55rem 0.5rem 0.4rem;
  background: linear-gradient(to top, var(--card) 48%, transparent);
  pointer-events: none;
  border-radius: 0 0 11px 11px;
}
.train-split > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  min-height: 0;
}
.train-split .scroll-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.train-split #ready {
  flex: 0 0 auto;
}
.train-split #trainSessions {
  flex: 1 1 auto;
  height: 100%;
  max-height: none;
}
.subhead {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 750;
}
.list-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  min-height: 2.15rem;
}
.list-meta .subhead {
  margin: 0;
  white-space: nowrap;
}
.filter-input {
  margin-left: auto;
  width: 220px;
  max-width: 46%;
  height: 2.15rem;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 0.7rem;
  font-size: 0.84rem;
}
.filter-input:focus {
  outline: 0;
  border-color: var(--gold);
}
.train-split { margin: 0; }
tr:last-child td { border-bottom: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pill {
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
}
.pill b { color: var(--gold); font-weight: 700; }

.footer {
  padding: 1.6rem 0 2.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.gate {
  display: none;
  place-items: center;
  width: 100%;
  min-height: 100svh;
  margin: 0;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.gate.is-open {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  min-height: 100svh;
  background: var(--bg);
}
body:has(.gate.is-open) .footer {
  display: none;
}
.gate-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem 1.35rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-logo {
  display: block;
  height: 88px;
  width: auto;
  margin: 0 auto 0.85rem;
  object-fit: contain;
}
.gate-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
  line-height: 1.25;
}
.gate-copy { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.gate-label {
  display: block;
  margin: 0.95rem 0 0.28rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  text-align: left;
}
.gate-card select, .gate-card input {
  width: 100%;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
}
.gate-btn {
  margin-top: 1.1rem;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--brand);
  font-weight: 800;
  padding: 0.78rem;
  cursor: pointer;
}
.gate-err { color: var(--bad); font-size: 0.85rem; margin: 0.6rem 0 0; }

.impact-hero {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.25rem 1.35rem 1.15rem;
  margin-bottom: 1rem;
}
.impact-hero p {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.45;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.impact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
}
.outcome {
  background: var(--gold-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  font-size: 0.82rem;
}
.outcome b { color: var(--gold); }
.delta {
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 0.35rem;
}
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }

.event {
  border-top: 1px solid var(--line-soft);
  padding: 0.85rem 0 0.15rem;
}
.event:first-child { border-top: 0; padding-top: 0; }
.event-when {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.event-title {
  margin: 0.2rem 0 0.25rem;
  font-weight: 700;
}
.event-meta, .event-line {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.75rem 0.7rem;
}

@media (max-width: 1080px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .live-row, .grid, .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .wrap { width: min(100% - 1.2rem, 1280px); }
  .hero { padding: 0.9rem 0 1.4rem; gap: 0.9rem; }
  #sec-calls,
  #sec-pilots,
  #sec-training,
  #sec-coverage,
  #sec-airspace {
    margin-top: 0.7rem;
  }
  .shell-header {
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-right: 10px;
    padding-bottom: 4px;
    padding-left: 10px;
  }
  .shell-brand { gap: 6px; }
  .shell-logo { height: 84px; }
  .shell-brand-dept { font-size: clamp(0.7rem, 3.1vw, 0.84rem); }
  .shell-brand-title { font-size: clamp(1.05rem, 5vw, 1.28rem); }
  .shell-header-ranges {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .ranges { width: 100%; }
  .ranges button { flex: 1 1 auto; min-height: 2.4rem; }
  .shell-header-ranges { gap: 0.95rem; }
  .jump { justify-content: flex-start; margin: 0; }
  .logout-btn { min-height: 2.4rem; }
  .photo-show { height: 8.5rem; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .live-row, .grid, .grid-2, .grid-3, .split { grid-template-columns: 1fr; }
  .card { padding: 0.9rem 0.85rem 0.85rem; }
  .card-head {
    flex-direction: column;
    align-items: stretch;
  }
  .card-head > .card-filters,
  .card-filters {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex-wrap: wrap;
  }
  .filter-field select,
  .filter-field input[type="date"],
  .filter-select {
    width: 100%;
    min-width: 0;
    max-width: none;
    font-size: 16px;
    min-height: 2.5rem;
  }
  .export-btn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 2.5rem;
  }
  .filter-input { font-size: 16px; min-height: 2.5rem; }
  .gate-logo { height: 76px; }
  .gate-card {
    width: min(400px, calc(100% - 8px));
    padding: 1.35rem 1.15rem 1.2rem;
  }
  .gate-card input { font-size: 16px; min-height: 2.7rem; }
  .card, .split-col, .chart-block, .chart-frame, .scroll-wrap {
    min-width: 0;
    max-width: 100%;
  }
  .card canvas {
    max-width: 100%;
  }
  .table-scroll,
  .table-fit {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-fit { max-height: 22rem; overflow: auto; }
  .table-scroll table,
  .table-fit table {
    width: max(100%, 36rem);
  }
  th, td {
    padding: 0.4rem 0.4rem;
    white-space: nowrap;
  }
}
@media (max-width: 480px) {
  .shell-logo { height: 72px; }
  .kpis { gap: 0.55rem; }
  .kpi .n { font-size: 1.15rem; }
}

@media print {
  #appMain { zoom: 1; }
  :root { --bg: #fff; --card: #fff; --ink: #111; --muted: #444; --gold: #8a7010; }
  body { background: #fff; color: #111; }
  .shell-header, .shell-header-ranges { position: static; background: #fff; color: #111; }
  .shell-header-ranges { border-bottom-color: var(--gold); }
  .ranges, .jump, .footer, .photo-show, .export-btn, .logout-btn, .photo-editor { display: none; }
  th.is-sortable::after { display: none; }
  .card, .kpi, .live-chip { box-shadow: none; border-color: #ddd; background: #fff; }
}
