:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #101412;
  --muted: #69736e;
  --panel: #ffffff;
  --panel-soft: #fbfcf7;
  --line: #e1e5dc;
  --accent: #00a884;
  --accent-dark: #007761;
  --sun: #f2b84b;
  --alert: #e16f5c;
  --blue: #5b8def;
  --shadow: 0 22px 70px rgba(16, 20, 18, 0.1);
  --soft-shadow: 0 10px 32px rgba(16, 20, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 168, 132, 0.16), transparent 340px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0) 420px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1160px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 38px;
}

.toolbar,
.hero-panel,
.summary-panel,
.metric-card,
.chart-section,
.windows-section {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px;
  border-radius: 24px;
  position: sticky;
  top: 12px;
  z-index: 3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 280px;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 18px;
  background: #eef2ea;
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 13px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.app-nav a:hover,
.app-nav a[aria-current="page"] {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(16, 20, 18, 0.08);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 16px;
  background: #101412;
  color: #f7f8ef;
  font-weight: 850;
  font-size: 1.15rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p,
.source-note,
.metric-card small,
.summary-copy p,
.status-meta {
  color: var(--muted);
}

.brand p {
  margin-top: 5px;
  max-width: 520px;
  font-size: 0.94rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(116px, auto));
  align-items: end;
  gap: 8px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 0 12px;
  background: #eef2ea;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: color-mix(in srgb, var(--accent) 62%, #fff);
  box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.12);
}

.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 15px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(0, 168, 132, 0.22);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: clamp(20px, 4vw, 38px);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(16, 20, 18, 0.96), rgba(24, 43, 38, 0.9)),
    #101412;
  color: #f8faf5;
}

