:root {
  --green: #00843d;
  --green-dark: #006c31;
  --navy: #081c2f;
  --navy-soft: #16324b;
  --gold: #c99a2e;
  --gray-50: #f7f9fb;
  --gray-100: #edf1f4;
  --gray-200: #d9e0e6;
  --gray-500: #687685;
  --gray-700: #334252;
  --white: #ffffff;
  --danger: #b32318;
  --seat: #e8f6ee;
  --seat-border: #74bd92;
  --shadow: 0 16px 40px rgba(8, 28, 47, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--navy);
  background: linear-gradient(180deg, #f8fbf9 0%, #eef4f1 100%);
}

button {
  font: inherit;
  touch-action: manipulation;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 12px clamp(14px, 3vw, 28px);
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--green);
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--gray-500);
  margin-top: 1px;
}

.flight-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--gray-700);
  font-size: 0.9rem;
}

.flight-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--gray-100);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(292px, 360px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px clamp(12px, 3vw, 28px) 28px;
}

.app[data-view="passengers"] .layout,
.app[data-view="seatmap"] .layout {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.app[data-view="passengers"] .seatmap-panel,
.app[data-view="seatmap"] .side-panel {
  display: none;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.app[data-view="passengers"] .side-panel {
  width: 100%;
}

.panel-section {
  display: grid;
  gap: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.08;
}

h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
}

.status-text {
  color: var(--gray-700);
  line-height: 1.45;
}

.passenger-list {
  list-style: none;
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.passenger-card,
.summary-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
}

.passenger-card {
  width: 100%;
  color: inherit;
  cursor: pointer;
  text-align: left;
  border-width: 2px;
}

.passenger-card.active {
  border-color: var(--green);
  background: #eefaf3;
  box-shadow: inset 4px 0 0 var(--green);
}

.passenger-card.complete {
  border-color: #b6d9c3;
  background: #f3fbf6;
}

.passenger-card strong,
.summary-item strong {
  font-size: 0.96rem;
}

.passenger-meta,
.summary-item span {
  color: var(--gray-500);
  font-size: 0.86rem;
}

.class-badge {
  justify-self: start;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--white);
  background: var(--navy-soft);
  font-size: 0.74rem;
  font-weight: 700;
}

.class-badge.business,
.class-badge.first {
  background: var(--gold);
  color: #231900;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  font-size: 0.83rem;
  color: var(--gray-700);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-seat {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 6px 6px 4px 4px;
  border: 2px solid var(--seat-border);
  background: var(--seat);
}

.legend-seat.selected {
  background: var(--green);
  border-color: var(--green-dark);
}

.legend-seat.occupied {
  background: #c5ced6;
  border-color: #9aa8b5;
}

.legend-seat.blocked {
  background: #f7dedb;
  border-color: #d86a62;
}

.legend-seat.extra {
  box-shadow: inset 0 -5px 0 #bce5c8;
}

.legend-seat.exit {
  border-color: #e0781c;
}

.legend-seat.bassinet {
  background: #e8f0ff;
  border-color: #809ee5;
}

.legend-seat.crew {
  background: #ede7f6;
  border-color: #8e6ec6;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: auto;
}

.primary-action,
.secondary-action,
.toolbar button {
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  color: var(--white);
  background: var(--green);
}

.primary-action:disabled {
  cursor: not-allowed;
  color: #7d8994;
  background: var(--gray-200);
}

.secondary-action,
.toolbar button {
  color: var(--navy);
  background: var(--gray-100);
}

.form-message {
  min-height: 1.35em;
  color: var(--gray-700);
  font-size: 0.9rem;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--green-dark);
}

.seatmap-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.seat-context {
  position: sticky;
  top: 82px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.seat-context div:first-child {
  display: grid;
  gap: 3px;
}

.seat-context strong {
  font-size: 1.04rem;
}

.seat-context span:last-child {
  color: var(--gray-700);
  font-size: 0.9rem;
}

.eyebrow {
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.seat-context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
}

.map-shell {
  position: relative;
  min-height: 640px;
  overflow: hidden;
  touch-action: none;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 18%, rgba(0, 132, 61, 0.08), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f2f6f8 100%);
  box-shadow: var(--shadow);
}

.map-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.aircraft {
  width: min(86vw, 560px);
  min-width: 360px;
  margin: 34px;
  padding: 70px 20px 58px;
  position: relative;
  display: grid;
  gap: 16px;
  border: 3px solid #cfd9df;
  border-top: 0;
  border-radius: 50% 50% 40px 40px / 88px 88px 36px 36px;
  background: linear-gradient(90deg, #f8fafb 0%, #ffffff 18%, #ffffff 82%, #f8fafb 100%);
}

.aircraft::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -34px;
  width: 58%;
  height: 92px;
  transform: translateX(-50%);
  border: 3px solid #cfd9df;
  border-bottom: 0;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafb 100%);
  z-index: -1;
}

