:root {
    --bg-color: #06070a;
    --card-bg: rgba(255, 255, 255, 0.03);
    --accent: #00ff88;
    --text: #ffffff;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

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

.background-glow {
    position: fixed;
    top: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 255, 136, 0.1) 0%, transparent 70%);
    z-index: -1;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.logo span {
    color: var(--accent);
}

.system-status {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 1px;
    animation: blink 2s infinite;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(760px, 1.8fr) minmax(500px, 1.2fr);
    gap: 24px;
    padding: 0 2.5vw 4vh 2.5vw;
    max-width: 1920px;
    margin: 0 auto;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.card-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    display: inline-block;
}

.video-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #000;
    aspect-ratio: 4/3;
}

.video-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

h3 {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.event-text {
    font-size: clamp(2rem, 2.8vw, 3.2rem);
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    line-height: 1.1;
    word-break: break-word;
}

.stat-card {
    margin-bottom: 30px;
    text-align: center;
}

.info-section {
    display: grid;
    gap: 16px;
    align-content: start;
}

.info-section .stat-card {
    margin-bottom: 0;
}

/* Таблицы */
.table-wrapper {
    overflow-x: auto;
}

.table-wrapper td,
.table-wrapper th {
    white-space: nowrap;
}

.table-wrapper td:nth-child(2),
.table-wrapper th:nth-child(2) {
    white-space: normal;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-dim);
    font-size: 0.8rem;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 15px 0;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.count-badge {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.module-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 12px;
}

.module-card.active {
    border-color: rgba(0, 255, 136, 0.7);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.25);
}

.module-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-weight: 700;
}

.module-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.module-state {
    white-space: nowrap;
    color: var(--accent);
    font-size: 0.78rem;
}

.module-meta {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.module-status {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
}

.pill.on {
    color: var(--accent);
    border-color: rgba(0, 255, 136, 0.6);
    background: rgba(0, 255, 136, 0.12);
}

/* Панель управления */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--glass-border);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
}

.tuning-section {
    align-self: start;
}

.tuning-card {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow: auto;
}

.settings-accordion summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.settings-accordion summary::-webkit-details-marker {
    display: none;
}

.settings-accordion summary::before {
    content: "▸";
    color: var(--accent);
    margin-right: 8px;
}

.settings-accordion[open] summary::before {
    content: "▾";
}

.settings-accordion {
    margin-bottom: 10px;
}

.settings-accordion:last-of-type {
    margin-bottom: 0;
}

.preset-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.preset-btn {
    padding: 7px 8px;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--glass-border);
}

.preset-btn.active {
    border-color: rgba(0, 255, 136, 0.7);
    color: var(--accent);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.25);
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 8px;
}

.setting-item label {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 700;
}

.setting-item input[type="range"] {
    width: 100%;
}

.setting-item span {
    min-width: 34px;
    text-align: right;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.8rem;
}

.switch-row {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.switch-row input {
    accent-color: var(--accent);
}

.btn-ghost {
    width: 100%;
    margin-top: 14px;
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(0, 255, 136, 0.5);
}

.btn-ghost:hover {
    background: rgba(0, 255, 136, 0.08);
}

.btn-logout {
    padding: 8px 14px;
    font-size: 0.72rem;
    background: rgba(255, 68, 68, 0.15);
    color: #ffd6d6;
    border: 1px solid rgba(255, 68, 68, 0.4);
}

.btn-logout:hover {
    background: rgba(255, 68, 68, 0.28);
}

select {
    background: #1e2130;
    color: white;
    border: 1px solid var(--glass-border);
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
}

button {
    padding: 10px 25px;
    border-radius: 8px;
    border: none;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-start {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
}

.btn-stop {
    background: #ff4444;
    color: white;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

.btn-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(255, 68, 68, 0.6);
}

@media (max-width: 1320px) {
    .dashboard {
        grid-template-columns: 1fr 1fr;
    }
    .tuning-section {
        grid-column: 1 / -1;
    }
    .tuning-card {
        position: static;
        max-height: none;
    }
    .modules-grid {
        grid-template-columns: 1fr;
    }
}

.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card h2 {
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.auth-card h2 span {
    color: var(--accent);
}

.auth-card p {
    color: var(--text-dim);
    margin-bottom: 18px;
}

.auth-form {
    display: grid;
    gap: 10px;
}

.auth-form label {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 700;
}

.auth-form input {
    background: #1e2130;
    color: var(--text);
    border: 1px solid var(--glass-border);
    padding: 10px 12px;
    border-radius: 8px;
}

.auth-error {
    background: rgba(255, 68, 68, 0.15);
    border: 1px solid rgba(255, 68, 68, 0.4);
    color: #ffb3b3;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
}
