:root {
  color-scheme: light;
  --ink: #18312b;
  --muted: #697a73;
  --paper: #f5f4ee;
  --card: #fffefa;
  --line: #dfe2da;
  --solar: #f2b84b;
  --solar-soft: #fff3ce;
  --mint: #bedfce;
  --mint-deep: #2d785e;
  --blue: #557d8b;
  --danger: #b85d4f;
  --shadow: 0 18px 60px rgba(39, 58, 50, 0.08);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 4%, rgba(255, 255, 255, 0.9), transparent 27rem),
    var(--paper);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(24, 49, 43, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 31px;
  height: 31px;
  display: inline-flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  padding-bottom: 7px;
}

.brand-mark span {
  width: 4px;
  border-radius: 3px;
  background: var(--solar);
  transform: rotate(-12deg);
}

.brand-mark span:nth-child(1) {
  height: 8px;
}

.brand-mark span:nth-child(2) {
  height: 13px;
}

.brand-mark span:nth-child(3) {
  height: 18px;
}

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

.connection-pill,
.refresh-button {
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.connection-pill {
  padding: 0 15px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--solar);
  box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.18);
}

.connection-pill.is-online .status-dot {
  background: #4fa575;
  box-shadow: 0 0 0 4px rgba(79, 165, 117, 0.15);
}

.connection-pill.is-offline .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(184, 93, 79, 0.13);
}

