/* ===== Variables & base ===== */
:root {
  --navy: #073b5f;
  --blue: #0879bd;
  --blue-dark: #05669e;
  --cyan: #1ab6bf;
  --ink: #173447;
  --muted: #6a7f8d;
  --line: #dce8ed;
  --surface: #ffffff;
  --soft: #f2f8fa;
  --success: #20a66a;
  --danger: #d65353;
}

* { box-sizing: border-box; }

html { background: #eaf3f6; }

body {
  margin: 0;
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background:
    radial-gradient(circle at 72% 8%, rgba(26, 182, 191, .11), transparent 28%),
    linear-gradient(145deg, #edf6f7 0%, #f8fbfc 48%, #e9f2f5 100%);
}

button, input { font: inherit; }

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(26, 182, 191, .45);
  outline-offset: 2px;
}

/* ===== Topbar & navigation ===== */
.topbar {
  min-height: 66px;
  border-bottom: 1px solid rgba(7, 59, 95, .1);
  box-shadow: 0 8px 28px rgba(17, 62, 82, .07);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: white;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--blue), var(--cyan));
  box-shadow: 0 7px 16px rgba(8, 121, 189, .25);
}

.top-nav-button {
  position: relative;
  padding: 23px 2px 18px;
  color: #637985;
  font-weight: 600;
  transition: color .2s ease;
}

.top-nav-button:hover,
.top-nav-button.is-active { color: var(--blue); }

.top-nav-button::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--cyan);
  content: "";
  opacity: 0;
  transform: scaleX(.3);
  transition: .2s ease;
}

.top-nav-button.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

/* ===== App frame & side rail ===== */
.app-frame {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  width: 100%;
  min-height: calc(100 * min(var(--vh, 1vh), 1vh) - 66px);
}

.side-rail {
  position: relative;
  overflow: hidden;
  color: white;
  background: linear-gradient(180deg, rgba(5, 79, 125, .97), rgba(5, 109, 150, .96));
}

.side-image {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 42%;
  object-fit: cover;
  opacity: .24;
  mix-blend-mode: screen;
  mask-image: linear-gradient(to bottom, transparent, black 48%);
}

.side-button {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: rgba(255,255,255,.7);
  border-radius: 12px;
  transition: .2s ease;
}

.side-button:hover,
.side-button.is-active {
  color: white;
  background: rgba(255,255,255,.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}

/* ===== Dashboard layout ===== */
.dashboard-shell {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 22px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(230px, .82fr) minmax(440px, 1.72fr) minmax(255px, .92fr);
  gap: 18px;
  align-items: start;
}

/* ===== Panels & cards ===== */
.panel-card {
  overflow: hidden;
  border: 1px solid rgba(21, 80, 105, .12);
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 13px 34px rgba(28, 72, 91, .08);
}

.panel-heading {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  font-size: 15px;
}

.panel-body { padding: 15px; font-size: 13px; }

.blue-heading {
  color: white;
  background: linear-gradient(110deg, var(--blue-dark), var(--blue));
}

.neutral-heading {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #fff, #f4f9fa);
}

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  color: #54707e;
}

.metric-row strong {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

/* ===== Segmented control ===== */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #edf4f6;
}

.segment-button {
  min-height: 32px;
  padding: 5px 7px;
  color: #6b7e88;
  border-radius: 7px;
  font-weight: 700;
  font-size: 12px;
  transition: .2s ease;
}

.segment-button.is-active {
  color: var(--blue-dark);
  background: white;
  box-shadow: 0 3px 10px rgba(26, 73, 92, .12);
}

/* ===== Document sheet ===== */
.document-sheet {
  min-height: 186px;
  margin-top: 12px;
  padding: 18px;
  border: 1px dashed #b9ccd3;
  border-radius: 12px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent 0 21px, #edf3f5 22px) border-box;
}

