/* ============================================================
   vpn.masuda.tech — Admin Panel CSS  (V4 — Premium Dark Edition)
   ============================================================ */

/* ── Blob animations (Смягченные и медленные) ────────────── */

@keyframes ambientDrift1 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(5vw, -5vh) scale(1.1);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes ambientDrift2 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(-5vw, 6vh) scale(0.9);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes ambientDrift3 {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(calc(-50% + 3vw), calc(-50% + 4vh)) scale(1.05);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ── Global reset & theme variables ──────────────────────── */

:root {
    /* Более глубокий и холодный черный фон */
    --bg: #050509;
    --accent: #FF8000;
    --accent-h: #FF9933;

    /* Приглушенные цвета фонового свечения (оранжевый + глубокий синий для объема) */
    --blob1: rgba(255, 128, 0, 0.35);
    --blob2: rgba(60, 50, 180, 0.25);
    --blob3: rgba(255, 60, 0, 0.25);

    /* Более чистое и темное стекло */
    --glass-bg: rgba(15, 15, 20, 0.5);
    --glass-bg-hover: rgba(25, 25, 32, 0.6);
    --bg2: rgba(255, 255, 255, 0.02);
    --bg3: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.12);

    --blur-card: blur(24px);
    --blur-sidebar: blur(32px);
    --blur-modal: blur(24px);

    /* Аккуратные тени без грязи */
    --shadow-glass: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 128, 0, 0.15);
    --inner-highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.04);

    /* Text */
    --text: #94a3b8;
    --text-dim: #64748b;
    --text-h: #ffffff;

    /* Status palette */
    --green: #10b981;
    --red: #f43f5e;
    --yellow: #f59e0b;
    --blue: #3b82f6;
    --orange: #f97316;

    /* Layout */
    --sidebar-w: 260px;
    --radius: 16px;

    font: 14.5px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    color-scheme: dark;
    -webkit-font-smoothing: antialiased;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100svh;
    background: var(--bg);
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-h);
}

/* ── Animated ambient background ──────────────────────────── */

.bg-root {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: var(--bg);
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.25;
    /* Прозрачность компенсируется мягкими цветами в переменных */
    will-change: transform;
}

.blob1 {
    width: 60vw;
    height: 60vw;
    background: var(--blob1);
    top: -20vh;
    left: -10vw;
    animation: ambientDrift1 30s ease-in-out infinite;
}

.blob2 {
    width: 50vw;
    height: 50vw;
    background: var(--blob2);
    bottom: -20vh;
    right: -10vw;
    animation: ambientDrift2 35s ease-in-out infinite;
}

.blob3 {
    width: 40vw;
    height: 40vw;
    background: var(--blob3);
    top: 50%;
    left: 60%;
    animation: ambientDrift3 40s ease-in-out infinite;
}

/* ── Shell (grid) ─────────────────────────────────────────── */

#root {
    position: relative;
    z-index: 1;
}

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100svh;
}

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
    background: rgba(3, 3, 8, 0.4);
    backdrop-filter: var(--blur-sidebar);
    -webkit-backdrop-filter: var(--blur-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 200;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    /* Делаем тень мощнее и добавляем внутренний блик на правую грань */
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.6), inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--blob3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    box-shadow: var(--shadow-glow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.logo-text {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-h);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.logo-sub {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: all .2s ease;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--bg3);
    color: var(--text-h);
    text-decoration: none;
}

.nav-item--active {
    background: var(--glass-bg);
    color: var(--text-h);
    border: 1px solid var(--border-light);
    /* Меняем огромную тень на аккуратное свечение, чтобы она не ломалась о края сайдбара */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), var(--inner-highlight);
}

.nav-item--active .nav-icon {
    color: var(--accent);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    transition: color .2s;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
}

.nav-item:hover .nav-icon {
    color: var(--text-h);
}

/* Deprecated dot — kept for compat */
.nav-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--bg3);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.nav-dot--active {
    background: var(--accent);
    border-color: var(--accent);
}

.sidebar-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    padding: 16px 14px 6px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--border);
    box-shadow: var(--inner-highlight);
    margin-bottom: 12px;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blob2));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(255, 128, 0, 0.3);
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-h);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-version {
    font-size: 11px;
    color: var(--text-dim);
    padding-left: 4px;
}

