:root { 
  --green-900:#142e1f; 
  --green-800:#1b482d; 
  --green-600:#2d8a53; 
  --green-500:#38a169;
  --green-100:#eaf6ed; 
  --green-50:#f4faf6; 
  --orange:#f59e0b; 
  --ink:#1e293b; 
  --muted:#64748b; 
  --line:#e2e8f0; 
  --surface:#ffffff; 
  --shadow:0 10px 30px rgba(20,46,31,.08); 
  --shadow-lg:0 20px 40px rgba(0,0,0,.15);
  --bottom-bar-height:50px;
  --container-max-width:1380px;
}

* { box-sizing:border-box; margin:0; padding:0; }
html { scroll-behavior:smooth; -webkit-text-size-adjust:100%; height:100%; }
body { 
  min-height:100%; 
  display:flex;
  flex-direction:column;
  background:#f8fafc; 
  color:var(--ink); 
  font:400 16px/1.6 'Outfit', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x:hidden;
}
a { color:inherit; text-decoration:none; }

h1,h2,h3,h4 { font-family:'Outfit', sans-serif; color:var(--green-800); line-height:1.25; font-weight:700; }
h1 { font-size:clamp(1.4rem,3vw,2.1rem); margin:0 0 0.7rem; } 
h2 { font-size:1.2rem; margin:0 0 0.6rem; } 
h3 { font-size:1rem; margin:0 0 0.4rem; }

.page-header { margin-bottom: 18px; }
.page-header h1 { margin-bottom: 4px; }

/* Visibility toggles */
.mobile-only { display:none !important; }
.desktop-only { display:flex; }

/* Topbar Header */
.topbar { 
  position:sticky; 
  top:0; 
  z-index:100; 
  color:#fff; 
  background:linear-gradient(135deg,var(--green-900),var(--green-800)); 
  box-shadow:0 4px 20px rgba(0,0,0,.15); 
  flex-shrink:0;
}

.topbar-inner, .container { 
  width:min(var(--container-max-width), calc(100% - 48px)); 
  margin:0 auto; 
}

.topbar-inner { 
  min-height:60px; 
  display:flex; 
  align-items:center; 
  justify-content:space-between;
  gap:16px; 
}

