:root {
    --bg: #f4f7f5;
    --surface: #ffffff;
    --ink: #13231a;
    --muted: #64756b;
    --line: #dde6e0;
    --green: #0b7a3e;
    --green-d: #075c2e;
    --green-l: #e6f4ec;
    --red: #c0392b;
    --red-l: #fdecea;
    --amber: #b7791f;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 40, 24, .06), 0 8px 24px rgba(16, 40, 24, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* Fondo: líneas de cancha muy sutiles */
.pitch-bg {
    position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
    background:
        radial-gradient(circle at 50% 50%, transparent 119px, var(--line) 120px, var(--line) 122px, transparent 123px),
        linear-gradient(90deg, transparent calc(50% - 1px), var(--line) calc(50% - 1px), var(--line) calc(50% + 1px), transparent calc(50% + 1px));
}

/* ---------- Preloader ---------- */
#preloader {
    position: fixed; inset: 0; z-index: 100;
    background: var(--surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--green);
    transition: opacity .45s ease, visibility .45s ease;
}
#preloader.done { opacity: 0; visibility: hidden; }
.pl-ball { animation: pl-bounce .7s cubic-bezier(.5, 0, .5, 1) infinite alternate; }
.pl-ball svg { display: block; animation: pl-spin 1.4s linear infinite; }
.pl-shadow {
    width: 44px; height: 8px; border-radius: 50%; background: rgba(11, 122, 62, .18);
    margin-top: 6px; animation: pl-shadow .7s cubic-bezier(.5, 0, .5, 1) infinite alternate;
}
.pl-line { width: 140px; height: 2px; background: var(--line); margin-top: 26px; overflow: hidden; border-radius: 2px; }
.pl-line span { display: block; height: 100%; width: 40%; background: var(--green); animation: pl-run 1.1s ease-in-out infinite; }
@keyframes pl-bounce { from { transform: translateY(-46px); } to { transform: translateY(0); } }
@keyframes pl-spin { to { transform: rotate(360deg); } }
@keyframes pl-shadow { from { transform: scaleX(.55); opacity: .5; } to { transform: scaleX(1); opacity: 1; } }
@keyframes pl-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
    .pl-ball, .pl-ball svg, .pl-shadow, .pl-line span { animation: none; }
}

