/* ==========================================================================
   Аналитика — «Итог периода» для того, кто гонит трафик с парка аккаунтов.
   Одна прокручиваемая страница без вкладок: сверху ответ на «что произвёл парк и
   что это стоило», ниже — пульс, список дел, воронка, компоненты, источники,
   карта откликов, живучесть, таблица аккаунтов, события. Тона: --ok / --warn /
   --bad несут смысл (результат / внимание / потеря), фиолетовый и циан — только для
   различения серий на графиках.
   ========================================================================== */
.anx { --ok: var(--color-success-text); --warn: var(--color-warning); --bad: var(--color-danger);
       --violet: #8b7bf0; --cyan: #25c2d6; --amber: #e8a13a; --grid: color-mix(in srgb, var(--color-text) 8%, transparent);
       display: flex; flex-direction: column; gap: 16px; }
.anx .num { font-variant-numeric: tabular-nums; }
.anx .card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 16px; padding: 18px; min-width: 0; }
.anx .cap { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-faint); font-weight: 700; }
.anx .card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.anx .card-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.anx .card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--color-text-muted); }
.anx .grid { display: grid; gap: 16px; min-width: 0; }
.anx .g2 { grid-template-columns: 1fr 1fr; }
.anx .g21 { grid-template-columns: 1.6fr 1fr; }
.anx .g12 { grid-template-columns: 1fr 1.6fr; }
@media (max-width: 960px) { .anx .g2, .anx .g21, .anx .g12 { grid-template-columns: 1fr; } }

/* ── Шапка: период, компонент, действия ── */
.anx .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.anx .bar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.anx .seg { display: inline-flex; background: var(--color-surface-muted); border: 1px solid var(--color-border); border-radius: 12px; padding: 3px; }
.anx .seg a { text-decoration: none; color: var(--color-text-muted); font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 9px; transition: background .15s ease, color .15s ease; }
.anx .seg a.on { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.anx .role-sel { height: 38px; border-radius: 11px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 13px; font-weight: 600; padding: 0 12px; }
.anx .abtn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 13px; font-weight: 600; padding: 9px 13px; border-radius: 11px; cursor: pointer; text-decoration: none; }
.anx .abtn.prim { background: var(--color-primary); color: var(--color-on-primary, #fff); border-color: transparent; }
.anx .abtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ── Итог периода: три колонки «произведено / сгорело / эффективность» ── */
.anx .hero { padding: 0; overflow: hidden; display: grid; grid-template-columns: 1.15fr 1fr .9fr; }
.anx .hero > div { padding: 18px 20px; min-width: 0; }
.anx .hero > div + div { border-left: 1px solid var(--color-border); }
@media (max-width: 960px) { .anx .hero { grid-template-columns: 1fr; } .anx .hero > div + div { border-left: 0; border-top: 1px solid var(--color-border); } }
.anx .hero .cap { display: flex; align-items: center; gap: 7px; }
.anx .hero .cap i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.anx .hero .prod .cap i { background: var(--ok); }
.anx .hero .burn .cap i { background: var(--bad); }
.anx .hero .eff .cap i { background: var(--color-primary); }
.anx .hero .prod { background: linear-gradient(180deg, color-mix(in srgb, var(--ok) 7%, transparent), transparent 60%); }
.anx .hero .burn { background: linear-gradient(180deg, color-mix(in srgb, var(--bad) 6%, transparent), transparent 60%); }
.anx .big { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.anx .big b { font-family: var(--font-display); font-size: 44px; line-height: 1; font-weight: 750; letter-spacing: -.03em; }
.anx .big .lbl { font-size: 13px; color: var(--color-text-muted); }
.anx .delta { font-size: 12px; font-weight: 700; display: inline-flex; gap: 3px; padding: 3px 8px; border-radius: 999px; }
.anx .delta.up { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.anx .delta.down { color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, transparent); }
.anx .delta.flat { color: var(--color-text-muted); background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.anx .mini-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.anx .mini { min-width: 0; }
.anx .mini b { display: block; font-size: 20px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.anx .mini span { display: block; font-size: 11.5px; color: var(--color-text-muted); margin-top: 3px; line-height: 1.3; }
.anx .eff-list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.anx .eff-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--color-text-muted); }
.anx .eff-row b { font-size: 15px; font-weight: 750; color: var(--color-text); letter-spacing: -.01em; }
.anx .eff-row b.na { color: var(--color-text-faint); font-weight: 500; }
.anx .note { font-size: 11px; color: var(--color-text-faint); margin-top: 10px; line-height: 1.4; }

/* ── Пульс: стек по компонентам + линия откликов + метки потерь ── */
.anx .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--color-text-muted); }
.anx .legend span { display: inline-flex; align-items: center; gap: 6px; }
.anx .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.anx .legend i.line { height: 3px; border-radius: 2px; }
.anx .chart-host { position: relative; }
.anx .chart-host svg { width: 100%; height: auto; display: block; overflow: visible; }
.anx .xaxis { display: flex; justify-content: space-between; margin-top: 6px; padding: 0 2px; font-size: 10.5px; color: var(--color-text-faint); font-variant-numeric: tabular-nums; }
.anx .tip { position: absolute; z-index: 6; pointer-events: none; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.28); transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity .12s ease; }
.anx .tip.on { opacity: 1; }
.anx .tip .d { color: var(--color-text-faint); font-size: 10.5px; letter-spacing: .03em; margin-bottom: 5px; }
.anx .tip .r { display: flex; align-items: center; gap: 7px; line-height: 1.5; }
.anx .tip .r i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.anx .tip .r span { color: var(--color-text-muted); }
.anx .tip .r b { margin-left: auto; padding-left: 14px; color: var(--color-text); font-variant-numeric: tabular-nums; }
.anx .cross { position: absolute; width: 1px; background: var(--color-border); pointer-events: none; opacity: 0; z-index: 5; }
.anx .pulse-bar { transition: opacity .15s ease; }
.anx .empty { text-align: center; padding: 30px 16px; color: var(--color-text-faint); font-size: 13px; }

