:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(22, 30, 49, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --pipe-cold: #5858ff;
    --pipe-hot: #ffb4b4;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

html, body {
    overflow: hidden;
    height: 100dvh;
    height: 100vh;
    touch-action: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.glass-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.15) 0%, transparent 40%);
    z-index: -1;
}

.app-container {
    width: 100%;
    max-width: 1600px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    isolation: isolate;
    will-change: transform;
    transform: translateZ(0);
    z-index: 1000;
}

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

.logo-icon {
    font-size: 24px;
    animation: rotate-fan 4s linear infinite;
    display: inline-block;
}

.logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(to right, #3b82f6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title-separator {
    color: var(--text-secondary);
    font-weight: 300;
    opacity: 0.5;
    margin: 0 4px;
}

.current-page-title {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-cyan);
    letter-spacing: 0.5px;
    border-radius: 8px;
    background: rgba(6, 182, 212, 0.1);
    padding: 2px 10px;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge {
    font-size: 11px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.header-status {
    display: flex;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
}

.status-indicator.online .dot {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.status-indicator.offline .dot {
    background-color: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.fault-indicator.active {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.fault-indicator.active .dot {
    background-color: var(--accent-red);
    animation: pulse-red 1s infinite alternate;
}

/* Layout */
.scada-canvas-main {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 28, 0.85);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    contain: layout paint;
    isolation: isolate;
    min-height: 0;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: grab;
    user-select: none;
    overflow: hidden;
    touch-action: none;
    contain: layout paint;
    isolation: isolate;
}

.canvas-wrapper:active {
    cursor: grabbing;
}

.canvas-wrapper svg {
    width: 100%;
    height: 100%;
    display: block;
}

.canvas-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--card-border);
    padding: 10px;
    border-radius: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.canvas-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.canvas-control-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-blue);
    transform: scale(1.08);
}

.canvas-control-btn:active {
    transform: scale(0.92);
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
}

.card-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.card-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

/* Plan View SVG */
.plan-container, .schematic-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
}

#svg-plan-wrapper, #svg-schematic-wrapper {
    width: 100%;
    height: 100%;
    max-height: 480px;
    display: flex;
    justify-content: center;
    align-items: center;
}

svg {
    width: 100%;
    height: auto;
    max-height: 100%;
}

/* Interactive SVG Classes */
.room-polygon {
    fill: rgba(30, 41, 59, 0.4);
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5;
    transition: all 0.3s ease;
}

.room-polygon:hover {
    fill: rgba(30, 41, 59, 0.7);
    stroke: rgba(255, 255, 255, 0.4);
}

.active-zone {
    stroke: var(--accent-blue);
    stroke-width: 2.5;
    fill: rgba(59, 130, 246, 0.08);
}

.active-zone:hover {
    fill: rgba(59, 130, 246, 0.15);
}

.active-zone.cooling-active {
    fill: rgba(6, 182, 212, 0.15);
    stroke: var(--accent-cyan);
}

/* Fan animation handled by CSS */
.spinning-fan {
    transform-origin: center;
    transform-box: fill-box;
    animation: rotate-fan 4s linear infinite;
}

.spinning-fan.speed-0 {
    animation: none;
}

.spinning-fan.speed-1 {
    animation-duration: 3s;
}

.spinning-fan.speed-2 {
    animation-duration: 1.5s;
}

.spinning-fan.speed-3 {
    animation-duration: 0.6s;
}

/* Console details */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
}

