/* ============================================================
   RustX Admin — аналитические дашборды и графики
   Дизайн-язык: острые углы через clip-path, без border-radius,
   палитра #C43F2B / #95C443, иконки Font Awesome.
   ============================================================ */

:root {
    --an-panel: rgba(255, 255, 255, 0.028);
    --an-panel-border: rgba(255, 255, 255, 0.075);
    --an-text-dim: rgba(255, 255, 255, 0.52);
    --an-text-mid: rgba(255, 255, 255, 0.72);
    --an-cut: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
    --an-cut-sm: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

/* ---------- Шапка страницы ---------- */

.an-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.an-head-left { min-width: 0; }

.an-head-sub {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    color: var(--an-text-dim);
    max-width: 68ch;
}

.an-head-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Честная плашка: данные ненастоящие */
.an-demo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e6b432;
    background: rgba(230, 180, 50, 0.12);
    border: 1px solid rgba(230, 180, 50, 0.3);
    clip-path: var(--an-cut-sm);
}

/* Обратная плашка: данные настоящие, из БД (страница «Доход») */
.an-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #95C443;
    background: rgba(149, 196, 67, 0.12);
    border: 1px solid rgba(149, 196, 67, 0.3);
    clip-path: var(--an-cut-sm);
}

/* Карточка-макет: числа внутри выдуманы. Гасится целиком и уходит в серый,
   чтобы её нельзя было спутать с настоящими данными даже боковым зрением.
   Полностью прятать нельзя — это напоминание о том, чего не хватает. */
.an-card-fake {
    filter: grayscale(1);
    opacity: 0.55;
    border-style: dashed;
    transition: opacity 0.15s ease;
}

.an-card-fake:hover {
    opacity: 0.85;
}

.an-card-fake .an-card-title {
    color: rgba(255, 255, 255, 0.6);
}

/* ---------- Переключатели периодов / режимов ---------- */

.an-switch {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut-sm);
    padding: 2px;
}

.an-switch button {
    background: none;
    border: none;
    color: var(--an-text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.42rem 0.8rem;
    cursor: pointer;
    transition: color .12s, background .12s;
    white-space: nowrap;
}

/* Обёртка-лента: переполнение остаётся внутри переключателя и не растягивает
   страницу горизонтально. Стрелки-подсказки и классы has-prev/has-next —
   общие, из .hscroll-wrap (styles.css + site.js). */
.an-switch-scroll {
    display: flex;
    min-width: 0;
    max-width: 100%;
}

.an-switch-scroll > .an-switch {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.an-switch-scroll > .an-switch::-webkit-scrollbar { display: none; }

/* Кнопки не сжимаются — иначе «этот месяц» переносится и ломает строку. */
.an-switch-scroll > .an-switch > button { flex: 0 0 auto; }

.an-switch button:hover { color: #fff; }

.an-switch button.active {
    background: var(--color-primary, #C43F2B);
    color: #fff;
}

/* Пересчёт под новый период: старые цифры остаются, но видно, что они уже неактуальны. */
.an-reload { transition: opacity .15s ease; }

.an-reload.busy {
    opacity: 0.38;
    pointer-events: none;
}

.an-reload-tag {
    display: inline-flex;
    align-items: center;
    color: var(--an-text-dim);
    font-size: 0.8rem;
    padding: 0 0.2rem;
}

/* ---------- Календарь периода ---------- */

.an-cal-wrap {
    position: relative;
    display: inline-flex;
}

.an-cal-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut-sm);
    color: var(--an-text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.48rem 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color .12s, background .12s;
}

.an-cal-toggle:hover { color: #fff; }

.an-cal-toggle.active {
    background: var(--color-primary, #C43F2B);
    border-color: var(--color-primary, #C43F2B);
    color: #fff;
    text-transform: none;
    letter-spacing: 0.02em;
}

/* Клик мимо календаря закрывает его — без этого он ловится только повторным нажатием. */
.an-cal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.an-cal {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 41;
    width: 268px;
    padding: 0.7rem;
    background: #16171a;
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.an-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.an-cal-head button {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--an-panel-border);
    color: var(--an-text-mid);
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: color .12s, background .12s;
}

.an-cal-head button:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.09); }
.an-cal-head button:disabled { opacity: 0.3; cursor: default; }

.an-cal-title {
    flex: 1;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.an-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.an-cal-wd {
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--an-text-dim);
    padding-bottom: 0.25rem;
}

.an-cal-day {
    height: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    color: var(--an-text-mid);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    transition: background .12s, color .12s;
}

.an-cal-day.empty { background: none; cursor: default; }
.an-cal-day:hover:not(:disabled):not(.empty) { background: rgba(255, 255, 255, 0.1); color: #fff; }
.an-cal-day:disabled { opacity: 0.22; cursor: default; }
.an-cal-day.today { border-color: rgba(149, 196, 67, 0.55); }
.an-cal-day.in-range { background: rgba(196, 63, 43, 0.22); color: #fff; }

.an-cal-day.edge {
    background: var(--color-primary, #C43F2B);
    color: #fff;
    font-weight: 700;
}

.an-cal-foot {
    margin-top: 0.6rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--an-panel-border);
}

.an-cal-sel {
    font-size: 0.72rem;
    color: var(--an-text-dim);
    margin-bottom: 0.5rem;
}

.an-cal-actions {
    display: flex;
    gap: 0.4rem;
}

.an-cal-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut-sm);
    color: var(--an-text-mid);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.45rem 0.5rem;
    cursor: pointer;
    transition: color .12s, background .12s;
}

.an-cal-btn:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.09); }
.an-cal-btn:disabled { opacity: 0.35; cursor: default; }

.an-cal-btn.primary {
    background: var(--color-primary, #C43F2B);
    border-color: var(--color-primary, #C43F2B);
    color: #fff;
}

.an-cal-btn.primary:hover:not(:disabled) { background: #d24a35; color: #fff; }

/* ---------- KPI ---------- */

.an-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.an-kpi {
    position: relative;
    padding: 0.85rem 0.9rem;
    background: var(--an-panel);
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut);
    min-width: 0;
}

.an-kpi-top {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--an-text-dim);
    margin-bottom: 0.45rem;
}

.an-kpi-top i { font-size: 0.8rem; opacity: 0.75; }

.an-kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.an-kpi-value .an-kpi-unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--an-text-dim);
    margin-left: 0.25rem;
}

.an-kpi-foot {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
    font-size: 0.75rem;
    color: var(--an-text-dim);
    min-width: 0;
}

.an-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 700;
    white-space: nowrap;
}

