* {
    box-sizing: border-box
}

:root {
    --navy: #14284a;
    --teal: #16a085;
    --bg: #f4f7fa;
    --card: #fff;
    --text: #172033;
    --muted: #718096;
    --line: #e5eaf0;
    --green: #20a46b;
    --shadow: 0 8px 24px rgba(20, 40, 74, .06)
}

html,
body {
    margin: 0;
    min-height: 100%
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text)
}

button {
    font: inherit
}

.app-shell {
    min-height: 100vh;
    display: flex
}

.sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: var(--navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 26px 16px 18px
}

.brand {
    padding: 0 12px 30px
}

.brand-mark {
    font-size: 29px;
    font-weight: 800;
    letter-spacing: 1px
}

.brand-mark span {
    color: #35c8aa
}

.brand-subtitle {
    color: #9db0ca;
    font-size: 11px;
    margin-top: 4px
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    border-radius: 9px;
    color: #b9c7d9;
    text-decoration: none;
    font-size: 14px
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, .09);
    color: #fff
}

.nav-item.active {
    box-shadow: inset 3px 0 0 var(--teal)
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: 18px 12px 0
}

.system-status {
    color: #a9bdd4;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(32, 164, 107, .12)
}

.logout-link {
    color: #a9bdd4;
    text-decoration: none;
    font-size: 13px
}

.main {
    flex: 1;
    min-width: 0
}

.topbar {
    min-height: 82px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px
}

.eyebrow {
    color: var(--teal);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    margin-bottom: 4px
}

.topbar-title h1 {
    margin: 0;
    font-size: 22px
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e4f4f0;
    color: var(--teal);
    display: grid;
    place-items: center;
    font-weight: 800
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px
}

.user-info strong {
    font-size: 13px
}

.user-info span {
    color: var(--muted);
    font-size: 11px
}

.mobile-menu {
    display: none;
    border: 0;
    background: transparent;
    font-size: 23px;
    cursor: pointer
}

.content {
    padding: 30px 34px 50px;
    max-width: 1500px
}

.welcome-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 22px
}

.welcome-row h2 {
    margin: 0 0 5px;
    font-size: 25px
}

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

.live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--green);
    background: #edf9f4;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700
}

.location-bar {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 15px 18px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px
}

.label {
    display: block;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 4px
}

.location-bar strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px
}

.last-update {
    text-align: right
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 34px
}

.metric-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 19px;
    box-shadow: var(--shadow)
}

.metric-top {
    display: flex;
    justify-content: space-between;
    align-items: center
}

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

.metric-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 800;
    background: #edf3fa;
    color: var(--navy)
}

.metric-value {
    margin-top: 13px;
    font-size: 30px;
    font-weight: 750
}

.metric-unit {
    color: var(--muted);
    font-size: 10px;
    margin-top: 4px
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 12px
}

.section-heading h3 {
    margin: 0 0 4px;
    font-size: 18px
}

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

.sensor-count {
    color: var(--muted);
    font-size: 12px
}

.sensor-list {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.sensor-card{
    width:100%;
    border:1px solid var(--line);
    background:#fff;
    border-radius:12px;
    box-shadow:var(--shadow);
    padding:16px 18px;

    display:grid;
    grid-template-columns:1.2fr 2fr auto;
    align-items:center;
    gap:20px;

    text-align:left;
    cursor:pointer;
    transition:.15s ease;
}

.sensor-card:hover,
.sensor-card.selected {
    border-color: #a8d9cf;
    box-shadow: 0 8px 28px rgba(22, 160, 133, .09)
}

.sensor-main {
    display: flex;
    align-items: center;
    gap: 12px
}

.sensor-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(32, 164, 107, .1)
}

.sensor-main strong {
    display: block;
    font-size: 14px;
    color: var(--text)
}

.sensor-main span:not(.sensor-status) {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px
}

.sensor-reading {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px
}

.sensor-reading span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-bottom: 3px
}

.sensor-reading strong {
    font-size: 13px
}

.loading-card,
.empty-card,
.error-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px;
    color: var(--muted);
    font-size: 13px
}

.error-box {
    color: #a33a2c;
    background: #fff6f4;
    border-color: #f2d0c9;
    margin-bottom: 18px
}

.hidden {
    display: none
}

@media(max-width:1050px) {
    .sidebar {
        width: 220px;
        flex-basis: 220px
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .location-bar {
        grid-template-columns: repeat(2, 1fr)
    }

    .last-update {
        text-align: left
    }
}

@media(max-width:760px) {
    .sidebar {
        position: fixed;
        z-index: 20;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: left .2s ease;
        box-shadow: 10px 0 30px rgba(0, 0, 0, .15)
    }

    .sidebar.open {
        left: 0
    }

    .mobile-menu {
        display: block;
        margin-right: 12px
    }

    .topbar {
        justify-content: flex-start;
        padding: 0 18px
    }

    .user-box {
        margin-left: auto
    }

    .user-info {
        display: none
    }

    .content {
        padding: 24px 18px 40px
    }

    .welcome-row {
        align-items: flex-start;
        flex-direction: column
    }

    .metric-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px
    }

    .location-bar {
        grid-template-columns: 1fr;
        gap: 13px
    }

    .last-update {
        text-align: left
    }

    .sensor-card {
        grid-template-columns: 1fr;
        gap: 14px
    }

    .sensor-reading {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px
    }
}

@media(max-width:430px) {
    .metric-grid {
        grid-template-columns: 1fr
    }

    .welcome-row h2 {
        font-size: 21px
    }

    .topbar-title h1 {
        font-size: 19px
    }
}

.sensor-details {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-left: 18px;
    padding: 9px 14px;

    border-radius: 8px;
    background: #17345e;
    color: #ffffff;

    font-size: 13px;
    font-weight: 600;
    text-decoration: none;

    white-space: nowrap;

    transition: 0.15s ease;
}

.sensor-details:hover {
    background: #214878;
    transform: translateX(2px);
}