/* Mobile-first styles, designed at 390 px wide, working from 360 to 430 px (spec §7). */
:root {
    --ink: #1f2937;
    --muted: #4b5563;
    --line: #e2e8f0;
    --accent: #c2410c;
    --accent-ink: #fff;
    --success: #15803d;
    --danger: #b91c1c;
    --warn-bg: #fff7ed;
    --bg: #f9f8f6;
    --radius: 14px;
    color-scheme: light;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.5 "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    overflow-x: hidden;
}

.topbar { padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.page { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }

h1 { font-size: 24px; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 1.2rem; margin-top: 28px; }
a { color: var(--accent); }

.eyebrow { margin: 0; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.hint, .optional { color: var(--muted); font-size: .9rem; }
.hint { margin: 4px 0 0; }

.form label:not(.choice) { display: block; margin-top: 18px; font-weight: 600; }
.form input:not([type=radio]):not([type=checkbox]), .invite-link input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    font: inherit;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

fieldset { margin: 18px 0 0; padding: 0; border: 0; }
legend { font-weight: 600; margin-bottom: 4px; }
.choice { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.choice input { width: 20px; height: 20px; accent-color: var(--accent); }

.button {
    display: inline-block;
    width: 100%;
    min-height: 56px;
    margin-top: 24px;
    padding: 14px 18px;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: var(--accent-ink);
    background: var(--accent);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
}

.alert { padding: 12px; border-radius: var(--radius); background: #fef2f2; color: var(--danger); }
.field-error { margin: 4px 0 0; color: var(--danger); font-size: .9rem; }
.warning { padding: 10px 12px; border-radius: var(--radius); background: var(--warn-bg); }

@media (min-width: 720px) {
    .page { padding-top: 32px; }
    .button { width: auto; }
}

/* Public pages */
.footer { max-width: 560px; margin: 0 auto; padding: 0 16px 32px; font-size: .9rem; }
.footer a { color: var(--muted); }

/* Group pages */
.group-header { padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.group-title { display: block; font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.group-summary { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.subnav { display: flex; gap: 16px; margin-top: 10px; font-size: .9rem; }
.card { margin: 16px 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card h2 { margin-top: 0; }
.status-yes { margin: 4px 0 0; font-weight: 600; color: #15803d; }
.status-no { margin: 4px 0 0; color: var(--muted); }
.empty { color: var(--muted); }
.form input.short { max-width: 6em; }
.inline-form { margin-top: 8px; }
.link-button { padding: 0; font: inherit; color: var(--accent); text-decoration: underline; background: none; border: 0; cursor: pointer; }

/* Ideas */
.idea { display: flex; gap: 12px; margin: 12px 0; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.idea-image { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; flex: none; background: var(--line); }
.idea-preview { display: block; max-width: 160px; max-height: 160px; margin: 0 auto 8px; border-radius: 8px; }
.idea-body { min-width: 0; }
.idea-title { margin: 0; font-size: 1rem; }
.idea-title a { color: var(--ink); }
.idea-store, .idea-comment { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.idea-price { margin: 6px 0 0; }
.badge-warning { display: inline-block; margin: 6px 0 0; padding: 2px 8px; font-size: .8rem; border-radius: 999px; background: var(--warn-bg); color: #9a3412; }
.form textarea { display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius); }

/* Supports and sorting */
.idea-support { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.support-count { font-weight: 600; }
.support-button { padding: 6px 14px; font: inherit; font-weight: 600; color: var(--accent); background: #fff; border: 1px solid var(--accent); border-radius: 999px; cursor: pointer; }
.support-button.is-on { color: var(--accent-ink); background: var(--accent); }
.sort { display: flex; gap: 12px; margin: 8px 0; font-size: .9rem; color: var(--muted); }
.sort a[aria-current] { font-weight: 700; color: var(--ink); text-decoration: none; }

/* Questions and comments */
.message { margin: 10px 0; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.message p { margin: 4px 0; }
.message-meta { color: var(--muted); font-size: .85rem; }
.answer { margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--accent); }
.idea-links { margin: 6px 0 0; font-size: .9rem; }

/* Chosen gift */
.chosen { border-color: #15803d; }
.choice-card { align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }

/* Payments */
.payment-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.iban { font-family: ui-monospace, monospace; letter-spacing: .02em; }

/* My groups */
.group-link { display: block; color: var(--ink); text-decoration: none; }
.group-link .hint { display: block; margin-top: 4px; }
.form select { display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* Sharing and QR */
.share-pending-banner { padding: 10px 16px; background: var(--warn-bg); border-bottom: 1px solid var(--line); font-size: .9rem; }
.qr { max-width: 200px; margin: 8px 0; }
.qr svg { width: 100%; height: auto; }
.qr-details summary { cursor: pointer; color: var(--accent); }

/* Header aligned with the content column; secondary button */
.topbar, .group-header { padding-left: max(16px, calc((100% - 528px) / 2)); padding-right: max(16px, calc((100% - 528px) / 2)); }
.button-secondary { color: var(--accent); background: #fff; border: 1px solid var(--accent); }
details.card summary { cursor: pointer; }
.link-like { color: var(--accent); text-decoration: underline; }

/* Two or three options side by side, one tap each */
.segmented { display: flex; border: 1px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.segmented label { flex: 1; margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 12px 8px; text-align: center; font-weight: 600; color: var(--accent); background: #fff; cursor: pointer; }
.segmented label + label span { border-left: 1px solid var(--accent); }
.segmented input:checked + span { color: var(--accent-ink); background: var(--accent); }
.segmented input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: -4px; }
.form .segmented label { margin-top: 0; }

/* Install banner (CU-28) */
.install-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.12); font-size: .95rem; z-index: 30; }
.install-banner p { margin: 4px 0 10px; color: var(--muted); }
.install-banner .button { width: auto; margin: 0 12px 0 0; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.code-row { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.code-row .code-input { margin-top: 0 !important; flex: 1; }
.paste-button { width: auto; margin-top: 0; padding: 0 16px; }

/* Top bar and menu on every page */
.topbar { display: flex; justify-content: space-between; align-items: center; position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(15, 23, 42, .55); }
.menu-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; display: flex; flex-direction: column; width: min(320px, 88vw); padding: 12px; overflow-y: auto; background: #fff; box-shadow: -6px 0 24px rgba(0,0,0,.15); }
.menu-head { padding: 8px 12px 12px; border-bottom: 1px solid var(--line); }
.menu-name { margin: 0; font-weight: 700; }
.menu-head .hint { margin: 0; }
.menu-section { margin: 16px 12px 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.menu-panel .hint { display: block; }
.menu-count { position: static; display: inline-block; margin-left: 6px; }
.menu-foot { margin: auto 12px 0; padding-top: 16px; font-size: 13px; }
.menu-foot a { display: inline; padding: 0; color: var(--muted); }
.menu-panel a, .menu-panel .link-button { display: block; width: 100%; padding: 10px 12px; text-align: left; color: var(--ink); text-decoration: none; border-radius: 8px; }
.menu-panel a:hover, .menu-panel .link-button:hover { background: #f5f5f4; }
.menu-panel form { margin: 0; }
.group-header { border-top: 0; }
.notice { padding: 10px 12px; border-radius: var(--radius); background: #f0fdf4; color: #166534; }
.danger-zone { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.danger-zone .link-button { color: var(--danger); }

/* Top bar (spec §7): brand left; «⚙ Administrar», the bell and ☰ right */
.topbar { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; white-space: nowrap; }
.brand img { flex: none; display: block; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.admin-button { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; font-size: 14px; font-weight: 700; color: #fff; background: #374151; border-radius: 999px; text-decoration: none; white-space: nowrap; }
.admin-button.is-active { background: var(--accent); }
.bell, .menu-button { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; color: #374151; text-decoration: none; border-radius: 999px; }
.menu[open] .menu-button { background: #f3f4f6; }
.bell-count { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

/* Status pills (spec §4) */
.pill { display: inline-block; margin-top: 6px; padding: 3px 10px; font-size: 13px; font-weight: 600; border-radius: 999px; }
.pill-open { color: #9a3412; background: #fff7ed; }
.pill-decided { color: var(--success); background: #f0fdf4; }
.pill-closed { color: var(--muted); background: #f3f4f6; }

/* Fixed footer with the main button */
.action-bar { position: sticky; bottom: 0; z-index: 5; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(15, 23, 42, .06); }
.action-bar .button { width: 100%; margin-top: 0; }
.action-bar .button + .button { margin-top: 8px; }
.button-compact { width: auto; min-height: 40px; margin-top: 0; padding: 8px 16px; }
.button-danger { background: var(--danger); color: #fff; border: 0; }

/* Confirmation sheet rising from the bottom */
.sheet { position: fixed; inset: auto 0 0 0; width: 100%; max-width: 560px; margin: 0 auto; padding: 0; border: 0; border-radius: 20px 20px 0 0; background: #fff; color: var(--ink); }
.sheet::backdrop { background: rgba(15, 23, 42, .55); }
.sheet[open] { animation: sheet-up .2s ease-out; }
.sheet-panel { display: flex; flex-direction: column; gap: 12px; padding: 24px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-title { margin: 0; font-size: 20px; }
.sheet-text { margin: 0; color: #374151; }
.sheet .button { margin-top: 0; width: 100%; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }

/* Screen «Ordenador»: landing with the QR of the same page */
html:has(.area-desktop) { scroll-behavior: smooth; }
.area-desktop { background: var(--bg); }
.desktop-bar { position: sticky; top: 0; z-index: 10; padding: 14px 48px; }
.area-desktop .brand { font-size: 20px; }
.desktop-nav { display: flex; gap: 28px; }
.desktop-nav a { color: var(--muted); font-weight: 600; text-decoration: none; }
.desktop-nav a:hover { color: var(--accent); }
.area-desktop main > section { max-width: 1120px; margin: 0 auto; padding: 72px 48px; }
.desktop-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 64px; }
.desktop-text { flex: 1 1 420px; max-width: 560px; }
.kicker { margin: 0 0 8px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; }
.desktop-text h1 { margin: 0 0 16px; font-size: 52px; line-height: 1.08; font-weight: 800; letter-spacing: -.02em; }
.area-desktop .lead { font-size: 19px; color: #374151; }
.desktop-badges { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.desktop-badges li { padding: 6px 14px; color: var(--accent); background: #fff7ed; border: 1px solid #fdba74; border-radius: 999px; font-weight: 600; font-size: 14px; }
.desktop-badges li::before { content: "✓ "; }
.desktop-url { color: var(--ink); word-break: break-all; }
.desktop-qr-card { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 14px; width: 340px; padding: 28px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 20px 50px rgb(194 65 12 / 14%); }
.area-desktop .desktop-qr-card h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
.desktop-qr { width: 240px; padding: 10px; border: 3px solid var(--accent); border-radius: 16px; }
.desktop-qr svg { display: block; width: 100%; height: auto; }
.desktop-qr-steps { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: qr; font-size: 12px; color: var(--muted); }
.desktop-qr-steps li { counter-increment: qr; flex: 1; }
.desktop-qr-steps li::before { content: counter(qr); display: grid; place-items: center; width: 22px; height: 22px; margin: 0 auto 4px; color: #fff; background: var(--accent); border-radius: 999px; font-weight: 700; }
.desktop-qr-card .hint { margin: 0; }
.desktop-how { text-align: center; }
.area-desktop h2 { font-size: 32px; letter-spacing: -.01em; }
.desktop-how > h2 { margin: 0 0 8px; }
.desktop-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 40px 0 0; padding: 0; list-style: none; counter-reset: step; text-align: left; }
.desktop-steps li { counter-increment: step; position: relative; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 20px; transition: transform .2s, box-shadow .2s; }
.desktop-steps li:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgb(15 23 42 / 8%); }
.desktop-steps li::after { content: counter(step); position: absolute; top: 18px; right: 20px; font-size: 40px; font-weight: 800; color: #fed7aa; line-height: 1; }
.step-icon { display: grid; place-items: center; width: 52px; height: 52px; color: #fff; background: var(--accent); border-radius: 14px; }
.desktop-steps h3 { margin: 18px 0 6px; font-size: 18px; }
.desktop-steps p { margin: 0; color: var(--muted); font-size: 15px; }
.desktop-preview { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 72px; }
.phone { flex: none; width: 290px; padding: 12px; background: #1f2937; border-radius: 40px; box-shadow: 0 30px 60px rgb(15 23 42 / 25%); transform: rotate(-3deg); }
.phone-screen { display: flex; flex-direction: column; gap: 10px; padding: 16px 14px 20px; background: var(--bg); border-radius: 30px; font-size: 13px; }
.phone-bar { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.phone-title { margin: 6px 0 0; font-size: 17px; font-weight: 800; }
.phone-screen .pill { align-self: flex-start; }
.phone-card { display: grid; gap: 4px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.phone-card span { color: var(--muted); font-size: 12px; }
.phone-card em { font-style: normal; font-size: 11px; color: var(--accent); font-weight: 700; }
.phone-card .progress { height: 6px; margin: 2px 0; }
.phone-button { margin-top: 4px; padding: 10px; text-align: center; color: #fff; background: var(--accent); border-radius: 12px; font-weight: 700; }
.desktop-points { flex: 1 1 400px; max-width: 520px; }
.desktop-points h2 { margin-top: 0; }
.desktop-points ul { margin: 0; padding: 0; list-style: none; }
.desktop-points li { position: relative; margin-bottom: 16px; padding-left: 34px; color: var(--muted); }
.desktop-points li::before { content: "✓"; position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 22px; height: 22px; color: #fff; background: var(--success); border-radius: 999px; font-size: 13px; font-weight: 700; }
.desktop-points strong { color: var(--ink); }
.area-desktop main > .desktop-cta { display: flex; align-items: center; gap: 24px; max-width: 1024px; margin-bottom: 72px; padding: 32px 40px; color: #fff; background: linear-gradient(135deg, #c2410c, #ea580c); border-radius: 28px; }
.desktop-cta img { border-radius: 14px; box-shadow: 0 0 0 3px rgb(255 255 255 / 60%); }
.desktop-cta div { flex: 1; }
.desktop-cta h2 { margin: 0 0 4px; font-size: 26px; }
.desktop-cta p { margin: 0; opacity: .9; }
.desktop-cta-button { flex: none; display: inline-flex; align-items: center; justify-content: center; width: auto; padding: 0 24px; color: var(--accent); background: #fff; }
.desktop-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; max-width: 1120px; margin: 0 auto; padding: 28px 48px 40px; border-top: 1px solid var(--line); font-size: 14px; }
.desktop-footer .brand { font-size: 16px; }
.desktop-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.desktop-footer a { color: var(--muted); }
@media (max-width: 960px) { .desktop-steps { grid-template-columns: repeat(2, 1fr); } .desktop-nav { display: none; } }
@media (prefers-reduced-motion: reduce) { html:has(.area-desktop) { scroll-behavior: auto; } .desktop-steps li { transition: none; } }

/* Create a group (Org 1–4) */
.type-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.type-card { display: block; width: 100%; min-height: 64px; padding: 14px 16px; text-align: left; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.type-card strong { display: block; font-size: 17px; }
.type-card:focus-visible, .type-card:hover { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { min-height: 40px; padding: 6px 14px; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.method-card { margin-top: 12px; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.method-card .choice { margin: 0; }
.payment-method { padding: 8px 0; border-bottom: 1px solid var(--line); }
.payment-method:last-child { border-bottom: 0; }
.payment-method p { margin: 2px 0 0; }

/* Group created (Org 6), invite (Org 7) and QR (Org 8) */
.celebration .button { display: block; }
.created-card { text-align: center; }
.created-card h1 { margin: 0; }
.created-recipient { margin: 8px 0 0; font-size: 22px; font-weight: 700; text-align: center; }
.invite-message { display: block; width: 100%; margin: 12px 0 4px; padding: 12px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.qr-big { max-width: 300px; margin: 24px auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Joining (Familia 1–3b) */
.invitation { padding-top: 24px; text-align: center; }
.invitation-from { margin: 0; color: var(--muted); }
.invitation-recipient { margin: 8px 0 4px; font-size: 30px; }
.invitation-reason { margin: 0 0 8px; font-size: 18px; }
.invitation .button { margin-top: 32px; }
.already-in { margin-top: 12px; padding: 16px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: var(--radius); }
.already-in h2 { margin: 0 0 8px; font-size: 17px; }
.child-row { display: flex; justify-content: space-between; width: 100%; min-height: 48px; padding: 12px 4px; font: inherit; text-align: left; color: var(--ink); background: none; border: 0; border-top: 1px solid #fde68a; cursor: pointer; }
.child-list { margin: 0; padding: 0; list-style: none; }
.child-list li + li .child-row { border-top: 1px solid #fde68a; }
.child-row { border-top: 0; }
.child-row strong::before { content: "•"; margin-right: 10px; color: var(--accent); }
.child-new-title { margin: 24px 0 0; font-size: 17px; }

/* Ideas (Familia 4–7b) */
.group-home { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.group-home .button { margin-top: 0; }
.reminder { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 12px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.tag { display: inline-block; padding: 2px 8px; font-size: 12px; font-weight: 600; color: var(--muted); background: #f3f4f6; border-radius: 999px; }
.idea { display: block; }
.idea-meta { margin: 6px 0 0; }
.idea-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.idea-actions .inline-form { margin: 0; }
.vote-button.is-on { color: var(--success); background: #f0fdf4; border: 1px solid var(--success); }
.button-outline { color: var(--ink); background: #fff; border: 1.5px solid var(--ink); }
.idea-owner-actions { display: flex; gap: 8px; margin-top: 12px; }
.idea-owner-actions .button { flex: 1; margin-top: 0; }
.idea-owner-actions .inline-form { margin: 0; }
.trash-button { display: grid; place-items: center; width: 56px; height: 56px; color: var(--danger); background: #fff; border: 1.5px solid var(--danger); border-radius: var(--radius); cursor: pointer; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
/* Some thumbnails are labels: keep them off the top margin of form labels. */
.form .thumbs .thumb { margin-top: 0; }
.thumb { position: relative; display: block; width: 72px; height: 72px; padding: 0; overflow: hidden; background: var(--line); border: 0; border-radius: 10px; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-removable input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb-removable span { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; line-height: 20px; text-align: center; color: #fff; background: rgba(15, 23, 42, .7); border-radius: 50%; }
.thumb-removable input:checked ~ span { background: var(--danger); }
.thumb-removable:has(input:checked) img { opacity: .3; }
.thumb-add { display: grid; place-items: center; font-size: 12px; text-align: center; color: var(--accent); background: #fff; border: 1.5px dashed var(--accent); }
.thumb-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb-add[hidden], .photo-camera[hidden] { display: none; }
.form .photos-field .photo-camera { position: relative; margin-top: 10px; }
.photo-camera input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb-new button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; line-height: 20px; font-size: 16px; text-align: center; color: #fff; background: rgba(15, 23, 42, .7); border: 0; border-radius: 50%; cursor: pointer; }
.photo-files { display: none; }

/* Photo viewer (Familia 6d) */
.viewer { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; color: #fff; background: #000; border: 0; }
.viewer::backdrop { background: #000; }
.viewer[open] { display: flex; flex-direction: column; justify-content: center; }
.viewer-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.viewer-close, .viewer-prev, .viewer-next { width: 44px; height: 44px; font-size: 28px; color: #fff; background: rgba(255, 255, 255, .12); border: 0; border-radius: 50%; cursor: pointer; }
.viewer-prev, .viewer-next { position: absolute; top: 50%; transform: translateY(-50%); }
.viewer-prev { left: 8px; }
.viewer-next { right: 8px; }
.viewer-img { width: 100%; max-height: 75vh; object-fit: contain; }
.viewer-bottom { position: absolute; bottom: 0; left: 0; right: 0; padding: 16px; text-align: center; }
.viewer-dots { display: flex; justify-content: center; gap: 6px; }
.viewer-dots span { width: 8px; height: 8px; background: rgba(255, 255, 255, .4); border-radius: 50%; }
.viewer-dots .is-on { background: #fff; }
.viewer-title { margin: 8px 0 0; }

/* Administrar (Admin 1–7) */
.admin-header .eyebrow { margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stats p { margin: 0; padding: 10px; text-align: center; font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.stats strong { display: block; font-size: 20px; color: var(--ink); }
.stats .is-due, .stats .is-due strong { color: var(--accent); }
.card-highlight { border: 2px solid var(--accent); background: var(--warn-bg); }
.action-list { display: flex; flex-direction: column; margin: 16px 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.action-list > a, .action-list > form { display: block; padding: 14px 16px; color: var(--ink); text-decoration: none; border-top: 1px solid var(--line); }
.action-list > :first-child { border-top: 0; }
.action-list .hint { display: block; margin-top: 2px; }
.action-list .link-button { color: var(--ink); text-decoration: none; text-align: left; width: 100%; }
.action-list .danger-link, .danger-link { color: var(--danger); }
.family-list { display: flex; flex-direction: column; }
.family-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 56px; padding: 10px 4px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.family-row .hint { display: block; }
.share-amount { font-weight: 700; color: var(--accent); }

/* Payments (Familia 8–8c, Admin 3–4b) */
.paid-gift { text-align: center; }
.paid-gift .payment-method { text-align: left; }
.confetti { height: 48px; margin: -16px -16px 8px; background:
    radial-gradient(circle at 10% 40%, #f59e0b 4px, transparent 5px), radial-gradient(circle at 25% 70%, #c2410c 3px, transparent 4px),
    radial-gradient(circle at 40% 30%, #15803d 4px, transparent 5px), radial-gradient(circle at 55% 65%, #2563eb 3px, transparent 4px),
    radial-gradient(circle at 70% 35%, #db2777 4px, transparent 5px), radial-gradient(circle at 85% 60%, #f59e0b 3px, transparent 4px), #fdf6ec; }
.share-big { margin: 4px 0 16px; font-size: 40px; font-weight: 800; color: var(--accent); }
.share-line { font-size: 18px; }
.pay-value { font-size: 18px; font-weight: 700; margin-right: 8px; }
.button-success { color: #fff; background: var(--success); }
.progress { display: block; width: 100%; height: 12px; margin: 16px 0 6px; overflow: hidden; background: #e5e7eb; border: 0; border-radius: 999px; appearance: none; }
.progress::-webkit-progress-bar { background: #e5e7eb; }
.progress::-webkit-progress-value { background: var(--success); }
.progress::-moz-progress-bar { background: var(--success); }
.menu-panel .menu-foot a { display: inline; padding: 0; color: var(--muted); }
.menu-panel .danger-link { color: var(--danger); }
.urgent-banner { display: block; margin: 0 0 12px; padding: 12px 14px; font-weight: 600; color: #9a3412; background: var(--warn-bg); border: 1px solid #fdba74; border-radius: var(--radius); text-decoration: none; }
.task-card { display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; }
.action-bar:has(> [hidden]:only-child), .action-bar:not(:has(*)) { display: none; }
.home-hero { padding: 16px 0 8px; }
.steps { padding-left: 22px; }
.group-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; }
.group-card .pill { margin-top: 0; }
.tag-pending { color: #9a3412; background: var(--warn-bg); }
.next-task { font-weight: 600; color: var(--accent); }
.invitations-title { margin: 20px 0 8px; font-size: 17px; }
.invitation-card { border: 2px solid var(--accent); }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; font: inherit; color: var(--ink); background: none; border: 0; cursor: pointer; }
.switch-track { position: relative; width: 44px; height: 26px; background: #d1d5db; border-radius: 999px; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: left .15s; }
.switch[aria-checked="true"] .switch-track { background: var(--success); }
.switch[aria-checked="true"] .switch-track::after { left: 21px; }

/* The fixed footer sits at the bottom of the screen also on short pages: the page fills the height. */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body > .page { flex: 1 0 auto; width: 100%; }
body > .action-bar { flex: none; }
.idea-form [data-kind="link"] .button { margin-top: 10px; }

/* «Avisa al grupo»: highlighted card and a red, beating WhatsApp button, so it is not missed. */
.share-prompt { border: 2px solid #f87171; background: #fef2f2; }
.share-prompt h2 { color: #991b1b; }
.share-button { color: #fff; background: #dc2626; border: 0; box-shadow: 0 4px 14px rgba(220, 38, 38, .35); animation: share-beat 1.6s ease-in-out infinite; }
.share-button:hover, .share-button:focus-visible { background: #b91c1c; }
@keyframes share-beat {
    0%, 40%, 100% { transform: scale(1); }
    10% { transform: scale(1.06); }
    20% { transform: scale(1); }
    30% { transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) { .share-button { animation: none; } }

/* «Cómo funciona» */
.steps li { margin-bottom: 12px; }
.faq-list { padding-left: 20px; }
.faq-list li { margin-bottom: 10px; }

/* Elements shown by JavaScript stay hidden until then, whatever their display. */
[hidden] { display: none !important; }

/* «Tenlo siempre a mano» in «Tus grupos»: invite to add the app to the home screen */
.install-card { display: grid; grid-template-columns: 48px 1fr; gap: 6px 14px; align-items: start; margin-top: 32px; padding: 16px; background: linear-gradient(135deg, #fff7ed, #ffedd5); border: 1px solid #fdba74; border-radius: var(--radius); }
.install-card h2 { margin: 0 0 4px; font-size: 17px; }
.install-card p { margin: 0; color: var(--muted); font-size: 14px; }
.install-card img { border-radius: 12px; box-shadow: 0 4px 10px rgb(194 65 12 / 25%); }
.install-button { grid-column: 1 / -1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; box-shadow: 0 6px 16px rgb(194 65 12 / 30%); }
.install-button::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 45%) 50%, transparent 70%); transform: translateX(-100%); animation: install-shine 3.2s ease-in-out infinite; }
@keyframes install-shine { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .install-button::after { animation: none; display: none; } }

/* Information pages: FAQ, contact, about, cookies, legal notice */
.lead { font-size: 17px; color: #374151; }
.faq { border-bottom: 1px solid var(--line); }
.faq summary { padding: 12px 28px 12px 0; position: relative; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 20px; color: var(--accent); }
.faq[open] summary::after { content: "–"; }
.faq p { margin: 0 0 14px; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.cookie-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cookie-table th, .cookie-table td { padding: 8px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }

/* Information and legal pages on a computer (web::layout/desktop) */
.desktop-reading { display: flex; align-items: flex-start; gap: 56px; max-width: 1120px; margin: 0 auto; padding: 56px 48px 72px; }
.desktop-article { flex: 1; max-width: 720px; font-size: 16px; }
.area-desktop .desktop-article h1 { margin-top: 0; font-size: 42px; line-height: 1.1; letter-spacing: -.02em; }
.area-desktop .desktop-article h2 { margin-top: 36px; font-size: 24px; }
.desktop-article .steps li, .desktop-article .faq-list li { margin-bottom: 14px; }
.desktop-aside { position: sticky; top: 100px; flex: 0 0 260px; padding: 24px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 14px 34px rgb(194 65 12 / 10%); }
.desktop-aside img { border-radius: 12px; }
.desktop-aside p { margin: 8px 0; }
.desktop-aside .button { margin-top: 8px; }
@media (max-width: 960px) { .desktop-aside { display: none; } }