.refresh-button {
  padding: 0 16px;
  border: 1px solid var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.refresh-button:hover {
  color: var(--paper);
  background: var(--ink);
}

.refresh-button:active {
  transform: translateY(1px);
}

.refresh-button:focus-visible {
  outline: 3px solid rgba(242, 184, 75, 0.55);
  outline-offset: 2px;
}

.refresh-button.is-loading .refresh-icon {
  animation: spin 700ms linear infinite;
}

main {
  padding: 58px 0 30px;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 40px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 11px;
  color: var(--mint-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  max-width: 670px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.last-update {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  line-height: 1.7;
}

.last-update time {
  display: block;
  color: var(--ink);
  font-weight: 700;
}

.energy-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-bottom: 18px;
}

.flow-widget {
  position: relative;
  margin-bottom: 18px;
  overflow: hidden;
  padding: 29px 32px 20px;
  color: white;
  background:
    radial-gradient(circle at 50% 47%, rgba(190, 223, 206, 0.13), transparent 24%),
    radial-gradient(circle at 12% 8%, rgba(242, 184, 75, 0.1), transparent 27%),
    linear-gradient(145deg, #193b33 0%, #102b25 52%, #0d241f 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  box-shadow: 0 22px 70px rgba(20, 45, 38, 0.18);
}

.flow-widget::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(255, 255, 255, 0.2) 0.6px, transparent 0.6px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.flow-widget-header,
.flow-widget-footer {
  position: relative;
  z-index: 5;
}

.flow-widget-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

.flow-kicker {
  margin: 0 0 8px;
  color: var(--solar);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.flow-widget h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3vw, 35px);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.flow-live {
  min-height: 33px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.67);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #78d7a6;
  box-shadow: 0 0 0 4px rgba(120, 215, 166, 0.12);
  animation: pulse 1.9s ease infinite;
}

.flow-stage {
  position: relative;
  z-index: 2;
  width: min(100%, 1000px);
  height: 480px;
  margin: -2px auto 0;
}

.flow-node,
.flow-core {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
}

button.flow-node,
button.flow-core {
  color: white;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.flow-core {
  padding: 0;
  background: transparent;
  border: 0;
}

.flow-node:focus-visible,
.flow-core:focus-visible,
.back-button:focus-visible {
  outline: 3px solid var(--solar);
  outline-offset: 4px;
}

.flow-node {
  --node-accent: var(--mint);
  width: 204px;
  min-height: 116px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
  transition:
    border-color 350ms ease,
    box-shadow 350ms ease,
    background 350ms ease;
}

.flow-node.is-active {
  background: rgba(255, 255, 255, 0.09);
  border-color: color-mix(in srgb, var(--node-accent) 62%, transparent);
  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.14),
    0 0 28px color-mix(in srgb, var(--node-accent) 13%, transparent);
}

.flow-node-solar {
  --node-accent: #f4c45f;
  top: 13%;
  left: 50%;
}

.flow-node-grid {
  --node-accent: #8dc5d1;
  top: 50%;
  left: 14%;
}

.flow-node-home {
  --node-accent: #f7f1dc;
  top: 50%;
  left: 86%;
}

.flow-node-battery {
  --node-accent: #78d7a6;
  top: 87%;
  left: 50%;
}

.flow-node-icon {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
}

.flow-node-content {
  flex: 1 1 auto;
  min-width: 0;
}

.flow-node-content p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-node-content p {
  margin: 0 0 5px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.flow-node-content > div {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.flow-node-content strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.flow-node-battery .flow-node-content strong {
  font-size: 35px;
}

.flow-node-content > div span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 750;
}

.flow-node-content small {
  display: block;
  min-height: 20px;
  margin-top: 7px;
  color: var(--node-accent);
  font-size: 9px;
  font-weight: 650;
  line-height: 1.3;
  white-space: normal;
}

.solar-node-icon {
  overflow: visible;
}

.mini-sun {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  color: #f7d06f;
  background: rgba(244, 196, 95, 0.14);
  border-radius: 50%;
  font-size: 10px;
}

.mini-panel {
  position: absolute;
  left: 8px;
  bottom: 10px;
  width: 30px;
  height: 21px;
  display: flex;
  gap: 2px;
  padding: 3px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px) 0 50% / 100% 8px,
    #315c68;
  border: 1px solid #8dc5d1;
  border-radius: 3px;
  transform: skew(-8deg);
}

.mini-panel i {
  flex: 1;
  border-right: 1px solid rgba(255, 255, 255, 0.24);
}

.grid-node-icon > span {
  position: absolute;
  bottom: 7px;
  width: 29px;
  height: 34px;
  border-right: 2px solid #8dc5d1;
  border-left: 2px solid #8dc5d1;
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
}

.grid-node-icon > i {
  position: absolute;
  width: 30px;
  height: 1.5px;
  background: #8dc5d1;
}

.grid-node-icon > i:nth-of-type(1) {
  top: 16px;
}

.grid-node-icon > i:nth-of-type(2) {
  top: 24px;
  width: 24px;
}

.grid-node-icon > i:nth-of-type(3) {
  top: 32px;
  width: 17px;
}

.home-node-icon .mini-roof {
  position: absolute;
  top: 9px;
  left: 14px;
  width: 22px;
  height: 22px;
  border-top: 2px solid #f7f1dc;
  border-left: 2px solid #f7f1dc;
  transform: rotate(45deg);
  border-radius: 2px;
}

.home-node-icon .mini-house {
  position: absolute;
  left: 12px;
  bottom: 8px;
  width: 27px;
  height: 23px;
  display: flex;
  align-items: end;
  gap: 5px;
  padding: 6px 5px 0;
  background: #1c4037;
  border-right: 2px solid #f7f1dc;
  border-bottom: 2px solid #f7f1dc;
  border-left: 2px solid #f7f1dc;
}

.home-node-icon .mini-house i:first-child {
  width: 6px;
  height: 7px;
  border: 1.5px solid var(--solar);
}

.home-node-icon .mini-house i:last-child {
  width: 6px;
  height: 13px;
  margin-left: auto;
  border: 1.5px solid var(--mint);
  border-bottom: 0;
}

.battery-node-icon > span {
  position: relative;
  width: 24px;
  height: 37px;
  display: flex;
  align-items: end;
  padding: 3px;
  border: 2px solid #78d7a6;
  border-radius: 5px;
}

.battery-node-icon > span::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 7px;
  width: 7px;
  height: 4px;
  background: #78d7a6;
  border-radius: 2px 2px 0 0;
}

.battery-node-icon > span i {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  width: auto;
  height: 0%;
  max-height: 100%;
  background: #78d7a6;
  border-radius: 2px;
  transition: height 600ms ease;
}

.battery-node-icon > span b {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-shadow: 0 1px 5px rgba(9, 35, 28, 0.7);
}

.flow-node-battery .flow-node-icon {
  flex-basis: 62px;
  width: 62px;
  height: 68px;
  background: rgba(120, 215, 166, 0.07);
  border-color: rgba(120, 215, 166, 0.2);
}

.flow-node-battery .battery-node-icon > span {
  width: 43px;
  height: 54px;
  padding: 3px;
  border-color: #78d7a6;
  border-radius: 7px;
}

.flow-node-battery .battery-node-icon > span::before {
  top: -6px;
  left: 13px;
  width: 12px;
  height: 5px;
}

.flow-node-battery .battery-node-icon > span b {
  font-size: 13px;
}

.flow-core {
  top: 50%;
  left: 50%;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.flow-core-rings,
.flow-core-rings i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.flow-core-rings {
  inset: -12px;
  border: 1px solid rgba(190, 223, 206, 0.13);
}

.flow-core-rings i:first-child {
  border-top: 1px solid rgba(120, 215, 166, 0.68);
  border-right: 1px solid transparent;
  animation: orbit 8s linear infinite;
}

.flow-core-rings i:last-child {
  inset: 8px;
  border-bottom: 1px dashed rgba(244, 196, 95, 0.45);
  animation: orbit 13s linear infinite reverse;
}

.flow-core-inner {
  position: relative;
  z-index: 2;
  width: 106px;
  height: 106px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.09), transparent 50%),
    #1a4439;
  border: 1px solid rgba(190, 223, 206, 0.35);
  border-radius: 50%;
  box-shadow:
    0 0 0 8px rgba(120, 215, 166, 0.035),
    0 18px 40px rgba(0, 0, 0, 0.27),
    inset 0 0 24px rgba(120, 215, 166, 0.05);
}

