/* ═══════════════════════════════════════════════════════════════════
   Diseño claro de la app (base común)
   · Colores, letras, tarjetas, botones y tablas
   · Menú de arriba (ordenador) y barra de abajo + panel "Más" (móvil)
   Las páginas que ya usan este diseño cargan ui.css y ui-nav.js.
   ═══════════════════════════════════════════════════════════════════ */
@font-face { font-family: "Montserrat"; src: url("/web/fonts/Montserrat-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/web/fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/web/fonts/SourceSans3-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/web/fonts/SourceSans3-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f3f5f8; --sf: #ffffff; --sf2: #f1f3f7; --sf3: #e6e9ef; --bd: #e3e7ee;
  --ink: #111827; --ink2: #4b5563; --mut: #6b7280; --acc: #1f4bff; --acc-soft: rgba(31,75,255,.08);
  --bd2: #c9d0db; --dim: rgba(15,23,42,.38); --pop: 0 16px 40px rgba(15,23,42,.16);
  --w: #1a9b52; --d: #8b949e; --l: #d64545; --gold: #f2c100;
  --r: 12px; --nav-h: 56px; --tab-h: 64px;
  --head: "Montserrat", "Source Sans 3", system-ui, sans-serif;
  --body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}
html.ui { background: var(--bg); }
html.ui body {
  margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
}
html.ui *, html.ui *::before, html.ui *::after { box-sizing: border-box; }
html.ui h1, html.ui h2, html.ui h3 { font-family: var(--head); color: var(--ink); }
:where(html.ui) a { color: inherit; }

/* Tema oscuro (lo elige cada usuario; se guarda en su navegador) */
html.ui[data-theme="dark"] {
  --bg: #101215; --sf: #181b20; --sf2: #1f232a; --sf3: #2a2f37; --bd: #2a2f37; --bd2: #3a414c;
  --ink: #e8eaed; --ink2: #b9bfc7; --mut: #8b929c; --acc: #3d7bff; --acc-soft: rgba(61,123,255,.16);
  --dim: rgba(0,0,0,.55); --pop: 0 16px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
html.ui[data-theme="dark"] .ui-card { box-shadow: none; }
html.ui[data-theme="dark"] .ui-seg button.on { background: var(--sf3); box-shadow: none; }
html.ui[data-theme="dark"] img[src*="/crests/"] { filter: drop-shadow(0 0 1px rgba(255,255,255,.25)); }

/* Botón de tema */
.ui-theme { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--bd); background: var(--sf2); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ui-theme:hover { border-color: var(--bd2); }
.ui-sheet .theme-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 4px 0; font: 700 13px var(--head); }

.ui-wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.ui-card { background: var(--sf); border: 1px solid var(--bd); border-radius: var(--r); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.ui-card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px 10px; font: 700 15px var(--head); }
.ui-card-h small { font: 400 12px var(--body); color: var(--mut); }
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--bd); background: var(--sf); color: var(--ink);
  font: 700 13px var(--head); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.ui-btn:hover { border-color: var(--bd2); background: var(--sf2); }
