:root {
  --bg: #0f1420;
  --card: #1a2130;
  --line: #2a3446;
  --text: #e6ebf5;
  --muted: #8a97ad;
  --primary: #3b82f6;
  --primary-hover: #2f6fd8;
  --green: #22c55e;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 20px;
  margin: 0;
}

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

.muted {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 13px;
}

.error {
  color: var(--red);
  min-height: 18px;
  margin: 6px 0 0;
  font-size: 13px;
}

.center {
  text-align: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

input {
  background: #0e131d;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  width: 100%;
}

input:focus {
  border-color: var(--primary);
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
}

button.primary {
  background: var(--primary);
  color: #fff;
}

button.primary:hover {
  background: var(--primary-hover);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

button.ghost:hover {
  border-color: var(--muted);
}

button.small {
  padding: 6px 12px;
  font-size: 13px;
}

.block {
  display: block;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--primary);
  padding: 10px;
  border-radius: 8px;
  margin-top: 12px;
}

/* login */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  margin: 0;
}

.login-card h1 {
  margin-bottom: 4px;
}

.login-card input {
  margin-top: 14px;
}

.login-card button {
  width: 100%;
  margin-top: 12px;
}

/* app */
#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px;
}

#app header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.add-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.add-row input {
  flex: 1;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.clients {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.client {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  flex-wrap: wrap;
}

.client .name {
  font-weight: 600;
}

.client .meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.badge.on {
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.5);
}

.badge.off {
  color: var(--muted);
}

.client .actions {
  display: flex;
  gap: 8px;
}

.danger {
  color: var(--red) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 340px;
  margin: 0;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #fff;
  border-radius: 10px;
}

.qr-wrap img {
  width: 240px;
  height: 240px;
  image-rendering: pixelated;
}