.flow-core-inner > span {
  color: var(--solar);
  font-family: Georgia, serif;
  font-size: 29px;
  line-height: 1;
}

.flow-core-inner strong {
  margin-top: 5px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.flow-core-inner small {
  position: relative;
  margin-top: 5px;
  padding-left: 10px;
  color: var(--mint);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.flow-core-inner small::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 5px;
  height: 5px;
  background: #78d7a6;
  border-radius: 50%;
  box-shadow: 0 0 8px #78d7a6;
}

.flow-link {
  --flow-color: var(--mint);
  --flow-speed: 0.9s;
  position: absolute;
  z-index: 1;
  opacity: 0.5;
}

.flow-link::before,
.flow-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.flow-link::before {
  background: rgba(190, 223, 206, 0.16);
}

.flow-link::after {
  opacity: 0;
  filter: drop-shadow(0 0 5px var(--flow-color));
  transition: opacity 250ms ease;
}

.flow-link.is-active {
  opacity: 1;
}

.flow-link.is-active::after {
  opacity: 1;
}

.flow-link-horizontal {
  height: 2px;
}

.flow-link-horizontal::after {
  top: -3px;
  bottom: -3px;
  background:
    radial-gradient(circle, var(--flow-color) 0 2.5px, transparent 3px)
    left center / 18px 8px repeat-x;
}

.flow-link-horizontal.is-active::after {
  animation: flow-x var(--flow-speed) linear infinite;
}

.flow-link-vertical {
  width: 2px;
}

.flow-link-vertical::after {
  right: -3px;
  left: -3px;
  background:
    radial-gradient(circle, var(--flow-color) 0 2.5px, transparent 3px)
    center top / 8px 18px repeat-y;
}

.flow-link-vertical.is-active::after {
  animation: flow-y var(--flow-speed) linear infinite;
}

.flow-link.is-reverse::after {
  animation-direction: reverse;
}

.flow-link-solar {
  --flow-color: #f4c45f;
  top: 24%;
  left: 50%;
  height: 13%;
}

.flow-link-grid {
  --flow-color: #8dc5d1;
  top: 50%;
  left: 24%;
  width: 19%;
}

.flow-link-home {
  --flow-color: #f7f1dc;
  top: 50%;
  left: 57%;
  width: 19%;
}

.flow-link-battery {
  --flow-color: #78d7a6;
  top: 63%;
  left: 50%;
  height: 13%;
}

.flow-widget-footer {
  min-height: 47px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: -4px;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
}

.flow-story-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #17392f;
  background: var(--solar);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 800;
}

