:root {
    --bg: #080b0f;
    --panel: #0e1319;
    --panel-2: #111820;
    --border: #202a34;
    --text: #f5f7fa;
    --muted: #778391;
    --green: #00e89a;
    --green-2: #00c982;
    --red: #ff4f68;
    --red-bg: rgba(255, 79, 104, 0.10);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 85% 0%, rgba(0, 232, 154, 0.08), transparent 28rem),
        radial-gradient(circle at 0% 100%, rgba(71, 112, 255, 0.05), transparent 24rem),
        var(--bg);
    font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 24px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1;
    letter-spacing: -1px;
}

.topbar p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.connection-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(14, 19, 25, 0.86);
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #68727d;
}

.connection-pill.online {
    color: #b7ffe7;
    border-color: rgba(0, 232, 154, 0.22);
}

.connection-pill.online .status-dot {
    background: var(--green);
    box-shadow: 0 0 13px rgba(0, 232, 154, 0.8);
}

.connection-pill.error {
    color: #ffabb7;
    border-color: rgba(255, 79, 104, 0.24);
}

.connection-pill.error .status-dot {
    background: var(--red);
    box-shadow: 0 0 13px rgba(255, 79, 104, 0.8);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.sensor-card {
    position: relative;
    min-height: 205px;
    overflow: hidden;
    padding: 23px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        linear-gradient(145deg, rgba(17, 24, 32, 0.98), rgba(10, 14, 19, 0.98));
    box-shadow: var(--shadow);
}

.sensor-card::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -100px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(0, 232, 154, 0.035);
    pointer-events: none;
}

.card-head {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-label {
    display: block;
    color: #a6b0bb;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.3px;
}

.card-datastream {
    display: block;
    margin-top: 5px;
    color: #596570;
    font-size: 10px;
}

.card-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid #25303a;
    border-radius: 11px;
    background: #141b23;
    font-size: 18px;
}

.metric {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 24px;
}

.metric span {
    font-size: clamp(38px, 5vw, 50px);
    font-weight: 850;
    line-height: 1;
    letter-spacing: -2px;
}

.metric small {
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.card-foot {
    position: relative;
    z-index: 1;
    margin-top: 17px;
    color: #5f6b77;
    font-size: 11px;
}

.progress-track {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 9px;
    margin-top: 21px;
    overflow: hidden;
    border-radius: 999px;
    background: #202831;
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green-2), var(--green));
    transition: width 0.45s ease, background 0.25s ease;
}

.progress-bar.low {
    background: linear-gradient(90deg, #ff3c55, var(--red));
}

.warning {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    color: #ff7788;
    font-size: 11px;
    font-weight: 800;
}

.hidden {
    display: none !important;
}

.security-state {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 24px;
}

.security-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 15px;
    background: rgba(0, 232, 154, 0.08);
    font-size: 26px;
}

.security-state strong {
    display: block;
    font-size: 29px;
    line-height: 1;
}

.security-state span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
}

.security-state.safe {
    color: var(--green);
}

.security-state.opened {
    color: var(--red);
}

.security-state.opened .security-icon {
    background: var(--red-bg);
}

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

.system-item {
    min-height: 70px;
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(14, 19, 25, 0.78);
}

.system-label {
    display: block;
    color: #5f6a76;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.system-item strong {
    display: block;
    margin-top: 7px;
    color: #c8d0d8;
    font-size: 12px;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    color: #4f5a65;
    font-size: 10px;
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 24px, 620px);
        padding-top: 20px;
    }

    .topbar {
        flex-direction: column;
    }

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

    .sensor-card {
        min-height: 185px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
