.routes__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 0 0 1.125rem;
  flex-wrap: wrap;
}

.routes__filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.routes__filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #666;
}

.routes__filter select {
  padding: 10px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  min-width: 190px;
  background: #fff;
}

/* ── таблица ─────────────────────────────────────────────────────────────── */

.routes-table thead th,
.routes-table tbody td {
  text-align: left;
  vertical-align: middle;
}

.routes-table thead th {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  padding: 10px 12px;
  white-space: nowrap;
}

.routes-table tbody td {
  font-size: 14px;
  padding: 12px;
}

.routes-table tbody tr[data-id] {
  height: auto;
  min-height: 64px;
}

.routes-table tbody tr[data-id] td {
  border-bottom: 1px solid #ececec;
}

.routes-table tbody tr.routes-row--city td:first-child {
  box-shadow: inset 3px 0 0 var(--color-accent, #cb9451);
}

.routes-table tbody tr.routes-row--intercity td:first-child {
  box-shadow: inset 3px 0 0 #5b8def;
}

.routes-table td[data-field^="price-"],
.routes-table th.routes-th--price {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.routes-table th.routes-th--price small {
  display: block;
  font-weight: 400;
  color: #888;
  font-size: 12px;
}

.routes-table th.routes-th--actions,
.routes-table td:last-child {
  text-align: right;
}

.routes-name {
  display: block;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
}

.routes-sub {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: #888;
  font-weight: 400;
}

.routes-cat {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}

.routes-cat--city {
  background: #fdf7ef;
  color: #8a6230;
}

.routes-cat--intercity {
  background: #eef3fc;
  color: #3d5a8a;
}

.routes-price-pair {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.3;
}

.routes-price-pair span {
  display: block;
}

.routes-price-pair em {
  font-style: normal;
  font-size: 11px;
  color: #999;
  font-weight: 400;
  margin-left: 6px;
}

.routes-empty-price {
  color: #c0c0c0;
}

.routes-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}

.routes-status--on {
  background: #e8f7e8;
  color: #2d8a2d;
}

.routes-status--off {
  background: #f3f3f3;
  color: #888;
}

.routes-row--off .routes-name,
.routes-row--off .routes-price-pair {
  color: #a0a0a0;
}

.routes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.routes-act {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 0 10px;
  min-width: 0;
  height: 32px;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  background: #fff;
  color: #444;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.routes-act:hover:not([disabled]) {
  border-color: var(--color-accent, #cb9451);
  color: #222;
}

.routes-act[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.routes-act--icon {
  width: 32px;
  padding: 0;
}

.routes-act--icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

.routes-act--danger:hover:not([disabled]) {
  border-color: #d32525;
  color: #d32525;
}

/* ── модалка: каркас, не наследует 24px/60px из .modal__actions ─────────── */

.modal.routes-modal {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 20px 20px 16px;
  overflow: hidden;
}

.modal.routes-modal.is-map-step {
  height: calc(100dvh - 24px);
}

.routes-modal .modal__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  padding-right: 36px;
}

.routes-modal__head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.routes-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.routes-modal__error {
  flex: 0 0 auto;
  margin: 8px 0 0;
}

.routes-modal__footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.routes-modal__nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.routes-modal__footer .routes-btn {
  min-width: 110px;
  height: 40px;
  font-size: 14px;
}

.routes-modal__footer .routes-btn--primary {
  min-width: 140px;
}

/* Поля внутри модалки — свой ритм, не 20px/258px из глобального .field */
.routes-modal .field {
  gap: 6px;
  min-width: 0;
}

.routes-modal .field > span:first-child {
  font-size: 13px;
  color: #666;
  line-height: 1.3;
}

.routes-modal .field input,
.routes-modal .field select,
.routes-modal .field textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 40px;
  max-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  background: #fff;
  font-size: 14px;
  line-height: 1.3;
  color: #222;
}

.routes-modal .field input::placeholder,
.routes-modal .field textarea::placeholder {
  color: #c8c8c8;
  font-weight: 400;
  opacity: 1;
}

.routes-modal .field input:focus,
.routes-modal .field select:focus {
  outline: none;
  border-color: var(--color-accent, #cb9451);
}

.routes-lead {
  margin: 0 0 16px;
  font-size: 14px;
  color: #777;
  line-height: 1.45;
}

.routes-form__row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.routes-form__row:last-child {
  margin-bottom: 0;
}

.routes-form__row > .field {
  flex: 1 1 180px;
}

.routes-form__grow {
  flex: 2 1 320px !important;
}

.routes-form__narrow {
  flex: 0 1 140px !important;
}

.routes-hint {
  margin: 0;
  font-size: 12px;
  color: #888;
  line-height: 1.4;
  font-weight: 400;
}

.routes-error {
  margin: 0;
  color: #d32525;
  font-size: 13px;
  line-height: 1.4;
}

.routes-block {
  margin-bottom: 22px;
}

.routes-block__title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.routes-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.routes-block__head .routes-block__title {
  margin-bottom: 0;
}

.routes-btn--text {
  height: auto;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--color-accent, #cb9451);
  font-size: 13px;
  font-weight: 600;
}

.routes-btn--text:hover:not([disabled]) {
  color: #161616;
  border-color: transparent;
}

.routes-wait {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eee;
  max-width: 380px;
}

.routes-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 440px;
  margin-top: 10px;
}

.routes-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #e6e6e6;
  border-radius: 2px;
  background: #fafafa;
  min-width: 0;
}

