:root {
  --bg: #050b12;
  --sidebar-bg: linear-gradient(180deg, rgba(2, 9, 18, 0.95), rgba(1, 7, 14, 0.94));
  --glass: rgba(5, 14, 24, 0.42);
  --glass-strong: rgba(4, 12, 22, 0.52);
  --glass-soft: rgba(7, 17, 28, 0.33);
  --border: rgba(255, 255, 255, 0.14);
  --text: #fff;
  --muted: rgba(236, 244, 248, 0.88);
  --muted-soft: rgba(236, 244, 248, 0.66);
  --green: #84ff1f;
  --green-glow: rgba(132, 255, 31, 0.45);
  --cyan: #2eddff;
  --cyan-glow: rgba(46, 221, 255, 0.45);
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.22);
  --radius-xl: 28px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}
body {
  display: grid;
  place-items: center;
  overflow: hidden;
}
button, input, select { font: inherit; }

.dashboard {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: clamp(84px, 7vw, 128px) 1fr;
  background: #01060d;
}

.sidebar {
  padding: clamp(16px, 1.4vw, 28px) clamp(10px, 1vw, 18px);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 2vw, 34px);
  backdrop-filter: blur(10px);
}
.sidebar__clock {
  width: 100%;
  text-align: center;
  font-size: clamp(20px, 1.45vw, 28px);
  letter-spacing: .05em;
  color: rgba(255,255,255,0.92);
}
.sidebar__nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1vw, 18px);
}
.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: #fff;
  border-radius: 22px;
  padding: clamp(12px, .95vw, 18px) clamp(8px, .7vw, 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: .25s ease;
}
.nav-item.active,
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.07);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 10px 24px rgba(0,0,0,0.14);
}
.nav-item__icon {
  width: clamp(24px, 1.9vw, 36px);
  height: clamp(24px, 1.9vw, 36px);
  display: grid;
  place-items: center;
}
.nav-item__label {
  font-size: clamp(12px, .9vw, 15px);
  color: var(--muted);
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--pv { color: var(--green); }
.icon--battery { color: var(--green); }
.icon--grid { color: var(--green); }
.icon--home { color: #fff; }
.icon--car { color: #fff; }
.icon--stats { color: #fff; }
.icon--settings { color: #fff; }
.cyan { color: var(--cyan) !important; }

.scene {
  position: relative;
  overflow: hidden;
  background: #0b1420;
}
.scene__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scene__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5,10,16,0.04) 0%, rgba(5,10,16,0.04) 55%, rgba(5,10,16,0.16) 76%, rgba(5,10,16,0.24) 100%),
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.08), transparent 30%);
  pointer-events: none;
}

.topbar {
  position: absolute;
  z-index: 4;
  top: clamp(18px, 2vw, 34px);
  left: clamp(18px, 2.2vw, 42px);
  right: clamp(18px, 2.4vw, 42px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.pill-select,
.glass-card,
.node-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(8, 16, 28, 0.48), rgba(6, 13, 24, 0.36));
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}
.pill-select {
  border-radius: 28px;
  min-width: clamp(180px, 15vw, 290px);
  padding: clamp(12px, .9vw, 18px) clamp(18px, 1.2vw, 24px);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: clamp(18px, 1.5vw, 28px);
}
.pill-select__chevron {
  font-size: 0.9em;
  opacity: 0.9;
}
.weather-mini {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.5vw, 28px);
  color: rgba(255,255,255,0.95);
  font-size: clamp(16px, 1.25vw, 24px);
  text-shadow: 0 2px 10px rgba(0,0,0,0.22);
}
.weather-mini__icon { opacity: .92; }

