:root {
  --bg: #0b101b;
  --bg-elevated: #121a2b;
  --bg-card: #162033;
  --border: rgba(148, 163, 184, 0.16);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --cyan: #06b6d4;
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.08), transparent 40%),
              radial-gradient(circle at bottom left, rgba(6, 182, 212, 0.08), transparent 40%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.text-accent {
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 16, 27, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #041310; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}
.brand-name { display: block; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; line-height: 1.1; }
.brand-tag { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px; font-size: 0.88rem;
}
.role-badge {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}
.role-badge.admin { background: rgba(6, 182, 212, 0.16); color: #22d3ee; }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { padding: 28px 16px 64px; }
.container { max-width: 780px; margin: 0 auto; }
.container-wide { max-width: 1120px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  color: var(--text); background: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #0d9488); color: #031510; font-weight: 700; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-success { background: var(--accent); color: #031510; font-weight: 700; }
.btn-success:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; font-weight: 700; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-outline-danger { border-color: rgba(239, 68, 68, 0.45); color: #f87171; background: rgba(239, 68, 68, 0.08); }
.btn-outline-danger:hover:not(:disabled) { border-color: var(--danger); background: rgba(239, 68, 68, 0.18); color: #fecaca; }
.modal-danger-zone { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.btn-outline { border-color: var(--border); background: rgba(255, 255, 255, 0.03); }
.btn-outline:hover:not(:disabled) { border-color: rgba(148, 163, 184, 0.4); background: rgba(255, 255, 255, 0.07); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.btn-sm { padding: 7px 12px; font-size: 0.84rem; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.auth-wrapper { max-width: 960px; margin: 24px auto 0; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 32px; align-items: center; }
.hero-badge { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.8rem; font-weight: 700; margin-bottom: 14px; }
.auth-hero h1 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); line-height: 1.15; letter-spacing: -0.03em; margin-bottom: 14px; }
.auth-hero p { color: var(--text-muted); font-size: 1.02rem; max-width: 48ch; }
.auth-card { padding: 24px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; }
.tab { border: none; background: transparent; color: var(--text-muted); padding: 9px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.tab.active { background: var(--bg-card); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field textarea, .search-input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 0.95rem; font-family: inherit; outline: none; transition: border-color 0.15s ease;
}
.field input:focus, .field textarea:focus, .search-input:focus { border-color: var(--accent); }
.status-hero { padding: 28px; text-align: center; margin-bottom: 28px; }
.status-icon { width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 16px; display: grid; place-items: center; font-size: 2rem; }
.status-icon.none { background: var(--accent-soft); }
.status-icon.pending { background: var(--warning-soft); }
.status-icon.approved { background: var(--accent-soft); }
.status-icon.rejected { background: var(--danger-soft); }
.status-hero h1 { font-size: 1.6rem; margin-bottom: 8px; }
.status-hero p { color: var(--text-muted); max-width: 50ch; margin: 0 auto 20px; }
.status-note-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 auto 20px; max-width: 540px; font-size: 0.94rem; text-align: left; }
.status-note-box.rejected-reason { background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.45); color: #fecaca; }
.status-note-box.rejected-reason strong { display: block; color: #f87171; margin-bottom: 4px; }
.pending-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--warning-soft); border: 1px solid rgba(245, 158, 11, 0.4); color: #fbbf24; font-size: 0.86rem; font-weight: 700; margin-bottom: 14px; }
.pending-dot { width: 9px; height: 9px; border-radius: 50%; background: #fbbf24; animation: pulseRec 1.2s infinite; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-header h2 { font-size: 1.15rem; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.status-badge.pending { background: var(--warning-soft); color: #fbbf24; }
.status-badge.approved { background: var(--accent-soft); color: #34d399; }
.status-badge.rejected { background: var(--danger-soft); color: #f87171; }
.history-list, .admin-list { display: flex; flex-direction: column; gap: 14px; }
.verification-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.verification-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.verification-title { font-weight: 700; font-size: 1.02rem; }
.verification-meta { font-size: 0.84rem; color: var(--text-muted); }
.empty-state { text-align: center; padding: 42px 20px; color: var(--text-muted); }
.camera-overlay { position: fixed; inset: 0; z-index: 100; background: #060a12; display: flex; align-items: center; justify-content: center; padding: 12px; }
.camera-shell { width: 100%; max-width: 520px; height: 100%; max-height: 860px; display: flex; flex-direction: column; gap: 10px; }
.camera-header { display: flex; align-items: center; justify-content: space-between; }
.step-pill, .rec-pill { background: var(--bg-card); border: 1px solid var(--border); padding: 5px 14px; border-radius: 999px; font-size: 0.84rem; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.rec-pill.recording { border-color: rgba(239, 68, 68, 0.55); background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; animation: pulseRec 1s infinite; }
@keyframes pulseRec { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
.challenge-steps-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 6px; }
.step-chip { padding: 7px 6px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); font-size: 0.72rem; color: var(--text-muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-chip.active { border-color: var(--accent); background: var(--accent-soft); color: #fff; font-weight: 700; }
.step-chip.done { border-color: rgba(16, 185, 129, 0.45); color: #34d399; }
.video-player-wrap { width: 100%; border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--border); margin-bottom: 14px; }
.video-player-wrap video { width: 100%; max-height: 360px; display: block; background: #000; }
.modal-video-wrap video { max-height: 400px; }
.card-video-preview { width: 100%; max-height: 240px; border-radius: 12px; background: #000; border: 1px solid var(--border); }
.timeline-section { margin-bottom: 16px; }
.timeline-title { font-size: 0.84rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.timeline-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.timeline-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.8rem; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.timeline-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.timeline-chip .ts { font-family: monospace; font-weight: 700; color: var(--accent); }
.camera-progress-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.camera-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width 0.35s ease; }
.camera-stage { position: relative; flex: 1; min-height: 360px; border-radius: 20px; overflow: hidden; background: #000; border: 1px solid var(--border); }
#camera-video, #sim-canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
#camera-video.mirrored { transform: scaleX(-1); }
.camera-guide-overlay { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 96px 18px 16px; }
.body-frame { position: relative; width: 100%; flex: 1; border-radius: 16px; border: 2px dashed rgba(255, 255, 255, 0.35); transition: border-color 0.25s ease; }
.body-frame.capturing { border-color: rgba(16, 185, 129, 0.75); }
.body-frame .corner { position: absolute; width: 24px; height: 24px; border-color: var(--accent); border-style: solid; }
.body-frame .tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-radius: 10px 0 0 0; }
.body-frame .tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-radius: 0 10px 0 0; }
.body-frame .bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-radius: 0 0 0 10px; }
.body-frame .br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-radius: 0 0 10px 0; }
.camera-framing-hint { margin-top: 10px; background: rgba(11, 16, 27, 0.78); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.16); color: #e2e8f0; padding: 6px 14px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; text-align: center; }
.admin-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.config-grid-top { display: grid; grid-template-columns: 180px 1fr; gap: 12px; }
.cfg-list { display: flex; flex-direction: column; gap: 8px; }
.cfg-item { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.cfg-emoji-input { width: 52px !important; text-align: center; font-size: 1.15rem; padding: 8px 4px !important; }
.cfg-label-input { flex: 1; }
.cfg-item-actions { display: flex; gap: 4px; }
.cfg-add-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.cfg-add-row input[type="text"]:not(.cfg-emoji-input) { flex: 1; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.92rem; }
.cfg-add-row .cfg-emoji-input { padding: 10px 4px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.challenge-banner { position: absolute; top: 14px; left: 14px; right: 14px; background: rgba(11, 16, 27, 0.88); backdrop-filter: blur(10px); border: 1px solid rgba(16, 185, 129, 0.45); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); }
.challenge-emoji { font-size: 2rem; line-height: 1; }
.challenge-text { flex: 1; }
.challenge-kicker { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; }
.challenge-text strong { font-size: 1.08rem; color: #fff; }
.challenge-countdown { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #031510; font-weight: 800; font-size: 1.2rem; display: grid; place-items: center; flex-shrink: 0; }
.camera-fallback { position: absolute; inset: 0; background: rgba(11, 16, 27, 0.96); display: grid; place-items: center; padding: 24px; text-align: center; }
.fallback-icon { font-size: 2.6rem; margin-bottom: 10px; }
.fallback-box h3 { margin-bottom: 8px; }
.fallback-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 18px; }
.fallback-actions { display: flex; flex-direction: column; gap: 10px; }
.camera-footer { display: flex; flex-direction: column; gap: 10px; }
.camera-controls { display: flex; justify-content: center; }
.camera-controls .btn { width: 100%; }
.ready-shell { width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; padding: 28px 24px; text-align: center; }
.ready-check { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--cyan)); color: #031510; font-size: 2.2rem; font-weight: 900; display: grid; place-items: center; margin: 0 auto 14px; box-shadow: 0 10px 28px rgba(16, 185, 129, 0.35); }
.ready-shell h1 { font-size: 2rem; margin-bottom: 8px; }
.ready-subtitle { color: var(--text-muted); margin-bottom: 20px; }
.ready-actions { display: flex; flex-direction: column; gap: 10px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 18px; }
.stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 800; }
.stat-pending .stat-value { color: #fbbf24; }
.stat-approved .stat-value { color: #34d399; }
.stat-rejected .stat-value { color: #f87171; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.filter-pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.admin-toolbar .search-input { max-width: 280px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(6, 10, 18, 0.82); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.modal-card { width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto; padding: 24px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 12px; }
.lightbox img { max-width: 92vw; max-height: 78vh; border-radius: 14px; border: 1px solid var(--border); }
.lightbox-close { position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); color: #fff; font-size: 1.1rem; cursor: pointer; }
.lightbox-caption { color: var(--text-muted); font-size: 0.95rem; }
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 0.9rem; max-width: 340px; animation: slideIn 0.2s ease; }
.toast.success { border-left: 4px solid var(--accent); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 820px) {
  .auth-wrapper { grid-template-columns: 1fr; gap: 20px; margin-top: 8px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-actions { grid-template-columns: 1fr; }
  .admin-toolbar .search-input { max-width: 100%; }
}
@media (max-width: 640px) {
  .config-grid-top { grid-template-columns: 1fr; }
  .cfg-add-row { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .user-name { display: none; }
}