:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --brand: #0b3d91;
  --brand-2: #1d5fd1;
  --accent: #f59e0b;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 18px; }
main.wrap { flex: 1; padding-top: 22px; padding-bottom: 40px; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.loading, .empty { padding: 40px; text-align: center; color: var(--ink-3); }

/* barra superior */
.topbar { background: linear-gradient(90deg, #0a2f6e, var(--brand) 60%, #1747a6); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.topbar-in { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { color: #fff; font-weight: 800; font-size: 1.15rem; display: flex; gap: 8px; align-items: center; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-ico { font-size: 1.4rem; }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a, .nav button { color: #dbe6ff; padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: .93rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a:hover, .nav button:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.18); color: #fff; }
.nav .user-chip { font-size: .8rem; opacity: .85; padding: 0 6px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--brand); flex-direction: column; align-items: stretch; padding: 8px; }
  .nav.open { display: flex; }
}
.footer { color: var(--ink-3); font-size: .82rem; padding: 18px; text-align: center; }

/* tarjetas y grillas */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* hero */
.hero { background: radial-gradient(1200px 300px at 0% 0%, #2a6cf0 0%, transparent 60%), linear-gradient(120deg, #0a2f6e, #0b3d91); color: #fff; border-radius: 18px; padding: 26px; margin-bottom: 20px; position: relative; overflow: hidden; }
.hero h1 { font-size: 1.9rem; }
.hero p { margin: 0; color: #c9d8ff; }
.hero::after { content: "⚽ 🏀 🏐 🥅"; position: absolute; right: 20px; bottom: -6px; font-size: 3.4rem; opacity: .15; letter-spacing: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.6rem; }
.stat span { font-size: .8rem; color: #c9d8ff; text-transform: uppercase; letter-spacing: .5px; }

/* chips/filtros */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: .88rem; cursor: pointer; color: var(--ink-2); font-family: inherit; }
.chip:hover { border-color: var(--brand-2); color: var(--brand-2); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* tarjeta de campeonato */
.champ { display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .12s, box-shadow .12s; color: inherit; }
.champ:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(15,23,42,.12); text-decoration: none; }
.champ-top { display: flex; gap: 12px; align-items: center; }
.champ-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.6rem; background: #eef3ff; flex-shrink: 0; }
.champ h3 { margin: 0; color: var(--ink); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.progress { height: 6px; border-radius: 9px; background: #e8edf5; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), #22c55e); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef2f7; color: var(--ink-2); white-space: nowrap; }
.b-inscripcion { background: #fef3c7; color: #92400e; }
.b-en_curso { background: #dcfce7; color: #166534; }
.b-finalizado { background: #e0e7ff; color: #3730a3; }
.b-programado { background: #eef2f7; color: #475569; }
.b-en_juego { background: #fee2e2; color: #b91c1c; }
.b-jugado { background: #dcfce7; color: #166534; }
.b-suspendido { background: #fde68a; color: #92400e; }
.b-wo { background: #fce7f3; color: #9d174d; }

/* botones y formularios */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: .9rem; cursor: pointer; font-family: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); color: var(--brand-2); text-decoration: none; }
.btn-p { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-p:hover { background: var(--brand-2); color: #fff; }
.btn-d { color: var(--bad); }
.btn-d:hover { border-color: var(--bad); color: #fff; background: var(--bad); }
.btn-s { padding: 5px 10px; font-size: .8rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
input, select, textarea { font-family: inherit; font-size: .95rem; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfd3ff; border-color: var(--brand-2); }
input[type=color] { padding: 3px; height: 40px; }
input[type=checkbox] { width: auto; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
label.chk { flex-direction: row; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.filters select, .filters input { width: auto; min-width: 160px; }

/* tablas */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #f8fafc; }
td.n, th.n { text-align: center; }
td.pts { font-weight: 800; color: var(--brand); text-align: center; }
.pos { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #eef2f7; font-weight: 700; font-size: .85rem; }
tr.q .pos { background: #dcfce7; color: #166534; }
.team { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; display: inline-block; border: 1px solid rgba(0,0,0,.1); }
.racha { display: inline-flex; gap: 3px; }
.racha i { width: 18px; height: 18px; border-radius: 5px; font-size: .65rem; font-style: normal; display: grid; place-items: center; color: #fff; font-weight: 800; }
.racha .G { background: var(--ok); } .racha .E { background: var(--ink-3); } .racha .P { background: var(--bad); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 16px; font-weight: 700; color: var(--ink-2); border-bottom: 3px solid transparent; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; font-size: .95rem; white-space: nowrap; }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }

/* partidos */
.round { margin-bottom: 18px; }
.round-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); font-weight: 800; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.match { display: grid; grid-template-columns: 110px 1fr auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 6px; }
.match:hover { border-color: #bfd3ff; }
.match .when { font-size: .78rem; color: var(--ink-2); line-height: 1.3; }
.match .l { text-align: right; justify-content: flex-end; }
.match .score { min-width: 76px; text-align: center; font-weight: 800; font-size: 1.1rem; background: #0f172a; color: #fff; border-radius: 9px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.match .score.pend { background: #eef2f7; color: var(--ink-3); font-size: .85rem; }
.match .side { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.match .win { font-weight: 800; }
@media (max-width: 640px) {
  .match { grid-template-columns: 1fr auto 1fr; }
  .match .when { grid-column: 1 / -1; }
  .match .side { grid-column: 1 / -1; justify-content: center; }
}
.mini-match { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .88rem; color: inherit; }
.mini-match:hover { text-decoration: none; background: #f8fafc; }
.mini-match:last-child { border-bottom: 0; }

/* llaves */
.bracket { display: flex; gap: 26px; overflow-x: auto; padding-bottom: 8px; }
.b-round { display: flex; flex-direction: column; justify-content: space-around; min-width: 210px; gap: 14px; }
.b-round h4 { margin: 0 0 4px; text-align: center; font-size: .78rem; text-transform: uppercase; color: var(--ink-3); letter-spacing: .6px; }
.b-match { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; box-shadow: var(--shadow); }
.b-match:hover { border-color: var(--brand-2); }
.b-team { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; font-size: .88rem; }
.b-team + .b-team { border-top: 1px solid var(--line); }
.b-team.w { background: #f0fdf4; font-weight: 800; }
.b-team.tbd { color: var(--ink-3); font-style: italic; }
.champion { display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, #fef3c7, #fff7e6); border: 1px solid #fcd34d; border-radius: 12px; padding: 12px 16px; font-weight: 700; margin-bottom: 14px; }
.champion .big { font-size: 1.8rem; }

/* marcador del partido */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; text-align: center; padding: 22px 10px; }
.scoreboard .t-name { font-size: 1.2rem; font-weight: 800; }
.scoreboard .crest { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 8px; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 1.1rem; }
.scoreboard .big { font-size: 3rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 2px; }
.ev-list { list-style: none; padding: 0; margin: 0; }
.ev-list li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.ev-list li:last-child { border-bottom: 0; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-h h3 { margin: 0; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.x { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--ink-3); }
@keyframes fade { from { opacity: 0; } }
.check-list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.check-list label { display: flex; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.check-list label:hover { background: #f1f5f9; }

/* toasts */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: fade .15s; max-width: 360px; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }

/* login */
.login { max-width: 400px; margin: 40px auto; }
.page-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.side-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.alert { padding: 12px 14px; border-radius: 10px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: .9rem; margin-bottom: 14px; }

@media print {
  .topbar, .footer, .toolbar, .tabs, .btn, .filters { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