/* Fan speed bar */
.fan-speed-indicator-container h3, .underfloor-monitoring h3, .user-settings h3, .panel-header h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fan-speed-bar {
    display: flex;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.speed-step {
    flex: 1;
    padding: 6px 0;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    border-right: 1px solid var(--card-border);
    transition: all 0.3s;
}

.speed-step:last-child {
    border-right: none;
}

.speed-step.active-speed-0 {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.speed-step.active-speed-1 {
    background: rgba(6, 182, 212, 0.25);
    color: #22d3ee;
}

.speed-step.active-speed-2 {
    background: rgba(6, 182, 212, 0.45);
    color: #67e8f9;
}

.speed-step.active-speed-3 {
    background: rgba(6, 182, 212, 0.7);
    color: #cffafe;
    box-shadow: inset 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Underfloor details */
.floor-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.12);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.floor-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.floor-row span:first-child {
    color: var(--text-secondary);
}

.badge-status {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
}

.badge-status.active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Switches & Inputs */
.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: 1px solid var(--card-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent-blue);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.range-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 60%;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Sim controls */
.sim-controls-panel {
    background: rgba(251, 146, 60, 0.03);
    border: 1px dashed rgba(251, 146, 60, 0.2);
    border-radius: 10px;
    padding: 8px;
    margin-top: 4px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(251, 146, 60, 0.1);
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.panel-header h3 {
    color: var(--accent-orange);
    margin-bottom: 0;
}

.panel-body {
    display: none;
}

.panel-body.active {
    display: block;
}

.fault-injection h4 {
    font-size: 10px;
    color: var(--text-secondary);
    margin: 8px 0 4px 0;
    text-transform: uppercase;
}

.fault-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 4px;
}

.fault-row label {
    color: #fca5a5;
}

/* Dividers */
.section-divider {
    height: 1px;
    background: var(--card-border);
    margin: 4px 0;
}

/* Animations */
@keyframes rotate-fan {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse-red {
    from { box-shadow: 0 0 2px var(--accent-red); }
    to { box-shadow: 0 0 10px var(--accent-red); }
}

/* Responsive grid */
@media (max-width: 900px) {
    .fancoil-card-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    .fancoil-controls {
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }
    .fancoil-schematic-container {
        height: 350px;
    }
}

/* Water Flow Animation Styles */
.flow-arrow {
    opacity: var(--flow-opacity, 1);
    pointer-events: none; /* Make sure arrows don't interfere with mouse interactions */
}

.flow-arrow path {
    transform: scale(var(--flow-scale, 1));
    transform-origin: center;
    transform-box: fill-box;
}

.supply-arrow {
    --flow-speed: 3s;
    --flow-opacity: 1;
    --flow-scale: 1;
}

.bypass-arrow {
    --flow-speed: var(--bypass-flow-speed, 2s);
    --flow-opacity: var(--bypass-flow-opacity, 1);
    --flow-scale: var(--bypass-flow-scale, 1);
}

.coil-in-arrow {
    --flow-speed: var(--coil-flow-speed, 2s);
    --flow-opacity: var(--coil-flow-opacity, 1);
    --flow-scale: var(--coil-flow-scale, 1);
}

.coil-out-arrow {
    --flow-speed: var(--coil-flow-speed, 2s);
    --flow-opacity: var(--coil-flow-opacity, 1);
    --flow-scale: var(--coil-flow-scale, 1);
}

.return-arrow {
    --flow-speed: 2.5s;
    --flow-opacity: 1;
    --flow-scale: 1;
}

.fc2-supply-arrow {
    --flow-speed: 0.8s;
    --flow-opacity: 1;
    --flow-scale: 0.85;
}

.fc2-bypass-arrow {
    --flow-speed: var(--bypass-flow-speed, 2s);
    --flow-opacity: var(--bypass-flow-opacity, 1);
    --flow-scale: var(--bypass-flow-scale, 0.85);
}

.fc2-coil-arrow {
    --flow-speed: var(--coil-flow-speed, 2s);
    --flow-opacity: var(--coil-flow-opacity, 1);
    --flow-scale: var(--coil-flow-scale, 0.85);
}

.fc2-return-arrow {
    --flow-speed: 1.0s;
    --flow-opacity: 1;
    --flow-scale: 0.85;
}

.flow-arrow.reverse {
    animation-name: move-arrow-reverse;
}

/* Disclaimer Info Footer */
.info-disclaimer {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: var(--glass-shadow);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent-blue);
}

.info-disclaimer .info-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.info-disclaimer .info-text {
    flex: 1;
}

.info-disclaimer strong {
    color: var(--text-primary);
}

/* Modals styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 10, 19, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-card {
    background: rgba(22, 30, 49, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    width: 90%;
    max-width: 440px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-cyan));
}
.modal-card.sim-card::before {
    background: linear-gradient(to right, var(--accent-orange), var(--accent-red));
}
.modal-card.hammam-setpoint-card::before {
    background: linear-gradient(to right, var(--accent-orange), var(--accent-cyan));
}
.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}
.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.modal-card.sim-card .modal-header h2 {
    background: linear-gradient(to right, var(--accent-orange), #fca5a5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.close-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}
.modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
}
.modal-val-badge {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    min-width: 65px;
    text-align: center;
}
.modal-card.sim-card .modal-val-badge {
    background: rgba(251, 146, 60, 0.15);
    border: 1px solid rgba(251, 146, 60, 0.3);
    color: #fdba74;
}
.modal-number-input {
    width: 110px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 700;
    text-align: center;
    outline: none;
}
.modal-number-input:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}
.modal-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.15);
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.modal-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}
.modal-stat-box .label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.modal-stat-box .value {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
}
.modal-sub-section {
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal-sub-section.active {
    opacity: 1;
    pointer-events: auto;
}
.fault-injection-section {
    margin-top: 8px;
    border-top: 1px dashed rgba(251, 146, 60, 0.2);
    padding-top: 14px;
}
.fault-injection-section h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-orange);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.fault-switch-row {
    font-size: 13px;
    color: #fca5a5;
    margin-bottom: 10px;
}
.switch.mini {
    width: 36px;
    height: 20px;
}
.switch.mini .slider:before {
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
}
.switch.mini input:checked + .slider:before {
    transform: translateX(16px);
}

/* Main pipelines & Branch animations */
.main-supply-arrow {
    --flow-speed: 40s;
    --flow-opacity: 1;
    --flow-scale: 1;
}

.main-return-arrow {
    --flow-speed: 40s;
    --flow-opacity: 1;
    --flow-scale: 1;
}

.branch-supply-arrow {
    --flow-speed: 3s;
    --flow-opacity: var(--coil-flow-opacity, 0);
    --flow-scale: var(--coil-flow-scale, 0.9);
}
.branch-return-arrow {
    offset-path: var(--branch-path);
    --flow-speed: 3s;
    --flow-opacity: var(--coil-flow-opacity, 0);
    --flow-scale: var(--coil-flow-scale, 0.9);
}

.main-pump-blade {
    transform-origin: center;
    transform-box: fill-box;
    animation: rotate-fan 2s linear infinite;
}
.main-pump-blade.stopped {
    animation: none;
}

.clickable-thermostat {
    cursor: pointer;
    transition: filter 0.2s ease;
}
.clickable-thermostat:hover {
    filter: brightness(1.2);
}

.sim-btn-g {
    cursor: pointer;
    transition: filter 0.2s ease;
}
.sim-btn-g:hover {
    filter: brightness(1.2);
}
.sim-btn-rect {
    fill: #27272a;
    stroke: #3f3f46;
    stroke-width: 1;
    rx: 4px;
    transition: all 0.2s;
}
.sim-btn-g:hover .sim-btn-rect {
    fill: rgba(251, 146, 60, 0.15);
    stroke: var(--accent-orange);
}
.sim-btn-text {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    fill: var(--text-secondary);
    font-weight: 500;
    transition: fill 0.2s;
}
.sim-btn-g:hover .sim-btn-text {
    fill: #ffffff;
}

.sim-btn-g text {
    fill: var(--text-secondary);
    transition: fill 0.2s ease, transform 0.2s ease;
}
.sim-btn-g:hover text {
    fill: var(--accent-orange);
}

/* Custom interactive styles for pump & valves */
.interactive-pump, .interactive-valve {
    cursor: pointer;
    transition: filter 0.2s ease;
}
.interactive-pump:hover, .interactive-valve:hover {
    filter: brightness(1.3) drop-shadow(0 0 5px var(--accent-blue));
}
.interactive-pump .pump-body {
    transition: stroke 0.3s, fill 0.3s;
}
.interactive-pump.on .pump-body {
    stroke: var(--accent-green) !important;
}
.interactive-pump.on .main-pump-blade path {
    fill: var(--accent-green) !important;
}
.interactive-valve .valve-wing-left,
.interactive-valve .valve-wing-right,
.interactive-valve .valve-actuator {
    transition: fill 0.3s;
}
.interactive-valve.open .valve-wing-left,
.interactive-valve.open .valve-wing-right {
    fill: var(--accent-green) !important;
}
.interactive-valve.open .valve-actuator {
    fill: var(--accent-green) !important;
}

/* ALO valves (SKLO, KP, external valves) - RED when closed/off, GREEN when open/on */
.alo-valve .valve-wing,
.alo-valve .valve-center-line {
    transition: stroke 0.3s;
    stroke: var(--accent-red) !important;
}
.alo-valve .valve-circle {
    transition: fill 0.3s;
    fill: var(--accent-red) !important;
}

.alo-valve.open .valve-wing,
.alo-valve.open .valve-center-line {
    stroke: var(--accent-green) !important;
}
.alo-valve.open .valve-circle {
    fill: var(--accent-green) !important;
}

/* QD4 off: mixing unit valves lose power and turn dark-gray */
.alo-valve.no-power .valve-wing,
.alo-valve.no-power .valve-center-line {
    stroke: #4b5563 !important;
}
.alo-valve.no-power .valve-circle {
    fill: #4b5563 !important;
}

.no-power-text {
    fill: #4b5563 !important;
    animation: none !important;
}


/* Pausing and hiding flow animations when the pump is OFF */
.pump-off .flow-arrow {
    display: none !important;
    animation-play-state: paused !important;
}
.pump-off .main-pump-blade {
    animation-play-state: paused !important;
}

/* --- Навигационное меню (Hamburger) и страницы --- */

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.info-toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 18px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    user-select: none;
}

.info-toggle-btn:hover {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
}

.menu-toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.menu-toggle-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.menu-toggle-btn .bar {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.2s ease;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100%;
    background: rgba(11, 15, 25, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--card-border);
    z-index: 1200;
    transform: translate3d(-320px, 0, 0);
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6);
}

