/* Графики Службы (chart.js): только переменные theme.css. Столбики не толще 24 px, скругление 4 px только у конца,
   линии 2 px, точки r 4 с кольцом цвета поверхности, сетка волосяная, текст цветом --ink и --muted. */
.ch { width: 100%; box-sizing: border-box; font-variant-numeric: tabular-nums; }
.ch-none { margin: 6px 0; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 6px; font-size: var(--fs-cap); color: var(--muted); }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
/* горизонтальные столбики */
.ch-hbars { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: 6px 10px; align-items: center; }
.ch-row { display: contents; }
.ch-row:hover .ch-k { color: var(--accent); }
.ch-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: var(--fs-sm); }
.ch-k small { display: block; color: var(--muted); font-size: var(--fs-cap); }
.ch-k a { color: inherit; }
.ch-track { position: relative; display: block; height: 18px; background: var(--grey-soft); border-radius: 4px; overflow: visible; }
.ch-bar { position: absolute; left: 0; top: 0; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; transition: width .25s ease; }
.ch-mark { position: absolute; top: -3px; width: 2px; height: calc(100% + 6px); background: var(--ink); border-radius: 1px; transform: translateX(-1px); }
.ch-v { white-space: nowrap; color: var(--ink); font-weight: 600; font-size: var(--fs-sm); display: flex; gap: 6px; align-items: baseline; }
.ch-v small { color: var(--muted); font-weight: 500; font-size: var(--fs-cap); }
.ch-stack .ch-track { display: flex; gap: 2px; background: var(--grey-soft); }
.ch-seg { display: block; height: 100%; }
.ch-seg:first-child { border-radius: 4px 0 0 4px; }
.ch-seg:last-child { border-radius: 0 4px 4px 0; }
/* расходящиеся от нуля */
.ch-div .ch-track { background: linear-gradient(to right, var(--grey-soft) 0, var(--grey-soft) calc(50% - 1px), var(--line2) calc(50% - 1px), var(--line2) calc(50% + 1px), var(--grey-soft) calc(50% + 1px)); }
.ch-div .ch-bar.pos { left: 50%; border-radius: 0 4px 4px 0; }
.ch-div .ch-bar.neg { left: auto; right: 50%; border-radius: 4px 0 0 4px; }
.ch-divl { grid-column: 2; display: flex; justify-content: space-between; font-size: var(--fs-cap); }
/* линии и каскад */
.ch-linebox { width: 100%; }
.ch-svg { width: 100%; height: auto; display: block; overflow: visible; font-family: var(--font); }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-base { stroke: var(--line2); stroke-width: 1; }
.ch-ax { fill: var(--muted); font-size: 13px; }
.ch-end { fill: var(--ink); font-size: 13px; font-weight: 600; paint-order: stroke; stroke: var(--card); stroke-width: 3px; stroke-linejoin: round; }
.ch-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-dot { stroke: var(--card); stroke-width: 2; }
.ch-cross { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 0; pointer-events: none; }
/* спарклайн */
.ch-spark path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-spark circle { stroke: var(--card); stroke-width: 2; }
/* плитки */
.ch-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-width: 0; }
.ch-tt { color: var(--muted); font-weight: 600; font-size: var(--fs-cap); line-height: 1.3; }
.ch-tv { font-size: var(--fs-num); font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.ch-tile.quiet { background: var(--bg); box-shadow: none; }
.ch-tile.quiet .ch-tv { font-size: var(--fs-h2); color: var(--muted); font-weight: 600; }
.ch-ts { margin: 2px 0 0; color: var(--muted); }
.ch-tsub { font-size: var(--fs-cap); }
.ch-delta { font-size: var(--fs-cap); font-weight: 600; }
.ch-delta.good { color: var(--green); }
.ch-delta.bad { color: var(--red); }
.ch-delta.same { color: var(--muted); font-weight: 500; }
/* полоса плана */
.ch-bullet { display: flex; align-items: center; gap: 10px; }
.ch-bullet .ch-track { flex: 1; height: 10px; }
.ch-bullet .ch-mark { top: -4px; height: 18px; }
.ch-bl { white-space: nowrap; font-size: var(--fs-cap); }
/* тепловая карта */
.ch-heat { display: grid; gap: 3px; }
.ch-hh, .ch-hr { display: grid; grid-template-columns: minmax(70px, 110px) repeat(var(--cols), minmax(10px, 1fr)); gap: 3px; align-items: center; }
.ch-hc { font-size: 12px; color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }
.ch-hk { font-size: var(--fs-cap); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ch-cell { display: block; height: 22px; border-radius: 3px; background: var(--grey-soft); }
.ch-cell.s1, .ch-hl .s1 { background: var(--seq-1); } .ch-cell.s2, .ch-hl .s2 { background: var(--seq-2); } .ch-cell.s3, .ch-hl .s3 { background: var(--seq-3); }
.ch-cell.s4, .ch-hl .s4 { background: var(--seq-4); } .ch-cell.s5, .ch-hl .s5 { background: var(--seq-5); }
.ch-cell:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.ch-hl { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; }
.ch-hl i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.ch-hl em { margin-left: 10px; font-style: normal; }
/* распределение */
.ch-dots { position: relative; height: 26px; margin: 10px 0 18px; }
.ch-dots::before { content: ''; position: absolute; left: 0; right: 0; top: 12px; height: 1px; background: var(--line2); }
.ch-iqr { position: absolute; top: 6px; height: 13px; background: var(--accent-soft); border-radius: 3px; }
.ch-pt { position: absolute; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--ch-1); border: 2px solid var(--card); transform: translateX(-5px); opacity: .85; }
.ch-med { position: absolute; top: 2px; width: 3px; height: 21px; background: var(--ink); border-radius: 1px; transform: translateX(-1px); }
.ch-mk { position: absolute; top: 0; width: 0; height: 0; border: 6px solid transparent; border-top-color: var(--amber); transform: translateX(-6px); }
.ch-dl { position: absolute; left: 0; right: 0; top: 26px; display: flex; justify-content: space-between; font-size: 12px; }
/* фигура с переключателем таблицы */
.ch-fig { margin: 0; padding: 12px 14px; }
.ch-cap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ch-cap b { font-size: var(--fs-h3); font-weight: 650; }
.ch-sp { flex: 1; }
.ch-tgl { height: var(--h-sm); padding: 0 12px; font-size: var(--fs-cap); }
.ch-table td, .ch-table th { padding: 6px 10px; }
.ch-table .r { text-align: right; white-space: nowrap; }
/* подсказка */
.ch-tip { position: fixed; z-index: 2000; max-width: 320px; padding: 6px 10px; background: var(--ink); color: var(--card); font-size: var(--fs-cap); border-radius: 8px; pointer-events: none; box-shadow: var(--shadow); white-space: pre-line; }
body.night .ch-tip { background: var(--surface-raised); color: var(--ink); border: 1px solid var(--line2); }
@media (max-width: 640px) { .ch-hbars { grid-template-columns: minmax(70px, 40%) 1fr auto; } .ch-tv { font-size: var(--fs-h1); } .ch-hh, .ch-hr { grid-template-columns: 60px repeat(var(--cols), minmax(6px, 1fr)); } }
