:root {
    --ink: #1a1a1a;
    --red: #c8102e;
    --gold: #ffc72c;
    --paper: #f6f4ee;
    --card: #ffffff;
    --line: #e2ddd0;
    --muted: #6b6558;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    margin: 0;
    background: #dcd8cc;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .club-name, .cat-pill, .nav-item span, .panel-title { font-family: 'Oswald', sans-serif; }

.app-shell {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    box-shadow: 0 0 60px rgba(0, 0, 0, .14);
    position: relative;
}

.flagbar { height: 6px; display: flex; flex-shrink: 0; }
.flagbar span { flex: 1; }
.flagbar .b { background: var(--ink); }
.flagbar .r { background: var(--red); }
.flagbar .g { background: var(--gold); }

.topbar {
    position: sticky; top: 0; z-index: 10;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
}
.topbar img { height: 38px; width: auto; flex-shrink: 0; }
.topbar .titles { flex: 1; min-width: 0; }
.club-name { font-size: 16px; font-weight: 600; margin: 0; line-height: 1.15; }
.club-sub { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); }
.icon-btn {
    background: none; border: none; padding: 8px; margin: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--ink); cursor: pointer; border-radius: 50%; text-decoration: none;
}
.icon-btn:active { background: var(--paper); }

.content { flex: 1; padding: 20px 16px 24px; overflow-x: hidden; }
.panel.hidden { display: none; }
.panel-title { font-size: 19px; font-weight: 600; margin: 0 0 3px; }
.panel-desc { font-size: 13px; color: var(--muted); margin: 0 0 20px; }

.field { margin-bottom: 20px; position: relative; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: -4px; margin-bottom: 8px; }

input[type=text], input[type=date], input[type=password], select {
    width: 100%; padding: 13px 14px; font-size: 15.5px; font-family: inherit;
    border: 1px solid #cfc9ba; border-radius: 9px; background: #fffdf9; color: var(--ink);
    -webkit-appearance: none;
}
input:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }

