/* Живые графики Моста и Движка (`timechart.js`) — один файл в обеих системах. Цвета — переменные темы, общие для
   обеих (`--surface`, `--line`, `--accent` и т. д.): тёмная и светлая темы работают без своих правил. */

figure.tc, figure.tc-overview { position: relative; margin: 0 0 14px; min-width: 0; }
figure.tc:last-child { margin-bottom: 0; }
.tc-plot { position: relative; }
.tc-plot .uplot { font-family: inherit; }
.tc-plot .u-over { cursor: crosshair; }
.tc-plot .u-over.tc-panning { cursor: grabbing; }
.tc-loading .tc-plot { opacity: .72; transition: opacity .15s; }

/* Название графика — подпись `aria-label`, если у фигуры нет своего заголовка. */
figure.tc[aria-label]::before { content: attr(aria-label); display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text); margin: 0 0 4px; padding-right: 220px; min-height: 18px; }
/* единственный график карточки с заголовком: название уже в шапке карточки, своё — пустая строка под панелью */
.card-body > figure.tc:only-child::before { content: ""; min-height: 26px; }

/* Панель над графиком: сравнение, CSV, записи за выделенное. */
.tc-tools { position: absolute; top: -2px; right: 0; display: flex; gap: 6px; align-items: center; z-index: 2; }
.tc-btn { font: inherit; font-size: 11.5px; line-height: 1; padding: 5px 8px; border-radius: 7px; cursor: pointer;
  color: var(--muted); background: transparent; border: 1px solid var(--line); text-decoration: none; white-space: nowrap; }
.tc-btn:hover { color: var(--text); background: var(--surface-2); }
.tc-compare select { font: inherit; font-size: 11.5px; padding: 3px 6px; border-radius: 7px; color: var(--muted);
  background: transparent; border: 1px solid var(--line); cursor: pointer; }
.tc-compare select:hover { color: var(--text); }

/* Легенда: ряды в строку; щелчок — этот ряд ярким, остальные серыми; Ctrl/Cmd — спрятать. */
.tc-plot .u-legend { font-size: 12px; text-align: left; margin-top: 4px; }
.tc-plot .u-legend .u-series { cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.tc-plot .u-legend .u-series:first-child { display: none; }
.tc-plot .u-legend .u-series:hover { background: var(--surface-2); }
.tc-plot .u-legend .u-series.tc-focused { background: var(--chip); box-shadow: inset 0 0 0 1px var(--accent); }
.tc-plot .u-legend .u-series th { font-weight: 500; color: var(--text); }
.tc-plot .u-legend .u-series td { color: var(--muted); font-variant-numeric: tabular-nums; padding-left: 4px; }
.tc-plot .u-legend .u-marker { width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.tc-plot .u-legend .u-off > * { opacity: .38; }
.tc-plot .u-legend .u-off th { text-decoration: line-through; }

/* Выделение протяжкой — полупрозрачный цвет акцента с краями. */
.tc-plot .u-select { background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-left: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent); }
.tc-plot .u-cursor-x { border-right: 1px dashed color-mix(in srgb, var(--muted) 70%, transparent); }
.tc-plot .u-cursor-y { display: none; }

/* Подсказка у курсора: время шага, значения видимых рядов, событие рядом. */
.tc-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 180px; max-width: 320px; padding: 8px 10px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .45); font-size: 12px; line-height: 1.35; }
.tc-tip[hidden] { display: none; }
.tc-tip-time { color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 5px; }
.tc-tip-row { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 7px; align-items: center; }
.tc-tip-row i { width: 9px; height: 9px; border-radius: 3px; }
.tc-tip-row span { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-tip-row b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.tc-tip-row small { font-weight: 400; color: var(--muted); }
.tc-tip-row em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.tc-tip-event { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--text); }
.tc-tip-event span { display: block; color: var(--muted); font-size: 11px; }
.tc-tip-event small { display: block; color: var(--muted); }
.tc-tip-event[data-kind="alert"] span { color: var(--lost); }

.tc-note { font-size: 11px; color: var(--muted); margin-top: 2px; text-align: right; }
.tc-hint { font-size: 11.5px; color: var(--muted); margin: -6px 0 14px; }
.tc-hint .tc-kinds { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; margin-left: 6px; }
.tc-hint .tc-kinds i { display: inline-block; width: 0; height: 0; margin-right: 4px; vertical-align: 1px;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid currentColor; }
figure.tc[data-error]::after, figure.tc-overview[data-error]::after { content: attr(data-error); display: block;
  font-size: 12px; color: var(--lost); margin-top: 4px; }

/* Полоса обзора всего хранимого срока: рамка — окно графиков. */
figure.tc-overview { padding: 4px 6px 0; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); }
figure.tc-overview .u-over { cursor: pointer; }

/* Что выделено — под полосой промежутка. */
.tc-selection { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  margin: -4px 0 14px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.tc-selection b { font-variant-numeric: tabular-nums; }

/* Выбор строкой: выбранное ярким, остальное серым. */
[data-pick] { cursor: pointer; }
[data-picked] [data-pick]:not([aria-pressed="true"]) { opacity: .38; transition: opacity .15s; }
[data-picked] [data-pick]:not([aria-pressed="true"]):hover { opacity: .7; }
[data-pick][aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--accent); }

/* Страница пересчитывается на месте — тонкая полоса хода наверху вместо перезагрузки. */
html.span-loading::before { content: ""; position: fixed; z-index: 100; top: 0; left: 0; height: 2px; width: 40%;
  background: var(--accent); animation: span-progress 1s ease-in-out infinite; }
@keyframes span-progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { html.span-loading::before { animation: none; width: 100%; opacity: .6; } }

/* Полоса промежутка — одинаково в обеих системах: «◀ с … — по … ▶ Показать» одной плашкой, как выбор времени в
   системах наблюдения; поля даты и времени — без своих рамок и заливки, цифры одной ширины. */
.span-bar .span-edges { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 0; padding: 2px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.span-bar .span-edges label { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px 0 8px; margin: 0;
  color: var(--muted); font-size: 12px; }
.span-bar .span-edges label + label { border-left: 1px solid var(--line-soft); }
.span-bar .span-edges input[type="datetime-local"] { height: 28px; width: auto; min-width: 0; padding: 0 2px; margin: 0;
  border: 0; border-radius: 6px; background: transparent; box-shadow: none; color: var(--text); font: inherit;
  font-size: 13px; font-variant-numeric: tabular-nums; color-scheme: light dark; }
.span-bar .span-edges input[type="datetime-local"]:hover { background: var(--surface-2); }
.span-bar .span-edges input[type="datetime-local"]:focus-visible { outline: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.span-bar .span-edges input::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; margin-left: 2px; }
.span-bar .span-edges input::-webkit-calendar-picker-indicator:hover { opacity: .9; }
.span-bar .span-edges .span-step, .span-bar .span-edges > .btn.icon { display: inline-flex; align-items: center;
  justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 11px; }
.span-bar .span-edges a.span-step:hover, .span-bar .span-edges > a.btn.icon:hover { background: var(--surface-2); color: var(--text); }
.span-bar .span-edges button[type="submit"] { height: 28px; margin-left: 4px; border-radius: 7px; }
@media (max-width: 720px) { .span-bar .span-edges { flex-wrap: wrap; } }