.sidebar.open {
    transform: translate3d(0, 0, 0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
}

.sidebar-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(to right, #3b82f6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.sidebar-close:hover {
    color: var(--text-primary);
}

.sidebar-menu {
    padding: 20px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.25);
    box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.1);
}

.sidebar-item-icon {
    font-size: 18px;
}

/* Page system states */
.scada-page {
    display: none;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.scada-page.active {
    display: flex;
}

/* ALO page styling */
.alo-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    height: calc(100vh - 160px);
}

.alo-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
}

.alo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.alo-icon {
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: pulse-alo 3s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-snowflake-icon {
    display: inline-block;
    vertical-align: middle;
    transition: transform 0.3s;
}

.sun-snowflake-icon.menu-icon {
    width: 20px;
    height: 20px;
}

.sun-snowflake-icon.page-icon {
    width: 68px;
    height: 68px;
}

.sun-snowflake-icon .sun-part {
    stroke: #fb923c;
    fill: #fb923c;
}

.sun-snowflake-icon .snowflake-part {
    stroke: #38bdf8;
}

.alo-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(to right, #3b82f6, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

@keyframes pulse-alo {
    0% { 
        transform: scale(1) rotate(0deg); 
        filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.4)) drop-shadow(0 0 4px rgba(59, 130, 246, 0.4)); 
    }
    100% { 
        transform: scale(1.08) rotate(15deg); 
        filter: drop-shadow(0 0 20px rgba(251, 146, 60, 0.8)) drop-shadow(0 0 20px rgba(6, 182, 212, 0.8)); 
    }
}

/* --- Стили для интерактивной мнемосхемы АЛО --- */

/* Вращение трехходовых заслонок АЛО */
.three-way-valve-line,
.three-way-valve-dynamic-line {
    transform-origin: 804px 754.58626px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Интерактивные сенсоры и датчики АЛО (только те, которыми можно управлять) */
.alo-interactive {
    cursor: pointer !important;
    pointer-events: all !important;
}

/* Эффект наведения для интерактивного текста */
text.alo-interactive {
    transition: fill 0.2s ease, font-weight 0.2s ease;
}
text.alo-interactive:hover {
    fill: var(--accent-blue) !important;
    font-weight: 700;
}

/* Эффект наведения для интерактивных групп и путей (насосы, клапаны) */
g.alo-interactive,
path.alo-interactive {
    transition: filter 0.3s ease, stroke 0.3s ease;
}
g.alo-interactive:hover,
path.alo-interactive:hover {
    filter: drop-shadow(0 0 5px var(--accent-blue));
}

/* Все остальные текстовые датчики АЛО - неинтерактивные */
.scada-canvas-main text[id^="us-"][id*="-dt-"],
.scada-canvas-main text[id^="us-"][id*="-dd-"],
.scada-canvas-main text[id^="us-"][id*="-pr-"],
.scada-canvas-main text[id^="dpl-"],
.scada-canvas-main text[id*="_temp"],
.scada-canvas-main text[id*="_pressure"],
.scada-canvas-main text[id*="_chiller"] {
    cursor: default !important;
    pointer-events: none;
}

/* Интерактивные иконки насосов АЛО */
.pump-icon {
    cursor: pointer;
    transition: stroke 0.3s ease, fill 0.3s ease, transform 0.3s ease;
}

.pump-icon:hover {
    filter: drop-shadow(0 0 4px var(--accent-blue));
}

.pump-icon.on {
    animation: pulse-pump-green 2s infinite alternate;
}

.pump-icon.no-power {
    stroke: #4b5563 !important;
    animation: none !important;
}

@keyframes pulse-pump-green {
    0% {
        filter: drop-shadow(0 0 2px rgba(34, 197, 94, 0.5));
    }
    100% {
        filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.8));
    }
}

