/* Custom styling overrides and glassmorphism panel styles */

:root {
    --primary: #10b981; /* emerald-500 */
    --bg-dark: #0b0f19;
    --border-rgba: rgba(255, 255, 255, 0.05);
}

body {
    background-color: #1c253a !important;
    font-family: 'Plus Jakarta Sans', 'Outfit', 'Rubik', 'Assistant', sans-serif !important;
}

body:not(.light-theme) .bg-\[\#0c101c\],
body:not(.light-theme) .bg-\[\#0f172a\],
body:not(.light-theme) .bg-\[\#080b12\],
body:not(.light-theme) .bg-\[\#0e1626\],
body:not(.light-theme) .bg-\[\#050b14\] {
    background-color: #000000 !important;
}

body:not(.light-theme) .bg-\[\#151c2c\] {
    background-color: #0a0e1a !important;
    border-color: #1e293b !important;
}

body:not(.light-theme) #device-list-container > div:not(.eco-dev-themed-card):hover {
    background-color: #07090f !important;
}

body:not(.light-theme) .glass-panel {
    background: rgba(8, 12, 22, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.glass-panel {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.3) 0%, rgba(15, 23, 42, 0.5) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-rgba);
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

/* Custom range sliders styling */
.slider-bar {
    -webkit-appearance: none;
    height: 6px;
    border-radius: 5px;
    background: #1e293b;
    outline: none;
    transition: background 0.15s ease-in-out;
}

.slider-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: transform 0.1s ease-in-out;
}

.slider-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: transform 0.1s ease-in-out;
    border: none;
}

.slider-bar::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Chart Control tab button styles */
.chart-tab-btn {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid #1e293b;
    color: #94a3b8;
    background: transparent;
    transition: all 0.25s ease-in-out;
}

.chart-tab-btn:hover {
    color: #fff;
    background: rgba(30, 41, 59, 0.5);
}

.chart-tab-btn.active {
    color: #fff;
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

/* UI Action Button generic animations */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-action:hover {
    transform: translateY(-1px);
}

.btn-action:active {
    transform: translateY(0);
}

/* Thin Webkit scrollbar customization for logs */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Custom inputs selection states */
input:focus {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Color calendar icon for date picker */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* Alarm Filter Device Toggle Chips */
.alarm-device-chip-label input[type="checkbox"]:checked + .chip-text {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.alarm-device-chip-label input[type="checkbox"]:not(:checked) + .chip-text {
    background-color: #080b12;
    color: #94a3b8;
    border-color: #1e293b;
}

.alarm-device-chip-label:hover .chip-text {
    border-color: rgba(16, 185, 129, 0.3);
    color: #ffffff;
}

/* Smooth SPA transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Shake animation for validation errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.animate-shake {
    animation: shake 0.4s ease-in-out;
}

/* Premium Crown animation */
@keyframes crownPulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.4)); }
    50% { filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.8)); }
}

.premium-glow-crown {
    animation: crownPulse 3s infinite ease-in-out;
}

/* Global Size & Scale Optimizations - Dramatically Enlarged Fonts and Spacing */
html {
    font-size: 17px !important; /* Premium base scale up from 16px */
}

@media (min-width: 768px) {
    html {
        font-size: 18px !important;
    }
}

@media (min-width: 1024px) {
    html {
        font-size: 19px !important;
    }
}

@media (max-width: 640px) {
    /* Optimize card padding on mobile to maximize horizontal spacing */
    .glass-panel {
        padding: 0.75rem !important;
    }
    
    /* Device card list styling overrides for mobile */
    #device-list-container > div {
        padding: 0.75rem !important;
        border-radius: 12px !important;
        gap: 0.75rem !important;
    }
    
    /* Standardize device icons to a clean responsive size on mobile */
    #device-list-container svg {
        width: 56px !important;
        height: 56px !important;
    }
    #device-list-container img {
        width: 56px !important;
        height: 56px !important;
    }
    
    /* Make title and header elements stand out more on mobile */
    h1.text-3xl {
        font-size: 2.25rem !important;
    }
    h2.text-xl {
        font-size: 1.35rem !important;
    }
    
    /* regular dashboard cards compact on mobile */
    #regular-dashboard-grid {
        gap: 0.5rem !important;
    }
    #regular-dashboard-grid > div {
        height: auto !important;
        min-height: 65px !important;
        padding: 0.4rem 0.25rem !important;
        border-radius: 6px !important;
    }
    
    /* Expand tap target size of the info button */
    #regular-dashboard-grid > div button {
        width: 1.1rem !important;
        height: 1.1rem !important;
    }
    #regular-dashboard-grid > div button svg {
        width: 0.65rem !important;
        height: 0.65rem !important;
    }
}

/* Equalizer Animation for Baby Sounds playing state */
@keyframes eq-bar-anim {
    0%, 100% { height: 3px; }
    50% { height: 12px; }
}
.eq-bar-1 { animation: eq-bar-anim 0.8s ease-in-out infinite; }
.eq-bar-2 { animation: eq-bar-anim 0.5s ease-in-out infinite 0.2s; }
.eq-bar-3 { animation: eq-bar-anim 0.7s ease-in-out infinite 0.4s; }

/* Custom Redesign - Force Large Typography and Spacing on specific key panels */

/* Header & Titles Sizing */
h1.text-3xl {
    font-size: 2.25rem !important;
    font-weight: 800 !important;
}
h2.text-xl {
    font-size: 1.55rem !important;
    font-weight: 700 !important;
}
p.text-sm {
    font-size: 1.1rem !important;
}

/* Registered Devices section */
#devices-count {
    font-size: 0.9rem !important;
}
#btn-open-add-device {
    font-size: 0.95rem !important;
    padding: 0.5rem 0.85rem !important;
}

/* Device rows styling scale-up */
#device-list-container .text-lg {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
}
#device-list-container .text-xs,
#device-list-container .text-sm,
#device-list-container .text-\[11px\],
#device-list-container .text-\[10px\] {
    font-size: 0.95rem !important;
}
/* Crucial: ensure edit/delete buttons/icons remain clean and proportional */
#device-list-container button {
    padding: 6px !important;
}
#device-list-container button svg {
    width: 18px !important;
    height: 18px !important;
}

/* Live environmental cards sizing & font enhancements */
#regular-dashboard-grid > div {
    min-height: 75px !important;
    padding: 0.5rem 0.35rem !important;
    border-radius: 8px !important;
}
#regular-dashboard-grid > div .metric-icon {
    font-size: 1rem !important;
    margin-bottom: 2px !important;
}
#regular-dashboard-grid > div .metric-name {
    font-size: 0.55rem !important;
    letter-spacing: 0.05em !important;
}
#regular-dashboard-grid > div .metric-value {
    font-size: 0.8rem !important;
}
#regular-dashboard-grid > div .metric-status {
    font-size: 0.55rem !important;
    letter-spacing: 0.05em !important;
}
/* Crucial: info button sizing */
#regular-dashboard-grid > div button.absolute {
    width: 16px !important;
    height: 16px !important;
    top: 4px !important;
    right: 4px !important;
}
#regular-dashboard-grid > div button.absolute svg {
    width: 9px !important;
    height: 9px !important;
}

/* Security logs, device details panels, and tables scale-up */
.glass-panel button[onclick*="toggleCollapsible"],
.glass-panel div[onclick*="toggleCollapsible"] {
    padding: 0.65rem 1rem !important; /* Compact premium spacing unified like security log */
}

.glass-panel button[onclick*="toggleCollapsible"] h3,
.glass-panel div[onclick*="toggleCollapsible"] h3,
#security-log-card h3 {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
}

#detail-view label,
#detail-view select,
#detail-view input,
#detail-view span:not(.text-[10px]):not(.text-[9px]):not(.rounded-full) {
    font-size: 0.8rem !important;
}

#detail-view p.text-xs {
    font-size: 0.65rem !important;
}

#detail-view table th {
    font-size: 0.65rem !important;
    padding: 0.35rem 0.45rem !important;
}
#detail-view table td {
    font-size: 0.7rem !important;
    padding: 0.35rem 0.45rem !important;
}

/* Alarm Logs Table styling */
#alarm-list-container table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Outfit', 'Rubik', 'Assistant', sans-serif !important;
}

#alarm-list-container table th {
    position: sticky;
    top: 0;
    background-color: #0c1222;
    color: #94a3b8;
    font-weight: 600;
    font-size: 10px !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 6px !important;
    border-bottom: 1px solid rgba(30, 41, 59, 0.6);
    z-index: 10;
}

body.light-theme #alarm-list-container table th {
    background-color: #e2e8f0 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

#alarm-list-container table td {
    padding: 6px 6px !important;
    vertical-align: middle;
    border-bottom: 1px solid rgba(30, 41, 59, 0.4);
    font-family: 'Outfit', 'Rubik', 'Assistant', sans-serif !important;
}

#alarm-list-container .text-time {
    font-size: 11px !important;
    font-weight: 600 !important;
}

#alarm-list-container .text-date {
    font-size: 9.5px !important;
}