/* ── Что делать сейчас ── */
.anx .todo { display: flex; flex-direction: column; gap: 8px; }
.anx .todo-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--color-border); background: var(--color-surface-muted); }
.anx .todo-item .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.anx .todo-item .ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.anx .todo-item.danger .ic { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.anx .todo-item.warn .ic { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.anx .todo-item.info .ic { background: color-mix(in srgb, var(--color-primary) 14%, transparent); color: var(--color-primary); }
.anx .todo-item .tx { flex: 1; min-width: 0; }
.anx .todo-item .tx b { display: block; font-size: 13.5px; font-weight: 650; }
.anx .todo-item .tx span { display: block; font-size: 12.5px; color: var(--color-text-muted); margin-top: 2px; line-height: 1.4; }
.anx .todo-item .go { flex: none; align-self: center; font-size: 12px; font-weight: 600; color: var(--color-primary); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.anx .todo-item .go:hover { background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.anx .todo-ok { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--ok) 10%, transparent); color: var(--ok); font-weight: 600; font-size: 13.5px; }
.anx .todo-ok svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ── Парк: донат + сетка состояний ── */
.anx .fleet { display: flex; align-items: center; gap: 22px; }
.anx .donut { position: relative; width: 128px; height: 128px; flex: none; }
.anx .donut svg circle { transition: stroke-dasharray .6s var(--ease, ease); }
.anx .donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.anx .donut .center b { font-family: var(--font-display); font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.anx .donut .center span { margin-top: 4px; font-size: 9.5px; color: var(--color-text-faint); text-transform: uppercase; letter-spacing: .1em; }
.anx .fleet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; flex: 1; }
.anx .fs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text-muted); }
.anx .fs i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.anx .fs b { margin-left: auto; color: var(--color-text); font-weight: 750; }

/* ── Воронка ── */
.anx .funnel { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.anx .fstep { display: grid; grid-template-columns: 9rem 1fr 3.4rem; align-items: center; gap: 12px; font-size: 13px; }
.anx .fstep .n { color: var(--color-text-muted); }
.anx .fstep .b { height: 22px; border-radius: 7px; background: var(--color-surface-muted); overflow: hidden; }
.anx .fstep .b span { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 60%, var(--violet))); width: 0; transition: width .8s var(--ease, ease); }
.anx .fstep .v { text-align: right; font-weight: 750; }
.anx .fstep small { display: block; font-weight: 500; font-size: 11px; color: var(--color-text-faint); }

/* ── Компоненты ── */
.anx .mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.anx .mod { display: block; text-decoration: none; color: inherit; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--color-border); background: var(--color-surface-muted); transition: border-color .15s ease, transform .15s ease; }
.anx .mod:hover { border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border)); transform: translateY(-1px); }
.anx .mod .mn { font-size: 12.5px; font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.anx .mod .mn svg { width: 14px; height: 14px; fill: none; stroke: var(--color-text-faint); stroke-width: 2; }
.anx .mod .mv { font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.anx .mod .mv small { font-size: 12px; font-weight: 500; color: var(--color-text-muted); margin-left: 4px; }
.anx .mod .mr { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--color-text-muted); }
.anx .mod .mr .pb { flex: 1; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--color-text) 8%, transparent); overflow: hidden; }
.anx .mod .mr .pb span { display: block; height: 100%; border-radius: 3px; background: var(--ok); width: 0; transition: width .8s var(--ease, ease); }
.anx .mod .mr .pb span.warn { background: var(--amber); }
.anx .mod .mr .pb span.bad { background: var(--bad); }
.anx .mod .mr b { color: var(--color-text); }
.anx .mod .ms { font-size: 11.5px; color: var(--color-text-faint); margin-top: 5px; }

