:root {
  color-scheme: dark;
  --bg: #06070b;
  --bg-soft: #11131a;
  --card: rgba(255, 255, 255, 0.94);
  --card-dark: rgba(18, 20, 31, 0.88);
  --card-border: rgba(255, 255, 255, 0.16);
  --text: #f8fafc;
  --dark-text: #10111a;
  --muted: #9aa3b2;
  --muted-dark: #5e6676;
  --header: #111827;
  --header-text: #ffffff;
  --virgin-red: #e10a46;
  --virgin-burgundy: #7b0c2e;
  --virgin-purple: #5b2cff;
  --champagne: #f5ead7;
  --today: #e10a46;
  --shift-bg: #dbeafe;
  --shift-text: #0f3973;
  --vacation-bg: #fff2a6;
  --vacation-text: #6b4a00;
  --trainer-bg: #dff8e6;
  --trainer-text: #105c2a;
  --recovery-bg: #ffe0b8;
  --recovery-text: #8a3d00;
  --off-bg: #e7e9ee;
  --off-text: #4b5563;
  --blank-bg: #f7f8fb;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
  --radius-lg: 28px;
  --radius-md: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% -10%, rgba(225, 10, 70, 0.42), transparent 34rem),
    radial-gradient(circle at 85% 5%, rgba(91, 44, 255, 0.26), transparent 30rem),
    linear-gradient(135deg, #05060a 0%, #11131d 48%, #260617 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.055) 40%, transparent 48%),
    radial-gradient(circle at 50% 110%, rgba(255,255,255,0.08), transparent 32rem);
  opacity: 0.9;
}

h1, h2, h3, p {
  margin-top: 0;
}

code {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  padding: 2px 6px;
  color: #ffe4ef;
  background: rgba(225, 10, 70, 0.16);
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #ff9fbd;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.55rem, 7vw, 5.65rem);
  line-height: 0.88;
  letter-spacing: -0.07em;
  text-wrap: balance;
}

.subtitle {
  margin-bottom: 0;
  color: #c8ceda;
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.status-card,
.dashboard-card,
.filters,
.section-card,
.schedule-card {
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(249,250,252,0.92));
  color: var(--dark-text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.status-card {
  min-height: 104px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
}

.status-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-dark);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.095em;
}

.status-card strong,
.dashboard-card strong {
  display: block;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  letter-spacing: -0.035em;
}

.status-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted-dark);
  line-height: 1.35;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 24px;
  background: rgba(7, 8, 13, 0.74);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 45px rgba(0,0,0,0.22);
}

.tab-button {
  border: 0;
  border-radius: 18px;
  padding: 13px 18px;
  background: transparent;
  color: #dbe1ea;
  font: inherit;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.tab-button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--virgin-red), var(--virgin-burgundy));
  box-shadow: 0 10px 25px rgba(225, 10, 70, 0.34);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.ops-dashboard {
  grid-template-columns: repeat(4, 1fr);
}

.dashboard-card {
  min-width: 0;
  min-height: 152px;
  border-radius: var(--radius-md);
  padding: 20px;
}

.dashboard-card p {
  margin: 10px 0 0;
  color: var(--muted-dark);
  line-height: 1.45;
}

.accent-card {
  color: #fff;
  background:
    linear-gradient(135deg, rgba(225,10,70,0.96), rgba(89,12,55,0.95)),
    linear-gradient(180deg, #fff, #fff);
  border-color: rgba(255,255,255,0.24);
}

.accent-card .status-label,
.accent-card p {
  color: rgba(255,255,255,0.8);
}

.dashboard-card__header,
.section-card__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.link-button {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  color: #fff;
  background: #121827;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.department-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.department-tabs button {
  border: 1px solid #dfe4ee;
  border-radius: 999px;
  padding: 8px 11px;
  background: #fff;
  color: var(--dark-text);
  font-weight: 800;
  cursor: pointer;
}

.department-tabs button.active {
  background: linear-gradient(135deg, var(--virgin-red), var(--virgin-burgundy));
  color: #fff;
  border-color: transparent;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 14px;
  margin: 10px 0 0;
  padding: 0;
  color: var(--muted-dark);
  font-size: 0.9rem;
  list-style: none;
}

.legend li {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.legend-swatch {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
}

.legend-swatch--shift { background: var(--shift-bg); }
.legend-swatch--vacation { background: var(--vacation-bg); }
.legend-swatch--trainer { background: var(--trainer-bg); }
.legend-swatch--recovery { background: var(--recovery-bg); }
.legend-swatch--off { background: var(--off-bg); }

.filters {
  display: flex;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  padding: 15px;
}

.filters label {
  flex: 1;
  min-width: 180px;
}

.filters span,
.textarea-label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-dark);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d7deea;
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--dark-text);
  background: #fff;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(225,10,70,0.22);
  border-color: rgba(225,10,70,0.65);
}

