:root {
  --bg: #0c0e11;
  --text: #edf3ea;
  --muted: #8d9790;
  --bad: #ef5b4c;
  --line: #2a3330;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Tahoma, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(900px 420px at 50% -10%, #1a2220, transparent 60%), var(--bg);
}

.dashboard-page {
  color-scheme: light;
  color: #171921;
  background: #f3f4f6;
}
.dashboard-page main {
  width: min(100%, 786px);
  margin-inline: auto;
  padding: 4px max(10px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
.unit {
  width: min(100%, max(420px, 84svh));
  margin: 10px auto 18px;
  padding: 14px 10px 16px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #e4e7ee;
}
.panel {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin-inline: auto;
}
.face { display: block; width: 100%; height: 100%; }
.inactive-indicator { filter: grayscale(1); }
.inactive-indicator.is-online { filter: none; }
#logo-shape { mask-type: alpha; }
.center-logo { filter: drop-shadow(0 0 8px #165cff) drop-shadow(0 0 2px #285dff); }
.digits-green { --light: #60fc58; --glow: #19f31f; }
.digits-red { --light: #ff7580; --glow: #ff231b; }
.digits-blue { --light: #c5e7ff; --glow: #163eff; }
.digits-amber { --light: #ffdb32; --glow: #ff8a00; }
.digits-orange { --light: #ff7a12; --glow: #ff4e00; }
.unlit-segments { fill: var(--light); opacity: 0.065; }
.active-segments {
  fill: var(--light);
  filter: drop-shadow(0 0 7px var(--glow)) drop-shadow(0 0 11px var(--glow));
}
.stale .active-segments { opacity: 0.42; }
.missing-segments { fill: #707581; opacity: 0.72; }
.amps-legend, .kwh-legend { visibility: hidden; }
.kwh-selected .amps-legend { visibility: visible; filter: grayscale(1); }
.kwh-selected .kwh-legend { visibility: visible; }
.meter-controls {
  position: absolute;
  top: 42.2%;
  left: 61.2%;
  width: 17.1%;
  height: 9.5%;
  display: grid;
  grid-template-rows: 1fr 1.15fr;
}
.meter-controls button {
  border: 0;
  border-radius: 5px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.meter-controls button:focus-visible { outline: 2px solid #9ccdff; outline-offset: 1px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.power-slot {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 12px auto 0;
}
.power-btn {
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  border: 2px solid #8d5348;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #322824 0 62%, #16110f 63%);
  box-shadow: 0 0 0 8px #1a1210;
  color: #f3eee9;
  font: 700 13px "Segoe UI", sans-serif;
  letter-spacing: 0.12em;
  cursor: pointer;
}
.power-btn svg { width: 28px; height: 28px; }
.power-btn[data-mode="on"] {
  color: #e9fff0;
  border-color: #2f8f4e;
  box-shadow: 0 0 0 8px #102216;
}
.power-btn[data-mode="off"] {
  color: #f6f1ec;
  border-color: #c46a58;
  box-shadow: 0 0 0 8px #1c1210;
}
.power-btn[data-mode="pending"] { color: #ffd378; border-color: #b0893e; }
.power-btn:disabled { opacity: 0.72; cursor: default; }
.power-arabic { color: #2c313a; font-size: 16px; font-weight: 700; }
.power-warning {
  max-width: 560px;
  margin: 2px 0 0;
  color: #865111;
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}
.power-warning:empty { display: none; }

.toolbar, .meta { width: min(100%, 560px); margin-inline: auto; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.toolbar button, .device-pick, .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dce0e7;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: #454e5d;
  font: 12px Tahoma, "Segoe UI", sans-serif;
}
.toolbar button { cursor: pointer; }
.dashboard-page select {
  background: #f2f4f7;
  color: #171921;
  border: 0;
  border-radius: 8px;
  padding: 4px 6px;
  max-width: min(180px, 46vw);
}
.dashboard-page :is(.toolbar button, select, .power-btn):focus-visible {
  outline: 2px solid #2168cc;
  outline-offset: 3px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot.on { background: #1a8a48; }
.dot.stale { background: #b36a16; }
.dot.off { background: #b74a47; }

.meta { margin-block: 8px 0; color: #4d5562; font-size: 12px; line-height: 1.65; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login form, .card {
  width: min(420px, 100%);
  background: #121417;
  border: 1px solid #1f6b38;
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 0 0 6px #070808, 0 16px 30px rgba(0, 0, 0, 0.35);
}
.login h1 { margin: 0; color: #00f7a2; text-align: center; }
.sub { margin: 6px 0 12px; color: var(--muted); text-align: center; }
input {
  width: 100%;
  margin: 8px 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0c100e;
  color: var(--text);
  font-size: 16px;
}
.login button {
  width: 100%;
  margin-top: 8px;
  background: #12c64a;
  color: #062114;
  border: 0;
  font-weight: 700;
  font-size: 16px;
  border-radius: 12px;
  padding: 12px;
}
.err { color: var(--bad); min-height: 1.2em; font-size: 14px; }