/* Color overrides for ALO schema on dark theme */
#scada-canvas-alo use {
    fill: #ffffff !important;
    stroke: none !important;
}

#scada-canvas-alo path[stroke="#000000"],
#scada-canvas-alo path[stroke="black"],
#scada-canvas-alo rect[stroke="#000000"],
#scada-canvas-alo rect[stroke="black"],
#scada-canvas-alo circle[stroke="#000000"],
#scada-canvas-alo circle[stroke="black"],
#scada-canvas-alo polygon[stroke="#000000"],
#scada-canvas-alo polygon[stroke="black"] {
    stroke: #ffffff !important;
}

#scada-canvas-alo path[fill="#000000"],
#scada-canvas-alo path[fill="black"],
#scada-canvas-alo rect[fill="#000000"],
#scada-canvas-alo rect[fill="black"],
#scada-canvas-alo circle[fill="#000000"],
#scada-canvas-alo circle[fill="black"],
#scada-canvas-alo polygon[fill="#000000"],
#scada-canvas-alo polygon[fill="black"] {
    fill: #ffffff !important;
}

#scada-canvas-alo path:not([fill]),
#scada-canvas-alo polygon:not([fill]),
#scada-canvas-alo rect:not([fill]),
#scada-canvas-alo circle:not([fill]) {
    fill: #ffffff !important;
}

/* ALO pump blades styles */
.alo-pump-blade, .pump-blades {
    transform-origin: 0px 0px;
    animation: rotate-fan 2s linear infinite;
    animation-play-state: paused;
    pointer-events: none;
}
.alo-pump-blade.spinning, .pump-blades.spinning {
    animation-play-state: running;
}
.alo-pump-blade path, .pump-blades path {
    fill: none !important;
    stroke: #64748b !important;
    transition: stroke 0.3s ease;
}
.alo-pump-blade circle, .pump-blades circle {
    fill: #e2e8f0 !important;
}

/* Green fill styling when pump is active (ON) */
.pump-korpus, .pump-vvod {
    transition: fill 0.3s ease, stroke 0.3s ease;
}
.alo-pump.on .pump-korpus,
.alo-pump.on .pump-vvod {
    fill: var(--accent-green) !important;
    stroke: #ffffff !important;
}

/* QD3 off: mixing unit pumps casing, inlet, and blades turn dark-gray */
.alo-pump.no-power .pump-korpus,
.alo-pump.no-power .pump-vvod {
    stroke: #4b5563 !important;
    fill: #4b5563 !important;
}
.alo-pump.no-power .alo-pump-blade path,
.alo-pump.no-power .pump-blades path {
    stroke: #4b5563 !important;
}
.alo-pump.no-power .alo-pump-blade circle,
.alo-pump.no-power .pump-blades circle {
    fill: #4b5563 !important;
}


/* ALO simulation toggle button styling */
.simulation-toggle-btn-alo,
.simulation-toggle-btn-fancoils2,
.simulation-toggle-btn-convectors,
.simulation-toggle-btn-underfloor {
    transition: all 0.3s ease;
}
.simulation-toggle-btn-alo.active,
.simulation-toggle-btn-fancoils2.active,
.simulation-toggle-btn-convectors.active,
.simulation-toggle-btn-underfloor.active {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: #10b981 !important;
    color: #10b981 !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

/* ALO valve line rotation transition */
path[id$="-line"],
path[id$="-valve-line"] {
    transition: transform 0.4s ease;
}

/* ALO Flow Animations */
.alo-flow-arrow-group {
    /* Hide and pause by default */
    display: none !important;
    animation-play-state: paused !important;
    --flow-opacity: 0;
}
.alo-flow-arrow-group.active {
    display: inline !important;
    animation-play-state: running !important;
    --flow-opacity: 0.85;
}

.alo-flow-hsn-riser-podacha {
    --flow-speed: 6s;
    --flow-scale: 1.0;
}
.alo-flow-hsn-riser-obratka {
    --flow-speed: 6s;
    --flow-scale: 1.0;
}
.alo-flow-hsn-top-podacha {
    --flow-speed: 4s;
    --flow-scale: 1.0;
}
.alo-flow-hsn-top-obratka {
    --flow-speed: 4s;
    --flow-scale: 1.0;
}
.alo-flow-hsn-bypass-150 {
    --flow-speed: 2s;
    --flow-scale: 1.0;
}
.alo-flow-hsn-bypass-142 {
    --flow-speed: 2s;
    --flow-scale: 1.0;
}
.alo-flow-line-142-hsn-to {
    --flow-speed: 2s;
    --flow-scale: 1.0;
}
.alo-flow-line-hsn-to-142 {
    --flow-speed: 2s;
    --flow-scale: 1.0;
}
.alo-flow-line-150-to-chiller {
    --flow-speed: 2s;
    --flow-scale: 1.0;
}
.alo-flow-line-to-chiller-150 {
    --flow-speed: 2s;
    --flow-scale: 1.0;
}
.alo-flow-line-142-150 {
    --flow-speed: 5s;
    --flow-scale: 1.0;
}
.alo-flow-line-podacha-chiller-to {
    --flow-speed: 4s;
    --flow-scale: 1.0;
}
.alo-flow-line-obratka-chiller-to {
    --flow-speed: 4s;
    --flow-scale: 1.0;
}
.alo-flow-line-podacha-bak-chiller {
    --flow-speed: 2s;
    --flow-scale: 1.0;
}


/* Mixing Unit Branches */
.alo-flow-hsn-branch-podacha-us1 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-hsn-branch-obratka-us1 { --flow-speed: 2s; --flow-scale: 0.9; }

.alo-flow-hsn-branch-podacha-us2 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-hsn-branch-obratka-us2 { --flow-speed: 2s; --flow-scale: 0.9; }

.alo-flow-hsn-branch-podacha-us3 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-hsn-branch-obratka-us3 { --flow-speed: 2s; --flow-scale: 0.9; }

.alo-flow-hsn-branch-podacha-us4 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-hsn-branch-obratka-us4 { --flow-speed: 2s; --flow-scale: 0.9; }

/* TSN Flow Animations */
.alo-flow-tsn-riser-podacha {
    --flow-speed: 6s;
    --flow-scale: 1.0;
}
.alo-flow-tsn-riser-obratka {
    --flow-speed: 6s;
    --flow-scale: 1.0;
}
.alo-flow-tsn-top-podacha {
    --flow-speed: 4s;
    --flow-scale: 1.0;
}
.alo-flow-tsn-top-obratka {
    --flow-speed: 4s;
    --flow-scale: 1.0;
}
/* TSN Mixing Unit Branches */
.alo-flow-tsn-branch-podacha-us1 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-tsn-branch-obratka-us1 { --flow-speed: 2s; --flow-scale: 0.9; }

.alo-flow-tsn-branch-podacha-us2 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-tsn-branch-obratka-us2 { --flow-speed: 2s; --flow-scale: 0.9; }

.alo-flow-tsn-branch-podacha-us3 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-tsn-branch-obratka-us3 { --flow-speed: 2s; --flow-scale: 0.9; }

.alo-flow-tsn-branch-podacha-us4 { --flow-speed: 1.5s; --flow-scale: 0.9; }
.alo-flow-tsn-branch-obratka-us4 { --flow-speed: 2s; --flow-scale: 0.9; }

/* Danger animations for Pump 8 and TSN mixing unit valves */
.pump-icon.danger-flash {
    stroke: #ef4444 !important;
    animation: pulse-pump-red 0.5s infinite alternate !important;
}

@keyframes pulse-pump-red {
    0% {
        filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.5));
        fill: rgba(239, 68, 68, 0.2) !important;
    }
    100% {
        filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.9));
        fill: rgba(239, 68, 68, 0.6) !important;
    }
}