/* Theme switcher in sidebar footer */
.theme-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all .2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.theme-btn:hover {
    transform: translateY(-2px) scale(1.1);
}

.theme-btn--active {
    border-color: var(--text-h);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* ── Content ──────────────────────────────────────────────── */

.content {
    grid-column: 2;
    min-height: 100svh;
}

/* ── Mobile topbar ───────────────────────────────────────── */

.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(4, 4, 12, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-logo {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-h);
}

.topbar-hamburger {
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.topbar-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}

.topbar-hamburger:hover {
    background: var(--bg3);
}

/* ── Page ─────────────────────────────────────────────────── */

.page {
    padding: 0 40px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    margin-bottom: 24px;

    /* Чистая стеклянная шапка без градиентных масок */
    background: rgba(5, 5, 9, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);

    /* Отрицательные отступы, чтобы шапка прилипала к краям контента */
    margin-left: -40px;
    margin-right: -40px;
    padding-left: 40px;
    padding-right: 40px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-h);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(255, 128, 0, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 128, 0, 0.2);
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* Filter row below page-header */
.page-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text-dim);
    margin: 24px 0 10px;
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    outline: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-h));
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 14px rgba(255, 128, 0, .3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(255, 128, 0, .5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    filter: brightness(1.1);
}

.btn-ghost {
    background: var(--glass-bg);
    color: var(--text-h);
    border-color: var(--border);
    backdrop-filter: var(--blur-card);
    box-shadow: var(--inner-highlight);
}

.btn-ghost:hover {
    background: var(--glass-bg-hover);
    border-color: var(--border-light);
}

.btn-danger-outline {
    background: transparent;
    color: var(--red);
    border-color: rgba(248, 113, 113, .35);
}

.btn-danger-outline:hover:not(:disabled) {
    background: rgba(248, 113, 113, .10);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-danger {
    color: var(--red) !important;
}

.btn-icon {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    color: var(--text-dim);
    transition: all .2s;
    box-shadow: var(--inner-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--glass-bg-hover);
    color: var(--text-h);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.btn-icon:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.btn-icon--danger:hover {
    color: var(--red);
    border-color: rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.1);
}

.btn-icon--ok:hover {
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.1);
}

.btn-icon--edit:hover {
    color: var(--blue);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
}

/* ── Page Filters (Делаем панель фильтров выразительным блоком-карточкой) ── */
.page-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: var(--bg2);
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-glass);
    backdrop-filter: var(--blur-card);
}

/* ── Forms & Inputs (Светлые элементы на темном фоне) ── */
input,
select,
textarea {
    background: rgba(255, 255, 255, 0.06);
    /* Светлая подложка вместо черной */
    border: 1px solid var(--border-light);
    /* Выразительная рамка */
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-h);
    outline: none;
    transition: all .2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    width: 100%;
    font-family: inherit;
    appearance: none;
    /* Убираем старый системный дизайн браузера */
}

/* Кастомная стрелочка для всех выпадающих списков */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
    cursor: pointer;
}

select option {
    background: #0d0d1a;
}

.select-sm {
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    color: var(--text-h);
}

.input-sm {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-h);
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus,
.input-sm:focus,
.select-sm:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 128, 0, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ── Table ────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg);
    backdrop-filter: var(--blur-card);
    box-shadow: var(--shadow-glass), var(--inner-highlight);
    margin-bottom: 14px;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.table th {
    padding: 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
    transition: background 0.2s;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

.tr-muted td {
    opacity: .45;
}

.tr-warn td {
    background: rgba(251, 191, 36, .03);
}

.tr-error td {
    background: rgba(248, 113, 113, .04);
}

.td-bold {
    font-weight: 600;
    color: var(--text-h);
}

.td-mono {
    font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace;
    font-size: 13px;
    letter-spacing: -0.3px;
}

.td-dim {
    color: var(--text-dim);
}

.td-sm {
    font-size: 11.5px;
}

.td-warn {
    color: var(--yellow);
}

.td-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 48px;
    font-size: 14px;
}

.td-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.td-nowrap {
    white-space: nowrap;
}

.td-meta {
    max-width: 160px;
}

.table-sm td,
.table-sm th {
    padding: 6px 10px;
    font-size: 12px;
}

