* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f6f8; color: #1f2329;
}
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: #185FA5; color: #fff;
}
header h1 { font-size: 18px; margin: 0; font-weight: 500; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.on { background: #34c759; }
.dot.off { background: #c0392b; }
.muted { color: #cfe0f5; }
main { max-width: 980px; margin: 18px auto; padding: 0 16px; display: grid; gap: 16px; }
.card { background: #fff; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 500; }
.card h2 small { color: #888; font-size: 12px; font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }

.cell {
  border: 1px solid #e3e6ea; border-radius: 10px; padding: 10px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.cell .name { font-size: 13px; color: #444; }
.cell .val { font-size: 15px; font-weight: 500; }
.cell .val.on { color: #c0392b; }
.cell .val.off { color: #1f2329; }

.btn {
  border: none; border-radius: 8px; padding: 7px 0; width: 100%;
  background: #185FA5; color: #fff; font-size: 13px; cursor: pointer;
}
.btn:hover { background: #0c447c; }
.btn.off { background: #e3e6ea; color: #1f2329; }

.reg-row { display: flex; gap: 6px; width: 100%; }
.reg-row input {
  width: 100%; padding: 6px; border: 1px solid #e3e6ea; border-radius: 8px;
  font-size: 13px; text-align: center;
}
.reg-row button { white-space: nowrap; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: .95; }

.stale-banner {
  position: sticky; top: 0; z-index: 9;
  background: #c0392b; color: #fff; text-align: center;
  padding: 10px 16px; font-size: 14px; font-weight: 500;
}
.gw-off { color: #ffd3cd; }