textarea {
  min-height: 290px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}

.schedule-card,
.section-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.schedule-card__header,
.section-card__header {
  padding: 24px 26px;
  border-bottom: 1px solid #e4e8ef;
  background:
    linear-gradient(90deg, rgba(225,10,70,0.08), transparent 44%),
    rgba(255,255,255,0.72);
}

.schedule-card__header h2,
.section-card h2 {
  margin-bottom: 7px;
  font-size: 1.45rem;
  letter-spacing: -0.035em;
}

.schedule-card__header p,
.section-card__header p {
  margin-bottom: 0;
  color: var(--muted-dark);
}

.mobile-hint {
  font-weight: 800;
}

.department-section {
  border-bottom: 1px solid #e4e8ef;
}

.department-section h3 {
  position: sticky;
  left: 0;
  z-index: 7;
  margin: 0;
  padding: 15px 18px;
  color: #fff;
  background: linear-gradient(135deg, #111827, #2a0716 70%, #741038);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.department-section h3 span {
  opacity: 0.74;
  font-size: 0.82em;
  text-transform: none;
  letter-spacing: 0;
}

.table-wrap {
  overflow: auto;
  max-height: 66vh;
  -webkit-overflow-scrolling: touch;
}

.schedule-table,
.flight-reference {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td,
.flight-reference th,
.flight-reference td {
  padding: 10px 9px;
  border-right: 1px solid #e3e8f0;
  border-bottom: 1px solid #e3e8f0;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.schedule-table th,
.schedule-table td {
  min-width: 112px;
  height: 66px;
  text-align: center;
  white-space: pre-line;
}

.schedule-table thead th,
.flight-reference thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  color: #fff;
  background: linear-gradient(180deg, #151a29, #090a10);
  font-size: 0.86rem;
}

.schedule-table .name-col {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 132px;
  width: 132px;
  text-align: left;
}

.schedule-table .role-col {
  min-width: 108px;
  width: 108px;
  color: var(--muted-dark);
  background: #fff;
}

.schedule-table thead .name-col {
  z-index: 6;
  color: #fff;
  background: linear-gradient(180deg, #151a29, #090a10);
}

.schedule-table tbody .name-col {
  background: #fff;
  color: var(--dark-text);
  font-weight: 900;
}

.date-label {
  display: block;
  font-size: 0.98rem;
  font-weight: 900;
}

.day-label {
  display: block;
  margin-top: 3px;
  opacity: 0.76;
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.cell--shift { background: var(--shift-bg); color: var(--shift-text); font-weight: 800; }
.cell--vacation { background: var(--vacation-bg); color: var(--vacation-text); font-weight: 900; }
.cell--trainer { background: var(--trainer-bg); color: var(--trainer-text); font-weight: 900; }
.cell--recovery { background: var(--recovery-bg); color: var(--recovery-text); font-weight: 900; }
.cell--off { background: var(--off-bg); color: var(--off-text); font-weight: 900; }
.cell--blank { background: var(--blank-bg); color: #98a2b3; }
.is-today { box-shadow: inset 3px 0 0 var(--today), inset -3px 0 0 var(--today); }
thead .is-today { background: linear-gradient(180deg, #e10a46, #7b0c2e); }

.empty-state {
  margin: 0;
  padding: 18px;
  color: var(--muted-dark);
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
}

.flight-sections {
  padding: 0 24px 24px;
}

.flight-sections h3 {
  margin: 24px 0 12px;
  color: var(--dark-text);
  letter-spacing: -0.025em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 12px;
}

.flight-card {
  border: 1px solid #e1e6ef;
  border-radius: 20px;
  padding: 16px;
  color: var(--dark-text);
  background:
    linear-gradient(135deg, rgba(225,10,70,0.08), transparent 36%),
    linear-gradient(180deg, #fff, #fbfcff);
}

.flight-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 13px;
}

.flight-card strong {
  display: block;
  font-size: 1.28rem;
  letter-spacing: -0.04em;
}

.flight-card span {
  color: var(--muted-dark);
}

.flight-card em {
  border-radius: 999px;
  padding: 5px 9px;
  color: #fff;
  background: linear-gradient(135deg, var(--virgin-red), var(--virgin-burgundy));
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.flight-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 14px;
  margin: 0;
}

.flight-card dt {
  color: var(--muted-dark);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.flight-card dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.warning-note {
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 12px;
  color: #7c2d12;
  background: #fff7ed;
  font-weight: 800;
}

.data-tool {
  padding-bottom: 24px;
}

.data-tool > :not(.section-card__header) {
  margin-left: 24px;
  margin-right: 24px;
}

.notice {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #e5d6dc;
  border-radius: 14px;
  color: #481629;
  background: linear-gradient(90deg, #fff4f8, #ffffff);
}

details {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e4e8ef;
  border-radius: 14px;
  background: #fff;
}

summary {
  cursor: pointer;
  font-weight: 850;
}

pre {
  white-space: pre-wrap;
  overflow: auto;
}

.textarea-label {
  display: block;
  margin-top: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.button-row button,
.file-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 15px;
  color: #fff;
  background: linear-gradient(135deg, #111827, #2a0716);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.button-row button:nth-child(3) {
  background: linear-gradient(135deg, var(--virgin-red), var(--virgin-burgundy));
}

.button-row button:nth-child(4) {
  background: #64748b;
}

.file-button input {
  display: none;
}

.validation-output,
.json-preview {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #e3e8f0;
  border-radius: 14px;
  color: var(--dark-text);
  background: #f8fafc;
}

.validation-output.ok {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.validation-output.bad {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

@media (max-width: 1000px) {
  .hero,
  .filters,
  .schedule-card__header,
  .section-card__header {
    display: block;
  }

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

  .status-grid,
  .dashboard,
  .ops-dashboard {
    grid-template-columns: 1fr;
    min-width: 0;
    margin-top: 16px;
  }

  .filters label + label {
    margin-top: 12px;
  }

  .flight-filters label + label {
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 18px, 1360px);
    padding: 18px 0;
  }

  h1 {
    font-size: clamp(2.45rem, 14vw, 4.1rem);
  }

  .tabs {
    border-radius: 18px;
  }

  .tab-button {
    padding: 11px 13px;
  }

  .status-card,
  .dashboard-card {
    min-height: auto;
    border-radius: 18px;
    padding: 15px;
  }

  .schedule-card,
  .section-card {
    border-radius: 20px;
  }

  .schedule-card__header,
  .section-card__header {
    padding: 17px;
  }

  .department-section h3 {
    padding: 13px 14px;
  }

  .table-wrap {
    max-height: none;
  }

  .schedule-table {
    min-width: 790px;
  }

  .schedule-table th,
  .schedule-table td {
    min-width: 98px;
    height: 58px;
    padding: 8px 7px;
    font-size: 0.84rem;
  }

  .schedule-table .name-col {
    min-width: 108px;
    width: 108px;
  }

  .schedule-table .role-col {
    min-width: 90px;
    width: 90px;
  }

  .flight-sections,
  .data-tool > :not(.section-card__header) {
    margin-left: 14px;
    margin-right: 14px;
    padding-left: 0;
    padding-right: 0;
  }

  .flight-card dl {
    grid-template-columns: 1fr;
  }

  .mobile-hint {
    margin-top: 10px;
  }
}
