:root {
    --bg: #071221;
    --bg-soft: #0b1728;
    --panel: #101d31;
    --panel-2: #0e1a2c;
    --border: #263a56;
    --border-soft: #1f3048;
    --text: #f4f7fb;
    --muted: #9eb4d1;
    --blue: #39b8ff;
    --cyan: #66e0ff;
    --green: #24d178;
    --red: #ff5252;
    --orange: #ffc033;
    --gray: #73839b;
    --shadow: 0 14px 35px rgba(0,0,0,.22);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(57,184,255,.12), transparent 34rem),
        linear-gradient(180deg, #0a1424 0%, #071221 100%);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
.topbar {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 34px;
    background: rgba(10, 20, 36, .92);
    border-bottom: 1px solid var(--border-soft);
}
.brand-title {
    display: inline-block;
    font-size: 33px;
    letter-spacing: 10px;
    font-weight: 900;
    line-height: 1;
}
.brand-subtitle { margin-top: 8px; color: var(--muted); font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.user-pill {
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,.03);
    color: #cde4ff;
}
.main-nav {
    display: flex;
    gap: 4px;
    padding: 0 34px;
    background: rgba(13, 25, 43, .92);
    border-bottom: 1px solid var(--border-soft);
    overflow-x: auto;
}
.nav-item {
    padding: 13px 18px;
    color: #b9cce8;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
    border-top: 3px solid transparent;
    white-space: nowrap;
    font-weight: 650;
}
.nav-item:hover { background: rgba(57,184,255,.08); color: #fff; }
.nav-item.active {
    color: #fff;
    background: linear-gradient(180deg, rgba(57,184,255,.25), rgba(57,184,255,.08));
    border-top-color: var(--blue);
    border-left-color: rgba(57,184,255,.16);
    border-right-color: rgba(57,184,255,.16);
}
.page-wrap { width: min(1480px, calc(100% - 48px)); margin: 26px auto 70px; }
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin: 2px 0 22px;
}
.page-title h1 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.page-title p { margin: 7px 0 0; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
    background: linear-gradient(180deg, rgba(16,29,49,.96), rgba(11,23,40,.96));
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-pad { padding: 22px; }
.card-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border-soft);
}
.card-head h2 { font-size: 21px; margin: 0; }
.card-head span { color: var(--muted); font-size: 14px; }
.metric-label { color: #aad3ff; font-size: 14px; }
.metric-value { margin-top: 14px; font-size: 43px; line-height: 1; font-weight: 900; letter-spacing: -.04em; }
.metric-value.green { color: var(--green); }
.metric-value.red { color: var(--red); }
.metric-value.orange { color: var(--orange); }
.metric-value.blue { color: var(--blue); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; }
th { color: #acd0fb; font-size: 13px; font-weight: 750; }
td { color: #f5f8ff; font-size: 14px; }
tr.group-row td {
    background: rgba(57,184,255,.12);
    color: #dff4ff;
    font-weight: 850;
    border-top: 1px solid var(--border);
}
.subline { display:block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .03em;
}
.badge-online { color: #052915; background: var(--green); }
.badge-offline { color: #3a0808; background: var(--red); }
.badge-warning { color: #392800; background: var(--orange); }
.badge-muted { color: #dae4f1; background: #526178; }
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: rgba(57,184,255,.12);
    color: #e6f5ff;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 750;
    font-size: 14px;
}
.btn:hover { background: rgba(57,184,255,.22); }
.btn-primary { background: linear-gradient(180deg, #2fb8ff, #1689d8); border-color: #34bfff; color: #03111d; }
.btn-danger { background: rgba(255,82,82,.12); border-color: rgba(255,82,82,.5); color: #ffd1d1; }
.btn-small { padding: 7px 10px; font-size: 13px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-row.full { grid-column: 1 / -1; }
label { color: #bbd7f5; font-size: 13px; font-weight: 750; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: #081426;
    color: var(--text);
    border-radius: 10px;
    padding: 11px 12px;
    outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(57,184,255,.12); }
.form-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }
.alert { padding: 14px 16px; border-radius: 14px; margin: 0 0 16px; border: 1px solid var(--border); }
.alert-success { background: rgba(36,209,120,.12); border-color: rgba(36,209,120,.35); }
.alert-error { background: rgba(255,82,82,.14); border-color: rgba(255,82,82,.45); }
.alert-info { background: rgba(57,184,255,.13); border-color: rgba(57,184,255,.35); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card { width: min(440px, 100%); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-title { font-size: 42px; }
.muted { color: var(--muted); }
.kpi-note { color: var(--muted); font-size: 13px; margin-top: 10px; }
.section-gap { margin-top: 18px; }
.empty { color: var(--muted); padding: 20px 0; }
.hr { border: none; border-top: 1px solid var(--border-soft); margin: 18px 0; }
@media (max-width: 1050px) {
    .grid.cards, .grid.two, .form-grid, .form-grid.three { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .page-wrap { width: min(100% - 26px, 1480px); }
}
