/* Шкала времени и плашка свежести (контракт v1.4, раздел 5). Подключён после app.css.
   Шкала - две строки: управление (вид «Сутки | Недели», «Вчера», «Последний», календарь) и дорожка окна
   7 / 14 / 30 суток с подписью дня недели и числа у каждой засечки; месяц - разделитель, «сегодня» - по
   судовым суткам. Высота шкалы задаёт --tl-h: по ней app.css отодвигает легенду, масштаб и тосты.
   Кегль не меньше 12 px, веса 400-500, красного нет. */

:root:root { --tl-base: 88px; --tl-h: var(--tl-base); }
@media (pointer: coarse) {
  :root:root { --tl-base: 120px; }
}
/* строка «новый прогноз ещё не загружен» прибавляет высоту шкалы */
:root:root.tl-has-stale { --tl-h: calc(var(--tl-base) + 26px); }

#timeline.timeline { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; gap: 2px; height: var(--tl-h); max-width: 760px; padding: 6px 8px 4px; }

/* ---------- плашка свежести в шапке: «Сутки 05.10 · сегодня · обновлено 3 ч назад» */
.plate .pl-kind { color: var(--t2); font-weight: 400; }
.plate .pl-sep { color: var(--t3); font-weight: 400; }
.plate .pl-rel { font-weight: 400; color: var(--t2); }
.plate .pl-rel.old { color: var(--warn-text); }
.plate .pl-upd { color: var(--t2); }
.plate .pl-short { display: none; }
@media (max-width: 599px) {
  .plate .pl-kind, .plate .pl-long { display: none; }
  .plate .pl-short { display: inline; }
  /* связь «онлайн» - точкой без слова: шапке нужно место (слово остаётся в подсказке и у офлайна) */
  .net:not(.off) .n-short { display: none; }
}
/* узкий экран: ширина шапки не больше места слева от кластера (--cl-w ставит chrome.js), хвост плашки обрезается */
@media (max-width: 899px), (orientation: portrait) {
  #hdr { max-width: calc(100% - var(--cl-w, 0px) - var(--g) * 3); }
  .plate .t { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .plate .age { min-width: 0; overflow: hidden; }
  .plate .pl-upd { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- спокойная жёлтая пометка: прогноз на сегодня не загружен */
.tl-stale { flex: none; display: flex; align-items: center; gap: 8px; height: 22px; padding: 0 8px; border-radius: var(--r-s); background: var(--warn-bg); color: var(--warn-text); font-size: var(--fs-xs); line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-stale[hidden] { display: none; }
.tl-stale::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* ---------- строка управления */
.tl-ctl { flex: none; display: flex; align-items: center; gap: 6px; min-width: 0; min-height: var(--h-s); }
.tl-fill { flex: 1 1 auto; min-width: 0; }
.tl-ctl [hidden] { display: none; }
.tl-series { flex: none; }
.tl-series button { height: calc(var(--h-s) - 4px); padding: 0 12px; }
.tl-sel { flex: 0 1 140px; min-width: 0; height: var(--h-s); font-size: var(--fs-s); }
.tl-b { flex: none; height: var(--h-s); padding: 0 10px; font-size: var(--fs-s); font-weight: 500; }
.tl-b:disabled, .btn:disabled { opacity: 0.45; cursor: default; }
.tl-b:disabled:hover, .btn:disabled:hover { background-color: var(--surface); }
.tl-calwrap { position: relative; flex: none; }
.tl-cal { color: var(--t2); }
#timeline .tl-pop { top: auto; bottom: calc(100% + 10px); left: auto; right: -4px; width: min(280px, calc(100vw - var(--g) * 2)); }
.tl-pop .note { margin: 2px 0 6px; font-size: var(--fs-s); color: var(--t2); }
.tl-pop input[type="date"] { width: 100%; }

/* ---------- дорожка: окно засечек */
.tl-row { flex: 1 1 auto; display: flex; align-items: stretch; gap: 2px; min-height: 0; }
.tl-row .ibtn { align-self: center; flex: none; }
#timeline .tl-play { min-width: var(--h-s); height: var(--h-s); }
.tl-play:disabled { opacity: 0.4; cursor: default; }
#timeline .tl-track { position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: stretch; height: auto; margin: 0 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.tl-track::-webkit-scrollbar { display: none; }
#timeline .tl-stop { position: relative; flex: 1 0 30px; min-width: 30px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0; padding: 0 2px 2px; border: 0; background: transparent; color: var(--t2); font-size: var(--fs-s); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; transition: color var(--dur) var(--ease); }
#timeline .tl-stop:hover { color: var(--t1); }
#timeline .tl-stop:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--accent-line); border-radius: var(--r-s); }
.tl-wd { font-size: var(--fs-xs); line-height: 16px; color: var(--t3); }
.tl-d { font-size: var(--fs-s); line-height: 16px; }
.tl-stop:hover .tl-wd { color: var(--t2); }
#timeline .tl-stop.on { font-size: var(--fs-s); font-weight: 400; color: var(--t1); }
.tl-stop.on .tl-d { font-weight: 500; color: var(--t1); }
.tl-stop.on .tl-wd { color: var(--t2); }
#timeline .tl-mark { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 6px; margin-top: 3px; }
.tl-mark::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.tl-mark i { position: relative; width: 1px; height: 6px; background: var(--t3); transition: all var(--dur) var(--ease); }
.tl-stop.on .tl-mark i { width: 18px; height: 3px; border-radius: 2px; background: var(--accent); }
/* сегодня и завтра шире остальных: слово вместо дня недели */
#timeline .tl-stop.today { flex-basis: 50px; min-width: 50px; }
#timeline .tl-stop.tmrw { flex-basis: 46px; min-width: 46px; }
.tl-stop.today .tl-wd { color: var(--accent-text); }
.tl-stop.today:not(.on) .tl-mark i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.tl-stop.today.on .tl-d, .tl-stop.tmrw.on .tl-d { color: var(--t1); }
/* сегодня без прогноза: пустая засечка */
#timeline .tl-stop.ghost { cursor: default; color: var(--t3); }
.tl-stop.ghost .tl-mark i { width: 6px; height: 6px; border-radius: 50%; background: transparent; border: 1px dashed var(--t3); box-sizing: border-box; }
/* недели: две даты столбиком */
#timeline .tl-stop.wk { flex-basis: 52px; min-width: 52px; }
.tl-stop.wk .tl-wd { color: var(--t3); }
/* месяц - разделитель между засечками; пропущенные сутки - пунктир */
.tl-mo { flex: none; align-self: stretch; display: flex; align-items: center; padding: 0 6px 12px 8px; border-left: 1px solid var(--border); font-size: var(--fs-xs); color: var(--t3); white-space: nowrap; }
.tl-track > .tl-mo:first-child { border-left: 0; padding-left: 4px; }
.tl-gap { flex: none; align-self: stretch; width: 14px; display: flex; align-items: flex-end; }
.tl-gap::after { content: ''; width: 100%; margin-bottom: 7px; border-top: 1px dashed var(--t3); }
#timeline .tl-new { top: 4px; right: 3px; }
.tl-empty { align-self: center; flex: 1 1 auto; text-align: center; color: var(--t3); font-size: var(--fs-s); }

/* ---------- касание: цели не меньше 44 px */
@media (pointer: coarse) {
  #timeline .tl-stop { flex-basis: 44px; min-width: 44px; }
  #timeline .tl-stop.today { flex-basis: 56px; min-width: 56px; }
  #timeline .tl-stop.tmrw { flex-basis: 52px; min-width: 52px; }
  #timeline .tl-stop.wk { flex-basis: 60px; min-width: 60px; }
  .tl-b { padding: 0 12px; font-size: var(--fs-m); }
  .tl-series button { padding: 0 14px; }
}
@media (max-width: 599px) {
  #timeline.timeline { padding: 6px 6px 4px; }
  .tl-ctl { gap: 4px; }
  .tl-b { padding: 0 9px; }
  .tl-series button { padding: 0 10px; }
  .tl-sel { flex-basis: 96px; }
}

/* ---------- прочее v1.4 */
.demo-note { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--t2); }
.trip-pick { margin: 6px 0; }
