/* «Аналитика»: вкладки-метрики над графиком, таблица по правилам, ответы людям. Цвет данных — одна серия --chart. */
:root { --chart: #628EF7; } /* проверен dataviz validate_palette: светлая и тёмная поверхность, полоса светлоты и контраст ≥3:1 */
.an { padding-bottom: 32px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.an__say { max-width: none; margin: 0 0 16px; }
.an__say p { flex: 1; font-size: 15px; }
.an__say .btn { flex: none; background: var(--panel); }

.chart { padding: 8px; border-radius: var(--r-row); background: var(--panel); border: 1px solid var(--line); }
.mtabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mtabs button { display: grid; align-content: start; gap: 4px; min-height: 44px; padding: 12px 14px; border: 0; border-radius: var(--r-row); background: transparent; color: var(--ink); text-align: left; transition: background-color var(--t-fast) var(--ease); }
.mtabs button:hover { background: var(--ctl); }
.mtabs button[aria-selected=true] { background: var(--well); }
.mtabs__k { color: var(--ink2); font-size: 13px; }
.mtabs button[aria-selected=true] .mtabs__k, .mtabs button[aria-selected=true] small { color: var(--ink2-onmuted); }
.mtabs b { font-weight: 500; font-size: 36px; line-height: 1.1; letter-spacing: -.04em; }
.mtabs small { color: var(--ink2); font-size: 13px; }

.plot { --ph: 220px; position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; padding: 20px 12px 8px 4px; }
.plot__y { display: grid; align-content: space-between; height: var(--ph); color: var(--ink2); font-size: 12px; text-align: right; transform: translateY(-.6em); }
.plot__area { position: relative; min-width: 0; }
.plot__grid { position: absolute; left: 0; right: 0; top: calc(var(--y) * var(--ph)); height: 1px; background: var(--line); }
.plot__bars { position: relative; display: flex; align-items: flex-end; gap: 2px; height: var(--ph); }
.bar { position: relative; flex: 1; height: 100%; min-width: 0; padding: 0; border: 0; background: transparent; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.bar i { display: block; width: min(72%, 40px); height: calc(var(--h) * 100%); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--chart); transition: opacity var(--t-fast) var(--ease); }
/* день без данных: точка на нуле, а не линия 2 px */
.bar--0 i { width: 6px; height: 6px; min-height: 0; border-radius: 50%; }
.plot__bars:hover .bar i { opacity: .55; }
.plot__bars .bar:hover i, .bar:focus-visible i { opacity: 1; }
.bar:focus-visible { outline-offset: 2px; border-radius: 6px; }
.tip { position: absolute; z-index: 5; bottom: calc(var(--h) * 100% + 8px); left: 50%; transform: translateX(-50%); padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--frame); font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--t-fast) var(--ease); }
.tip b { font-weight: 500; }
.bar:hover .tip, .bar:focus-visible .tip { opacity: 1; }
.bar:first-child .tip { left: 0; transform: none; } .bar:last-child .tip { left: auto; right: 0; transform: none; }
.plot__x { display: flex; gap: 2px; margin-top: 8px; color: var(--ink2); font-size: 12px; }
.plot__x span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plot__x span:last-child { overflow: visible; }
/* телефон, 7 дней: столбец-цель шириной 44 px; зазор убран (полоска i уже и стоит по центру) */
@media (max-width: 599px) { .plot { margin: 0 -8px; padding: 20px 4px 8px; grid-template-columns: 28px minmax(0, 1fr); gap: 4px; } .plot__bars, .plot__x { gap: 0; }
  .bar:nth-child(-n+3) .tip { left: 0; transform: none; } .bar:nth-last-child(-n+3) .tip { left: auto; right: 0; transform: none; } }

.an__tbl { padding: 8px; }
.an__tbl .r { text-align: right; white-space: nowrap; }
.an__tbl td { padding: 10px 8px; }
.an__tbl tbody tr:hover { background: var(--ctl); }
.an__tbl td b { font-weight: 500; }
.an__tbl small { color: var(--ink2); font-size: 12px; }
.an__tbl small.lost { color: var(--err); font-weight: 500; } /* комментарии без ответа — ошибка, поэтому красным */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.facts p { display: grid; gap: 4px; padding: 16px 18px; border-radius: var(--r-row); background: var(--panel); border: 1px solid var(--line); }
.facts b { font-weight: 500; font-size: 28px; letter-spacing: -.03em; }
.facts span { color: var(--ink2); font-size: 13px; }