.an-delta.up { color: #95C443; }
.an-delta.down { color: #C43F2B; }
.an-delta.flat { color: rgba(255, 255, 255, 0.45); }

/* спарклайн в углу KPI */
.an-kpi-spark {
    display: block;
    width: 100%;
    height: 26px;
    margin-top: 0.5rem;
    overflow: visible;
}

/* ---------- Сетка панелей ---------- */

.an-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.6rem;
}

.an-card {
    grid-column: span 12;
    padding: 0.9rem 1rem 1rem;
    background: var(--an-panel);
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut);
    min-width: 0;
}

.an-card.span-4 { grid-column: span 4; }
.an-card.span-5 { grid-column: span 5; }
.an-card.span-6 { grid-column: span 6; }
.an-card.span-7 { grid-column: span 7; }
.an-card.span-8 { grid-column: span 8; }

.an-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.an-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.an-card-title i { color: var(--color-primary, #C43F2B); font-size: 0.85rem; }

.an-card-note {
    font-size: 0.75rem;
    color: var(--an-text-dim);
}

.an-card-hint {
    margin: 0.7rem 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--an-text-dim);
    border-left: 2px solid rgba(255, 255, 255, 0.12);
    padding-left: 0.6rem;
}

/* ---------- Графики (SVG) ---------- */

.chart-block { width: 100%; }

.chart-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-grid {
    stroke: rgba(255, 255, 255, 0.07);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.chart-axis-label {
    fill: rgba(255, 255, 255, 0.42);
    font-size: 11px;
    font-family: inherit;
}

.chart-marker-line {
    stroke-width: 1.2;
    stroke-dasharray: 4 4;
    opacity: 0.75;
}

.chart-marker-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-family: inherit;
}

.chart-peak-label {
    font-size: 11px;
    font-weight: 800;
    font-family: inherit;
}

/* ---------- Курсор и плашка значений ---------- */

.chart-cursor-line {
    stroke: rgba(255, 255, 255, 0.28);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    shape-rendering: crispEdges;
}

/* Цвет обводки точки под курсором — под фон карточки, чтобы точка «вырезалась» из линии. */
.chart-block {
    --chart-cursor-ring: #14171d;
}

.chart-tip-box {
    fill: rgba(12, 14, 18, 0.94);
    stroke: rgba(255, 255, 255, 0.14);
    stroke-width: 1;
}

.chart-tip-title {
    fill: rgba(255, 255, 255, 0.55);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: inherit;
}

.chart-tip-name {
    fill: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-family: inherit;
}

.chart-tip-value {
    fill: #fff;
    font-size: 11px;
    font-weight: 800;
    font-family: inherit;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    color: var(--an-text-mid);
}

.chart-legend-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}

