:root {
    --bg: #070b12;
    --panel: #0e1521;
    --panel-2: #111b29;
    --border: #1f3047;
    --text: #edf4ff;
    --muted: #8ea1b8;
    --primary: #7c5cff;
    --green: #27d17f;
    --yellow: #f2ba4b;
    --red: #ff4f68;
    --blue: #4fa3ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at top right,
            #192641 0,
            transparent 35%
        ),
        var(--bg);
    color: var(--text);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(
        135deg,
        var(--primary),
        #36a6ff
    );
    font-weight: 900;
    font-size: 20px;
}

.brand h1 {
    margin: 0;
    font-size: 19px;
}

.brand p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.login-card label {
    display: block;
    margin: 28px 0 8px;
    color: var(--muted);
    font-size: 13px;
}

input {
    width: 100%;
    padding: 12px 14px;
    color: var(--text);
    background: #09111d;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .14);
}

button {
    border: 0;
    border-radius: 10px;
    padding: 11px 15px;
    font-weight: 700;
}

.primary {
    color: white;
    background: linear-gradient(
        135deg,
        #7c5cff,
        #526dff
    );
}

.secondary {
    color: var(--text);
    background: #162235;
    border: 1px solid var(--border);
}

.ghost {
    color: var(--muted);
    background: transparent;
}

.warning {
    color: #17110a;
    background: var(--yellow);
}

.success {
    color: #07140e;
    background: var(--green);
}

.danger {
    color: white;
    background: var(--red);
}

.error {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #ffd4da;
    background: rgba(255, 79, 104, .12);
    border: 1px solid rgba(255, 79, 104, .35);
}

.app {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 11, 18, .88);
    backdrop-filter: blur(16px);
}

.top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #101b2a;
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 800;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.container {
    width: min(1380px, calc(100% - 32px));
    margin: 24px auto 60px;
}

.hero-grid {
    display: grid;
    grid-template-columns:
        1.6fr
        repeat(3, 1fr);
    gap: 14px;
}

.hero-card,
.metric-card,
.panel-card,
.control-card {
    border: 1px solid var(--border);
    background: linear-gradient(
        145deg,
        var(--panel),
        var(--panel-2)
    );
    border-radius: 18px;
}

.hero-card {
    padding: 22px;
}

.hero-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
}

.hero-status {
    margin-top: 11px;
    font-size: 30px;
    font-weight: 900;
}

.hero-sub {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.metric-card {
    padding: 20px;
}

.metric-card span,
.system-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 21px;
}

.control-card {
    margin-top: 14px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.section-title {
    font-size: 15px;
    font-weight: 850;
}

.section-subtitle {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.control-buttons {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.panel-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 14px;
}

.panel-card {
    padding: 21px;
}

.fields {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
}

.check-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.check-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0a1220;
}

.check-card input {
    width: auto;
}

.check-card span {
    font-weight: 800;
}

.split-title {
    margin-top: 24px;
}

.direction-grid {
    margin-top: 13px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.switch-card {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #0a1220;
    font-weight: 800;
}

.switch-card input {
    position: absolute;
    opacity: 0;
}

.switch {
    width: 42px;
    height: 23px;
    border-radius: 999px;
    background: #26364c;
    position: relative;
}

.switch::after {
    content: "";
    width: 17px;
    height: 17px;
    position: absolute;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: white;
    transition: .18s;
}

.switch-card input:checked + .switch {
    background: var(--green);
}

.switch-card input:checked + .switch::after {
    left: 22px;
}

.split-grid {
    margin-top: 13px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.split-status {
    margin-top: 10px;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    background: #0a1220;
    color: var(--green);
    font-weight: 800;
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: center;
}

.message {
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 10px;
    color: #cffff0;
    background: rgba(39, 209, 127, .11);
    border: 1px solid rgba(39, 209, 127, .25);
}

.system-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.system-grid div {
    padding: 14px;
    background: #0a1220;
    border: 1px solid var(--border);
    border-radius: 11px;
}

.system-grid strong {
    display: block;
    margin-top: 5px;
}

.emergency-card {
    box-shadow:
        0 0 0 1px rgba(255, 79, 104, .04),
        0 15px 50px rgba(0, 0, 0, .2);
}

@media (max-width: 1050px) {

    .hero-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .panel-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 720px) {

    .topbar {
        padding: 15px;
        align-items: flex-start;
    }

    .topbar,
    .control-card,
    .section-header {
        flex-direction: column;
    }

    .top-actions,
    .control-buttons {
        width: 100%;
    }

    .top-actions button,
    .control-buttons button {
        flex: 1;
    }

    .container {
        width: min(100% - 20px, 1380px);
        margin-top: 12px;
    }

    .hero-grid,
    .fields,
    .direction-grid,
    .split-grid,
    .system-grid {
        grid-template-columns: 1fr;
    }

    .check-grid {
        grid-template-columns:
            repeat(3, 1fr);
    }

}
