:root {
  --bg: #f3f6f4;
  --ink: #1c2b24;
  --muted: #5f7268;
  --line: #d5e0d9;
  --card: #ffffff;
  --accent: #0f6b4c;
  --accent-2: #14845e;
  --danger: #b42318;
  --warn: #9a6700;
  --ok-bg: #e8f7ef;
  --ok-ink: #0f6b4c;
  --shadow: 0 10px 30px rgba(28, 43, 36, 0.08);
  --radius: 18px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(20, 132, 94, 0.12), transparent 40%),
    linear-gradient(180deg, #eaf3ee 0%, var(--bg) 42%, #eef2f0 100%);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

.page {
  width: min(440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.theme-title {
  display: grid;
  gap: 4px;
  font-size: clamp(18px, 5vw, 24px);
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--ink);
}

.theme-title span {
  display: block;
}

.pin-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pin-display i {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
  font-style: normal;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

.pin-display i.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 0 18px;
}

.keypad button {
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f4f8f6);
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.keypad button:active {
  transform: translateY(1px);
  background: #e8f2ec;
}

.keypad .key-del {
  font-size: 16px;
}

.keypad .key-x {
  font-size: 22px;
}

.theme-sub {
  max-width: 42em;
}

.sub {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.location-status {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  background: #f3f4f3;
  color: var(--muted);
}

.location-status.wait {
  background: #fff7e6;
  color: var(--warn);
}

.location-status.ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.location-status.bad {
  background: #fff5f4;
  color: var(--danger);
}

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

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  font-size: 14px;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 20px;
  color: var(--ink);
  background: #fbfcfb;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
}

.btn.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn.danger {
  background: #fff5f4;
  border-color: #f0c2bd;
  color: var(--danger);
}

.error {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff5f4;
  color: var(--danger);
  border: 1px solid #f0c2bd;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

.result {
  text-align: left;
}

.temp-tip {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff7e6;
  color: var(--warn);
  border: 1px solid #f0d9a0;
  line-height: 1.5;
  font-weight: 700;
}

.tag.temp {
  background: #fff7e6;
  color: var(--warn);
}

.success-title {
  display: block;
  text-align: center;
  margin: 8px 0 28px;
  padding: 18px 12px;
  border-radius: 16px;
  font-size: clamp(36px, 10vw, 48px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.success-title.ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.success-title.warn {
  background: #fff7e6;
  color: var(--warn);
}

.info {
  margin: 0;
  display: grid;
  gap: 14px;
}

.info > div {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}

.info > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info dt {
  font-size: 13px;
  color: var(--muted);
}

.info dd {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  word-break: break-all;
}

.admin-body {
  background:
    radial-gradient(circle at top right, rgba(20, 132, 94, 0.1), transparent 35%),
    #f2f5f3;
}

.admin {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.login-panel {
  width: min(440px, 100%);
  margin: 48px auto 0;
}

.login-panel .btn.primary {
  width: 100%;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat strong {
  font-size: 32px;
  letter-spacing: -0.03em;
}

.qr-panel {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}

.qr-panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.qr-panel img {
  width: min(240px, 100%);
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 10px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  color: var(--accent);
  word-break: break-all;
}

.site-list {
  display: grid;
  gap: 12px;
}

.site-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.site-card summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-weight: 700;
}

.site-card summary::-webkit-details-marker {
  display: none;
}

.site-meta {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.people-table {
  width: 100%;
  border-collapse: collapse;
}

.people-table th,
.people-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

.people-table th {
  color: var(--muted);
  font-weight: 600;
  background: #f8faf8;
}

.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tag.done {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.tag.todo {
  background: #f3f4f3;
  color: var(--muted);
}

@media (max-width: 720px) {
  .qr-panel {
    grid-template-columns: 1fr;
  }

  .qr-panel img {
    justify-self: start;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }
}
