/* ========================================================================== */
/* ADMIN → SYSTEM — SHELL & OVERVIEW CARDS                                    */
/* ========================================================================== */

/* ── page wrapper ── */
.system-wrapper {
    padding: 60px 70px;
    margin-left: var(--sidenav-width);
    margin-top: var(--topnav-height);
    margin-bottom: 300px;
}

@media (max-width: 991.98px) {
    .system-wrapper {
        padding: 24px var(--page-gutter);
    }
}

/* ── hero header ── */
.system-header h1 {
    font-size: 2.6rem;
    font-weight: 650;
    color: #032f4f;
    margin-bottom: 8px;
}

.system-sub {
    max-width: 700px;
    font-size: 1.1rem;
    color: #4f6b80;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* ── sections ── */
.system-section {
    margin-top: 45px;
}

.system-section-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 18px;
    margin-top: 40px;
    min-height: 30px;
}

/* panel header row above each table section */
.system-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    margin-top: 40px;
}

.system-section-title {
    font-size: 1.24rem;
    text-transform: uppercase;
    letter-spacing: 0.07rem;
    font-weight: 700;
    color: #022a46;
    margin: 0;
}

.system-status-hint {
    font-size: 0.9rem;
    color: #48687f;
    font-weight: 500;
    display: inline-block;
    min-width: 280px;
}

.system-status-hint.error {
    color: #b91c1c;
}

/* ── stat cards grid ── */
.system-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 25px;
}

@media (max-width: 1199.98px) {
    .system-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .system-overview-grid {
        grid-template-columns: 1fr;
    }
}

/* ── stat card ── */
.system-card {
    background: white;
    padding: 20px 22px 0;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    min-height: 130px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-top-color 0.22s ease;
}

.system-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
}

/* legacy h3 kept for non-stat fallback */
.system-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #032f4f;
    margin-bottom: 6px;
}

/* ── stat card internals ── */
.stat-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: rgba(3, 47, 79, 0.40);
}

.stat-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.055rem;
    color: #4f6b80;
}

.stat-value {
    font-size: 2rem;
    font-weight: 720;
    color: #032f4f;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 14px;
    flex: 1;
}

/* progress bar at bottom of stat card */
.stat-bar {
    height: 5px;
    background: rgba(0,0,0,0.07);
    border-radius: 0 0 14px 14px;
    margin: 0 -22px; /* flush to card edges */
    overflow: hidden;
    margin-top: auto;
}

/* smoother ease-out animation toward new values */
.stat-fill {
    width: 0;
    height: 100%;
    border-radius: 0 3px 3px 0;
    background: #2d64d8;
    /* transition is set by systemStatBar.js at runtime — CSS rule removed to avoid no-op conflicts */
    will-change: width;
}

/* ── dynamic metric coloring via --metric-pct (0..100) ── */
.stat-card:not(.stat-idle) {
    border-top: 3px solid rgba(0, 0, 0, 0.10);
}

.stat-card:not(.stat-idle):hover {
    border-top-color: hsl(calc(120 - var(--metric-pct, 0) * 1.2), 70%, 38%);
}

.stat-idle {
    border-top: 3px solid rgba(0, 0, 0, 0.10);
}

.stat-card .stat-fill {
    background: hsl(calc(120 - var(--metric-pct, 0) * 1.2), 72%, 38%);
}

.stat-card .stat-value {
    color: hsl(calc(120 - var(--metric-pct, 0) * 1.2), 62%, 24%);
}

/* ── section heading icons ── */
.section-header-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 6px;
    color: #2d64d8;
    position: relative;
    top: -1px;
}

/* ── live-value flicker feedback ── */
.live-value {
    display: inline-block;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.live-value.updating {
    opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
    /* systemStatBar.js respects this by not setting a transition duration above 0 */
    .stat-fill {
        transition: none !important;
    }
}

.last-error.loading-text {
    opacity: 0.8;
    font-size: 0.85rem;
    max-width: 260px;
}
