/* JapanTrak 2.4: czytelniejszy układ formularza wielopunktowej trasy */

@media (min-width: 1121px) {
  .modal.live-route-enabled {
    grid-template-columns: minmax(0, 820px) minmax(350px, 1fr);
    width: min(1240px, 100%);
  }
}

.modal.live-route-enabled > form {
  min-width: 0;
}

/* Punkty trasy są kolejnymi, niezależnymi kartami zamiast dwóch
   sztucznie wyrównanych kolumn o tej samej wysokości. */
.modal.live-route-enabled .address-sections.full {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.modal.live-route-enabled .address-card {
  align-self: start;
  min-width: 0;
}

/* Szersza karta pozwala zmieścić adres w dwóch krótkich rzędach. */
.modal.live-route-enabled .address-fields {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.modal.live-route-enabled .address-fields > label:nth-child(1) {
  grid-column: span 2;
}

.modal.live-route-enabled .address-fields > label:nth-child(2) {
  grid-column: span 2;
}

.modal.live-route-enabled .address-fields > label:nth-child(3) {
  grid-column: span 2;
}

.modal.live-route-enabled .address-fields > label:nth-child(4) {
  grid-column: span 3;
}

.modal.live-route-enabled .address-fields > label:nth-child(5) {
  grid-column: span 1;
}

.modal.live-route-enabled .address-fields > label:nth-child(6) {
  grid-column: span 2;
}

/* Dane klienta i rozliczenie tworzą dwa zwarte rzędy. */
.modal.live-route-enabled .stop-extra-fields {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.modal.live-route-enabled .stop-extra-fields > label:nth-child(1),
.modal.live-route-enabled .stop-extra-fields > label:nth-child(2) {
  grid-column: span 3;
}

.modal.live-route-enabled .stop-extra-fields > label:nth-child(3),
.modal.live-route-enabled .stop-extra-fields > label:nth-child(4),
.modal.live-route-enabled .stop-extra-fields > label:nth-child(5) {
  grid-column: span 2;
}

@media (max-width: 1120px) {
  .modal.live-route-enabled {
    grid-template-columns: minmax(0, 1fr);
    width: min(820px, 100%);
  }

  .modal.live-route-enabled .modal-head,
  .modal.live-route-enabled > form,
  .modal.live-route-enabled > .live-route-preview {
    grid-column: 1;
  }

  .modal.live-route-enabled > .live-route-preview {
    position: static;
  }
}

@media (max-width: 760px) {
  .modal.live-route-enabled .address-fields,
  .modal.live-route-enabled .stop-extra-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal.live-route-enabled .address-fields > label:nth-child(1),
  .modal.live-route-enabled .address-fields > label:nth-child(4),
  .modal.live-route-enabled .stop-extra-fields > label:nth-child(1),
  .modal.live-route-enabled .stop-extra-fields > label:nth-child(2),
  .modal.live-route-enabled .stop-extra-fields > label:nth-child(5) {
    grid-column: 1 / -1;
  }

  .modal.live-route-enabled .address-fields > label:nth-child(2),
  .modal.live-route-enabled .address-fields > label:nth-child(3),
  .modal.live-route-enabled .address-fields > label:nth-child(5),
  .modal.live-route-enabled .address-fields > label:nth-child(6),
  .modal.live-route-enabled .stop-extra-fields > label:nth-child(3),
  .modal.live-route-enabled .stop-extra-fields > label:nth-child(4) {
    grid-column: span 1;
  }
}

@media (max-width: 600px) {
  .modal.live-route-enabled .address-fields,
  .modal.live-route-enabled .stop-extra-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal.live-route-enabled .address-fields > label,
  .modal.live-route-enabled .stop-extra-fields > label {
    grid-column: 1 !important;
  }
}

/* JapanTrak 2.5: rozliczenie kilometrów na całej trasie. */
.route-distance-summary {
  background: #fffdf8;
  border: 1px solid #d8d3e5;
  border-radius: 10px;
  margin: 10px 0;
  overflow: hidden;
}

.route-distance-summary[hidden] {
  display: none;
}

.route-distance-title {
  color: #37334b;
  background: #f0eef7;
  border-bottom: 1px solid #dedbea;
  padding: 9px 11px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.route-distance-legs {
  margin: 0;
  padding: 5px 11px;
  list-style: none;
}

.route-distance-legs li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #ece9f2;
  padding: 7px 0;
  color: #6a657c;
  font-size: 10px;
}

.route-distance-legs li:last-child {
  border-bottom: 0;
}

.route-distance-legs strong {
  color: #292541;
  white-space: nowrap;
  font-size: 11px;
}

.route-distance-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #1f1e18;
  background: #ffef00;
  padding: 10px 11px;
  font-size: 11px;
  font-weight: 850;
}

.route-distance-total[hidden] {
  display: none;
}

.route-distance-total strong {
  white-space: nowrap;
  font-size: 16px;
}

.route-detail-distances {
  margin-top: 14px;
  break-inside: avoid;
}

.route-detail-distances .route-distance-title,
.route-detail-distances .route-distance-total {
  padding: 11px 13px;
}

.route-detail-distances .route-distance-legs {
  padding: 6px 13px;
}

.route-detail-distances .route-distance-legs li {
  font-size: 11px;
}

.route-distance-loading {
  color: #6a657c;
  margin: 0;
  padding: 12px 13px;
  font-size: 11px;
}

.route-distance-loading.is-error {
  color: #962d28;
  background: #ffedeb;
}

@media print {
  .route-distance-summary {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