#alarm-list-container .text-device {
    font-size: 11px !important;
    font-weight: 600 !important;
}

#alarm-list-container .text-location {
    font-size: 9.5px !important;
}

#alarm-list-container .text-desc {
    font-size: 11px !important;
}

#alarm-list-container .badge-text {
    font-size: 9px !important;
    font-weight: 700 !important;
}

#alarm-list-container .font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}

/* Settings modal and inputs readability */
#settings-modal-container h2 {
    font-size: 1.55rem !important;
}
#settings-modal-container button,
#settings-modal-container label,
#settings-modal-container input,
#settings-modal-container select {
    font-size: 1.05rem !important;
}

/* Mobile responsive scale down to prevent overflows and optimize grids */
@media (max-width: 640px) {
    #device-list-container .text-lg {
        font-size: 1.1rem !important;
    }
    #device-list-container .text-xs,
    #device-list-container .text-sm,
    #device-list-container .text-\[11px\],
    #device-list-container .text-\[10px\] {
        font-size: 0.85rem !important;
    }
    #device-list-container .text-sm,
    #device-list-container .text-base {
        font-size: 0.85rem !important; /* scale down telemetry summary on mobile */
    }
    #regular-dashboard-grid > div {
        min-height: 65px !important;
        padding: 0.4rem 0.25rem !important;
        border-radius: 6px !important;
    }
    #regular-dashboard-grid > div .metric-icon {
        font-size: 0.9rem !important;
    }
    #regular-dashboard-grid > div .metric-name {
        font-size: 0.5rem !important;
    }
    #regular-dashboard-grid > div .metric-value {
        font-size: 0.75rem !important;
    }
    #regular-dashboard-grid > div .metric-status {
        font-size: 0.5rem !important;
    }
    
    /* Device illustration scaling on mobile */
    #device-list-container img, 
    #device-list-container svg {
        width: 56px !important;
        height: 56px !important;
    }

    /* Clean grid navigation container for header buttons on mobile has been moved to responsive hamburger styles */

    /* Stacking layout for collapsible headers on mobile to prevent squishing */
    .glass-panel button[onclick*="toggleCollapsible"],
    .glass-panel div[onclick*="toggleCollapsible"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 0.75rem !important;
    }
    .glass-panel button[onclick*="toggleCollapsible"] > div:first-child,
    .glass-panel div[onclick*="toggleCollapsible"] > div:first-child {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
    }
    .glass-panel button[onclick*="toggleCollapsible"] > div:first-child > span,
    .glass-panel div[onclick*="toggleCollapsible"] > div:first-child > span {
        flex-shrink: 0 !important;
    }
    .glass-panel button[onclick*="toggleCollapsible"] > div:first-child > div,
    .glass-panel div[onclick*="toggleCollapsible"] > div:first-child > div {
        flex: 1 !important;
        min-width: 0 !important;
    }
    .glass-panel button[onclick*="toggleCollapsible"] > div:last-child,
    .glass-panel div[onclick*="toggleCollapsible"] > div:last-child {
        width: 100% !important;
        justify-content: flex-start !important;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 8px !important;
        margin-top: 4px !important;
        margin-left: 0 !important;
        display: flex !important;
        align-items: center !important;
    }
}

/* PREMIUM LIGHT THEME OVERRIDES */
body.light-theme {
    background-color: #faf9f6 !important; /* Soft warm Alabaster/Warm Stone */
    background-image: radial-gradient(at 0% 0%, rgba(240, 237, 230, 0.4) 0px, transparent 50%),
                      radial-gradient(at 100% 100%, rgba(230, 235, 240, 0.4) 0px, transparent 50%) !important;
    background-attachment: fixed !important;
    color: #1e1b18 !important; /* Rich charcoal with warm bronze-brown undertones */
}

body.light-theme .glass-panel {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-color: rgba(30, 27, 24, 0.05) !important;
    box-shadow: 0 10px 40px rgba(30, 27, 24, 0.03), 0 2px 10px rgba(30, 27, 24, 0.01) !important;
}

body.light-theme h1,
body.light-theme h2,
body.light-theme h3,
body.light-theme .text-white {
    color: #1e1b18 !important; /* Premium rich dark bronze */
}

body.light-theme p,
body.light-theme .text-\[\#94a3b8\],
body.light-theme .text-\[\#cbd5e1\],
body.light-theme .text-slate-400,
body.light-theme .text-slate-300,
body.light-theme .text-slate-200,
body.light-theme .text-slate-100,
body.light-theme .text-gray-300,
body.light-theme .text-gray-200 {
    color: #5c5854 !important; /* Soft warm slate/stone */
}

body.light-theme .bg-\[\#151c2c\] div {
    color: #5c5854 !important;
}

body.light-theme input,
body.light-theme select {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(30, 27, 24, 0.1) !important;
    color: #1e1b18 !important;
}

body.light-theme label {
    color: #5c5854 !important;
}

body.light-theme #device-list-container > div {
    background-color: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important; /* Defined, solid slate gray border */
    color: #1e1b18 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06) !important;
}

body.light-theme #device-list-container > div.bg-\[\#0f172a\] {
    background-color: #ffffff !important;
    border: 2.5px solid #386641 !important; /* Highly visible premium Sage border */
    box-shadow: 0 8px 24px rgba(56, 102, 65, 0.1) !important;
}

body.light-theme #device-list-container > div.bg-\[\#160b0e\],
body.light-theme #device-list-container > div.bg-\[\#12080a\] {
    background-color: rgba(139, 38, 53, 0.04) !important;
    border: 2.5px solid #8b2635 !important; /* Thick burgundy alarm border */
    color: #8b2635 !important;
    box-shadow: 0 8px 24px rgba(139, 38, 53, 0.1) !important;
}

body.light-theme #device-list-container > div:hover {
    background-color: #ffffff !important;
    border: 1.5px solid #386641 !important;
    box-shadow: 0 8px 22px rgba(30, 27, 24, 0.1) !important;
}

body.light-theme #device-list-container .text-white {
    color: #1e1b18 !important;
}

body.light-theme .bg-\[\#151c2c\] {
    background-color: #f1f0ec !important; /* Contrasting soft sand-stone inner background */
    border: 1px solid rgba(30, 27, 24, 0.1) !important;
    color: #1e1b18 !important;
}

body.light-theme #device-list-container > div.bg-\[\#0f172a\] .bg-\[\#151c2c\] {
    background-color: #e6e4df !important; /* Slightly deeper contrast inside active card */
}

body.light-theme #device-list-container > div.bg-\[\#160b0e\] .bg-\[\#151c2c\],
body.light-theme #device-list-container > div.bg-\[\#12080a\] .bg-\[\#151c2c\] {
    background-color: rgba(139, 38, 53, 0.06) !important;
}

body.light-theme #regular-dashboard-grid > div {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(30, 27, 24, 0.06) !important;
}

body.light-theme #regular-dashboard-grid > div.bg-emerald-500\/10 {
    background-color: rgba(56, 102, 65, 0.06) !important;
    border-color: rgba(56, 102, 65, 0.18) !important;
}

body.light-theme #regular-dashboard-grid > div.bg-amber-500\/10 {
    background-color: rgba(184, 90, 56, 0.06) !important;
    border-color: rgba(184, 90, 56, 0.18) !important;
}

body.light-theme #regular-dashboard-grid > div.bg-red-500\/10 {
    background-color: rgba(139, 38, 53, 0.06) !important;
    border-color: rgba(139, 38, 53, 0.18) !important;
}

body.light-theme #regular-dashboard-grid > div .text-white {
    color: #1e1b18 !important;
}

body.light-theme #alarm-filters-panel {
    background-color: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(30, 27, 24, 0.06) !important;
}

body.light-theme #security-log-card table th {
    background-color: rgba(245, 243, 240, 0.8) !important;
    color: #5c5854 !important;
    border-color: rgba(30, 27, 24, 0.08) !important;
}

body.light-theme #security-log-card table td {
    color: #1e1b18 !important;
    border-color: rgba(30, 27, 24, 0.05) !important;
}

body.light-theme #security-log-card table tr:hover {
    background-color: rgba(255, 255, 255, 0.4) !important;
}

body.light-theme #screen-sources-checkbox-list {
    background-color: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(30, 27, 24, 0.08) !important;
}

body.light-theme #auth-container {
    background: linear-gradient(to right, #faf9f6, #f3f1eb) !important;
    color: #1e1b18 !important;
}

body.light-theme #auth-container .glass-panel {
    background: rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 20px 50px rgba(30, 27, 24, 0.05) !important;
    border-color: rgba(30, 27, 24, 0.06) !important;
}

body.light-theme #auth-container .text-white {
    color: #1e1b18 !important;
}

body.light-theme #ir-buttons-grid > button {
    background-color: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(30, 27, 24, 0.08) !important;
    color: #5c5854 !important;
}

body.light-theme #ir-buttons-grid > button:hover {
    background-color: rgba(255, 255, 255, 1) !important;
    color: #1e1b18 !important;
    border-color: rgba(56, 102, 65, 0.2) !important;
}

