/* Final UI stabilization layer: keep operational content prominent and detail tools predictable. */

.flight-filters--details {
  margin: 18px 0 10px;
  border-left-color: #e3e8f0;
  border-right-color: #e3e8f0;
  background: #f8fafc;
  box-shadow: none;
}

.flight-reference-details {
  margin-top: 10px;
  padding: 0;
  overflow: clip;
  border: 1px solid rgba(225, 10, 70, 0.18);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
}

.flight-reference-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  list-style: none;
  color: #111827;
  cursor: pointer;
  font-weight: 950;
}

.flight-reference-details > summary::-webkit-details-marker { display: none; }

.flight-reference-details > summary::after {
  content: '+';
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #e10a46;
  color: #fff;
  line-height: 1;
}

.flight-reference-details[open] > summary::after { content: '–'; }

.flight-reference-details > summary span,
.flight-reference-details > summary small {
  display: block;
}

.flight-reference-details > summary small {
  margin-left: auto;
  color: var(--muted-dark);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.flight-reference-details #flight-table {
  padding: 0 12px 14px;
}

/* Use cards before the desktop reference table becomes wider than the viewport. */
.flight-reference-desktop { display: block; }
.flight-reference-cards { display: none; }

/* Healthy live state stays visible without pushing the Action Center down the page. */
.flight-data-status--live {
  margin: 8px 18px 4px;
  padding: 7px 10px;
  border-color: rgba(22, 163, 74, .22);
  background: rgba(22, 163, 74, .06);
  font-size: .78rem;
}

.flight-data-status--live > div {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.flight-data-status--live strong { color: #166534; }
.flight-data-status--live span { color: #475569; }

/* Cached/checking/waiting states now live on a light dashboard card, not the old dark shell. */
.flight-data-status--cached strong,
.flight-data-status--checking strong,
.flight-data-status--waiting strong {
  color: #111827;
}

.flight-data-status--cached span,
.flight-data-status--checking span,
.flight-data-status--waiting span {
  color: #475569;
}

.flight-data-status--cached button,
.flight-data-status--checking button,
.flight-data-status--waiting button {
  border-color: #cbd5e1;
  color: #111827;
  background: rgba(255,255,255,.75);
}

/* Keep nested emphasis text from inheriting the flight-header status-pill treatment. */
.flight-countdown em,
.flight-delay-overlap em {
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  white-space: normal;
}

/* Make the operations trigger visible and comfortably tappable on light flight cards. */
.flight-card--optimized .flight-card__top {
  grid-template-columns: minmax(0, 1fr) auto 44px !important;
}

.flight-card__menu-button {
  width: 44px !important;
  height: 44px !important;
  border: 1px solid #d7dee8;
  background: #f1f5f9;
  color: #334155;
}

.flight-card__menu-button:hover,
.flight-card__menu-button:focus-visible {
  border-color: #b9c3d0;
  background: #e2e8f0;
  outline-color: rgba(225,10,70,.3);
}

/* Restored shared-flight admin controls. */
.data-tool .admin-token-label {
  flex: 1 1 100%;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #e3e8f0;
}

.data-tool .admin-token-label > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-dark);
  font-size: .74rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.data-tool .remember-token-label {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 2px;
  color: #475569;
  font-weight: 800;
}

.data-tool .remember-token-label input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--virgin-red);
}

#save-flight-data {
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--virgin-red), var(--virgin-burgundy));
  box-shadow: 0 8px 20px rgba(225,10,70,.2);
}

#save-flight-data:disabled {
  opacity: .62;
  cursor: wait;
}

@media (max-width: 900px) {
  .flight-reference-desktop { display: none; }
  .flight-reference-cards { display: block; }
}

@media (max-width: 760px) {
  /* Leave clear space inside the 8px red/gold brand rails. */
  .page-shell {
    width: min(100% - 20px, 1360px);
  }

  .flight-filters--details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0 8px;
    padding: 10px;
  }

  .flight-filters--details label,
  .flight-filters--details label:last-child {
    grid-column: auto;
    min-width: 0;
    margin-top: 0;
  }

  .flight-reference-details > summary {
    align-items: flex-start;
    padding: 13px 14px;
  }

  .flight-reference-details > summary small {
    max-width: 48%;
    text-align: right;
  }

  .flight-reference-details #flight-table {
    padding: 0 8px 10px;
  }

  .flight-data-status--live {
    margin: 6px 12px 2px;
    padding: 6px 9px;
  }

  /* Give the inbound label its natural width and the operational status the remainder. */
  .live-flight-status__heading,
  .live-flight-status > div:first-child {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .live-flight-status strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .data-tool .button-row {
    align-items: stretch;
  }

  .data-tool .admin-token-label,
  .data-tool .remember-token-label,
  #save-flight-data {
    flex-basis: 100%;
  }

  #save-flight-data {
    width: 100%;
    min-height: 46px;
  }
}

@media (max-width: 390px) {
  .flight-filters--details { grid-template-columns: 1fr; }

  .flight-reference-details > summary small {
    display: none;
  }

  .live-flight-status__heading,
  .live-flight-status > div:first-child {
    grid-template-columns: 1fr;
  }
}