/* ---------- Estructura ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 20px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand img { height: 32px; width: auto; }
.home .brand { visibility: hidden; }
.topnav { display: flex; gap: 16px; }
.topnav a { text-decoration: none; font-weight: 600; font-size: .95rem; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 28px 16px 48px; flex: 1; }
.foot { text-align: center; padding: 18px; color: var(--muted); font-size: .85rem; }

/* ---------- Home ---------- */
.hero { text-align: center; padding: 4vh 0 0; }
.hero-logos { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 28px; }
.hero-logos img { height: clamp(64px, 14vw, 104px); width: auto; object-fit: contain; }
.hero-x { color: var(--muted); font-size: 1.4rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 600; color: var(--green); margin: 0 0 6px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
.hero-sub { color: var(--muted); margin: 0 0 36px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; max-width: 640px; margin: 0 auto; }
.choice {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
    background: var(--green); color: #fff; text-decoration: none; padding: 22px 22px 24px;
    border-radius: var(--radius); box-shadow: var(--shadow);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.choice:hover { transform: translateY(-2px); background: var(--green-d); }
.choice.alt { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.choice.alt:hover { background: var(--surface); border-color: var(--green); }
.choice.alt .choice-ico { background: var(--green-l); color: var(--green); }
.choice.disabled { background: var(--line); color: var(--muted); box-shadow: none; }
.choice-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: rgba(255, 255, 255, .16); margin-bottom: 10px; }
.choice-t { font-size: 1.2rem; font-weight: 700; }
.choice-d { font-size: .92rem; opacity: .8; }

/* ---------- Tarjetas y formularios ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.back { display: inline-block; text-decoration: none; color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
legend { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--green); margin-bottom: 12px; padding: 0; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
input[type=text], input:not([type]), input[type=email], input[type=password], input[type=number] {
    width: 100%; font: inherit; color: inherit; padding: 11px 13px; border: 1px solid var(--line);
    border-radius: 10px; background: #fbfdfc; transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 122, 62, .15); background: #fff; }
input.invalid { border-color: var(--red); }
.input-code { text-transform: uppercase; letter-spacing: .2em; font-weight: 600; text-align: center; }
.err { display: block; color: var(--red); font-size: .84rem; margin-top: 4px; }
.err:empty { display: none; }

.drop {
    display: flex !important; align-items: center; justify-content: center; gap: 14px; min-height: 96px;
    border: 1.5px dashed var(--line); border-radius: 12px; cursor: pointer; color: var(--muted);
    font-weight: 500 !important; background: #fbfdfc; padding: 12px;
}
.drop:hover { border-color: var(--green); color: var(--green); }
.drop img { width: 72px; height: 72px; object-fit: contain; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
    padding: 12px 20px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
    transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-d); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .88rem; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .95rem; }
.alert-error { background: var(--red-l); color: var(--red); }
.alert-ok { background: var(--green-l); color: var(--green-d); }
.alert-info { background: #eef3f8; color: #2c4a66; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 25, 16, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 720px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); animation: pop .2s ease; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.modal-x { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { overflow-y: auto; padding: 8px 24px 20px; flex: 1; }
.modal-foot { padding: 14px 24px 18px; border-top: 1px solid var(--line); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.scroll-hint { margin: 0 0 8px; font-size: .85rem; color: var(--amber); }
.scroll-hint.ok { color: var(--green); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--green); }
.check:has(input:disabled) { opacity: .5; cursor: not-allowed; }

.reglamento h3 { font-size: 1.1rem; margin-top: 14px; }
.reglamento h4 { font-size: .95rem; color: var(--green); text-transform: uppercase; letter-spacing: .06em; margin: 20px 0 6px; }
.reglamento p, .reglamento li { font-size: .94rem; }
.reglamento ul { padding-left: 20px; margin: 6px 0; }
.reglamento li { margin-bottom: 4px; }
.reglamento .lead { font-weight: 500; }
.reglamento .destacado { color: var(--red); font-weight: 700; }
.reglamento .nota { background: var(--green-l); padding: 10px 12px; border-radius: 8px; }
.reglamento .version { color: var(--muted); font-size: .8rem; text-align: right; }

/* ---------- Mi equipo ---------- */
.code-card { border-color: var(--green); text-align: center; }
.code { font-size: 2rem; letter-spacing: .25em; font-weight: 800; background: var(--green-l); color: var(--green-d); padding: 14px; border-radius: 12px; margin: 12px auto; max-width: 340px; }

.team-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.team-logo { width: 84px; height: 84px; border-radius: 16px; background: var(--green-l); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.team-logo img { width: 100%; height: 100%; object-fit: contain; }
.team-logo span { font-size: 1.8rem; font-weight: 800; color: var(--green); }
.team-info { flex: 1; min-width: 200px; }
.team-info h1 { margin-bottom: 4px; }
.team-info p { margin: 0; }
.logo-edit { width: 100%; }
.logo-edit summary { cursor: pointer; color: var(--green); font-weight: 600; font-size: .9rem; }
.logo-edit form { display: inline-flex; gap: 8px; align-items: center; margin: 10px 10px 0 0; flex-wrap: wrap; }

.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; background: #fff8ec; border: 1px solid #f1e0bf; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; }
.status.is-ok { background: var(--green-l); border-color: #bfe0cc; }
.status ul { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 0; flex: 1; font-size: .9rem; }
.status li::before { margin-right: 5px; font-weight: 700; }
.status li.ok::before { content: '✓'; color: var(--green); }
.status li.pend::before { content: '•'; color: var(--amber); }
.status li.info::before { content: '·'; color: var(--muted); }

.roster-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.roster-head h2 { margin: 0; }
.roster-sec { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--green); margin: 24px 0 8px; }
.roster-sec span { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.roster-cols, .player { display: grid; grid-template-columns: 24px minmax(0, 1.6fr) 118px minmax(0, 1.1fr) 150px; gap: 8px; align-items: center; }
.roster-cols { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 0 4px; }
.player { padding: 5px 0; }
.player input { padding: 9px 10px; min-width: 0; }
.player.has-err input { border-color: #eab4ae; }
.p-idx { color: var(--muted); font-weight: 600; text-align: center; }
.p-err { grid-column: 2 / -1; margin-top: 0; }
.roster-actions { display: flex; justify-content: flex-end; margin-top: 22px; position: sticky; bottom: 12px; }
.roster-actions .btn { box-shadow: var(--shadow); }
input[type=date] { width: 100%; font: inherit; color: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfc; }
.team-edit { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.team-edit input:not([type=file]) { width: auto; min-width: 220px; }

@media (max-width: 720px) {
    .card { padding: 20px 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .roster-cols { display: none; }
    .player {
        grid-template-columns: 1fr 1fr; grid-template-areas: "n n" "d f" "a a";
        border-top: 1px solid var(--line); padding: 12px 0 12px 14px; position: relative;
    }
    .p-idx { position: absolute; left: -4px; top: 14px; font-size: .7rem; }
    .player .p-nombre { grid-area: n; }
    .player .p-dni { grid-area: d; }
    .player .p-fecha { grid-area: f; }
    .player .p-area { grid-area: a; }
    .p-err { grid-column: 1 / -1; }
}

/* ---------- Google Sign-In ---------- */
.gsi-boton { display: flex; justify-content: center; min-height: 44px; margin: 22px 0 8px; }
.gsi-estado { min-height: 1.4em; margin: 0 0 8px; color: var(--muted); }
.gsi-estado.err { color: var(--red); }
.google-id { display: flex; align-items: center; gap: 12px; background: var(--green-l); border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; }
.google-id img { width: 38px; height: 38px; border-radius: 50%; }
.google-id div { display: flex; flex-direction: column; min-width: 0; }
.google-id strong { overflow-wrap: anywhere; }

/* ---------- Panel de organización (/ver) ---------- */
.wrap-wide { max-width: 1180px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-head h1 { margin-bottom: 2px; }
.panel-head p { margin: 0; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: .88rem; }
.stat span { display: block; font-size: 1.7rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 220px; }
.filters input, .filters select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; }
.table-card { padding: 8px 0; overflow-x: auto; }
.table-card > .h-sec, .table-card > .roster-sec, .table-card > p { padding: 0 20px; }
.table-card > .h-sec { padding-top: 14px; }
.tabla { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tabla th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tabla td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #fafcfb; }
.tabla small { font-size: .8rem; }
.eq-cell { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.eq-cell span:last-child { display: flex; flex-direction: column; }
.eq-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--green-l); color: var(--green); display: grid; place-items: center; font-weight: 800; font-size: .85rem; overflow: hidden; flex-shrink: 0; }
.eq-logo img { width: 100%; height: 100%; object-fit: contain; }
.acciones { white-space: nowrap; text-align: right; }
.acciones a { margin-left: 10px; font-weight: 600; font-size: .88rem; text-decoration: none; }
.badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef1ef; color: var(--muted); margin: 0 4px 2px 0; }
.b-ok { background: var(--green-l); color: var(--green-d); }
.b-warn { background: #fff4e0; color: var(--amber); }
.pago-form { margin: 0; }
.pago-toggle { font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid #f1e0bf; background: #fff8ec; color: var(--amber); cursor: pointer; white-space: nowrap; }
.pago-toggle.on { background: var(--green); border-color: var(--green); color: #fff; }
.pago-toggle:hover { filter: brightness(.96); }
.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.detail-grid .card { margin-bottom: 20px; }
.h-sec { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--green); margin-bottom: 14px; }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.datos dt { color: var(--muted); font-size: .88rem; }
.datos dd { margin: 0; overflow-wrap: anywhere; }
.pago-card { background: #fffdf8; }
.pago-card.is-ok { background: #f6fbf8; }
.pago-estado { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; color: var(--amber); }
.pago-card.is-ok .pago-estado { color: var(--green); }
.pago-card form { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.pago-card .field { width: 100%; margin-bottom: 4px; }
@media (max-width: 820px) {
    .detail-grid { grid-template-columns: 1fr; }
    .datos { grid-template-columns: 1fr; gap: 2px; }
    .datos dd { margin-bottom: 8px; }
    .tabla thead { display: none; }
    .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; width: 100%; }
    .tabla tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
    .tabla td { border: 0; padding: 6px 16px; }
    .acciones { text-align: left; }
    .acciones a { margin: 0 14px 0 0; }
}

/* ---------- Monto de inscripción ---------- */
.monto { display: flex; align-items: center; gap: 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 18px; }
.monto-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--green-l); color: var(--green); font-weight: 800; font-size: 1.25rem; flex-shrink: 0; }
.monto-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.monto-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.monto-valor { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.monto-det { font-size: .86rem; color: var(--muted); }
.monto-estado { font-size: .85rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: #fff4e0; color: var(--amber); white-space: nowrap; }
.monto.is-ok .monto-estado { background: var(--green); color: #fff; }
.monto.is-ok { border-color: #bfe0cc; }
.monto-left { margin-top: 18px; }

/* Portada: monto + botón de reglamento debajo de las opciones */
.home-info { display: flex; align-items: stretch; gap: 12px; max-width: 640px; margin: 16px auto 0; flex-wrap: wrap; }
.home-info .monto { flex: 1 1 340px; margin: 0; }
.btn-reglamento { flex: 0 1 auto; background: var(--surface); padding: 14px 20px; border-radius: var(--radius); }
@media (max-width: 560px) {
    .btn-reglamento { flex: 1 1 100%; }
    .monto { flex-wrap: wrap; }
    .monto-estado { margin-left: 56px; }
}

/* ---------- Aviso de inicio + WhatsApp ---------- */
.aviso { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap;
    background: var(--green-l); border: 1px solid #bfe0cc; border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px; text-align: left; }
.aviso-fecha { display: flex; align-items: center; gap: 10px; color: var(--green-d); }
.aviso-fecha svg { flex-shrink: 0; }
.aviso-wa { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-size: .92rem;
    background: var(--surface); border: 1px solid #bfe0cc; border-radius: 999px; padding: 7px 14px; transition: border-color .15s; }
.aviso-wa svg { color: #1fa855; flex-shrink: 0; }
.aviso-wa:hover { border-color: #1fa855; }
.home .aviso { max-width: 640px; margin: 0 auto 22px; }
@media (max-width: 560px) { .aviso-wa { width: 100%; justify-content: center; } }