.flow-widget-footer p {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.overview-screen[hidden],
.detail-screen[hidden] {
  display: none;
}

.detail-screen {
  animation: detail-in 280ms ease both;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.back-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(24, 49, 43, 0.22);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.back-button span {
  font-size: 17px;
}

.detail-update {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.detail-hero {
  position: relative;
  min-height: 278px;
  overflow: hidden;
  padding: 37px 40px;
  color: white;
  background:
    radial-gradient(circle at 85% 20%, rgba(242, 184, 75, 0.24), transparent 25%),
    radial-gradient(circle at 65% 92%, rgba(120, 215, 166, 0.18), transparent 31%),
    linear-gradient(135deg, #21483d, #102b25 62%);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 25px;
  box-shadow: var(--shadow);
}

.detail-hero::after {
  content: "";
  position: absolute;
  top: -90px;
  right: -30px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgba(255, 255, 255, 0.035),
    0 0 0 56px rgba(255, 255, 255, 0.025);
}

.detail-hero .eyebrow {
  position: relative;
  z-index: 1;
  color: var(--solar);
}

.detail-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 550px;
  color: white;
  font-size: clamp(37px, 5vw, 59px);
}

.detail-hero > p:not(.eyebrow) {
  position: relative;
  z-index: 1;
  max-width: 450px;
  margin: 13px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.5;
}

.detail-primary {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 28px;
}

.detail-primary strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(47px, 7vw, 80px);
  font-weight: 500;
  line-height: 0.8;
  letter-spacing: -0.06em;
}

.detail-primary span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 17px;
  font-weight: 750;
}

.detail-eta {
  position: absolute;
  top: 37px;
  right: 34px;
  z-index: 1;
  width: min(30%, 224px);
  padding: 16px 18px;
  color: white;
  background: rgba(7, 29, 24, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.detail-eta span,
.detail-eta small {
  display: block;
  color: rgba(255, 255, 255, 0.63);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-eta strong {
  display: block;
  margin: 7px 0 6px;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(31px, 3.4vw, 46px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.detail-eta small {
  color: var(--mint);
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
}

.detail-state {
  position: absolute;
  right: 31px;
  bottom: 27px;
  z-index: 1;
  padding: 7px 10px;
  color: var(--mint);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.detail-data-card {
  min-height: 157px;
  padding: 22px 21px;
  background: var(--card);
  border: 1px solid rgba(24, 49, 43, 0.1);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(39, 58, 50, 0.05);
}

.detail-data-card p {
  min-height: 28px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-data-card > div {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 11px;
}

.detail-data-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.detail-data-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.detail-data-card small {
  display: block;
  margin-top: 14px;
  color: rgba(24, 49, 43, 0.67);
  font-size: 10px;
  line-height: 1.4;
}

.detail-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.insight-grid .detail-card {
  min-height: 236px;
  padding: 25px 26px;
}

.insight-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.insight-heading .detail-label {
  margin-bottom: 7px;
}

.insight-heading h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.insight-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #d56c3e;
  background: #fff1e8;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 700;
}

.solar-insight-icon {
  color: #9d6b08;
  background: var(--solar-soft);
  font-size: 16px;
}

.battery-insight-icon {
  color: var(--mint-deep);
  background: #e3f3ea;
  font-size: 20px;
}

.temperature-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 25px;
}

.temperature-list > div {
  padding: 11px 8px;
  text-align: center;
  background: #fff6f0;
  border-radius: 11px;
}

.temperature-list span,
.temperature-list small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.temperature-list strong {
  display: inline-block;
  margin-top: 5px;
  color: #a84f31;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.05em;
}

.temperature-list small {
  display: inline;
  margin-left: 2px;
}

.string-line {
  margin-top: 17px;
}

.string-line > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.string-line > div:first-child strong {
  color: var(--ink);
  font-size: 11px;
}

.string-line > div:first-child b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.string-bar {
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  background: #edf0e8;
  border-radius: 999px;
}

.string-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #e1a932, var(--solar));
  border-radius: inherit;
  transition: width 600ms ease;
}

.string-line small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.estimate-card {
  color: white;
  background:
    radial-gradient(circle at 80% 100%, rgba(120, 215, 166, 0.26), transparent 43%),
    #1a4439;
  border-color: #1a4439;
}

.estimate-card .detail-label,
.estimate-card .insight-heading h3,
.estimate-card #batteryEstimateTitle,
.estimate-card #batteryEstimateNote {
  color: white;
}

.estimate-card .detail-label {
  opacity: 0.65;
}

.estimate-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 31px;
}

.estimate-value strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.055em;
}

.estimate-value span {
  color: var(--mint);
  font-size: 13px;
  font-weight: 750;
}

.estimate-card #batteryEstimateTitle {
  margin: 9px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.estimate-card #batteryEstimateNote {
  margin: 17px 0 0;
  color: var(--mint);
  font-size: 10px;
  line-height: 1.4;
}

.hero-metric,
.home-card,
.detail-card {
  overflow: hidden;
  border: 1px solid rgba(24, 49, 43, 0.11);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-metric {
  position: relative;
  min-height: 298px;
  padding: 31px 34px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.2), transparent 55%),
    var(--solar);
}