/* ── Источники ── */
.anx .src { display: flex; flex-direction: column; gap: 8px; }
.anx .srow { display: grid; grid-template-columns: 1fr 6rem 3.2rem; align-items: center; gap: 10px; font-size: 13px; }
.anx .srow .t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anx .srow .t small { color: var(--color-text-faint); margin-left: 6px; }
.anx .srow .sb { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--color-text) 8%, transparent); overflow: hidden; }
.anx .srow .sb span { display: block; height: 100%; border-radius: 3px; width: 0; transition: width .8s var(--ease, ease); }
.anx .srow .r { text-align: right; font-weight: 700; }
.anx .srow .r.ok { color: var(--ok); } .anx .srow .r.mid { color: var(--amber); } .anx .srow .r.bad { color: var(--bad); }

/* ── Карта «когда отвечают» ── */
.anx .heat { display: grid; grid-template-columns: 2.2rem repeat(24, 1fr); gap: 3px; align-items: center; }
.anx .heat .hl { font-size: 10.5px; color: var(--color-text-faint); }
.anx .heat .hc { aspect-ratio: 1; border-radius: 3px; background: color-mix(in srgb, var(--color-primary) var(--a, 6%), var(--color-surface-muted)); transition: transform .1s ease; }
.anx .heat .hc:hover { transform: scale(1.25); outline: 1px solid var(--color-text-faint); }
.anx .heat-x { display: grid; grid-template-columns: 2.2rem repeat(24, 1fr); gap: 3px; margin-top: 4px; font-size: 9.5px; color: var(--color-text-faint); text-align: center; }
.anx .heat-x span:nth-child(24n+1) { visibility: visible; }

/* ── Живучесть ── */
.anx .live { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 700px) { .anx .live { grid-template-columns: repeat(2, 1fr); } }
.anx .lv { background: var(--color-surface-muted); border: 1px solid var(--color-border); border-radius: 12px; padding: 12px; }
.anx .lv .v { font-size: 21px; font-weight: 750; letter-spacing: -.02em; }
.anx .lv .v small { font-size: 12px; color: var(--color-text-muted); font-weight: 500; margin-left: 3px; }
.anx .lv .k { font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }
.anx .hist-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--color-text-faint); margin-top: 4px; padding: 0 6px; }

