:root {
  --bg: #eceff3;
  --card: #ffffff;
  --ink: #2a2f36;
  --muted: #8b939e;
  --track: #e4e7ec;
  --shadow: 0 2px 10px rgba(30, 40, 55, 0.06);
  --radius: 14px;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --pad: clamp(1rem, 3.5vw, 2rem);
  --max: 1100px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88em;
  color: #3a6ef0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem var(--pad);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.topbar-brand {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.topbar-nav {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.topbar-nav a:hover,
.topbar-nav a.is-active {
  color: var(--ink);
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem var(--pad) 2.5rem;
}

.dash {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dash-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.demo-badge {
  display: inline-block;
  margin: 0.45rem 0 0;
  padding: 0.3rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a4210;
  background: rgba(240, 163, 94, 0.28);
  border: 1px solid rgba(240, 163, 94, 0.45);
  border-radius: 999px;
}

.gauge-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.summary-row {
  display: grid;
  grid-template-columns: 1.35fr 1.35fr 0.7fr;
  gap: 1rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1.25rem;
}

.card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--muted);
}

.card-gauge {
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.gauge {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.35rem;
}

.gauge svg {
  width: 100%;
  max-width: 210px;
  height: auto;
  display: block;
}

.gauge-value {
  font-size: 1.65rem;
  font-weight: 300;
  fill: var(--ink);
  letter-spacing: -0.02em;
}

.gauge-unit {
  font-size: 0.85rem;
  font-weight: 400;
  fill: var(--muted);
}

.gauge-scale {
  font-size: 0.72rem;
  fill: #b0b6bf;
}

.card-summary {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-value {
  margin: 1.5rem 0 0.35rem;
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}

.summary-unit {
  font-size: 0.38em;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.2em;
  vertical-align: super;
}

.summary-currency {
  font-size: 0.38em;
  font-weight: 400;
  color: var(--muted);
  margin-right: 0.15em;
  vertical-align: super;
}

.card-relay {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.relay-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  cursor: pointer;
}

.relay-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.relay-track {
  position: relative;
  width: 72px;
  height: 38px;
  background: #3a3f46;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.relay-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.relay-switch input:checked + .relay-track {
  background: #4a7dff;
}

.relay-switch input:checked + .relay-track::after {
  transform: translateX(34px);
}

.relay-switch input:focus-visible + .relay-track {
  outline: 2px solid #4a7dff;
  outline-offset: 3px;
}

.usage-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.card-usage {
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.summary-value-sm {
  font-size: clamp(2rem, 5vw, 2.85rem);
  margin: 1rem 0 0.35rem;
}

.usage-cost {
  margin: auto 0 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--muted);
}

.usage-cost .summary-currency {
  font-size: 0.85em;
  vertical-align: baseline;
  margin-right: 0.15em;
}

.chart-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.range-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.range-btn {
  appearance: none;
  border: 1px solid #d5dae2;
  background: #fff;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.78rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.range-btn:hover {
  color: var(--ink);
  border-color: #4a7dff;
}

.range-btn.is-active {
  background: #4a7dff;
  border-color: #4a7dff;
  color: #fff;
}

.card-chart {
  min-height: 280px;
}

.chart-wrap {
  position: relative;
  height: min(280px, 55vw);
  margin-top: 0.5rem;
}

.rules {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.kicker {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4a7dff;
}

.rules h2 {
  margin: 0 0 0.6rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.lede {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 52ch;
}

.code {
  overflow: auto;
  margin: 1rem 0;
  padding: 1rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #445;
  box-shadow: var(--shadow);
}

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--pad) 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

@media (max-width: 900px) {
  .gauge-row {
    grid-template-columns: 1fr 1fr;
  }

  .summary-row {
    grid-template-columns: 1fr 1fr;
  }

  .card-relay {
    grid-column: 1 / -1;
    min-height: 110px;
    flex-direction: row;
    align-items: center;
  }

  .card-relay .relay-switch {
    flex: 0;
    margin-left: auto;
  }
}

@media (max-width: 520px) {
  .gauge-row,
  .summary-row,
  .usage-row {
    grid-template-columns: 1fr;
  }

  .card-relay {
    grid-column: auto;
  }

  .topbar-nav a:not(.is-active):not([href="#aturan"]) {
    display: none;
  }
}