/* ===== Accordion ===== */
.accordion {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.accordion + .accordion { margin-top: 9px; }

.accordion-trigger {
  display: flex;
  width: 100%;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  background: #f8fbfc;
  transition: background .2s ease;
}

.accordion-trigger:hover { background: #eef7f8; }

.accordion-icon { transition: transform .25s ease; }

.accordion.is-open .accordion-icon { transform: rotate(180deg); }

.accordion-panel {
  display: none;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.accordion.is-open .accordion-panel { display: block; }

/* ===== Tables ===== */
.itinerary-table {
  width: 100%;
  min-width: 590px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.itinerary-table.compact-table {
  min-width: 0;
}

.itinerary-table th {
  padding: 8px 9px;
  color: #687c87;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .02em;
  text-align: left;
  background: #edf4f6;
}

.itinerary-table td {
  padding: 9px 9px;
  border-top: 1px solid #e8eff2;
  color: #405c69;
  vertical-align: middle;
}

.itinerary-table th:first-child { border-radius: 9px 0 0 9px; }
.itinerary-table th:last-child { border-radius: 0 9px 9px 0; }

/* ===== Icon actions & inputs ===== */
.icon-action {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--blue);
  border-radius: 8px;
  transition: .2s ease;
}

.icon-action:hover { background: #e5f5fa; }
.icon-action.danger { color: var(--danger); }
.icon-action.danger:hover { background: #fff0f0; }

.edit-input {
  width: 100%;
  min-width: 130px;
  padding: 6px 8px;
  border: 1px solid #8bcbd4;
  border-radius: 7px;
  background: #fff;
}

/* ===== Services list ===== */
.service-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 3px;
  border-bottom: 1px solid #e8eff2;
}

.service-item:last-child { border-bottom: 0; }

.add-service-button,
.add-passenger-button {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: white;
  border-radius: 9px;
  background: var(--blue);
  transition: .2s ease;
}

.add-service-button:hover,
.add-passenger-button:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.search-field {
  width: 100%;
  min-height: 40px;
  padding: 8px 38px 8px 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.compact-panel-body { padding: 10px 12px; }

.compact-search-field {
  min-height: 30px;
  padding: 5px 30px 5px 9px;
  font-size: 12px;
  border-radius: 8px;
}

.compact-service-item {
  padding: 6px 3px;
  font-size: 12px;
}

.compact-service-item p:first-child { font-size: 12.5px; }
.compact-service-item p:last-child { font-size: 11px; }

.compact-add-button {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(340px, calc(100% - 44px));
  padding: 12px 15px;
  color: white;
  border-radius: 12px;
  background: #113f55;
  box-shadow: 0 14px 35px rgba(6, 40, 55, .26);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: .25s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Reveal animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal .45s ease forwards;
}

.reveal:nth-child(2) { animation-delay: .07s; }
.reveal:nth-child(3) { animation-delay: .14s; }

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive breakpoints ===== */
@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: minmax(220px, .75fr) minmax(430px, 1.5fr);
  }

  .right-column {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 18px;
  }
}

@media (max-width: 780px) {
  .top-nav { display: none !important; }

  .app-frame { grid-template-columns: 56px minmax(0, 1fr); }

  .dashboard-shell { padding: 13px; }

  .dashboard-grid,
  .right-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .right-column { grid-column: auto; }

  .side-button { width: 38px; height: 38px; }

  .brand-subtitle { display: none; }
}

@media (max-width: 480px) {
  .topbar { min-height: 58px; }
  .app-frame { min-height: calc(100 * min(var(--vh, 1vh), 1vh) - 58px); }
  .dashboard-shell { padding: 10px; }
  .panel-heading, .panel-body { padding-left: 12px; padding-right: 12px; }
  .profile-label { display: none; }
}

/* ===== Passengers table ===== */
.pdf-badge {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #b8860a;
  border-radius: 8px;
  background: #fbe4a1;
}

.passenger-name-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 4px;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  border-radius: 6px;
  transition: color .2s ease, background .2s ease;
}

.passenger-name-button:hover {
  color: var(--blue-dark);
  background: #eef7f8;
}

.passenger-avatar {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--blue);
}

.passenger-name-text { min-width: 0; }

/* ===== Passenger modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 34, 48, .45);
}

.modal-overlay[hidden] { display: none; }

.modal-panel {
  width: 100%;
  max-width: 360px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border-radius: 16px;
  background: white;
  box-shadow: 0 24px 60px rgba(6, 40, 55, .3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.modal-field {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f5f7;
  font-size: 13px;
}

.modal-label { color: #6a7f8d; }
.modal-value { color: var(--ink); font-weight: 700; }

@media (max-width: 480px) {
  .modal-panel { max-width: 100%; }
}

.service-line-table {
  min-width: 0;
  table-layout: fixed;
}

.service-line-table th:not(:first-child),
.service-line-table td:not(:first-child) {
  text-align: center;
}

.service-line-table th:nth-child(1) { width: auto; }
.service-line-table th:nth-child(2) { width: 44px; }
.service-line-table th:nth-child(3) { width: 60px; }
.service-line-table th:nth-child(4) { width: 68px; }
.service-line-table th:nth-child(5) { width: 84px; }
.service-line-table th:nth-child(6) { width: 44px; }

.service-name-cell,
.service-price-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-name-cell {
  align-items: flex-start;
  overflow-wrap: break-word;
}

.service-name-cell .min-w-0 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.service-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--blue);
}

.pax-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  color: white;
  border-radius: 999px;
  background: #e0a63a;
  font-weight: 700;
  font-size: 12px;
}

/* ===== Add Services modal ===== */
.services-modal-panel {
  max-width: min(960px, calc(100vw - 32px));
}

.services-modal-header {
  background: linear-gradient(110deg, var(--blue-dark), var(--blue));
}

.services-modal-header h3 { color: white; }

.services-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.services-modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(110deg, var(--blue-dark), var(--blue));
}

