:root {
  --bg-dark: #111;
  --text: #111;
  --muted: #6B7280;
  --green: #22C55E;
  --orange: #F59E0B;
  --red: #EF4444;
  --gold: #FFD700;
  --accent: #C8860A;
  --card: #fff;
  --line: #E5E7EB;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif
}

.hidden {
  display: none !important
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
}

.muted {
  color: var(--muted)
}

.brand-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px
}

.scanner-title,
.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px
}

.auth-logo {
  display: block;
  width: 120px;
  max-width: 70%;
  height: auto;
  margin: 0 auto 14px
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed
}

.btn-sm {
  padding: 8px 10px;
  border-radius: 10px;
  min-height: 38px;
  font-size: 13px
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
  font-weight: 700
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 700
}

.btn-warning {
  background: var(--orange);
  border-color: var(--orange);
  color: #111;
  font-weight: 700
}

.btn-ghost {
  border-color: rgba(255, 255, 255, 0.18)
}

.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  min-height: 44px
}

.label {
  display: block;
  margin: 10px 0 6px;
  font-size: 13px;
  color: var(--muted)
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin: 12px 0;
  font-weight: 600
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0
}

.auth-container {
  max-width: 420px;
  margin: 60px auto;
  padding: 24px;
  border-radius: 16px;
  background: #0b0b0b;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08)
}

.auth-page .auth-container {
  margin: 0
}

.auth-container.light {
  background: #fff;
  color: #111;
  border: 1px solid var(--line)
}

.auth-title {
  margin: 0 0 14px;
  font-size: 22px
}

.auth-form {
  display: block
}

.auth-hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px
}

/* Scanner */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px
}

.page-logo {
  width: 160px;
  max-width: 70vw;
  height: auto
}

.scanner-body {
  background: #fff;
  color: #111;
  height: 100vh;
  overflow: hidden
}

.scanner-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08)
}

.scanner-title {
  font-weight: 800
}

.scanner-main {
  position: relative;
  height: calc(100vh - 58px)
}

.camera-wrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 50%
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none
}

.scan-frame {
  width: min(70vw, 320px);
  height: min(70vw, 320px);
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.35) inset
}

.scan-hint {
  margin-top: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85)
}

.status-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 10px
}

.status-title {
  font-weight: 900;
  letter-spacing: .02em
}

.status-body {
  flex: 1;
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  overflow: auto;
  display: grid;
  place-items: center;
  text-align: center
}

.status-content {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.status-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.5)
}

.status-warning {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.55)
}

.status-error {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.55)
}

.status-body .title {
  font-size: 34px;
  font-weight: 900;
  margin-bottom: 10px
}

.status-body .name {
  font-size: 44px;
  font-weight: 900;
  margin-bottom: 14px;
  line-height: 1.05
}

.status-body .meta {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.9);
  display: grid;
  gap: 8px
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  min-height: 24px
}

.badge-gold {
  background: var(--gold);
  color: #111
}

/* Dashboard */
.dash-body {
  background: #F3F4F6;
  color: #111;
  min-height: 100vh
}

.dash-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10
}

.dash-brand {
  font-weight: 900
}

.dash-actions {
  display: flex;
  gap: 10px
}

.dash-actions .btn {
  border-color: var(--line)
}

.dash-wrap {
  max-width: 1200px;
  margin: 18px auto;
  padding: 0 16px 30px
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 16px;
  padding: 14px
}

.stat-green {
  border-left-color: var(--green)
}

.stat-orange {
  border-left-color: var(--orange)
}

.stat-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  margin-top: 6px
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: #E5E7EB;
  margin-top: 10px;
  overflow: hidden
}

.progress .bar {
  height: 100%;
  background: var(--accent)
}

.tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0
}

.tools-left {
  flex: 1
}

.tools-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden
}

.table {
  width: 100%;
  border-collapse: collapse
}

.table th,
.table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top
}

.table th {
  background: #FAFAFA;
  font-size: 13px;
  color: #374151
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.inline {
  display: inline
}

.name-cell {
  font-weight: 800
}

.qr-thumb {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: block
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px
}

.pager-info {
  color: var(--muted);
  font-weight: 700
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50
}

.modal-card {
  background: #fff;
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line)
}

.modal-title {
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 8px
}

.modal-text {
  color: #374151;
  margin-bottom: 14px
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px
}