/* ─── Design tokens ─── */
:root {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent: #2563eb;
    --accent-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;
    --radius: .5rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --transition: .15s ease;
}

/* ─── Base ─── */
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: .9375rem;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: #1d4ed8; }
h1:focus { outline: none; }

.content { padding-top: 1.5rem; }

/* ─── Page header ─── */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .25rem;
    letter-spacing: -.01em;
}
.page-header p {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: .875rem;
}

/* ─── Cards ─── */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}
.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: .875rem;
    padding: .75rem 1rem;
}

/* ─── Stat cards ─── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.stat-card:hover {
    box-shadow: var(--shadow);
}
.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: .75rem;
}
.stat-card .stat-label {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .25rem;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0;
}
.stat-card.blue .stat-icon { background: var(--accent-light); color: var(--accent); }
.stat-card.blue .stat-value { color: var(--accent); }
.stat-card.green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.green .stat-value { color: var(--success); }
.stat-card.yellow .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.yellow .stat-value { color: var(--warning); }
.stat-card.cyan .stat-icon { background: var(--info-light); color: var(--info); }
.stat-card.cyan .stat-value { color: var(--info); }
.stat-card.red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.red .stat-value { color: var(--danger); }

/* ─── Status dots ─── */
.status-dot {
    display: inline-block;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    margin-right: .5rem;
    flex-shrink: 0;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.status-dot.stale { background: var(--warning); box-shadow: 0 0 0 3px rgba(217,119,6,.15); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }

/* ─── Update chips ─── */
.update-chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .15rem .5rem;
    border-radius: 1rem;
    font-size: .75rem;
    font-weight: 600;
}
.update-chip.sys { background: var(--warning-light); color: var(--warning); }
.update-chip.pkg { background: var(--info-light); color: var(--info); }
.update-chip.ok { background: var(--success-light); color: var(--success); }

/* ─── Tables ─── */
.table { font-size: .875rem; }
.table thead th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
    border-bottom-width: 1px;
    padding: .625rem .75rem;
}
.table td {
    vertical-align: middle;
    padding: .625rem .75rem;
}
.table-hover tbody tr { transition: background var(--transition); }

/* ─── Buttons ─── */
.btn { font-size: .8125rem; font-weight: 500; border-radius: var(--radius); transition: all var(--transition); }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(37,99,235,.2);
}

/* ─── Alerts ─── */
.alert { border-radius: var(--radius); font-size: .875rem; border: none; }

/* ─── Badges ─── */
.badge { font-weight: 500; font-size: .75rem; }

/* ─── Forms ─── */
.form-control, .form-select { border-radius: var(--radius); font-size: .875rem; border-color: var(--border-color); }

/* ─── Validation ─── */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

/* ─── Blazor error boundary ─── */
.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ─── Empty state ─── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}
.empty-state i {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
    opacity: .4;
}

/* ─── Section divider ─── */
.section-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.section-title i { color: var(--text-secondary); }