.ui-btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; }
.ui-btn.ic { width: 36px; padding: 0; }
.ui-btn:disabled { opacity: .6; cursor: wait; }
.ui-btn svg { flex-shrink: 0; }
.ui-badge { display: inline-block; min-width: 20px; text-align: center; font: 800 11px var(--head); color: #fff; border-radius: 5px; padding: 2px 6px; }
.ui-badge.W { background: var(--w); } .ui-badge.D { background: var(--d); } .ui-badge.L { background: var(--l); }
.ui-seg { display: inline-flex; gap: 2px; background: var(--sf2); border-radius: 9px; padding: 3px; }
.ui-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: 700 12px var(--head); color: var(--mut); cursor: pointer; }
.ui-seg button.on { background: var(--sf); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ui-select {
  height: 34px; border: 1px solid var(--bd); border-radius: 8px; background: var(--sf); color: var(--ink);
  font: 600 13px var(--body); padding: 0 10px; cursor: pointer;
}

/* ── Tabla de clasificación ── */
.ui-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ui-table th { color: var(--mut); font-weight: 600; font-size: 12px; padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--bd); }
.ui-table td { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--bd); font-variant-numeric: tabular-nums; }
.ui-table .l { text-align: left; }
.ui-table td b { font-family: var(--head); }
.ui-table tbody tr { cursor: pointer; }
.ui-table tbody tr:hover td { background: var(--sf2); }
.ui-table tr.zc td:first-child { box-shadow: inset 3px 0 var(--gold); }
.ui-table tr.zp td:first-child { box-shadow: inset 3px 0 var(--acc); }
.ui-table tr.zr td:first-child { box-shadow: inset 3px 0 var(--l); }
.ui-tn { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-tn img { width: 18px !important; height: 18px !important; flex-shrink: 0; }
.ui-tn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-form { display: inline-flex; gap: 2px; } .ui-form i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.ui-form .W { background: var(--w); } .ui-form .D { background: var(--d); } .ui-form .L { background: var(--l); }

/* ═════════════ Menú de arriba (ordenador) ═════════════ */
html.ui body.ui-has-nav { padding-top: var(--nav-h); }
.ui-nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 800;
  background: var(--sf); border-bottom: 1px solid var(--bd);
  display: flex; align-items: center; gap: 4px; padding: 0 24px; font-size: 14px;
}
.ui-brand { display: flex; align-items: center; gap: 9px; font: 800 15px var(--head); color: var(--ink); text-decoration: none; margin-right: 18px; white-space: nowrap; }
.ui-brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }
.ui-brand span { display: flex; flex-direction: column; line-height: 1.05; }
.ui-brand b { font: 800 15px var(--head); }
.ui-brand small { font: 700 10px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--mut); margin-top: 2px; }
.ui-mi { position: relative; height: 100%; display: flex; align-items: center; }
.ui-mi > a, .ui-mi > button {
  height: 100%; display: flex; align-items: center; gap: 4px; padding: 0 11px; border: 0; background: none;
  color: var(--mut); font: 600 14px var(--body); text-decoration: none; cursor: pointer; position: relative;
}
.ui-mi > a:hover, .ui-mi > button:hover, .ui-mi.open > button { color: var(--ink); }
.ui-mi.on > a, .ui-mi.on > button { color: var(--ink); font-weight: 700; }
.ui-mi.on > a::after, .ui-mi.on > button::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 0; height: 2px; background: var(--acc); }
.ui-mi .car { font-size: 10px; opacity: .7; }
.ui-dd {
  position: absolute; top: calc(100% - 4px); left: -6px; width: 300px; background: var(--sf); border: 1px solid var(--bd);
  border-radius: 12px; box-shadow: var(--pop); padding: 6px; display: none;
}
.ui-mi.open .ui-dd { display: block; }
.ui-dd a { display: flex; flex-direction: column; padding: 9px 10px; border-radius: 8px; text-decoration: none; }
.ui-dd a:hover, .ui-dd a.cur { background: var(--sf2); }
.ui-dd b { font: 700 13px var(--head); color: var(--ink); }
.ui-dd span { font-size: 12px; color: var(--mut); }
.ui-nav-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ui-search {
  height: 36px; width: 240px; border: 1px solid var(--bd); border-radius: 9px; background: var(--sf2); color: var(--ink);
  padding: 0 12px 0 32px; font: 400 13px var(--body);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
.ui-search:focus { outline: none; border-color: var(--acc); background-color: var(--sf); }

/* Usuario (el menú de auth.js se coloca arriba a la derecha) */
.ui-nav #rfef-user { position: static !important; }
.ui-nav #rfef-user .rfef-user-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--bd) !important; background: var(--sf2) !important;
  color: var(--ink) !important; font: 700 12px var(--head) !important; opacity: 1 !important;
}
.ui-nav #rfef-user .rfef-user-menu {
  left: auto !important; right: 0; bottom: auto !important; top: 44px; background: var(--sf) !important;
  border: 1px solid var(--bd) !important; box-shadow: var(--pop) !important; color: var(--ink);
}
.ui-nav #rfef-user .rfef-user-head { border-color: var(--bd) !important; }
.ui-nav #rfef-user .rfef-user-head strong { color: var(--ink) !important; }
.ui-nav #rfef-user .rfef-user-menu a, .ui-nav #rfef-user .rfef-user-menu button { color: var(--ink) !important; }
.ui-nav #rfef-user .rfef-user-menu a:hover, .ui-nav #rfef-user .rfef-user-menu button:hover { background: var(--sf2) !important; }

