:root {
  --brand-orange: #ed7d31;
  --brand-orange-dark: #d5651c;
  --brand-blue: #1878b4;
  --brand-blue-dark: #125e8a;
  --brand-blue-tint: #eaf4fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}

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

.app-header {
  background: var(--brand-blue-dark);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-name {
  font-weight: 800;
  font-size: 20px;
  color: var(--brand-orange);
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #cfe6f4;
}

.app-nav {
  display: flex;
  gap: 18px;
}

.app-nav a {
  color: #cfe6f4;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
}

.app-nav a.active {
  color: #fff;
  border-bottom-color: var(--brand-orange);
}

.header-account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #cfe6f4;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--brand-blue-dark), var(--brand-blue));
}

.login-card {
  background: #fff;
  border-radius: 10px;
  padding: 32px;
  width: 340px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.login-sub {
  text-align: center;
  font-size: 13px;
  color: #555;
  margin: 0 0 20px;
}

.app-main {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: #fff;
  border: 1px solid #e2e4e9;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--brand-blue-dark);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  flex: 1;
  min-width: 160px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: #444;
}

.field input,
.field select,
.field textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 13px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 5px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
}

.btn-primary {
  background: var(--brand-orange);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-orange-dark);
}

.btn-secondary {
  background: var(--brand-blue-tint);
  color: var(--brand-blue-dark);
}

.btn-danger {
  background: #fde2e2;
  color: #a11;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
}

th {
  background: var(--brand-blue-tint);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--brand-blue-dark);
}

.segment-block {
  border: 1px solid #e2e4e9;
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafbfc;
}

.segment-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Accordion — used by the New Ticket page's Flight Segments and Passengers lists so adding
   several items doesn't blow up the page height; only the active item's fields render. */
.accordion-item {
  border: 1px solid #e2e4e9;
  border-radius: 6px;
  margin-bottom: 10px;
  background: #fafbfc;
}

.accordion-item.is-expanded {
  background: #fff;
  border-color: var(--brand-blue);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
}

.accordion-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.accordion-caret {
  color: var(--brand-blue-dark);
  font-size: 11px;
  flex-shrink: 0;
  width: 10px;
}

.accordion-title {
  font-weight: 700;
  flex-shrink: 0;
}

.accordion-summary {
  color: #666;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accordion-remove {
  flex-shrink: 0;
}

.accordion-body {
  padding: 4px 12px 14px;
  border-top: 1px solid #e2e4e9;
}

.field-group {
  flex: 1;
  min-width: 220px;
  border: 1px solid #e2e4e9;
  border-radius: 6px;
  padding: 10px 10px 0;
  margin-bottom: 12px;
  background: #fff;
}

.field-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-blue-dark);
  margin-bottom: 6px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 2px;
}

.pagination-info {
  font-size: 13px;
  color: #555;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: default;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.status-accepted {
  background: #dff5e1;
  color: #1a7a2e;
}

.status-rejected {
  background: #fde2e2;
  color: #a11;
}

.error-text {
  color: #a11;
  font-size: 13px;
  margin: 8px 0;
}

.help-text {
  font-size: 12px;
  color: #666;
  margin: 4px 0 12px;
}

.required-mark {
  color: #a11;
  margin-left: 2px;
}

.airline-logo-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #e2e4e9;
}

.airline-logo-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #e2e4e9;
}

.airline-logo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: var(--brand-blue-tint);
  color: var(--brand-blue-dark);
  font-size: 11px;
  font-weight: 700;
}

.preview-frame {
  width: 100%;
  height: 700px;
  border: 1px solid #e2e4e9;
  border-radius: 6px;
  background: #f4f5f7;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tables scroll horizontally within their own box instead of widening the page. */
table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Laptop / small desktop: nav starts competing with header-account for space. With 8 menu
   items, even 1024-1200px is too narrow for a single-line header, so it wraps here too. */
@media (max-width: 1200px) {
  .app-header {
    flex-wrap: wrap;
    gap: 10px 20px;
    padding: 12px 16px;
  }

  .app-nav {
    flex-wrap: wrap;
    gap: 4px 14px;
    order: 3;
    width: 100%;
  }

  .header-account {
    margin-left: auto;
  }
}

@media (max-width: 1024px) {
  .app-main {
    max-width: 100%;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .preview-frame {
    height: 500px;
  }
}

/* Tablet */
@media (max-width: 768px) {
  .app-main {
    padding: 16px;
  }

  .field {
    min-width: 130px;
  }

  .login-card {
    width: min(340px, 92vw);
  }
}

/* Mobile: stack rows of fields, full-width buttons, tighter spacing. */
@media (max-width: 480px) {
  .app-header {
    padding: 10px 12px;
    gap: 8px 14px;
  }

  .brand-sub {
    display: none;
  }

  .header-account span {
    display: none;
  }

  .app-main {
    padding: 12px;
  }

  .card {
    padding: 14px;
  }

  .row {
    gap: 10px;
  }

  .field {
    min-width: 0;
    width: 100%;
  }

  /* Many segment/passenger fields set an inline max-width (e.g. style="max-width:100px")
     for their desktop grid; ignore it below this breakpoint so fields go full-width instead
     of rendering cramped at their desktop cap. */
  .field[style*="max-width"] {
    max-width: none !important;
  }

  .segment-block-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Not enough width for title + summary + remove button on one line; drop the summary and
     let the header wrap instead of overflowing horizontally. */
  .accordion-header {
    flex-wrap: wrap;
  }

  .accordion-summary {
    display: none;
  }

  .field-group {
    min-width: 0;
  }

  .preview-frame {
    height: 380px;
  }

  .login-card {
    width: min(320px, 94vw);
    padding: 24px 20px;
  }
}
