html, body {
    height: 100%;
}
.gradient-bg {
    background: linear-gradient(135deg, #06938f 0%, #0aa3d8 50%, #00c853 100%);
}
.dark-mode .gradient-bg {
    background: linear-gradient(135deg, #0b1b2a 0%, #0b2a3c 50%, #102b1f 100%);
}
.swal2-title, .swal2-content {
    color: #fff;
}
.hidden {
    display: none !important;
}
.main-sidebar {
    background: linear-gradient(135deg, #0a8d8a 0%, #0a79c8 50%, #00a86b 100%);
    background-size: 200% 200%;
    animation: sidebarShift 14s ease infinite;
}
.main-sidebar .nav-link {
    color: rgba(255,255,255,0.9);
}
.main-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.12);
}
.main-sidebar .nav-link.active {
    background: rgba(255,255,255,0.2);
}
.dark-mode .main-sidebar {
    background: linear-gradient(135deg, #0a1623 0%, #0b2233 50%, #101c24 100%);
    background-size: 200% 200%;
    animation: sidebarShift 14s ease infinite;
}
.dark-mode .main-sidebar .nav-link {
    color: rgba(255,255,255,0.92);
}
.dark-mode .main-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.08);
}
.dark-mode .main-sidebar .nav-link.active {
    background: rgba(255,255,255,0.16);
}
.dark-mode .main-sidebar .brand-link {
    background: rgba(0,0,0,0.25);
}
.main-sidebar .brand-link {
    text-align: center;
}
.main-sidebar .brand-link .brand-text {
    display: block;
    width: 100%;
    text-align: center;
}
@keyframes sidebarShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.table-stack td {
    vertical-align: middle;
}
@media (max-width: 767.98px) {
    .table-stack thead {
        display: none;
    }
    .table-stack,
    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }
    .table-stack tr {
        margin-bottom: .75rem;
        border: 1px solid rgba(0,0,0,0.08);
        border-radius: .25rem;
        padding: .5rem .75rem;
        background: #fff;
    }
    .table-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: 0;
        padding: .25rem 0;
    }
    .table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        margin-right: .75rem;
    }
}
.fade-in {
    animation: fadeIn .35s ease-in both;
}
.slide-up {
    animation: slideUp .35s ease-out both;
}
.sensor-card {
    transition: transform .2s ease, box-shadow .2s ease;
}
.sensor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15);
}
.dark-mode .sensor-card {
    border: 1px solid rgba(160,160,160,.35);
    border-radius: .4rem;
    background: rgba(20,24,28,.6);
}
.dark-mode .sensor-card.is-on {
    border-left-color: #7ad08b;
}
.dark-mode .sensor-card.is-off {
    border-left-color: #e08c96;
}
.device-card .card-header {
    background: linear-gradient(135deg, rgba(10,163,216,0.15), rgba(0,200,83,0.15));
}
.dark-mode .device-card .card-header {
    background: linear-gradient(135deg, rgba(10,121,200,0.25), rgba(0,168,107,0.25));
}
.device-stats .badge {
    font-size: .75rem;
    padding: .35rem .5rem;
}
.sensor-card.is-on {
    border-left: 4px solid #28a745;
    box-shadow: 0 0.6rem 1.2rem rgba(40,167,69,.15);
}
.sensor-card.is-off {
    border-left: 4px solid #dc3545;
    box-shadow: 0 0.6rem 1.2rem rgba(220,53,69,.12);
}
.status-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.on {
    background: #28a745;
    box-shadow: 0 0 0 rgba(40,167,69,.6);
    animation: pulseGreen 1.6s infinite;
}
.status-dot.off {
    background: #dc3545;
    box-shadow: 0 0 0 rgba(220,53,69,.5);
    animation: pulseRed 1.6s infinite;
}
.status-pill {
    font-size: .75rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 999px;
    color: #fff;
}
.status-pill.on {
    background: #28a745;
}
.status-pill.off {
    background: #dc3545;
}
.dashboard-live .device-card {
    overflow: hidden;
}
.dashboard-live .device-card-body {
    padding: 1rem;
}
.dashboard-live .sensor-card .card-body {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.sensor-card-head strong {
    display: block;
    min-width: 0;
    font-size: .95rem;
    line-height: 1.25;
    margin-right: .5rem;
    word-break: break-word;
}
.sensor-card-meta {
    line-height: 1.35;
    word-break: break-word;
}
.dashboard-live .sensor-card .form-control-sm,
.dashboard-live .sensor-card .custom-range {
    width: 100%;
}
.dashboard-submit-btn {
    min-width: 160px;
}
@keyframes pulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(40,167,69,.55); }
    70% { box-shadow: 0 0 0 10px rgba(40,167,69,0); }
    100% { box-shadow: 0 0 0 0 rgba(40,167,69,0); }
}
@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(220,53,69,.5); }
    70% { box-shadow: 0 0 0 10px rgba(220,53,69,0); }
    100% { box-shadow: 0 0 0 0 rgba(220,53,69,0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@media (max-width: 767.98px) {
    .dashboard-live .card-body {
        padding: .85rem;
    }
    .dashboard-live .device-card-head {
        flex-direction: column;
        align-items: flex-start !important;
        gap: .5rem;
    }
    .dashboard-live .device-stats {
        display: flex;
        flex-wrap: wrap;
        gap: .35rem;
        width: 100%;
    }
    .dashboard-live .device-stats .badge {
        margin-right: 0 !important;
    }
    .dashboard-live .sensor-grid {
        margin-left: -.35rem;
        margin-right: -.35rem;
    }
    .dashboard-live .sensor-grid > [class*='col-'] {
        padding-left: .35rem;
        padding-right: .35rem;
        margin-bottom: .7rem;
    }
    .dashboard-live .sensor-card {
        border-radius: .7rem;
        box-shadow: 0 0.45rem 1rem rgba(0,0,0,.08);
    }
    .dashboard-live .sensor-card .card-body {
        padding: .8rem;
        gap: .6rem;
    }
    .sensor-card-head {
        flex-direction: column;
        gap: .45rem;
    }
    .sensor-card-head .badge {
        align-self: flex-start;
    }
    .status-row {
        flex-wrap: wrap;
    }
    .dashboard-live .sensor-card .form-control-sm {
        min-height: 38px;
    }
    .dashboard-live .sensor-card .custom-range {
        margin-top: .15rem;
    }
    .dashboard-live .led-reading,
    .dashboard-live .reading-hum {
        line-height: 1.4;
        word-break: break-word;
    }
    .dashboard-live .reading-temp {
        font-size: 1.2rem;
    }
    .dashboard-submit-btn {
        width: 100%;
        margin-top: .25rem;
    }
}
