/* Portal público de seguridad (formas por QR) — pensado primero para el teléfono.
   Sin estilos en línea: el CSP del portal es style-src 'self'. */
:root {
    --navy: #0a0a3c; --navy-2: #171a5e; --amber: #f7941d; --amber-ink: #8a4b00;
    --bg: #f3f5fa; --card: #ffffff; --ink: #0f172a; --muted: #5b6577; --line: #dfe4ee;
    --ok: #15803d; --ok-bg: #e7f6ec; --err: #b42318; --err-bg: #fdecea;
    --hazard: #c2410c; --hazard-bg: #fff1e6; --incident: #b42318; --incident-bg: #fdecea; --idea: #0f6fb8; --idea-bg: #e6f2fb;
    --radius: 16px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 17px; line-height: 1.45;
       color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.center { text-align: center; }

/* Barra superior */
.top { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 12px 16px;
       padding-top: calc(12px + env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.top-brand img { border-radius: 10px; background: #fff; padding: 3px; object-fit: contain; }
.top-brand b { display: block; font-size: 16px; font-weight: 700; letter-spacing: .1px; white-space: nowrap; }
.top-brand i { display: block; font-style: normal; font-size: 12.5px; color: var(--amber); font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.lang { display: flex; background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 3px; flex: none; }
.lang a { color: #dbe1f1; text-decoration: none; font-weight: 700; font-size: 13px; padding: 7px 13px; border-radius: 999px; min-width: 44px; text-align: center; }
.lang a.on { background: #fff; color: var(--navy); }

.wrap { width: 100%; max-width: 620px; margin: 0 auto; padding: 22px 16px 32px; flex: 1; }

/* Inicio */
.hero { margin: 6px 2px 22px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--amber-ink); }
h1 { font-size: 30px; line-height: 1.12; font-weight: 800; letter-spacing: -.4px; margin: 6px 0 10px; text-wrap: balance; }
.lead { color: var(--muted); margin: 0 0 14px; font-size: 17px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px;
        padding: 8px 14px 8px 11px; font-size: 14.5px; color: var(--muted); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.chip .ic { color: var(--amber); }
.chip b { color: var(--ink); font-weight: 600; }
.chip-sm { padding: 5px 11px 5px 8px; font-size: 13.5px; margin-top: 6px; }

.cards { display: grid; gap: 12px; }
.card { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 16px 14px 16px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease; }
.card:active { transform: scale(.985); }
.card:hover, .card:focus-visible { border-color: var(--navy); }
.card-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.card-ic .ic { width: 28px; height: 28px; }
.card-hazard .card-ic, .form-hazard .card-ic { background: var(--hazard-bg); color: var(--hazard); }
.card-incident .card-ic, .form-incident .card-ic { background: var(--incident-bg); color: var(--incident); }
.card-idea .card-ic, .form-idea .card-ic { background: var(--idea-bg); color: var(--idea); }
.card-tx { flex: 1; min-width: 0; }
.card-tx b { display: block; font-size: 18.5px; font-weight: 700; }
.card-tx i { display: block; font-style: normal; color: var(--muted); font-size: 14.5px; line-height: 1.35; margin-top: 2px; }
.card-go { color: #9aa3b5; display: grid; place-items: center; }

.trust { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trust li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; font-size: 13px; color: var(--muted); line-height: 1.25; padding: 4px; }
.trust .ic { width: 22px; height: 22px; color: var(--navy); }
.emergency { display: flex; gap: 10px; align-items: flex-start; margin: 22px 0 0; padding: 13px 14px; border-radius: 12px;
             background: var(--err-bg); color: #7a1a12; font-size: 14.5px; line-height: 1.35; }
.emergency .ic { margin-top: 1px; }

/* Forma */
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; padding: 6px 4px; margin: -6px 0 8px -4px; }
.form-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.form-head h1 { font-size: 25px; margin: 0; }
.progress { margin: 0 2px 14px; }
.progress-bar { height: 6px; border-radius: 999px; background: #dfe4ee; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 33.34%; background: var(--amber); border-radius: 999px; transition: width .25s ease; }
.progress-bar span.p2 { width: 66.67%; }
.progress-bar span.p3 { width: 100%; }
.progress-steps { list-style: none; display: flex; justify-content: space-between; margin: 7px 0 0; padding: 0; font-size: 12.5px; font-weight: 600; color: #9aa3b5; text-transform: uppercase; letter-spacing: .6px; }
.progress-steps li.on { color: var(--navy); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 16px 16px; }
.step-h { font-size: 20px; font-weight: 700; margin: 0 0 14px; }
.field { margin-bottom: 18px; }
.field label, .field legend { display: block; font-weight: 600; font-size: 16px; margin-bottom: 6px; padding: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.help { color: var(--muted); font-size: 14px; margin: -2px 0 8px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], select, textarea {
    width: 100%; font: inherit; font-size: 17px; color: var(--ink); background: #fff; border: 1.5px solid #c9d1df; border-radius: 12px;
    padding: 13px 14px; min-height: 52px; appearance: none; -webkit-appearance: none; }
textarea { resize: vertical; min-height: 116px; line-height: 1.4; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6577' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
         background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; padding-right: 42px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(10, 10, 60, .14); }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--err); }
.err { color: var(--err); font-size: 14px; font-weight: 500; margin: 6px 0 0; }

.pills { display: grid; gap: 8px; }
.pills-2 { grid-template-columns: 1fr 1fr; }
.pills-3 { grid-template-columns: 1fr 1fr 1fr; }
.pills input, .options input { position: absolute; opacity: 0; pointer-events: none; }
.pill { display: grid !important; place-items: center; text-align: center; min-height: 52px; padding: 10px 8px; margin: 0 !important; border: 1.5px solid #c9d1df; border-radius: 12px;
        background: #fff; font-weight: 600 !important; font-size: 16px !important; cursor: pointer; user-select: none; }
.pills input:checked + .pill { background: var(--navy); border-color: var(--navy); color: #fff; }
.pills input:checked + .pill-low { background: #15803d; border-color: #15803d; }
.pills input:checked + .pill-medium { background: #b45309; border-color: #b45309; }
.pills input:checked + .pill-high { background: #b42318; border-color: #b42318; }
.pills input:focus-visible + .pill, .options input:focus-visible + .option { box-shadow: 0 0 0 3px rgba(10, 10, 60, .22); }
.field.bad .pill, .field.bad .option { border-color: var(--err); }

.options { display: grid; gap: 10px; }
.option { display: flex !important; align-items: center; gap: 12px; padding: 14px; margin: 0 !important; border: 1.5px solid #c9d1df; border-radius: 14px; background: #fff; cursor: pointer; }
.option .ic { width: 26px; height: 26px; color: var(--muted); }
.option b { display: block; font-size: 16.5px; font-weight: 700; }
.option i { display: block; font-style: normal; font-weight: 400; color: var(--muted); font-size: 14px; line-height: 1.3; }
.options input:checked + .option { border-color: var(--navy); background: #f1f3fb; box-shadow: inset 0 0 0 1px var(--navy); }
.options input:checked + .option .ic { color: var(--navy); }

.confidential { display: flex; gap: 10px; align-items: flex-start; background: var(--ok-bg); color: #14532d; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.35; margin: 4px 0 4px; }

/* Fotos */
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #e8ecf4; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .78); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.thumb button .ic { width: 16px; height: 16px; }
.photo-btn { display: flex !important; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border: 2px dashed #b4bfd3; border-radius: 14px; color: var(--navy);
             font-weight: 600 !important; cursor: pointer; background: #f8f9fd; margin: 0 0 12px !important; }
.photo-btn .ic { width: 26px; height: 26px; }
.photo-btn.off { opacity: .45; pointer-events: none; }

/* Botones */
.actions { display: flex; gap: 10px; margin-top: 8px; position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0, #fff 14px); padding: 16px 0 calc(4px + env(safe-area-inset-bottom)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 20px; border-radius: 14px; border: 1.5px solid transparent;
       font: inherit; font-weight: 700; font-size: 17px; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; flex: 1; }
.btn-primary:active { background: var(--navy-2); }
.btn-primary[disabled] { opacity: .6; cursor: default; }
.btn-ghost { background: #fff; border-color: #c9d1df; color: var(--ink); }
.banner { border-radius: 12px; padding: 12px 14px; font-size: 15px; margin: 0 0 14px; }
.banner-err { background: var(--err-bg); color: #7a1a12; }

/* Confirmación */
.big-ic { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto 14px; }
.big-ic .ic { width: 40px; height: 40px; stroke-width: 2.4; }
.big-ic.ok { background: var(--ok-bg); color: var(--ok); }
.big-ic.warn { background: var(--hazard-bg); color: var(--hazard); }
#done:focus { outline: none; }   /* recibe el foco al terminar (lectores de pantalla); sin marco */
#done h1, .panel.center h1 { font-size: 24px; }
.ref { display: inline-flex; flex-direction: column; gap: 2px; background: var(--bg); border: 1px dashed #b4bfd3; border-radius: 14px; padding: 12px 26px; margin: 4px 0 20px; }
.ref span { font-size: 12.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.ref b { font-size: 26px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
#done .btn { width: 100%; }

.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.foot { text-align: center; color: #8b94a7; font-size: 13px; padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); line-height: 1.5; }
.foot b { color: var(--muted); }

@media (min-width: 640px) {
    .wrap { padding-top: 34px; }
    h1 { font-size: 36px; }
    .panel { padding: 26px 26px 20px; }
    .trust li { flex-direction: row; justify-content: center; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
