/* ===== Базовые переменные ===== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2333;
    --bg-card-hover: #222d3f;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-green: #3fb950;
    --accent-green-dark: #238636;
    --accent-green-light: #56d364;
    --accent-red: #f85149;
    --accent-red-light: #ff7b72;
    --accent-orange: #d29922;
    --accent-yellow: #e3b341;
    --accent-blue: #58a6ff;
    --gauge-red: #da3633;
    --gauge-orange: #d29922;
    --gauge-green: #238636;
    --font-main: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 60px;
}

/* ===== Сброс ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== Шапка ===== */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

.logo-subtitle {
    font-size: 9px;
    letter-spacing: 2.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.current-datetime {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--bg-card);
    border-color: var(--text-secondary);
}

.tab-indicators {
    display: flex;
    gap: 6px;
}

.tab-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    padding: 0;
}

.tab-dot.active {
    background: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green);
    transform: scale(1.3);
}

.tab-dot:hover {
    transform: scale(1.2);
}

/* ===== Основной контент ===== */
.dashboard-main {
    height: calc(100vh - var(--header-height) - 4px);
    position: relative;
    overflow: hidden;
}

.tab-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 16px 20px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateX(40px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.tab-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.tab-panel::-webkit-scrollbar {
    width: 4px;
}

.tab-panel::-webkit-scrollbar-track {
    background: transparent;
}

.tab-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.tab-title {
    font-size: clamp(20px, 2.5vw, 30px);
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    border-left: 4px solid var(--accent-green);
    padding-left: 14px;
}

/* ===== Карточки ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.card:hover {
    border-color: var(--accent-blue);
}

.card.full-width {
    grid-column: 1 / -1;
}

.card-title {
    font-size: clamp(13px, 1.1vw, 16px);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chart-wrapper {
    flex: 1;
    min-height: 0;
    position: relative;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 100%;
}

/* ===== Сетка ===== */
.grid-layout {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

.grid-2col {
    grid-template-columns: 1fr 1fr;
}

.grid-3col {
    grid-template-columns: 1fr 1fr 1fr;
}

.grid-4col {
    grid-template-columns: 1fr 1.2fr 1.2fr 1fr;
}

/* ===== Прогресс-бар ===== */
.switch-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--bg-secondary);
    z-index: 200;
}

.switch-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    transition: width 0.1s linear;
}

/* ===== Адаптив ===== */
@media (max-width: 1400px) {
    .grid-4col {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1200px) {
    .grid-3col {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 992px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding: 6px 12px;
        height: 54px;
    }

    .logo-title {
        font-size: 13px;
    }

    .logo-subtitle {
        font-size: 8px;
    }

    .logo-icon {
        font-size: 22px;
    }

    .current-datetime {
        font-size: 11px;
    }

    .tab-panel {
        padding: 10px 12px;
    }

    .tab-title {
        font-size: 18px;
        margin-bottom: 10px;
        padding-left: 10px;
    }

    .grid-3col,
    .grid-2col,
    .grid-4col {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 12px;
        min-height: 150px;
    }

    .card-title {
        font-size: 12px;
    }

    .header-right {
        gap: 10px;
    }

    .tab-dot {
        width: 8px;
        height: 8px;
    }

    .theme-toggle {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 4px 8px;
        height: 48px;
    }

    .logo-title {
        font-size: 11px;
    }

    .logo-subtitle {
        font-size: 7px;
    }

    .logo-icon {
        font-size: 18px;
    }

    .logo {
        gap: 6px;
    }

    .current-datetime {
        font-size: 9px;
    }

    .tab-panel {
        padding: 6px 8px;
    }

    .tab-title {
        font-size: 15px;
        margin-bottom: 8px;
        padding-left: 8px;
    }

    .card {
        padding: 8px;
        min-height: 120px;
    }

    .card-title {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .grid-layout {
        gap: 8px;
        margin-bottom: 8px;
    }

    .header-right {
        gap: 6px;
    }

    .tab-dot {
        width: 6px;
        height: 6px;
    }

    .theme-toggle {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
}

.auto-switch-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-weight: 600;
}

.auto-switch-btn:hover {
    background: var(--bg-card);
    border-color: var(--text-secondary);
}

.auto-switch-btn.active {
    background: rgba(63, 185, 80, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* Адаптив */
@media (max-width: 768px) {
    .auto-switch-btn {
        font-size: 10px;
        padding: 2px 8px;
    }
}