:root {
  color-scheme: dark;
  --bg: #06090d;
  --panel: rgba(15, 23, 34, 0.88);
  --panel-strong: #101722;
  --panel-soft: #131d2a;
  --line: #27364a;
  --text: #edf5ff;
  --muted: #91a3ba;
  --cyan: #35d6ff;
  --green: #3fe28f;
  --amber: #ffc857;
  --red: #ff647c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -12%, rgba(53, 214, 255, 0.16), transparent 32rem),
    radial-gradient(circle at 82% 8%, rgba(63, 226, 143, 0.08), transparent 28rem),
    linear-gradient(150deg, #05080c, #08111a 55%, #06090d);
  color: var(--text);
}

button { font: inherit; cursor: pointer; }

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar,
.brand,
.topbar-actions,
.hero-main,
.hero-actions,
.widget-head,
.share-card-top,
.modal-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  gap: 12px;
  font-size: 18px;
  font-weight: 850;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #31506b;
  color: var(--cyan);
  background: linear-gradient(145deg, #152236, #0b111b);
  font-weight: 850;
}

.topbar-actions,
.hero-actions,
.modal-actions {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.updated {
  color: var(--muted);
  font-size: 12px;
}

.button {
  border: 1px solid #34516d;
  border-radius: 7px;
  padding: 10px 12px;
  font-weight: 750;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: #5f87ad;
}

.button-primary {
  background: #e8f7ff;
  color: #07111b;
  border-color: #e8f7ff;
}

.button-support {
  background: #123222;
  color: #a9ffd0;
  border-color: #2e7051;
}

.button-ghost {
  background: #101a27;
  color: var(--text);
}

.hero-panel,
.widget,
.share-card,
.modal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(53, 214, 255, 0.09), transparent 40%, rgba(63, 226, 143, 0.06));
  pointer-events: none;
}

.hero-main {
  position: relative;
  gap: 22px;
  align-items: center;
}

.gauge {
  --value: 50;
  flex: 0 0 auto;
  width: 168px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid #2b4058;
  background:
    radial-gradient(circle at center, var(--panel-strong) 0 55%, transparent 56%),
    conic-gradient(var(--green) calc(var(--value) * 1%), #26364a 0);
  box-shadow: inset 0 0 30px rgba(53, 214, 255, 0.08), 0 0 42px rgba(53, 214, 255, 0.12);
}

.gauge-inner { text-align: center; }
.gauge-inner strong { display: block; font-size: 40px; line-height: 1; }
.gauge-inner span { color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 66px);
  line-height: 0.98;
  letter-spacing: 0;
}

.so-what {
  max-width: 800px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.widget {
  min-height: 226px;
  padding: 14px;
}

.widget-head {
  justify-content: space-between;
  gap: 12px;
}

.widget h2 {
  margin: 0;
  font-size: 16px;
}

.state {
  border: 1px solid #36506b;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.state-good { color: var(--green); border-color: rgba(63, 226, 143, 0.5); }
.state-warn { color: var(--amber); border-color: rgba(255, 200, 87, 0.5); }
.state-neutral { color: var(--muted); }

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

.metric {
  min-height: 68px;
  padding: 10px;
  border: 1px solid #29394d;
  border-radius: 7px;
  background: var(--panel-soft);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.metric strong { font-size: 16px; }

.widget-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chart-wrap {
  min-height: 180px;
  margin-top: 12px;
}

canvas {
  width: 100%;
  max-width: 100%;
  border-radius: 7px;
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 7, 12, 0.76);
}

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.wide-modal { width: min(760px, 100%); }

.modal-close {
  float: right;
  border: 1px solid #34516d;
  border-radius: 7px;
  padding: 8px 10px;
  background: #101a27;
  color: var(--muted);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 28px;
}

.modal p,
.modal label {
  color: var(--muted);
  line-height: 1.5;
}

.modal code {
  display: block;
  overflow-wrap: anywhere;
  margin: 6px 0 12px;
  padding: 10px;
  border: 1px solid #29394d;
  border-radius: 7px;
  background: #0a111b;
}

.share-card {
  padding: 18px;
  background: linear-gradient(145deg, #111c2b, #0a111b);
}

.share-card-top {
  justify-content: space-between;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.share-card h3 {
  margin: 18px 0;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1;
}

.qr-panel {
  display: grid;
  place-items: center;
  width: 148px;
  aspect-ratio: 1;
  margin: 12px 0;
  border: 1px dashed #36506b;
  border-radius: 8px;
  color: var(--muted);
}

.config-note {
  border: 1px solid #29394d;
  border-radius: 7px;
  background: #0a111b;
  padding: 10px;
}

@media (max-width: 1020px) {
  .widget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .hero-main { align-items: flex-start; flex-direction: column; }
  .gauge { width: 148px; }
}

@media (max-width: 640px) {
  .shell { width: min(100vw - 24px, 1280px); }
  .widget-grid,
  .metric-grid { grid-template-columns: 1fr; }
}
