:root {
  --bg: #07100f;
  --panel: #0d1917;
  --panel-2: #132420;
  --line: #28423b;
  --text: #f5fbf8;
  --muted: #9bb4ad;
  --green: #27f28a;
  --cyan: #52d1c3;
  --yellow: #fff164;
  --avgas-blue: #1e7bff;
  --mogas-orange: #ff7a1a;
  --ink: #04110d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(135deg, #06100e 0%, #10211d 58%, #030807 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

.appSplash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 42%, rgba(82, 209, 195, .18) 0%, rgba(82, 209, 195, 0) 38%),
    linear-gradient(180deg, #07100f 0%, #020605 100%);
  transition: opacity .55s ease, visibility .55s ease;
}

.appSplash::before,
.appSplash::after {
  content: "";
  position: absolute;
  inset: auto 12% 16%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(82, 209, 195, .55), transparent);
  opacity: .55;
  transform: scaleX(.2);
  animation: launchSweep 1.4s ease forwards;
}

.appSplash::after {
  inset: auto 23% 19%;
  animation-delay: .18s;
  opacity: .32;
}

.appSplash.done {
  opacity: 0;
  visibility: hidden;
}

.splashMark {
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translateY(8px);
  animation: splashLift 1.45s cubic-bezier(.2, .9, .18, 1) forwards;
}

.launchIcon {
  width: min(70vw, 280px);
  height: auto;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 28px 52px rgba(0, 0, 0, .38));
  transform-origin: 50% 50%;
  animation:
    launchIconFrame 1.45s cubic-bezier(.2, .9, .18, 1) forwards,
    logoFadeZoom 4.4s cubic-bezier(.2, .82, .16, 1) forwards;
}

.launchIcon img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.splashTitle {
  margin-top: 4px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: 0;
  animation: splashText .7s ease .35s forwards;
}

.silhouetteShowcase {
  position: relative;
  width: min(88vw, 390px);
  aspect-ratio: 16 / 9;
  margin-top: 8px;
  opacity: 0;
  animation:
    splashText .7s ease .52s forwards,
    silhouetteFloat 1.9s ease-in-out 1.15s infinite,
    silhouetteExit 4.4s ease forwards;
}

.silhouetteShowcase::before {
  content: "";
  position: absolute;
  inset: 12% 2%;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(0, 194, 255, .17) 0%, rgba(0, 194, 255, .06) 34%, transparent 70%);
  filter: blur(8px);
  opacity: .75;
}

.silhouettePlane {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 0 7px rgba(0, 194, 255, .76))
    drop-shadow(0 0 18px rgba(0, 194, 255, .36))
    drop-shadow(0 12px 24px rgba(0, 0, 0, .28));
  opacity: 0;
  transform: scale(.985);
  animation: silhouetteCycle 4.4s ease-in-out forwards;
}

.planeTwo {
  animation-delay: .52s;
}

.planeThree {
  animation-delay: 1.04s;
}

.planeFour {
  animation-delay: 1.56s;
}

.planeFive {
  animation-delay: 2.08s;
}