.brand { 
  display:inline-flex; 
  align-items:center; 
  gap:8px; 
  color:#fff; 
  font:700 1.25rem 'Outfit',sans-serif; 
  letter-spacing:-.02em; 
  flex-shrink:0; 
  white-space:nowrap; 
}
.brand-icon { color:#4ade80; font-size:1.15em; }

.nav { 
  display:flex; 
  align-items:center; 
  gap:4px; 
  white-space:nowrap; 
}

.nav a { 
  padding:6px 12px; 
  color:rgba(255,255,255,.88); 
  font-weight:500; 
  border-radius:8px; 
  transition:all .18s ease; 
  font-size:0.88rem; 
}
.nav a:hover, .nav a.active { 
  background:rgba(255,255,255,.18); 
  color:#fff; 
}
.nav a.active {
  font-weight:600;
  box-shadow:0 2px 8px rgba(0,0,0,.1);
}

.nav-sep { 
  width:1px; 
  height:18px; 
  background:rgba(255,255,255,.22); 
  margin:0 4px; 
}
.btn-nav-register { 
  background:rgba(255,255,255,.18) !important; 
  color:#fff !important; 
  font-weight:600 !important; 
}

.userbox { 
  display:flex; 
  align-items:center; 
  gap:10px; 
  font-size:.86rem; 
  flex-shrink:0; 
}
.user-profile-badge { 
  display:inline-flex; 
  align-items:center; 
  gap:6px; 
  padding:5px 12px; 
  border-radius:20px; 
  background:rgba(255,255,255,.12); 
  color:#fff; 
  font-weight:500; 
  transition:background 0.2s; 
}
.user-profile-badge:hover { background:rgba(255,255,255,.22); }
.user-fio { max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Селектор активных устройств */
.device-selector-wrap { position:relative; }
.device-dropdown { position:relative; }
.device-btn { 
  display:flex; 
  align-items:center; 
  gap:6px; 
  padding:6px 12px; 
  border-radius:8px; 
  background:rgba(0,0,0,.25); 
  border:1px solid rgba(255,255,255,.2); 
  color:#fff; 
  font-size:0.84rem; 
  font-weight:600; 
  cursor:pointer; 
  white-space:nowrap; 
}
.device-btn:hover { background:rgba(0,0,0,.4); }
.device-menu { 
  display:none; 
  position:absolute; 
  right:0; 
  top:calc(100% + 6px); 
  min-width:240px; 
  max-width:90vw;
  background:#fff; 
  color:var(--ink); 
  border-radius:12px; 
  box-shadow:var(--shadow-lg); 
  border:1px solid var(--line); 
  padding:6px 0; 
  z-index:200; 
}
.device-dropdown:hover .device-menu, .device-dropdown:focus-within .device-menu { display:block; }
.device-menu-header { padding:8px 14px; font-size:0.75rem; font-weight:700; text-transform:uppercase; color:var(--muted); letter-spacing:0.05em; }
.device-item { display:flex; flex-direction:column; padding:8px 14px; transition:background 0.15s; }
.device-item:hover { background:var(--green-50); }
.device-item.active { background:var(--green-100); border-left:3px solid var(--green-600); }
.device-item-name { font-weight:600; font-size:0.88rem; color:var(--green-900); }
.device-item-id { font-size:0.76rem; color:var(--muted); font-family:monospace; }
.device-menu-divider { height:1px; background:var(--line); margin:4px 0; }
.btn-add-device-menu { 
  width:100%; 
  text-align:left; 
  padding:10px 14px; 
  background:transparent; 
  border:none; 
  color:var(--green-600); 
  font-weight:600; 
  font-size:0.85rem; 
  cursor:pointer; 
  display:flex; 
  align-items:center; 
  gap:6px; 
}
.btn-add-device-menu:hover { background:var(--green-50); }

/* Main layout & Containers (Expanded for PC monitors) */
main.container { 
  flex: 1 0 auto;
  padding: 26px 0 44px; 
}
.card { 
  padding:22px; 
  margin:12px 0; 
  background:var(--surface); 
  border:1px solid var(--line); 
  border-radius:14px; 
  box-shadow:0 4px 15px rgba(0,0,0,.03); 
}
.grid { display:grid; gap:18px; }
.grid-2 { grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); }
.grid-3 { grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); }

.dashboard-header { 
  display:flex; 
  justify-content:space-between; 
  align-items:center; 
  gap:14px; 
  margin-bottom:16px; 
  flex-wrap:wrap; 
}
.dashboard-stats { 
  grid-template-columns:repeat(3,minmax(0,1fr)); 
  gap:16px;
}