/* ── Badges ───────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-red {
    background: rgba(244, 63, 94, 0.15);
    color: var(--red);
    border-color: rgba(244, 63, 94, 0.3);
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.15);
    color: var(--yellow);
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue);
    border-color: rgba(59, 130, 246, 0.3);
}

.badge-orange {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange);
    border-color: rgba(249, 115, 22, 0.3);
}

.badge-gray {
    background: var(--bg3);
    color: var(--text-dim);
}

.badge-rose {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
}

.badge-amber {
    background: rgba(245, 158, 11, 0.15);
    color: var(--yellow);
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-dim {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border-color: var(--border);
}

/* ── Progress bar ─────────────────────────────────────────── */

.progress-track {
    position: relative;
    height: 5px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    min-width: 70px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px currentColor;
}

.bar-ok {
    background: var(--green);
}

.bar-warn {
    background: var(--yellow);
}

.bar-crit {
    background: var(--red);
}

/* ── KPI Cards ────────────────────────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-card);
    -webkit-backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-glass), var(--inner-highlight);
    transition: all .3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: var(--glass-bg-hover);
}

.kpi-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-h);
    line-height: 1.1;
    margin-bottom: 4px;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-sub {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 8px;
    display: inline-block;
    background: rgba(255, 128, 0, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.kpi-card--green {
    border-left: 3px solid var(--green);
}

.kpi-card--red {
    border-left: 3px solid var(--red);
}

.kpi-card--yellow {
    border-left: 3px solid var(--yellow);
}

.kpi-card--blue {
    border-left: 3px solid var(--blue);
}

.kpi-card--accent {
    border-left: 3px solid var(--accent);
}

/* ── Chart card ───────────────────────────────────────────── */

.chart-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-card);
    -webkit-backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-glass), var(--inner-highlight);
    transition: all .3s ease;
}

.chart-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-h);
    margin-bottom: 14px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 10px;
    flex-wrap: wrap;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-h);
}

.chart-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.chart-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-dim);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 48px;
}

.server-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.chip {
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text-dim);
    cursor: pointer;
    transition: all .15s;
    user-select: none;
}

.chip:hover {
    border-color: var(--accent);
    color: var(--text);
}

.chip--active {
    background: rgba(255, 128, 0, .15);
    border-color: var(--accent);
    color: var(--accent-h);
    box-shadow: 0 0 12px rgba(255, 128, 0, .15);
}

/* ── Alerts ───────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
    border: 1px solid transparent;
    backdrop-filter: blur(8px);
}

.alert-error {
    background: rgba(248, 113, 113, .10);
    border-color: rgba(248, 113, 113, .30);
    color: var(--red);
}

.alert-info {
    background: rgba(96, 165, 250, .10);
    border-color: rgba(96, 165, 250, .30);
    color: var(--blue);
}

.alert-ok {
    background: rgba(52, 211, 153, .10);
    border-color: rgba(52, 211, 153, .30);
    color: var(--green);
}

/* ── Spinner ──────────────────────────────────────────────── */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.page-loader {
    display: flex;
    justify-content: center;
    padding: 64px;
}

/* ── Pagination ───────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.page-info {
    font-size: 12px;
    color: var(--text-dim);
}

/* ── Modal ────────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(8px);
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: linear-gradient(180deg, rgba(15, 15, 25, 0.95) 0%, rgba(8, 8, 15, 0.95) 100%);
    backdrop-filter: var(--blur-modal);
    -webkit-backdrop-filter: var(--blur-modal);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    width: 560px;
    max-width: 100%;
    max-height: 90svh;
    /* Убрали overflow-y: auto отсюда */
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), var(--inner-highlight);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Защищает тень и скругления от слома */
}

.modal-lg {
    width: 680px;
}

.modal--wide {
    width: 680px;
}

.modal-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    /* Шапка всегда на месте */
}

.modal-header h2 {
    font-size: 16px;
    color: var(--text-h);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 18px;
    padding: 3px 8px;
    border-radius: 5px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg3);
    color: var(--text-h);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    /* Скроллится только контент внутри! */
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.modal-section {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin-top: 4px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Forms ────────────────────────────────────────────────── */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}

label.label-check {
    flex-direction: row;
    align-items: center;
    text-transform: none;
    font-size: 13px;
    letter-spacing: 0;
    color: var(--text);
    gap: 8px;
    padding-top: 14px;
}

.form-label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-check {
    display: flex;
    flex-direction: row; /* Явно перебиваем column из базового label */
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    cursor: pointer;
    user-select: none; /* Чтобы текст не выделялся при промахе кликом */
}