.aircraft::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -32px;
  width: 34%;
  height: 42px;
  transform: translateX(-50%);
  border: 3px solid #cfd9df;
  border-top: 0;
  border-radius: 0 0 48% 48%;
  background: #f8fafb;
}

.nose-label {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gray-500);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.service-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: var(--gray-500);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.service-unit {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
}

.cabin {
  display: grid;
  gap: 8px;
}

.cabin-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-500);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.cabin-title::before,
.cabin-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--gray-200);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  min-height: 42px;
}

.row.wing::before,
.row.wing::after {
  content: "";
  position: absolute;
  top: 4px;
  width: clamp(46px, 11vw, 94px);
  height: 34px;
  background: rgba(8, 28, 47, 0.1);
  border: 1px solid rgba(8, 28, 47, 0.15);
}

.row.wing::before {
  right: 100%;
  border-radius: 999px 0 0 999px;
}

.row.wing::after {
  left: 100%;
  border-radius: 0 999px 999px 0;
}

.row.exit {
  padding-block: 5px;
}

.row.exit .row-number {
  color: #9e4c00;
}

.row.exit .seats {
  border-block: 1px dashed #e0781c;
}

.row.bulkhead {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 7px solid #e8edf1;
}

.row-number {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.8rem;
  font-weight: 900;
}

.seats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 42px;
}

.aisle {
  width: 24px;
  height: 1px;
}

.seat {
  position: relative;
  width: 34px;
  height: 34px;
  border: 2px solid var(--seat-border);
  border-radius: 12px 12px 8px 8px;
  color: var(--navy);
  background: var(--seat);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  touch-action: manipulation;
  box-shadow: inset 0 -8px 0 rgba(0, 132, 61, 0.12);
}

.seat::before {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 4px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.seat.business {
  border-color: var(--gold);
  background: #fff7df;
  box-shadow: inset 0 -8px 0 rgba(201, 154, 46, 0.22);
}

.seat.extra-legroom {
  box-shadow: inset 0 -11px 0 #bce5c8;
}

.seat.emergency-exit {
  border-color: #e0781c;
}

.seat.bassinet {
  background: #e8f0ff;
  border-color: #809ee5;
}

.seat.crew {
  background: #ede7f6;
  border-color: #8e6ec6;
}

.seat.selected {
  color: var(--white);
  border-color: var(--green-dark);
  background: var(--green);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.18), 0 0 0 3px rgba(0, 132, 61, 0.18);
}

.seat.draft {
  color: var(--white);
  border-color: var(--green-dark);
  background: var(--green);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.18), 0 0 0 4px rgba(201, 154, 46, 0.35);
}

.seat.occupied,
.seat.blocked,
.seat.unavailable,
.seat.crew {
  cursor: not-allowed;
}

.seat.occupied {
  color: #5d6974;
  background: #c5ced6;
  border-color: #9aa8b5;
  box-shadow: inset 0 -8px 0 rgba(8, 28, 47, 0.12);
}

.seat.blocked,
.seat.unavailable {
  color: var(--danger);
  background: #f7dedb;
  border-color: #d86a62;
  box-shadow: inset 0 -8px 0 rgba(179, 35, 24, 0.1);
}

.seat:disabled {
  opacity: 0.72;
}

.seat:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.toolbar button:focus-visible {
  outline: 3px solid rgba(0, 132, 61, 0.35);
  outline-offset: 2px;
}

.seat-letters {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 900;
}

.seat-letters .seats {
  min-height: 22px;
}

.letter {
  width: 34px;
  text-align: center;
}

.loading,
.error-state {
  padding: 30px;
  text-align: center;
  color: var(--gray-700);
}

.high-contrast {
  --green: #006b30;
  --navy: #001526;
  --gray-500: #465360;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

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

  .side-panel {
    max-height: none;
  }

  .app[data-view="passengers"] .layout,
  .app[data-view="seatmap"] .layout {
    grid-template-columns: 1fr;
  }

  .map-shell {
    min-height: 58vh;
  }

  .seat-context {
    top: 92px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .flight-summary {
    justify-content: flex-start;
  }

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

  .seat-context {
    align-items: stretch;
    flex-direction: column;
    top: 128px;
  }

  .seat-context-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .aircraft {
    min-width: 330px;
    margin: 22px;
    padding-inline: 12px;
  }

  .seat {
    width: 30px;
    height: 32px;
  }

  .letter {
    width: 30px;
  }

  .seats {
    gap: 4px;
  }

  .aisle {
    width: 18px;
  }
}
