*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d1a;
  --surface: #1a1a2e;
  --surface2: #16213e;
  --accent: #4f8ef7;
  --text: #f0f0f0;
  --muted: #8888aa;
  --border: #2a2a44;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #fbbf24;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.page { display: none; }
.page.active { display: block; }

/* ── Auth (login + register) ──────────────────────────── */
#page-auth {
  display: none;
  min-height: 100vh;
  align-items: flex-start;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 20%, #1a0a3e 0%, var(--bg) 65%);
  padding: 40px 16px;
}
#page-auth.active { display: flex; }

.auth-center { width: 100%; max-width: 440px; }

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  overflow: hidden;
}

.auth-logo {
  text-align: center;
  padding: 36px 40px 20px;
}
.auth-logo img { height: 44px; }
.auth-logo h1 {
  font-size: 24px; font-weight: 700; margin-top: 10px;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-logo p { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
}
.auth-tab {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 12px 0; font-size: 14px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .2s, border-color .2s;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-tab:hover:not(.active) { color: var(--text); }

/* Panels */
.auth-panel { display: none; padding: 28px 40px 36px; }
.auth-panel.active { display: block; }

/* Fields */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input[type=text],
.field input[type=email],
.field input[type=password] {
  width: 100%; padding: 11px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 15px;
  transition: border-color .2s;
}
.field input:focus { outline: none; border-color: var(--accent); }

/* Bank picker */
.bank-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bank-opt { cursor: pointer; }
.bank-opt input[type=radio] { display: none; }
.bank-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 2px solid var(--border);
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.bank-opt input:checked ~ .bank-card { border-color: var(--accent); background: rgba(79,142,247,.08); }
.bank-name { font-weight: 700; font-size: 14px; }
.bank-desc { font-size: 11px; color: var(--muted); }
.bank-a-card .bank-name { color: var(--accent); }
.bank-b-card .bank-name { color: var(--green); }

/* Step header */
.step-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; margin-bottom: 18px;
}
.step-badge {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.step-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* Succes scherm */
.success-box { text-align: center; padding: 8px 0; }
.success-icon { font-size: 48px; margin-bottom: 12px; }
.success-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.success-box p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

.idx-reveal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 4px;
}
.idx-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.idx-code-big {
  font-family: 'Courier New', monospace;
  font-size: 24px; font-weight: 700; letter-spacing: 3px;
  color: var(--accent); margin-bottom: 10px;
}
.idx-badge-sm {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(34,197,94,.15); color: var(--green);
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer; border: none;
  transition: opacity .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover:not(:disabled) { opacity: .9; }
.btn-outline {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; padding: 8px 16px;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px; display: none;
}
.alert.visible { display: block; }
.alert-error {
  background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); color: #fca5a5;
}
.alert-success {
  background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.4); color: #86efac;
}

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.navbar-logo { display: flex; align-items: center; gap: 10px; }
.navbar-logo span { font-weight: 700; font-size: 18px; }
.navbar-spacer { flex: 1; }
.navbar-user { font-size: 13px; color: var(--muted); }
.navbar-user strong { color: var(--text); }

/* ── Dashboard ──────────────────────────────────────── */
.dashboard-wrap { max-width: 960px; margin: 0 auto; padding: 32px 24px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media(max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
}
.card-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 12px;
}
.balance-amount { font-size: 36px; font-weight: 700; letter-spacing: -1px; }
.balance-iban { font-size: 13px; color: var(--muted); margin-top: 6px; font-family: monospace; }
.balance-bank { display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.bank-a { background: rgba(79,142,247,.2); color: var(--accent); }
.bank-b { background: rgba(34,197,94,.2); color: var(--green); }
.idx-code { font-family: 'Courier New', monospace; font-size: 22px; font-weight: 700; letter-spacing: 2px; color: var(--accent); margin: 4px 0 10px; }
.idx-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(34,197,94,.15); color: var(--green); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; }

