:root {
    --bg-deep: #0b0f1a;
    --bg-card: #121A2A;
    --bg-input: #1B263B;
    --text-main: #ffffff;
    --text-muted: #8E9AAF;
    --accent-blue: #3B82F6;
    
    /* Status Colors */
    --color-critical: #ef4444;
    --color-high: #f97316;
    --color-medium: #eab308;
    --color-low: #bef264;
    --color-normal: #10b981;
    --color-info: #0ea5e9;
    --color-maint: #8b5cf6;
    --color-off: #64748b;
    --color-unknown: #475569;
}

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

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

.hidden {
    display: none !important;
}

.error-banner {

    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
}


/* Setup Screen */
.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#setup-screen {
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e3a8a 0%, var(--bg-deep) 60%);
}

.setup-container {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.setup-header {
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

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

.setup-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.qr-wrapper {
    position: relative;
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    margin: 0 auto 2rem;
    width: fit-content;
}

#qrcode img {
    display: block;
}

.qr-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.setup-instructions {
    text-align: left;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.step-num {
    background: var(--accent-blue);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.step p {
    font-size: 0.95rem;
    color: #cbd5e1;
}

.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    color: #10b981;
    font-size: 0.8rem;
}

/* Dashboard Header */
.main-header {
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-small {
    font-weight: 700;
    color: var(--accent-blue);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

#dashboard-title {
    font-size: 1.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.timestamp {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.countdown-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: uppercase;
}


.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.icon-btn:hover {
    opacity: 1;
}

/* Alert Bar */
.alert-bar-section {
    padding: 2rem;
}

.alert-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.alert-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    border-left: 4px solid var(--color-unknown);
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.alert-box:hover {
    transform: translateY(-2px);
}

.alert-box-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.alert-box .label {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    margin-bottom: 0;
}

.alert-box .total-count {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    font-family: 'Outfit', sans-serif;
}

.alert-box-stats {
    display: flex;
    gap: 1rem;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 40px;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.stat.dimmed {
    opacity: 0.2;
}

.alert-box.critical { border-left-color: var(--color-critical); border-bottom-color: var(--color-critical); }
.alert-box.critical .total-count { color: var(--color-critical); }
.alert-box.high { border-left-color: var(--color-high); border-bottom-color: var(--color-high); }
.alert-box.high .total-count { color: var(--color-high); }
.alert-box.medium { border-left-color: var(--color-medium); border-bottom-color: var(--color-medium); }
.alert-box.medium .total-count { color: var(--color-medium); }
.alert-box.low { border-left-color: var(--color-low); border-bottom-color: var(--color-low); }
.alert-box.low .total-count { color: var(--color-low); }


/* Grid Sections */
.sections-container {
    padding: 0 2rem 4rem;
}

.grid-section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.severity-bar {
    height: 4px;
    width: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    display: flex;
    overflow: hidden;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

/* Status Cards */
.card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s;
    cursor: default;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-parent {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-name {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.status-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .alert-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
