:root {
  --bg: #f6f4ef;
  --ink: #141414;
  --muted: #5e5b55;
  --card: #ffffff;
  --accent: #ff8a00;
  --accent-2: #0f766e;
  --accent-3: #2563eb;
  --accent-4: #7c3aed;
  --border: rgba(20, 20, 20, 0.12);
  --shadow: 0 18px 40px rgba(20, 20, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff3e5, transparent 55%),
              radial-gradient(circle at 20% 20%, #f1f4ff, transparent 50%),
              var(--bg);
  min-height: 100vh;
}

.bg-noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.04'/></svg>");
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.kicker {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
}

h1 {
  margin: 8px 0 0;
  font-size: clamp(28px, 4vw, 42px);
}

.status {
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff5e4;
  border: 1px solid rgba(255, 138, 0, 0.4);
  color: #b45309;
  font-weight: 600;
}

.pill.live {
  background: #e7fff7;
  border-color: rgba(15, 118, 110, 0.35);
  color: #0f766e;
}

.pill.offline {
  background: #fff1f2;
  border-color: rgba(225, 29, 72, 0.3);
  color: #be123c;
}

.meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 28px;
}

.card, .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.unit {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  margin-top: 26px;
}

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

.legend {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 6px;
}

.dot.pv { background: var(--accent); }
.dot.load { background: var(--accent-2); }
.dot.grid { background: var(--accent-3); }
.dot.batt { background: var(--accent-4); }

.chart-wrap {
  margin-top: 16px;
  height: 320px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.extras {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 24px;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .status {
    text-align: left;
  }
}