.danger-text-flash {
    animation: pulse-text-red 0.5s infinite alternate !important;
}

@keyframes pulse-text-red {
    0% {
        fill: #ffffff !important;
    }
    100% {
        fill: #ef4444 !important;
        font-weight: bold;
    }
}

.alo-valve.danger-flash .valve-wing,
.alo-valve.danger-flash .valve-center-line {
    animation: stroke-pulse-red 0.5s infinite alternate !important;
}
.alo-valve.danger-flash .valve-circle {
    animation: fill-pulse-red 0.5s infinite alternate !important;
}

@keyframes stroke-pulse-red {
    0% {
        stroke: var(--accent-red) !important;
    }
    100% {
        stroke: #ff5555 !important;
        filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.8));
    }
}
@keyframes fill-pulse-red {
    0% {
        fill: var(--accent-red) !important;
    }
    100% {
        fill: #ff5555 !important;
        filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.8));
    }
}

.alo-valve.dew-warning-flash .valve-wing,
.alo-valve.dew-warning-flash .valve-center-line,
.alo-valve.dew-warning-flash .valve-circle {
    animation: opacity-pulse-dew 1s infinite alternate ease-in-out !important;
}

@keyframes opacity-pulse-dew {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0.15;
    }
}



/* Sonar concentric radar rings for danger indication */
.sonar-waves {
    pointer-events: none;
}

.sonar-ring {
    stroke: #ef4444;
    transform-origin: center;
    opacity: 0;
    filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.85));
    animation: sonar-ripple 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes sonar-ripple {
    0% {
        r: 2px;
        opacity: 0.9;
        stroke-width: 3;
    }
    50% {
        opacity: 0.6;
        stroke-width: 2;
    }
    100% {
        r: 30px;
        opacity: 0;
        stroke-width: 0.5;
    }
}

/* Circuit Breakers (AVT) Styling */
.avt-value {
    transition: fill 0.3s ease;
}
.avt-value.val-on {
    fill: var(--accent-green) !important;
}
.avt-value.val-off {
    fill: var(--accent-red) !important;
}
.avt-value.val-na {
    fill: #9ca3af !important; /* Neutral gray for NA */
}
.avt-lever {
    transition: transform 0.4s ease;
}
.avt-lever.lever-on {
    transform: translateX(-22px);
}
.avt-lever.lever-off {
    transform: translateX(0);
}
.avt-lever.lever-na {
    transform: translateX(-11px); /* Midpoint position */
}

/* QF2 off: mixing unit three-way valves sub-elements lose power and turn dark-gray */
.alo-three-way-valve.no-power .three-way-valve-circle,
.alo-three-way-valve.no-power .three-way-valve-static-line,
.alo-three-way-valve.no-power .three-way-valve-dynamic-line {
    stroke: #4b5563 !important;
}
.alo-three-way-valve.no-power .three-way-valve-value {
    fill: #4b5563 !important;
}

/* QF2 off: mixing unit sensors circle, leg, and type text (PE, TE, PT) turn dark-gray */
.alo-sensor.no-power .sensor-circle,
.alo-sensor.no-power .sensor-leg {
    stroke: #4b5563 !important;
}
.alo-sensor.no-power .sensor-type-text {
    fill: #4b5563 !important;
}

/* QF2 off: DPL leakage sensors icon turns dark-gray */
.alo-dpl.no-power .dpl-leak-icon {
    fill: #4b5563 !important;
}

/* DPL leakage active: icon pulses red */
.dpl-leak-icon.danger-flash {
    animation: pulse-pump-red 0.5s infinite alternate !important;
}

.status-indicator.alo-interactive {
    cursor: pointer;
    transition: background 0.2s ease;
}

/* Red stroke color for sensors with error */
.sensor-circle.has-error {
    stroke: #ef4444 !important;
}

