:root {
  --background: #181836;
  --accent: #ff00ff;
  --secondary: #66ffcc;
  --card: rgba(255, 255, 255, 0.08);
  --card-top: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --success: #3ee574;
  --warning: #ffa62b;
  --error: #ff526b;
  --electric: #3d8bff;
  --gas: #a666ff;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-border: rgba(255, 255, 255, 0.1);
  --warm-glow: rgba(255, 204, 223, 0.18);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--warm-glow), rgba(255, 255, 255, 0) 390px),
    var(--background);
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background: radial-gradient(circle at 50% -12%, rgba(255, 0, 255, 0.12), transparent 42%);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 88px;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px 4px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.7;
}

.topbar-brand span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: 0 0 8px var(--secondary);
}

.topbar-brand span:nth-child(2) {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.icon-button,
.menu-popover button,
.menu-popover a,
.primary-button,
.save-button,
.modal-close {
  border: 0;
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  background: transparent;
  font-weight: 600;
  padding: 7px 8px;
  border-radius: 12px;
  transition: background-color 160ms ease, transform 160ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: rgba(255, 0, 255, 0.12);
  outline: none;
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button svg,
.menu-popover svg,
.card svg,
.primary-button svg,
.save-button svg,
.modal-close svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.01);
}

.menu-popover {
  position: fixed;
  top: 56px;
  right: 12px;
  z-index: 40;
  width: 190px;
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background:
    linear-gradient(var(--background), var(--background)) padding-box,
    linear-gradient(135deg, var(--accent), var(--secondary)) border-box;
  box-shadow: 0 4px 10px rgba(255, 0, 255, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.menu-popover button,
.menu-popover a {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  text-align: left;
  text-decoration: none;
  background: transparent;
  font-size: 18px;
}

.menu-popover button + button,
.menu-popover button + a {
  border-top: 1px solid rgba(255, 0, 255, 0.24);
}

.menu-support {
  display: grid;
  gap: 8px;
  margin: 8px -8px 0;
  padding: 12px 8px 4px;
  border-top: 1px solid rgba(255, 0, 255, 0.24);
  justify-items: center;
}

.menu-support-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-support .bmc-btn {
  min-width: 150px;
  max-width: 100%;
}

.menu-popover svg {
  color: var(--secondary);
}

.content {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 0 16px;
}

.brand-block {
  text-align: center;
  padding: 10px 0 12px;
}

.brand-block h1 {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--secondary), #ff6ab6);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: 0 2px 8px rgba(255, 0, 255, 0.32);
}

.brand-kicker,
.section-kicker,
.card-eyebrow {
  margin: 0;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.brand-kicker {
  margin-bottom: 8px;
  color: rgba(102, 255, 204, 0.78);
}

.brand-block p {
  margin: 0 auto;
  max-width: 440px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
}

.status-stack {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 0, 255, 0.75);
  padding: 12px;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 0, 255, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.error-box {
  color: var(--error);
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 82, 107, 0.08);
}

.setup-message {
  width: min(100%, 520px);
  margin: 10px auto 20px;
  color: var(--text);
  text-align: center;
  line-height: 1.4;
  padding: 18px 12px;
  border: 2px solid rgba(255, 0, 255, 0.45);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--card-top), transparent), var(--panel);
  box-shadow: 0 3px 12px rgba(255, 0, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.setup-message p {
  margin: 0 0 8px;
}

.setup-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 18px rgba(255, 0, 255, 0.16);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 8px;
  padding: 8px 16px;
  border: 1px solid rgba(102, 255, 204, 0.4);
  border-radius: 14px;
  color: var(--secondary);
  background: rgba(102, 255, 204, 0.08);
  cursor: pointer;
  font-weight: 700;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background: rgba(102, 255, 204, 0.16);
  outline: none;
}

.cards,
.dashboard {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
}

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 4px;
}

.dashboard-heading h2 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(62, 229, 116, 0.3);
  border-radius: 999px;
  color: var(--success);
  background: rgba(62, 229, 116, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.live-badge span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.energy-grid {
  display: grid;
  gap: 12px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.comparison-card {
  display: grid;
  gap: 16px;
  border-color: rgba(102, 255, 204, 0.55);
}

.comparison-card h2,
.history-heading h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
}

.comparison-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  color: var(--secondary);
  background: rgba(102, 255, 204, 0.1);
}