body.light-theme .chart-tab-btn {
    border-color: rgba(30, 27, 24, 0.08) !important;
    color: #5c5854 !important;
}

body.light-theme .chart-tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.8) !important;
    color: #1e1b18 !important;
}

body.light-theme .chart-tab-btn.active {
    background-color: #386641 !important; /* Sage/Jade active state */
    color: #ffffff !important;
    border-color: #386641 !important;
}

body.light-theme #webcam-placeholder {
    background-color: rgba(245, 243, 240, 0.6) !important;
}

body.light-theme #webcam-placeholder .text-\[\#94a3b8\] {
    color: #5c5854 !important;
}

body.light-theme #sd-status-badge {
    background-color: rgba(88, 49, 90, 0.08) !important;
    color: #58315a !important;
    border-color: rgba(88, 49, 90, 0.18) !important;
}

body.light-theme .hover\:text-white:hover {
    color: #1e1b18 !important;
}

body.light-theme #settings-modal-container button:hover,
body.light-theme #btn-close-settings:hover,
body.light-theme #btn-toggle-theme:hover,
body.light-theme #btn-open-settings:hover {
    color: #1e1b18 !important;
}

body.light-theme .border-\[\#1e293b\] {
    border-color: rgba(30, 27, 24, 0.08) !important;
}

body.light-theme .border-slate-800 {
    border-color: rgba(30, 27, 24, 0.08) !important;
}

body.light-theme .border-slate-700 {
    border-color: rgba(30, 27, 24, 0.08) !important;
}

body.light-theme header {
    border-color: rgba(30, 27, 24, 0.06) !important;
}

body.light-theme #settings-modal-container .border-b,
body.light-theme #settings-modal-container .border-t {
    border-color: rgba(30, 27, 24, 0.08) !important;
}

/* Curated, rich luxury status color overrides for light mode */
body.light-theme .text-emerald-300,
body.light-theme .text-emerald-400,
body.light-theme .text-emerald-500 {
    color: #386641 !important; /* Premium Jade green */
}
body.light-theme .text-sky-300,
body.light-theme .text-sky-400,
body.light-theme .text-sky-500 {
    color: #2b4c7e !important; /* Premium Slate blue */
}
body.light-theme .text-teal-300,
body.light-theme .text-teal-400,
body.light-theme .text-teal-500 {
    color: #285855 !important;
}
body.light-theme .text-cyan-300,
body.light-theme .text-cyan-400,
body.light-theme .text-cyan-500 {
    color: #265c69 !important;
}
body.light-theme .text-amber-300,
body.light-theme .text-amber-400,
body.light-theme .text-amber-500 {
    color: #a77a28 !important; /* Bronze gold */
}
body.light-theme .text-yellow-300,
body.light-theme .text-yellow-400,
body.light-theme .text-yellow-500 {
    color: #8c6a1b !important;
}
body.light-theme .text-orange-300,
body.light-theme .text-orange-400,
body.light-theme .text-orange-500 {
    color: #b85a38 !important; /* Elegant Terracotta */
}
body.light-theme .text-red-300,
body.light-theme .text-red-400,
body.light-theme .text-red-500 {
    color: #8b2635 !important; /* Crimson Wine Red */
}
body.light-theme .text-purple-300,
body.light-theme .text-purple-400,
body.light-theme .text-purple-500 {
    color: #58315a !important; /* Premium Eggplant/Plum */
}
body.light-theme .text-indigo-300,
body.light-theme .text-indigo-400,
body.light-theme .text-indigo-500 {
    color: #313d5a !important;
}
body.light-theme .text-violet-300,
body.light-theme .text-violet-400,
body.light-theme .text-violet-500 {
    color: #4a315a !important;
}

/* Gradient text overrides in light mode */
body.light-theme h1.text-transparent,
body.light-theme h2.text-transparent,
body.light-theme h3.text-transparent,
body.light-theme .text-transparent {
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
}

body.light-theme .bg-gradient-to-r.from-emerald-400 {
    background-image: linear-gradient(to right, #386641, #285855, #2b4c7e) !important;
}

body.light-theme .bg-gradient-to-r.from-amber-400 {
    background-image: linear-gradient(to right, #a77a28, #386641, #2b4c7e) !important;
}

body.light-theme .bg-gradient-to-r.from-red-500 {
    background-image: linear-gradient(to right, #8b2635, #9e2a2b, #a77a28) !important;
}

/* Invert dark backgrounds in Light Mode - Premium warm sand/stone colors */
body.light-theme .bg-\[\#080b12\],
body.light-theme .bg-\[\#0e1626\],
body.light-theme .bg-\[\#050b14\],
body.light-theme .bg-\[\#0c101c\],
body.light-theme .bg-\[\#0f172a\] {
    background-color: rgba(255, 255, 255, 0.95) !important;
    color: #1e1b18 !important;
    border-color: rgba(30, 27, 24, 0.05) !important;
}

body.light-theme .bg-\[\#1e293b\] {
    background-color: #f5f3f0 !important;
    color: #5c5854 !important;
    border-color: rgba(30, 27, 24, 0.08) !important;
}

body.light-theme .bg-\[\#1e293b\]\/50,
body.light-theme .bg-\[\#1e293b\]\/60 {
    background-color: rgba(30, 27, 24, 0.04) !important;
    color: #5c5854 !important;
    border-color: rgba(30, 27, 24, 0.06) !important;
}

body.light-theme .bg-\[\#160b0e\],
body.light-theme .bg-\[\#12080a\] {
    background-color: rgba(139, 38, 53, 0.04) !important;
    color: #8b2635 !important;
    border-color: rgba(139, 38, 53, 0.15) !important;
}

/* Hover overrides for buttons and rows in Light Mode */
body.light-theme .hover\:bg-\[\#334155\]:hover,
body.light-theme .hover\:bg-\[\#334155\]\/50:hover {
    background-color: rgba(30, 27, 24, 0.08) !important;
    color: #1e1b18 !important;
}

body.light-theme .hover\:bg-\[\#131a2b\]:hover {
    background-color: rgba(30, 27, 24, 0.04) !important;
}

body.light-theme .hover\:bg-\[\#1e293b\]:hover {
    background-color: rgba(30, 27, 24, 0.06) !important;
}

/* ==========================================================================
   Responsive Hamburger Navigation Menu Styles (max-width: 767px)
   ========================================================================== */
@media (max-width: 767px) {
    #header-nav-container {
        display: flex !important;
        visibility: hidden !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 300px !important;
        height: 100vh !important;
        z-index: 50 !important;
        padding: 2rem 1.5rem !important;
        background-color: rgba(8, 12, 22, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6) !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease !important;
        gap: 1rem !important;
        overflow-y: auto !important;
    }
    
    #header-nav-container.open {
        visibility: visible !important;
        transform: translateX(0) !important;
    }

    #header-nav-container > * {
        width: 100% !important;
        justify-content: flex-start !important;
        text-align: start !important;
    }
    
    /* Optimize buttons inside mobile drawer to look like clean menu list items */
    #header-nav-container .glass-panel:not(.hidden),
    #header-nav-container button:not(.hidden),
    #header-nav-container a:not(.hidden) {
        background-color: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        padding: 0.75rem 1rem !important;
        border-radius: 12px !important;
        font-size: 0.85rem !important;
        color: #cbd5e1 !important;
        transition: all 0.20s ease !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    #header-nav-container .glass-panel:hover,
    #header-nav-container button:hover,
    #header-nav-container a:hover {
        background-color: rgba(16, 185, 129, 0.08) !important;
        border-color: rgba(16, 185, 129, 0.2) !important;
        color: #10b981 !important;
    }

    /* Unified header menu button stays compact in top bar */

    /* Hide the clock container on mobile to avoid info clutter */
    #header-clock-container {
        display: none !important;
    }
    


    #system-status-badge {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.75rem !important;
    }

    /* Light Theme Drawer Overrides */
    body.light-theme #header-nav-container {
        background-color: rgba(255, 255, 255, 0.98) !important;
        border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1) !important;
    }
    
    body.light-theme #header-nav-container .glass-panel,
    body.light-theme #header-nav-container button,
    body.light-theme #header-nav-container a {
        background-color: rgba(0, 0, 0, 0.02) !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        color: #1e1b18 !important;
    }
    
    body.light-theme #header-nav-container .glass-panel:hover,
    body.light-theme #header-nav-container button:hover,
    body.light-theme #header-nav-container a:hover {
        background-color: rgba(56, 102, 65, 0.08) !important;
        border-color: rgba(56, 102, 65, 0.2) !important;
        color: #386641 !important;
    }
}

body.light-theme #header-nav-backdrop {
    background-color: rgba(241, 245, 249, 0.6) !important;
}

body.light-theme .slider-bar {
    background: #cbd5e1 !important;
}

/* Light theme camera action button styles */
body.light-theme #btn-siren {
    background-color: rgba(139, 38, 53, 0.06) !important;
    color: #8b2635 !important;
    border-color: rgba(139, 38, 53, 0.2) !important;
}
body.light-theme #btn-siren:hover {
    background-color: rgba(139, 38, 53, 0.12) !important;
}

