* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #202124;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;

    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;

    padding: 0 24px;
}

.topbar__title {
    font-size: 21px;
    font-weight: 600;
}


.container {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}


.dashboard__header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 28px;
}

h1 {
    margin: 0;

    font-size: 30px;
    font-weight: 650;
}

.subtitle {
    margin: 5px 0 0;

    color: #6b7280;
    font-size: 15px;
}


.connection-statuses {
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;

    color: #6b7280;
    font-size: 14px;
}


.connection-status__dot {
    width: 9px;
    height: 9px;

    flex-shrink: 0;

    border-radius: 50%;
    background: #9ca3af;
}


.connection-status.online {
    color: #16803c;
}


.connection-status.online .connection-status__dot {
    background: #22c55e;
}


.connection-status.offline {
    color: #b42318;
}


.connection-status.offline .connection-status__dot {
    background: #ef4444;
}


.connection-status.unknown {
    color: #6b7280;
}


.connection-status.unknown .connection-status__dot {
    background: #9ca3af;
}


.cards {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 16px;
}


.card {
    min-height: 150px;

    display: flex;
    align-items: center;

    padding: 24px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;

    text-decoration: none;
    color: inherit;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.card--clickable {
    cursor: pointer;
}

.card--clickable:hover {
    transform: translateY(-2px);

    border-color: #d1d5db;

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.07);
}


.card__icon {
    width: 56px;
    height: 56px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 14px;

    background: #f3f4f6;

    font-size: 28px;
}


.card__content {
    margin-left: 18px;
}


.card__label {
    color: #6b7280;

    font-size: 14px;
    font-weight: 500;
}


.card__value {
    margin-top: 5px;

    font-size: 32px;
    font-weight: 650;
    line-height: 1.15;
}


.card__unit {
    margin-left: 2px;

    color: #6b7280;

    font-size: 16px;
    font-weight: 500;
}


.card__state {
    margin-top: 8px;

    font-size: 22px;
    font-weight: 600;
}


.last-update {
    margin-top: 20px;

    color: #9ca3af;

    font-size: 13px;
}


@media (max-width: 800px) {

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


@media (max-width: 520px) {

    .container {
        width: min(100% - 20px, 1100px);

        padding-top: 20px;
    }

    .topbar {
        padding: 0 16px;
    }

    .dashboard__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    h1 {
        font-size: 26px;
    }

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

    .card {
        min-height: 120px;

        padding: 20px;
    }
}


.sensor-page {
    padding-bottom: 40px;
}


.sensor-page__header {
    margin-bottom: 24px;
}


.back-link {
    display: inline-block;

    margin-bottom: 20px;

    color: #6b7280;

    font-size: 14px;
    text-decoration: none;
}


.back-link:hover {
    color: #202124;
}


.sensor-page h1 {
    margin: 0;

    font-size: 30px;
}


.sensor-current {
    margin-top: 8px;

    font-size: 38px;
    font-weight: 650;
}


.sensor-current__unit {
    color: #6b7280;

    font-size: 18px;
    font-weight: 500;
}


.period-selector {
    display: flex;

    gap: 8px;

    margin-bottom: 16px;
}


.period-button {
    padding: 9px 16px;

    border: 1px solid #e5e7eb;
    border-radius: 10px;

    background: #ffffff;

    color: #4b5563;

    font-size: 14px;

    cursor: pointer;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}


.period-button:hover {
    border-color: #d1d5db;
}


.period-button.active {
    background: #202124;

    border-color: #202124;

    color: #ffffff;
}


.chart-card {
    padding: 24px;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 16px;
}


.chart-container {
    position: relative;

    width: 100%;
    height: 450px;
}


.chart-status {
    min-height: 20px;

    margin-top: 12px;

    color: #6b7280;

    font-size: 13px;
}


@media (max-width: 520px) {

    .sensor-page h1 {
        font-size: 26px;
    }


    .sensor-current {
        font-size: 32px;
    }


    .period-selector {
        width: 100%;
    }


    .period-button {
        flex: 1;

        padding: 9px 8px;
    }


    .chart-card {
        padding: 12px;
    }


    .chart-container {
        height: 350px;
    }
}



.events-page {
    padding-bottom: 40px;
}


.events-page__header {
    margin-bottom: 24px;
}


.events-page h1 {
    margin: 0;
    font-size: 30px;
}


.events-card {
    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 16px;

    padding: 8px 24px;
}


.events-status {
    min-height: 20px;

    padding: 16px 0;

    color: #6b7280;

    font-size: 13px;
}


.events-list {
    display: flex;

    flex-direction: column;
}


.event-item {
    display: flex;
    align-items: center;

    gap: 14px;

    min-height: 68px;

    border-top: 1px solid #f0f1f3;
}


.event-item:first-child {
    border-top: none;
}


.event-item__icon {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 50%;

    font-size: 10px;
}


.event-item--open .event-item__icon {
    background: #fef2f2;
    color: #ef4444;
}


.event-item--closed .event-item__icon {
    background: #f0fdf4;
    color: #22c55e;
}


.event-item__content {
    display: flex;

    flex-direction: column;

    gap: 3px;
}


.event-item__state {
    font-size: 16px;

    font-weight: 600;
}


.event-item__time {
    color: #6b7280;

    font-size: 13px;
}


@media (max-width: 520px) {

    .events-page h1 {
        font-size: 26px;
    }


    .events-card {
        padding: 8px 16px;
    }
}