/* Sensor value text in alarm state */
.scada-canvas-main text.has-error {
    fill: #ef4444 !important;
    font-weight: 700;
}
.status-indicator.alo-interactive:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Gear button styling */
.canvas-gear-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 101;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.canvas-gear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    border-color: rgba(255, 255, 255, 0.2);
}

.canvas-gear-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    transform: rotate(90deg);
}

/* Controls panel transition */
.canvas-controls.alo-controls-panel,
.canvas-controls.fancoils2-controls-panel,
.canvas-controls.convectors-controls-panel,
.canvas-controls.underfloor-controls-panel,
.canvas-controls.water-controls-panel {
    bottom: 76px; /* Positioned right above the gear button */
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.canvas-controls.alo-controls-panel.visible,
.canvas-controls.fancoils2-controls-panel.visible,
.canvas-controls.convectors-controls-panel.visible,
.canvas-controls.underfloor-controls-panel.visible,
.canvas-controls.water-controls-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#scada-canvas-underfloor svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Make status indicators interactive */
.status-indicator {
    cursor: pointer;
    transition: all 0.2s ease;
}
.status-indicator:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    /* Container padding override for mobile to maximize space */
    .app-container {
        padding: 8px;
        gap: 12px;
        height: 100dvh;
        height: 100vh;
    }

    /* Header optimization for mobile screens */
    header {
        padding: 8px 12px;
        gap: 8px;
        border-radius: 12px;
    }
    
    .logo {
        gap: 6px;
    }
    
    .logo-icon {
        display: none !important;
    }
    
    .logo h1 {
        font-size: 15px;
        letter-spacing: 0.5px;
    }
    
    .current-page-title {
        font-size: 11px;
        padding: 1px 6px;
    }

    .page-title-separator {
        margin: 0 2px;
    }
    
    .logo .badge {
        display: none !important;
    }
    
    .header-left {
        gap: 8px;
    }
    
    .header-status {
        gap: 6px;
    }
    
    .status-indicator {
        padding: 0;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--card-border);
    }
    
    .status-indicator:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .status-indicator .text {
        display: none;
    }
    
    .status-indicator .dot {
        margin: 0;
        width: 10px;
        height: 10px;
    }
    
    /* Reposition gear button and control panels on mobile screens */
    .canvas-gear-btn {
        bottom: 35px;
        right: 15px;
    }
    
    .canvas-controls {
        bottom: 91px !important;
        right: 15px !important;
    }
}

/* ==========================================================================
   Hammam Page Styles
   ========================================================================== */
.hammam-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 20px;
    height: 100%;
    min-height: 0;
    width: 100%;
}

.hammam-visual-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.hammam-visual-card .visual-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    padding: 16px;
    overflow: hidden;
}

.hammam-control-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.card-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 12px;
}

.card-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.steam-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
}

.steam-status-badge.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.4);
    color: var(--accent-cyan);
}

.steam-status-badge.active .dot {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: pulse 1.5s infinite;
}

.steam-status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
}

.hammam-setpoint-control {
    cursor: pointer;
    outline: none;
}

.hammam-setpoint-control rect {
    transition: fill 0.2s ease, stroke 0.2s ease;
    stroke: transparent;
    stroke-width: 1.5;
}

.hammam-setpoint-control:hover rect,
.hammam-setpoint-control:focus rect {
    fill: rgba(249, 115, 22, 0.12);
    stroke: rgba(249, 115, 22, 0.45);
}

.hammam-setpoint-control:hover #steam-setpoint-val,
.hammam-setpoint-control:focus #steam-setpoint-val {
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.8));
}

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

.modal-hint {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
    margin-top: -4px;
}

/* Control elements */
.hammam-cmd-panel {
    flex-shrink: 0;
}

/* Disabled state for Hammam elements when communication is lost */
.hammam-cmd-panel.disabled .thermostat-row,
.hammam-cmd-panel.disabled .hammam-status-grid {
    opacity: 0.6;
}
.hammam-cmd-panel.disabled .step-btn,
.hammam-cmd-panel.disabled .switch,
.hammam-cmd-panel.disabled .zone-info {
    pointer-events: none;
    cursor: default !important;
}
.hammam-setpoint-control.disabled {
    pointer-events: none;
    opacity: 0.5;
}
#temp-indicator-group.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.hammam-status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.status-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-box .label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-box .value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Errors Panel */
.hammam-errors-panel {
    flex-shrink: 0;
    min-height: auto;
    height: auto;
}

.hammam-errors-panel .card-body {
    height: auto;
    overflow: visible;
}

.error-count-badge {
    background: var(--accent-red);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.no-errors-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--accent-green);
    text-align: center;
}

.no-errors-message .success-icon {
    font-size: 32px;
}

.no-errors-message .message-text {
    font-size: 14px;
    font-weight: 500;
}

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

.error-item {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: shake-item 0.4s ease-in-out;
}

.error-item-icon {
    font-size: 16px;
    margin-top: 2px;
}

.error-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.error-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #fca5a5;
}

.error-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* SVG Animations */
@keyframes dash-move {
    to {
        stroke-dashoffset: -100;
    }
}

@keyframes dash-move-reverse {
    to {
        stroke-dashoffset: 100;
    }
}

.water-flow-line {
    stroke-dasharray: 10 15 !important;
    animation: dash-move 2s linear infinite !important;
}

.water-flow-line-reverse {
    stroke-dasharray: 10 15 !important;
    animation: dash-move-reverse 2s linear infinite !important;
}