body.light-theme #btn-push-to-talk {
    background-color: rgba(56, 102, 65, 0.06) !important;
    color: #386641 !important;
    border-color: rgba(56, 102, 65, 0.2) !important;
}
body.light-theme #btn-push-to-talk:hover {
    background-color: rgba(56, 102, 65, 0.12) !important;
}

body.light-theme #btn-snapshot {
    background-color: rgba(43, 76, 126, 0.06) !important;
    color: #2b4c7e !important;
    border-color: rgba(43, 76, 126, 0.2) !important;
}
body.light-theme #btn-snapshot:hover {
    background-color: rgba(43, 76, 126, 0.12) !important;
}

body.light-theme #btn-cam-play-audio {
    background-color: rgba(139, 38, 53, 0.06) !important;
    color: #8b2635 !important;
    border-color: rgba(139, 38, 53, 0.2) !important;
}
body.light-theme #btn-cam-play-audio:hover {
    background-color: rgba(139, 38, 53, 0.12) !important;
}

body.light-theme #btn-gallery-save-all {
    background-color: rgba(56, 102, 65, 0.06) !important;
    color: #386641 !important;
    border-color: rgba(56, 102, 65, 0.2) !important;
}
body.light-theme #btn-gallery-save-all:hover {
    background-color: rgba(56, 102, 65, 0.12) !important;
}


/* Mobile Drawer & User Profile Dropdown Horizontal-Overflow Fix */
@media (max-width: 767px) {
    #header-nav-container {
        width: min(92vw, 330px) !important;
        max-width: 92vw !important;
        padding: 1.15rem 0.9rem !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    #user-profile-wrapper {
        width: auto !important;
        max-width: none !important;
    }
    #user-session-dropdown {
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
}


/* Light Theme Unified User Menu Overrides */
body.light-theme #user-session-dropdown {
    background-color: rgba(255, 255, 255, 0.98) !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    color: #0f172a !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18) !important;
}
body.light-theme #user-session-dropdown > div:first-child {
    background-color: rgba(241, 245, 249, 0.9) !important;
}
body.light-theme #user-session-dropdown #menu-account-username,
body.light-theme #user-session-dropdown button:not(.text-amber-300):not(.text-rose-400):not(.text-sky-300),
body.light-theme #user-session-dropdown a {
    color: #1e293b !important;
}
body.light-theme #user-session-dropdown button:hover,
body.light-theme #user-session-dropdown a:hover {
    background-color: rgba(15, 23, 42, 0.06) !important;
}


/* === ECO SOLID OPAQUE MENUS & MODALS (v21.0) === */
body:not(.light-theme) .eco-solid-menu,
body:not(.light-theme) #user-session-dropdown,
body:not(.light-theme) #eco-device-actions-popover {
    background-color: #152033 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body:not(.light-theme) .eco-solid-menu-header {
    background-color: #0f172a !important;
}

body:not(.light-theme) .eco-solid-modal {
    background-color: #162238 !important;
    border-color: #64748b !important;
    color: #f8fafc !important;
    opacity: 1 !important;
}

body:not(.light-theme) .eco-solid-modal-row {
    background-color: #0d1526 !important;
    border-color: #334155 !important;
}

body.light-theme .eco-solid-menu,
body.light-theme #user-session-dropdown,
body.light-theme #eco-device-actions-popover,
body.light-theme .eco-solid-modal {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    opacity: 1 !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22) !important;
}

body.light-theme .eco-solid-menu-header,
body.light-theme .eco-solid-modal-row {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme .eco-solid-modal h3,
body.light-theme .eco-solid-modal-row span,
body.light-theme #user-session-dropdown .eco-menu-row,
body.light-theme #user-session-dropdown #menu-account-username,
body.light-theme #eco-device-actions-popover button {
    color: #0f172a !important;
}

body.light-theme #user-session-dropdown .eco-menu-row:hover,
body.light-theme #eco-device-actions-popover button:hover {
    background-color: #f1f5f9 !important;
}

body.light-theme #settings-display-modal .eco-solid-modal button:not(.btn-close-subsettings) {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* === CLEAN PROFESSIONAL TOP NAVBAR (v21.3) === */
#user-profile-wrapper {
    width: auto !important;
    flex-shrink: 0 !important;
}

body:not(.light-theme) #user-profile-badge {
    background-color: #152033 !important;
    border: 1px solid #475569 !important;
    color: #f8fafc !important;
    width: auto !important;
}

body:not(.light-theme) #user-profile-badge:hover {
    background-color: #1e2d47 !important;
    border-color: #64748b !important;
}

body.light-theme #user-profile-badge {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    width: auto !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

body.light-theme #user-profile-badge #header-username,
body.light-theme #user-profile-badge svg {
    color: #0f172a !important;
}

/* === PROFESSIONAL ARCHITECTURAL LIGHT THEME SYSTEM (v21.5) === */
body.light-theme {
    background-color: #f1f5f9 !important;
    background-image: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%) !important;
    color: #0f172a !important;
}

/* Outer Panels */
body.light-theme .glass-panel {
    background: #ffffff !important;
    border: 1px solid #dce4ee !important;
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.03) !important;
}

/* Typography Contrast Hierarchy */
body.light-theme h1:not(.text-transparent),
body.light-theme h2:not(.text-transparent),
body.light-theme h3:not(.text-transparent),
body.light-theme h4:not(.text-transparent),
body.light-theme .text-white,
body.light-theme .text-slate-100 {
    color: #0f172a !important;
}

body.light-theme .text-slate-200,
body.light-theme .text-slate-300,
body.light-theme .text-\[\#cbd5e1\] {
    color: #334155 !important;
}

body.light-theme .text-slate-400,
body.light-theme .text-slate-500,
body.light-theme .text-\[\#94a3b8\] {
    color: #64748b !important;
}

/* Status Accents in Light Mode — Crisp, Clean, Balanced */
body.light-theme .text-emerald-300,
body.light-theme .text-emerald-400,
body.light-theme .text-emerald-500 {
    color: #047857 !important;
}

body.light-theme .text-sky-300,
body.light-theme .text-sky-400,
body.light-theme .text-sky-500 {
    color: #0369a1 !important;
}

body.light-theme .text-indigo-300,
body.light-theme .text-indigo-400 {
    color: #4338ca !important;
}

body.light-theme .text-amber-300,
body.light-theme .text-amber-400 {
    color: #b45309 !important;
}

body.light-theme .text-rose-300,
body.light-theme .text-rose-400,
body.light-theme .text-red-400 {
    color: #be123c !important;
}

/* Top Navbar Elements in Light Mode */
body.light-theme header {
    border-bottom-color: #dde4ee !important;
}

body.light-theme header .bg-slate-700\/80 {
    background-color: #cbd5e1 !important;
}

body.light-theme #system-status-badge.bg-emerald-500\/10 {
    background-color: #ecfdf5 !important;
    border-color: #a7f3d0 !important;
    color: #047857 !important;
}

body.light-theme #header-clock-container {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

/* Active Hardware Header, Counter Pill, Segmented View Toggle & Add Button */
body.light-theme #devices-count {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}

body.light-theme #active-hardware-card .bg-\[\#070b14\] {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05) !important;
}

body.light-theme #btn-layout-mode-building.bg-emerald-500\/20,
body.light-theme #btn-layout-mode-cards.bg-emerald-500\/20 {
    background-color: #ffffff !important;
    color: #047857 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08) !important;
}

body.light-theme #btn-open-add-device {
    background-color: #ecfdf5 !important;
    border-color: #6ee7b7 !important;
    color: #047857 !important;
}
body.light-theme #btn-open-add-device:hover {
    background-color: #d1fae5 !important;
}

/* 4 Top Executive KPI Squares (#devices-executive-summary) */
body.light-theme #devices-executive-summary > button {
    background-color: #f8fafc !important;
    border: 1.5px solid #dbe3ee !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03) !important;
    color: #0f172a !important;
}

body.light-theme #devices-executive-summary > button:hover {
    background-color: #ffffff !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07) !important;
}

body.light-theme #devices-executive-summary > button .w-9.h-9 {
    background-color: #ffffff !important;
    border-color: #dbe3ee !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}

/* Device Cards (#device-list-container) */
body.light-theme #device-list-container > div {
    background-color: #ffffff !important;
    border: 1.5px solid #d8e1ec !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04) !important;
    color: #0f172a !important;
}

body.light-theme #device-list-container > div.bg-\[\#0d1729\] {
    background-color: #ffffff !important;
    border: 2px solid #059669 !important;
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.12) !important;
}

body.light-theme #device-list-container > div:hover {
    border-color: #94a3b8 !important;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08) !important;
}

/* 5 Sensor Metric Tiles inside Device Cards */
body.light-theme #device-list-container .grid-cols-5 > div,
body.light-theme #device-list-container [class*="bg-[#0d1526]"] {
    background-color: #f4f7fb !important;
    border: 1px solid #dfe7f1 !important;
    color: #0f172a !important;
}

body.light-theme #device-list-container .grid-cols-5 > div.bg-amber-950\/15 {
    background-color: #fffbeb !important;
    border-color: #fcd34d !important;
}

