/* Вкладка «Приложение»: аналитика мобильного приложения (admin-app.js).
   Всё на токенах admin.css — тот же язык, что у остальной админки. */

/* ─── Подвкладки ─── */
.app-subnav {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: var(--surface);
    border-radius: var(--r-md);
    box-shadow: var(--ring);
    overflow-x: auto;
    scrollbar-width: none;
}
.app-subnav::-webkit-scrollbar { display: none; }
.app-subnav button {
    flex: 1 0 auto;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--r-sm);
    white-space: nowrap;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.app-subnav button:hover { color: var(--text); }
.app-subnav button.active { background: var(--surface-3); color: var(--text); }

/* Переключатель периода в заголовке секции */
.app-range { display: inline-flex; gap: 2px; padding: 2px; background: var(--bg-elev); border-radius: var(--r-sm); box-shadow: var(--ring); }
.app-range button {
    border: 0; background: transparent; color: var(--text-dim);
    font-size: 0.76rem; font-weight: 500; padding: 4px 10px; border-radius: var(--r-xs);
}
.app-range button.active { background: var(--surface-3); color: var(--text); }

.app-grid-2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .app-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.app-grid-2 > .section { margin-bottom: 0; }
.app-grid-2 + .section, .app-grid-2 + .app-grid-2 { margin-top: 12px; }

.app-chart { position: relative; height: 240px; }
.app-chart.tall { height: 300px; }

/* ─── Распределения: подпись · полоска · число ─── */
.hbar-list { display: flex; flex-direction: column; gap: 9px; }
.hbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 2px 10px;
    font-size: 0.84rem;
}
.hbar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hbar-label small { color: var(--text-dim); margin-left: 6px; font-size: 0.74rem; }
.hbar-value { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.hbar-value b { color: var(--text); font-weight: 600; margin-right: 6px; }
.hbar-track { grid-column: 1 / -1; height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.5s var(--ease); }
.hbar.clickable { cursor: pointer; }
.hbar.clickable:hover .hbar-label { color: var(--accent-2); }
.hbar-empty { color: var(--text-dim); font-size: 0.84rem; padding: 6px 0; }

/* ─── Доступность: цвет процента и тепловая карта ─── */
.avail-good { color: var(--success); }
.avail-warn { color: var(--warning); }
.avail-bad { color: var(--danger); }
.avail-none { color: var(--text-dim); }

.heatmap { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 0.8rem; }
.heatmap th { color: var(--text-muted); font-weight: 500; padding: 4px 6px; white-space: nowrap; }
.heatmap thead th { text-align: center; font-size: 0.74rem; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.heatmap tbody th { text-align: left; }
.heatmap td {
    text-align: center; padding: 7px 4px; border-radius: var(--r-xs);
    font-variant-numeric: tabular-nums; font-weight: 600; min-width: 58px;
}
.heat-good { background: rgba(63, 185, 80, 0.16); color: #57c76a; }
.heat-warn { background: rgba(217, 158, 51, 0.18); color: #e0ad50; }
.heat-bad { background: rgba(242, 86, 77, 0.2); color: #f5736c; }
.heat-none { background: var(--surface-2); color: var(--text-dim); font-weight: 400; }

.loc-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.loc-flag { font-size: 1.05rem; line-height: 1; }
.kind-badge { font-size: 0.66rem; padding: 2px 6px; border-radius: 5px; font-weight: 600; letter-spacing: 0.02em; }
.kind-antijam { background: rgba(255, 138, 61, 0.14); color: #ff9f5f; }
.kind-gaming { background: var(--surface-3); color: var(--text-muted); }

/* ─── События ─── */
.event-list { display: flex; flex-direction: column; }
.event-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 4px 12px;
    padding: 9px 2px;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
}
.event-row:last-child { border-bottom: 0; }
.event-time { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.event-main { min-width: 0; }
.event-meta { color: var(--text-dim); font-size: 0.76rem; margin-top: 2px; overflow-wrap: anywhere; }
.event-meta a { color: var(--accent-2); cursor: pointer; text-decoration: none; }

/* ─── Таблица устройств ─── */
.dev-name { font-weight: 500; }
.dev-sub { color: var(--text-dim); font-size: 0.76rem; }
.dot-online { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); margin-right: 6px; vertical-align: middle; }
.dot-offline { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); margin-right: 6px; vertical-align: middle; }

/* Карточка пользователя: блок приложения */
.user-app-devices .dev-line {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.84rem;
}
.user-app-devices .dev-line:last-child { border-bottom: 0; }
.avail-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.avail-chip { font-size: 0.76rem; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); }
