#main:has(.tm-page) {
  width: min(calc(100% - 48px), 1280px);
  max-width: 1280px;
}
.info-page.tm-page {
  width: 100%;
  max-width: none;
  margin-inline: auto;
}
.tm-head { margin-bottom: 18px; }
.tm-head h1 { margin-bottom: 8px; }
.tm-lead { margin: 0; color: var(--muted, #5c6670); font-size: 1rem; line-height: 1.5; max-width: 78ch; }
.tm-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.tm-page .tm-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(256px, 22%, 292px);
  grid-template-rows: auto clamp(560px, 80svh, 840px);
  border: 1px solid var(--line, #e2e6ea);
  border-radius: 12px;
  background: var(--card, #fff);
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: 0 2px 10px rgba(16, 24, 40, .04);
}
.tm-toolbar, .tm-grid { display: contents; }
.tm-search-wrap, .tm-filters {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line, #e2e6ea);
  background: var(--bg, #f7f8fa);
}
.tm-filters {
  grid-column: 1;
  grid-row: 1;
  flex-wrap: wrap;
  gap: 6px;
}
.tm-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line, #d7dde3);
  border-radius: 999px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.tm-filter:hover { border-color: var(--tm-type, var(--accent, #1d6fd6)); }
.tm-filter.is-active {
  background: var(--tm-type, var(--region-ink, var(--accent, #1d6fd6)));
  border-color: var(--tm-type, var(--region-ink, var(--accent, #1d6fd6)));
  color: #fff;
}
.tm-filter.is-active .tm-dot { background: #fff; }
.tm-filter.is-active .tm-count { background: rgba(255, 255, 255, .22); color: #fff; }
.tm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tm-type, #1d6fd6);
  flex: none;
}
.tm-count {
  font-size: .78rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .07);
}
.tm-search-wrap {
  grid-column: 2;
  grid-row: 1;
  padding-inline: 10px;
  border-left: 1px solid var(--line, #e2e6ea);
}
.tm-search {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--line, #d0d7de);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: .92rem;
}
.tm-search:focus { outline: 2px solid var(--accent, #1d6fd6); outline-offset: 1px; }

.tm-map-col { grid-column: 1; grid-row: 2; position: relative; min-width: 0; min-height: 0; }
.tm-map-wrap { position: relative; height: 100%; }
.tm-map { width: 100%; height: 100%; z-index: 1; background: #eef1f4; }

.tm-active-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(20, 27, 36, .92);
  color: #fff;
  font-size: .88rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}
.tm-active-bar[hidden] { display: none; }
.tm-reset-btn {
  flex: none;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #141b24;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.tm-reset-btn:hover { background: #e8edf2; }

.tm-sidebar {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line, #e2e6ea);
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  min-width: 0;
  background: var(--card, #fff);
}
.tm-list-head {
  flex: none;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line, #e2e6ea);
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted, #5c6670);
  background: var(--bg, #f9fafb);
}
.tm-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.tm-item {
  display: flex;
  flex: none;
  align-items: baseline;
  gap: 8px;
  min-height: 44px;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.tm-item + .tm-item { border-top: 1px solid var(--line, #dcd8d9); }
.tm-item:focus-visible { outline-offset: -2px; }
.tm-item:hover { background: var(--bg, #f4f6f8); }
.tm-item.is-selected {
  background: rgba(29, 111, 214, .08);
  border-color: var(--accent, #1d6fd6);
}
.tm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 4px 7px;
  border-radius: 6px;
  color: #fff;
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.15;
  flex: none;
}
.tm-item .tm-badge { min-width: 34px; padding: 3px 5px; }
.tm-item-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tm-item-type { font-size: .9rem; font-weight: 650; line-height: 1.25; }
.tm-item-dir { font-size: .82rem; color: var(--muted, #5c6670); line-height: 1.3; word-break: break-word; }
.tm-empty { padding: 18px 12px; color: var(--muted, #5c6670); font-size: .9rem; margin: 0; }

.tm-detail {
  flex: none;
  border-bottom: 2px solid var(--line, #e2e6ea);
  padding: 10px 12px;
  background: #fbfcfd;
  max-height: clamp(160px, 24svh, 208px);
  overflow-y: auto;
}
.tm-detail[hidden] { display: none; }
.tm-detail-top { display: flex; align-items: flex-start; gap: 10px; }
.tm-detail-titles { flex: 1 1 auto; min-width: 0; }
.tm-detail-type { display: block; font-size: .96rem; line-height: 1.25; }
.tm-detail-dir { margin: 3px 0 0; font-size: .84rem; color: var(--muted, #5c6670); line-height: 1.35; }
.tm-detail-close {
  border: 0;
  background: transparent;
  color: var(--muted, #5c6670);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.tm-detail-close:hover { color: inherit; }
.tm-detail-meta { margin: 8px 0 8px; font-size: .8rem; font-weight: 600; color: var(--muted, #5c6670); }
.tm-stops-list {
  margin: 0;
  padding-left: 20px;
  font-size: .84rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tm-stop-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tm-stop-btn:hover { color: var(--accent, #1d6fd6); text-decoration: underline; }

.tm-article h2 { margin-top: 28px; margin-bottom: 12px; }
.tm-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin: 18px 0 24px;
}
.tm-stat {
  padding: 12px 14px;
  border: 1px solid var(--line, #e2e6ea);
  border-left: 4px solid var(--tm-type, var(--accent, #1d6fd6));
  border-radius: 8px;
  background: var(--card, #fff);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tm-stat strong { font-size: 1.35rem; line-height: 1.1; }
.tm-stat span { font-size: .86rem; color: var(--muted, #5c6670); }

.tm-group { margin-bottom: 18px; }
.tm-group h3 { margin: 0 0 10px; font-size: 1.05rem; }
.tm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-chip {
  padding: 5px 10px;
  border: 1px solid var(--line, #d7dde3);
  border-left: 3px solid var(--tm-type, #1d6fd6);
  border-radius: 6px;
  background: var(--card, #fff);
  color: inherit;
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.tm-chip:hover {
  background: var(--bg, #f4f6f8);
  border-color: var(--tm-type, #1d6fd6);
}

.tm-faq { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.tm-faq-item {
  padding: 14px 16px;
  border: 1px solid var(--line, #e2e6ea);
  border-radius: 10px;
  background: var(--card, #fff);
}
.tm-faq-item h3 { margin: 0 0 6px; font-size: 1.02rem; line-height: 1.35; }
.tm-faq-item p { margin: 0; font-size: .95rem; line-height: 1.55; }
.tm-faq-link {
  margin-top: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line, #d7dde3);
  border-radius: 6px;
  background: var(--bg, #f7f8fa);
  color: var(--accent, #1d6fd6);
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}
.tm-faq-link:hover { border-color: var(--accent, #1d6fd6); background: #fff; }

.tm-page > .tm-article, .tm-page > .reference-sources {
  width: 100%;
  max-width: none;
  margin-inline: auto;
}
@media (max-width: 800px) {
  #main:has(.tm-page) { width: calc(100% - 24px); padding-inline: 0; }
  .tm-page .tm-app { display: flex; flex-direction: column; }
  .tm-search-wrap { order: 0; padding: 10px; border-left: 0; }
  .tm-filters { order: 1; flex-wrap: nowrap; overflow-x: auto; padding: 6px 10px 9px; }
  .tm-filter { flex: none; }
  .tm-map-col { order: 2; }
  .tm-map-wrap { height: auto; }
  .tm-map { height: clamp(300px, 48svh, 480px); }
  .tm-active-bar { position: static; border-radius: 0; box-shadow: none; }
  .tm-sidebar { order: 3; max-height: 450px; border: 0; }
  .tm-detail { max-height: 155px; }
  .tm-list { flex-basis: auto; }
}
@media (min-width: 801px) and (max-height: 550px) {
  .tm-page .tm-app { grid-template-rows: auto clamp(280px, 80svh, 480px); }
}
