:root {
  --bg: #efeff2;
  --panel: #ffffff;
  --text: #1b1b22;
  --muted: #636379;
  --line: #ddddee;
  --purple: #6a1bff;
  --purple-2: #8d4bff;
  --ok: #30a46c;
  --warn: #f0ad2c;
  --bad: #d34f4f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}

#appShell[hidden],
.scan-modal[hidden] {
  display: none !important;
}

.auth-screen {
  display: grid;
  place-items: start center;
  min-height: 75vh;
  padding-top: 18px;
}

.auth-phone {
  width: min(360px, 100%);
  border: 2px solid #7f32ff;
  border-radius: 22px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 28px rgba(72, 37, 126, 0.15);
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-brand {
  color: #2361cf;
  font-size: 30px;
  font-weight: 800;
}

.auth-logo {
  color: #f3c92d;
  font-size: 28px;
}

.auth-sub {
  margin: 8px 0 14px;
  color: #5d6e87;
  border-bottom: 1px solid #75a5f1;
  padding-bottom: 8px;
}

.auth-next-btn {
  width: 100%;
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  font-weight: 800;
  font-size: 20px;
  cursor: pointer;
  color: #5a4500;
  background: #f2cd48;
}

.auth-note {
  margin-top: 14px;
  background: #f3f3f5;
  border: 1px solid #e2e2e9;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}

.auth-note p {
  margin: 6px 0;
}

.auth-status {
  margin: 12px 0 0;
  color: #31568a;
  font-weight: 700;
  text-align: center;
}

.top h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
}

.top p {
  margin: 4px 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.controls {
  display: grid;
  gap: 12px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  font-size: 16px;
}

.scan-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mode-btn,
.btn {
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  font-weight: 800;
  cursor: pointer;
}

.mode-btn {
  background: #ece7ff;
  color: #41208f;
}

.mode-btn.mode-active {
  background: linear-gradient(145deg, var(--purple), var(--purple-2));
  color: #fff;
}

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

.list-head h2 { margin: 0; }
.summary { color: var(--muted); font-weight: 700; }

.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.member-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.member-main strong { display: block; }
.member-main small { color: var(--muted); }

.tag {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 800;
}

.tag-ok { background: #dff5e9; color: #176b46; }
.tag-warn { background: #fff2d6; color: #805200; }
.tag-bad { background: #fde1e1; color: #892f2f; }

.member-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.footer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--purple), var(--purple-2));
}

.btn-muted {
  color: #fff;
  background: #717192;
}

.btn:disabled,
.mode-btn:disabled,
.icon-btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.35);
  cursor: not-allowed;
}

.scan-modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 16, 26, 0.58);
  display: grid;
  place-items: center;
  padding: 16px;
}

.scan-card {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 16px;
  text-align: center;
}

.scan-card h3 { margin: 0 0 4px; }
.scan-card p { margin: 0 0 10px; color: var(--muted); }

.progress-wrap {
  position: relative;
  width: 120px;
  margin: 0 auto 12px;
}

.progress-ring {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.progress-bg {
  fill: none;
  stroke: #e8e8f6;
  stroke-width: 10;
}

.progress-fg {
  fill: none;
  stroke: #4a7bff;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.25s ease;
}

.progress-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.status {
  margin: 0;
  font-weight: 700;
  color: #323255;
}

@media (max-width: 720px) {
  .member-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .footer-actions {
    grid-template-columns: 1fr;
  }
}
