:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ef;
  --brand: #075aaa;
  --brand-strong: #00427f;
  --row-hover: #edf5ff;
  --selected: #dcecff;
  --good-bg: #e8f7ef;
  --good-text: #12723b;
  --shadow: 0 8px 28px rgba(23, 32, 51, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.refresh-button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 18px;
  touch-action: manipulation;
}

.refresh-button:hover,
.refresh-button:focus-visible {
  background: var(--brand-strong);
}

.filter-button {
  align-self: end;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 16px;
  touch-action: manipulation;
}

.ub-time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-button:hover,
.filter-button:focus-visible {
  border-color: var(--brand);
  outline: 3px solid rgba(7, 90, 170, .14);
}

.filter-button.active {
  border-color: var(--brand);
  background: var(--selected);
  color: var(--brand-strong);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(240px, 1fr) auto auto auto auto;
  gap: 14px;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  min-height: 44px;
  padding: 0 12px;
  font-size: 16px;
}

select:focus,
input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(7, 90, 170, .14);
}

.status-message {
  min-height: 22px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.status-message.error {
  color: #b42318;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f9;
  color: #344054;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--row-hover);
}

tbody tr.selected {
  background: var(--selected);
  box-shadow: inset 4px 0 0 var(--brand);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.flight-number {
  color: var(--brand);
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--good-bg);
  color: var(--good-text);
  font-size: 13px;
  font-weight: 800;
  padding: 3px 10px;
}

.empty-cell {
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
}

.page-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.page-footer a {
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.page-footer a:hover,
.page-footer a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 720px) {
  body {
    background: #eef3f9;
  }

  .page-shell {
    width: 100%;
    padding: 14px 10px 28px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 12px;
  }

  .page-header > div {
    min-width: 0;
  }

  .eyebrow {
    font-size: 11px;
    margin-bottom: 2px;
  }

  h1 {
    font-size: 24px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }

  .field {
    gap: 5px;
    font-size: 12px;
  }

  select,
  input,
  .filter-button,
  .refresh-button {
    min-height: 48px;
    border-radius: 8px;
  }

  .filter-button {
    width: 100%;
  }

  .refresh-button {
    flex: 0 0 auto;
    min-width: 98px;
    padding: 0 14px;
  }

  .status-message {
    margin: 8px 2px 10px;
    font-size: 13px;
  }

  .page-footer {
    margin-top: 14px;
    font-size: 13px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tbody tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    cursor: pointer;
    overflow: hidden;
  }

  tbody tr:hover {
    background: var(--panel);
  }

  tbody tr.selected {
    background: var(--panel);
    box-shadow: inset 4px 0 0 var(--brand), var(--shadow);
  }

  td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    min-height: 40px;
    padding: 8px 12px;
    white-space: normal;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  td:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    background: #f8fbff;
  }

  td:first-child::before {
    content: attr(data-label);
  }

  td:last-child {
    border-bottom: 0;
  }

  .flight-number {
    font-size: 19px;
  }

  .status-pill {
    justify-self: start;
  }

  .ub-time {
    margin-top: 2px;
  }

  .empty-cell {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 24px 12px;
  }

  .empty-cell::before {
    content: "";
  }
}