@keyframes silhouetteFloat {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes silhouetteCycle {
  0% {
    opacity: 0;
    transform: scale(.988);
  }

  4% {
    opacity: 0;
    transform: scale(.99);
  }

  8% {
    opacity: 1;
    transform: scale(1);
  }

  12% {
    opacity: 1;
    transform: scale(1.002);
  }

  17% {
    opacity: 0;
    transform: scale(1.006);
  }

  100% {
    opacity: 0;
    transform: scale(1.006);
  }
}

@keyframes silhouetteExit {
  0%, 68% {
    opacity: 1;
  }

  78%, 100% {
    opacity: 0;
  }
}

@keyframes launchIconFrame {
  0% {
    opacity: 0;
    transform: scale(.88);
  }

  55% {
    opacity: 1;
    transform: scale(1.02);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes logoFadeZoom {
  66% {
    opacity: 1;
    transform: scale(1);
    filter:
      drop-shadow(0 28px 52px rgba(0, 0, 0, .38))
      drop-shadow(0 0 0 rgba(82, 209, 195, 0));
  }

  73% {
    opacity: 1;
    transform: scale(1.08);
    filter:
      drop-shadow(0 28px 52px rgba(0, 0, 0, .38))
      drop-shadow(0 0 18px rgba(82, 209, 195, .55));
  }

  86% {
    opacity: .78;
    transform: scale(2.35);
    filter:
      drop-shadow(0 0 18px rgba(82, 209, 195, .78))
      drop-shadow(0 0 46px rgba(0, 194, 255, .48));
  }

  100% {
    opacity: 0;
    transform: scale(4.6);
    filter:
      drop-shadow(0 0 26px rgba(255, 241, 100, .38))
      drop-shadow(0 0 72px rgba(0, 194, 255, .58));
  }
}

@keyframes splashText {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes splashLift {
  to {
    transform: translateY(0);
  }
}

@keyframes launchSweep {
  0% {
    transform: scaleX(.12);
    opacity: 0;
  }

  28% {
    opacity: .7;
  }

  100% {
    transform: scaleX(1);
    opacity: .34;
  }
}

button,
input,
select {
  font: inherit;
}

.appShell {
  min-height: 100vh;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  animation: appEnter .65s ease .35s both;
}

@keyframes appEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topBar {
  display: grid;
  grid-template-columns: minmax(108px, auto) minmax(300px, 1fr) minmax(500px, auto) minmax(190px, auto);
  gap: 18px;
  align-items: center;
  min-height: 146px;
  border: 1px solid var(--line);
  background: #0a1714;
  padding: 14px 18px;
}

.languageControl {
  align-self: end;
}

.languageControl select {
  min-width: 118px;
  height: 40px;
  border-color: rgba(82, 209, 195, .45);
}

.brandBlock {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brandLogo {
  width: auto;
  height: 142px;
  max-height: 142px;
  margin-block: -14px;
  object-fit: contain;
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
}

h1 {
  margin-top: 4px;
  font-size: clamp(34px, 4vw, 62px);
}

h2 {
  font-size: clamp(22px, 2vw, 34px);
}

.controlPanel {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, .75fr) minmax(130px, .75fr) auto auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23f5fbf8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center / 22px 22px no-repeat,
    var(--panel-2);
  padding-right: 46px;
  font-weight: 850;
  font-size: 16px;
}

select::-ms-expand {
  display: none;
}

input,
select {
  display: block;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  color: var(--text);
  background-color: var(--panel-2);
  padding: 0 12px;
  outline: 0;
}

select {
  padding-right: 46px;
}

input:focus,
select:focus {
  border-color: var(--cyan);
}

button {
  height: 44px;
  border: 0;
  color: var(--ink);
  background: var(--cyan);
  padding: 0 18px;
  cursor: pointer;
  font-weight: 900;
}

.connectButton {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--green);
  padding: 0 16px;
  text-decoration: none;
  font-weight: 900;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

.syncBlock {
  text-align: right;
  display: grid;
  gap: 8px;
}

.syncTimeLine {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 14px;
}

.activeRangeLabel {
  color: var(--cyan);
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .02em;
}

.clock {
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1;
  font-weight: 850;
}

.syncStatus {
  color: var(--muted);
  font-weight: 750;
  max-width: 320px;
}

.dashboardGrid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.summaryBand {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.mixPanel,
.fuelPanel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.metric {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.metric strong {
  font-size: clamp(42px, 4vw, 68px);
  line-height: 1;
}

.metric.accent {
  background: linear-gradient(180deg, #17251f 0%, #101d19 100%);
  border-color: rgba(255, 241, 100, .42);
}

.metric.accent strong,
.fuelTotal {
  color: var(--yellow);
}

.metric.accent.fuelStatusGreen {
  background: linear-gradient(180deg, rgba(39, 242, 138, .16) 0%, #101d19 100%);
  border-color: rgba(39, 242, 138, .58);
}

.metric.accent.fuelStatusGreen strong {
  color: var(--green);
}

.metric.accent.fuelStatusYellow {
  background: linear-gradient(180deg, rgba(255, 241, 100, .18) 0%, #101d19 100%);
  border-color: rgba(255, 241, 100, .62);
}

.metric.accent.fuelStatusYellow strong {
  color: var(--yellow);
}

.metric.accent.fuelStatusRed,
.metric.accent.fuelStatusFlash {
  background: linear-gradient(180deg, rgba(255, 71, 71, .2) 0%, #101514 100%);
  border-color: rgba(255, 71, 71, .72);
}

.metric.accent.fuelStatusRed strong,
.metric.accent.fuelStatusFlash strong {
  color: #ff5757;
}

.metric.accent.fuelStatusFlash {
  animation: fuelAlertPulse .82s ease-in-out infinite;
}

@keyframes fuelAlertPulse {
  0%, 100% {
    background: linear-gradient(180deg, rgba(255, 71, 71, .18) 0%, #101514 100%);
    border-color: rgba(255, 71, 71, .62);
    box-shadow: none;
  }

  50% {
    background: linear-gradient(180deg, rgba(255, 71, 71, .38) 0%, rgba(74, 12, 12, .88) 100%);
    border-color: rgba(255, 71, 71, 1);
    box-shadow: 0 0 0 2px rgba(255, 71, 71, .2), 0 0 30px rgba(255, 71, 71, .28);
  }
}

.fuelPanel,
.mixPanel {
  overflow: hidden;
}

.panelTitle {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.panelTitle span {
  color: var(--muted);
  font-weight: 800;
}

.mixPanel {
  background: linear-gradient(180deg, #101d19 0%, #0d1917 100%);
  border-color: rgba(82, 209, 195, .34);
}

.mixTitle {
  border-bottom-color: rgba(82, 209, 195, .28);
}

.mixBody {
  display: grid;
  grid-template-columns: minmax(180px, .55fr) minmax(0, 1.45fr);
  gap: 14px;
  align-items: end;
  padding: 18px;
}

.mixInput select {
  height: 56px;
  border-color: rgba(82, 209, 195, .45);
  font-size: 20px;
}

.mixResults {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mixResult {
  min-height: 104px;
  border: 1px solid var(--line);
  background: #091612;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
}

.mixResult.avgas,
.mixResult.mogas {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  align-content: center;
}

.fuelTypeLogo {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
}

.mixResult span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.mixResult strong {
  font-size: clamp(38px, 4vw, 58px);
  line-height: .95;
}

.mixResult em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mixResult.total {
  border-color: rgba(82, 209, 195, .45);
}

.mixResult.total strong {
  color: var(--cyan);
}

.mixResult.avgas {
  border-color: rgba(30, 123, 255, .62);
  background: linear-gradient(180deg, rgba(30, 123, 255, .14) 0%, #091612 100%);
}

.mixResult.avgas strong {
  color: var(--avgas-blue);
}

.mixResult.mogas {
  border-color: rgba(255, 122, 26, .66);
  background: linear-gradient(180deg, rgba(255, 122, 26, .14) 0%, #091612 100%);
}

.mixResult.mogas strong {
  color: var(--mogas-orange);
}

.tableHeader,
.aircraftRow,
.detailRow {
  display: grid;
  gap: 12px;
  align-items: center;
}

.tableHeader,
.aircraftRow {
  grid-template-columns: minmax(150px, 1.2fr) .55fr .75fr .8fr;
}

.detailHeader,
.detailRow {
  grid-template-columns: minmax(145px, .9fr) minmax(110px, .6fr) .45fr;
}

.tableHeader {
  color: var(--muted);
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.aircraftRow,
.detailRow {
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
  font-weight: 800;
}

.aircraftRow:nth-child(even) {
  background: rgba(255, 255, 255, .025);
}

.tail {
  display: grid;
  gap: 4px;
}

.tail strong {
  font-size: 24px;
}

.tail em {
  color: var(--muted);
  font-style: normal;
  font-size: 14px;
}

.emptyRows {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

@media (max-width: 1050px) {
  .topBar,
  .controlPanel,
  .summaryBand {
    grid-template-columns: 1fr;
  }

  .topBar {
    align-items: stretch;
  }

  .languageControl {
    max-width: 220px;
  }

  .syncBlock {
    text-align: left;
  }

  .syncStatus {
    max-width: none;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
    background: #07100f;
  }

  .appShell {
    padding: 10px 10px calc(18px + var(--safe-bottom));
    gap: 12px;
  }

  .topBar {
    min-height: 0;
    padding: 12px;
    gap: 12px;
    border-color: rgba(82, 209, 195, .34);
    background: #091612;
  }

  .brandBlock {
    justify-content: flex-start;
    gap: 10px;
  }

  .languageControl {
    max-width: none;
  }

  .languageControl select {
    height: 44px;
  }

  .brandLogo {
    height: 64px;
    max-height: 64px;
    margin-block: 0;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: .09em;
  }

  h1 {
    font-size: 31px;
  }

  h2 {
    font-size: 20px;
    line-height: 1.1;
  }

  .controlPanel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 8px;
  }

  .customRangeActive .controlPanel {
    grid-template-columns: 1fr;
  }

  .customRangeActive .customRange,
  .customRangeActive input[type="date"] {
    width: 100%;
    max-width: 100%;
  }

  label {
    font-size: 10px;
    letter-spacing: .08em;
  }

  input,
  select,
  button,
  .connectButton {
    height: 46px;
  }

  input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
    font-size: 16px;
    text-align: left;
  }

  select {
    background-size: 28px 28px;
    background-position: right 12px center;
    font-size: 18px;
    padding-right: 50px;
  }

  button,
  .connectButton {
    padding-inline: 14px;
  }

  #refreshButton {
    grid-column: 1 / -1;
  }

  .connectButton {
    grid-column: 1 / -1;
  }

  .syncBlock {
    display: grid;
    gap: 8px;
    min-width: 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }

  .clock {
    font-size: 22px;
    white-space: nowrap;
    text-align: right;
  }

  .syncTimeLine {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    min-width: 0;
  }

  .activeRangeLabel {
    min-width: 0;
    font-size: clamp(19px, 5.4vw, 23px);
    line-height: 1.12;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .syncStatus {
    min-width: 0;
    text-align: left;
    font-size: 12px;
    line-height: 1.25;
    max-width: none;
  }

  .dashboardGrid {
    gap: 12px;
  }

  .summaryBand {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric {
    min-height: 84px;
    padding: 12px;
    gap: 7px;
  }

  .metric.accent {
    grid-column: 1 / -1;
    min-height: 112px;
  }

  .metric span {
    font-size: 10px;
    letter-spacing: .08em;
  }

  .metric strong {
    font-size: 34px;
  }

  .metric.accent strong {
    font-size: clamp(44px, 14vw, 58px);
  }

  .mixBody {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .mixInput select {
    height: 52px;
    font-size: 19px;
  }

  .mixResults {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mixResult {
    min-height: 92px;
    padding: 10px;
  }

  .mixResult.avgas,
  .mixResult.mogas {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .fuelTypeLogo {
    width: 44px;
    height: 44px;
  }

  .mixResult span {
    font-size: 9px;
    letter-spacing: .07em;
  }

  .mixResult strong {
    font-size: clamp(31px, 11vw, 44px);
  }

  .mixResult em {
    font-size: 10px;
  }

  .panelTitle {
    min-height: 0;
    display: grid;
    gap: 6px;
    padding: 14px;
  }

  .panelTitle span {
    font-size: 12px;
    line-height: 1.3;
  }

  .tableHeader {
    display: none;
  }

  .aircraftRow,
  .detailRow {
    grid-template-columns: 1fr 1fr;
    gap: 12px 10px;
    min-height: 0;
    padding: 14px;
  }

  .aircraftRow span::before,
  .detailRow span::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  .aircraftRow .tail {
    grid-column: 1 / -1;
  }

  .aircraftRow .tail strong {
    font-size: 28px;
  }

  .aircraftRow .tail::before {
    content: "";
    display: none;
  }

  .aircraftRow span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .fuelTotal {
    font-size: 24px;
  }

  .emptyRows {
    padding: 22px 14px;
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  .summaryBand {
    grid-template-columns: 1fr;
  }

  .metric.accent {
    min-height: 104px;
  }

  .metric strong {
    font-size: 36px;
  }

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

  .mixResult {
    min-height: 84px;
  }

  .mixResult.avgas,
  .mixResult.mogas {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .fuelTypeLogo {
    width: 50px;
    height: 50px;
  }

  .aircraftRow,
  .detailRow {
    grid-template-columns: 1fr;
  }

  .fuelTotal {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .appSplash,
  .splashMark,
  .launchIcon,
  .silhouetteShowcase,
  .silhouettePlane,
  .splashTitle,
  .appShell,
  .metric.accent.fuelStatusFlash {
    animation: none !important;
    transition: none !important;
  }
}