/* ═════════════ Móvil: barra de abajo + panel "Más" ═════════════ */
.ui-tabbar { display: none; }
.ui-sheet-back { position: fixed; inset: 0; background: var(--dim); z-index: 900; }
.ui-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow-y: auto; z-index: 901;
  background: var(--sf); border-radius: 22px 22px 0 0; padding: 10px 16px calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(15,23,42,.15);
}
.ui-sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--sf3); margin: 0 auto 12px; }
.ui-sheet h3 { margin: 12px 4px 8px; font-size: 13px; color: var(--mut); text-transform: none; }
.ui-sheet .gr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ui-sheet .gr a { background: var(--sf2); border-radius: 12px; padding: 10px 12px; text-decoration: none; display: flex; flex-direction: column; }
.ui-sheet .gr a b { font: 700 13px var(--head); color: var(--ink); }
.ui-sheet .gr a span { font-size: 11px; color: var(--mut); }
.ui-sheet .acct { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 0; }
.ui-sheet .acct b { font: 700 15px var(--head); } .ui-sheet .acct small { display: block; color: var(--mut); font-size: 12px; }
.ui-sheet .acct-act { display: flex; gap: 6px; }

@media (max-width: 900px) {
  html.ui body.ui-has-nav { padding-top: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
  .ui-nav { display: none; }
  .ui-wrap { padding: 0 12px; }
  .ui-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 800; background: var(--sf); border-top: 1px solid var(--bd);
    height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding: 6px 0 env(safe-area-inset-bottom, 0px);
    justify-content: space-around;
  }
  .ui-tabbar a, .ui-tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none;
    color: #7c838d; font: 600 10px var(--body); text-decoration: none; cursor: pointer; padding-top: 4px;
  }
  .ui-tabbar .on { color: var(--acc); }
  #rfef-user { display: none !important; }
  .ui-sheet #rfef-user { display: block !important; position: static !important; }
}
@media print { .ui-nav, .ui-tabbar { display: none !important; } html.ui body.ui-has-nav { padding: 0 !important; } }