input,
select,
textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-h);
    outline: none;
    transition: all .2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(255, 128, 0, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type="checkbox"],
input[type="radio"] {
    appearance: auto !important; /* ГЛАВНЫЙ ФИКС: принудительно возвращаем системный вид */
    -webkit-appearance: checkbox !important; /* Для Safari/Chrome */
    width: 18px !important;
    height: 18px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

select option {
    background: #0d0d1a;
}

.select-sm {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: var(--text-h);
}

.input-sm {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-h);
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
}

.input-sm:focus {
    border-color: var(--accent);
}

/* ── Settings ─────────────────────────────────────────────── */

.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    backdrop-filter: var(--blur-card);
}

.settings-tab {
    flex: 1;
    padding: 8px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    border: none;
    background: none;
    transition: all .15s;
    text-align: center;
    white-space: nowrap;
}

.settings-tab:hover {
    color: var(--text-h);
}

.settings-tab--active {
    background: rgba(255, 255, 255, 0.10);
    color: var(--text-h);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .3);
}

.settings-group {
    margin-bottom: 28px;
}

.settings-list {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: var(--blur-card);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.setting-row:hover {
    background: rgba(255, 255, 255, .02);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-meta {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.setting-key {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
    color: var(--text-h);
}

.setting-desc {
    font-size: 11px;
    color: var(--text-dim);
}

.setting-control {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: center;
}

.setting-input {
    flex: 1;
}

.setting-input--dirty {
    border-color: var(--yellow) !important;
}

/* Theme picker */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.theme-option {
    border-radius: 10px;
    padding: 14px 12px;
    border: 2px solid var(--border);
    cursor: pointer;
    background: var(--bg2);
    transition: all .18s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    backdrop-filter: var(--blur-card);
}

.theme-option:hover {
    border-color: rgba(255, 255, 255, .2);
    transform: translateY(-2px);
}

.theme-option--active {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255, 128, 0, .2);
}

.theme-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 0 14px rgba(0, 0, 0, .4);
}

/* Admin list */
.admin-list {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: var(--blur-card);
    box-shadow: var(--shadow-glass), var(--inner-highlight);
}

.admin-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}

.admin-row:last-child {
    border-bottom: none;
}

.admin-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-info {
    flex: 1;
    min-width: 0;
}

.admin-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-h);
}

.admin-since {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 1px;
}

.admin-actions {
    display: flex;
    gap: 4px;
}

/* ── Plans grid ───────────────────────────────────────────── */

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.plan-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    box-shadow: var(--shadow-glass), var(--inner-highlight);
    transition: border-color .2s, transform .2s;
}

.plan-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-light);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: var(--glass-bg-hover);
}

.plan-card--inactive {
    opacity: .5;
}

.plan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.plan-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-h);
}

.plan-id {
    font-size: 11px;
    color: var(--text-dim);
    font-family: ui-monospace, Consolas, monospace;
    margin-top: 2px;
}

.plan-tier {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-h);
    background: rgba(255, 128, 0, .13);
    padding: 2px 8px;
    border-radius: 20px;
}

.plan-props {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-dim);
}

.plan-prices {
    display: flex;
    gap: 12px;
}

.price-rub {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-h);
}

.price-stars {
    font-size: 12px;
    color: var(--text-dim);
    align-self: flex-end;
    padding-bottom: 2px;
}

.plan-card-footer {
    display: flex;
    gap: 6px;
    margin-top: auto;
}

.plan-tag {
    display: inline-flex;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(255, 128, 0, 0.15), rgba(255, 128, 0, 0.05));
    color: var(--accent);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    border: 1px solid rgba(255, 128, 0, 0.2);
}

.tier-info {
    font-size: 12px;
    color: var(--text-dim);
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    line-height: 1.7;
}

.tier-info strong {
    color: var(--text);
}

/* ── Login screen ─────────────────────────────────────────── */

.login-screen {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-card {
    width: 380px;
    background: rgba(8, 8, 20, 0.80);
    backdrop-filter: var(--blur-modal);
    -webkit-backdrop-filter: var(--blur-modal);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 38px 34px 34px;
    box-shadow: var(--shadow), 0 0 60px rgba(255, 128, 0, .07);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.login-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-h);
    letter-spacing: -.3px;
}