.routes-stat__label {
  font-size: 12px;
  color: #888;
  line-height: 1.2;
}

.routes-stat__control {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.routes-stat__control input {
  box-sizing: border-box;
  width: 100%;
  max-width: 96px;
  height: 32px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #ddd;
  border-radius: 0;
  background: transparent;
  font-size: 22px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #161616;
}

.routes-stat__control input:focus {
  outline: none;
  border-bottom-color: var(--color-accent, #cb9451);
}

.routes-stat__control input::placeholder {
  color: #ccc;
  font-weight: 500;
}

.routes-stat__unit {
  font-size: 13px;
  color: #888;
}

.routes-stat__extra {
  min-height: 16px;
  font-size: 12px;
  color: #888;
  line-height: 1.3;
}

/* ── шаги ────────────────────────────────────────────────────────────────── */

.routes-steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border: 1px solid #e4e4e4;
  border-radius: 2px;
  overflow: hidden;
  background: #f6f6f6;
}

.routes-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px 8px;
  border: 0;
  border-right: 1px solid #e4e4e4;
  background: transparent;
  color: #777;
  font-size: 13px;
  cursor: pointer;
  min-width: 0;
}

.routes-step:last-child {
  border-right: 0;
}

.routes-step__n {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #ccc;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.routes-step__t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.routes-step.is-active {
  background: #fff;
  color: #222;
  font-weight: 600;
}