/* ── Mi equipo (cuentas de cliente ligadas a un equipo) ── */
.mt-box { padding-top: 14px; }
.mt-box[hidden] { display: none; }
.mt-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); background: var(--sf); border: 1px solid var(--bd); border-radius: var(--r); overflow: hidden; }
.mt-me { display: flex; align-items: center; gap: 14px; padding: 14px 18px; position: relative; background: linear-gradient(135deg, #0b3a8c, #1557c9); color: #fff; }
html.ui[data-theme="dark"] .mt-me { background: linear-gradient(135deg, #0b2f70, #12161c); }
.mt-me > img, .mt-me > .crest { background: #fff; border-radius: 10px; padding: 4px; flex-shrink: 0; }
.mt-me small { display: block; font: 700 10.5px var(--body); text-transform: uppercase; letter-spacing: .05em; color: #bcd2ff; }
.mt-me b { display: block; font: 800 20px/1.15 var(--head); }
.mt-st { display: block; font-size: 13px; color: #e3ecff; margin-top: 2px; } .mt-st em { font-style: normal; font-weight: 800; color: #fff; }
.mt-form { margin-top: 6px; } .mt-form i { width: 9px; height: 9px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.5); }
.mt-link { margin-left: auto; align-self: flex-start; font: 700 12.5px var(--body); color: #fff; text-decoration: none; background: rgba(255,255,255,.16); border-radius: 99px; padding: 5px 11px; white-space: nowrap; }
.mt-next { padding: 12px 18px; display: flex; flex-direction: column; gap: 8px; justify-content: center; min-width: 0; }
.mt-next small { font: 700 11px var(--body); color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.mt-rv { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mt-rv b { display: block; font: 800 16px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-rv span { font-size: 12.5px; color: var(--mut); }
.mt-acts { display: flex; gap: 6px; flex-wrap: wrap; } .mt-acts .ui-btn { height: 32px; font-size: 12.5px; text-decoration: none; }
/* su equipo resaltado */
.mc.mine { border-color: color-mix(in srgb, var(--gold) 70%, var(--bd)); box-shadow: inset 3px 0 0 var(--gold); }
tr.mine td { background: color-mix(in srgb, var(--gold) 14%, transparent) !important; }
tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
@media (max-width: 720px) {
  .mt-card { grid-template-columns: 1fr; }
  .mt-me { padding: 12px 14px; } .mt-me b { font-size: 17px; }
  .mt-next { padding: 10px 14px 12px; }
  .mt-acts .ui-btn { flex: 1; justify-content: center; }
}

/* Cuenta de jugador: sin onces, vestuario, penaltis ni árbitros */
html[data-kind="player"] [data-tab="equipo"], html[data-kind="player"] [data-tab="vestuario"],
html[data-kind="player"] a[href*="/web/equipo.html"], html[data-kind="player"] a[href*="/web/vestuario.html"],
html[data-kind="player"] a[href*="/web/penaltis.html"], html[data-kind="player"] a[href*="/web/arbitros.html"],
html[data-kind="player"] a[href*="/web/comparativa.html"] { display: none !important; }
.mt-nums { display: flex; gap: 14px; margin-top: 6px; font: 700 10.5px var(--body); color: #bcd2ff; }
.mt-nums b { display: block; font: 800 17px/1 var(--head); color: #fff; }
.mt-warn { display: inline-block; margin-top: 7px; font: 700 11.5px var(--body); background: #facc15; color: #3d2f00; border-radius: 6px; padding: 2px 8px; }

/* Público: candados y botones de entrar / suscribirse */
.ui-lock { display: inline-block; vertical-align: -1px; margin-left: 5px; color: var(--mut); }
.ui-dd a.locked b, .ui-sheet a.locked b { color: var(--ink2); }
.ui-tabbar a.locked { opacity: .7; } .ui-tabbar a .ui-lock { position: absolute; margin: -2px 0 0 14px; }
.ui-tabbar a { position: relative; }
.ui-nav-r > .ui-btn { height: 34px; font-size: 13px; text-decoration: none; }
.ui-sheet .acct.pub { background: linear-gradient(135deg, #0b3a8c, #1557c9); color: #fff; }
.ui-sheet .acct.pub small { color: #cfe0ff; }
.ui-sheet .acct-act a.ui-btn { text-decoration: none; }

/* Notificaciones */
.nt-ov { position: fixed; inset: 0; z-index: 1200; background: var(--dim); display: flex; align-items: center; justify-content: center; padding: 16px; }
.nt-dlg { width: min(460px, 100%); max-height: 90vh; overflow: auto; background: var(--sf); color: var(--ink); border: 1px solid var(--bd); border-radius: 16px; box-shadow: var(--pop); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.nt-h { display: flex; align-items: center; justify-content: space-between; } .nt-h h3 { margin: 0; font: 800 18px var(--head); }
.nt-b { display: flex; flex-direction: column; gap: 12px; }
.nt-dev { display: flex; align-items: center; gap: 12px; background: var(--sf2); border-radius: 12px; padding: 12px 14px; }
.nt-dev.on { background: color-mix(in srgb, var(--w) 12%, var(--sf2)); }
.nt-dev > div { flex: 1; } .nt-dev b { display: block; font: 800 14px var(--head); } .nt-dev small { font-size: 12.5px; color: var(--mut); }
.nt-warn { background: color-mix(in srgb, var(--gold) 18%, var(--sf2)); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ink2); line-height: 1.45; }
.nt-l { border: 1px solid var(--bd); border-radius: 12px; overflow: hidden; }
.nt-lh { font: 700 11.5px var(--body); text-transform: uppercase; letter-spacing: .05em; color: var(--mut); padding: 9px 14px; background: var(--sf2); }
.nt-t { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--bd); cursor: pointer; font-size: 14px; }
.nt-t span { flex: 1; }
.nt-t input { position: absolute; opacity: 0; pointer-events: none; }
.nt-t i { width: 38px; height: 22px; border-radius: 99px; background: var(--sf3); position: relative; transition: background .15s; flex-shrink: 0; }
.nt-t i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.nt-t input:checked + i { background: var(--acc); } .nt-t input:checked + i::after { transform: translateX(16px); }
.nt-f { display: flex; align-items: center; justify-content: space-between; } .nt-f small { font-size: 12px; color: var(--mut); }
.nt-msg { font-size: 13px; font-weight: 700; color: var(--acc); }
/* Público: los PDF también llevan candado */
html[data-kind="public"] #btnExportPdf::after, html[data-kind="public"] #btnExportTemporada::after, html[data-kind="public"] #btnPdf::after {
  content: ""; width: 12px; height: 12px; margin-left: 2px; background: currentColor; opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center/contain no-repeat; }
