.home-automation-page {
    padding: 24px;
}

.home-automation-header {
    margin-bottom: 24px;
}

.home-automation-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.home-automation-header p {
    margin: 6px 0 0;
    color: #666;
}

.home-automation-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(320px, 1fr)
    );
    gap: 20px;
}

.home-device-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.home-device-card__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.home-device-card__header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.home-device-card__meta {
    margin-top: 4px;
    font-size: 13px;
    color: #6b7280;
}

.home-device-card__status {
    font-size: 13px;
    white-space: nowrap;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot--online {
    background: #16a34a;
}

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

.home-device-card__channels {
    display: grid;
    gap: 12px;
}

.home-channel-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
    background: #fafafa;
}

.home-channel-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.home-channel-card__title {
    font-weight: 600;
}

.home-channel-card__output {
    margin-top: 3px;
    font-size: 13px;
    color: #6b7280;
}

.home-channel-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-channel-toggle-form {
    margin: 0;
}

.home-channel-state {
    min-width: 48px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.home-channel-state--on {
    background: #dcfce7;
    color: #166534;
}

.home-channel-state--off {
    background: #f3f4f6;
    color: #4b5563;
}

.home-channel-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

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

.metric__label {
    font-size: 12px;
    color: #6b7280;
}

.metric__value {
    font-size: 16px;
    font-weight: 600;
}

.home-channel-card__footer {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    font-size: 11px;
    color: #9ca3af;
}

.home-channel-empty,
.home-automation-empty {
    padding: 16px;
    color: #6b7280;
}

.home-channel-toggle {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.home-channel-toggle:hover {
    transform: translateY(-1px);
}

.home-channel-toggle--on {
    background: #dcfce7;
    color: #166534;
}

.home-channel-toggle--off {
    background: #e5e7eb;
    color: #374151;
}

@media (max-width: 640px) {
    .home-automation-page {
        padding: 16px;
    }

    .home-automation-grid {
        grid-template-columns: 1fr;
    }

    .home-channel-metrics {
        grid-template-columns: 1fr 1fr;
    }
}
