*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #0f172a; --bg2: #1e293b; --bg3: #334155;
    --text: #f1f5f9; --text2: #94a3b8;
    --primary: #3b82f6; --primary-hover: #2563eb;
    --success: #22c55e; --warning: #eab308; --danger: #ef4444;
    --offline: #6b7280;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text);
}
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.page-content { flex: 1; }
.app-footer {
    background: var(--bg2); border-top: 1px solid var(--bg3);
    padding: 0.75rem 2rem; text-align: center;
    font-size: 0.8rem; color: var(--text2); opacity: 0.7;
}
.app-footer a { color: var(--text2); text-decoration: none; font-weight: 600; }
.app-footer a:hover { color: var(--primary); }
.nav {
    background: var(--bg2); padding: 1rem 2rem; display: flex;
    align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--bg3);
}
.nav-brand { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.nav-user { display: flex; align-items: center; gap: 1rem; }
.nav-user span { color: var(--text2); font-size: 0.875rem; }
.nav-brand-link { text-decoration: none; display: flex; align-items: center; gap: 0.75rem; }
.nav-logo { height: 32px; width: auto; border-radius: 6px; }
.container { max-width: 1400px; margin: 0 auto; padding: 2rem; }
.card {
    background: var(--bg2); border: 1px solid var(--bg3);
    border-radius: 0.75rem; padding: 1.5rem;
}
.grid { display: grid; gap: 1.5rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 850px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 500px) { .grid-4 { grid-template-columns: 1fr; } }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.875rem; color: var(--text2); margin-top: 0.25rem; }
.badge {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.25rem 0.75rem; border-radius: 9999px;
    font-size: 0.75rem; font-weight: 600;
}
.badge-online { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-offline { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-critical { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(234,179,8,0.15); color: var(--warning); }
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 1rem; border-radius: 0.5rem; border: none;
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
    transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg3); color: var(--text); }
.btn-secondary:hover { filter: brightness(1.2); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-danger { background: var(--danger); color: white; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--bg3); }
th { color: var(--text2); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.progress-bar {
    width: 100%; height: 0.5rem; background: var(--bg3);
    border-radius: 9999px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 9999px; transition: width 0.5s; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-secondary { color: var(--text2); }
.text-xs { font-size: 0.75rem; }
.text-2xs { font-size: 0.65rem; }
.text-sm { font-size: 0.875rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.items-center { align-items: center; }
.cursor-pointer { cursor: pointer; }
.overflow-x-auto { overflow-x: auto; }
input, select, textarea {
    background: var(--bg3); border: 1px solid transparent;
    border-radius: 0.5rem; padding: 0.5rem 0.75rem;
    color: var(--text); width: 100%; font-size: 0.875rem;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
}
label { display: block; font-size: 0.875rem; color: var(--text2); margin-bottom: 0.375rem; }
.form-group { margin-bottom: 1rem; }
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 50;
}
.modal-content {
    background: var(--bg2); border: 1px solid var(--bg3);
    border-radius: 0.75rem; padding: 2rem; max-width: 500px;
    width: 90%; max-height: 90vh; overflow-y: auto;
}
.nav-user-wrap { position: relative; display: flex; align-items: center; }
.nav-user-btn {
    display: flex; align-items: center; gap: 0.5rem;
    background: none; border: none; color: var(--text);
    cursor: pointer; padding: 0.375rem 0.75rem;
    border-radius: 0.5rem; font-size: 0.875rem;
}
.nav-user-btn:hover { background: var(--bg3); }
.dropdown-menu {
    position: absolute; top: 100%; right: 0; margin-top: 0.25rem;
    background: var(--bg2); border: 1px solid var(--bg3);
    border-radius: 0.5rem; padding: 0.375rem; min-width: 180px;
    z-index: 100;
}
.dropdown-menu a, .dropdown-menu button {
    display: block; width: 100%; padding: 0.5rem 0.75rem;
    color: var(--text); text-decoration: none; font-size: 0.875rem;
    background: none; border: none; text-align: left; cursor: pointer;
    border-radius: 0.375rem;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg3); }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu hr { border: none; border-top: 1px solid var(--bg3); margin: 0.25rem 0; }
.footer-logo {
    position: fixed; bottom: 4rem; left: 1.5rem;
    opacity: 0.6; z-index: 40; pointer-events: none;
    transition: opacity 0.3s;
}
.footer-logo img { height: 120px; width: auto; }
@media (max-width: 1024px) { .footer-logo img { height: 90px; } }
@media (max-width: 768px) { .footer-logo img { height: 70px; } }
@media (max-width: 480px) { .footer-logo img { height: 50px; } }
.footer-brand {
    position: fixed; bottom: 4rem; right: 1.5rem;
    z-index: 40; transition: opacity 0.3s;
}
.footer-brand a { text-decoration: none; display: block; }
.footer-brand img { height: auto; width: auto; max-width: 180px; }
@media (max-width: 480px) { .footer-brand { display: none; } }
.login-page {
    min-height: 100vh; display: flex; align-items: center;
    justify-content: center; background: var(--bg);
}
.login-card {
    background: var(--bg2); border: 1px solid var(--bg3);
    border-radius: 1rem; padding: 3rem; width: 100%; max-width: 420px;
}
.login-card h1 { text-align: center; margin-bottom: 2rem; }
.login-card .errorlist { color: var(--danger); font-size: 0.875rem; margin-bottom: 1rem; }
[x-cloak] { display: none !important; }
.hidden { display: none; }
.inline-chart { max-height: 250px; }
.back-link { color: var(--primary); text-decoration: none; font-size: 0.875rem; }
.alert-item { padding: 0.75rem; border-bottom: 1px solid var(--bg3); font-size: 0.875rem; }
.empty-state { text-align: center; color: var(--text2); padding: 2rem; }
.empty-state-lg { text-align: center; color: var(--text2); padding: 3rem; }
.load-detail { font-size: 0.7rem; color: var(--text2); margin-top: 0.25rem; }
.load-detail-xs { font-size: 0.75rem; color: var(--text2); margin-top: 0.35rem; }
.heartbeat-row { font-size: 0.75rem; color: var(--text2); display: flex; justify-content: space-between; margin-bottom: 0.75rem; }
.metric-label { font-size: 0.75rem; margin-bottom: 0.25rem; }
.info-grid { font-size: 0.875rem; }
.w-200 { width: 200px; }
.toast-container {
    position: fixed; top: 1rem; right: 1rem; z-index: 999;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
    padding: 0.75rem 1.25rem; border-radius: 0.5rem;
    font-size: 0.875rem; font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex; align-items: center; gap: 0.5rem;
    animation: toast-in 0.3s ease;
}
.toast-success { background: #065f46; color: #d1fae5; border: 1px solid #059669; }
.toast-error { background: #7f1d1d; color: #fee2e2; border: 1px solid #dc2626; }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}
