:root {
    --bg: #09111f;
    --panel: #111b2e;
    --panel-2: #0d1627;
    --border: #25324a;
    --text: #e8eef9;
    --muted: #9ca9c3;
    --primary: #3b82f6;
    --primary-2: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 10px 30px rgba(0, 0, 0, .25);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 270px;
    background: var(--panel-2);
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { margin-bottom: 28px; }
.brand-title { font-weight: 800; font-size: 1.35rem; }
.brand-subtitle { color: var(--muted); margin-top: 6px; font-size: .95rem; }

.nav-links { display: grid; gap: 8px; }
.nav-links a {
    display: block;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text);
    background: transparent;
}
.nav-links a:hover,
.nav-links a.active { background: rgba(59, 130, 246, .14); color: #cfe1ff; }

.main-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(9, 17, 31, .85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
}
.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.page-title { font-size: 1.35rem; margin-bottom: 4px; }
.page-subtitle, .muted { color: var(--muted); }
.user-chip {
    padding: 10px 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .92rem;
}
.content { padding: 22px; }
.card {
    background: linear-gradient(180deg, rgba(17, 27, 46, 1) 0%, rgba(12, 21, 37, 1) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.table-card { padding: 0; overflow: hidden; }

.grid-cards { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { font-size: 2rem; font-weight: 800; margin-top: 10px; }
.kpi-sm { font-size: 1.6rem; font-weight: 800; margin-top: 8px; }
.mini-card {
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.section-header h2 { margin: 0; font-size: 1.1rem; }

.item-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px 0;
    border-top: 1px solid rgba(255,255,255,.06);
}
.item-row:first-of-type { border-top: 0; padding-top: 0; }
.item-title { font-weight: 700; }

.btn {
    appearance: none;
    border: 0;
    border-radius: 14px;
    padding: 11px 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: .18s ease;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: linear-gradient(180deg, var(--primary), var(--primary-2)); color: white; }
.btn-secondary { background: rgba(59,130,246,.12); color: #dbeafe; border: 1px solid rgba(59,130,246,.25); }
.btn-dark { background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(239,68,68,.14); color: #fecaca; border: 1px solid rgba(239,68,68,.28); }
.btn-block { width: 100%; }

.alert-banner {
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
}
.alert-success {
    background: rgba(16, 185, 129, .12);
    border-color: rgba(16, 185, 129, .2);
    color: #a7f3d0;
}
.alert-error {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .2);
    color: #fecaca;
}

.stack > * + * { margin-top: 16px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 18px;
}
.full-span { grid-column: 1 / -1; }
.label {
    display: block;
    margin-bottom: 7px;
    color: #d6dff1;
    font-weight: 700;
}
.input {
    width: 100%;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    padding: 12px 14px;
    outline: none;
}
.input:focus {
    border-color: rgba(59,130,246,.6);
    box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.textarea { min-height: 130px; resize: vertical; }
.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.checkbox-wrap { display: flex; align-items: end; }
.checkbox-row { display: inline-flex; align-items: center; gap: 10px; }

.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    text-align: left;
    vertical-align: top;
}
.table thead th {
    color: var(--muted);
    background: rgba(255,255,255,.02);
    font-size: .9rem;
}
.text-right { text-align: right; }
.action-buttons {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.pagination-wrap { padding: 16px 18px; }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}
.badge-success { background: rgba(16,185,129,.14); color: #a7f3d0; }
.badge-warning { background: rgba(245,158,11,.14); color: #fde68a; }
.badge-critical { background: rgba(239,68,68,.14); color: #fecaca; }
.badge-info { background: rgba(59,130,246,.14); color: #bfdbfe; }

.detail-list { display: grid; gap: 14px; }
.list-spaced { margin: 10px 0 0 18px; padding: 0; }
.code {
    background: #060b15;
    border: 1px solid var(--border);
    padding: 14px 16px;
    border-radius: 14px;
    overflow-x: auto;
    white-space: pre-wrap;
    color: #d6e3ff;
}
.login-card {
    width: min(440px, calc(100vw - 32px));
    background: linear-gradient(180deg, rgba(17, 27, 46, 1) 0%, rgba(12, 21, 37, 1) 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 28px;
}
.guest-body {
    display: grid;
    place-items: center;
    padding: 18px;
}
.guest-shell { width: 100%; display: grid; place-items: center; min-height: 100vh; }
.menu-toggle { display: none; }

@media (max-width: 1100px) {
    .kpi-grid, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: min(82vw, 320px);
        transition: left .2s ease;
        z-index: 50;
    }
    .sidebar.open { left: 0; }
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        border: 1px solid var(--border);
        background: rgba(255,255,255,.03);
        color: var(--text);
        cursor: pointer;
    }
    .topbar { padding: 14px 16px; }
    .content { padding: 16px; }
    .topbar-left { flex: 1; min-width: 0; }
    .topbar-right .user-chip { display: none; }
    .grid-2, .grid-3, .kpi-grid, .form-grid { grid-template-columns: 1fr; }
    .section-header { align-items: flex-start; flex-direction: column; }
    .item-row { flex-direction: column; align-items: stretch; }
}