.comparison-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.comparison-values > div {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.comparison-values span,
.comparison-values small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.comparison-values strong {
  display: inline-block;
  margin: 4px 4px 0 0;
  color: var(--text);
  font-size: 25px;
}

.comparison-result {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.comparison-result.cheaper,
.rate-trend.lower {
  color: var(--success);
  background: rgba(62, 229, 116, 0.1);
}

.comparison-result.more-expensive,
.rate-trend.higher {
  color: var(--error);
  background: rgba(255, 82, 107, 0.1);
}

.comparison-result.neutral,
.rate-trend.neutral {
  color: var(--warning);
  background: rgba(255, 166, 43, 0.1);
}

.history-section {
  display: grid;
  gap: 8px;
}

.history-caption {
  margin: 0 4px 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.history-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid rgba(102, 255, 204, 0.3);
  border-radius: 12px;
  background: rgba(102, 255, 204, 0.06);
}

.history-option {
  min-height: 30px;
  padding: 4px 9px;
  border: 0;
  border-radius: 9px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.history-option.active {
  color: var(--background);
  background: var(--secondary);
}

.chart-card {
  min-height: 310px;
  padding: 16px 14px 12px;
  border-color: rgba(102, 255, 204, 0.55);
}

.chart-wrap {
  position: relative;
  height: 250px;
}

.chart-status {
  min-height: 250px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 14px;
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.chart-legend span:nth-child(2),
.chart-legend span:nth-child(4) {
  margin-right: 8px;
}

.legend-current,
.legend-flexible {
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: var(--secondary);
}

.legend-flexible {
  background: var(--warning);
}

.rate-trend {
  margin: -4px 0 0;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.card {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 0, 255, 0.6);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--card-top), transparent), var(--panel);
  box-shadow: 0 3px 6px rgba(255, 0, 255, 0.1);
  padding: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.plan-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: var(--accent);
  background: rgba(255, 0, 255, 0.12);
}

.plan-card h2 {
  margin: 3px 0 7px;
  color: rgba(255, 0, 255, 0.85);
  font-size: 20px;
  line-height: 1.2;
}

.plan-card p {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  color: var(--text-muted);
}

.plan-location {
  font-size: 14px;
}

.plan-card svg {
  color: rgba(102, 255, 204, 0.72);
}

.energy-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 20px 16px;
}

.energy-card.electricity {
  border-color: var(--electric);
}

.energy-card.gas {
  border-color: var(--gas);
}

.energy-card h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.energy-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.energy-heading h2 {
  justify-content: flex-start;
  margin: 3px 0 0;
}

.energy-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.electricity h2 {
  color: var(--electric);
}

.electricity h2 svg {
  color: #ffe03d;
  fill: #ffe03d;
}

.gas h2 {
  color: var(--gas);
}

.gas h2 svg {
  color: #ff6ab6;
  fill: #ff6ab6;
}

.rate-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  white-space: nowrap;
}

.rate-line span {
  font-size: 18px;
}

.rate-line strong {
  color: var(--success);
  font-size: 36px;
  line-height: 1;
}

.rate-line.tomorrow span {
  font-size: 16px;
}

.rate-line.tomorrow strong {
  color: var(--warning);
  font-size: 28px;
}

.rate-line small {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.missing {
  min-height: 40px;
  margin: 0;
  color: var(--warning);
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}

.action-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border-color: rgba(255, 0, 255, 0.6);
}

.action-card p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.primary-button,
.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 16px;
  background: rgba(255, 0, 255, 0.62);
  box-shadow: 0 2px 4px rgba(255, 0, 255, 0.2);
  font-weight: 700;
  transition: filter 160ms ease, transform 160ms ease;
}

.primary-button:hover,
.save-button:hover {
  filter: brightness(1.12);
}

.primary-button:active,
.save-button:active {
  transform: scale(0.98);
}

.primary-button {
  width: min(100%, 260px);
  padding: 8px 16px;
}

.save-button {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
}

.primary-button:disabled,
.save-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.support-shell {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 8px;
  z-index: 10;
  max-width: 648px;
  min-height: 50px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(24, 24, 54, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

.support-shell > * {
  pointer-events: auto;
}

.modal {
  width: min(calc(100% - 24px), 540px);
  max-height: min(86vh, 760px);
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(7, 7, 22, 0.7);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  margin: 0;
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 24px;
  background:
    linear-gradient(180deg, var(--warm-glow), transparent 300px),
    var(--background);
  border: 2px solid rgba(255, 0, 255, 0.38);
  padding: 20px;
  box-shadow: 0 8px 30px rgba(255, 0, 255, 0.18);
}

#settingsDialog {
  width: min(calc(100% - 28px), 620px);
}

.settings-panel {
  padding: 30px 28px 28px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.modal-heading {
  text-align: center;
  padding-top: 6px;
  margin-bottom: 12px;
}

.modal-icon {
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.12);
}

.modal h2 {
  margin: 12px 0 22px;
  font-size: 26px;
  line-height: 1.2;
}

.field {
  display: grid;
  gap: 10px;
  margin: 0 0 22px;
}

.field span {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 700;
}

.field input,
.field select {
  min-height: 54px;
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 600;
  line-height: 1.25;
  padding: 13px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 0, 255, 0.14);
}

.field input {
  text-transform: uppercase;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--secondary) 50%),
    linear-gradient(135deg, var(--secondary) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 14px) 50%,
    0 0;
  background-size:
    8px 8px,
    8px 8px,
    100% 100%;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.field select option {
  color: #141427;
}

.field-error {
  margin: -6px 0 14px;
  color: var(--error);
  font-size: 14px;
}

.setting-toggle-field {
  gap: 12px;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.toggle-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  transition: background-color 160ms ease;
}

.toggle-track span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

.toggle-control input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-control input:checked + .toggle-track span {
  transform: translateX(18px);
}

.toggle-control input:focus-visible + .toggle-track {
  outline: 3px solid rgba(255, 0, 255, 0.25);
}

.toggle-label {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.disclaimer-panel h2 {
  margin-right: 44px;
  font-size: 22px;
}

.disclaimer-panel p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

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

@media (min-width: 620px) {
  .energy-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .content {
    padding: 0 12px;
  }

  .card {
    border-radius: 20px;
    padding: 14px 12px;
  }

  .settings-panel {
    padding: 24px 18px 22px;
  }

  .field {
    margin-bottom: 18px;
  }

  .rate-line {
    gap: 4px;
  }

  .rate-line strong {
    font-size: 32px;
  }

  .rate-line.tomorrow strong {
    font-size: 26px;
  }

  .comparison-values strong {
    font-size: 21px;
  }

  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