.metric-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 750;
}

.metric-icon {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #805a0c;
  background: rgba(255, 255, 255, 0.48);
  font-size: 15px;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 37px;
}

.metric-value strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(64px, 8vw, 102px);
  font-weight: 500;
  line-height: 0.8;
  letter-spacing: -0.065em;
}

.metric-value span {
  font-size: 19px;
  font-weight: 700;
}

.hero-metric p {
  position: relative;
  z-index: 2;
  margin: 26px 0 0;
  color: rgba(24, 49, 43, 0.72);
  font-size: 13px;
  font-weight: 600;
}

.spark-bars {
  position: absolute;
  right: 25px;
  bottom: 0;
  width: 42%;
  height: 116px;
  display: flex;
  align-items: end;
  gap: 6px;
  opacity: 0.28;
}

.spark-bars i {
  flex: 1;
  height: var(--h);
  min-width: 4px;
  background: var(--ink);
  border-radius: 8px 8px 0 0;
}

.home-card {
  min-height: 298px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px 32px 27px;
  background: var(--ink);
  color: white;
}

.house-visual {
  position: relative;
  width: 90px;
  height: 67px;
  margin: 4px 0 8px;
}

.roof {
  position: absolute;
  top: 6px;
  left: 18px;
  width: 57px;
  height: 57px;
  border-left: 2px solid var(--mint);
  border-top: 2px solid var(--mint);
  transform: rotate(45deg);
  border-radius: 3px;
}

.house-body {
  position: absolute;
  left: 21px;
  bottom: 0;
  width: 55px;
  height: 43px;
  display: flex;
  align-items: end;
  gap: 6px;
  padding: 9px;
  background: var(--ink);
  border-right: 2px solid var(--mint);
  border-bottom: 2px solid var(--mint);
  border-left: 2px solid var(--mint);
}

.house-body span {
  width: 10px;
  height: 11px;
  border: 2px solid var(--solar);
}

.house-body i {
  width: 12px;
  height: 23px;
  margin-left: auto;
  border: 2px solid var(--mint);
  border-bottom: 0;
}

.home-card p {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 13px;
}

.home-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.home-value strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 51px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.05em;
}

.home-value span {
  color: rgba(255, 255, 255, 0.73);
  font-size: 15px;
  font-weight: 700;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 17px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.live-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  animation: pulse 1.9s ease infinite;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.detail-card {
  min-height: 204px;
  padding: 26px 27px 23px;
  background: var(--card);
}

/* Debe ir después de .detail-card: conserva el fondo oscuro de la ETA. */
.insight-grid .estimate-card {
  order: -1;
  color: white;
  background:
    radial-gradient(circle at 80% 100%, rgba(120, 215, 166, 0.26), transparent 43%),
    #1a4439;
  border-color: #1a4439;
}

.detail-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.detail-label {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.detail-value strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 46px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.045em;
}

.detail-value span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.battery-gauge {
  position: relative;
  width: 37px;
  height: 67px;
  display: flex;
  align-items: end;
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: 7px;
}

.battery-gauge::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 10px;
  width: 13px;
  height: 5px;
  background: var(--ink);
  border-radius: 3px 3px 0 0;
}