.hero-panel h2 {
  margin-top: 4px;
  max-width: 720px;
  font-size: clamp(2.25rem, 7vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-panel p {
  max-width: 720px;
  margin-top: 18px;
  color: rgba(248, 250, 245, 0.72);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.45;
}

.hero-panel .eyebrow,
.hero-panel .status-meta {
  color: rgba(248, 250, 245, 0.65);
}

.status-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 220px;
  font-size: 0.88rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.35fr) repeat(3, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.summary-panel,
.metric-card {
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}

.summary-panel {
  display: flex;
  align-items: center;
  gap: 18px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  flex: 0 0 auto;
  border: 9px solid color-mix(in srgb, var(--accent) 78%, #fff);
  border-radius: 50%;
  background: #f7fff9;
}

.score-ring span {
  display: block;
  font-size: 2.05rem;
  font-weight: 900;
  line-height: 1;
}

.score-ring small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.summary-copy h3,
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
  line-height: 1.05;
}

.summary-copy p {
  margin-top: 10px;
  line-height: 1.45;
}

.metric-card {
  display: grid;
  align-content: space-between;
  min-height: 148px;
  background: var(--panel);
}

.metric-card small {
  display: block;
  margin-top: 12px;
  line-height: 1.35;
}

.grade-badge {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: #ffffff;
  font-size: 2rem;
  font-weight: 950;
  box-shadow: inset 0 -8px 20px rgba(0, 0, 0, 0.16);
}

.grade-a {
  background: #00a884;
}

.grade-b {
  background: #48a85c;
}

.grade-c {
  background: #f2b84b;
}

.grade-d {
  background: #e58b3c;
}

.grade-e {
  background: #e16f5c;
}

.grade-f {
  background: #a9423c;
}

.grade-g {
  background: #812f32;
}

.energy-label {
  display: grid;
  gap: 3px;
  width: min(100%, 122px);
  margin-top: 8px;
}

.energy-label span {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 18px;
  border-radius: 4px 12px 12px 4px;
  padding: 0 8px;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
  opacity: 0.42;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.energy-label span::after {
  content: "";
  position: absolute;
  top: 0;
  right: -9px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
}

.energy-label span:nth-child(1) {
  width: 48%;
  background: #009b72;
}

.energy-label span:nth-child(1)::after {
  border-left: 9px solid #009b72;
}

.energy-label span:nth-child(2) {
  width: 56%;
  background: #51a846;
}

.energy-label span:nth-child(2)::after {
  border-left: 9px solid #51a846;
}

.energy-label span:nth-child(3) {
  width: 64%;
  background: #b9b83a;
}

.energy-label span:nth-child(3)::after {
  border-left: 9px solid #b9b83a;
}

.energy-label span:nth-child(4) {
  width: 72%;
  background: #f1c232;
}

.energy-label span:nth-child(4)::after {
  border-left: 9px solid #f1c232;
}

.energy-label span:nth-child(5) {
  width: 80%;
  background: #ef9235;
}

.energy-label span:nth-child(5)::after {
  border-left: 9px solid #ef9235;
}

.energy-label span:nth-child(6) {
  width: 88%;
  background: #df5f43;
}

.energy-label span:nth-child(6)::after {
  border-left: 9px solid #df5f43;
}

.energy-label span:nth-child(7) {
  width: 96%;
  background: #b83a35;
}

.energy-label span:nth-child(7)::after {
  border-left: 9px solid #b83a35;
}

.energy-label span.active {
  opacity: 1;
  transform: translateX(3px);
  box-shadow: 0 7px 18px rgba(16, 20, 18, 0.18);
}

.chart-section,
.windows-section {
  margin-top: 12px;
  border-radius: 26px;
  padding: clamp(16px, 3vw, 24px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-top: 4px;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-best {
  background: var(--accent);
}

.legend-low {
  background: var(--sun);
}

.legend-high {
  background: var(--alert);
}

.hour-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(24px, 1fr));
  align-items: end;
  gap: 6px;
  min-height: 292px;
  padding: 20px 8px 4px;
  overflow-x: auto;
  background: linear-gradient(180deg, #f9fbf7, #eef3ec);
  border: 1px solid #e4e9df;
  border-radius: 22px;
}

.hour-bar {
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  min-width: 24px;
  height: 252px;
  color: var(--muted);
}

.bar-fill {
  align-self: end;
  width: 100%;
  min-height: 12px;
  border-radius: 999px 999px 6px 6px;
  background: var(--blue);
  transition: height 180ms ease;
}

.hour-bar.low .bar-fill {
  background: var(--sun);
}

.hour-bar.best .bar-fill {
  background: var(--accent);
}

.hour-bar.high .bar-fill {
  background: var(--alert);
}

.bar-price {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.bar-hour {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.window-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.window-item {
  display: grid;
  gap: 10px;
  min-height: 120px;
  border: 1px solid #e5eadf;
  border-radius: 20px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff, #f6faf4);
}

.window-item strong {
  font-size: 1.18rem;
}

.window-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eadf;
}

.window-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.window-item small {
  color: var(--muted);
  line-height: 1.35;
}

.methodology-hero h2 {
  max-width: 820px;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.method-card {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: clamp(18px, 3vw, 24px);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
}

.method-card h3 {
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.5vw, 2.1rem);
  line-height: 1.05;
}

.method-card p {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.method-card code {
  display: block;
  margin-top: 16px;
  border-radius: 16px;
  padding: 14px;
  background: #101412;
  color: #f8faf5;
  white-space: normal;
}

.grade-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.grade-list strong {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
}

.source-note {
  padding: 16px 4px 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.demo {
  color: #805400;
}

.error {
  color: var(--alert);
}

@media (max-width: 980px) {
  .toolbar,
  .hero-panel,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .app-nav {
    align-self: flex-start;
  }

  .controls,
  .dashboard-grid,
  .window-list,
  .method-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary-panel {
    grid-column: 1 / -1;
  }

  .status-meta {
    justify-items: start;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 18px, 1180px);
    padding-top: 10px;
  }

  .toolbar {
    position: static;
    border-radius: 22px;
  }

  .controls,
  .dashboard-grid,
  .window-list,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .score-ring {
    width: 96px;
    height: 96px;
  }

  .hour-chart {
    grid-template-columns: repeat(24, 30px);
  }
}
