:root {
    --bg-main: #020617;
    --bg-card: #0f172a;
    --bg-darker: #0b0f19;
    --primary: #38bdf8;
    --accent-purple: #a855f7;
    --text-main: #f8fafc;
    --text-muted: #64748b;
    --border: #1e293b;
    --green: #22c55e;
    --amber: #f59e0b;
}

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

body {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    padding-top: 70px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: rgba(2, 6, 23, 0.85);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.flex-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
}

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

nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
    transition: color 0.2s;
}

nav a:hover, nav a.active { color: var(--primary); }

.page-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 15px;
}

.dashboard-section, .metrics-section, .infra-section, .terminal-section {
    padding: 60px 0;
    border-bottom: 1px solid var(--border);
}

/* Сетка Статистики */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 25px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--primary);
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-value span { font-size: 14px; color: var(--text-muted); }

.stat-trend { font-size: 12px; display: block; }
.stat-trend.up { color: var(--green); }
.stat-trend.down { color: var(--primary); }
.stat-trend.locked { color: var(--accent-purple); }

/* Раздел Графиков */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 25px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 25px;
    border-radius: 8px;
}

.chart-card h3 {
    font-size: 15px;
    margin-bottom: 20px;
    color: var(--text-main);
}

.svg-chart-container {
    background: var(--bg-darker);
    border-radius: 6px;
    padding: 10px;
    border: 1px solid #111827;
}

.line-chart path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 0;
}

.chart-legend {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    font-size: 12px;
}

.legend-item { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.dot-blue { width: 8px; height: 8px; background: var(--primary); border-radius: 50%; }
.dot-purple { width: 8px; height: 8px; background: var(--accent-purple); border-radius: 50%; }

/* Столбчатый график на CSS-флексах */
.bar-chart-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 200px;
    background: var(--bg-darker);
    border-radius: 6px;
    padding: 20px 10px 10px;
    border: 1px solid #111827;
}

.bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    width: 12%;
}

.bar {
    width: 100%;
    background: linear-gradient(to top, var(--accent-purple), var(--primary));
    border-radius: 4px 4px 0 0;
    position: relative;
    display: flex;
    justify-content: center;
    transition: height 1s ease;
}

.bar span {
    position: absolute;
    top: -22px;
    font-size: 10px;
    color: var(--primary);
}

.bar-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    white-space: nowrap;
}

/* Таблицы Инфраструктуры */
.section-title {
    font-size: 22px;
    margin-bottom: 30px;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

th, td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-darker);
    color: var(--text-muted);
    font-weight: 500;
}

code {
    background: var(--bg-darker);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--primary);
    font-size: 12px;
}

.progress-bar {
    width: 120px;
    height: 6px;
    background: var(--bg-darker);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
}

.progress-fill.alert { background: var(--amber); }

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.status-online { background: rgba(34, 197, 94, 0.15); color: var(--green); border: 1px solid var(--green); }
.status-degraded { background: rgba(245, 158, 11, 0.15); color: var(--amber); border: 1px solid var(--amber); }

/* Консоль Живого Терминала */
.terminal-window {
    background: #05070f;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.terminal-header {
    background: var(--bg-darker);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.term-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.term-dot.red { background: #ef4444; }
.term-dot.yellow { background: #f59e0b; }
.term-dot.green { background: #10b981; }

.term-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 10px;
}

.terminal-body {
    padding: 20px;
    height: 180px;
    overflow-y: hidden;
    font-size: 12px;
    color: #34d399;
}

.log-line {
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    animation: typeLog 0.4s ease-out forwards;
}

footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 12px;
}