/* ── Таблица аккаунтов ── */
.anx .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.anx .tools input { flex: 1 1 14rem; height: 36px; border-radius: 10px; border: 1px solid var(--color-border); background: var(--color-surface-muted); color: var(--color-text); padding: 0 12px; font: inherit; font-size: 13px; }
.anx .tools input:focus { outline: none; border-color: var(--color-primary); }
.anx .chip { border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 11px; border-radius: 999px; cursor: pointer; }
.anx .chip.on { background: var(--color-primary); color: var(--color-on-primary, #fff); border-color: transparent; }
.anx table { width: 100%; border-collapse: collapse; font-size: 13px; }
.anx thead th { text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--color-text-faint); font-weight: 700; padding: 8px 10px; cursor: pointer; user-select: none; white-space: nowrap; }
.anx thead th.sorted { color: var(--color-text); }
.anx tbody tr { cursor: pointer; transition: background .12s ease; }
.anx tbody tr:hover { background: var(--color-surface-muted); }
.anx tbody td { padding: 10px; border-top: 1px solid var(--color-border); vertical-align: middle; }
.anx .acc-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.anx .acc-cell .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.anx .acc-cell b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anx .acc-cell small { color: var(--color-text-faint); font-size: 11.5px; }
.anx .abadge { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.anx .abadge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.anx .abadge.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.anx .abadge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.anx .roles { font-size: 11.5px; color: var(--color-text-muted); }
.anx .loadbar { height: 5px; border-radius: 3px; background: var(--color-surface-muted); overflow: hidden; min-width: 70px; }
.anx .loadbar span { display: block; height: 100%; background: var(--color-primary); border-radius: 3px; }
.anx tr.hide { display: none; }
.anx .more { display: block; width: 100%; margin-top: 8px; border: 1px dashed var(--color-border); background: transparent; color: var(--color-text-muted); font: inherit; font-size: 13px; padding: 9px; border-radius: 10px; cursor: pointer; }
.anx .more:hover { color: var(--color-text); border-color: var(--color-text-faint); }

/* ── События ── */
.anx .ev { display: flex; flex-direction: column; gap: 6px; }
.anx .ev-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 10px; background: var(--color-surface-muted); font-size: 12.5px; }
.anx .ev-row i { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.anx .ev-row .who { color: var(--color-text-muted); font-size: 11.5px; }
.anx .ev-row time { color: var(--color-text-faint); font-size: 11px; white-space: nowrap; }

/* ── Анимации входа: карточки поднимаются волной, графики проявляются ── */
@keyframes anx-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes anx-fade { from { opacity: 0; } to { opacity: 1; } }
.anx .card { animation: anx-rise .55s var(--ease, cubic-bezier(.22,.61,.36,1)) both; }
.anx > *:nth-child(2) .card, .anx > .card:nth-child(2) { animation-delay: .04s; }
.anx > *:nth-child(3) .card, .anx > .card:nth-child(3) { animation-delay: .1s; }
.anx > *:nth-child(4) .card, .anx > .card:nth-child(4) { animation-delay: .16s; }
.anx > *:nth-child(5) .card, .anx > .card:nth-child(5) { animation-delay: .22s; }
.anx > *:nth-child(n+6) .card, .anx > .card:nth-child(n+6) { animation-delay: .28s; }
.anx .chart-host svg { animation: anx-fade .7s ease .2s both; }
.anx .big b[data-count] { transition: none; }
@media (prefers-reduced-motion: reduce) { .anx .card, .anx .chart-host svg { animation: none; } .anx .fstep .b span, .anx .mod .mr .pb span, .anx .srow .sb span { transition: none; } }

/* ---- Мобильная раскладка аналитики ---- */
@media (max-width: 640px) {
  .anx .bar-left { width: 100%; }
  .anx .seg { display: flex; flex-wrap: wrap; width: 100%; }
  .anx .seg a { flex: 1 1 auto; text-align: center; padding: 7px 8px; font-size: 12px; }
  .anx .fleet { flex-direction: column; align-items: stretch; }
  .anx .fleet-grid { grid-template-columns: minmax(0, 1fr); }
  .anx .legend { font-size: 11.5px; }
  .anx .card, .anx .hero, .anx .card > * { min-width: 0; }
}
@media (max-width: 480px) { .anx .live { grid-template-columns: minmax(0, 1fr); } .anx .lv, .anx .lv .v { min-width: 0; overflow-wrap: anywhere; } }
@media (max-width: 640px) { .anx .card-head { flex-wrap: wrap; row-gap: 8px; } .anx .card-head > * { min-width: 0; max-width: 100%; } }

/* Здоровье парка — под донатом «живых» (прогрев/защита/возраст) */
.park-health { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 10px; }
.park-health .ph-title { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--color-text-muted); }
.ph-row { display: flex; flex-direction: column; gap: 5px; }
.ph-label { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; color: var(--color-text); }
.ph-label b { font-size: 13.5px; }
.ph-label small { color: var(--color-text-faint); font-weight: 500; }
.ph-bar { position: relative; display: flex; height: 7px; border-radius: 999px; background: var(--color-surface-muted); overflow: hidden; }
.ph-bar span { height: 100%; display: block; transition: width .5s cubic-bezier(.22,.61,.36,1); }
.ph-bar span.ok { background: var(--ok, #22c55e); }
.ph-bar span.warn { background: var(--amber, #e0a12b); }
.ph-bar span.prim { background: var(--color-primary); }
.ph-bar span.cyan { background: var(--cyan, #2ca6a4); }
.ph-foot { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; color: var(--color-text-muted); padding-top: 2px; }
.ph-foot b { color: var(--color-text); font-size: 13.5px; }

/* Тултип тепловой карты «Когда отвечают» */
/* Только внутри аналитики: голый .hc совпадал с контейнером проверки «человек или бот» на
   странице входа и рисовал ему фиолетовую обводку при наведении. */
.anx .hc { transition: outline-color .1s ease; outline: 1.5px solid transparent; outline-offset: -1px; cursor: default; }
.anx .hc:hover { outline-color: var(--color-primary); }
.heat-tip { position: absolute; z-index: 30; transform: translate(-50%, -100%); pointer-events: none; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 9px; padding: 6px 9px; box-shadow: 0 8px 24px rgba(0,0,0,.35); white-space: nowrap; }
.heat-tip b { display: block; font-size: 12px; color: var(--color-text); }
.heat-tip span { display: block; font-size: 11.5px; color: var(--color-text-muted); margin-top: 1px; }