.battery-gauge div {
  width: 100%;
  height: 0%;
  max-height: 100%;
  border-radius: 3px;
  background: var(--mint-deep);
  transition: height 600ms ease;
}

.detail-divider {
  margin: 25px 0 16px;
  border-top: 1px solid var(--line);
}

.detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.detail-foot strong {
  color: var(--ink);
  font-size: 12px;
}

.grid-symbol {
  position: relative;
  width: 65px;
  height: 65px;
  display: flex;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f1f4f1;
}

.grid-symbol i {
  width: 2px;
  height: 39px;
  margin-top: 13px;
  background: var(--blue);
  transform: rotate(var(--r, 0deg));
}

.grid-symbol i:first-child {
  --r: -18deg;
}

.grid-symbol i:last-child {
  --r: 18deg;
}

.direction-badge {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(85, 125, 139, 0.11);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.balance-card {
  background: var(--mint);
}

.balance-card .detail-label {
  color: rgba(24, 49, 43, 0.66);
}

.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 23px;
  font-size: 12px;
  font-weight: 700;
}

.balance-row strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  font-weight: 500;
}

.progress-track {
  height: 8px;
  margin-top: 13px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.52);
  border-radius: 999px;
}

.progress-track div {
  width: 0;
  height: 100%;
  background: var(--ink);
  border-radius: inherit;
  transition: width 600ms ease;
}

.balance-note {
  margin: 23px 0 0;
  color: rgba(24, 49, 43, 0.67);
  font-size: 11px;
  line-height: 1.45;
}

.notice {
  margin-top: 18px;
  padding: 16px 19px;
  display: flex;
  align-items: start;
  gap: 12px;
  border: 1px solid rgba(184, 93, 79, 0.24);
  border-radius: 14px;
  color: #6e332b;
  background: #fff2e8;
}

.notice[hidden] {
  display: none;
}

.notice-icon {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--danger);
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.notice strong {
  display: block;
  margin: 1px 0 3px;
  font-size: 12px;
}

.notice p {
  margin: 0;
  color: rgba(110, 51, 43, 0.77);
  font-size: 11px;
  line-height: 1.5;
}

