body {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(-45deg, #f6f9fc, #e3f0ff, #fef6ff, #f6fff7);
    background-size: 400% 400%;
    animation: gradientBG 20s ease-in-out infinite;
    transition: background 0.5s, color 0.5s;
    color: #212529;
}
@keyframes gradientBG {
    0% {background-position: 0% 50%;}
    50% {background-position: 100% 50%;}
    100% {background-position: 0% 50%;}
}
html[data-bs-theme='dark'] body {
    background: linear-gradient(-45deg, #232526, #414345, #141e30, #243b55);
    background-size: cover;
    animation: none;
    background-position: center;
    color: #f1f1f1;
}
.topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    border-radius: 0 0 2rem 2rem;
    margin: 0 auto 40px auto;
    width: 100%;
    max-width: 90vw;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(5px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.1);
    min-height: 70px;
    padding: 0 2rem;
    transition: background 0.5s;
    z-index: 100;
    display: flex;
    align-items: center;
}
html[data-bs-theme='dark'] .topbar {
    background: rgba(30,30,30,0.9);
}
.logo-link {
    color: inherit;
}
.logo-text {
    letter-spacing: 1px;
}
.nav-btn {
    margin-left: 1rem;
    margin-right: 0.2rem;
}
.nav.flex-row {
    display: flex;
    align-items: center;
}
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    transition: color 0.5s, background-color 0.5s, border-color 0.5s;
}
html[data-bs-theme='dark'] .btn-outline-primary,
html[data-bs-theme='dark'] .btn-outline-secondary {
    color: #f1f1f1;
    border-color: #888;
}
html[data-bs-theme='dark'] .btn-outline-primary:hover,
html[data-bs-theme='dark'] .btn-outline-primary:focus {
    background-color: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}
html[data-bs-theme='dark'] .btn-outline-secondary:hover,
html[data-bs-theme='dark'] .btn-outline-secondary:focus {
    background-color: #6c757d;
    color: #fff;
    border-color: #6c757d;
}
html[data-bs-theme='dark'] .btn-outline-danger {
    color: #fff;
    border-color: #dc3545;
}
html[data-bs-theme='dark'] .btn-outline-danger:hover,
html[data-bs-theme='dark'] .btn-outline-danger:focus {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* Dashboard blocks */
.dashboard-block {
    cursor: pointer;
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    transition: transform 0.1s, box-shadow 0.15s;
    min-height: 310px;
    background: var(--bs-card-bg, #fff);
    overflow: hidden;
    position: relative;
    perspective: 900px;
}
.dashboard-block:active,
.dashboard-block:focus {
    outline: 2px solid #0d6efd;
    box-shadow: 0 4px 32px rgba(13,110,253,0.12);
    z-index: 2;
}
.dashboard-block:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 32px rgba(13,110,253,0.07);
}

/* Flip-card styles */
.dashboard-flip {
    perspective: 1200px;
}
.dashboard-flip-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4,0.2,0.2,1);
    transform-style: preserve-3d;
}
.dashboard-flip.flipped .dashboard-flip-inner {
    transform: rotateY(180deg);
}
.dashboard-flip-front,
.dashboard-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    top: 0; left: 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.dashboard-flip-back {
    transform: rotateY(180deg);
    background: var(--bs-card-bg, #fff);
    /* overflow-y: auto; */
}

.gauge-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gauge-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    color: #0d6efd;
    text-shadow: 0 1px 4px rgba(13,110,253,0.08);
}
html[data-bs-theme='dark'] .gauge-label {
    color: #66b2ff;
}

/* Card for OpenVPN configs */
#openvpn-configs {
    width: 100%;
    min-height: 80px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
#openvpn-configs .card {
    min-width: 120px;
    flex: 1 1 120px;
    padding: 0.5rem;
    margin-bottom: 0;
}
/* Стили для кнопки "Назад" */
.flip-back-btn {
    align-self: center;
    min-width: 80px;
}

@media (max-width: 767.98px) {
    .dashboard-block {
        min-height: 260px;
    }
    .dashboard-flip-front, .dashboard-flip-back {
        padding: 1rem;
    }
}

.settings-tabs .nav-link {
    border-radius: 0.5rem;
    margin-right: 0.5rem;
    font-weight: 500;
    color: #0d6efd;
}
.settings-tabs .nav-link.active {
    background: #0d6efd;
    color: #fff;
}
@media (max-width: 767.98px) {
    .settings-tabs .nav-link {
        margin-bottom: 0.5rem;
        width: 100%;
    }
}



.client-stat-block {
    border-radius: 1rem;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 16px rgba(13,110,253,0.07);
    padding: 1.2rem 1rem;
    text-align: center;
    min-height: 104px;
    transition: background .4s,box-shadow .2s;
}
html[data-bs-theme='dark'] .client-stat-block {
    background: rgba(40,42,48,0.95);
}
.client-stat-block:hover {
    box-shadow: 0 4px 24px rgba(13,110,253,0.13);
    background: #f1f5ff;
}
html[data-bs-theme='dark'] .client-stat-block:hover {
    background: #23262f;
}
.stat-num {
    font-size: 2.3em;
    font-weight: bold;
    color: #0d6efd;
}
html[data-bs-theme='dark'] .stat-num {
    color: #66b2ff;
}
.stat-label {
    font-size: 1em;
    color: #666;
}
html[data-bs-theme='dark'] .stat-label {
    color: #aaa;
}
.client-table th {
    background: #f7f9fc;
    color: #4f5786;
    font-weight: 600;
    border-bottom: 2px solid #e1e7f5;
}
html[data-bs-theme='dark'] .client-table th {
    background: #23262f;
    color: #b6c2ee;
    border-bottom: 2px solid #35384a;
}
.client-table td {
    vertical-align: middle;
}
.status-connected { color: #20d465; font-weight: bold; }
.status-expired { color: #ff4a4a; font-weight: bold; }
.status-free { color: #a9b7ff; font-weight: bold; }