.overlay-nodes {
  position: absolute;
  inset: 0;
  z-index: 5;
}
.node-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: clamp(10px, .8vw, 16px);
  min-width: min(260px, 22vw);
  padding: clamp(14px, .95vw, 18px) clamp(14px, 1.05vw, 20px);
  border-radius: 24px;
}
.node-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 38%, rgba(255,255,255,0));
  pointer-events: none;
}
.node-card::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% - 2px);
  width: 2px;
  height: clamp(42px, 4.2vw, 74px);
  opacity: .85;
}
.node-card[data-line="green"]::after {
  background: linear-gradient(var(--green), rgba(132,255,31,0));
  box-shadow: 0 0 14px var(--green-glow);
}
.node-card[data-line="blue"]::after {
  background: linear-gradient(var(--cyan), rgba(46,221,255,0));
  box-shadow: 0 0 14px var(--cyan-glow);
}
.node-card__icon {
  width: clamp(28px, 2vw, 40px);
  height: clamp(28px, 2vw, 40px);
  flex: 0 0 auto;
}
.node-card__content small,
.node-card__content em {
  display: block;
  white-space: nowrap;
}
.node-card__content small {
  font-size: clamp(13px, .85vw, 16px);
  color: var(--muted);
  margin-bottom: 4px;
}
.node-card__content strong {
  display: block;
  font-weight: 650;
  font-size: clamp(24px, 1.7vw, 34px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.node-card__content em {
  margin-top: 5px;
  font-style: normal;
  font-size: clamp(12px, .8vw, 15px);
  color: rgba(242,247,250,0.86);
}
.node-card__dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px var(--green-glow);
}
.node-card__dot--blue {
  background: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
}

.node-card--pv { top: 11.5%; left: 54%; transform: translateX(-50%); }
.node-card--car { top: 37.8%; left: 2.8%; }
.node-card--home { top: 61%; left: 31.5%; }
.node-card--battery { top: 61%; left: 56%; }
.node-card--grid { top: 61%; left: 79.8%; transform: translateX(-50%); }

.bottom-summary {
  position: absolute;
  z-index: 6;
  left: clamp(16px, 2vw, 36px);
  right: clamp(16px, 2vw, 36px);
  bottom: clamp(16px, 2vw, 32px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1vw, 18px);
}
.glass-card {
  position: relative;
  min-height: clamp(180px, 15vw, 260px);
  padding: clamp(18px, 1.2vw, 22px);
  border-radius: 28px;
  overflow: hidden;
}
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(130deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03) 36%, rgba(255,255,255,0));
  pointer-events: none;
}
.metric-card__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.metric-card__title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.metric-card__head b {
  font-size: clamp(16px, 1.15vw, 24px);
  color: #fff;
}
.metric-card__head mark {
  margin-left: auto;
  background: transparent;
  color: var(--green);
  font-size: clamp(14px, .95vw, 18px);
}
.metric-card__head .cyan-text { color: var(--cyan); }
.metric-card__icon {
  width: clamp(28px, 1.8vw, 36px);
  height: clamp(28px, 1.8vw, 36px);
}
.metric-card__value {
  position: relative;
  z-index: 1;
  margin-top: clamp(18px, 1.6vw, 26px);
  font-size: clamp(32px, 2.6vw, 54px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}
.metric-card__value small {
  font-size: clamp(18px, 1.2vw, 24px);
}
.glass-card p {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(14px, .92vw, 17px);
}
.glass-card canvas {
  position: absolute;
  left: 40%;
  right: 16px;
  bottom: 16px;
  height: clamp(54px, 4.6vw, 82px);
  width: auto;
}

.battery-overview__body {
  position: relative;
  z-index: 1;
  margin-top: clamp(18px, 1.5vw, 24px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}
.battery-overview__left .metric-card__value {
  margin-top: 0;
}
.battery-overview__right {
  text-align: right;
  color: #fff;
  font-size: clamp(18px, 1.15vw, 22px);
}
.battery-overview__right small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(14px, .92vw, 17px);
}
.battery-progress {
  position: absolute;
  left: clamp(18px, 1.2vw, 22px);
  right: clamp(18px, 1.2vw, 22px);
  bottom: clamp(18px, 1.2vw, 22px);
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
}
.battery-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #57e915, #9eff1d);
  box-shadow: 0 0 14px rgba(132,255,31,0.28);
  transition: width .35s ease;
}

@media (max-width: 1420px) {
  .node-card--car { left: 2%; }
  .node-card--home { left: 28%; }
  .node-card--battery { left: 52%; }
  .node-card--grid { left: 79%; }
  .bottom-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
    display: block;
  }
  .dashboard {
    min-height: 100vh;
    height: auto;
    display: block;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 14px 16px;
    gap: 12px;
  }
  .sidebar__nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }
  .nav-item { border-radius: 18px; }

  .scene {
    min-height: 1220px;
  }
  .topbar {
    top: 16px;
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
  }
  .weather-mini { justify-content: space-between; }

  .overlay-nodes {
    top: 104px;
    left: 16px;
    right: 16px;
    bottom: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .node-card {
    position: relative;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    min-width: 0;
    width: 100%;
  }
  .node-card::after { display: none; }

  .bottom-summary {
    left: 16px;
    right: 16px;
    bottom: 16px;
    top: 520px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sidebar__clock { font-size: 18px; }
  .nav-item__label { font-size: 11px; }
  .scene {
    min-height: 1480px;
  }
  .pill-select {
    min-width: 0;
    width: 100%;
    font-size: 20px;
  }
  .weather-mini {
    font-size: 16px;
    flex-wrap: wrap;
  }
  .overlay-nodes {
    grid-template-columns: 1fr;
    top: 132px;
  }
  .bottom-summary {
    top: 700px;
    grid-template-columns: 1fr;
  }
  .glass-card {
    min-height: 180px;
  }
  .glass-card canvas {
    left: 46%;
    right: 14px;
  }
  .battery-overview__body {
    flex-direction: column;
    align-items: flex-start;
  }
  .battery-overview__right {
    text-align: left;
  }
}