footer {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  border-top: 1px solid rgba(24, 49, 43, 0.1);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.footer-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes flow-x {
  to {
    background-position: 18px center;
  }
}

@keyframes flow-y {
  to {
    background-position: center 18px;
  }
}

@media (max-width: 860px) {
  .energy-overview {
    grid-template-columns: minmax(0, 1.3fr) minmax(250px, 0.7fr);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .balance-card {
    grid-column: 1 / -1;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-stage {
    height: 450px;
  }

  .flow-node {
    width: 172px;
  }

  .flow-node-grid {
    left: 15%;
  }

  .flow-node-home {
    left: 85%;
  }

  .flow-link-grid {
    left: 25%;
    width: 18%;
  }

  .flow-link-home {
    width: 18%;
  }
}

@media (max-width: 650px) {
  .page-shell {
    width: min(100% - 28px, 1180px);
  }

  .topbar {
    min-height: 74px;
  }

  .connection-pill {
    max-width: 137px;
  }

  #connectionText {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .refresh-button {
    width: 40px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }

  .refresh-icon {
    font-size: 18px;
  }

  main {
    padding-top: 38px;
  }

  .intro {
    display: block;
    margin-bottom: 27px;
  }

  h1 {
    font-size: 41px;
  }

  .last-update {
    margin-top: 18px;
    text-align: left;
  }

  .last-update time {
    display: inline;
    margin-left: 5px;
  }

  .energy-overview,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .hero-metric {
    min-height: 250px;
    padding: 25px;
  }

  .home-card {
    min-height: 245px;
    padding: 25px;
  }

  .metric-value {
    margin-top: 30px;
  }

  .metric-value strong {
    font-size: 72px;
  }

  .balance-card {
    grid-column: auto;
  }

  .flow-widget {
    padding: 21px 10px 14px;
    border-radius: 22px;
  }

  .flow-widget-header {
    align-items: center;
  }

  .flow-widget h2 {
    max-width: 190px;
    font-size: 24px;
  }

  .flow-live {
    width: 34px;
    height: 34px;
    min-height: 34px;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  .flow-stage {
    height: 420px;
    margin-top: 8px;
  }

  .flow-node {
    width: 98px;
    min-height: 94px;
    display: block;
    padding: 10px 8px 9px;
    border-radius: 13px;
  }

  .flow-node-icon {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 26px;
    height: 29px;
    border: 0;
    background: transparent;
  }

  .flow-node-content {
    width: 100%;
  }

  .flow-node-content p {
    max-width: 57px;
    margin-bottom: 4px;
    font-size: 7px;
  }

  .flow-node-content strong {
    font-size: 23px;
  }

  .flow-node-battery .flow-node-content strong {
    font-size: 29px;
  }

  .flow-node-content > div span,
  .flow-node-content small {
    font-size: 7px;
  }

  .flow-node-content small {
    width: 100%;
    max-width: none;
    min-height: 19px;
    margin-top: 5px;
    line-height: 1.25;
  }

  .mini-sun {
    top: -2px;
    right: -1px;
    width: 12px;
    height: 12px;
    font-size: 7px;
  }

  .mini-panel {
    left: 1px;
    bottom: 2px;
    width: 27px;
    height: 18px;
  }

  .grid-node-icon > span {
    bottom: 1px;
    width: 25px;
    height: 30px;
  }

  .grid-node-icon > i:nth-of-type(1) {
    top: 9px;
  }

  .grid-node-icon > i:nth-of-type(2) {
    top: 17px;
  }

  .grid-node-icon > i:nth-of-type(3) {
    top: 25px;
  }

  .home-node-icon .mini-roof {
    top: 3px;
    left: 5px;
  }

  .home-node-icon .mini-house {
    left: 3px;
    bottom: 1px;
  }

  .battery-node-icon > span {
    width: 20px;
    height: 31px;
  }

  .flow-node-solar {
    top: 13%;
    width: 132px;
  }

  .flow-node-grid {
    top: 50%;
    left: 0;
    transform: translate(0, -50%);
  }

  .flow-node-home {
    top: 50%;
    right: 0;
    left: auto;
    transform: translate(0, -50%);
  }

  .flow-node-battery {
    top: 87%;
    width: 132px;
  }

  .flow-node-battery .flow-node-icon {
    top: 7px;
    right: 7px;
    width: 42px;
    height: 50px;
  }

  .flow-node-battery .battery-node-icon > span {
    width: 32px;
    height: 41px;
  }

  .flow-node-battery .battery-node-icon > span::before {
    left: 9px;
    width: 9px;
  }

  .flow-node-battery .battery-node-icon > span b {
    font-size: 10px;
  }

  .flow-core {
    width: 68px;
    height: 68px;
  }

  .flow-core-rings {
    inset: -8px;
  }

  .flow-core-inner {
    width: 58px;
    height: 58px;
  }

  .flow-core-inner > span {
    font-size: 17px;
  }

  .flow-core-inner strong {
    margin-top: 2px;
    font-size: 7px;
  }

  .flow-core-inner small {
    margin-top: 3px;
    padding-left: 8px;
    font-size: 5px;
  }

  .flow-link-solar {
    top: 23%;
    height: 17%;
  }

  .flow-link-grid {
    left: 98px;
    width: calc(50% - 132px);
  }

  .flow-link-home {
    left: calc(50% + 34px);
    width: calc(50% - 132px);
  }

  .flow-link-battery {
    top: 60%;
    height: 17%;
  }

  .flow-widget-footer {
    margin-top: 0;
    padding: 10px 12px;
    text-align: left;
  }

  .flow-widget-footer p {
    font-size: 9px;
  }

  .detail-header {
    margin-bottom: 15px;
  }

  .detail-update {
    font-size: 10px;
  }

  .detail-hero {
    min-height: 264px;
    padding: 29px 24px;
    border-radius: 20px;
  }

  .detail-hero h1 {
    font-size: 40px;
  }

  .detail-eta {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    margin-top: 22px;
  }

  .detail-state {
    right: 20px;
    bottom: 19px;
    max-width: calc(100% - 40px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .detail-data-card {
    min-height: 127px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