.routes-step.is-active .routes-step__n {
  border-color: var(--color-accent, #cb9451);
  background: var(--color-accent, #cb9451);
  color: #fff;
}

.routes-step.is-complete:not(.is-active) .routes-step__n {
  border-color: #2d8a2d;
  background: #2d8a2d;
  color: #fff;
}

.routes-step.is-locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.routes-step-pane {
  flex: 1 1 auto;
  min-height: 0;
}

.routes-step-pane[data-step-pane="1"],
.routes-step-pane[data-step-pane="3"] {
  overflow-y: auto;
  padding-right: 4px;
}

.routes-step-pane[hidden] {
  display: none !important;
}

.routes-step-pane:not([hidden])[data-step-pane="2"] {
  display: grid;
  overflow: hidden;
  height: 100%;
}

.routes-modal.is-map-step .routes-map {
  min-height: 360px;
}

/* ── кнопки модалки: свои, без .btn / .modal__actions ────────────────────── */

.routes-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 14px;
  min-width: 0;
  height: 40px;
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  background: #fff;
  color: #333;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}

.routes-btn:hover:not([disabled]) {
  border-color: #999;
}

.routes-btn--primary {
  background: #161616;
  border-color: #161616;
  color: #fff;
  min-width: 140px;
}

.routes-btn--primary:hover:not([disabled]) {
  background: #2a2a2a;
  border-color: #2a2a2a;
}

.routes-btn[disabled],
.routes-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* ── сегментный переключатель ────────────────────────────────────────────── */

.routes-seg {
  display: flex;
  padding: 3px;
  gap: 3px;
  background: #f1f1f1;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
}

.routes-seg button {
  flex: 1;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 1px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: #777;
  line-height: 1.2;
}

.routes-seg button.is-active {
  background: #fff;
  color: #161616;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ── области и карта ─────────────────────────────────────────────────────── */

.routes-points {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
}

.routes-points__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.routes-tabs {
  display: flex;
  gap: 6px;
}

.routes-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  color: #666;
  min-width: 0;
}

.routes-tab.is-active {
  border-color: var(--color-accent, #cb9451);
  background: #fdf7ef;
  color: #222;
}

.routes-tab[data-side="to"].is-active {
  border-color: #5b8def;
  background: #eef3fc;
}

.routes-tab__letter {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.routes-tab__letter--from {
  background: #cb9451;
}

.routes-tab__letter--to {
  background: #5b8def;
}

.routes-tab:not(.is-active) .routes-tab__letter {
  opacity: 0.45;
}

.routes-tab__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.routes-tab__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.routes-tab__meta {
  font-size: 11px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.routes-search {
  display: flex;
  gap: 8px;
}

.routes-search input {
  flex: 1 1 auto;
  min-width: 0;
}

.routes-search .routes-btn {
  flex: 0 0 auto;
  padding: 0 12px;
}

.routes-zone__tools {
  display: flex;
  gap: 8px;
}

.routes-zone__tools .routes-btn {
  flex: 1;
  padding: 0 8px;
  font-size: 13px;
}

.routes-zone__info {
  color: #555;
}

.routes-map {
  position: relative;
  min-height: 0;
  height: 100%;
  border: 1px solid #e3e3e3;
  border-radius: 2px;
  overflow: hidden;
  background: #f4f4f4;
}

.routes-map__canvas {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.routes-map__hint {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 56px;
  z-index: 1;
  margin: 0;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  font-size: 13px;
  color: #222;
  line-height: 1.35;
  pointer-events: none;
}

.routes-map__legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.06);
  pointer-events: none;
  font-size: 12px;
  color: #555;
}

.routes-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #333;
}

.routes-swatch::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.routes-swatch--from::before {
  background: #cb9451;
}

.routes-swatch--to::before {
  background: #5b8def;
}

.routes-map__legend-note {
  color: #888;
}

.routes-map__error {
  position: absolute;
  inset: auto 12px 48px;
  z-index: 2;
  margin: 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #d32525;
  color: #d32525;
  font-size: 13px;
  border-radius: 2px;
}

/* ── цены ────────────────────────────────────────────────────────────────── */

.routes-prices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 560px;
}

.routes-price-row {
  display: grid;
  grid-template-columns: minmax(100px, 1.3fr) minmax(120px, 1fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
}

.routes-price-row:not(.routes-price-row__head) {
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}

.routes-price-row:not(.routes-price-row__head):last-child {
  border-bottom: 0;
}

.routes-price-row__head {
  font-size: 12px;
  color: #888;
  font-weight: 500;
  padding-bottom: 4px;
}

.routes-price-row__class {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.routes-price-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.routes-price-cell span {
  flex: 0 0 auto;
  font-size: 12px;
  color: #999;
}

.routes-price-row input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  text-align: right;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.routes-price-row input::placeholder {
  color: #c8c8c8;
}

.routes-price-row input:focus {
  outline: none;
  border-color: var(--color-accent, #cb9451);
}

/* ── тумблер в каталоге ──────────────────────────────────────────────────── */

.routes-table .routes-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.routes-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.routes-switch__ui {
  flex: 0 0 auto;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #d8d8d8;
  position: relative;
  transition: background 0.15s ease;
}

.routes-switch__ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.routes-switch input:checked + .routes-switch__ui {
  background: #2d8a2d;
}

.routes-switch input:checked + .routes-switch__ui::after {
  transform: translateX(16px);
}

.routes-switch input:focus-visible + .routes-switch__ui {
  outline: 2px solid var(--color-accent, #cb9451);
  outline-offset: 2px;
}

.routes-switch input:disabled + .routes-switch__ui {
  opacity: 0.45;
}

.routes-switch:has(input:disabled) {
  cursor: default;
}

.routes-switch__text {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .modal.routes-modal {
    width: calc(100vw - 16px);
    padding: 16px 14px 12px;
  }

  .routes-points {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(280px, 1fr);
  }

  .routes-points__panel {
    overflow: visible;
  }

  .routes-map {
    min-height: 280px;
  }

  .routes-step__t {
    font-size: 12px;
  }

  .routes-price-row {
    grid-template-columns: 1fr 1fr;
  }

  .routes-price-row__class {
    grid-column: 1 / -1;
  }

  .routes-stats {
    max-width: none;
  }
}

@media (max-height: 800px) {
  .modal.routes-modal {
    padding-top: 16px;
  }

  .routes-modal__head {
    gap: 10px;
    margin-bottom: 10px;
  }

  .routes-modal .modal__title {
    font-size: 18px;
  }

  .routes-step {
    padding: 8px 6px;
  }
}
