:root {
  --bg: #06110d;
  --panel: #0d1b17;
  --panel-2: #14261f;
  --line: #2a4338;
  --text: #f2fbf7;
  --muted: #91aca0;
  --blue: #4cc3b0;
  --green: #00ff55;
  --yellow: #fff200;
  --red: #ff1f1f;
  --red-dark: #8f0000;
  --ink: #05100c;
  --fleet-row-height: 100px;
  --visible-fleet-rows: 3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, #06110d 0%, #0b1e18 54%, #030806 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  overflow: hidden;
}

button, input { font: inherit; }

.appShell {
  height: 100vh;
  min-height: 0;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.topBar {
  height: 154px;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(190px, auto) minmax(250px, auto);
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  background: #0a1713;
  padding: 16px 18px;
}

.brandBlock {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brandLogo {
  width: auto;
  height: 154px;
  max-height: 154px;
  margin-block: -16px;
  object-fit: contain;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin: 0; }

h1 {
  margin-top: 2px;
  font-size: clamp(34px, 4vw, 62px);
  line-height: .95;
}

.syncBlock {
  text-align: right;
  display: grid;
  gap: 6px;
}

.clock {
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1;
  font-weight: 850;
}

.syncStatus {
  color: var(--muted);
  font-weight: 700;
  max-width: 760px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weatherBlock {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 6px;
  justify-self: stretch;
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.weatherLabel {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.weatherMain {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weatherMain strong {
  font-size: 34px;
  line-height: 1;
}

.weatherMain span {
  color: var(--ink);
  background: var(--green);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.weatherMeta {
  color: var(--muted);
  font-weight: 750;
}

.weatherMeta.ok {
  color: var(--green);
}

.weatherMeta.warning {
  color: var(--yellow);
}

.weatherMeta.danger {
  color: var(--red);
}

.dashboardGrid {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, .85fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
}

.summaryBand {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 106px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0f211b 0%, var(--panel) 100%);
  padding: 18px;
}

.metricLabel {
  color: var(--muted);
  font-size: 15px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .12em;
}

.metric strong {
  font-size: clamp(38px, 3.6vw, 58px);
  line-height: 1;
}

.metric.warning strong { color: var(--yellow); }
.metric.danger {
  border-color: rgba(255, 31, 31, .78);
  box-shadow: 0 0 22px rgba(255, 31, 31, .18);
  animation: expiredFlashPanel 1s steps(2, end) infinite;
}

.metric.danger strong { color: #fff; }

.toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.searchWrap {
  min-width: min(460px, 100%);
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0 14px;
}

.searchWrap span {
  color: var(--muted);
  font-size: 22px;
}

.searchWrap input {
  width: 100%;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.segmented {
  height: 46px;
  display: flex;
  border: 1px solid var(--line);
  background: var(--panel);
}

.segmented button {
  color: var(--muted);
  min-width: 104px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.segmented button:last-child { border-right: 0; }
.segmented button.active { color: var(--ink); background: var(--blue); }

.fleetPanel, .detailPanel {
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.fleetPanel {
  grid-column: 1;
  grid-row: 3;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panelHeader {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panelHeader h2, .detailContent h2 {
  font-size: 36px;
  line-height: 1.1;
}

.panelHeader p, .aircraftHero p {
  color: var(--muted);
  margin-top: 4px;
}

.iconButton {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 24px;
}

.tableHeader, .fleetRow {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) .65fr .65fr minmax(210px, 1.4fr) .72fr;
  gap: 12px;
  align-items: center;
}

.tableHeader {
  color: var(--muted);
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.fleetRows {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  cursor: default;
  touch-action: none;
  user-select: none;
}

.fleetRows:active {
  cursor: default;
}

.fleetTrack {
  height: 100%;
  min-height: 0;
  display: grid;
  will-change: transform;
}

.fleetTrackSet {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: repeat(var(--visible-fleet-rows), minmax(56px, 1fr));
}

.fleetRows[data-scroll-enabled="false"] .fleetTrack,
.fleetRows[data-scroll-enabled="false"] .fleetTrackSet {
  height: 100%;
  min-height: 0;
}

.fleetRows[data-scroll-enabled="false"] .fleetTrackSet {
  grid-template-rows: repeat(var(--visible-fleet-rows), minmax(0, 1fr));
}

.fleetRow {
  width: 100%;
  height: auto;
  min-height: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  padding: 8px 18px;
  text-align: left;
  cursor: pointer;
}

.fleetRow:hover, .fleetRow.active { background: #173128; }

.tail {
  display: grid;
  gap: 4px;
}

.tail strong { font-size: 23px; }
.tail span, .cellMuted { color: var(--muted); }

.nextItem {
  display: grid;
  gap: 3px;
}

.statusPill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-expired {
  color: #fff;
  background: var(--red);
  animation: expiredFlash 1s steps(2, end) infinite;
}
.status-due-soon { background: var(--yellow); }
.status-ok { background: var(--green); }
.status-unknown { background: #7f919a; }

@keyframes expiredFlash {
  0%, 100% {
    background: var(--red);
    box-shadow: 0 0 0 rgba(255, 31, 31, 0);
  }

  50% {
    background: #ff0000;
    box-shadow: 0 0 18px rgba(255, 31, 31, .92);
  }
}

@keyframes expiredFlashPanel {
  0%, 100% {
    background: linear-gradient(180deg, #310e0e 0%, #180909 100%);
  }

  50% {
    background: linear-gradient(180deg, #ff1f1f 0%, var(--red-dark) 100%);
  }
}

.detailPanel {
  grid-column: 2;
  grid-row: 3;
  padding: 18px;
  overflow: auto;
}

.detailEmpty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 30px;
  font-weight: 700;
}

.hidden { display: none !important; }

.detailContent {
  display: grid;
  gap: 18px;
}

.aircraftHero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.hoursStack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.hoursStack div, .detailStats div {
  min-width: 92px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 12px;
}

.hoursStack span, .detailStats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.hoursStack strong, .detailStats strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.detailStats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detailContent h3 {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
}

.reminderList {
  display: grid;
  gap: 10px;
}

.reminder {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.reminderTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.reminderTitle {
  font-size: 21px;
  font-weight: 850;
}

.reminderMeta {
  color: var(--muted);
  font-weight: 700;
  font-size: 16px;
}

.emptyRows {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .dashboardGrid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(280px, 1fr) minmax(190px, .75fr);
  }

  .fleetPanel {
    grid-column: 1;
    grid-row: 3;
  }

  .detailPanel {
    grid-column: 1;
    grid-row: 4;
    min-height: 0;
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .appShell {
    height: auto;
    min-height: 100vh;
    padding: 10px;
    gap: 10px;
  }

  .topBar, .toolbar, .aircraftHero {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .topBar {
    height: auto;
    gap: 12px;
    padding: 12px;
  }

  .brandBlock {
    justify-content: center;
    gap: 12px;
  }

  .brandLogo {
    height: 92px;
    max-height: 92px;
    margin-block: 0;
  }

  h1 {
    font-size: clamp(32px, 11vw, 46px);
  }

  .syncBlock { text-align: left; }
  .weatherBlock { border-left: 0; border-top: 1px solid var(--line); padding: 14px 0 0; }
  .dashboardGrid {
    grid-template-rows: auto auto auto auto;
    gap: 10px;
  }

  .summaryBand { grid-template-columns: 1fr; }
  .metric { min-height: 86px; padding: 14px; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { min-width: 92px; }

  .tableHeader { display: none; }

  .fleetPanel {
    grid-template-rows: auto minmax(0, auto);
  }

  .fleetRows {
    height: auto;
    max-height: none;
    overflow: visible;
    cursor: auto;
    touch-action: auto;
    user-select: auto;
  }

  .fleetTrack {
    transform: none !important;
  }

  .fleetRow {
    grid-template-columns: 1fr 1fr;
    height: auto;
    min-height: 112px;
    padding: 14px;
    gap: 8px 12px;
  }

  .fleetRow > :nth-child(4),
  .fleetRow > :nth-child(5) {
    grid-column: 1 / -1;
  }

  .tail strong {
    font-size: 24px;
  }

  .detailPanel {
    max-height: none;
    overflow: visible;
    padding: 14px;
  }

  .hoursStack,
  .detailStats {
    grid-template-columns: 1fr;
  }

  .reminderTop {
    display: grid;
  }
}