.leak-glowing-dot circle {
    filter: drop-shadow(0 0 6px #ff0022) drop-shadow(0 0 10px #ef4444);
}

.steam-flow-line {
    animation: dash-move 1.2s linear infinite;
}

@keyframes rise-and-fade {
    0% {
        transform: translateY(30px) scale(0.7);
        opacity: 0;
    }
    50% {
        opacity: 0.18;
    }
    100% {
        transform: translateY(-90px) scale(1.3);
        opacity: 0;
    }
}

.steam-cloud {
    animation: rise-and-fade 5s ease-in-out infinite;
    transform-origin: center bottom;
}

.cloud-1 {
    animation-delay: 0s;
}

.cloud-2 {
    animation-delay: 1.7s;
}

.cloud-3 {
    animation-delay: 3.4s;
}

@keyframes shake-item {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Responsive for Hammam */
@media (max-width: 1024px) {
    #page-hammam {
        overflow-y: auto;
    }
    .hammam-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    .hammam-visual-card {
        height: 480px;
        flex-shrink: 0;
    }
    .hammam-control-card {
        height: auto;
        overflow-y: visible;
    }
}

/* Hammam Thermostats Styles */
.hammam-thermostats-panel {
    flex-shrink: 0;
}

.hammam-thermostats-panel .card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thermostat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--card-border);
    padding: 10px 16px;
    border-radius: 12px;
    gap: 16px;
}

.thermostat-row .zone-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 80px;
}

.thermostat-row .zone-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.thermostat-row .zone-temp {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.thermostat-row .zone-temp.sensor-error {
    color: var(--accent-red) !important;
}

.thermostat-row .zone-control {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 2px;
}

.thermostat-row .step-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.thermostat-row .step-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.thermostat-row .step-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.thermostat-row .setpoint-val {
    font-size: 14px;
    font-weight: 600;
    min-width: 54px;
    text-align: center;
    color: var(--accent-orange);
}

/* SVG Heating Effects */
.heating-active {
    stroke: var(--accent-red) !important;
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.85));
}
.heating-idle {
    stroke: var(--accent-orange) !important;
    filter: drop-shadow(0 0 7px rgba(249, 115, 22, 0.5));
}

path.heating-active {
    fill: rgba(239, 68, 68, 0.25) !important;
    stroke: var(--accent-red) !important;
}
path.heating-idle {
    fill: rgba(249, 115, 22, 0.12) !important;
    stroke: var(--accent-orange) !important;
}

/* Simulation Mode Indicators on Canvas */
@keyframes ramka-pulse {
    0% {
        fill: rgba(239, 68, 68, 0.03);
        stroke: rgba(239, 68, 68, 0.4);
        stroke-width: 0.72px;
    }
    50% {
        fill: rgba(239, 68, 68, 0.12);
        stroke: rgba(239, 68, 68, 0.75);
        stroke-width: 1.0px;
    }
    100% {
        fill: rgba(239, 68, 68, 0.03);
        stroke: rgba(239, 68, 68, 0.4);
        stroke-width: 0.72px;
    }
}

.simulation-active {
    animation: ramka-pulse 2s infinite ease-in-out !important;
}

.simulation-label {
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    font-size: 10px;
    font-weight: bold;
    fill: #ef4444;
    pointer-events: none;
}

#uslink-us-link-block-group {
    transition: filter 0.25s ease, opacity 0.25s ease;
}
#uslink-us-link-block-group:hover {
    filter: brightness(1.2) drop-shadow(0 0 8px rgba(88, 88, 255, 0.4));
    opacity: 0.95;
}
#uslink-us-link-block-group #uslink-uslink-click-prompt {
    transition: fill 0.25s ease;
}
#uslink-us-link-block-group:hover #uslink-uslink-click-prompt {
    fill: #60a5fa !important;
}

#fclink-fancoils-link-block-group {
    transition: filter 0.25s ease, opacity 0.25s ease;
}
#fclink-fancoils-link-block-group:hover {
    filter: brightness(1.2) drop-shadow(0 0 8px rgba(88, 88, 255, 0.4));
    opacity: 0.95;
}
#fclink-fancoils-link-block-group #fclink-tspan1-6 {
    transition: fill 0.25s ease;
}
#fclink-fancoils-link-block-group:hover #fclink-tspan1-6 {
    fill: #60a5fa !important;
}

/* Underfloor Modal Styles */
#underfloor-modal .step-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--accent-cyan) !important;
    color: var(--accent-cyan) !important;
}

#underfloor-modal .step-btn:active {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(0.95);
}

/* ==========================================================================
   Autoclimate Page Styles
   ========================================================================== */
@keyframes rotate-blades {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.rotate-active {
    transform-origin: 80px 45px;
    animation: rotate-blades 1.5s infinite linear;
}

@keyframes uf-pulse {
    0% { stroke-width: 4.5px; opacity: 0.8; }
    50% { stroke-width: 5.5px; opacity: 1; stroke: #f97316; }
    100% { stroke-width: 4.5px; opacity: 0.8; }
}
.uf-coil-active {
    stroke: #f97316 !important;
    animation: uf-pulse 2s infinite ease-in-out;
}

.radiant-panel-cooling {
    fill: rgba(6, 182, 212, 0.25) !important;
    stroke: var(--accent-cyan) !important;
    filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.4));
}
.radiant-panel-heating {
    fill: rgba(249, 115, 22, 0.25) !important;
    stroke: var(--accent-orange) !important;
    filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.4));
}
.radiant-panel-off {
    fill: rgba(71, 85, 105, 0.15) !important;
    stroke: rgba(255,255,255,0.08) !important;
}

.convector-active {
    stroke: var(--accent-orange) !important;
    filter: drop-shadow(0 0 5px rgba(249, 115, 22, 0.4));
}

@keyframes vent-flow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -20; }
}
.vent-active {
    stroke: var(--accent-green) !important;
    stroke-dasharray: 4 4;
    animation: vent-flow 1s infinite linear;
}

.autoclimate-system-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 4px;
}
.autoclimate-system-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
.autoclimate-system-status {
    font-size: 12px;
    font-weight: 600;
}
.autoclimate-system-status.on {
    color: var(--accent-green);
}
.autoclimate-system-status.off {
    color: var(--accent-red);
}
.autoclimate-system-status.cool {
    color: var(--accent-cyan);
}
.autoclimate-system-status.heat {
    color: var(--accent-orange);
}