.login-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 28px;
    padding-left: 44px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
}

.login-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 11px 13px;
    font-size: 14px;
    color: var(--text-h);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 128, 0, .15);
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: 11px;
    font-size: 14px;
    margin-top: 4px;
}

/* ── Detail drawer (user profile) ────────────────────────── */

.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 430px;
    max-width: 95vw;
    background: rgba(6, 6, 16, 0.85);
    backdrop-filter: var(--blur-modal);
    -webkit-backdrop-filter: var(--blur-modal);
    border-left: 1px solid var(--border);
    z-index: 250;
    overflow-y: auto;
    box-shadow: -8px 0 40px rgba(0, 0, 0, .5);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.detail-panel--open {
    transform: translateX(0);
}

.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(6, 6, 16, 0.90);
    backdrop-filter: blur(20px);
    z-index: 1;
}

.detail-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-section h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.detail-label {
    color: var(--text-dim);
    font-size: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-key {
    color: var(--text-dim);
}

.detail-val {
    color: var(--text-h);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

/* ── Logs ─────────────────────────────────────────────────── */

.log-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: center;
}

.log-search {
    display: flex;
    gap: 4px;
}

.log-message {
    max-width: 320px;
    color: var(--text);
}

.log-meta-pre {
    font-size: 10px;
    color: var(--text-dim);
    font-family: ui-monospace, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
    background: rgba(0, 0, 0, .4);
    border-radius: 5px;
    padding: 6px 8px;
    margin-top: 4px;
}

.log-level-info {
    color: var(--blue);
}

.log-level-warn {
    color: var(--yellow);
}

.log-level-error {
    color: var(--red);
}

.log-level-debug {
    color: var(--text-dim);
}

/* ── Two-column layout ────────────────────────────────────── */

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

/* ── Info card & Info box ─────────────────────────────────── */

.info-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-glass), var(--inner-highlight);
}

.info-card h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.info-box {
    background: var(--bg2);
    backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 20px;
}

.info-box-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.info-box-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-box-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
}

.info-box-desc {
    color: var(--text-dim);
    line-height: 1.5;
}

/* Tier badge */
.tier-badge {
    display: inline-flex;
    padding: 2px 8px;
    background: rgba(255, 128, 0, .12);
    color: var(--accent-h);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: ui-monospace, Consolas, monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Top-list ─────────────────────────────────────────────── */

.top-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.top-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.top-list-item:last-child {
    border-bottom: none;
}

.top-rank {
    width: 20px;
    font-weight: 700;
    color: var(--text-dim);
    flex-shrink: 0;
    text-align: right;
    font-size: 11px;
}

.top-name {
    flex: 1;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-traffic {
    color: var(--text-dim);
    font-family: ui-monospace, Consolas, monospace;
    font-size: 11.5px;
    flex-shrink: 0;
}

/* Legacy top-item aliases */
.top-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    padding: 6px 0;
}

.top-item-rank {
    width: 18px;
    font-weight: 700;
    color: var(--text-dim);
    flex-shrink: 0;
    text-align: right;
}

.top-item-name {
    flex: 1;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-item-val {
    color: var(--text-dim);
    flex-shrink: 0;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 11.5px;
}

/* ── Expiring list ────────────────────────────────────────── */

.expiring-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.expiring-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    flex-wrap: wrap;
}

.expiring-item:last-child {
    border-bottom: none;
}

.expiring-key {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 11px;
    color: var(--text-h);
}

.expiring-user {
    color: var(--text-dim);
    flex: 1;
    min-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expiring-name {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.expiring-days {
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    color: var(--yellow);
}

.expiring-days--urgent {
    color: var(--red);
}

.expiring-date {
    color: var(--yellow);
    font-weight: 600;
    flex-shrink: 0;
    font-size: 11.5px;
}

/* ── LineChart ────────────────────────────────────────────── */

.linechart-wrap {
    width: 100%;
}

.linechart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-h);
    margin-bottom: 10px;
}

.linechart-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.linechart-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-dim);
}

.linechart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.linechart-svg-wrap {
    position: relative;
}

.linechart-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(8, 8, 20, 0.90);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    box-shadow: var(--shadow);
    min-width: 130px;
    z-index: 10;
}

.linechart-tooltip-label {
    font-weight: 700;
    color: var(--text-h);
    margin-bottom: 6px;
    font-size: 11px;
}

