* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', 'Inter', -apple-system, Roboto, sans-serif; background: #eef4fa; padding: 20px; }
.container { max-width: 1500px; margin: 0 auto; }
h1 { text-align: center; margin-bottom: 24px; color: #0c4a6e; font-size: 1.9rem; display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 500; }

.user-info { position: fixed; top: 20px; right: 20px; display: flex; align-items: center; gap: 12px; background: white; padding: 8px 16px; border-radius: 40px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); z-index: 1000; }
.user-avatar { width: 32px; height: 32px; background: #0284c7; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; }
.user-details { font-size: 0.85rem; }
.user-name { font-weight: 600; color: #0c4a6e; }
.user-role { font-size: 0.7rem; color: #6b7280; }
.logout-btn { background: #ef4444; color: white; border: none; padding: 6px 12px; border-radius: 40px; cursor: pointer; font-size: 0.75rem; font-weight: 500; transition: background 0.2s; }
.logout-btn:hover { background: #dc2626; }
.login-btn-header { background: #0284c7; color: white; border: none; padding: 6px 16px; border-radius: 40px; cursor: pointer; font-size: 0.75rem; font-weight: 500; transition: background 0.2s; }
.login-btn-header:hover { background: #0369a1; }
.admin-btn { background: #8b5cf6; color: white; border: none; padding: 6px 12px; border-radius: 40px; cursor: pointer; font-size: 0.75rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.admin-btn:hover { background: #7c3aed; }
.settings-btn { background: #eef4fa; color: #0284c7; border: none; padding: 6px 12px; border-radius: 40px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: background 0.2s; display: flex; align-items: center; gap: 6px; }
.settings-btn:hover { background: #cde9fe; }

.devices-table-container { background: white; border-radius: 24px; overflow: hidden; margin-top: 20px; box-shadow: 0 8px 20px rgba(0, 60, 90, 0.08); border: 1px solid #dcf2ff; }
.devices-table { width: 100%; border-collapse: collapse; }
.devices-table th { background: #f8fafc; padding: 14px 16px; text-align: left; font-size: 0.75rem; font-weight: 600; color: #2c6e9e; border-bottom: 1px solid #e2edf7; }
.devices-table td { padding: 12px 16px; font-size: 0.85rem; border-bottom: 1px solid #eef2f6; }
.devices-table tr:hover { background: #f8fafc; cursor: pointer; }
.device-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; transition: background-color 0.2s ease; }
.device-status.active { background: #22c55e; box-shadow: 0 0 4px #22c55e; }
.device-status.inactive { background: #ef4444; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; }
.badge-heater { background: #ffedd5; color: #c2410c; }
.badge-sensor { background: #dcfce7; color: #166534; }
.badge-button { background: #e0e7ff; color: #4338ca; }
.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-user { background: #e0f2fe; color: #0369a1; }

.users-modal-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.users-modal-stats { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stat-pill { display: inline-flex; align-items: center; gap: 8px; background: #f8fafc; padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; color: #0c4a6e; border: 1px solid #e2edf7; }
.stat-pill i { font-size: 0.95rem; color: #0284c7; }

.tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid #e2edf7; padding-bottom: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tabs-buttons { display: flex; gap: 10px; }
.tab-btn { background: none; border: none; padding: 8px 20px; font-size: 0.9rem; font-weight: 500; cursor: pointer; border-radius: 20px; transition: 0.2s; color: #6b7280; }
.tab-btn.active { background: #0284c7; color: white; }
.tab-btn:hover:not(.active) { background: #e0f2fe; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.refresh-discovered-btn, .clear-discovered-btn { background: #0284c7; color: white; border: none; padding: 8px 16px; border-radius: 40px; font-size: 0.75rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background 0.2s; }
.refresh-discovered-btn:hover { background: #0369a1; }
.clear-discovered-btn { background: #dc2626; }
.clear-discovered-btn:hover { background: #b91c1c; }

.filters { background: white; padding: 18px 20px; border-radius: 24px; margin-bottom: 28px; box-shadow: 0 6px 14px rgba(2, 136, 209, 0.08); border: 1px solid #cde9fe; }
.filter-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.filter-group { flex: 1; min-width: 150px; }
.filter-group label { display: block; font-size: 0.7rem; font-weight: 600; color: #2c6e9e; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.filter-group select { width: 100%; padding: 10px 12px; border: 1px solid #cde9fe; border-radius: 18px; font-size: 0.85rem; background: white; color: #0c4a6e; font-weight: 500; cursor: pointer; }
.btn-reset { background: #6b7280; color: white; border: none; padding: 10px 24px; border-radius: 40px; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: 0.2s; }
.btn-reset:hover { background: #4b5563; }
.btn-refresh { background: #0284c7; color: white; border: none; padding: 10px 24px; border-radius: 40px; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: 0.2s; }
.btn-refresh:hover { background: #0369a1; }

.devices-grid {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.device-group {
    width: 100% !important;
    margin-bottom: 32px;
}

.device-group:last-child {
    margin-bottom: 0;
}

.device-group-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 16px;
    width: 100%;
}

.device-card {
    background: white;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid #dcf2ff;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    width: auto;
    min-width: 280px;
    max-width: 350px;
    flex-shrink: 0;
}
.device-card:hover { box-shadow: 0 8px 20px rgba(2, 132, 199, 0.12); border-color: #b8dff5; }
.device-card.inactive { opacity: 0.65; background: #f5f7fa; border-color: #d4dee8; filter: grayscale(0.3); pointer-events: none; }
.device-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; min-width: 0; gap: 8px; flex-wrap: wrap; }
.device-name { font-size: 0.9rem; font-weight: 500; color: #0369a1; letter-spacing: -0.2px; display: flex; align-items: center; gap: 6px; white-space: normal; word-break: keep-all; }
.device-location { font-size: 0.65rem; background: #eef4fa; padding: 2px 10px; border-radius: 40px; color: #2c6e9e; font-weight: 500; display: flex; align-items: center; gap: 4px; white-space: nowrap; flex-shrink: 0; }

.buttons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin: 4px 0; }
.device-action-btn { background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%); border: none; color: white; padding: 8px 8px; border-radius: 14px; font-size: 0.7rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 2px 8px rgba(67, 56, 202, 0.3); position: relative; overflow: hidden; }
.device-action-btn:active { transform: scale(0.98); }
.device-action-btn.long-press-active { background: linear-gradient(135deg, #ea580c 0%, #f97316 100%); box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.4); }
.device-action-btn .press-progress { position: absolute; bottom: 0; left: 0; height: 3px; background-color: rgba(255, 255, 255, 0.7); width: 0%; transition: width 0.05s linear; border-radius: 2px; }
.device-action-btn i { font-size: 0.8rem; }
.buttons-section-title { font-size: 0.6rem; font-weight: 600; color: #2c6e9e; margin: 4px 0 4px 0; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 6px; }

/* Стиль для неактивных кнопок */
.device-action-btn-disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background: #94a3b8 !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

.device-action-btn-disabled:hover {
    transform: none !important;
    opacity: 0.4 !important;
}

.sensor-metrics-stack { margin: 4px 0; }
.sensor-metric-block { display: flex; background: #fafeff; border-radius: 16px; border: 1px solid #e2edf7; overflow: hidden; margin-bottom: 8px; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; border-left-width: 3px; border-left-style: solid; }
.sensor-metric-block:hover { background: #ffffff; border-color: #7ab7d4; }
.sensor-metric-block--temp { border-left-color: #ef4444; }
.sensor-metric-block--humidity { border-left-color: #22c55e; }
.sensor-metric-block--pressure { border-left-color: #8b5cf6; }
.sensor-metric-icon { display: flex; align-items: center; justify-content: center; width: 40px; flex-shrink: 0; font-size: 1.2rem; }
.sensor-metric-block--temp .sensor-metric-icon { color: #ef4444; }
.sensor-metric-block--humidity .sensor-metric-icon { color: #22c55e; }
.sensor-metric-block--pressure .sensor-metric-icon { color: #8b5cf6; }
.sensor-metric-content { flex: 1; padding: 8px 10px; }
.sensor-metric-label { font-size: 0.6rem; font-weight: 600; color: #2c6e9e; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.sensor-metric-main { font-size: 1.2rem; font-weight: 500; color: #0b3b4f; line-height: 1.15; }
.sensor-metric-unit { font-size: 0.7rem; color: #64748b; font-weight: 400; margin-left: 4px; }
.sensor-metric-comment { font-size: 0.55rem; color: #475569; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.sensor-metrics-empty { text-align: center; color: #6c8eae; padding: 12px 10px; background: #f8fafc; border-radius: 16px; border: 1px solid #e2edf7; margin: 8px 0; font-size: 0.7rem; }

.coolant-block, .room-block, .power-block { display: flex; background: #fafeff; border-radius: 16px; border: 1px solid #e2edf7; overflow: hidden; cursor: pointer; margin-bottom: 8px; transition: background 0.15s ease, border-color 0.15s ease; border-left-width: 3px; border-left-style: solid; }
.coolant-block { border-left-color: #ef4444; }
.room-block { border-left-color: #3b82f6; }
.power-block { border-left-color: #f59e0b; }
.coolant-block:hover, .room-block:hover, .power-block:hover { background: #ffffff; border-color: #7ab7d4; }
.coolant-icon, .room-icon, .power-icon { display: flex; align-items: center; justify-content: center; width: 40px; font-size: 1.2rem; }
.coolant-icon { color: #ef4444; }
.room-icon { color: #3b82f6; }
.power-icon { color: #f59e0b; }
.coolant-content, .room-content, .power-content { flex: 1; padding: 8px 10px; }
.coolant-value, .room-value, .power-value { font-size: 1.2rem; font-weight: 500; color: #0b3b4f; line-height: 1.15; }
.coolant-unit, .room-unit, .power-unit { font-size: 0.7rem; color: #64748b; font-weight: 400; margin-left: 4px; }
.coolant-label, .room-label, .power-label { font-size: 0.6rem; font-weight: 600; color: #2c6e9e; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.coolant-main, .room-main, .power-main { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.progress-bar { width: 100%; height: 4px; background: #e2e8f0; border-radius: 10px; overflow: hidden; margin-top: 4px; }
.progress-fill { height: 100%; background: #0284c7; border-radius: 10px; transition: width 0.15s linear; }
.footer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 0.55rem; color: #6b7280; width: 100%; }

.card-footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid #e2edf7;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.footer-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.footer-left {
    display: flex;
    align-items: center;
}

.footer-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.device-id {
    font-size: 0.5rem;
    font-family: monospace;
    color: #88a4bc;
}

.last-update {
    font-size: 0.5rem;
    color: #88a4bc;
}

.power-btn {
    background: #0284c7 !important;
    border-radius: 40px !important;
    width: auto !important;
    padding: 4px 12px !important;
    gap: 6px;
    font-size: 0.7rem !important;
    font-weight: 600;
    color: white !important;
    transition: background 0.15s ease, color 0.15s ease;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.power-btn.active {
    background: #dc2626 !important;
    color: white !important;
}

.power-btn:hover {
    background: #0369a1 !important;
    opacity: 0.9;
}

.power-btn.active:hover {
    background: #b91c1c !important;
}

.icon-btn {
    background: #0284c7 !important;
    border: none !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background 0.15s ease, transform 0.1s ease !important;
    color: white !important;
    font-size: 0.8rem !important;
    box-shadow: none !important;
    outline: none !important;
}

.icon-btn:hover {
    background: #0369a1 !important;
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

.empty-state { text-align: center; color: #6c8eae; padding: 60px 30px; background: white; border-radius: 40px; }
.empty-state i { font-size: 3rem; color: #9ca3af; margin-bottom: 16px; display: block; }
.empty-state .btn-primary { margin-top: 16px; background: #0284c7; color: white; border: none; padding: 10px 24px; border-radius: 40px; cursor: pointer; font-size: 0.9rem; }
.empty-state .btn-primary:hover { background: #0369a1; }

.login-prompt { text-align: center; color: white; padding: 80px 30px; background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); border-radius: 40px; box-shadow: 0 8px 25px rgba(2, 132, 199, 0.3); }
.login-prompt i { font-size: 4rem; color: white; margin-bottom: 20px; display: block; text-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.login-prompt h3 { color: white; margin-bottom: 10px; font-size: 1.5rem; }
.login-prompt p { color: rgba(255,255,255,0.9); margin-bottom: 10px; }
.login-prompt .login-btn-large { background: white; color: #0284c7; border: none; padding: 12px 30px; border-radius: 40px; font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: 20px; transition: all 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.login-prompt .login-btn-large:hover { background: #f0f9ff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.action-icon { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px; transition: 0.2s; font-size: 1rem; }
.action-icon.add { color: #22c55e; }
.action-icon.add:hover { background: #dcfce7; }
.action-icon.edit { color: #0284c7; }
.action-icon.edit:hover { background: #e0f2fe; }
.action-icon.delete { color: #dc2626; }
.action-icon.delete:hover { background: #fee2e2; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 20, 30, 0.6); backdrop-filter: blur(4px); justify-content: center; align-items: center; z-index: 1100; }
.modal.active { display: flex; }
.modal-content { background: white; padding: 28px; border-radius: 32px; max-width: 1000px; width: 90%; max-height: 85vh; overflow-y: auto; }
.modal-content h2 { font-size: 1.3rem; font-weight: 500; color: #0369a1; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.btn { padding: 10px 20px; border-radius: 40px; font-weight: 500; border: none; cursor: pointer; transition: 0.2s; font-size: 0.85rem; }
.btn-primary { background: #0284c7; color: white; }
.btn-primary:hover { background: #0369a1; }
.btn-secondary { background: #e2e8f0; color: #2d3e50; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: #dc2626; color: white; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.form-group { margin: 20px 0; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 600; color: #2c6e9e; margin-bottom: 8px; text-transform: uppercase; }
.form-group input, .form-group select { width: 100%; padding: 12px 16px; border: 2px solid #e2edf7; border-radius: 24px; font-size: 0.9rem; }
.info-row { display: flex; padding: 10px 0; border-bottom: 1px solid #eef2f6; }
.info-label { width: 160px; font-weight: 600; color: #2c6e9e; }
.info-value { flex: 1; color: #1e293b; }
.device-info-sensors { margin-top: 16px; background: #f8fafc; border-radius: 20px; padding: 16px; }
.device-info-sensors h4 { color: #0369a1; margin-bottom: 12px; font-size: 0.85rem; }
.sensor-tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sensor-tag { background: #f8fafc; padding: 6px 12px; border-radius: 20px; margin: 4px; display: inline-block; font-size: 0.75rem; border: 1px solid #e2edf7; }
.notification { position: fixed; bottom: 24px; right: 24px; background: #0c4a6e; color: white; padding: 12px 22px; border-radius: 60px; z-index: 1300; display: none; font-weight: 500; font-size: 0.85rem; }
.notification.show { display: block; }
.notification.error { background: #dc2626; }
.loading-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.9); z-index: 9999; justify-content: center; align-items: center; }
.loading-overlay.active { display: flex; }
.loading-spinner { width: 40px; height: 40px; border: 3px solid #e2e8f0; border-top-color: #0284c7; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.slider-container { margin: 24px 0; width: 100%; }
.slider { width: 100%; height: 6px; border-radius: 10px; background: #e2e8f0; -webkit-appearance: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: #0284c7; border-radius: 50%; cursor: pointer; }
.slider-value { font-size: 1.2rem; font-weight: 500; text-align: center; margin-bottom: 12px; color: #0284c7; }

.debug-panel { background: #1e293b; color: #a5f3fc; padding: 12px 20px; border-radius: 12px; margin-bottom: 20px; font-family: monospace; font-size: 12px; max-height: 160px; overflow-y: auto; display: none; }
.debug-panel.visible { display: block; }
.debug-log { max-height: 108px; overflow-y: auto; font-size: 11px; line-height: 1.4; }
.debug-log div { padding: 2px 0; border-bottom: 1px solid rgba(165, 243, 252, 0.2); white-space: nowrap; overflow-x: hidden; text-overflow: ellipsis; }

.dual-slider-item { margin: 20px 0; }
.dual-slider-item label { display: block; font-size: 0.75rem; font-weight: 500; color: #0369a1; margin-bottom: 8px; }
.slider-info { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; color: #6b7280; }

.chart-container { margin: 20px 0; position: relative; }
canvas { max-height: 300px; width: 100%; }
.param-selector { display: flex; justify-content: flex-end; margin-bottom: 20px; align-items: center; }
.param-selector select { padding: 8px 16px; border-radius: 24px; border: 1px solid #e2edf7; background: white; font-size: 0.85rem; width: auto; }

.modal-chart-section { margin-top: 20px; position: relative; }
.heater-chart-container { margin: 15px 0; position: relative; }
.chart-period-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 15px; align-items: center; justify-content: flex-end; }
.chart-period-selector select { padding: 6px 12px; border-radius: 20px; border: 1px solid #e2edf7; background: white; font-size: 0.75rem; }
.chart-stats { font-size: 0.7rem; color: #6b7280; text-align: center; margin-top: 10px; }

.reset-zoom-btn { position: absolute; bottom: 10px; right: 10px; background: #0284c7; color: white; border: none; border-radius: 20px; padding: 5px 12px; font-size: 0.7rem; cursor: pointer; z-index: 100; box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: background 0.2s; }
.reset-zoom-btn:hover { background: #0369a1; }

.control-section { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #e2edf7; }
.login-hint { background: #fef3c7; color: #92400e; padding: 10px 15px; border-radius: 16px; font-size: 0.75rem; text-align: center; margin-bottom: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.sync-checkbox { display: flex; align-items: center; gap: 12px; margin: 15px 0 10px 0; padding: 8px 12px; background: #f0f9ff; border-radius: 40px; border: 1px solid #cde9fe; }
.sync-checkbox label { font-size: 0.8rem; font-weight: 500; color: #0369a1; cursor: pointer; margin: 0; display: flex; align-items: center; gap: 8px; }
.sync-checkbox input { width: 18px; height: 18px; cursor: pointer; margin: 0; }

.settings-section { margin: 20px 0; }
.settings-item { margin-bottom: 24px; }
.settings-item:last-child { margin-bottom: 0; }
.settings-switch { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.settings-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.settings-switch-slider { position: relative; display: inline-block; width: 50px; height: 24px; background-color: #ccc; border-radius: 24px; transition: 0.3s; }
.settings-switch-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: 0.3s; }
.settings-switch input:checked + .settings-switch-slider { background-color: #0284c7; }
.settings-switch input:checked + .settings-switch-slider:before { transform: translateX(26px); }
.settings-switch-label { flex: 1; margin-left: 12px; font-size: 0.9rem; font-weight: 500; color: #1e293b; }
.settings-label { display: block; font-size: 0.9rem; font-weight: 500; color: #1e293b; margin-bottom: 8px; }
.settings-select { width: 100%; padding: 10px 12px; border: 1px solid #cde9fe; border-radius: 12px; font-size: 0.85rem; background: white; color: #0c4a6e; cursor: pointer; }
.settings-hint { font-size: 0.7rem; color: #6b7280; margin-top: 6px; }

.help-content { max-height: 60vh; overflow-y: auto; padding-right: 8px; }
.help-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #e2edf7; }
.help-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.help-section h3 { font-size: 1rem; font-weight: 600; color: #0369a1; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.help-section p { font-size: 0.85rem; color: #334155; line-height: 1.5; margin-left: 28px; }
.help-section strong { color: #ea580c; }

.device-list-checkboxes { max-height: 200px; overflow-y: auto; border: 1px solid #e2edf7; border-radius: 16px; padding: 10px; background: #fafeff; }
.device-checkbox-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #eef2f6; }
.device-checkbox-item:last-child { border-bottom: none; }
.device-checkbox-item input { width: 18px; height: 18px; cursor: pointer; }
.device-checkbox-item label { margin: 0; font-size: 0.85rem; font-weight: normal; text-transform: none; color: #1e293b; cursor: pointer; flex: 1; }
.device-checkbox-item .device-type-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; background: #e2edf7; color: #2c6e9e; }
.access-hint { font-size: 0.7rem; color: #6b7280; margin-top: 8px; display: flex; align-items: center; gap: 6px; }

.last-update.stale { color: #f59e0b; background: #fef3c7; padding: 2px 6px; border-radius: 12px; display: inline-block; }
.last-update.stale i { color: #f59e0b; }

@media (max-width: 768px) {
    .device-group {
        margin-bottom: 24px;
    }
    .device-card {
        width: calc(50% - 8px) !important;
        min-width: 200px;
    }
    .footer-top {
        flex-wrap: wrap;
        gap: 6px;
    }
    .footer-left, .footer-right {
        min-width: auto;
    }
    .footer-bottom {
        flex-wrap: wrap;
        gap: 6px;
    }
    .power-btn {
        padding: 3px 10px !important;
        font-size: 0.65rem !important;
    }
    .icon-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.7rem !important;
    }
}

@media (max-width: 480px) {
    body { padding: 12px; }
    h1 { font-size: 1.4rem; }
    .device-group {
        margin-bottom: 20px;
    }
    .device-card { width: 100% !important; }
    .sensor-metric-icon, .coolant-icon, .room-icon, .power-icon { width: 35px !important; font-size: 1rem !important; }
    .sensor-metric-main, .coolant-value, .room-value, .power-value { font-size: 1.1rem !important; }
    .modal-content { padding: 20px; width: 95%; }
    .tabs { flex-direction: column; align-items: stretch; }
    .tabs-buttons { justify-content: center; }
    .refresh-discovered-btn, .clear-discovered-btn { justify-content: center; }
    .info-label { width: 120px; font-size: 0.7rem; }
    .info-value { font-size: 0.7rem; }
    .chart-period-selector { justify-content: center; }
    .param-selector { justify-content: center; }
    .user-guide-grid { flex-direction: column; gap: 12px; }
    .buttons-grid { grid-template-columns: 1fr; }
    .device-name { font-size: 0.8rem; }
    .device-location { font-size: 0.55rem; }
    .settings-switch-label { font-size: 0.8rem; }
    .help-section h3 { font-size: 0.9rem; }
    .help-section p { font-size: 0.75rem; margin-left: 20px; }
    .footer-top {
        flex-direction: column;
        gap: 8px;
    }
    .footer-left, .footer-right {
        min-width: auto;
        justify-content: center;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 4px;
    }
    .power-btn {
        padding: 3px 10px !important;
        font-size: 0.65rem !important;
    }
    .icon-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.7rem !important;
    }
}

.main-content-hidden { opacity: 0; transition: opacity 0.2s ease; }
.main-content-visible { opacity: 1; }
.spinning { animation: spin 0.5s linear infinite; }
.btn-pressed { transform: scale(0.95); transition: transform 0.05s ease; }