:root {
  --rm-ink: var(--pod-ink, #18201d);
  --rm-muted: var(--pod-muted, #617068);
  --rm-line: var(--pod-line, #d5dfd9);
  --rm-panel: var(--pod-panel, #f2f6f3);
  --rm-card: var(--pod-card, #fff);
  --rm-accent: var(--pod-accent, #0f6b57);
  --rm-accent-2: var(--pod-accent-2, #c45c26);
  --rm-font: var(--pod-font, "Segoe UI", Candara, "Trebuchet MS", sans-serif);
  --rm-navbar: var(--pod-navbar, 56px);
}

body.route-map-page {
  font-family: var(--rm-font);
  color: var(--rm-ink);
  background: #e7ede9;
}

body.route-map-page main.main-fullwidth > .container-fluid {
  max-width: none;
  padding: var(--rm-navbar) 0 0 !important;
}

body.route-map-page main.main-fullwidth > .container-fluid > nav[aria-label="breadcrumb"],
body.route-map-page main.main-fullwidth > .container-fluid > nav[aria-label="breadcrumb"] .breadcrumb {
  margin: 0 !important;
  margin-bottom: 0 !important;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

body.route-map-page .footer {
  position: relative;
  z-index: 3;
}

.rm-app {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  min-height: calc(100vh - var(--rm-navbar) - 160px);
  height: calc(100dvh - var(--rm-navbar) - 140px);
  background: #e7ede9;
}

.rm-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow: auto;
  min-height: 0;
  background:
    radial-gradient(900px 320px at -20% -10%, rgba(15, 107, 87, 0.1), transparent 55%),
    linear-gradient(180deg, #f8fbf9, var(--rm-panel));
  border-right: 1px solid var(--rm-line);
}

.rm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rm-brand__title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.rm-brand__sub {
  font-size: 0.8rem;
  color: var(--rm-muted);
}

.rm-block {
  background: var(--rm-card);
  border: 1px solid var(--rm-line);
  border-radius: 14px;
  padding: 14px;
}

.rm-block__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.rm-block__toggle:focus-visible {
  outline: 2px solid rgba(15, 107, 87, 0.35);
  outline-offset: 2px;
  border-radius: 6px;
}

.rm-block__title {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rm-muted);
  font-weight: 700;
}

.rm-block__chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  position: relative;
}

.rm-block__chevron::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-right: 2px solid var(--rm-muted);
  border-bottom: 2px solid var(--rm-muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  transform-origin: center;
}

.rm-block:not(.rm-block--collapsed) .rm-block__chevron::before {
  inset: 5px 4px 3px;
  transform: rotate(-135deg);
}

.rm-block__body {
  margin-top: 10px;
}

.rm-block--collapsed .rm-block__body {
  display: none;
}

.rm-block--collapsed {
  padding-top: 12px;
  padding-bottom: 12px;
}

.rm-block__toggle .rm-block__title {
  margin: 0;
}

.rm-hint {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--rm-muted);
  line-height: 1.45;
}

.rm-hint code {
  font-size: 0.78rem;
  word-break: break-all;
}

.rm-pdf-dropzone {
  position: relative;
  margin: 0 0 10px;
  border: 1.5px dashed #b7c5bd;
  border-radius: 12px;
  background: #f7faf8;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rm-pdf-dropzone:hover,
.rm-pdf-dropzone--active {
  border-color: var(--rm-accent);
  background: rgba(15, 107, 87, 0.06);
}

.rm-pdf-dropzone--busy {
  pointer-events: none;
  opacity: 0.7;
}

.rm-pdf-dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.rm-pdf-dropzone__content {
  padding: 14px 12px;
  text-align: center;
  pointer-events: none;
}

.rm-pdf-dropzone__icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 6px;
  color: var(--rm-accent);
  display: block;
}

.rm-pdf-dropzone__text {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--rm-ink);
}

.rm-pdf-dropzone__hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--rm-muted);
}

.rm-textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--rm-line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fbfcfb;
  margin-bottom: 10px;
}

.rm-textarea:focus {
  outline: 2px solid rgba(15, 107, 87, 0.25);
  border-color: var(--rm-accent);
}

.rm-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.rm-actions .rm-btn--primary {
  flex: 1;
  min-width: 0;
}

.rm-btn {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.rm-btn + .rm-btn { margin-top: 8px; }

.rm-actions .rm-btn + .rm-btn {
  margin-top: 0;
}

.rm-btn--primary {
  background: linear-gradient(135deg, #12856c, var(--rm-accent));
  color: #fff;
}

.rm-btn--primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.rm-btn--ghost {
  background: transparent;
  border: 1px solid var(--rm-line);
  color: var(--rm-muted);
}

.rm-btn--icon {
  width: 44px;
  min-width: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 1px solid var(--rm-line);
  border-radius: 11px;
  background: #fff;
  color: var(--rm-muted);
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 500;
}

.rm-btn--icon:hover {
  border-color: #9a3412;
  color: #9a3412;
  background: #fff7f5;
}

.rm-share--group {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.rm-status {
  font-size: 0.92rem;
  color: var(--rm-muted);
  margin-bottom: 10px;
}

.rm-status.is-ok { color: var(--rm-accent); }
.rm-status.is-error { color: #9a3412; }

.rm-meta__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #eef2f0;
  font-size: 0.9rem;
}

.rm-meta__row span { color: var(--rm-muted); }
.rm-meta__row strong { text-align: right; white-space: pre-line; }

.rm-meta__row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.rm-meta__row--stack strong {
  text-align: left;
  font-weight: 600;
}

.rm-mass {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--rm-ink);
}

.rm-mass__total {
  margin-bottom: 6px;
}

.rm-mass__axles {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 18px;
  font-weight: 400;
}

.rm-mass__axles-label {
  color: var(--rm-muted);
  white-space: nowrap;
}

.rm-mass__axle {
  display: inline-block;
  white-space: nowrap;
  color: var(--rm-ink);
}

.rm-mass__axle-num {
  font-weight: 700;
}

.rm-meta__link {
  display: inline-block;
  margin-top: 10px;
  color: var(--rm-accent);
  font-size: 0.88rem;
}

.rm-waypoints {
  margin: 12px 0 0;
  padding: 0 0 0 18px;
  max-height: 180px;
  overflow: auto;
  font-size: 0.82rem;
  color: var(--rm-muted);
}

.rm-waypoints li { margin-bottom: 6px; }

.rm-waypoints__item {
  cursor: pointer;
}

.rm-waypoints__item:hover {
  color: var(--rm-accent);
}

.rm-map-wrap {
  position: relative;
  min-width: 0;
  min-height: 360px;
  height: 100%;
  overflow: hidden;
  background: #dce4df;
}

.rm-map {
  width: 100%;
  height: 100%;
  min-height: 360px;
}

.rm-legend {
  position: absolute;
  left: 16px;
  bottom: 20px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  max-width: calc(100% - 80px);
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--rm-line);
  box-shadow: var(--rm-shadow);
  font-size: 0.8rem;
  color: var(--rm-muted);
}

.rm-legend__badge {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.rm-legend__badge:hover {
  filter: brightness(1.08);
}

.rm-legend__a,
.rm-legend__b,
.rm-legend__via {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.rm-legend__a { background: var(--rm-accent); }
.rm-legend__b { background: var(--rm-accent-2); }
.rm-legend__via { background: #64748b; }

.rm-legend__route-label {
  font-size: 0.78rem;
  color: var(--rm-muted);
  margin-right: 4px;
  cursor: pointer;
}

.rm-legend__route-label:hover {
  color: var(--rm-accent);
}

.rm-legend__frames {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.rm-legend__frames--off {
  opacity: 0.4;
}

.rm-legend__frames-text {
  font-size: 0.8rem;
}

.rm-ol-zoom {
  top: auto !important;
  left: auto !important;
  right: 12px !important;
  bottom: 12px !important;
}

.rm-ol-zoom button {
  border-radius: 8px !important;
}

.ol-viewport {
  width: 100% !important;
  height: 100% !important;
}

.rm-route-select-wrap {
  margin-top: 10px;
}

.rm-route-select-wrap label {
  display: block;
  font-size: 0.78rem;
  color: var(--rm-muted);
  margin-bottom: 6px;
}

.rm-route-select {
  width: 100%;
  border: 1px solid var(--rm-line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: #fbfcfb;
}

.rm-frames-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--rm-line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}

.rm-frames-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--rm-accent);
}

.rm-frames-toggle__icon {
  width: 22px;
  height: 26px;
  flex-shrink: 0;
  background: url(../img/frame-marker.svg) no-repeat center / contain;
  opacity: 0.9;
}

.rm-frames-toggle__text {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--rm-ink);
}

.rm-legend__frame {
  display: inline-block;
  width: 18px;
  height: 22px;
  background: url(../img/frame-marker.svg) no-repeat center / contain;
  vertical-align: middle;
}

.rm-share label {
  display: block;
  font-size: 0.78rem;
  color: var(--rm-muted);
  margin-bottom: 6px;
}

.rm-share__row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.rm-share__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--rm-line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.8rem;
  background: #fbfcfb;
}

.rm-share__copy {
  width: auto;
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.rm-brand {
  justify-content: space-between;
}

.rm-panel-collapse {
  border: 1px solid var(--rm-line);
  background: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--rm-muted);
  display: none;
}

.rm-panel-open {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  background: linear-gradient(135deg, #12856c, var(--rm-accent));
  color: #fff;
  box-shadow: var(--rm-shadow);
  cursor: pointer;
}

.rm-along-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
}

.rm-along-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid #eef2f0;
  cursor: pointer;
}

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

.rm-along-item__num {
  flex-shrink: 0;
  min-width: 1.4em;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--rm-ink);
}