@media (max-width: 899px) {
  .mtabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mtabs b { font-size: 30px; }
  .plot__x .odd { visibility: hidden; }
}
@media (max-width: 599px) {
  .an__say { flex-wrap: wrap; } .an__say .btn { flex: 1 0 100%; }
  .plot__x span:not(:first-child):not(:last-child) { visibility: hidden; }
  .an__tbl { padding: 0; overflow-x: auto; }
  .an__tbl table { min-width: 560px; }
  .an__tbl thead { display: table-header-group; } .an__tbl td { padding: 10px 4px; }
  .facts { grid-template-columns: 1fr; }
  .an .sec__hd a { display: inline-flex; align-items: center; min-height: 44px; }
}
.an__none { display: grid; justify-items: center; gap: 12px; padding: 48px 16px; border-radius: var(--r-card); background: var(--panel); color: var(--ink2); text-align: center; }

/* десктоп ≥900 в окне: график фиксирован, таблица «По правилам» берёт остаток и прокручивается внутри */
@media (min-width: 900px) {
  body[data-fit] .an__say, body[data-fit] .chart, body[data-fit] .ib__hd { flex: none; }
  body[data-fit] .an .sec { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 16px; }
  body[data-fit] .an .sec__hd { flex: none; margin-bottom: 8px; }
  body[data-fit] .an__tbl { flex: 1; min-height: 0; overflow: auto; }
  body[data-fit] .an__tbl th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
}
@media (min-width: 900px) and (max-height: 960px) { .plot { --ph: 160px; } }
@media (min-width: 900px) and (max-height: 860px) { .plot { --ph: 130px; } }

/* шаги правила раскрываются в таблице на месте: строки «название, число, доля», без полосок и воронки */
.an__r { display: flex; align-items: center; gap: 4px; }
.an__x { flex: none; border: 0; background: transparent; color: var(--ink2); }
.an__x:hover { background: var(--ctl-hover); color: var(--ink); }
.an__x svg { transition: transform var(--t-fast) var(--ease); }
.an__x[aria-expanded=true] svg { transform: rotate(180deg); }
.an__more td { padding: 0 8px 14px 52px; }
.an__steps { display: grid; gap: 2px; margin: 0; max-width: 520px; }
.an__steps > div { display: grid; grid-template-columns: minmax(0, 1fr) auto 56px; gap: 12px; align-items: baseline; min-height: 32px; font-size: 14px; }
.an__steps dt { color: var(--ink2); }
.an__steps dd { margin: 0; text-align: right; }
.an__sh { color: var(--ink2); }
.an__vt { margin: 14px 0 4px; font-size: 14px; }
.an__vars > div { font-weight: 400; }
.an__vars > .is-best { font-weight: 500; }
.an__vars > .is-best dt { color: var(--ink); }
.an__more .help { margin-top: 6px; max-width: 56ch; }
@media (max-width: 599px) { .an__more td { padding-left: 4px; } .an__x { width: 44px; height: 44px; } .an__steps > div { grid-template-columns: minmax(0, 1fr) auto 48px; min-height: 36px; } }
@media (max-width: 599px) { .an__in { position: sticky; left: 0; width: calc(100vw - 52px); max-width: 100%; } }

/* раскрытие шагов: тело проявляется на месте, закрытие быстрее открытия */
.an__more--in { animation: an-in 220ms var(--ease); }
.an__more--out { animation: an-out 120ms var(--ease) forwards; }
@keyframes an-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes an-out { to { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  .an__more--in { animation: an-fade 80ms linear; }
  .an__more--out { animation: an-fade 80ms linear reverse forwards; }
}
@keyframes an-fade { from { opacity: 0; } }
.an__use { margin: 0 0 16px; color: var(--ink2); }
.an__use b { color: var(--ink); font-weight: 500; }
