/* NomadPadel · estética deportiva: azul pista, líneas blancas, amarillo pelota */
:root {
  --bg: #eef2f8; --surface: #ffffff; --surface-2: #f3f6fb; --text: #0b1730; --muted: #5b6b85;
  --line: #dbe3ef; --navy: #0b1d3a; --navy-2: #13294f; --court: #1f5fd6; --court-2: #2f74ef;
  --ball: #d7f205; --ball-ink: #0b1d3a;
  --ok: #0f9d58; --ok-bg: #e2f6ec; --warn: #c26a00; --warn-bg: #fff1dc; --bad: #d93025; --bad-bg: #fde7e5;
  --info: #1f5fd6; --info-bg: #e3edff; --idle: #9aa7bd;
  --radius: 14px; --shadow: 0 1px 2px rgba(11,23,48,.06), 0 6px 18px rgba(11,23,48,.06);
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07101f; --surface: #0f1b31; --surface-2: #14233f; --text: #e8eef9; --muted: #95a4bf; --line: #22355a;
    --navy: #050d1b; --navy-2: #0c1830; --court: #4c8dff; --court-2: #6aa1ff;
    --ok: #3ddc84; --ok-bg: #0f2c1f; --warn: #ffb547; --warn-bg: #33240b; --bad: #ff6b60; --bad-bg: #3a1513;
    --info: #7fb0ff; --info-bg: #13274d; --idle: #5d6d8a; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 var(--body); background: var(--bg); color: var(--text); }
a { color: var(--court); }
h1, h2, h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: .02em; line-height: 1.05; }
h1 { font-size: 2rem; font-weight: 800; margin: .2rem 0 .5rem; }
h2 { font-size: 1.3rem; font-weight: 800; margin: 1.8rem 0 .7rem; display: flex; align-items: center; gap: 10px; }
h2::before { content: ""; width: 6px; height: 1.1em; background: var(--ball); border-radius: 3px; box-shadow: 0 0 0 1px rgba(11,29,58,.15); }
h3 { font-size: 1.1rem; font-weight: 700; margin: .1rem 0 .5rem; }
.container { max-width: 1080px; margin: 0 auto; padding: 18px 16px 90px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.stack > * + * { margin-top: 10px; }
[hidden] { display: none !important; }

/* ---------- barra superior / inferior */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  border-bottom: 3px solid var(--ball); }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.45rem; text-transform: uppercase; letter-spacing: .03em; text-decoration: none; color: #fff; display: flex; align-items: center; gap: 10px; }
.brand b { color: var(--ball); font-weight: 800; }
.ball { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f2ff7a, var(--ball) 60%, #a9bf00); position: relative; flex: none; }
.ball::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); border-left-color: transparent; border-right-color: transparent; transform: rotate(35deg); }
nav { display: flex; gap: 4px; margin-left: auto; }
nav a, nav button { display: flex; align-items: center; gap: 7px; text-decoration: none; color: #b9c6de; padding: 8px 12px; border-radius: 10px; font: 700 .95rem var(--body);
  background: none; border: 0; cursor: pointer; text-transform: uppercase; letter-spacing: .03em; }