.suggest-list {
    position: absolute; top: 100%; left: 0; right: 0; margin-top: 5px;
    background: #fff; border: 1px solid var(--line); border-radius: 9px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .10); z-index: 20; overflow: hidden; display: none;
}
.suggest-list.show { display: block; }
.suggest-item { padding: 11px 14px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest-item:last-child { border-bottom: none; }
.suggest-item:active, .suggest-item.active { background: #fdf1f0; }
.suggest-item small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pill {
    padding: 10px 15px; border: 1.5px solid var(--ink); border-radius: 999px;
    font-size: 13.5px; font-weight: 600; letter-spacing: .2px; background: transparent;
    color: var(--ink); cursor: pointer; user-select: none;
}
.cat-pill.selected { background: var(--red); border-color: var(--red); color: #fff; }

.role-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.role-opt {
    flex: 1; min-width: 100px; border: 1px solid #cfc9ba; border-radius: 9px;
    padding: 12px 10px; display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 13.5px; justify-content: center;
}
.role-opt input { accent-color: var(--red); }
.role-opt.checked { border-color: var(--red); background: #fdf1f0; }

.submit-btn, .btn {
    width: 100%; padding: 15px; background: var(--ink); color: #fff; border: none;
    border-radius: 10px; font-size: 15.5px; font-weight: 600; letter-spacing: .3px;
    cursor: pointer; font-family: 'Oswald', sans-serif; text-align: center; text-decoration: none;
    display: inline-block;
}
.submit-btn:active, .btn:active { background: var(--red); }
.btn.btn-secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.btn-red { background: var(--red); }

.confirm-box {
    display: none; margin-top: 18px; padding: 16px 16px; background: #f4faf1;
    border: 1px solid #bfe3ad; border-radius: 10px; font-size: 14px; color: #2e5c1a;
}
.confirm-box.show { display: block; }
.confirm-box p { margin: 0 0 12px; }
.error-box {
    display: none; margin-top: 14px; padding: 13px 15px; background: #fdf1f0;
    border: 1px solid #f2b9b9; border-radius: 10px; font-size: 13.5px; color: #96271f;
}
.error-box.show { display: block; }
.share-btn {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; padding: 11px; background: #2e5c1a; color: #fff; border: none;
    border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer;
    font-family: 'Oswald', sans-serif;
}

.admin-toolbar { margin-bottom: 16px; }
.admin-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filter-pill {
    padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
    font-size: 12px; font-weight: 600; background: var(--card); color: var(--muted); cursor: pointer;
}
.filter-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.date-filter { margin-bottom: 0; }
.toolbar-actions { display: flex; gap: 8px; margin-top: 12px; }
.toolbar-actions .btn { flex: 1; padding: 11px; font-size: 13.5px; }

.admin-count { font-size: 12.5px; color: var(--muted); margin: 14px 2px 8px; }
.admin-card { border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; margin-bottom: 9px; background: #fff; }
.admin-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.admin-card-name { font-weight: 600; font-size: 14.5px; }
.cat-tag {
    flex-shrink: 0; padding: 2px 9px; border-radius: 999px; background: #fdf1f0;
    color: var(--red); font-size: 11px; font-weight: 600; white-space: nowrap;
}
.admin-card-meta { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

.bottomnav {
    position: sticky; bottom: 0; z-index: 10; background: var(--card);
    border-top: 1px solid var(--line); display: flex;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.nav-item { flex: 1; text-align: center; padding: 6px 0 4px; cursor: pointer; color: var(--muted); background: none; border: none; text-decoration: none; }
.nav-item.active { color: var(--red); }
.nav-item svg { display: block; margin: 0 auto 3px; }
.nav-item span { font-size: 11px; font-weight: 600; letter-spacing: .3px; }

.toast {
    position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
    font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
    white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 30px 26px; }
.login-wrap img { height: 64px; display: block; margin: 0 auto 18px; }
.login-title { text-align: center; font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-sub { text-align: center; font-size: 13px; color: var(--muted); margin: 0 0 28px; }

/* --- selector de categoría (chips horizontales, con scroll en el celular) --- */
.cat-scroll {
    display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto;
    background: var(--card); border-bottom: 1px solid var(--line);
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
    flex-shrink: 0; padding: 9px 16px; border: 1.5px solid var(--ink); border-radius: 999px;
    font-family: 'Oswald', sans-serif; font-size: 13.5px; font-weight: 600; color: var(--ink);
    cursor: pointer; white-space: nowrap; user-select: none;
}
.cat-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* --- barra de progreso de confirmados --- */
.progreso-texto { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.progreso-barra { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progreso-relleno { height: 100%; background: var(--red); border-radius: 999px; transition: width .3s; width: 0; }

/* --- fila de jugador convocado --- */
.jugador-row {
    display: flex; align-items: center; gap: 12px; padding: 13px 4px;
    border-bottom: 1px solid var(--line); cursor: pointer;
}
.jugador-row:last-child { border-bottom: none; }
.jugador-row:active { background: var(--paper); }
.jugador-estado { font-size: 19px; flex-shrink: 0; width: 26px; text-align: center; }
.jugador-info { flex: 1; min-width: 0; }
.jugador-nombre { font-size: 15px; font-weight: 600; }
.jugador-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.jugador-row.confirmado .jugador-meta { color: #2e7d32; }

/* --- segmentado (Papá / Mamá / Acompañante en una sola fila) --- */
.segmentado {
    display: flex; border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden;
}
.segmento {
    flex: 1; text-align: center; padding: 11px 4px; font-size: 12.5px; font-weight: 600;
    color: var(--ink); cursor: pointer; border-right: 1.5px solid var(--ink); user-select: none;
}
.segmento:last-child { border-right: none; }
.segmento.selected { background: var(--ink); color: #fff; }

/* --- modal de confirmación --- */
.modal-fondo {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    align-items: flex-end; justify-content: center; z-index: 100;
}
.modal-fondo.show { display: flex; }
.modal-caja {
    background: var(--card); width: 100%; max-width: 430px; border-radius: 18px 18px 0 0;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
    max-height: 85vh; overflow-y: auto;
}
.modal-titulo { font-family: 'Oswald', sans-serif; font-size: 18px; font-weight: 600; margin: 0 0 3px; }

@media print {
    .topbar, .bottomnav, .toolbar-actions, .admin-filters, .date-filter, .toast { display: none !important; }
    body, .app-shell { background: #fff; box-shadow: none; max-width: 100%; }
}

@media (max-width: 520px) {
    .role-grid { flex-direction: column; }
}