/* 🎯 Restored Circular Gauge Cards */
.gauge-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  margin: 0;
  border-radius: 14px;
  min-height: 116px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.gauge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.gauge-info {
  flex: 1;
  min-width: 0;
}
.gauge-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gauge-value {
  font: 700 1.45rem 'Outfit', sans-serif;
  line-height: 1.2;
  color: var(--green-900);
}
.gauge-unit {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
}
.gauge-status {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gauge-circle-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.gauge-bg {
  fill: none;
  stroke: #f1f5f9;
  stroke-width: 7;
}
.gauge-progress {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 220;
  transition: stroke-dashoffset 0.6s ease;
}
.gauge-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

/* Gauge Thematic Colors */
.text-temp { color: #e11d48; }
.stroke-temp { stroke: #e11d48; }
.text-humidity { color: #0284c7; }
.stroke-humidity { stroke: #0284c7; }
.text-pressure { color: #7c3aed; }
.stroke-pressure { stroke: #7c3aed; }
.text-water { color: #16a34a; }
.stroke-water { stroke: #16a34a; }
.text-ec { color: #d97706; }
.stroke-ec { stroke: #d97706; }
.text-water-temp { color: #0d9488; }
.stroke-water-temp { stroke: #0d9488; }
.text-empty { color: #dc2626; }
.stroke-empty { stroke: #dc2626; }

/* System Info Grid */
.system-info-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:10px 20px;
  margin-top:8px;
}
.system-info-item {
  font-size:0.90rem;
  color:var(--ink);
}

/* 📈 Strictly Bounded Chart Containers (Eliminates infinite vertical resize loop) */
.chart-grid {
  gap:18px;
}
.chart-card {
  padding:20px;
  margin:0;
}
.chart-header {
  margin-bottom:12px;
}
.chart-header h3 {
  margin:0;
  font-size:0.96rem;
  color:var(--green-900);
  display:flex;
  align-items:center;
  gap:8px;
}
.chart-wrapper {
  position:relative;
  height:240px;
  max-height:240px;
  width:100%;
  overflow:hidden;
}
.chart-wrapper canvas {
  display:block !important;
  width:100% !important;
  height:100% !important;
}
.chart-card-wide {
  grid-column:1 / -1;
}

/* Archive Toolbar & Reset Button */
.archive-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Buttons & Controls */
.btn, button { 
  display:inline-flex; 
  justify-content:center; 
  align-items:center; 
  gap:8px; 
  min-height:42px; 
  padding:8px 20px; 
  border:1px solid var(--green-600); 
  border-radius:10px; 
  background:#fff; 
  color:var(--green-800); 
  font:600 .92rem 'Outfit',sans-serif; 
  cursor:pointer; 
  transition:all .18s ease; 
}
.btn:hover, button:hover { 
  background:var(--green-50); 
  box-shadow:0 4px 12px rgba(45,138,83,.15); 
}
.btn:active, button:active { transform:scale(0.98); }
.btn-primary { background:var(--green-800); color:#fff; border-color:var(--green-800); }
.btn-primary:hover { background:var(--green-600); color:#fff; border-color:var(--green-600); }
.btn-secondary { background:#f1f5f9; color:#334155; border-color:#cbd5e1; }
.btn-secondary:hover { background:#e2e8f0; color:#0f172a; }
.btn-outline { border-color:rgba(255,255,255,.3); background:transparent; color:#fff; }
.btn-outline:hover { background:rgba(255,255,255,.12); }
.btn-danger { background:#ef4444; color:#fff; border-color:#ef4444; }
.btn-danger:hover { background:#dc2626; color:#fff; border-color:#dc2626; box-shadow:0 4px 12px rgba(239,68,68,.2); }
.btn-sm { min-height:34px; padding:4px 14px; font-size:0.84rem; }
button:disabled { opacity:.5; cursor:not-allowed; transform:none; box-shadow:none; }
.btn-link { min-height:auto; padding:0; border:0; color:inherit; background:transparent; cursor:pointer; }
.logout-btn { color:rgba(255,255,255,.8); font-size:1.1rem; padding:6px 10px; border-radius:8px; }
.logout-btn:hover { color:#fff; background:rgba(255,255,255,.18); }
.btn-block { width:100%; }

.stack { display:flex; flex-direction:column; gap:14px; width:100%; }
label { display:grid; gap:6px; font-weight:500; font-size:.92rem; color:var(--ink); }
input, select { 
  width:100%; 
  padding:11px 14px; 
  border:1px solid #cbd5e1; 
  border-radius:10px; 
  background:#fff; 
  color:var(--ink); 
  font:inherit; 
  font-size:16px;
  transition:border-color 0.2s; 
}
input:focus, select:focus { 
  outline:none; 
  border-color:var(--green-600); 
  box-shadow:0 0 0 3px rgba(45,138,83,.15); 
}
.disabled-input, .readonly-input { background:#f1f5f9; color:#64748b; cursor:not-allowed; }

.form-divider { border:none; border-top:1px solid var(--line); margin:12px 0; }
.device-section-title { font-weight:700; color:var(--green-800); font-size:0.98rem; display:flex; align-items:center; gap:8px; margin-bottom:8px; }

.notification-section { display:flex; flex-direction:column; gap:8px; }
.checkbox-label { 
  display:flex !important; 
  align-items:flex-start; 
  gap:10px; 
  cursor:pointer; 
  font-weight:400; 
  font-size:0.92rem; 
  color:var(--ink); 
  user-select:none; 
}
.checkbox-label input[type="checkbox"] { 
  width:20px; 
  height:20px; 
  min-width:20px; 
  min-height:20px; 
  margin-top:2px; 
  accent-color:var(--green-600); 
  cursor:pointer; 
}
.notify-checkbox-grid { display:flex; flex-direction:column; gap:10px; margin-top:6px; }
.notify-threshold-block { background:#f8fafc; padding:12px 14px; border-radius:10px; border:1px solid var(--line); }

/* Push Permission Request Box in Settings */
.push-permission-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--green-50);
  border: 1px solid rgba(45, 138, 83, 0.25);
  border-radius: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.push-permission-info { flex: 1; min-width: 260px; }
.push-permission-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Live Auto-refresh Badge in Archive */
.live-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
}

/* In-App Floating Toasts (Centered at top) */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(92vw, 440px);
  max-width: 92vw;
  pointer-events: none;
}
.toast-item {
  width: 100%;
  pointer-events: auto;
  padding: 14px 18px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  border-left: 4px solid var(--green-600);
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s, transform 0.3s;
}
.toast-danger { border-left-color: #ef4444; background: #fff5f5; }
.toast-warning { border-left-color: #f59e0b; background: #fffdf5; }
.toast-title { font-weight: 700; font-size: 0.90rem; color: #0f172a; margin-bottom: 2px; }
.toast-body { font-size: 0.82rem; color: #475569; line-height: 1.4; }
.toast-fadeout { opacity: 0; transform: translateY(-20px); }

@keyframes slideInToast {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.inline-fields { display:flex; gap:12px; }
.inline-fields label { flex:1; }

.alert { padding:12px 16px; margin:12px 0; border:1px solid; border-radius:10px; font-size:0.92rem; display:flex; align-items:center; gap:8px; }
.alert-ok, .alert-success { color:#166534; background:#f0fdf4; border-color:#bbf7d0; }
.alert-error { color:#991b1b; background:#fef2f2; border-color:#fecaca; }
.alert-info { color:#1e40af; background:#eff6ff; border-color:#bfdbfe; }

.badge { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:999px; font-size:.78rem; font-weight:700; letter-spacing:.02em; }
.badge.on { color:#15803d; background:#dcfce7; }

.badge.off { color:#9a3412; background:#ffedd5; }

/* Period tabs in Archive */
.period-tabs { display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; margin:4px 0; scrollbar-width:none; }
.period-tabs::-webkit-scrollbar { display:none; }
.period-tab { padding:8px 16px; border-radius:8px; background:#f1f5f9; color:#475569; font-weight:600; font-size:0.88rem; white-space:nowrap; transition:all 0.15s; }
.period-tab:hover { background:#e2e8f0; color:#0f172a; }
.period-tab.active { background:var(--green-800); color:#fff; }

/* Linked devices table */
.linked-devices-table-wrap { overflow-x:auto; margin-top:12px; border-radius:10px; border:1px solid var(--line); -webkit-overflow-scrolling:touch; }
.linked-devices-table { width:100%; border-collapse:collapse; font-size:0.90rem; min-width:500px; }
.linked-devices-table th, .linked-devices-table td { padding:10px 14px; border-bottom:1px solid var(--line); text-align:left; }
.linked-devices-table th { background:var(--green-50); color:var(--green-800); font-weight:700; }
.linked-devices-table tr.active-row { background:rgba(45,138,83,0.07); }
.actions-cell { display:flex; align-items:center; gap:8px; }
.active-tag { color:var(--green-600); font-weight:700; font-size:0.82rem; }
.btn-danger-link { color:#ef4444; border:none; background:transparent; padding:4px 8px; border-radius:6px; cursor:pointer; }
.btn-danger-link:hover { background:#fef2f2; color:#dc2626; }

.login-wrap { display:grid; min-height:calc(100vh - 210px); place-items:center; padding:24px 0; }
.login-card { width:min(100%,480px); box-shadow:var(--shadow); border-radius:16px; padding:32px; }
.auth-footer { text-align:center; margin-top:20px; padding-top:16px; border-top:1px solid var(--line); }

/* Modal dialog (Guaranteed 100% Centered on all viewports) */
dialog.modal,
.modal { 
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 16px !important;
  padding: 0 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4) !important;
  background: transparent !important;
  width: min(92vw, 540px) !important;
  max-width: 92vw !important;
  max-height: 90vh !important;
  z-index: 1000 !important;
}
dialog.modal::backdrop,
.modal::backdrop { 
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.modal-card { 
  background: #ffffff; 
  padding: 24px; 
  border-radius: 16px; 
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  width: 100%;
  box-sizing: border-box;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.modal-header h3 { margin:0; display:flex; align-items:center; gap:8px; }
.modal-close { background:none; border:none; font-size:1.5rem; color:var(--muted); cursor:pointer; padding:0; min-height:auto; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }

.empty-device-card { text-align:center; padding:40px 20px; }
.empty-icon { font-size:3rem; color:var(--green-600); margin-bottom:16px; }

/* Sticky Footer (Fixed: No empty space below footer on desktop!) */
.footer { 
  flex-shrink:0;
  margin-top:auto;
  width:100%;
  padding:20px max(16px,calc((100vw - var(--container-max-width))/2)); 
  color:#cbd5e1; 
  background:var(--green-900); 
  font-size:.88rem; 
  text-align:center; 
}

/* 📱 NATIVE MOBILE BOTTOM NAVIGATION BAR (Sleek & Reduced Height) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background: #ffffff;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 150;
  box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.05);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  padding: 2px 0;
}
.bottom-nav-item i {
  font-size: 1.10rem;
  transition: transform 0.15s ease;
}
.bottom-nav-item:hover, .bottom-nav-item.active {
  color: var(--green-600);
}
.bottom-nav-item.active i {
  color: var(--green-600);
  transform: translateY(-1px);
}

/* 📱 SLIDE-OVER MOBILE DRAWER */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}
.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(84vw, 360px);
  background: #ffffff;
  z-index: 310;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--green-900), var(--green-800));
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-avatar {
  font-size: 1.8rem;
  color: #4ade80;
}
.drawer-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}
.drawer-user-login {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.75);
}
.drawer-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.drawer-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.drawer-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.drawer-devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-device-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  transition: all 0.15s;
}
.drawer-device-card.active {
  background: var(--green-100);
  border-color: var(--green-500);
}
.drawer-device-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--green-900);
}
.drawer-device-id {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.90rem;
  transition: background 0.15s;
}
.drawer-nav-link i {
  font-size: 1.10rem;
  color: var(--green-600);
  width: 20px;
  text-align: center;
}
.drawer-nav-link:hover, .drawer-nav-link.active {
  background: var(--green-50);
  color: var(--green-800);
}

.drawer-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.btn-drawer-logout {
  color: #ef4444 !important;
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

/* 📱 MOBILE RESPONSIVE MEDIA QUERIES */
@media (max-width: 860px) {
  body.has-bottom-nav {
    padding-bottom: calc(var(--bottom-bar-height) + 16px);
  }

  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }

  /* Compact Sleek Topbar on Mobile */
  .topbar-inner {
    min-height: 46px;
    height: 46px;
    padding: 0 4px;
  }
  .brand {
    font-size: 1.10rem;
  }

  .device-btn {
    padding: 4px 8px;
    font-size: 0.76rem;
    min-height: 30px;
  }
  .device-title {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .container {
    width: min(100% - 20px, 1380px);
    padding: 14px 0 28px;
  }

  .card {
    padding: 16px 14px;
    border-radius: 12px;
    margin: 10px 0;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .dashboard-header .btn {
    width: 100%;
  }

  /* Compact 2-column Gauges on Mobile */
  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .gauge-card {
    padding: 12px 10px;
    min-height: 94px;
  }
  .gauge-label {
    font-size: 0.72rem;
  }
  .gauge-value {
    font-size: 1.15rem;
  }
  .gauge-unit {
    font-size: 0.74rem;
  }
  .gauge-status {
    display: none;
  }
  .gauge-circle-wrap {
    width: 52px;
    height: 52px;
    margin-left: 4px;
  }
  .gauge-icon {
    font-size: 0.95rem;
  }

  .chart-wrapper {
    height: 190px;
    max-height: 190px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-block-mobile {
    width: 100%;
  }

  .inline-fields {
    flex-direction: column;
    gap: 8px;
  }

  .login-card {
    padding: 22px 16px;
  }

  .modal-card {
    padding: 20px 16px;
  }
  .modal-actions {
    flex-direction: column;
  }
  .modal-actions .btn {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
  .gauge-status {
    display: block;
  }
}
