:root {
    --bg: #0d0f12;
    --surface: #1a1d23;
    --surface-2: #23272f;
    --text: #f2f4f8;
    --muted: #9aa3b2;
    --primary: #2f7bff;
    --primary-press: #2563d6;
    --danger: #ff5a5a;
    --border: #2e333d;
    --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.4;
}

body {
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    padding-top: calc(16px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
}
.logo-sm { font-size: 18px; font-weight: 700; margin: 0; }
.logout-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface-2);
}

/* ---------- App layout ---------- */
.app { padding: 22px 18px 40px; max-width: 520px; margin: 0 auto; }
.step { display: flex; flex-direction: column; gap: 16px; }
.hidden { display: none !important; }

.instructions { color: var(--muted); margin: 0 0 6px; }
.instructions strong { color: var(--text); }

/* ---------- Botones ---------- */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-radius: var(--radius);
    padding: 18px 20px;
    font-size: 19px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    text-align: center;
}
.btn-primary { background: var(--primary); }
.btn-primary:active { background: var(--primary-press); }
.btn-secondary { background: var(--surface-2); }
.btn-secondary:active { background: var(--surface); }
.btn-photo { font-size: 22px; padding: 26px 20px; }

/* ---------- Campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 14px; color: var(--muted); }
.field input, .field textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 18px;
    padding: 14px 16px;
    width: 100%;
    font-family: inherit;
    resize: vertical;
}
.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ---------- Error ---------- */
.error-box {
    background: rgba(255, 90, 90, 0.12);
    border: 1px solid var(--danger);
    color: #ffb3b3;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 15px;
}

/* ---------- Spinner ---------- */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--surface-2);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 30px auto 8px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#step-loading { align-items: center; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 32px 24px;
    text-align: center;
}
.logo { font-size: 34px; font-weight: 800; line-height: 1.05; margin: 0 0 6px; }
.logo span { color: var(--primary); }
.subtitle { color: var(--muted); margin: 0 0 26px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 18px;
    padding: 16px 18px;
    text-align: center;
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.hint { color: var(--muted); font-size: 13px; margin-top: 18px; }