.linechart-tooltip-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.linechart-tooltip-name {
    flex: 1;
    color: var(--text-dim);
}

.linechart-tooltip-val {
    font-weight: 700;
    color: var(--text-h);
    font-family: ui-monospace, Consolas, monospace;
}

/* ── Stat grid (compat) ───────────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg2);
    backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-card--accent {
    border-left: 3px solid var(--accent);
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-h);
    line-height: 1;
}

.stat-label {
    font-size: 11.5px;
    color: var(--text-dim);
}

.stat-sub {
    font-size: 11px;
    color: var(--text-dim);
}




/* ── Portal (client page) ─────────────────────────────────── */

.portal-screen {
    min-height: 100svh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Portal top navbar */
.portal-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    background: rgba(4, 4, 12, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
}

.portal-navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.portal-navbar-logo {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    object-fit: cover;
    flex-shrink: 0;
}

.portal-navbar-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-h);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-navbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.portal-hero {
    padding: 60px 40px 50px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.portal-logo-mark {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 0 40px rgba(255, 128, 0, .4);
    margin-bottom: 8px;
}

.portal-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-h);
    letter-spacing: -.6px;
}

.portal-sub {
    font-size: 16px;
    color: var(--text-dim);
    max-width: 480px;
    line-height: 1.6;
}

.portal-main {
    padding: 0 40px 60px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

.portal-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.portal-servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.portal-server-card {
    background: var(--bg2);
    backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color .2s, transform .2s;
}

.portal-server-card:hover {
    border-color: rgba(255, 255, 255, .18);
    transform: translateY(-2px);
}

.portal-server-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-h);
}

.portal-server-host {
    font-size: 11.5px;
    color: var(--text-dim);
    font-family: ui-monospace, Consolas, monospace;
}

.portal-cta {
    background: var(--bg2);
    backdrop-filter: var(--blur-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.portal-cta-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-h);
}

.portal-cta-sub {
    font-size: 13px;
    color: var(--text-dim);
}

/* ── Sortable table headers ───────────────────────────────── */

.th-sort {
    cursor: pointer;
    user-select: none;
    transition: color .15s;
}

.th-sort:hover {
    color: var(--text-h);
}

/* ── Cabinet screen ───────────────────────────────────────── */

.cabinet-screen {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Cabinet login input */
.login-input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text-h);
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
}
.login-input:focus {
    border-color: var(--accent);
}

/* Cabinet bottom-nav label — hide on very small phones */
@media (max-width: 360px) {
    .cab-nav-label { display: none !important; }
}

/* Cabinet page scroll — prevent overscroll bounce showing gap under bottom nav */
html.cabinet-page {
    overscroll-behavior-y: none;
}

/* ── Scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ── Responsive (Tablet 1024px) ───────────────────────────── */

@media (max-width: 1024px) {
    .row-3 {
        grid-template-columns: 1fr 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .form-row-3 {
        grid-template-columns: 1fr 1fr;
    }

    .page {
        padding: 20px 24px;
    }
}

/* ============================================================
   Фиксы для компонента Stats.jsx (адаптация inline-стилей)
   ============================================================ */

:root {
    /* Прокидываем алиас для рамки, чтобы React-код ее увидел */
    --border-color: var(--border); 
}

/* Хитрость: ловим блоки, у которых фон задан прямо в HTML-теге 
  через inline-стиль (как это делает Stats.jsx), и докидываем 
  к ним эффекты "стекла" из твоей дизайн-системы.
*/
.page [style*="var(--bg2)"] {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--blur-card) !important;
    -webkit-backdrop-filter: var(--blur-card) !important;
    box-shadow: var(--shadow-glass), var(--inner-highlight) !important;
}

