@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #070b14;
  --bg-elevated: rgba(15, 23, 42, 0.72);
  --card-border: rgba(148, 163, 184, 0.14);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-3: #22d3ee;
  --success: #4ade80;
  --danger: #f87171;
  --input-bg: rgba(2, 6, 23, 0.55);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

.page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.page::before,
.page::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.page::before {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 70%);
  animation: float-a 14s ease-in-out infinite;
}

.page::after {
  width: 520px;
  height: 520px;
  right: -140px;
  bottom: -160px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.24), transparent 70%);
  animation: float-b 16s ease-in-out infinite;
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}

.card {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  padding: 36px 32px 32px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: rise 0.55s ease-out;
}

.card.wide { width: min(560px, 100%); }

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(129, 140, 248, 0.15), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(129, 140, 248, 0.22));
  border: 1px solid rgba(125, 211, 252, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-icon svg { width: 24px; height: 24px; color: #bae6fd; }

.brand-text h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.section-title {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.field { margin-bottom: 18px; }

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: #cbd5e1;
}

input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input[type="text"]::placeholder { color: #64748b; }

input[type="text"]:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
  background: rgba(2, 6, 23, 0.75);
}

.otp-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.otp-box {
  width: 100%;
  aspect-ratio: 1;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0;
}

.otp-box.filled {
  border-color: rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
}

.btn {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 14px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  color: #082f49;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.22);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 16px 36px rgba(56, 189, 248, 0.28);
}

.btn-secondary {
  color: var(--text);
  background: rgba(51, 65, 85, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  width: auto;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.btn-row {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.message {
  min-height: 22px;
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.18);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
}

.message.show { opacity: 1; transform: translateY(0); }
.message.ok {
  color: #bbf7d0;
  background: rgba(20, 83, 45, 0.22);
  border-color: rgba(74, 222, 128, 0.18);
}

.hint {
  margin-top: 18px;
  text-align: center;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.hint a {
  color: #7dd3fc;
  text-decoration: none;
}

.hint a:hover { text-decoration: underline; }

.hidden { display: none !important; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}

.step {
  padding: 10px 8px;
  border-radius: 12px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.08);
}

.step.active {
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.28);
  background: rgba(56, 189, 248, 0.08);
}

.step.done {
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.22);
}

.qr-frame {
  position: relative;
  display: grid;
  place-items: center;
  padding: 22px;
  margin: 18px 0 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.qr-frame img {
  width: 220px;
  height: 220px;
  border-radius: 8px;
}

.qr-frame::before,
.qr-frame::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #0ea5e9;
}

.qr-frame::before {
  top: 12px;
  left: 12px;
  border-right: none;
  border-bottom: none;
  border-radius: 6px 0 0 0;
}

.qr-frame::after {
  bottom: 12px;
  right: 12px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 6px 0;
}

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

.instructions li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.5;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 700;
}

.users {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.users li,
.users .empty {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.08);
}

.users .empty {
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #e0f2fe;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(129, 140, 248, 0.35));
  border: 1px solid rgba(125, 211, 252, 0.18);
}

.user-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name strong {
  font-size: 0.96rem;
  font-weight: 600;
}

.badge {
  font-size: 0.78rem;
  color: #fbbf24;
}

.badge.ok { color: #86efac; }

.success-panel {
  text-align: center;
  padding: 10px 0 4px;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.22);
  color: #86efac;
  font-size: 1.8rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float-a {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(24px, 18px); }
}

@keyframes float-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -16px); }
}

.hint-inline {
  margin: -8px 0 18px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.users li.pending {
  cursor: pointer;
  border-color: rgba(251, 191, 36, 0.22);
  background: rgba(251, 191, 36, 0.06);
}

.users li.pending:hover {
  border-color: rgba(251, 191, 36, 0.35);
  transform: translateY(-1px);
}

#stepScan {
  scroll-margin-top: 24px;
}

@media (max-width: 480px) {
  .card { padding: 28px 20px 24px; }
  .otp-row { gap: 8px; }
  .otp-box { font-size: 1.15rem; }
  .steps { grid-template-columns: 1fr; }
}