.rm-along-item strong {
  font-size: 0.88rem;
}

.rm-along-item span {
  font-size: 0.78rem;
  color: var(--rm-muted);
}

.rm-along-item:hover strong {
  color: var(--rm-accent);
}

.rm-history-empty {
  margin-bottom: 0;
}

.rm-history-empty[hidden] {
  display: none;
}

.rm-route-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rm-route-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid #eef2f0;
  cursor: pointer;
}

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

.rm-route-item--active {
  background: rgba(15, 107, 87, 0.06);
  border-radius: 8px;
}

.rm-route-item__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.rm-route-item__body {
  flex: 1;
  min-width: 0;
}

.rm-route-item__title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.rm-route-item__meta {
  font-size: 0.78rem;
  color: var(--rm-muted);
  margin-top: 2px;
}

.rm-route-item__actions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}

.rm-route-item__btn {
  border: 1px solid var(--rm-line);
  background: #fff;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  color: var(--rm-muted);
}

.rm-route-item__btn:hover {
  border-color: var(--rm-accent);
  color: var(--rm-accent);
}

.rm-route-item__btn--danger:hover {
  border-color: #9a3412;
  color: #9a3412;
}

.rm-route-result {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid #eef2f0;
}

.rm-route-result:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.rm-route-result--active {
  background: rgba(15, 107, 87, 0.04);
  margin-left: -8px;
  margin-right: -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 10px;
}