nav svg { width: 19px; height: 19px; flex: none; }
nav a:hover, nav button:hover { color: #fff; background: rgba(255,255,255,.07); }
nav a.active { color: var(--ball-ink); background: var(--ball); }

/* ---------- tarjetas genéricas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card a.cardlink { text-decoration: none; color: inherit; display: block; }
.empty { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px 16px; color: var(--muted); text-align: center; background: var(--surface); }

/* ---------- insignias */
.badge { display: inline-flex; align-items: center; gap: 5px; font: 700 .74rem var(--body); text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.pach { background: var(--court); color: #fff; }
.badge.torn { background: var(--ball); color: var(--ball-ink); }
.badge.pach::before, .badge.torn::before { display: none; }

/* ---------- formularios */
label { display: block; font-weight: 700; font-size: .86rem; margin: 10px 0 5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
input, select, textarea { width: 100%; font: 500 1rem var(--body); padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin-right: 8px; accent-color: var(--court); }
.check { display: flex; align-items: center; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); font-size: .95rem; }
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--court) 35%, transparent); border-color: var(--court); outline-offset: 0; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
button, .btn { font: 800 .95rem var(--body); text-transform: uppercase; letter-spacing: .05em; cursor: pointer; border-radius: 10px; padding: 11px 18px;
  border: 0; background: var(--court); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: transform .05s, background .15s; }
button:hover, .btn:hover { background: var(--court-2); }
button:active, .btn:active { transform: translateY(1px); }
button.primary-ball { background: var(--ball); color: var(--ball-ink); }
button.secondary, .btn.secondary { background: transparent; color: var(--court); box-shadow: inset 0 0 0 1.5px var(--court); }
button.secondary:hover, .btn.secondary:hover { background: var(--info-bg); }
button.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px var(--bad); }
button.danger:hover { background: var(--bad-bg); }
button.small, .btn.small { padding: 7px 12px; font-size: .8rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
form .actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
details > summary { cursor: pointer; font-weight: 800; color: var(--court); margin: 4px 0; text-transform: uppercase; font-size: .85rem; letter-spacing: .04em; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; }
details[open] > summary::before { content: "▾ "; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { flex: 1; margin: 0; padding: 10px; text-align: center; cursor: pointer; border-radius: 9px; color: var(--muted); font-size: .9rem; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--court); color: #fff; }
.seg label:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* ---------- cabecera de página (banner pista) */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 22px 20px; color: #fff; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--court) 0%, #1a4fb8 100%); }
.hero.torneo { background: linear-gradient(135deg, var(--navy-2) 0%, var(--navy) 100%); }
.hero::before { content: ""; position: absolute; inset: 12px; border: 2px solid rgba(255,255,255,.22); border-radius: 8px; pointer-events: none; }
.hero::after { content: ""; position: absolute; top: 12px; bottom: 12px; left: 62%; width: 2px; background: rgba(255,255,255,.22); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 2.3rem; margin: 6px 0 4px; }
.hero p { margin: 4px 0; color: rgba(255,255,255,.85); }
.hero .stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 12px; }
.hero .stat b { display: block; font: 800 1.9rem/1 var(--display); color: var(--ball); }
.hero .stat span { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.hero .badge { background: rgba(255,255,255,.16); color: #fff; }
.hero .badge.torn { background: var(--ball); color: var(--ball-ink); }
.hero .btn.secondary { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.6); }
.hero .btn.secondary:hover { background: rgba(255,255,255,.1); }

/* ---------- tarjeta de partido tipo marcador */
.match { padding: 0; overflow: hidden; border-left: 6px solid var(--idle); }
.match.t-ok { border-left-color: var(--ok); }
.match.t-warn { border-left-color: var(--warn); }
.match.t-done { border-left-color: var(--navy-2); }
.match.mine { box-shadow: 0 0 0 2px var(--court), var(--shadow); }
.mhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.mhead .mtitle { font: 800 1rem var(--display); text-transform: uppercase; letter-spacing: .04em; }
.mhead .mtitle a { color: inherit; text-decoration: none; }
.board { background: var(--navy); color: #fff; }
.side { display: grid; grid-template-columns: 1fr 56px; align-items: stretch; }
.side + .side { border-top: 1px solid rgba(255,255,255,.1); }
.side .tinfo { padding: 10px 14px; min-width: 0; }
.side .tname { font: 700 1.15rem/1.15 var(--display); text-transform: uppercase; letter-spacing: .02em; overflow-wrap: anywhere; }
.side .tplayers { font-size: .84rem; color: #a9b8d3; margin-top: 2px; }
.side .sets { display: grid; place-items: center; font: 800 1.9rem var(--display); background: rgba(255,255,255,.06); color: #fff; }
.side.win .sets { background: var(--ball); color: var(--ball-ink); }
.side.win .tname::after { content: " ✓"; color: var(--ball); }
.side.lose { opacity: .6; }
.side.empty .tname { color: #8091b0; font-style: italic; text-transform: none; }
.tag { display: inline-block; vertical-align: middle; font: 700 .64rem var(--body); text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px;
  background: rgba(255,255,255,.14); color: #cfdaf0; margin-left: 4px; }
.tag.me { background: var(--court); color: #fff; }
.mbody { padding: 12px 14px 14px; }
.when { display: flex; gap: 12px; align-items: center; }
.dtile { flex: none; width: 54px; text-align: center; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--line); background: var(--surface); }
.dtile .wd { background: var(--court); color: #fff; font: 700 .7rem var(--body); text-transform: uppercase; letter-spacing: .06em; padding: 2px 0; }
.dtile .dn { font: 800 1.55rem/1.1 var(--display); padding-top: 2px; }
.dtile .mo { font: 700 .68rem var(--body); text-transform: uppercase; color: var(--muted); padding-bottom: 3px; }
.dtile.none { border-style: dashed; }
.dtile.none .wd { background: var(--idle); }
.when .wmain { font: 800 1.25rem/1.1 var(--display); text-transform: uppercase; }
.when .wsub { font-size: .9rem; color: var(--muted); }
.note { margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: .92rem; background: var(--surface-2); }
.note.warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.note.ok { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: .8rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; }
.chip.hl { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip a { text-decoration: none; color: var(--bad); margin-left: 4px; }
.minfo { margin-top: 10px; font-size: .9rem; }
.minfo .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.panel { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.contacts { margin-top: 10px; }
.contacts .c { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 4px 0; border-top: 1px solid var(--line); font-size: .88rem; }

/* ---------- avisos (inicio) */
.alerts { display: grid; gap: 8px; }
.alert { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.alert .ico { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; }
.alert.warn .ico { background: var(--warn-bg); color: var(--warn); }
.alert.info .ico { background: var(--info-bg); color: var(--info); }
.alert .atitle { font: 800 1rem var(--display); text-transform: uppercase; letter-spacing: .03em; }
.alert .atext { font-size: .92rem; color: var(--muted); }

/* ---------- lista de eventos */
.evcard { padding: 0; overflow: hidden; transition: transform .1s, box-shadow .1s; }
.evcard:hover { transform: translateY(-2px); }
.evcard .top { height: 8px; background: var(--court); }
.evcard.torneo .top { background: var(--ball); }
.evcard .in { padding: 14px 16px; }
.evcard h3 { font-size: 1.35rem; margin: 8px 0 4px; }
.evcard .nums { display: flex; gap: 18px; margin-top: 10px; }
.evcard .nums b { font: 800 1.4rem/1 var(--display); display: block; }
.evcard .nums span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- calendario de disponibilidad */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal .wd { font: 700 .72rem var(--body); text-align: center; color: var(--muted); text-transform: uppercase; }
.cal button.day { padding: 7px 0; border-radius: 9px; background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); font: 800 1rem/1.05 var(--display); display: block; text-transform: none; letter-spacing: 0; }
.cal button.day small { display: block; font: 600 .62rem var(--body); color: var(--muted); text-transform: uppercase; }
.cal button.day:hover { box-shadow: inset 0 0 0 1.5px var(--court); background: var(--surface); }
.cal button.day.on { background: var(--court); box-shadow: none; color: #fff; }
.cal button.day.on small { color: rgba(255,255,255,.85); }
.cal .pad { visibility: hidden; }

/* ---------- cuadro */
.bracket-wrap { overflow-x: auto; padding: 14px; -webkit-overflow-scrolling: touch; background: var(--navy); border-radius: 16px; }
.bracket { display: flex; gap: 28px; min-width: max-content; }
.bracket .col { display: flex; flex-direction: column; width: 220px; }
.bracket .col h3 { text-align: center; font-size: .95rem; color: var(--ball); margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.12); }
.bracket .games { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 14px; }
.bm.bye { opacity: .7; border-style: dashed; }
.bm.bye .l .s { background: none; color: var(--ball); }
.bm { background: var(--navy-2); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; font-size: .9rem; overflow: hidden; color: #fff; position: relative; }
.bm.mine { box-shadow: 0 0 0 2px var(--court-2); }
.bm .l { display: grid; grid-template-columns: 1fr 30px; align-items: center; }
.bm .l + .l { border-top: 1px solid rgba(255,255,255,.08); }
.bm .l .n { padding: 7px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 1rem var(--display); text-transform: uppercase; letter-spacing: .02em; }
.bm .l .s { text-align: center; font: 800 1.1rem var(--display); align-self: stretch; display: grid; place-items: center; background: rgba(255,255,255,.05); }
.bm .l.win .s { background: var(--ball); color: var(--ball-ink); }
.bm .l.lose { opacity: .55; }
.bm .l .n .muted { color: #7f90ae; font-style: italic; text-transform: none; font-family: var(--body); font-weight: 500; font-size: .85rem; }
.bm .meta { font-size: .72rem; color: #9fb0cf; padding: 4px 10px; background: rgba(0,0,0,.22); text-transform: uppercase; letter-spacing: .04em; }
.champion { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--ball), #b9d400); color: var(--ball-ink); border: 0; }
.champion .cup { font-size: 2.2rem; }
.champion .ct { font: 800 .8rem var(--body); text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.champion .cn { font: 800 1.6rem/1.05 var(--display); text-transform: uppercase; }

/* ---------- listas de administración */
.list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.list .item { padding: 12px 14px; border-top: 1px solid var(--line); }
.list .item:first-child { border-top: 0; }
.list .item strong { font-weight: 700; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; background: var(--surface); padding: 4px; border-radius: 12px; border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.tabs a { text-decoration: none; padding: 8px 14px; border-radius: 9px; color: var(--muted); font: 800 .85rem var(--body); text-transform: uppercase; letter-spacing: .04em; }
.tabs a.active { background: var(--navy); color: #fff; }

/* ---------- acceso */
.auth-bg { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(160deg, var(--court) 0%, #1a4fb8 55%, var(--navy) 100%); }
.auth { width: 100%; max-width: 420px; }
.auth .brand { justify-content: center; font-size: 2.2rem; margin-bottom: 4px; }
.auth .tagline { text-align: center; color: rgba(255,255,255,.8); margin: 0 0 18px; text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; }
.auth .card { padding: 22px; }
.demo { font-size: .85rem; color: rgba(255,255,255,.85); text-align: center; margin-top: 14px; }
.demo code { background: rgba(255,255,255,.15); padding: 1px 6px; border-radius: 5px; color: #fff; }
body.on-auth .container { max-width: none; padding: 0; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(140px); background: var(--navy); color: #fff; border-left: 5px solid var(--ball);
  padding: 12px 18px; border-radius: 10px; font-weight: 700; max-width: calc(100vw - 32px); transition: transform .2s; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { border-left-color: var(--bad); }

/* ---------- móvil: barra de pestañas inferior */
@media (max-width: 720px) {
  .topbar { padding: 10px 16px; }
  nav { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; background: var(--navy); border-top: 3px solid var(--ball); justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 0; z-index: 30; }
  nav a, nav button { flex-direction: column; gap: 2px; font-size: .62rem; padding: 6px 4px; flex: 1; justify-content: center; letter-spacing: .02em; }
  nav svg { width: 22px; height: 22px; }
  nav a.active { background: none; color: var(--ball); }
  .toast { bottom: 84px; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 1.9rem; }
  .hero::after { display: none; }
}