body.light-theme #device-list-container .grid-cols-5 > div.bg-rose-950\/20 {
    background-color: #fff1f2 !important;
    border-color: #fda4af !important;
}

body.light-theme #device-list-container .grid-cols-5 > div span.font-mono {
    color: #0f172a !important;
}
body.light-theme #device-list-container .grid-cols-5 > div.bg-amber-950\/15 span.font-mono {
    color: #b45309 !important;
}
body.light-theme #device-list-container .grid-cols-5 > div.bg-rose-950\/20 span.font-mono {
    color: #be123c !important;
}

/* Buttons & Location Pills inside Device Cards (ביטול צופר, ⋮, מיקום) */
body.light-theme #device-list-container button {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: none !important;
}

body.light-theme #device-list-container button:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* Thumbnail Status Lamp Ring in Light Mode */
body.light-theme #device-list-container .border-\[\#0a101d\],
body.light-theme .eco-unit-chip .border-\[\#0b1322\] {
    border-color: #ffffff !important;
}

/* Architectural Building Sketch View (.eco-blueprint-surface, Floors, Rooms, Unit Chips) */
body.light-theme .eco-blueprint-surface,
body.light-theme #building-blueprint-canvas > div {
    background-color: #f8fafc !important;
    background-image:
        linear-gradient(to right, rgba(14, 116, 144, 0.045) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(14, 116, 144, 0.045) 1px, transparent 1px) !important;
    border-color: #cbd5e1 !important;
}

body.light-theme .eco-room-dropzone {
    background-color: #ffffff !important;
    border: 1.5px solid #d5dfec !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03) !important;
}

body.light-theme .eco-room-dropzone .bg-slate-800\/90 {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
}

body.light-theme .eco-unit-chip {
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme .eco-unit-chip:hover {
    background-color: #ffffff !important;
    border-color: #94a3b8 !important;
}

body.light-theme .eco-unit-chip .bg-slate-900,
body.light-theme .eco-unit-chip button {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

body.light-theme .eco-unit-chip button:hover {
    background-color: #e2e8f0 !important;
}

/* General Dark Surface Fallbacks inside Light Mode (Graphs, Sub-panels, Tables, Badges) */
body.light-theme #graphs-container [class*="bg-[#0"],
body.light-theme #graphs-container [class*="bg-slate-900"],
body.light-theme #camera-widget-container [class*="bg-[#0"]:not(#camera-viewer-locked-overlay):not(#camera-timeout-overlay),
body.light-theme #device-hardware-prefs-modal [class*="bg-[#0"],
body.light-theme #settings-automations-modal [class*="bg-[#0"] {
    background-color: #f8fafc !important;
    border-color: #dbe3ee !important;
    color: #0f172a !important;
}

body.light-theme .border-slate-800\/80,
body.light-theme .border-slate-800\/90,
body.light-theme .border-slate-700\/80,
body.light-theme .border-\[\#1e293b\]\/80 {
    border-color: #e2e8f0 !important;
}

body.light-theme .eco-room-dropzone svg line[stroke="#070d19"] {
    stroke: #ffffff !important;
}

/* === DETAIL VIEW, LIVE CAMERA & ANALYTICS LIGHT THEME (v21.6) === */
/* Selected Device Top Bar Chips & Action Buttons */
body.light-theme #detail-view button[onclick*="backToDeviceList"] {
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}
body.light-theme #detail-view button[onclick*="backToDeviceList"]:hover {
    background-color: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

body.light-theme #detail-device-status-badges .eco-detail-chip {
    background-color: #f4f7fb !important;
    border-color: #d8e1ec !important;
    color: #1e293b !important;
}

body.light-theme #detail-device-status-badges .eco-detail-action-btn {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: none !important;
}
body.light-theme #detail-device-status-badges .eco-detail-action-btn:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
}

/* Camera Header Timer & Close Button */
body.light-theme #camera-session-timer-badge.eco-cam-timer-ok {
    background-color: #f0f9ff !important;
    border-color: #bae6fd !important;
    color: #0369a1 !important;
}
body.light-theme #camera-session-timer-badge.eco-cam-timer-warn {
    background-color: #fffbeb !important;
    border-color: #fcd34d !important;
    color: #b45309 !important;
}
body.light-theme #btn-close-camera {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}
body.light-theme #btn-close-camera:hover {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Preserve White Text Inside Dark Video Overlays */
body.light-theme #camera-timeout-overlay h4,
body.light-theme #camera-viewer-locked-overlay h4 {
    color: #ffffff !important;
}
body.light-theme #camera-timeout-overlay p {
    color: #cbd5e1 !important;
}

/* Camera Sub-Cards: ISP Color, Smart LED, Passive Buzzer, Intercom, Storage */
body.light-theme #cam-color-settings-section,
body.light-theme #rgb-led-settings-section,
body.light-theme #camera-widget-container .bg-slate-900\/60,
body.light-theme #intercom-level-container,
body.light-theme #sd-info-section > div:first-child {
    background-color: #f8fafc !important;
    border: 1px solid #d8e1ec !important;
    color: #0f172a !important;
}

body.light-theme #cam-color-controls-panel {
    background-color: #ffffff !important;
    border: 1px solid #dbe3ee !important;
}

/* Smart LED Pilot Lamp Pill & Toggle Switch Wrapper */
body.light-theme #smart-led-pilot-wrap,
body.light-theme #rgb-led-settings-section label.bg-slate-900\/80 {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

body.light-theme #rgb-led-settings-section .peer ~ div.bg-slate-700 {
    background-color: #cbd5e1 !important;
}
body.light-theme #rgb-led-settings-section .peer:checked ~ div {
    background-color: #10b981 !important;
}

/* Camera & Intercom Controls / Selects / Buttons */
body.light-theme #buzzer-tone-select,
body.light-theme #cam-audio-track,
body.light-theme #ir-tx-mode-select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.light-theme #btn-buzzer-stop,
body.light-theme #btn-cam-color-reset,
body.light-theme #btn-toggle-remote-mic,
body.light-theme #btn-simulate-webcam,
body.light-theme #btn-drilldown-back,
body.light-theme #btn-toggle-inversion {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    box-shadow: none !important;
}

body.light-theme #btn-buzzer-stop:hover,
body.light-theme #btn-cam-color-reset:hover,
body.light-theme #btn-toggle-remote-mic:hover,
body.light-theme #btn-drilldown-back:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

body.light-theme #btn-push-to-talk {
    background-color: #ecfdf5 !important;
    border-color: #a7f3d0 !important;
    color: #047857 !important;
    box-shadow: none !important;
}

body.light-theme #btn-siren {
    background-color: #fff1f2 !important;
    border-color: #fecdd3 !important;
    color: #be123c !important;
}

body.light-theme #btn-snapshot {
    background-color: #f0f9ff !important;
    border-color: #bae6fd !important;
    color: #0369a1 !important;
    box-shadow: none !important;
}

/* Collapsible Headers & Analytics Graphs Section */
body.light-theme #graphs-container > button:hover,
body.light-theme #power-ups-container > div:first-child:hover,
body.light-theme #ir-transceiver-container > div:first-child:hover,
body.light-theme #screen-config-container > button:hover,
body.light-theme #buzzer-config-container > button:hover {
    background-color: #f8fafc !important;
}

body.light-theme #graphs-content .inline-flex.bg-\[\#080b12\] {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
}

body.light-theme #btn-graph-online.bg-emerald-500,
body.light-theme #btn-graph-history.bg-emerald-500 {
    color: #ffffff !important;
}

body.light-theme #graphs-content button[onclick*="showMetricInfo"] {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
}

body.light-theme #buzzer-status-msg,
body.light-theme [class*="text-amber-400/"] {
    color: #b45309 !important;
}

/* === ARCHITECTURAL CUTAWAY BUILDING ELEVATION (v21.8) === */
/* Sky / Drafting Backdrop behind Building */
#building-blueprint-canvas {
    padding: 1.25rem 0.75rem 1rem !important;
    border-radius: 18px !important;
}

@media (min-width: 640px) {
    #building-blueprint-canvas {
        padding: 1.5rem 1.5rem 1.25rem !important;
    }
}

/* ---------------- DARK MODE BUILDING PALETTE (Warm Architectural Cutaway House at Night) ---------------- */
body:not(.light-theme) #building-blueprint-canvas {
    background-color: #081121 !important;
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(56, 189, 248, 0.16) 0%, rgba(30, 58, 138, 0.14) 42%, rgba(7, 12, 24, 0.96) 85%),
        linear-gradient(to right, rgba(148, 163, 184, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(148, 163, 184, 0.04) 1px, transparent 1px) !important;
    background-size: 100% 100%, 24px 24px, 24px 24px !important;
    border: 1.5px solid #334155 !important;
}

.eco-bldg-roof-wrap {
    margin: 0 -2px;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}