.rm-route-result__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--rm-ink);
}

.rm-route-result__title {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.rm-route-result__title:hover {
  color: var(--rm-accent);
}

.rm-frames-toggle {
  display: none !important;
}

.rm-route-result__copy {
  flex-shrink: 0;
  margin-left: auto;
  display: inline-grid;
  place-items: center;
}

.rm-route-result__copy svg {
  display: block;
}

.rm-route-result__copy.is-copied {
  border-color: var(--rm-accent);
  color: var(--rm-accent);
}

.rm-route-result__remove {
  flex-shrink: 0;
  margin-left: 0;
}

.rm-route-result__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rm-along-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef2f0;
}

.rm-along-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.rm-along-section__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--rm-ink);
}

.rm-along-section__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0;
}

.rm-along-section__title:hover {
  color: var(--rm-accent);
}

.rm-along-section__toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--rm-line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.rm-along-section__toggle::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-right: 2px solid var(--rm-muted);
  border-bottom: 2px solid var(--rm-muted);
  transform: rotate(-135deg);
  transition: transform 0.15s ease;
}

.rm-along-section--collapsed .rm-along-section__toggle::before {
  inset: 7px 8px 9px;
  transform: rotate(45deg);
}

.rm-along-section--collapsed .rm-along-section__body {
  display: none;
}

.rm-along-section__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 960px) {
  .rm-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 55vh);
    height: auto;
    min-height: 0;
  }

  .rm-panel {
    border-right: 0;
    border-bottom: 1px solid var(--rm-line);
    max-height: none;
  }

  .rm-panel-collapse {
    display: inline-grid;
    place-items: center;
  }

  .rm-map-wrap {
    min-height: 420px;
    height: 55vh;
  }

  .rm-app--panel-collapsed {
    grid-template-rows: minmax(70vh, calc(100dvh - var(--rm-navbar) - 80px));
  }

  .rm-app--panel-collapsed .rm-panel {
    display: none;
  }

  .rm-app--panel-collapsed .rm-map-wrap {
    height: calc(100dvh - var(--rm-navbar) - 80px);
    min-height: 70vh;
  }
}