.chart-empty {
    padding: 1.2rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--an-text-dim);
}

/* ---------- Donut ---------- */

.chart-donut {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.chart-donut-svg {
    width: 160px;
    height: 160px;
    flex: 0 0 auto;
}

.chart-donut-value {
    fill: #fff;
    font-size: 22px;
    font-weight: 800;
    font-family: inherit;
}

.chart-donut-label {
    fill: rgba(255, 255, 255, 0.45);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: inherit;
}

.chart-donut-legend {
    flex: 1 1 150px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.chart-donut-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    min-width: 0;
}

.chart-donut-name {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--an-text-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-donut-amount {
    flex: 0 0 auto;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.chart-donut-share {
    flex: 0 0 auto;
    min-width: 2.6em;
    text-align: right;
    font-weight: 700;
    color: var(--an-text-dim);
    font-variant-numeric: tabular-nums;
}

/* ---------- Горизонтальный рейтинг ---------- */

.chart-barlist {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chart-barlist-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    min-width: 0;
}

.chart-barlist-name {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    color: var(--an-text-mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-barlist-rank {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.07);
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

.chart-barlist-value {
    flex: 0 0 auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.chart-barlist-hint {
    margin-left: 0.4rem;
    font-weight: 500;
    font-size: 0.72rem;
    color: var(--an-text-dim);
}

.chart-barlist-track {
    height: 7px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.chart-barlist-fill {
    height: 100%;
    transition: width .25s ease;
}

/* ---------- Воронка ---------- */

.chart-funnel {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.chart-funnel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
    min-width: 0;
}

.chart-funnel-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-funnel-idx {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.6);
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

.chart-funnel-val {
    flex: 0 0 auto;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.chart-funnel-track {
    position: relative;
    height: 26px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.chart-funnel-fill {
    height: 100%;
    opacity: 0.85;
    transition: width .25s ease;
}

.chart-funnel-pct {
    position: absolute;
    top: 0;
    left: 0.55rem;
    line-height: 26px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
    pointer-events: none;
}

.chart-funnel-delta {
    margin-top: 0.3rem;
    font-size: 0.73rem;
    color: var(--an-text-dim);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.chart-funnel-delta.bad { color: #C43F2B; }
.chart-funnel-delta i { font-size: 0.7rem; }
.chart-funnel-hint { color: var(--an-text-dim); }

/* ---------- Тепловая карта ---------- */

.chart-heatmap-wrap {
    width: 100%;
    overflow-x: auto;
}

.chart-heatmap {
    border-collapse: separate;
    border-spacing: 2px;
    width: 100%;
    min-width: 520px;
}

.chart-heatmap th {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--an-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.3rem;
    white-space: nowrap;
}

.chart-heatmap-row { text-align: right; }
.chart-heatmap-corner { text-align: left; }

.chart-heatmap-cell {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 0.32rem 0.2rem;
    min-width: 30px;
    transition: outline .1s;
}

.chart-heatmap-cell:hover { outline: 1px solid rgba(255, 255, 255, 0.35); }
.chart-heatmap-cell.empty { background: rgba(255, 255, 255, 0.02); }

/* ---------- Таблицы внутри карточек ---------- */

.an-table-wrap { width: 100%; overflow-x: auto; }

.an-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 520px;
}

.an-table th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--an-text-dim);
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--an-panel-border);
    white-space: nowrap;
}

.an-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    color: var(--an-text-mid);
}

.an-table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.an-table .num { text-align: right; font-variant-numeric: tabular-nums; color: #fff; }
.an-table .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.75rem; }

/* ---------- Статусы / бейджи ---------- */

.an-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}

.an-badge.good { background: rgba(149, 196, 67, 0.16); color: #95C443; }
.an-badge.warn { background: rgba(230, 180, 50, 0.16); color: #e6b432; }
.an-badge.bad { background: rgba(196, 63, 43, 0.18); color: #C43F2B; }
.an-badge.mute { background: rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.6); }

/* ---------- Заглушки: вёрстка есть, данных ещё нет ----------
   Место под метрику, которую пока некому посчитать (нет сбора на игровом сервере,
   нет таблицы). Разметку не трогаем и не удаляем — гасим её визуально, чтобы
   заглушку нельзя было спутать с настоящим нулём. Когда источник появится,
   достаточно снять класс: ни одна строка вёрстки при этом не двигается.        */

.an-stub {
    position: relative;
    color: rgba(255, 255, 255, 0.28) !important;
    background: repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.02) 0 6px,
        rgba(255, 255, 255, 0.05) 6px 12px
    );
    filter: grayscale(1);
    cursor: not-allowed;
    user-select: none;
}

/* Карточка целиком: гасим содержимое и подписываем углом, что это не данные. */
.an-card.an-stub {
    opacity: 0.5;
}

.an-card.an-stub::after {
    content: "нет данных";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.07);
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

/* Пустая панель: данных нет не потому, что нет сбора, а потому что за период ничего не было. */
.an-empty {
    padding: 1.1rem 0.6rem;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
}

/* полоска-индикатор внутри таблиц (заполненность сервера и т.п.) */
.an-mini-bar {
    position: relative;
    height: 6px;
    min-width: 60px;
    background: rgba(255, 255, 255, 0.07);
}

.an-mini-bar span { display: block; height: 100%; }

/* ---------- Список событий ---------- */

.an-events { display: flex; flex-direction: column; gap: 0.15rem; }

.an-event {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    font-size: 0.8rem;
}

.an-event:last-child { border-bottom: none; }

.an-event-icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.06);
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}

.an-event-body { flex: 1 1 auto; min-width: 0; }
.an-event-text { color: var(--an-text-mid); }
.an-event-text strong { color: #fff; font-weight: 600; }
.an-event-time { font-size: 0.7rem; color: var(--an-text-dim); margin-top: 0.15rem; }

/* ---------- Фильтр по серверам: кнопки в шапке + модалка выбора ---------- */

/* Заголовок и переключатель в один ряд, переключатель прижат к заголовку. */
.an-head-inline {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.an-head-inline .an-switch button i {
    margin-right: 0.35rem;
    font-size: 0.7rem;
}

.an-srv-modal { max-width: 560px; }

/* Чипсы режимов: клик выбирает все серверы режима разом. */
.an-srv-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.an-srv-mode {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut-sm);
    color: var(--an-text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    transition: color .12s, background .12s;
}

.an-srv-mode:hover { color: #fff; }

.an-srv-mode.active {
    background: var(--color-primary, #C43F2B);
    border-color: transparent;
    color: #fff;
}

.an-srv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.an-srv-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--an-panel-border);
    clip-path: var(--an-cut-sm);
    padding: 0.6rem 0.7rem;
    cursor: pointer;
    text-align: left;
    transition: border-color .12s, background .12s;
}

.an-srv-card:hover { border-color: rgba(255, 255, 255, 0.25); }

.an-srv-card.on {
    background: rgba(196, 63, 43, 0.16);
    border-color: var(--color-primary, #C43F2B);
}

.an-srv-name {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.an-srv-tag {
    color: var(--an-text-dim);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Галка в правом верхнем углу: срез clip-path его не задевает. */
.an-srv-check {
    position: absolute;
    top: 0.45rem;
    right: 0.5rem;
    color: var(--color-primary, #C43F2B);
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity .12s;
}

.an-srv-card.on .an-srv-check { opacity: 1; }

/* ---------- Адаптив ---------- */

@media (max-width: 1100px) {
    .an-card.span-4,
    .an-card.span-5,
    .an-card.span-7,
    .an-card.span-8 { grid-column: span 6; }
}

@media (max-width: 760px) {
    .an-card,
    .an-card.span-4,
    .an-card.span-5,
    .an-card.span-6,
    .an-card.span-7,
    .an-card.span-8 { grid-column: span 12; }

    .an-kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .an-kpi-value { font-size: 1.35rem; }

    .an-head { flex-direction: column; align-items: stretch; min-width: 0; }
    .an-head-right { justify-content: flex-start; width: 100%; min-width: 0; }

    /* Лента пресетов на всю ширину, но листающаяся: раньше кнопки с nowrap
       не сжимались до нуля и выпирали за экран — отсюда горизонтальный
       скролл всей страницы. */
    .an-switch-scroll { width: 100%; }
    .an-switch-scroll > .an-switch { flex: 1 1 auto; }
    .an-switch button { padding: 0.45rem 0.7rem; }

    /* На телефоне поповер справа уезжал бы за экран — прижимаем к левому краю. */
    .an-cal-wrap { width: 100%; }
    .an-cal-toggle { width: 100%; justify-content: center; }
    .an-cal { right: auto; left: 0; width: min(100%, 300px); }

    .chart-donut { justify-content: center; }

    /* Карточки серверов в модалке ужимаются, но остаются сеткой. */
    .an-srv-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
