:root {
  --ink: #1a2330;
  --muted: #6b7a8d;
  --line: #e4e9f0;
  --bg: #f6f8fb;
  --card: #ffffff;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --ok: #0f7b55;
  --ok-soft: #e6f7ef;
  --danger: #c62828;
  --danger-soft: #fdecea;
  --shadow: 0 10px 30px rgba(26, 35, 48, 0.06);
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% 0%, #dce9ff 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, #d9f3e8 0%, transparent 50%),
    var(--bg);
}

button, input { font: inherit; }
button { cursor: pointer; }
#app { min-height: 100vh; }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 72px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.header h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 0.72rem 1.05rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-soft {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 10px;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-box {
  width: min(100%, 380px);
  background: var(--card);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.login-box h1 { margin: 0 0 6px; font-size: 1.6rem; }
.login-box p { margin: 0 0 18px; color: var(--muted); }
.login-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 12px;
  outline: none;
}
.login-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-box .btn { width: 100%; }
.err { color: var(--danger); font-size: 0.88rem; margin: 0 0 10px; }

.create {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.banner {
  background: #fff8e6;
  border: 1px solid #f0d58a;
  color: #7a5b00;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.banner strong {
  display: inline-block;
  margin-top: 4px;
  color: var(--ink);
  word-break: break-all;
}
.banner-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}
.create h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}
.create-row {
  display: grid;
  grid-template-columns: 1.1fr 1.6fr auto;
  gap: 10px;
}
.create input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  outline: none;
  background: #fbfcfe;
}
.create input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}
.create-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1a2330;
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 99;
  animation: up .25s ease both;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: up .3s ease both;
}
.card.off { opacity: 0.72; }
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}
.pill {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}
.pill-on { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: var(--danger-soft); color: var(--danger); }

.qr {
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f8fafc, #eef3f9);
  border-radius: 16px;
  padding: 14px;
  min-height: 220px;
}
.qr img {
  width: 180px;
  height: 180px;
  background: #fff;
  border-radius: 10px;
}
.qr-loading {
  color: var(--muted);
  font-size: 0.9rem;
}

.label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.target-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  outline: none;
  background: #fbfcfe;
}
.target-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}
.target-hint {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}
.meta strong { color: var(--ink); }

.ops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ops .btn { width: 100%; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  background: rgba(255,255,255,.55);
  border: 1px dashed var(--line);
  border-radius: 20px;
}

@keyframes up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  .create-row { grid-template-columns: 1fr; }
  .create-row .btn { width: 100%; }
}