/* Делаем внутренние плашки (с иконками) более выразительными */
.page [style*="var(--bg3)"] {
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* ============================================================
   Фикс для фильтров серверов (овальные кнопки-чипсы)
   ============================================================ */

/* Даем стекло всем кнопкам фильтров */
.page button[style*="border-radius: 99px"] {
    backdrop-filter: var(--blur-card) !important;
    -webkit-backdrop-filter: var(--blur-card) !important;
}

/* Стилизация именно АКТИВНОЙ кнопки (находим ее по font-weight: 600) */
.page button[style*="border-radius: 99px"][style*="font-weight: 600"] {
    /* Делаем ее ярче */
    filter: brightness(1.2);
    /* Добавляем внутренний блик для объема + легкое внешнее свечение цвета графика (currentColor) */
    box-shadow: 
        0 0 12px currentColor, 
        inset 0 1px 1px rgba(255, 255, 255, 0.2),
        inset 0 0 8px currentColor !important;
    /* Усиливаем контраст текста */
    text-shadow: 0 0 8px currentColor;
}

/* ============================================================
   Фикс Z-index для перекрытия (тултипы графиков, ховеры кнопок)
   ============================================================ */

/* 1. Кнопки фильтров: поднимаем активную и ту, на которую навели курсор */
.page button[style*="border-radius: 99px"] {
    position: relative;
    z-index: 1;
}

.page button[style*="border-radius: 99px"]:hover,
.page button[style*="border-radius: 99px"][style*="font-weight: 600"] {
    z-index: 50 !important;
}

/* 2. Карточки (графики, KPI, таблицы): чтобы тултип верхнего графика не прятался под нижним */
.page div[style*="var(--glass-bg)"],
.page div[style*="var(--bg2)"] {
    position: relative;
    z-index: 1;
}

.page div[style*="var(--glass-bg)"]:hover,
.page div[style*="var(--bg2)"]:hover {
    z-index: 40 !important;
}

/* ── Responsive (Mobile 768px) ───────────────────────────── */

@media (max-width: 768px) {
    :root {
        --sidebar-w: 260px;
    }

    /* Оболочка: убираем сетку колонок */
    .shell {
        grid-template-columns: 1fr;
    }

    /* Сайдбар прячется за левый край экрана */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 300;
    }

    .sidebar--open {
        transform: translateX(0);
    }

    /* Затемнение фона при открытом меню */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 299;
        animation: fadeIn 0.2s ease;
    }

    .content {
        grid-column: 1;
        width: 100vw;
        overflow-x: hidden;
    }

    /* Показываем мобильную шапку с гамбургером */
    .topbar {
        display: flex;
        justify-content: space-between;
    }

    .topbar-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
    }

    /* Адаптация отступов страницы */
    .page {
        padding: 16px 16px 40px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 16px;
        padding: 16px 0;
        margin-bottom: 16px;
    }

    .page-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    /* Фильтры и поиск друг под другом */
    .page-filters {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
        padding: 16px;
    }

    .page-filters>div,
    .page-filters>select,
    .page-filters>input {
        width: 100% !important;
        max-width: none !important;
    }

    /* Таблицы: горизонтальный скролл */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px 14px;
        padding: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        background: transparent;
        box-shadow: none;
    }

    .table {
        min-width: 540px;
    }

    /* Скрытые колонки на мобилке */
    .col-hide-sm {
        display: none !important;
    }

    /* Фильтры — горизонтальный скролл вместо столбца */
    .page-filters {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px;
        gap: 8px !important;
        align-items: center !important;
    }

    .page-filters > * {
        flex-shrink: 0;
        width: auto !important;
        max-width: none !important;
    }

    .page-filters > div:first-child {
        min-width: 200px;
        max-width: 240px !important;
    }

    /* Карточки KPI и статистики */
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .row-2 {
        grid-template-columns: 1fr;
    }

    .row-3 {
        grid-template-columns: 1fr;
    }

    /* Формы внутри модалок */
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .setting-meta {
        flex: none;
        width: 100%;
    }

    .detail-panel {
        width: 100%;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    /* Модальные окна на весь экран (вылезают снизу) */
    .modal-backdrop {
        align-items: flex-end;
        /* Прижимаем к низу */
        padding: 0;
    }

    .modal {
        width: 100%;
        border-radius: 20px 20px 0 0 !important;
        max-height: 90svh;
        border-bottom: none !important;
        animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Скролл для вкладок */
    .settings-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .settings-tabs::-webkit-scrollbar {
        display: none;
    }

    .settings-tab {
        flex: none;
        font-size: 13px;
        padding: 10px 16px;
    }

    /* Портал (клиентская часть) */
    .portal-hero {
        padding: 40px 20px 32px;
    }

    .portal-title {
        font-size: 26px;
    }

    .portal-main {
        padding: 0 20px 40px;
    }

    .portal-servers-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .portal-servers-grid {
        grid-template-columns: 1fr;
    }
}