/* Vista de verificación de carnets — sin dependencias externas. */
:root {
    --brand: #1d4ed8;
    --on-brand: #ffffff;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --ok: #15803d;
    --ok-soft: #dcfce7;
    --bad: #b91c1c;
    --bad-soft: #fee2e2;
    --wait: #b45309;
    --wait-soft: #fef3c7;
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, .25);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1220;
        --surface: #111a2e;
        --ink: #e2e8f0;
        --muted: #94a3b8;
        --line: #1f2b44;
        --ok: #4ade80;
        --ok-soft: rgba(74, 222, 128, .12);
        --bad: #f87171;
        --bad-soft: rgba(248, 113, 113, .12);
        --wait: #fbbf24;
        --wait-soft: rgba(251, 191, 36, .12);
        --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
    }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

.card {
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* --- Estados sueltos (cargando, inválido, error) --- */
.state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
}
.title { margin: 0; font-size: 1.25rem; font-weight: 700; }
.muted { margin: 0; color: var(--muted); font-size: .95rem; }
.big-icon { width: 56px; height: 56px; fill: currentColor; }
.big-icon.danger { color: var(--bad); }
.big-icon.warning { color: var(--wait); }

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.btn {
    min-height: 44px;
    padding: 10px 20px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: var(--on-brand);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* --- Resultado --- */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 64px;
    padding: 14px 20px 52px;
    background: var(--brand);
    color: var(--on-brand);
}
.brand-logo {
    max-width: 120px;
    max-height: 36px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 3px 6px;
}
.brand-name { font-weight: 600; font-size: 1rem; text-align: center; overflow-wrap: anywhere; }

.holder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: -44px;
    padding: 0 20px;
    text-align: center;
}
.photo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    height: 112px;
    overflow: hidden;
    border: 4px solid var(--surface);
    border-radius: 50%;
    background: var(--line);
    box-shadow: 0 6px 16px -6px rgba(15, 23, 42, .35);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { width: 56px; height: 56px; fill: var(--muted); }
.name { margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }

.status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 20px 4px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    font-size: .95rem;
}
.status-icon { width: 24px; height: 24px; flex: none; fill: currentColor; }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-bad { background: var(--bad-soft); color: var(--bad); }
.status-wait { background: var(--wait-soft); color: var(--wait); }

.fields { margin: 12px 20px 0; padding: 0; }
.field {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.field:last-child { border-bottom: 0; }
.field dt { color: var(--muted); font-size: .875rem; }
.field dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.contact { margin: 8px 20px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.contact h2 { margin: 0 0 10px; color: var(--muted); font-size: .8rem; font-weight: 600; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
}
.contact-link svg { width: 18px; height: 18px; fill: var(--brand); }
.contact-link:hover { border-color: var(--brand); }

.meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .8rem;
}
.link-btn {
    min-height: 32px;
    padding: 4px 8px;
    border: 0;
    background: none;
    color: var(--brand);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.powered { margin: 0; color: var(--muted); font-size: .75rem; text-align: center; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
    .contact-link svg { fill: currentColor; }
    .link-btn { color: var(--ink); }
}
