:root {
  --bg: #f4f8ff;
  --panel: #ffffff;
  --text: #172034;
  --muted: #4b5d7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 10%, #d7e7ff, var(--bg) 45%, #e6f3ff 100%);
  color: var(--text);
}

.brand-strip {
  padding: 10px 14px;
  border-bottom: 1px solid #d8e4f9;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
}

.brand-primary,
.brand-secondary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-note {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-transform: lowercase;
}

.brand-logo {
  display: block;
  width: 64px;
  height: 56px;
  object-fit: contain;
  object-position: center;
}

.utilus-logo {
  width: 128px;
  height: 112px;
}

.ey-logo {
  width: 64px;
  height: 56px;
}

.greenchoice-logo {
  width: 64px;
  height: 56px;
}

.greenflux-logo {
  width: 64px;
  height: 56px;
}

.shell {
  min-height: calc(100vh - 61px);
  display: grid;
  grid-template-columns: 320px 1fr;
}

.panel {
  border-right: 1px solid #d8e4f9;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  padding: 18px;
}

.panel h1 {
  margin: 0;
  font-size: 1.3rem;
}

.panel p {
  color: var(--muted);
  line-height: 1.35;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.field span {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select {
  border: 1px solid #ceddf7;
  border-radius: 8px;
  height: 38px;
  padding: 0 10px;
  font-size: 0.95rem;
}

.toggles {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.toggles label {
  color: var(--muted);
}

.controls {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.scrub {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.scrub label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.scrub input[type='range'] {
  width: 100%;
}

.controls button {
  border: 1px solid #bcd0f6;
  background: #fff;
  border-radius: 8px;
  height: 36px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 700;
}

.meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.main {
  padding: 14px;
  display: grid;
  grid-template-rows: 280px 1fr;
  gap: 12px;
  min-height: 100vh;
}

.chart-wrap {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d9e6fb;
  border-radius: 14px;
  box-shadow: 0 10px 20px rgba(50, 72, 120, 0.1);
  padding: 10px;
}

#line-chart {
  width: 100%;
  height: 100%;
}

.grid-wrap {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d9e6fb;
  border-radius: 14px;
  box-shadow: 0 10px 20px rgba(50, 72, 120, 0.1);
  padding: 10px;
  overflow: auto;
}

.grid-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #30476e;
  margin-bottom: 8px;
}

.ev-title {
  margin-top: 14px;
}

#battery-section[hidden] {
  display: none;
}

.houses-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(64px, 1fr));
  gap: 8px;
}

.house {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 9px;
  padding: 5px;
  min-height: 56px;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 3px;
  transition: background 0.3s ease;
}

.house-id {
  font-size: 0.64rem;
  color: rgba(17, 24, 39, 0.82);
  font-weight: 700;
}

.house-power {
  font-size: 0.62rem;
  color: rgba(17, 24, 39, 0.84);
}

.house-icons {
  display: flex;
  gap: 4px;
}

.icon-slot {
  width: 11px;
  min-width: 16px;
  height: 12px;
  border-radius: 3px;
  border: 1px dashed rgba(17, 24, 39, 0.5);
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.5rem;
  line-height: 10px;
  text-align: center;
  color: rgba(17, 24, 39, 0.78);
  font-weight: 700;
}

.icon-slot.active-pv {
  border-style: solid;
  border-color: #ca8a04;
  background: #fde68a;
  color: #78350f;
}

.icon-slot.active-hp {
  border-style: solid;
  border-color: #ea580c;
  background: #fdba74;
  color: #7c2d12;
}

.ev-badge {
  margin-left: auto;
  display: inline-block;
  min-width: 18px;
  height: 12px;
  border-radius: 3px;
  background: #111827;
  color: #ffffff;
  font-size: 0.53rem;
  line-height: 12px;
  text-align: center;
  font-weight: 700;
}

.ev-badge[hidden] {
  display: none !important;
}

.ev-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(70px, 1fr));
  gap: 8px;
}

.battery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  gap: 8px;
}

.ev-connector {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 9px;
  min-height: 52px;
  padding: 6px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
  background: #dbe3f2;
  transition: background 0.25s ease;
}

.ev-id {
  font-size: 0.64rem;
  font-weight: 700;
  color: #1f2937;
}

.ev-state {
  font-size: 0.62rem;
  color: #1f2937;
  font-weight: 600;
}

.ev-connector.state-idle {
  background: #dbe3f2;
}

.ev-connector.state-active {
  background: #93c5fd;
}

.ev-connector.state-plugin {
  background: #86efac;
}

.ev-connector.state-plugout {
  background: #fdba74;
}

.ev-connector.state-charging {
  background: #a78bfa;
}

.battery-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  min-height: 76px;
  padding: 8px;
  display: grid;
  gap: 4px;
  background: #dbe3f2;
  transition: background 0.25s ease;
}

.battery-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #1f2937;
}

.battery-state,
.battery-soc,
.battery-profit {
  font-size: 0.66rem;
  font-weight: 600;
  color: #1f2937;
}

.battery-card.state-charge {
  background: #86efac;
}

.battery-card.state-discharge {
  background: #fdba74;
}

.battery-card.state-neutral {
  background: #cbd5e1;
}

@media (max-width: 980px) {
  .brand-strip {
    justify-content: flex-start;
    gap: 10px 14px;
  }

  .brand-secondary {
    width: 100%;
    flex-wrap: wrap;
  }

  .brand-note {
    width: 100%;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid #d8e4f9;
  }

  .main {
    grid-template-rows: 240px 1fr;
  }

  .houses-grid {
    grid-template-columns: repeat(7, minmax(60px, 1fr));
  }

  .ev-grid {
    grid-template-columns: repeat(5, minmax(68px, 1fr));
  }

  .battery-grid {
    grid-template-columns: 1fr;
  }
}