.services-day-select,
.services-type-select {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--ink);
  border: none;
  border-radius: 8px;
  background: white;
  font-size: 13px;
  font-weight: 600;
}

.services-modal-search {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--ink);
  border: none;
  border-radius: 8px;
  background: white;
  font-size: 13px;
}

.services-modal-icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  place-items: center;
  color: #7a5a08;
  border-radius: 8px;
  background: #f2c14e;
  transition: .2s ease;
}

.services-modal-icon-button:hover { background: #e8b23a; }

.service-catalog-table {
  min-width: 640px;
  font-size: 13px;
}

.service-catalog-table th {
  background: linear-gradient(110deg, var(--blue-dark), var(--blue));
  color: white;
}

.service-catalog-table th:first-child { width: 44px; }

.catalog-add-button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #7a5a08;
  border-radius: 7px;
  background: #f2c14e;
  transition: .2s ease;
}

.catalog-add-button:hover { background: #e8b23a; }

.services-modal-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pagination-button {
  min-width: 34px;
  min-height: 30px;
  padding: 4px 8px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  transition: .2s ease;
}

.pagination-button:hover:not(:disabled) { background: #eef7f8; }
.pagination-button:disabled { color: #b7c4cb; cursor: not-allowed; }

.pagination-button.is-active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.pagination-ellipsis { padding: 0 2px; color: #6a7f8d; }

.services-modal-legend {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #54707e;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-swatch-unavailable { background: #f3c6c6; }

/* ===== Days manager ===== */
.days-manager-group {
  display: flex;
  width: fit-content;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.days-manager-button {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 7px 8px;
  color: #54707e;
  border-right: 1px solid var(--line);
  transition: .2s ease;
}

.days-manager-button:last-child { border-right: none; }

.days-manager-button:hover {
  color: var(--blue-dark);
  background: #eef7f8;
}

.days-manager-button:disabled {
  color: #c3cfd4;
  cursor: not-allowed;
  background: none;
}

/* ===== Passenger detail modal ===== */
.passenger-modal-panel {
  max-width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
}

.passenger-modal-panel .services-modal-header h3 { color: white; }

.passenger-modal-action {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  transition: .2s ease;
}

.passenger-modal-save { color: #7a5a08; background: #f2c14e; }
.passenger-modal-save:hover { background: #e8b23a; }
.passenger-modal-discard { color: white; background: var(--danger); }
.passenger-modal-discard:hover { opacity: .9; }

.passenger-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  overflow-y: auto;
}

.passenger-modal-fieldset {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.passenger-modal-fieldset legend {
  padding: 0 6px;
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
}

.passenger-modal-subtitle {
  margin: 4px 0 10px;
  color: #54707e;
  font-style: italic;
  text-decoration: underline;
  font-size: 13px;
}

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

.passenger-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.passenger-field em {
  color: var(--danger);
  font-style: normal;
}

.passenger-field input,
.passenger-field select,
.passenger-field textarea {
  padding: 7px 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  background: white;
}

.passenger-field textarea { resize: vertical; }

.passenger-field-wide { grid-column: 1 / -1; }

.upload-icon-button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #7a5a08;
  border-radius: 7px;
  background: #f2c14e;
}

.passport-upload-preview {
  display: grid;
  width: 96px;
  height: 96px;
  margin-top: 10px;
  place-items: center;
  color: #b7c4cb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.flight-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.flight-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.flight-column-heading {
  margin: 0;
  padding: 8px;
  color: white;
  background: #2c3e4f;
  font-weight: 700;
  text-align: center;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 13px;
}

.flight-column .passenger-field { padding: 0 10px; }
.flight-column .passenger-field:last-child { padding-bottom: 10px; }

.yes-no-question {
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.yes-no-question p {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.yes-no-question p em {
  color: var(--danger);
  font-style: normal;
}

.yes-no-options {
  display: flex;
  align-items: center;
  gap: 16px;
}

.yes-no-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #54707e;
}

.yes-no-question-comment .passenger-field-comment {
  margin-top: 8px;
}

.passenger-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* ===== Create document modal ===== */
.document-price-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: .2s ease;
}

.document-price-option:hover { border-color: #8bcbd4; }

.document-price-option:has(input:checked) {
  border-color: var(--blue);
  background: #eef7f8;
}

.document-price-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

/* ===== Status indicator (traffic light) ===== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  font-weight: 700;
  font-size: 12px;
  color: white;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: currentColor;
}

.status-pill[data-status="open"] .status-dot { color: #f2b134; }
.status-pill[data-status="confirmed"] .status-dot { color: #20a66a; }
.status-pill[data-status="cancelled"] .status-dot { color: #d65353; }