/* Warm Terracotta / Clay Roof Tiles + Brick Chimney + Lit Attic Skylight in Dark Mode */
body:not(.light-theme) .eco-roof-face { fill: url(#ecoRoofGradDark); }
body:not(.light-theme) .eco-roof-shingles { stroke: rgba(254, 215, 170, 0.22); }
body:not(.light-theme) .eco-roof-ridge { stroke: #f59e0b; }
body:not(.light-theme) .eco-roof-eaves { fill: #64748b; stroke: #94a3b8; stroke-width: 1; }
body:not(.light-theme) .eco-roof-chimney { fill: #9a3412; stroke: #fdba74; stroke-width: 1.6; }
body:not(.light-theme) .eco-roof-cap { fill: #cbd5e1; }
body:not(.light-theme) .eco-roof-dormer { fill: #1e293b; stroke: #cbd5e1; stroke-width: 1.8; }
body:not(.light-theme) .eco-roof-dormer-glass { fill: #fde68a; opacity: 0.88; }

body:not(.light-theme) .eco-bldg-attic-bar {
    background: linear-gradient(180deg, #27364f 0%, #1b283d 100%);
    border-left: 8px solid #64748b;
    border-right: 8px solid #64748b;
    border-top: 1px solid #94a3b8;
    border-bottom: 3px solid #64748b;
    margin: 0 6px;
}
body:not(.light-theme) .eco-bldg-attic-title { color: #f8fafc; }
body:not(.light-theme) .eco-bldg-attic-meta { color: #cbd5e1; }

/* Exterior Load-Bearing Stone/Concrete House Walls */
.eco-bldg-shell {
    margin: 0 6px;
    overflow: hidden;
}
body:not(.light-theme) .eco-bldg-shell {
    border-left: 8px solid #64748b;
    border-right: 8px solid #64748b;
    background-color: #131f33;
    box-shadow:
        0 0 0 1px rgba(148, 163, 184, 0.32),
        0 24px 55px rgba(0, 0, 0, 0.72);
}

/* Concrete Inter-Floor Structural Slab */
.eco-bldg-slab {
    height: 14px;
    width: 100%;
}
body:not(.light-theme) .eco-bldg-slab {
    background-color: #3b4c66;
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(226, 232, 240, 0.2),
        rgba(226, 232, 240, 0.2) 4px,
        transparent 4px,
        transparent 9px
    );
    border-top: 2px solid #94a3b8;
    border-bottom: 2px solid #475569;
}

/* Vertical Stairwell Core Shaft */
body:not(.light-theme) .eco-bldg-stairwell {
    background: linear-gradient(180deg, #1b2a44 0%, #132036 100%);
    border-bottom: 3px solid #475569;
}
@media (min-width: 640px) {
    body:not(.light-theme) .eco-bldg-stairwell {
        border-bottom: none;
        border-left: 5px solid #64748b;
    }
}
body:not(.light-theme) .eco-bldg-level-pill {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(30, 41, 59, 0.95));
    border: 1px solid rgba(56, 189, 248, 0.5);
    color: #e0f2fe;
}
body:not(.light-theme) .eco-bldg-floor-name { color: #e2e8f0; }
body:not(.light-theme) .eco-bldg-stairs-svg { color: #94a3b8; }

/* Cutaway Interior Rooms (Warm Lit Home Interior + Crisp Partition Walls!) */
.eco-bldg-rooms-grid {
    gap: 0 !important;
}
.eco-bldg-room {
    border-radius: 0 !important;
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}
body:not(.light-theme) .eco-bldg-room {
    background: linear-gradient(180deg, #1e2d47 0%, #162338 84%, #24334d 100%) !important;
    border: none !important;
    border-bottom: 4px solid #526580 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -3px 0 rgba(180, 83, 9, 0.28) !important;
}
body:not(.light-theme) .eco-bldg-room:nth-child(2n) {
    background: linear-gradient(180deg, #1b2b44 0%, #142136 84%, #21314a 100%) !important;
}
body:not(.light-theme) .eco-bldg-room:nth-child(3n) {
    background: linear-gradient(180deg, #202c46 0%, #182338 84%, #25334d 100%) !important;
}
@media (min-width: 768px) {
    body:not(.light-theme) .eco-bldg-room {
        border-bottom: none !important;
        border-left: 4px solid #64748b !important;
    }
    body:not(.light-theme) .eco-bldg-room:last-child {
        border-left: none !important;
    }
}

/* Room Alert Glows */
body:not(.light-theme) .eco-bldg-room.eco-bldg-room-warn {
    background: linear-gradient(180deg, rgba(146, 64, 14, 0.42) 0%, #1a1f2e 92%) !important;
    box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.65) !important;
}
body:not(.light-theme) .eco-bldg-room.eco-bldg-room-crit {
    background: linear-gradient(180deg, rgba(157, 23, 77, 0.44) 0%, #1c1224 92%) !important;
    box-shadow: inset 0 0 0 2px rgba(244, 114, 182, 0.75) !important;
}

/* Warm Ceiling Lamp & Light Cone */
body:not(.light-theme) .eco-bldg-lamp-cord { background-color: #94a3b8; }
body:not(.light-theme) .eco-bldg-lamp-shade { background-color: #fbbf24; box-shadow: 0 2px 8px rgba(251, 191, 36, 0.45); }
body:not(.light-theme) .eco-bldg-lamp-glow {
    background: radial-gradient(ellipse at top, rgba(253, 224, 71, 0.26) 0%, rgba(251, 191, 36, 0.06) 55%, transparent 78%);
}

/* Architectural 4-Pane Window on Back Wall of Room */
.eco-bldg-window {
    position: absolute;
    top: 52px;
    left: 14px;
    width: 36px;
    height: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    padding: 2.5px;
    border-radius: 4px 4px 1px 1px;
    opacity: 0.78;
}
body:not(.light-theme) .eco-bldg-window {
    border: 1.5px solid #64748b;
    background-color: #0f172a;
    box-shadow: 0 2px 0 #94a3b8;
}
body:not(.light-theme) .eco-bldg-window > span {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.42) 0%, rgba(30, 58, 138, 0.55) 100%);
}

/* Interior Baseboard & Doorway Trim */
.eco-bldg-doorway {
    position: absolute;
    bottom: 0;
    left: 14px;
    width: 20px;
    height: 26px;
    border-radius: 4px 4px 0 0;
    opacity: 0.72;
}
body:not(.light-theme) .eco-bldg-doorway {
    border: 1.5px solid #94a3b8;
    border-bottom: none;
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
}

body:not(.light-theme) .eco-bldg-room-hdr {
    border-bottom: 1px solid rgba(148, 163, 184, 0.32);
}
body:not(.light-theme) .eco-bldg-room-icon {
    background-color: rgba(15, 23, 42, 0.75);
    border: 1px solid #64748b;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
body:not(.light-theme) .eco-bldg-room-title { color: #f8fafc; }
body:not(.light-theme) .eco-bldg-mini-btn {
    background-color: rgba(15, 23, 42, 0.85);
    border: 1px solid #64748b;
    color: #e2e8f0;
}
body:not(.light-theme) .eco-bldg-mini-btn:hover {
    background-color: #334155;
    color: #ffffff;
}
body:not(.light-theme) .eco-bldg-empty-drop {
    border: 1px dashed #64748b;
    background-color: rgba(15, 23, 42, 0.35);
    color: #94a3b8;
}

/* Ground Stone Foundation Plinth, Porch Entrance & Garden/Street Line */
.eco-bldg-foundation {
    margin: 0;
}
body:not(.light-theme) .eco-bldg-plinth {
    height: 24px;
    margin: 0 2px;
    border-radius: 2px 2px 6px 6px;
    background: linear-gradient(180deg, #64748b 0%, #334155 100%);
    border: 1.5px solid #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
body:not(.light-theme) .eco-bldg-entrance-step {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 1px 14px;
    border-radius: 4px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fde68a;
    border: 1px solid #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.22);
}
body:not(.light-theme) .eco-bldg-ground-line {
    height: 5px;
    margin-top: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, #059669 18%, #10b981 50%, #059669 82%, transparent 100%);
    opacity: 0.75;
}


/* ---------------- LIGHT MODE BUILDING PALETTE (Cohesive Architectural Cutaway) ---------------- */
body.light-theme #building-blueprint-canvas {
    background: linear-gradient(180deg, #e8f0f8 0%, #f1f5f9 65%, #e2e8f0 100%) !important;
    border: 1.5px solid #cbd5e1 !important;
}

body.light-theme #building-blueprint-canvas > .eco-bldg-elevation {
    background: transparent !important;
    border: none !important;
}

body.light-theme .eco-roof-face { fill: #475569; }
body.light-theme .eco-roof-ridge { stroke: #334155; }
body.light-theme .eco-roof-eaves { fill: #334155; }
body.light-theme .eco-roof-chimney { fill: #64748b; stroke: #334155; stroke-width: 1.5; }
body.light-theme .eco-roof-cap { fill: #334155; }
body.light-theme .eco-roof-dormer { fill: #e2e8f0; stroke: #334155; stroke-width: 1.5; }

body.light-theme .eco-bldg-attic-bar {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    border-left: 6px solid #64748b;
    border-right: 6px solid #64748b;
    border-bottom: 3px solid #94a3b8;
    margin: 0 6px;
}
body.light-theme .eco-bldg-attic-title { color: #0f172a !important; }
body.light-theme .eco-bldg-attic-meta { color: #475569 !important; }

body.light-theme .eco-bldg-shell {
    border-left: 6px solid #64748b;
    border-right: 6px solid #64748b;
    background-color: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

/* Concrete Inter-Floor Structural Slab in Light Mode */
body.light-theme .eco-bldg-slab {
    background-color: #cbd5e1;
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(71, 85, 105, 0.18),
        rgba(71, 85, 105, 0.18) 4px,
        transparent 4px,
        transparent 9px
    );
    border-top: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
}

/* Vertical Stairwell Core in Light Mode */
body.light-theme .eco-bldg-stairwell {
    background: linear-gradient(180deg, #eef2f6 0%, #e2e8f0 100%) !important;
    border-bottom: 2px solid #cbd5e1;
}
@media (min-width: 640px) {
    body.light-theme .eco-bldg-stairwell {
        border-bottom: none;
        border-left: 4px solid #94a3b8;
    }
}
body.light-theme .eco-bldg-level-pill {
    background-color: #ffffff;
    border: 1px solid #94a3b8;
    color: #0f172a !important;
}
body.light-theme .eco-bldg-floor-name { color: #334155 !important; }
body.light-theme .eco-bldg-stairs-svg { color: #64748b !important; }

/* Cutaway Interior Rooms in Light Mode */
body.light-theme .eco-bldg-room {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 82%, #f1f5f9 100%) !important;
    border: none !important;
    border-bottom: 3px solid #cbd5e1 !important;
    box-shadow: inset 0 4px 10px rgba(15, 23, 42, 0.025) !important;
}
@media (min-width: 768px) {
    body.light-theme .eco-bldg-room {
        border-bottom: none !important;
        border-left: 4px solid #94a3b8 !important;
    }
    body.light-theme .eco-bldg-room:last-child {
        border-left: none !important;
    }
}

body.light-theme .eco-bldg-room.eco-bldg-room-warn {
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 90%) !important;
    box-shadow: inset 0 0 0 2px #f59e0b !important;
}
body.light-theme .eco-bldg-room.eco-bldg-room-crit {
    background: linear-gradient(180deg, #fdf4ff 0%, #fff1f2 90%) !important;
    box-shadow: inset 0 0 0 2px #e11d48 !important;
}

/* Ceiling Lamp & Window in Light Mode */
body.light-theme .eco-bldg-lamp-cord { background-color: #94a3b8; }
body.light-theme .eco-bldg-lamp-shade { background-color: #64748b; }
body.light-theme .eco-bldg-lamp-glow {
    background: radial-gradient(ellipse at top, rgba(251, 191, 36, 0.16) 0%, transparent 72%);
}

body.light-theme .eco-bldg-window {
    border: 1.5px solid #94a3b8;
    background-color: #ffffff;
    box-shadow: 0 2px 0 #94a3b8;
    opacity: 0.65;
}
body.light-theme .eco-bldg-window > span {
    background: linear-gradient(135deg, #bae6fd 0%, #e0f2fe 100%);
}

body.light-theme .eco-bldg-doorway {
    border: 1.5px solid #94a3b8;
    border-bottom: none;
    background-color: #e2e8f0;
    opacity: 0.65;
}

body.light-theme .eco-bldg-room-hdr {
    border-bottom: 1px solid #e2e8f0;
}
body.light-theme .eco-bldg-room-icon {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
}
body.light-theme .eco-bldg-room-title { color: #0f172a !important; }
body.light-theme .eco-bldg-mini-btn {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
}
body.light-theme .eco-bldg-mini-btn:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}
body.light-theme .eco-bldg-empty-drop {
    border: 1px dashed #cbd5e1;
    color: #64748b;
}

/* Foundation Plinth in Light Mode */
body.light-theme .eco-bldg-plinth {
    height: 20px;
    margin: 0 1px;
    border-radius: 2px 2px 4px 4px;
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
    border: 1.5px solid #475569;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.light-theme .eco-bldg-entrance-step {
    font-size: 9px;
    font-weight: 700;
    padding: 0 10px;
    border-radius: 2px;
    background-color: #f8fafc;
    color: #334155;
    border: 1px solid #64748b;
}
body.light-theme .eco-bldg-ground-line {
    height: 4px;
    margin-top: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, #94a3b8 15%, #64748b 50%, #94a3b8 85%, transparent 100%);
}

/* === UNIVERSAL ALL-PAGES & ALL-MODALS LIGHT THEME (v22.0) === */
/* 1. Soft Frosted Backdrop for All Modals in Light Mode */
body.light-theme div.fixed.inset-0[class*="bg-black"] {
    background-color: rgba(15, 23, 42, 0.45) !important;
}

/* 2. All Modal Dialog Cards & Auth Card Shell */
body.light-theme div.fixed.inset-0 > .glass-panel,
body.light-theme div.fixed.inset-0 > .eco-solid-modal,
body.light-theme #auth-card-panel {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18) !important;
    color: #0f172a !important;
}

/* 3. Universal Dark-Hex & Dark-Slate Container Inversion Across All Modals, Forms, Auth & Admin
      (Excludes live video viewport & architectural roof/plinth elements) */
body.light-theme :not(#camera-timeout-overlay):not(#camera-viewer-locked-overlay):not(#camera-live-badge):not(.eco-bldg-plinth):not(.eco-bldg-entrance-step)[class*="bg-[#0"],
body.light-theme :not(#user-profile-badge):not(#user-session-dropdown):not(#eco-device-actions-popover):not(.eco-solid-modal)[class*="bg-[#111"],
body.light-theme :not(#user-profile-badge):not(#user-session-dropdown):not(#eco-device-actions-popover):not(.eco-solid-modal)[class*="bg-[#151"],
body.light-theme :not(#user-profile-badge):not(#user-session-dropdown):not(#eco-device-actions-popover):not(.eco-solid-modal)[class*="bg-[#192"],
body.light-theme [class*="bg-[#1e293b]"],
body.light-theme [class*="bg-slate-950"],
body.light-theme :not(.eco-bldg-entrance-step)[class*="bg-slate-900"],
body.light-theme :not(.eco-bldg-slab)[class*="bg-slate-800"] {
    background-color: #f4f7fb !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* 4. Crisp White Inputs, Selects & Textareas Everywhere in Light Mode */
body.light-theme input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.light-theme select,
body.light-theme textarea {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03) !important;
}

body.light-theme input:not([type="checkbox"]):not([type="radio"]):not([type="range"])::placeholder,
body.light-theme textarea::placeholder {
    color: #94a3b8 !important;
}

body.light-theme input[type="checkbox"] {
    background-color: #ffffff !important;
    border-color: #94a3b8 !important;
}

/* 5. Interactive Choice Cards, Tabs, Preset Chips & Secondary Buttons in Modals
      (e.g. "עריכת מבנה, קומות וחדרים", "הוספת חדר", "ספי התראה", "התראות וצופר", Auth) */
body.light-theme button[class*="bg-[#0"],
body.light-theme button[class*="bg-[#1"],
body.light-theme button[class*="bg-slate-800"],
body.light-theme button[class*="bg-slate-900"] {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
}

body.light-theme button[class*="bg-[#0"]:hover,
body.light-theme button[class*="bg-[#1"]:hover,
body.light-theme button[class*="bg-slate-800"]:hover,
body.light-theme button[class*="bg-slate-900"]:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* Keep Top Navbar User Menu Button Pure White */
body.light-theme #user-profile-badge {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

/* Selected / Highlighted Choice Cards & Active Modal Tabs in Light Mode */
body.light-theme #building-type-cards button[class*="bg-emerald-500"],
body.light-theme #onboard-type-buttons button[class*="bg-emerald-500"],
body.light-theme #onboard-floors-pills button[class*="bg-emerald-500"],
body.light-theme #builder-modal-unified-bar button[class*="bg-emerald-500"],
body.light-theme #auth-top-mode-tabs button[class*="bg-emerald-500"] {
    background-color: #ecfdf5 !important;
    border: 1.5px solid #10b981 !important;
    color: #065f46 !important;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12) !important;
}

body.light-theme #building-type-cards button[class*="bg-emerald-500"] div,
body.light-theme #onboard-type-buttons button[class*="bg-emerald-500"] div {
    color: #065f46 !important;
}

body.light-theme #builder-modal-unified-bar button[class*="bg-indigo-500"] {
    background-color: #eef2ff !important;
    border: 1.5px solid #6366f1 !important;
    color: #3730a3 !important;
}

body.light-theme #room-modal-size-group button[class*="bg-sky-500"],
body.light-theme button[class*="bg-sky-500/15"],
body.light-theme button[class*="bg-sky-500/20"] {
    background-color: #f0f9ff !important;
    border: 1.5px solid #38bdf8 !important;
    color: #0369a1 !important;
}

body.light-theme button[class*="bg-emerald-500/10"],
body.light-theme button[class*="bg-emerald-500/15"] {
    background-color: #ecfdf5 !important;
    border: 1px solid #6ee7b7 !important;
    color: #047857 !important;
}

body.light-theme button[class*="bg-rose-500/15"],
body.light-theme button[class*="bg-rose-950"] {
    background-color: #fff1f2 !important;
    border: 1px solid #fda4af !important;
    color: #be123c !important;
}

/* Primary Solid Emerald / Sky Save Buttons — High-Contrast Crisp Ink */
body.light-theme button.bg-emerald-500,
body.light-theme button[class*="from-emerald-500"] {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border-color: #059669 !important;
    color: #ffffff !important;
}
body.light-theme button.bg-emerald-500 span,
body.light-theme button[class*="from-emerald-500"] span {
    color: #ffffff !important;
}

body.light-theme button.bg-sky-500 {
    background-color: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
}

/* Stepper Circles & Dividers inside Modals */
body.light-theme .divide-slate-800 > :not([hidden]) ~ :not([hidden]),
body.light-theme .divide-slate-800\/60 > :not([hidden]) ~ :not([hidden]),
body.light-theme .divide-slate-700\/80 > :not([hidden]) ~ :not([hidden]),
body.light-theme .border-white\/5,
body.light-theme .border-white\/10 {
    border-color: #e2e8f0 !important;
}

body.light-theme .text-sky-200 { color: #0369a1 !important; }
body.light-theme .text-emerald-200 { color: #047857 !important; }
body.light-theme .text-indigo-200 { color: #3730a3 !important; }
body.light-theme .text-purple-300 { color: #6d28d9 !important; }

/* 6. Admin Panel (admin.html) Complete Light Mode Support */
body.light-theme aside {
    background-color: #ffffff !important;
    border-color: #dce4ee !important;
}
body.light-theme main > header {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-color: #dce4ee !important;
}
body.light-theme table thead tr,
body.light-theme table th {
    background-color: #f8fafc !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}
body.light-theme table td,
body.light-theme table tr {
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}

/* === V22.1 FINAL POLISH: bg-[#2...] BUTTONS & AUTH LIGHT GATE === */
body.light-theme button[class*="bg-[#2"],
body.light-theme #user-takeover-stream-wrap button {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}
body.light-theme button[class*="bg-[#2"]:hover,
body.light-theme #user-takeover-stream-wrap button:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
}

body.light-theme button.bg-purple-500,
body.light-theme button[class*="bg-purple-600"] {
    background-color: #7c3aed !important;
    color: #ffffff !important;
}

body.light-theme #auth-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
}

body.light-theme #btn-register-google,
body.light-theme #btn-login-google {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
}
body.light-theme #btn-register-google:hover,
body.light-theme #btn-login-google:hover {
    background-color: #f8fafc !important;
    border-color: #94a3b8 !important;
}

body.light-theme #user-session-dropdown .eco-menu-row,
body.light-theme #eco-device-actions-popover .divide-y button {
    background-color: transparent !important;
    border-color: transparent !important;
}
body.light-theme #user-session-dropdown .eco-menu-row:hover,
body.light-theme #eco-device-actions-popover .divide-y button:hover {
    background-color: #f1f5f9 !important;
    border-color: transparent !important;
}

/* === v22.3 3-Tier Live Stream Quality Selector (Dark + Light Mode) === */
.cam-quality-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.65rem;
    border-radius: 0.75rem;
    background: #0b111e;
    border: 1px solid #1e293b;
}

.cam-quality-label {
    font-size: 0.73rem;
    font-weight: 700;
    color: #cbd5e1;
    white-space: nowrap;
}

.cam-quality-seg {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 0.6rem;
    background: #060a12;
    border: 1px solid #1e293b;
}

.cam-quality-btn {
    padding: 0.28rem 0.58rem;
    border-radius: 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.16s ease;
    line-height: 1.15;
    white-space: nowrap;
}

.cam-quality-btn:hover {
    color: #f1f5f9;
    background: rgba(51, 65, 85, 0.45);
}

.cam-quality-btn.active[data-qmode="sd"] {
    background: #0284c7;
    color: #ffffff !important;
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.cam-quality-btn.active[data-qmode="hd"] {
    background: #059669;
    color: #ffffff !important;
    border-color: rgba(52, 211, 153, 0.45);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.cam-quality-btn.active[data-qmode="fhd"] {
    background: #0d9488;
    color: #ffffff !important;
    border-color: rgba(45, 212, 191, 0.45);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.cam-quality-btn.active[data-qmode="ultra"] {
    background: linear-gradient(135deg, #0284c7, #059669);
    color: #ffffff !important;
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
}

.cam-antiflicker-btn {
    padding: 0.28rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    background: #060a12;
    border: 1px solid #1e293b;
    cursor: pointer;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.cam-antiflicker-btn.active {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399 !important;
    border-color: rgba(16, 185, 129, 0.45);
}

.cam-quality-metrics {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.67rem;
    font-weight: 600;
    color: #38bdf8;
    background: #060a12;
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
    padding: 0.25rem 0.55rem;
    white-space: nowrap;
}

body.light-theme .cam-quality-bar {
    background: #f4f7fb !important;
    border-color: #cbd5e1 !important;
}

body.light-theme .cam-quality-label {
    color: #1e293b !important;
}

body.light-theme .cam-quality-seg {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
}

body.light-theme .cam-quality-btn {
    color: #475569 !important;
}

body.light-theme .cam-quality-btn:hover {
    color: #0f172a !important;
    background: rgba(255, 255, 255, 0.7);
}

body.light-theme .cam-quality-btn.active[data-qmode="sd"] {
    background: #0284c7 !important;
    color: #ffffff !important;
}

body.light-theme .cam-quality-btn.active[data-qmode="hd"] {
    background: #059669 !important;
    color: #ffffff !important;
}

body.light-theme .cam-quality-btn.active[data-qmode="fhd"] {
    background: #0d9488 !important;
    color: #ffffff !important;
}

body.light-theme .cam-quality-btn.active[data-qmode="ultra"] {
    background: linear-gradient(135deg, #0284c7, #059669) !important;
    color: #ffffff !important;
}

body.light-theme .cam-antiflicker-btn {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
}

body.light-theme .cam-antiflicker-btn.active {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    color: #047857 !important;
}

body.light-theme .cam-quality-metrics {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0369a1 !important;
}

/* === v23.0 PER-DEVICE SIGNATURE COLOR SEPARATION (CARDS VIEW + BUILDING SKETCH CHIPS) === */
body.light-theme .eco-roof-shingles { stroke: rgba(255, 255, 255, 0.22); }
body.light-theme .eco-roof-dormer-glass { fill: #bae6fd; opacity: 0.9; }

body:not(.light-theme) #device-list-container > div.eco-dev-themed-card {
    background: var(--dev-card-bg) !important;
    border: 1.5px solid var(--dev-card-border) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

body:not(.light-theme) #device-list-container > div.eco-dev-themed-card:hover {
    background: var(--dev-card-bg-hover) !important;
    border-color: var(--dev-accent) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48), 0 0 20px var(--dev-glow) !important;
}

body:not(.light-theme) #device-list-container > div.eco-dev-themed-card.eco-dev-selected {
    border-width: 2px !important;
    border-color: var(--dev-accent) !important;
    box-shadow: 0 0 0 2px var(--dev-glow), 0 14px 34px rgba(0, 0, 0, 0.5) !important;
}

body.light-theme #device-list-container > div.eco-dev-themed-card {
    background: var(--dev-card-bg-light) !important;
    border: 1.5px solid var(--dev-card-border-light) !important;
}

body.light-theme #device-list-container > div.eco-dev-themed-card:hover,
body.light-theme #device-list-container > div.eco-dev-themed-card.eco-dev-selected {
    border-color: var(--dev-accent) !important;
}

.eco-dev-accent-stripe {
    position: absolute;
    top: 10px;
    bottom: 10px;
    right: 0;
    width: 4.5px;
    border-radius: 6px 0 0 6px;
    background: var(--dev-accent);
    box-shadow: 0 0 10px var(--dev-glow);
    pointer-events: none;
}

body:not(.light-theme) .eco-dev-type-pill {
    background: var(--dev-pill-bg);
    color: var(--dev-pill-text);
    border: 1px solid var(--dev-card-border);
}

body.light-theme .eco-dev-type-pill {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid var(--dev-card-border-light) !important;
}

/* Color-Separated Device Chips inside Building Sketch Rooms */
body:not(.light-theme) .eco-unit-chip.eco-unit-chip-themed {
    background: var(--dev-chip-bg) !important;
    border: 1.5px solid var(--dev-card-border) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.32) !important;
}

body:not(.light-theme) .eco-unit-chip.eco-unit-chip-themed:hover {
    border-color: var(--dev-accent) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42), 0 0 14px var(--dev-glow) !important;
}

body:not(.light-theme) .eco-unit-chip.eco-unit-chip-themed .eco-chip-icon-box {
    background: var(--dev-pill-bg) !important;
    border: 1px solid var(--dev-card-border) !important;
}

body.light-theme .eco-unit-chip.eco-unit-chip-themed {
    border: 1.5px solid var(--dev-card-border-light) !important;
}

