/* palette: override these variables in your template CSS to match the site */
.ts-schedule { --ts-accent: var(--tcts-brand, #17704a); --ts-accent-soft: #e5f2ea; --ts-line: var(--tcts-line, #cdd6d1); --ts-head: #f1f5f3; --ts-today: #fff3c9; --ts-today-strong: #fbe39a; --ts-past: #f0f2f1; --ts-muted: var(--tcts-muted, #66756e); --ts-weekend: var(--tcts-err, #c0392b); }
.ts-schedule .ts-meta { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; color: var(--bs-secondary-color, #6c757d); margin-bottom: .5rem; }
.ts-schedule .ts-counter { margin: .4rem 0 .15rem; font-size: .78rem; color: var(--ts-muted); }
/* ===== table: compact, with a full cell grid ===== */
.ts-schedule .ts-table-wrap { border: 1px solid var(--ts-line); border-radius: .5rem; overflow-x: auto; background: #fff; }
.ts-schedule .ts-table { width: 100%; margin: 0; border-collapse: collapse; border-spacing: 0; color: inherit; }
.ts-schedule .ts-table th,
.ts-schedule .ts-table td { border: 1px solid var(--ts-line) !important; padding: .28rem .45rem !important; font-size: .78rem !important; line-height: 1.25 !important; vertical-align: middle; background-clip: padding-box; }
/* no double border where the table meets the rounded wrapper */
.ts-schedule .ts-table tr > *:first-child { border-left: 0 !important; }
.ts-schedule .ts-table tr > *:last-child { border-right: 0 !important; }
.ts-schedule .ts-table thead tr:first-child > * { border-top: 0 !important; }
.ts-schedule .ts-table tbody tr:last-child > * { border-bottom: 0 !important; }

.ts-schedule .ts-table thead th { background: var(--ts-head); font-weight: 600; text-align: center; white-space: nowrap; }
.ts-schedule .ts-table thead th.ts-sticky,
.ts-schedule .ts-table thead th.ts-city-col,
.ts-schedule .ts-table thead th.ts-station-col { text-align: left; }
.ts-schedule .ts-matrix thead th.ts-dates-head { background: var(--ts-accent); border-color: var(--ts-accent) !important; color: #fff; letter-spacing: .02em; }
.ts-schedule .ts-group th { background: #e8eeeb; font-weight: 600; text-align: left; }
.ts-schedule .ts-group.ts-today th { background: var(--ts-today); }

/* day header */
.ts-schedule .ts-matrix .ts-day { min-width: 5.6rem; }
.ts-schedule .ts-matrix .ts-day-name { display: block; font-weight: 600; }
.ts-schedule .ts-matrix .ts-day-date { display: block; font-weight: 400; font-size: .7rem; color: var(--ts-muted); }
.ts-schedule .ts-matrix .ts-weekend .ts-day-name { color: var(--ts-weekend); }
.ts-schedule .ts-matrix thead th.ts-today { background: var(--ts-today); box-shadow: inset 0 -3px 0 #e9a912; }

/* left columns: train name, city, station */
.ts-schedule .ts-matrix { min-width: 900px; }
.ts-schedule .ts-matrix .ts-sticky { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 9.5rem; text-align: left; box-shadow: 1px 0 0 var(--ts-line); }
.ts-schedule .ts-matrix thead .ts-sticky { background: var(--ts-head); }
.ts-schedule .ts-city-col { min-width: 5.5rem; text-align: left; font-weight: 600; }
.ts-schedule .ts-station-col { min-width: 7rem; text-align: left; color: var(--ts-muted); }
.ts-schedule .ts-service-name { font-weight: 600; }
.ts-schedule .ts-service-code { margin-left: .3rem; padding: .02rem .3rem; border-radius: .25rem; background: #e7edea; color: #4f5f58; font-size: .66rem; font-weight: 600; white-space: nowrap; }
.ts-schedule .ts-matrix tbody tr:hover > th,
.ts-schedule .ts-matrix tbody tr:hover > td.ts-city-col,
.ts-schedule .ts-matrix tbody tr:hover > td.ts-station-col { background: #f4f9f6; }

/* day cells */
.ts-schedule .ts-matrix .ts-cell { text-align: center; min-width: 5.6rem; }
.ts-schedule .ts-matrix .ts-has-trip { background: var(--ts-accent-soft); }
.ts-schedule .ts-matrix .ts-cell.ts-today { background: var(--ts-today); }
.ts-schedule .ts-matrix .ts-has-trip.ts-today { background: var(--ts-today-strong); }
.ts-schedule .ts-matrix .ts-has-trip.ts-past { background: var(--ts-past); }

/* train number badge */
.ts-schedule .ts-train { display: inline-block; margin: .05rem .1rem; padding: .08rem .38rem; border-radius: .3rem; background: var(--ts-accent); color: #fff; font-size: .76rem; font-weight: 600; line-height: 1.3; cursor: default; }
.ts-schedule .ts-train small { margin-left: .15rem; font-size: .62rem; font-weight: 500; opacity: .9; }
.ts-schedule .ts-past .ts-train { background: #94a09a; }
.ts-schedule .ts-train:target { outline: 3px solid #e9a912; }
.ts-schedule .ts-matrix .ts-arr { display: block; margin-top: .1rem; font-size: .66rem; line-height: 1.15; color: var(--ts-muted); white-space: nowrap; }
.ts-schedule .ts-arr-label { text-transform: lowercase; opacity: .85; }
.ts-schedule .ts-row.ts-past { opacity: .62; }

/* list mode */
.ts-schedule .ts-list thead th { text-align: left; }
.ts-schedule .ts-list tbody tr:hover > td { background: #f4f9f6; }

.ts-schedule .ts-pagination { margin-top: 1rem; }
.ts-schedule .ts-hint { margin: 0 0 .5rem; font-size: .78rem; }
@media (max-width: 575.98px) {
  .ts-schedule .ts-matrix .ts-sticky { min-width: 7.5rem; }
}

/* direction summary (shown when a destination city is selected) */
.ts-schedule .ts-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1.1rem; margin: 0 0 .6rem; padding: .4rem .75rem; border: 1px solid var(--ts-line); border-radius: .5rem; background: var(--ts-accent-soft); font-size: .82rem; }
.ts-schedule .ts-summary-title strong { font-size: .95rem; }
.ts-schedule .ts-summary-item strong { margin-left: .2rem; font-size: 1.05rem; color: var(--ts-accent); }
.ts-schedule .ts-summary-note { margin-left: auto; font-size: .68rem; color: var(--ts-muted); }

/* waiting-time analysis block: compact lines one under another */
.ts-schedule .ts-waits { margin: 0 0 .9rem; padding: .55rem .85rem; border: 1px solid var(--ts-line); border-left: 4px solid var(--ts-accent); border-radius: .5rem; background: #f8faf9; }
.ts-schedule .ts-waits-title { margin: 0 0 .3rem; padding: 0; font-size: .9rem; font-weight: 600; line-height: 1.3; }
.ts-schedule .ts-waits-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: max-content max-content; justify-content: start; gap: .1rem 1.25rem; }
.ts-schedule .ts-waits-list li { display: contents; }
.ts-schedule .ts-wait-dest { font-size: .85rem; color: var(--ts-muted); }
.ts-schedule .ts-wait-days { font-size: .85rem; white-space: nowrap; }
.ts-schedule .ts-wait-days strong { font-size: .95rem; color: var(--ts-accent); }

/* switch: by weeks / by days */
.ts-schedule .ts-modes { display: inline-flex; gap: 2px; margin: .1rem 0 .7rem; padding: 2px; border: 1px solid var(--ts-line); border-radius: .5rem; background: #fff; }
.ts-schedule .ts-mode { display: inline-block; padding: .28rem 1rem; border-radius: .4rem; font-size: .82rem; font-weight: 600; line-height: 1.2; text-decoration: none !important; color: #4f5f58 !important; cursor: pointer; }
.ts-schedule .ts-mode:hover { background: #eef3f0; }
.ts-schedule .ts-mode.active { background: var(--ts-accent); color: #fff !important; }

/* compact one-line filter bar (own flex layout: the site template may not ship Bootstrap's grid) */
.ts-schedule .ts-filters { margin: 0 0 .75rem; padding: .55rem .7rem; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .5rem; background: var(--bs-tertiary-bg, #f8f9fa); }
.ts-schedule .ts-filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .45rem .6rem; }
.ts-schedule .ts-f { display: flex; flex-direction: column; min-width: 0; margin: 0; }
.ts-schedule .ts-f-search { flex: 2 1 12rem; }
.ts-schedule .ts-f-select { flex: 1.3 1 8.5rem; }
.ts-schedule .ts-f-date { flex: 1 1 8rem; min-width: 7.6rem; }
.ts-schedule .ts-f label { display: block; margin: 0 0 .15rem !important; padding: 0; font-size: .72rem !important; line-height: 1.1; font-weight: 500; color: var(--bs-secondary-color, #6c757d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-schedule .ts-f input,
.ts-schedule .ts-f select { width: 100%; height: 2rem !important; min-height: 0 !important; margin: 0 !important; padding: .2rem .5rem !important; font-size: .85rem !important; line-height: 1.2 !important; border-radius: .4rem !important; box-sizing: border-box; }
.ts-schedule .ts-f input[type="date"] { padding-right: .3rem !important; }
.ts-schedule .ts-filter-actions { display: flex; flex: 0 0 auto; gap: .35rem; margin: 0; }
.ts-schedule .ts-filter-actions .btn { height: 2rem !important; min-height: 0 !important; margin: 0 !important; padding: 0 .9rem !important; font-size: .85rem !important; line-height: 1 !important; white-space: nowrap; border-radius: .4rem !important; }
@media (max-width: 640px) {
  .ts-schedule .ts-f-search { flex-basis: 100%; }
  .ts-schedule .ts-f-select, .ts-schedule .ts-f-date { flex: 1 1 calc(50% - .4rem); }
}

/* ===== "Накопление поездов" page ===== */
.ts-schedule .ts-intro { margin: 0 0 .8rem; }
.ts-schedule .ts-accum { min-width: 700px; }
.ts-schedule .ts-accum .ts-num { text-align: center; white-space: nowrap; }
.ts-schedule .ts-accum .ts-wait-cell { font-weight: 600; }
.ts-schedule .ts-accum .ts-cell { min-width: 3.4rem; }
.ts-schedule .ts-accum .ts-day { min-width: 3.4rem; }
/* narrow value columns: Назначено / Принято / КП / Срок */
.ts-schedule .ts-accum th.ts-numhead,
.ts-schedule .ts-accum td.ts-num { width: 1%; padding-left: .35rem !important; padding-right: .35rem !important; white-space: nowrap; }
.ts-schedule .ts-accum th.ts-numhead { text-align: center; }
.ts-schedule .ts-accum-page .ts-table-wrap { min-height: 9rem; }
.ts-schedule .ts-accum tfoot th { background: var(--ts-head); font-weight: 600; text-align: center; }
.ts-schedule .ts-accum tfoot th.ts-sticky { text-align: left; }
.ts-schedule .ts-ukp { display: inline-block; padding: .05rem .38rem; border-radius: .3rem; background: var(--ts-accent); color: #fff; font-size: .74rem; font-weight: 600; line-height: 1.3; white-space: nowrap; cursor: default; }
.ts-schedule .ts-ukp-plan { background: #fff; color: var(--ts-accent); border: 1px dashed var(--ts-accent); }
.ts-schedule .ts-past .ts-ukp { background: #94a09a; }
.ts-schedule .ts-past .ts-ukp-plan { background: #fff; color: #94a09a; border-color: #94a09a; }

/* ===== terminal schedule (vsct.info) ===== */
.ts-schedule .ts-vsct { min-width: 720px; }
.ts-schedule .ts-vsct .ts-date { white-space: nowrap; }
.ts-schedule .ts-vsct .ts-num { text-align: center; white-space: nowrap; }
.ts-schedule .ts-vsct tbody tr:hover > td { background: #f4f9f6; }
.ts-schedule .ts-vsct .ts-today-row > td { background: var(--ts-today); font-weight: 600; }

/* tooltip on hover / focus (works with the keyboard and on tap) */
.ts-schedule .ts-tip { position: relative; display: inline-block; cursor: help; border-bottom: 1px dotted currentColor; outline: none; }
.ts-schedule .ts-tip::after { content: attr(data-tip); position: absolute; z-index: 30; top: calc(100% + .4rem); left: 50%; transform: translateX(-50%); width: max-content; max-width: 15rem; padding: .4rem .6rem; border-radius: .4rem; background: #1f2a26; color: #fff; font-size: .72rem; font-weight: 400; line-height: 1.35; text-align: left; white-space: normal; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s; }
.ts-schedule .ts-tip:hover::after,
.ts-schedule .ts-tip:focus::after { opacity: 1; visibility: visible; }
.ts-schedule .ts-vsct-page .ts-table-wrap { min-height: 9rem; }

/* ===== phone cards: shown instead of the wide table when one destination city is selected ===== */
.ts-schedule .ts-cards { display: none; }
.ts-schedule .ts-card { margin: 0 0 .6rem; padding: .6rem .75rem; border: 1px solid var(--ts-line); border-radius: .6rem; background: #fff; }
.ts-schedule .ts-card-title { margin: 0; padding: 0; font-size: .95rem; font-weight: 600; line-height: 1.3; }
.ts-schedule .ts-card-sub { margin: .15rem 0 .35rem; font-size: .78rem; color: var(--ts-muted); }
.ts-schedule .ts-card-list { margin: 0; padding: 0; list-style: none; }
.ts-schedule .ts-card-row { display: grid; grid-template-columns: 5.2rem 1fr; gap: .1rem .6rem; align-items: center; padding: .35rem 0; border-top: 1px dashed var(--ts-line); font-size: .82rem; }
.ts-schedule .ts-card-date { font-weight: 600; white-space: nowrap; }
.ts-schedule .ts-card-arr { grid-column: 2; font-size: .72rem; color: var(--ts-muted); }
.ts-schedule .ts-card-row.ts-past,
.ts-schedule .ts-card-trip.ts-past { opacity: .6; }
.ts-schedule .ts-card-row.ts-today-row,
.ts-schedule .ts-card-trip.ts-today-row { background: var(--ts-today); }
.ts-schedule .ts-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; margin: .4rem 0 .5rem; }
.ts-schedule .ts-metrics div { padding: .3rem .25rem; border-radius: .4rem; background: var(--ts-head); text-align: center; }
.ts-schedule .ts-metrics dt { font-size: .66rem; font-weight: 500; color: var(--ts-muted); }
.ts-schedule .ts-metrics dd { margin: 0; font-size: .95rem; font-weight: 600; }
.ts-schedule .ts-metrics small { font-size: .62rem; font-weight: 400; color: var(--ts-muted); }
.ts-schedule .ts-card-empty { margin: 0; font-size: .78rem; color: var(--ts-muted); }
.ts-schedule .ts-card-dates { font-size: .88rem; }
.ts-schedule .ts-card-transit { margin-left: .35rem; font-size: .72rem; color: var(--ts-muted); }
.ts-schedule .ts-card-route { margin: .15rem 0; font-size: .85rem; font-weight: 600; }
.ts-schedule .ts-card-status { font-size: .75rem; color: var(--ts-muted); }
@media (max-width: 640px) {
  .ts-schedule .ts-hide-mobile { display: none; }
  .ts-schedule .ts-cards { display: block; }
}

/* source link at the bottom, right above the disclaimer */
.ts-schedule .ts-source { margin: .7rem 0 .1rem; font-size: .78rem; }
.ts-schedule .ts-source + .ts-disclaimer { margin-top: 0; }

/* buttons to the other schedules, under the table */
.ts-schedule .ts-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; margin: 1rem 0 .4rem; }
.ts-schedule .ts-nav-label { font-size: .82rem; color: var(--ts-muted); }
.ts-schedule .ts-nav-btn { display: inline-block; padding: .35rem .9rem; border: 1px solid var(--ts-line); border-radius: .5rem; background: #fff; color: #4f5f58 !important; font-size: .82rem; font-weight: 600; line-height: 1.2; text-decoration: none !important; }
.ts-schedule .ts-nav-btn:hover,
.ts-schedule .ts-nav-btn:focus { background: var(--ts-accent); border-color: var(--ts-accent); color: #fff !important; }

/* note shown after a background update */
.ts-schedule .ts-refresh-note { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin: 0 0 .7rem; padding: .4rem .75rem; border: 1px solid var(--ts-line); border-radius: .5rem; background: var(--ts-accent-soft); font-size: .84rem; }

/* 2.1.1: кнопки перехода сверху, записи ВМРП по центру, реклама, листающаяся книга */
.ts-schedule .ts-nav { margin: 0 0 .6rem; }
.ts-schedule .ts-vsct td, .ts-schedule .ts-vsct th, .ts-schedule .ts-vsct .ts-city-col, .ts-schedule .ts-vsct .ts-station-col { text-align: center; }
.ts-schedule .ts-ad { max-width: 820px; margin: 14px auto 8px; padding: 14px 18px; border: 2px solid var(--tcts-dark, #16382b); border-radius: 12px; font-size: 18px; line-height: 1.4; text-align: center; }
.ts-schedule .ts-ad a, .ts-schedule .ts-ad a:hover { color: inherit; text-decoration: none; }
.ts-schedule .ts-ad__t { display: inline-block; transition: transform .4s ease; }
.ts-schedule .ts-ad:hover .ts-ad__t { transform: scale(1.06); }
.ts-schedule .ts-busy { display: flex; align-items: center; gap: 10px; margin: .5rem 0; font-size: .9rem; color: var(--ts-muted); }
.ts-schedule .ts-busy[hidden] { display: none; }
.ts-schedule .ts-book { flex: none; overflow: visible; }
.ts-schedule .ts-pg { transform-box: view-box; transform-origin: 32px 24px; animation: ts-flip 1.8s ease-in-out infinite; }
.ts-schedule .ts-pg--2 { animation-delay: .6s; }
.ts-schedule .ts-pg--3 { animation-delay: 1.2s; }
@keyframes ts-flip { 0% { transform: scaleX(1); opacity: 1; } 45% { transform: scaleX(-1); opacity: 1; } 55% { transform: scaleX(-1); opacity: 0; } 100% { transform: scaleX(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ts-schedule .ts-pg { animation: none; opacity: 0; } .ts-schedule .ts-pg--1 { opacity: 1; } }

/* 2.1.2: компактная шапка — неделя и кнопки расписаний в одной строке, меньше пустого места */
.ts-schedule .ts-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem 1rem; margin: 0 0 .4rem; }
.ts-schedule .ts-top .ts-meta { margin: 0; gap: .1rem 1rem; font-size: .88rem; }
.ts-schedule .ts-top .ts-nav { margin: 0; gap: .3rem .4rem; }
.ts-schedule .ts-nav-label { display: none; }
.ts-schedule .ts-nav-btn { padding: .2rem .65rem; font-size: .78rem; }
.ts-schedule .ts-heading { margin: 0 0 .4rem; }
.ts-schedule .ts-intro { margin: 0 0 .4rem; }
.ts-schedule .ts-waits { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem 1.1rem; margin: 0 0 .5rem; padding: .35rem .7rem; }
.ts-schedule .ts-waits-title { flex: 1 1 auto; margin: 0; font-size: .82rem; }
.ts-schedule .ts-waits-list { display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; }
.ts-schedule .ts-waits-list li { display: inline-flex; align-items: baseline; gap: .35rem; font-size: .82rem; }
.ts-schedule .ts-modes { margin: 0 0 .4rem; }
.ts-schedule .ts-mode { padding: .2rem .7rem; font-size: .8rem; }
.ts-schedule .ts-filters { margin: 0 0 .4rem; padding: .35rem .6rem; }
.ts-schedule .ts-counter { margin: .2rem 0 .1rem; }
.ts-schedule .ts-hint { margin: 0 0 .3rem; font-size: .72rem; }
.ts-schedule .ts-summary { margin: 0 0 .4rem; padding: .3rem .6rem; }
.ts-schedule .ts-ad { margin: 8px auto 4px; padding: 10px 14px; font-size: 16px; }
.ts-schedule .ts-source, .ts-schedule .ts-disclaimer { margin: .2rem 0; }

/* 2.1.3: переключатель вида иконками справа над таблицей, счётчик рейсов в блоке ожидания, без пустот */
.ts-schedule .ts-tools { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: 0 0 .3rem; }
.ts-schedule .ts-tools .ts-hint { flex: 1 1 auto; margin: 0; }
.ts-schedule .ts-tools .ts-counter { margin: 0; }
.ts-schedule .ts-tools .ts-modes { margin: 0 0 0 auto; flex: none; }
.ts-schedule .ts-mode { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 1.7rem; padding: 0; }
.ts-schedule .ts-waits { position: relative; margin: 0 0 .4rem; }
.ts-schedule .ts-waits-count { order: 2; margin-left: auto; font-size: .78rem; color: var(--ts-muted); white-space: nowrap; }
.ts-schedule .ts-waits-title { order: 1; flex: 1 1 auto; }
.ts-schedule .ts-waits-list { order: 3; flex: 1 1 100%; }
.ts-schedule .ts-top { margin-bottom: .3rem; }
.ts-schedule .ts-filters { margin: 0 0 .3rem; }

/* 2.1.3: накопление и ВМРП — счётчик в строке недели, плотные отступы */
.ts-schedule .ts-meta-count { margin-left: .25rem; padding: .05rem .5rem; border-radius: 1rem; background: var(--ts-accent-soft); color: var(--ts-accent); font-size: .78rem; font-weight: 600; align-self: center; }
.ts-schedule .ts-hint { margin: 0 0 .25rem; }
.ts-schedule .ts-cards { margin: 0 0 .4rem; gap: .4rem; }
.ts-schedule .ts-table-wrap { margin-top: 0; }
.ts-schedule .ts-accum-page .ts-table-wrap { min-height: 0; }
.ts-schedule .ts-refresh { margin: 0; }
.ts-schedule .alert { margin: 0 0 .4rem; padding: .4rem .7rem; }

.ts-schedule .ts-nav-btn--active,
.ts-schedule .ts-nav-btn--active:hover { background: var(--ts-accent); border-color: var(--ts-accent); color: #fff !important; cursor: default; }
