/* Vuelvo Bien — mobile first, sober, light. Red is only for urgent things. */
:root {
    /* October 2026 redesign: the colours of the logo. Yellow = the one action that matters, black = text
       and secondary actions, red = 112 and urgent, green = "he vuelto bien" and what is fine. */
    --bg: #f5f4ef;
    --surface: #ffffff;
    --text: #141414;
    --muted: #55585c;
    --border: #dcdbd5;
    --primary: #141414;
    --primary-text: #ffffff;
    --accent: #fceb03;
    --accent-soft: #fff9c2;
    --urgent: #c8120e;
    --ok: #1e7a34;
    --radius: 14px;
    --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Archivo", "Atkinson Hyperlegible", system-ui, sans-serif;
}

/* Self-hosted (OFL, public/fonts): no request ever leaves for a font service. */
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/archivo-latin-800-normal.woff2") format("woff2"); }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
}

h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -.01em; font-size: 1.7rem; line-height: 1.15; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
p { margin: 0 0 1rem; }
a { color: var(--primary); }

.container { padding: 1.25rem 1rem 3rem; max-width: 40rem; margin: 0 auto; }
.container.narrow { max-width: 26rem; padding-top: 2.5rem; }

.brand { font-weight: 700; color: var(--primary); text-decoration: none; margin-bottom: 1.5rem; display: inline-block; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .brand { margin: 0; white-space: nowrap; }
.topbar-nav { display: flex; gap: .8rem; align-items: center; font-size: .95rem; }
.topbar-nav form { margin: 0; }

.stack > * + * { margin-top: .75rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }

label { display: block; font-weight: 600; }

input[type=email], input[type=text] {
    width: 100%; padding: .85rem 1rem; font-size: 1rem;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
input:focus { outline: 3px solid #f2d600; outline-offset: 1px; }

.checkbox { display: flex; gap: .75rem; align-items: flex-start; font-weight: 400; }
.checkbox input { width: 1.4rem; height: 1.4rem; margin-top: .15rem; flex-shrink: 0; }

.button {
    display: block; width: 100%; padding: .9rem 1rem; min-height: 48px;
    font-size: 1rem; font-weight: 600; text-align: center; text-decoration: none;
    border: 1px solid var(--primary); border-radius: var(--radius);
    background: var(--primary); color: var(--primary-text); cursor: pointer;
}
.button.secondary { background: var(--surface); color: var(--primary); border-width: 2px; }
.button.danger { background: var(--urgent); border-color: var(--urgent); color: #fff; }
.button[disabled] { opacity: .6; }
.row .button { width: auto; flex: 1; }

.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.card > :last-child { margin-bottom: 0; }

.consent-text { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.error { color: var(--urgent); font-weight: 600; }
.notice { background: #e8f5e9; color: var(--ok); border-radius: var(--radius); padding: .75rem 1rem; }
.draft { background: #fff8e1; border-radius: var(--radius); padding: .5rem .75rem; font-size: .875rem; }

.divider { text-align: center; color: var(--muted); margin: 1.25rem 0; }

/* ---- Hito 2: profiles ---- */
.back { display: inline-block; margin-bottom: .5rem; text-decoration: none; font-size: .95rem; }
.eyebrow { margin-bottom: .25rem; }

input[type=tel], input[type=number], input[type=date], input[type=file], select, textarea {
    width: 100%; padding: .85rem 1rem; font-size: 1rem; font-family: inherit;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
}
input[type=file] { padding: .6rem; }
select:focus, textarea:focus { outline: 3px solid #f2d600; outline-offset: 1px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: .5rem; padding: 0; }
.grow { flex: 1; min-width: 8rem; }

.list { list-style: none; padding: 0; margin-left: 0; margin-right: 0; margin-bottom: 0; }
.list > li + li { margin-top: .5rem; }
.list-link, .block-link {
    display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1rem; text-decoration: none; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.blocks { list-style: none; padding: 0; margin-left: 0; margin-right: 0; margin-bottom: 0; }
.blocks > li + li { margin-top: .5rem; }
.block-title { font-weight: 600; color: var(--primary); }

.item {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem;
}
.item p { margin: .15rem 0 0; }
.item-actions { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; }
.visibility-item { flex-direction: column; }

.badge {
    display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px;
    background: #eceff3; color: var(--primary); vertical-align: middle;
}
.badge.urgent { background: #fdecea; color: var(--urgent); }
.badge.ok { background: #e8f5e9; color: var(--ok); }

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; }
.alert-option.is-on { border-color: var(--urgent); }
.locked { border-style: dashed; }
.warning { color: #8a5300; background: #fff8e1; border-radius: 8px; padding: .4rem .6rem; margin: .25rem 0 0; }
.ok { color: var(--ok); font-weight: 600; }
.missing-list { margin: 0; padding-left: 1.1rem; }
.photo { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }

.tabs { display: flex; gap: .5rem; }
.tab {
    flex: 1; padding: .7rem; font: inherit; font-weight: 600; border-radius: var(--radius); cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--primary);
}
.tab.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

/* Emergency screen styles live in resources/views/emergency/styles.blade.php (shared with the scan screen). */
.phone-frame { border: 1px solid var(--border); border-radius: 20px; overflow: hidden; background: var(--surface); }

/* ---- Hito 3: stickers and outings ---- */
.button.big { font-size: 1.2rem; padding: 1.1rem 1rem; }
.countdown { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 0; }
.list-link strong .muted { font-weight: 400; }

/* ---- Hito 7: activity, account ---- */
.topbar-nav { flex-wrap: wrap; justify-content: flex-end; row-gap: .25rem; }
.activity-item { flex-direction: column; gap: .15rem; }
.activity-item p { margin: 0; }
.activity-item .badge { align-self: flex-start; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.pagination .button { width: auto; padding: .6rem .9rem; min-height: 44px; }
.pagination [aria-disabled=true] { opacity: .45; }
.filters label { font-size: .9rem; }
.steps-list { padding-left: 1.2rem; margin: 0; }
.steps-list li + li { margin-top: .5rem; }

/* ---- Hito 8: admin panel ---- */
.container.wide { max-width: 60rem; }
.narrow-content { max-width: 26rem; }
.admin-bar { background: #1f3a5f; border-bottom-color: #1f3a5f; }
.admin-bar .brand, .admin-bar .topbar-nav a { color: #fff; }
.admin-bar .badge { background: #fff; color: #1f3a5f; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .6rem; }
.tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .9rem; text-decoration: none; color: var(--text); }
.tile strong { font-size: 1.6rem; line-height: 1.2; }
.tile-urgent { border-color: var(--urgent); }
.tile-urgent strong { color: var(--urgent); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: .45rem .5rem; border-bottom: 1px solid var(--border); font-size: .95rem; }
table.data th { font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }
table.bars th { width: 3.5rem; font-weight: 500; font-size: .85rem; padding: .15rem .3rem; }
table.bars td { padding: .15rem .3rem; font-size: .85rem; white-space: nowrap; }
.bar { display: inline-block; height: .9rem; background: var(--primary); border-radius: 3px; vertical-align: middle; min-width: 2px; }
.qr { max-width: 220px; margin: .5rem 0; }
.qr svg { width: 100%; height: auto; }
.secret { word-break: break-all; }
.codes-list { columns: 2; list-style: none; padding: 0; margin: 0; }
.codes-list li { margin-bottom: .4rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 480px) { table.data { display: block; overflow-x: auto; } }

/* ---- Hito 9: PWA, onboarding, accessibility ---- */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--primary); color: #fff; padding: .5rem 1rem; z-index: 10; border-radius: 0 0 var(--radius) 0; }
.skip-link:focus { left: 0; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 3px solid #141414; outline-offset: 2px; box-shadow: 0 0 0 6px var(--accent); }
.progress { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.progress-bar { flex: 1; height: .6rem; background: #e3e3e0; border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.progress-text { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.onboarding-actions { display: flex; flex-direction: column; gap: .6rem; }
.onboarding-actions .button { width: 100%; }
.onboarding-skip { text-align: center; }
.big-112-page { font-size: 3rem; font-weight: 900; color: var(--urgent); text-align: center; text-decoration: none; display: block; margin: 1rem 0; }
.faq summary { font-weight: 600; cursor: pointer; padding: .5rem 0; }
.faq details { border-bottom: 1px solid var(--border); }
.faq details p { margin: .25rem 0 .75rem; }
.install-steps { padding-left: 1.2rem; }
.install-steps li + li { margin-top: .4rem; }

/* Closed beta (October 2026) */
.beta-banner { background: #fff3e0; color: #4e342e; border-bottom: 1px solid #ffcc80; padding: .5rem 1rem; font-size: .875rem; line-height: 1.4; }
.beta-banner .badge { background: #ef6c00; color: #fff; margin-right: .25rem; }
.beta-banner a { margin-left: .25rem; white-space: nowrap; }
.beta-banner strong { display: block; }
.real-data { background: #e3f2fd; color: #0d47a1; border-left: 4px solid #1565c0; padding: .5rem .75rem; border-radius: 0 var(--radius) var(--radius) 0; font-size: .9rem; }
.badge.warn { background: #fff3e0; color: #e65100; }

/* Stickers created from the account (October 2026) */
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 4.4rem; cursor: pointer; font-size: .75rem; text-align: center; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch-color { display: block; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--swatch); border: 2px solid #d9d9d6; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch input:checked + .swatch-color { border-color: #0d2b5a; box-shadow: 0 0 0 3px #fff, 0 0 0 5px #0d2b5a; }
.swatch input:focus-visible + .swatch-color { outline: 3px solid #1565c0; outline-offset: 2px; }
.swatch-dot { display: inline-block; width: .9rem; height: .9rem; border-radius: 50%; background: var(--swatch); border: 1px solid #999; vertical-align: middle; }
.sticker-preview { display: flex; justify-content: center; padding: 1rem; background: #eceae6; border-radius: var(--radius); }
.sticker-preview svg { max-width: 100%; height: auto; max-height: 24rem; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.button.disabled { opacity: .5; pointer-events: none; }

/* Fixed confirmation / error toast (forms.js): visible wherever the person has scrolled to. */
.toast { position: fixed; top: calc(.75rem + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 1000;
    max-width: min(92vw, 32rem); background: var(--ok); color: #fff; padding: .8rem 1.1rem; border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0,0,0,.18); font-weight: 600; }
.toast-urgent { background: var(--urgent); }

/* ==== October 2026 redesign ==== */
.button { font-family: inherit; }
.button.go { background: var(--accent); color: var(--text); border: 0; box-shadow: 0 2px 0 var(--text); font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; border-radius: 18px; }
.button.go small { font-family: var(--font); font-weight: 400; font-size: .9rem; }
.button.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; min-height: 72px; border-radius: 18px; }
.button.urgent { background: var(--urgent); border-color: var(--urgent); color: #fff; }

/* Header and bottom menu of the signed-in area. */
.appbar { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.appbar .brand { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--text); font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.appbar .brand img { width: 30px; height: 30px; }
.appbar .appbar-end { margin-left: auto; font-size: .9rem; color: var(--muted); }
.has-tabbar { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    background: var(--surface); border-top: 1px solid var(--border); padding: .4rem .3rem calc(.6rem + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: 54px; color: var(--muted); font-size: .78rem; text-decoration: none; }
.tabbar a .tab-icon { display: flex; align-items: center; justify-content: center; width: 3.4rem; height: 1.9rem; border-radius: 999px; }
.tabbar a[aria-current=page] { color: var(--text); font-weight: 700; }
.tabbar a[aria-current=page] .tab-icon { background: var(--accent); }
.tabbar svg { width: 23px; height: 23px; }
@media (min-width: 52rem) { .tabbar { left: 50%; right: auto; width: 40rem; transform: translateX(-50%); border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; } }

/* Home */
.status-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1.2rem; }
.status-card .eyebrow-dot { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--muted); margin: 0 0 .3rem; }
.status-card .eyebrow-dot::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: #a3a39e; }
.status-card h1, .status-card h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; line-height: 1.1; margin: 0 0 .4rem; }
.status-card.live { background: var(--text); color: #fff; border-color: var(--text); }
.status-card.live .eyebrow-dot { color: #fff; }
.status-card.live .eyebrow-dot::before { background: var(--accent); }
.status-card.live .countdown { color: var(--accent); font-family: var(--font-display); font-size: 4.2rem; line-height: 1; letter-spacing: -.03em; }
.status-card.live .countdown .error { color: #ffb4ab; font-size: 1.6rem; }
.status-card.live .muted { color: #d6d6d0; }
.banner-warn { display: flex; align-items: center; gap: .75rem; background: #fff4e5; border: 1px solid #f0b46b; border-radius: var(--radius); padding: .75rem .9rem; color: var(--text); text-decoration: none; }
.banner-warn strong { display: block; }
.progress-card { display: flex; align-items: center; gap: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: .9rem 1rem; color: var(--text); text-decoration: none; }
.ring { position: relative; width: 52px; height: 52px; flex: none; border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--p) * 1%), #e6e5df 0); }
.ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1; font-size: .8rem; font-weight: 700; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: .6rem; min-height: 44px; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist li .tick { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--text); display: flex; align-items: center; justify-content: center; }
.checklist li.done .tick { border-color: var(--ok); background: var(--ok); color: #fff; }
.actions-bottom { display: flex; flex-direction: column; gap: .6rem; }

/* "Salgo ahora": choice chips */
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.chip { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-height: 52px; padding: .5rem; text-align: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; font-weight: 700; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip .chip-sub { font-weight: 400; font-size: .8rem; color: var(--muted); }
.chip:has(input:checked) { background: var(--accent-soft); border: 2px solid var(--text); }
.chip:has(input:focus-visible) { outline: 3px solid var(--text); outline-offset: 2px; }
.chip .chip-check { display: none; position: absolute; top: 5px; right: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); color: var(--accent); font-size: .7rem; line-height: 18px; }
.chip:has(input:checked) .chip-check { display: block; }
.chips.things .chip { min-height: 70px; }

/* Timeline: "qué pasa si no confirmas" */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; display: flex; gap: .75rem; padding: 0 0 .9rem; }
.timeline li::before { content: ""; flex: none; width: 12px; height: 12px; margin-top: .4rem; border-radius: 50%; border: 2px solid var(--text); background: var(--surface); box-sizing: border-box; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 1.2rem; bottom: .1rem; width: 2px; background: var(--border); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.alert::before { background: var(--urgent); border-color: var(--urgent); }
.timeline li:last-child { padding-bottom: 0; }

/* Segmented tabs (sticker page) */
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: #efeee8; border-radius: 12px; padding: 4px; }
.segmented button, .segmented a { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font: inherit; color: var(--muted); display: flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.segmented [aria-selected=true] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* Radio cards ("qué se ve sin salida") */
.radio-card { display: flex; align-items: center; gap: .8rem; min-height: 64px; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; font-weight: 400; cursor: pointer; }
.radio-card input { width: 1.3rem; height: 1.3rem; accent-color: var(--text); flex: none; }
.radio-card:has(input:checked) { background: var(--accent-soft); border: 2px solid var(--text); }
.radio-card strong { display: block; }
.thing-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex: none; }
.thing-row { display: flex; align-items: center; gap: .9rem; }
.status-ok { color: var(--ok); font-weight: 700; }
.status-todo { color: #a24a00; font-weight: 700; }
