/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand:        #2563eb;
    --brand-dark:   #1d4ed8;
    --success:      #16a34a;
    --warn:         #d97706;
    --danger:       #dc2626;
    --text:         #111827;
    --text-muted:   #6b7280;
    --border:       #e5e7eb;
    --bg:           #f9fafb;
    --card-bg:      #ffffff;
    --banner-bg:    #fef3c7;
    --banner-border:#f59e0b;
    --radius:       0.5rem;
    --shadow:       0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
}

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

/* ── Demo Banner ──────────────────────────────────────────────────────────── */
.demo-banner {
    background: var(--banner-bg);
    border-bottom: 2px solid var(--banner-border);
    padding: 0.6rem 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: #92400e;
    position: sticky;
    top: 0;
    z-index: 100;
}

.demo-banner strong { font-weight: 700; }

/* ── Stepper Nav ──────────────────────────────────────────────────────────── */
.stepper {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.stepper-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.15s;
}

.step:last-child { flex: 0; }

.step-circle {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.15s;
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 0.4rem;
    transition: background 0.15s;
}

/* Completed steps (data-step on body drives these via CSS) */
body[data-step="2"] .step[data-step-ref="1"] .step-circle,
body[data-step="3"] .step[data-step-ref="1"] .step-circle,
body[data-step="3"] .step[data-step-ref="2"] .step-circle,
body[data-step="4"] .step[data-step-ref="1"] .step-circle,
body[data-step="4"] .step[data-step-ref="2"] .step-circle,
body[data-step="4"] .step[data-step-ref="3"] .step-circle {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

body[data-step="3"] .step[data-step-ref="1"] .step-line,
body[data-step="3"] .step[data-step-ref="2"] .step-line,
body[data-step="4"] .step[data-step-ref="1"] .step-line,
body[data-step="4"] .step[data-step-ref="2"] .step-line,
body[data-step="4"] .step[data-step-ref="3"] .step-line {
    background: var(--brand);
}

/* Active step */
body[data-step="2"] .step[data-step-ref="2"] .step-circle,
body[data-step="3"] .step[data-step-ref="3"] .step-circle,
body[data-step="4"] .step[data-step-ref="4"] .step-circle {
    border-color: var(--brand);
    color: var(--brand);
    font-weight: 700;
}

body[data-step="2"] .step[data-step-ref="2"] .step-label,
body[data-step="3"] .step[data-step-ref="3"] .step-label,
body[data-step="4"] .step[data-step-ref="4"] .step-label {
    color: var(--brand);
    font-weight: 700;
}

/* ── Main Layout ──────────────────────────────────────────────────────────── */
.main {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.main--wide { max-width: 1100px; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge--sim   { background: #fef3c7; color: #92400e; }
.badge--local { background: #dbeafe; color: #1e40af; }
.badge--ok    { background: #dcfce7; color: #166534; }
.badge--ial   { background: #f3e8ff; color: #6b21a8; font-size: 0.85rem; padding: 0.2rem 0.8rem; }

/* ── Privacy callout ──────────────────────────────────────────────────────── */
.privacy-note {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    font-size: 0.83rem;
    color: #1e40af;
    margin-bottom: 1.5rem;
}

.privacy-note .icon { flex-shrink: 0; font-size: 1rem; }

/* ── Google-style button ──────────────────────────────────────────────────── */
.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 0.6rem 1.25rem;
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    box-shadow: 0 1px 1px rgba(0,0,0,.1);
    transition: box-shadow 0.15s, background 0.15s;
    text-decoration: none;
}

.btn-google:hover { box-shadow: 0 2px 4px rgba(0,0,0,.15); background: #f8f9fa; }
.btn-google:active { background: #f1f3f4; }

.btn-google svg { width: 20px; height: 20px; }

/* ── Primary button ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, background 0.15s;
    text-decoration: none;
}

.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--secondary { background: #f3f4f6; color: var(--text); border: 1px solid var(--border); }
.btn--secondary:hover { background: #e5e7eb; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Landing hero ─────────────────────────────────────────────────────────── */
.landing-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4rem 1.5rem 3rem;
}

.landing-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; }
.landing-hero p  { color: var(--text-muted); max-width: 520px; margin-bottom: 2rem; font-size: 1.05rem; }

.landing-privacy {
    max-width: 520px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    color: #166534;
    text-align: left;
    margin-top: 2rem;
}

/* ── Claims table ─────────────────────────────────────────────────────────── */
.claims-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.1rem;
    font-size: 0.875rem;
}

.claims-grid .key {
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.45rem 0.75rem 0.45rem 0;
    border-bottom: 1px solid var(--border);
}

.claims-grid .val {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}

.claims-grid .val code {
    background: #f3f4f6;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    font-size: 0.85em;
}

/* ── Profile row ──────────────────────────────────────────────────────────── */
.profile-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.profile-row .name  { font-size: 1.15rem; font-weight: 700; }
.profile-row .email { color: var(--text-muted); font-size: 0.88rem; }

/* ── Accordion ────────────────────────────────────────────────────────────── */
details { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 0.75rem; }
summary {
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: '▶'; font-size: 0.65rem; color: var(--text-muted); transition: transform 0.15s; }
details[open] summary::before { transform: rotate(90deg); }
details pre {
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    overflow-x: auto;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── IDV input cards ──────────────────────────────────────────────────────── */
.input-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fff;
}

.input-card:hover { border-color: var(--brand); background: #eff6ff; }
.input-card.active { border-color: var(--brand); background: #eff6ff; }
.input-card .card-icon { font-size: 2rem; margin-bottom: 0.6rem; }
.input-card .card-lbl  { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.3rem; }
.input-card .card-desc { font-size: 0.78rem; color: var(--text-muted); }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.progress-wrap {
    margin: 1rem 0;
    background: #e5e7eb;
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--brand);
    border-radius: 9999px;
    width: 0%;
    transition: width 0.2s;
}

.progress-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Image preview ────────────────────────────────────────────────────────── */
.doc-preview {
    max-width: 100%;
    max-height: 280px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: block;
    margin: 0.75rem auto 1rem;
    object-fit: contain;
}

/* ── OCR result fields ────────────────────────────────────────────────────── */
.ocr-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1rem 0;
}

.ocr-field { display: flex; flex-direction: column; gap: 0.2rem; }
.ocr-field label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ocr-field .val {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.92rem;
    background: #f9fafb;
}

.ocr-field input {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--brand);
    border-radius: 4px;
    font-size: 0.92rem;
}

/* ── Liveness camera ──────────────────────────────────────────────────────── */
.camera-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 1rem;
}

.camera-video {
    width: 280px;
    height: 280px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--border);
    background: #000;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    pointer-events: none;
    transition: border-color 0.3s;
}

.camera-overlay.detecting { border-color: var(--brand); }
.camera-overlay.success   { border-color: var(--success); }

.liveness-status {
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0.5rem 0;
    min-height: 1.4em;
}

.liveness-stages {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
}

.stage {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stage.done { color: var(--success); }
.stage.active { color: var(--brand); font-weight: 700; }

.selfie-thumb {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--success);
    display: none;
}

/* ── Binding layout ───────────────────────────────────────────────────────── */
.binding-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.binding-col {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.binding-col h3 {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.binding-signal {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
    background: #fff;
}

.binding-signal .sig-icon { font-size: 1.25rem; flex-shrink: 0; line-height: 1; }
.binding-signal .sig-body { flex: 1; }
.binding-signal .sig-title { font-weight: 700; font-size: 0.9rem; }
.binding-signal .sig-detail { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

.score-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 9999px;
    margin-top: 0.4rem;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 9999px;
    background: var(--success);
    transition: width 0.6s ease;
}

.score-fill--warn { background: var(--warn); }
.score-fill--danger { background: var(--danger); }

.face-compare {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.face-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.face-compare .arrow { font-size: 1.25rem; color: var(--text-muted); }

/* ── Result badge ─────────────────────────────────────────────────────────── */
.result-box {
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.result-box .result-icon { font-size: 2rem; }
.result-box .result-title { font-size: 1.1rem; font-weight: 800; color: #166534; }
.result-box .result-sub   { font-size: 0.85rem; color: #15803d; margin-top: 0.2rem; }

/* ── Section header ───────────────────────────────────────────────────────── */
.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 { font-size: 1.4rem; font-weight: 800; }
.section-header p  { color: var(--text-muted); font-size: 0.92rem; margin-top: 0.25rem; }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .input-cards { grid-template-columns: 1fr; }
    .binding-cols { grid-template-columns: 1fr; }
    .ocr-fields { grid-template-columns: 1fr; }
    .stepper-inner { flex-wrap: wrap; gap: 0.5rem; }
    .step-line { display: none; }
    .landing-hero h1 { font-size: 1.5rem; }
}
