:root {
    --bg-color: #1a1a2e;
    --text-color: #ffffff;
    --text-muted: #8899a6;

    /* Стекло */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 20px 40px rgba(0,0,0,0.4);

    /* Элементы форм */
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-border: 1px solid rgba(255, 255, 255, 0.1);
    --input-focus: #4cc9f0;

    /* Кнопки */
    --btn-gradient: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);

    /* Статусы */
    --danger-bg: rgba(255, 107, 107, 0.2);
    --danger-text: #ff6b6b;
    --success-bg: rgba(40, 167, 69, 0.2);
    --success-text: #98eebb;
}

/* === Глобальные настройки === */
body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 60px; /* Отступ снизу, чтобы контент не перекрывался баром лицензии */
}

/* На мобильных убираем лишние отступы body */
@media (max-width: 600px) {
    body { padding: 10px; padding-bottom: 70px; }
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
h1, h2, h3 { margin-top: 0; font-weight: 300; letter-spacing: 1px; }

/* === Навигация === */
.header-nav {
    width: 100%;
    max-width: 1400px;
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
}
.back-link {
    color: #4cc9f0;
    font-weight: 500;
    padding: 5px 0;
}
.back-link:hover { text-decoration: underline; }

/* === СТЕКЛЯННЫЕ ПАНЕЛИ === */
.glass-panel, .login-box, .panel, .card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 30px;
    color: white;
    box-sizing: border-box;
    max-width: 100%;
}

/* === Поля ввода === */
input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border-radius: 12px;
    border: var(--input-border);
    background: var(--input-bg);
    color: white;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
    transition: border 0.2s, background 0.2s;
}

input:focus, select:focus {
    border-color: var(--input-focus);
    background: rgba(0,0,0,0.5);
}
select option { background: #1a1a2e; color: white; }

/* === Кнопки === */
button, .btn {
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
    display: inline-block;
    color: white;
    transition: transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
}
button:hover, .btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4); }
button:active, .btn:active { transform: translateY(0); }

.btn-primary { background: var(--btn-gradient); width: 100%; }
.btn-success { background: #28a745; width: 100%; margin-top: 10px; }
.btn-edit { background: #ffc107; color: #333; padding: 8px 12px; }
.btn-del { background: #dc3545; padding: 8px 12px; }
.btn-icon { margin-left: 5px; }
.btn-close { background: #6c757d; display: block; width: 100%; max-width: 150px; margin: 20px auto 0; }
.logout-btn { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }
.logout-btn:hover { background: #dc3545; border-color: transparent; }

/* === ЛОГИН === */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    width: 100%;
}
.login-box {
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.helper-text { font-size: 12px; color: var(--text-muted); text-align: left; margin-top: -10px; margin-bottom: 20px; padding-left: 5px; }

/* === DASHBOARD === */
.dashboard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin-top: 40px;
}

.grid-services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    width: 100%;
    margin-bottom: 40px;
}

.service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 160px;
    text-decoration: none;
    color: white;
    transition: transform 0.2s, background 0.2s;
    text-align: center;
}
.service-card:hover { transform: scale(1.03); background: rgba(255, 255, 255, 0.1); }
.service-card img { width: 50px; height: 50px; margin-bottom: 15px; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.5)); }
.service-card span { font-size: 1.1rem; font-weight: 500; word-break: break-word; }

/* === ADMIN PANEL === */
.admin-container {
    display: flex;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    align-items: flex-start;
}

.panel-col {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .admin-container {
        flex-direction: column;
    }
    .panel-col {
        width: 100%;
        margin-bottom: 20px;
    }
}

/* Списки */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.list-item:last-child { border-bottom: none; }

.list-info { display: flex; align-items: center; gap: 15px; overflow: hidden; }
.list-info div { overflow: hidden; text-overflow: ellipsis; }

.list-info img {
    width: 40px; height: 40px;
    min-width: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: white;
    padding: 2px;
}

/* Чекбоксы */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    margin: 10px 0;
    border: 1px solid rgba(255,255,255,0.05);
}
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.check-row input { margin: 0; }
.check-row img { width: 20px; height: 20px; background: white; border-radius: 4px; }

/* === ТАБЛИЦА (Адаптивность) === */
.table-scroll-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 15px;
    border-radius: 8px;
}

.logs-table {
    min-width: 700px;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.logs-table th { text-align: left; padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.2); color: var(--text-muted); }
.logs-table td { padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); }

.status-badge { padding: 4px 8px; border-radius: 4px; font-weight: bold; font-size: 10px; color: #1a1a2e; white-space: nowrap;}
.status-success { background: #98eebb; color: #155724; }
.status-fail { background: #ffadad; color: #721c24; }

/* Уведомления */
.alert-box, .success-box {
    padding: 15px; border-radius: 12px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; box-sizing: border-box;
}
.alert-box { background: var(--danger-bg); border: 1px solid rgba(255, 107, 107, 0.3); color: var(--danger-text); }
.success-box { background: var(--success-bg); border: 1px solid rgba(40, 167, 69, 0.3); color: var(--success-text); flex-direction: column; text-align: center;}

/* Бейджи */
.badge { padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: bold; color: #333; white-space: nowrap; }
.badge-pass { background: #e2e6ea; }
.badge-totp { background: #cce5ff; }

/* === МОДАЛЬНЫЕ ОКНА === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay:target { display: flex; }

.modal-content {
    position: relative;
    background: #232338;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    color: white;
    margin-top: 50px;
    margin-bottom: 50px;
}

.modal-content input, .modal-content select { margin-bottom: 15px; }

/* === НИЖНИЙ БАР ЛИЦЕНЗИИ (Стилизованный) === */
/* === НИЖНИЙ БАР ЛИЦЕНЗИИ === */
.license-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    background: rgba(26, 26, 46, 0.95); /* Почти непрозрачный темный фон */
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    font-size: 14px;
    color: var(--text-muted);
}

/* Общий стиль плашки */
.license-bar strong {
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid transparent; /* Рамка по умолчанию прозрачная */
    letter-spacing: 0.5px;
    transition: 0.3s;
}

/* === ЦВЕТОВЫЕ СХЕМЫ === */

/* 1. Активная: Светло-зеленый (в стиле Success Box) */
.license-status-ok {
    background: rgba(40, 167, 69, 0.2) !important;       /* Прозрачный зеленый фон */
    border-color: rgba(40, 167, 69, 0.3) !important;     /* Тонкая рамка */
    color: #98eebb !important;                           /* Светло-зеленый текст */
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.1);         /* Легкое свечение */
}

/* 2. Истекает: Желтый (в стиле Warning) */
.license-status-warn {
    background: rgba(255, 193, 7, 0.15) !important;
    border-color: rgba(255, 193, 7, 0.3) !important;
    color: #ffe082 !important;
}

/* 3. Истекла: Красный (Точно как Alert Box "Неверный логин") */
.license-status-fail {
    background: rgba(255, 107, 107, 0.15) !important;    /* Темно-красная подложка */
    border-color: rgba(255, 107, 107, 0.3) !important;   /* Красная рамка */
    color: #ff6b6b !important;                           /* Текст цвета лосося */
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.1);       /* Тревожное свечение */
}}