/* ── Camera ─────────────────────────────────────────── */
.cam-wrap {
  position: relative; width: 100%; max-width: 480px;
  aspect-ratio: 1/1; background: #000;
  border-radius: var(--radius); overflow: hidden; margin: 0 auto;
}
#cam-video, #reg-video {
  width: 100%; height: 100%; object-fit: cover;
}
#cam-overlay, #reg-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
#cam-challenge-box, #reg-challenge-box {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  padding: 14px; text-align: center;
}
#cam-challenge-text, #reg-challenge-text {
  font-size: 18px; font-weight: 700; color: #fff;
}
#cam-loading-overlay, #reg-loading-overlay {
  position: absolute; inset: 0; background: rgba(13,13,26,.9);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  color: var(--muted); font-size: 14px;
}
#cam-loading-overlay.hidden, #reg-loading-overlay.hidden { display: none; }

/* ── Progress ────────────────────────────────────────── */
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.progress-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; width: 0%; }

/* ── Face result ─────────────────────────────────────── */
.result-box {
  padding: 16px 20px; border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
}
.result-box.success { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.4); color: var(--green); }
.result-box.fail    { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.4);  color: #fca5a5; }

/* ── Transactions ────────────────────────────────────── */
.tx-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tx-header h2 { font-size: 16px; font-weight: 600; }
.tx-list { display: flex; flex-direction: column; gap: 2px; }
.tx-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); transition: background .15s; }
.tx-item:hover { background: var(--surface2); }
.tx-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.tx-icon.in      { background: rgba(34,197,94,.15); }
.tx-icon.out     { background: rgba(239,68,68,.15); }
.tx-icon.pending { background: rgba(251,191,36,.15); }
.tx-info { flex: 1; min-width: 0; }
.tx-name { font-size: 14px; font-weight: 500; }
.tx-date { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tx-amount { font-size: 15px; font-weight: 600; text-align: right; flex-shrink: 0; }
.tx-amount.in      { color: var(--green); }
.tx-amount.out     { color: var(--red); }
.tx-amount.pending { color: var(--yellow); }
.empty-state { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }

/* ── QR code ─────────────────────────────────────────── */
.qr-instruction {
  font-size: 13px; color: var(--muted); margin-bottom: 18px; line-height: 1.6;
}
.qr-wrap {
  display: flex; justify-content: center; margin-bottom: 16px;
}
#qr-container { display: flex; justify-content: center; }
#qr-container img,
#qr-container canvas {
  border-radius: var(--radius);
  border: 6px solid #fff;
  width: 200px !important; height: 200px !important;
}
.qr-link-row {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 16px;
}
.qr-link-label { font-size: 11px; color: var(--muted); }
.qr-link-url {
  font-size: 12px; color: var(--accent); word-break: break-all;
  text-decoration: none;
}
.qr-link-url:hover { text-decoration: underline; }

/* Poll status indicator */
.poll-status {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px;
}
.poll-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  animation: pulse 1.4s ease-in-out infinite;
}
.poll-dot.done { background: var(--green); animation: none; }
.poll-dot.error { background: var(--red); animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.75); }
}

/* ── 3-segment liveness bar ──────────────────────────── */
.segments-wrap { display: flex; gap: 8px; }
.seg { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.seg-track { width: 100%; height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.seg-fill { height: 100%; width: 0%; border-radius: 99px; background: var(--accent); transition: width .25s ease, background .3s; }
.seg-fill.done    { background: var(--green); }
.seg-fill.skipped { background: rgba(136,136,170,.35); }
.seg-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.seg-icon  { font-size: 14px; min-height: 18px; color: var(--green); }
.all-done {
  display: none; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 0 2px; font-size: 18px; font-weight: 800; color: var(--green);
  animation: popIn .35s ease;
}
.all-done.visible { display: flex; }
@keyframes popIn { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Utilities ───────────────────────────────────────── */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; align-items: center; justify-content: center; padding: 60px; gap: 12px; color: var(--muted); }
