:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #dce4ee;
    --text: #16324f;
    --muted: #6b7c93;
    --primary: #1d5fa7;
    --primary-dark: #12457b;
    --success: #1f8b4c;
    --warning: #b7791f;
    --danger: #c53030;
    --info: #2b6cb0;
    --shadow: 0 12px 30px rgba(22, 50, 79, 0.08);
    --radius: 18px;
}

html,
body {
    min-height: 100%;
}

body {
    background: linear-gradient(180deg, #eef4fb 0%, var(--bg) 100%);
    color: var(--text);
}

.app-navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-logo {
    width: 72px;
    height: 58px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 14px;
    padding: 0.35rem;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.82rem;
    opacity: 0.85;
}

.page-header {
    max-width: 880px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--muted);
    font-size: 1rem;
}

.app-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.device-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.device-btn {
    border: 1px solid var(--border) !important;
    border-radius: 14px !important;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    transition: all 0.2s ease;
}

.device-btn:hover,
.device-btn:focus {
    background: #edf4ff;
    border-color: #bad0eb !important;
}

.device-btn.active {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 10px 20px rgba(29, 95, 167, 0.18);
}

.metric-card {
    height: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
}

.metric-label {
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.metric-value {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.15;
}

.metric-delta {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
    border: 1px solid transparent;
}

.status-success {
    background: #e6f7ed;
    color: var(--success);
    border-color: #bee3cd;
}

.status-warning {
    background: #fff7e6;
    color: var(--warning);
    border-color: #f0d9a7;
}

.status-danger {
    background: #fdecec;
    color: var(--danger);
    border-color: #f4b9b9;
}

.status-info {
    background: #e8f3ff;
    color: var(--info);
    border-color: #bbd8fb;
}

.status-neutral {
    background: #f1f5f9;
    color: #4a5568;
    border-color: #d9e2ec;
}

.filter-summary {
    color: var(--muted);
}

.filter-chip,
.table-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: #eef4ff;
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 700;
    margin-left: 0.35rem;
}

.table-modern thead th {
    border-top: none;
    border-bottom: 1px solid var(--border);
    background: #f4f8fd;
    color: var(--text);
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.table-modern tbody tr:hover {
    background: #f8fbff;
}

.table-modern td,
.table-modern th {
    vertical-align: middle;
    white-space: nowrap;
}

.pagination .page-link {
    border-radius: 10px !important;
    margin: 0 0.15rem;
    border-color: var(--border);
    color: var(--primary-dark);
}

.pagination .page-item.active .page-link,
.pagination .page-link:hover {
    background: #edf4ff;
    border-color: #bad0eb;
}

.app-footer {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    padding: 1rem 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.app-footer a {
    color: var(--primary-dark);
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .page-title {
        font-size: 1.7rem;
    }

    .nav-logo {
        width: 58px;
        height: 48px;
    }
}


.metric-card-soft {
    background: linear-gradient(180deg, #f6f9fc 0%, #eef4fb 100%);
}

.metric-text {
    font-size: 0.96rem;
    line-height: 1.5;
    color: var(--muted);
    margin-top: 0.35rem;
}

.dashboard-gauges {
    min-height: 480px;
}

.chart-window-group .btn {
    border-radius: 999px !important;
    margin-left: 0.35rem;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.chart-window-group .btn:first-child {
    margin-left: 0;
}

.chart-window-group .btn.active,
.chart-window-group .btn:hover {
    background: #edf4ff;
    border-color: #bad0eb;
    color: var(--primary-dark);
}

.chart-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--text);
}

.history-chart {
    min-height: 360px;
}

@media (max-width: 767.98px) {
    .dashboard-gauges {
        min-height: 720px;
    }

    .history-chart {
        min-height: 320px;
    }
}