@keyframes boiler-fault-pulse {
    0% { stroke: #ef4444; filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
    50% { stroke: #7f1d1d; filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8)); }
    100% { stroke: #ef4444; filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
}
.boiler-fault-active {
    animation: boiler-fault-pulse 1s infinite ease-in-out;
    stroke-width: 1.5px !important;
}

/* MQTT offline state sonar animation */
.status-indicator.offline .dot {
    background-color: #ef4444 !important;
    position: relative;
}
.status-indicator.offline .dot::before,
.status-indicator.offline .dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 2px solid #ef4444;
    animation: html-sonar-ripple 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
    pointer-events: none;
}
.status-indicator.offline .dot::after {
    animation-delay: 0.75s;
}

@keyframes html-sonar-ripple {
    0% {
        width: 6px;
        height: 6px;
        opacity: 0.9;
    }
    100% {
        width: 24px;
        height: 24px;
        opacity: 0;
    }
}

/* Autoclimate Top Panel Styling */
.autoclimate-top-panel {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.2fr);
    gap: 16px;
    width: 100%;
    margin-bottom: 5px;
}

.autoclimate-modes-card, .dtvu-sensors-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--glass-shadow);
}

.card-header-icon, .sensor-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mode-options {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    color: #ffffff;
    background: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    font-weight: 600;
}

/* Specific styling for Drying mode active */
.mode-btn.active[data-mode="осушение"] {
    background: var(--accent-orange);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.mode-btn.active[data-mode="выкл"] {
    background: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.sensor-grid {
    display: flex;
    gap: 16px;
}

.sensor-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.2s ease;
}

.sensor-item:hover {
    border-color: rgba(59, 130, 246, 0.2);
}

.sensor-name {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.sensor-values {
    display: flex;
    gap: 16px;
}

.sensor-val {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.sensor-val .temp-val {
    color: var(--accent-cyan);
}

.sensor-val .hum-val {
    color: #10b981;
}

@media (max-width: 768px) {
    .autoclimate-top-panel {
        grid-template-columns: 1fr;
    }
}

/* Segment Control (Segmented buttons) styling */
.segment-control {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 2px;
    border: 1px solid var(--card-border);
    gap: 2px;
}

.segment-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

.segment-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.segment-btn.active {
    background: var(--accent-blue);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Autoclimate Room Grid & Cards */
.autoclimate-grid-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    width: 100%;
}

.autoclimate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.autoclimate-room-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
}

.autoclimate-room-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.room-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.room-card-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.status-off {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-cool {
    background: rgba(6, 182, 212, 0.12);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.status-dry {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.room-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.room-sensor-data {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.room-sensor-value {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: #fff;
}

.room-sensor-label {
    color: var(--text-secondary);
}

.room-fancoil-info {
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fancoil-info-row {
    display: flex;
    justify-content: space-between;
}

.fancoil-info-value {
    color: #fff;
    font-weight: 500;
}

.room-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.room-control-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.room-setpoint-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.room-setpoint-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.room-setpoint-value {
    font-weight: bold;
    color: var(--accent-blue);
}

.room-setpoint-slider {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.room-setpoint-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: background 0.1s ease;
}

.room-setpoint-slider:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.manual-control-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 8px 10px;
}

.manual-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-systems-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 12px;
}

.system-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.system-label {
    color: var(--text-secondary);
}

.system-value {
    color: #fff;
    font-weight: 500;
}
.inline-history-btn {
    color: #94a3b8;
    text-decoration: none;
    font-size: 18px;
    transition: color 0.15s ease, transform 0.15s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.inline-history-btn:hover {
    color: #3b82f6 !important;
    transform: scale(1.1);
}

/* ==========================================================================
   User Management, Auth & Login UI Styles
   ========================================================================== */

/* Sidebar User Section */
.sidebar-user-section {
    margin-top: auto;
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}

.sidebar-user-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

.sidebar-user-avatar {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
}

.sidebar-user-actions {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-user-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-user-action-item:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-user-action-item.logout:hover {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.sidebar-action-icon {
    font-size: 16px;
}

.user-role-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.user-role-badge.superadmin {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.user-role-badge.user {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Fullscreen Login Overlay */

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 30%, rgba(15, 23, 42, 0.95), #020617);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.login-card {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(59, 130, 246, 0.15);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.login-logo-icon {
    font-size: 42px;
    margin-bottom: 4px;
    filter: drop-shadow(0 0 16px rgba(59, 130, 246, 0.6));
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.5px;
}

.login-header p {
    font-size: 13px;
    color: #94a3b8;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 14px;
    font-size: 16px;
    color: #64748b;
    pointer-events: none;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: #f8fafc;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.input-with-icon input:focus {
    border-color: #3b82f6;
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    text-align: center;
    animation: shake 0.3s ease-in-out;
}

.login-submit-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    margin-top: 6px;
}

.login-submit-btn:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
    transform: translateY(-1px);
}

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

/* User Management Modals */
.user-mgmt-card {
    max-width: 860px;
    width: 95%;
}

.user-mgmt-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.user-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.user-table th {
    background: rgba(15, 23, 42, 0.8);
    padding: 12px 14px;
    color: #94a3b8;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-table td {
    padding: 12px 14px;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.user-role-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.user-role-pill.superadmin {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.user-role-pill.user {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.user-actions-cell {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.user-action-btn-small {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-action-btn-small:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(59, 130, 246, 0.4);
    color: #ffffff;
}

.user-action-btn-small.danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.user-edit-card, .change-pwd-card {
    max-width: 480px;
    width: 92%;
}

.modal-text-input, .modal-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #f8fafc;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.modal-text-input:focus, .modal-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.modal-select option {
    background: #0f172a;
    color: #f8fafc;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-form-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 10px;
}

.btn {
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.6);
}

/* Toast Notifications */
.scada-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #f8fafc;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.2);
    backdrop-filter: blur(12px);
    font-size: 14px;
    z-index: 10005;
    animation: slideUp 0.3s ease-out;
}

.scada-toast.error {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(239, 68, 68, 0.2);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}



