/* =========================================================
   AD La Torre: estilos
   Paleta: pared de pabellón, tinta, pista azul, parquet,
   y los dos petos del sorteo (configurables en Ajustes).
   ========================================================= */

:root {
  --wall: #EEF1F3;
  --paper: #FFFFFF;
  --ink: #16212B;
  --ink-2: #4A5866;
  --ink-3: #7B8794;
  --line: #D6DCE2;
  --court: #12456B;
  --court-2: #0D3452;
  --parquet: #C8873F;
  --parquet-soft: #F6E9D8;
  --win: #2E9A5A;
  --draw: #8F99A4;
  --loss: #D0433B;
  --absent: #E3E7EB;
  --gk: #B0267A;
  --gold: #D4A017;
  --silver: #A3ADB8;
  --bronze: #B8733A;
  --trophy: #19B3D3;
  --up: #2E9A5A;
  --down: #D0433B;
  --focus: #F2C12E;
  --radius-s: 4px;
  --radius-m: 8px;
  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --team-a: #F2C12E; --team-b: #2B63C9; --team-a-ink: #16212B; --team-b-ink: #FFFFFF;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--court); text-underline-offset: 2px; }
a:hover { color: var(--court-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }
.num { font-variant-numeric: tabular-nums; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 .6em; }
h1, h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: .005em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }

.container { width: min(1440px, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(560px, 100% - 2rem); }
.page { padding-block: 2rem 4rem; }

/* ---------- Cabecera ---------- */
.site-header { background: var(--court); color: #fff; position: relative; z-index: 5; }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-logo { height: 40px; width: auto; }
.brand-name { white-space: nowrap; font-family: var(--font-display); font-weight: 900; font-size: 1.7rem; letter-spacing: .01em; }
.site-nav { display: flex; align-items: center; flex: 1; gap: 1rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav .menu { display: flex; gap: .25rem; flex: 1; align-items: center; }
.site-nav .menu > li { position: relative; display: flex; align-items: center; }
.site-nav a, .sub-toggle-label { white-space: nowrap; color: #DCE7F0; text-decoration: none; padding: .45rem .6rem; border-radius: var(--radius-s); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.site-nav .menu > li > a[aria-current], .site-nav .menu > li.is-active > a, .site-nav .menu > li.is-active > .sub-toggle-label { color: #fff; box-shadow: inset 0 -3px 0 var(--team-a); border-radius: 0; }
/* Desplegables */
.sub-toggle { background: none; border: 0; color: #DCE7F0; cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .35rem; }
.sub-toggle::after { content: ""; width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.sub-toggle-label { padding-right: .6rem; }
.sub-toggle:hover { color: #fff; }
.sub-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.site-nav .sub { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 220px; background: var(--paper); border-radius: var(--radius-m); box-shadow: 0 12px 32px rgba(13,52,82,.25); padding: .5rem; z-index: 20; }
.site-nav .sub::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.site-nav .menu > li.has-sub:hover > .sub, .site-nav .menu > li.has-sub:focus-within > .sub, .site-nav .menu > li.has-sub.open > .sub { display: flex; gap: .25rem 1.25rem; }
.site-nav .sub { flex-direction: column; }
.site-nav .sub:has(> li.group) { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
.site-nav .sub a { display: block; color: var(--ink); padding: .45rem .7rem; }
.site-nav .sub a:hover { background: var(--wall); color: var(--ink); }
.site-nav .sub a[aria-current] { color: var(--court); font-weight: 700; box-shadow: inset 3px 0 0 var(--team-a); border-radius: 0; }
.site-nav .group { min-width: 180px; }
.site-nav .group-title, .site-nav .sub .menu-label { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--court); padding: .35rem .7rem .2rem; }
a.group-title:hover { background: none; text-decoration: underline; }
.nav-user { display: flex; align-items: center; gap: .5rem; }
.nav-me { display: flex !important; align-items: center; gap: .4rem; }
.nav-me span { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.linklike { background: none; border: 0; color: #DCE7F0; font: inherit; font-size: .95rem; cursor: pointer; padding: .45rem .6rem; }
.linklike:hover { color: #fff; text-decoration: underline; }
.nav-user .nav-logout { font-weight: 500; border-radius: var(--radius-s); text-decoration: none; white-space: nowrap; }
.nav-user .nav-logout:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
/* Botón de cuenta en la cabecera: "Iniciar sesión" en ordenador (dentro de la barra), "Entrar" o la foto en móvil */
.nav-login { display: inline-flex !important; align-items: center; gap: .4rem; }
.ico-user { flex: none; }
.header-account { display: none; margin-left: auto; align-items: center; gap: .35rem; color: #fff; text-decoration: none; font: 600 .9rem var(--font-body); border: 1px solid rgba(255,255,255,.4); border-radius: var(--radius-s); padding: .38rem .7rem; white-space: nowrap; }
.header-account:hover { background: rgba(255,255,255,.08); color: #fff; }
.header-account.is-in { padding: 0; border: 2px solid rgba(255,255,255,.55); border-radius: 50%; line-height: 0; }
.header-account.is-in .avatar, .header-account.is-in .avatar-xs { width: 34px; height: 34px; font-size: .8rem; }
.header-account + .nav-toggle { margin-left: .5rem; }
.nav-toggle { display: none; margin-left: auto; background: none; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: var(--radius-s); padding: .4rem .8rem; font: 600 .9rem var(--font-body); }
form.inline { display: inline; margin: 0; }

@media (max-width: 1100px) {
  .nav-toggle { display: block; }
  .header-account { display: inline-flex; }
  .header-inner { column-gap: .5rem; }
  .header-account + .nav-toggle { margin-left: 0; }
  .nav-user .nav-login { display: none !important; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--court-2); flex-direction: column; align-items: stretch; padding: .75rem 1rem 1rem; }
  .site-nav.open { display: flex; }
  .site-nav .menu { flex-direction: column; align-items: stretch; }
  .site-nav .menu > li { flex-wrap: wrap; }
  .site-nav .menu > li > a, .site-nav .menu > li > .sub-toggle-label { flex: 1; }
  .site-nav .menu > li > a[aria-current], .site-nav .menu > li.is-active > a, .site-nav .menu > li.is-active > .sub-toggle-label { box-shadow: inset 3px 0 0 var(--team-a); }
  .sub-toggle-label { text-align: left; }
  .site-nav .menu > li.has-sub:hover > .sub, .site-nav .menu > li.has-sub:focus-within > .sub { display: none; }
  .site-nav .menu > li.has-sub.open > .sub { display: flex; }
  .site-nav .sub { position: static; flex-basis: 100%; box-shadow: none; background: rgba(255,255,255,.06); margin: .2rem 0 .4rem; }
  .site-nav .sub:has(> li.group) { flex-direction: column; }
  .site-nav .sub a { color: #DCE7F0; }
  .site-nav .sub a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .site-nav .sub a[aria-current] { color: #fff; }
  .site-nav .group-title, .site-nav .sub .menu-label { color: var(--team-a); }
  .nav-user { border-top: 1px solid rgba(255,255,255,.15); padding-top: .75rem; flex-wrap: wrap; }
}

/* ---------- Pie ---------- */
.site-footer { background: var(--f-bg, var(--ink)); color: var(--f-ink, #C2CBD3); font-size: .9rem; margin-top: auto; }
.footer-inner { display: flex; gap: 2rem; padding-block: 2.2rem; align-items: flex-start; }
.f-logo img { height: 64px; width: auto; }
.f-cols { flex: 1; display: grid; gap: 1.5rem 2.5rem; }
.f-cols-1 { grid-template-columns: 1fr; }
.f-cols-2 { grid-template-columns: repeat(2, 1fr); }
.f-cols-3 { grid-template-columns: repeat(3, 1fr); }
.f-cols-4 { grid-template-columns: repeat(4, 1fr); }
.f-cols-2 .f-col:last-child:not(:first-child) { justify-self: end; }
.f-title { color: var(--f-title, #fff); font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; margin: 0 0 .5rem; }
.f-brand { color: var(--f-title, #fff); font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; margin: 0 0 .3rem; }
.site-footer p { margin: .3rem 0 0; }
.f-text > :first-child { margin-top: 0; }
.f-text p { margin: 0 0 .5rem; }
.f-text h2, .f-text h3 { color: var(--f-title, #fff); font-size: 1.05rem; margin: 0 0 .4rem; }
.f-text ul { padding-left: 1.1rem; margin: 0 0 .5rem; }
.f-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.site-footer a { color: var(--f-ink, #C2CBD3); text-decoration: none; }
.site-footer a:hover { color: var(--f-title, #fff); }
.footer-links { display: flex; flex-direction: column; gap: .3rem; }
.f-sponsors { border-bottom: 1px solid color-mix(in srgb, var(--f-ink, #C2CBD3) 20%, transparent); padding-block: 1.5rem; text-align: center; }
.f-sponsors ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; justify-content: center; align-items: center; }
.f-sponsors img { max-height: 56px; max-width: 160px; width: auto; height: auto; }
.f-sponsors a { display: block; }
.f-sponsors a:hover img { opacity: .85; }
.f-bottom { border-top: 1px solid color-mix(in srgb, var(--f-ink, #C2CBD3) 20%, transparent); font-size: .82rem; padding-block: .9rem; }
.f-bottom .container { display: flex; justify-content: space-between; gap: .5rem 1.5rem; flex-wrap: wrap; }
.f-bottom-links { display: flex; gap: 1.2rem; flex-wrap: wrap; }
@media (max-width: 800px) {
  .footer-inner { flex-direction: column; }
  .f-cols-3, .f-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .f-cols-2, .f-cols-3, .f-cols-4 { grid-template-columns: 1fr; }
  .f-cols-2 .f-col:last-child:not(:first-child) { justify-self: start; }
}

/* ---------- Títulos de página ---------- */
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 900; margin: 0; }
.page-sub { color: var(--ink-2); margin: .3rem 0 0; }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 600 .95rem/1 var(--font-body); padding: .7rem 1.1rem; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-primary { background: var(--court); border-color: var(--court); color: #fff; }
.btn-primary:hover { background: var(--court-2); border-color: var(--court-2); color: #fff; }
.btn-danger { color: var(--loss); border-color: #EBC1BE; }
.btn-danger:hover { background: var(--loss); color: #fff; border-color: var(--loss); }
.btn-small { padding: .45rem .75rem; font-size: .85rem; }
.btn-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-on-dark:hover { background: #fff; color: var(--court); border-color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.form { display: grid; gap: 1rem; }
.form fieldset { border: 0; padding: 0; margin: 0 0 .5rem; display: grid; gap: .9rem; }
.form legend { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; margin-bottom: .4rem; padding: 0; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.form .check { display: flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--ink); }
.form .hint { font-weight: 400; color: var(--ink-3); font-size: .85rem; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], input[type=color], input:not([type]), select, textarea {
  font: 400 1rem var(--font-body); color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem .7rem; width: 100%;
}
input[type=color] { padding: .2rem; height: 2.6rem; width: 4rem; }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--court); outline: 2px solid rgba(18,69,107,.2); outline-offset: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 600px) { .row2, .row3 { grid-template-columns: 1fr; } }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.card-plain { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.5rem; }

.alert { padding: .8rem 1rem; border-radius: var(--radius-s); margin-bottom: 1rem; border-left: 4px solid; background: var(--paper); }
.alert-ok { border-color: var(--win); }
.alert-error { border-color: var(--loss); }
.alert-info { border-color: var(--court); }

.empty { background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius-m); padding: 2rem; text-align: center; color: var(--ink-2); }

/* ---------- Pestañas y selectores ---------- */
.toolbar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .25rem; }
.tabs a { padding: .5rem .9rem; border-radius: var(--radius-s); text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.tabs a:hover { color: var(--ink); background: var(--wall); }
.tabs a[aria-current] { background: var(--court); color: #fff; }
.month-select select { width: auto; font-weight: 600; padding-right: 2rem; }

/* ---------- Avatares y nombres ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: #CFD8E0; color: var(--court-2); font-weight: 700; object-fit: cover; flex: none; }
.avatar-xs { width: 26px; height: 26px; font-size: .65rem; }
.avatar-sm { width: 34px; height: 34px; font-size: .75rem; }
.avatar-md { width: 48px; height: 48px; font-size: .95rem; }
.avatar-xl { width: 150px; height: 150px; font-size: 2.6rem; border-radius: var(--radius-m); }
.avatar-gk { box-shadow: 0 0 0 2px var(--gk); }
.pl { color: var(--ink); text-decoration: none; font-weight: 600; }
.pl:hover { text-decoration: underline; color: var(--ink); }
.pl-gk, .pl-gk:hover { color: var(--gk); }
.legend { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); margin-top: .8rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.dot { width: .7rem; height: .7rem; border-radius: 2px; display: inline-block; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); }
table.t { width: 100%; border-collapse: collapse; font-size: .95rem; }
.t th, .t td { padding: .55rem .6rem; text-align: right; white-space: nowrap; }
.t th { font-size: .78rem; font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--line); background: #F7F9FA; position: sticky; top: 0; }
.t td { border-bottom: 1px solid #EDF0F3; font-variant-numeric: tabular-nums; }
.t tr:last-child td { border-bottom: 0; }
.t .l { text-align: left; }
.t .c { text-align: center; }
.t .pos { width: 2.6rem; text-align: center; font-weight: 700; color: var(--ink-2); }
.t .name { text-align: left; width: 100%; }
.t .name-cell { display: flex; align-items: center; gap: .55rem; }
.t .strong { font-weight: 700; color: var(--ink); }
.t tbody tr:hover td { background: #F8FAFB; }
.t tr.zone-up td.pos { box-shadow: inset 4px 0 0 var(--up); color: var(--up); }
.t tr.zone-down td.pos { box-shadow: inset 4px 0 0 var(--down); color: var(--down); }
.t tr.me td { background: #FFF8DE; }
.t .muted { color: var(--ink-3); }
.t .pts { font-weight: 800; font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }

.table-note { font-size: .85rem; color: var(--ink-2); margin: .6rem 0 0; }

/* ---------- Resultado (chips) ---------- */
.chip { display: inline-grid; place-items: center; min-width: 1.7rem; height: 1.7rem; padding: 0 .3rem; border-radius: var(--radius-s); font-weight: 700; font-size: .8rem; color: #fff; }
.chip-v { background: var(--win); }
.chip-e { background: var(--draw); }
.chip-d { background: var(--loss); }
.chip-x { background: var(--absent); color: var(--ink-3); }
.chip-a { background: #7C8B99; }
.chip-r { background: #5B2333; }
.score-susp { font-size: .8em; color: var(--ink-3); letter-spacing: .02em; }
.mp-status { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; font-size: .85rem; padding-left: 2.1rem; }
.mp-status select { width: auto; padding: .2rem .4rem; font-size: .85rem; }
.mp-status label { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 600; }
.mp-status input { width: 4.5rem; padding: .2rem .4rem; font-size: .85rem; }
.mp-status[hidden], .mp-status [hidden] { display: none !important; }
.picker.is-susp .o-b { display: none; }
.picker.is-susp .mp-status { display: none !important; }
.st-badge { font-size: .72rem; font-weight: 600; padding: .05rem .4rem; border-radius: 3px; background: var(--absent); color: var(--ink-2); white-space: nowrap; }
.prize-chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: .05rem .4rem; border-radius: 3px; background: var(--parquet, #C8873F); color: #fff; margin-left: .35rem; white-space: nowrap; vertical-align: middle; }
.prize-chip.is-prov { background: transparent; color: var(--parquet, #C8873F); border: 1px solid currentColor; }
.san-mark { color: var(--loss); font-weight: 700; margin-left: .2rem; cursor: help; }
.form-row { display: inline-flex; gap: 3px; }

/* ---------- Marcador del sorteo (el elemento protagonista) ---------- */
.draw-hero { position: relative; background: var(--court-2); color: #fff; overflow: hidden; }
.draw-hero-inner { position: relative; padding-block: 2.5rem 3rem; }
.draw-kicker { font-size: 1rem; color: #C9D8E5; margin: 0 0 1.2rem; }
.draw-kicker strong { color: #fff; }
.draw-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(2.6rem, 7vw, 5.2rem); line-height: .95; margin: 0 0 2rem; }
.draw-boards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.board { display: grid; grid-template-columns: 1fr auto 1fr; border-radius: var(--radius-m); overflow: hidden; text-decoration: none; color: inherit; min-height: 150px; box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.board:hover { color: inherit; }
.board:hover .board-score { background: #000; }
.board-side { padding: 1rem 1.1rem; display: flex; flex-direction: column; justify-content: space-between; gap: .6rem; }
.board-a { background: var(--team-a); color: var(--team-a-ink); clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%); padding-right: 1.6rem; }
.board-b { background: var(--team-b); color: var(--team-b-ink); text-align: right; clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%); padding-left: 1.6rem; }
.board-team { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; line-height: 1; }
.board-players { font-size: .78rem; line-height: 1.35; opacity: .85; }
.board-score { background: #0A1E2E; color: #fff; display: grid; place-items: center; padding: 0 1rem; min-width: 7.5rem; transition: background .15s; }
.board-score .cat { font-size: .78rem; color: #9FB4C6; text-align: center; margin-bottom: .2rem; }
.board-score .nums { font-family: var(--font-display); font-weight: 900; font-size: 3.6rem; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.board-score .nums span { color: #60717F; padding: 0 .1em; }
.board-empty { border: 1px dashed rgba(255,255,255,.3); border-radius: var(--radius-m); padding: 2rem; color: #C9D8E5; }
@media (max-width: 400px) { .header-account { padding: .38rem .55rem; } .nav-toggle { padding: .4rem .6rem; } }
@media (max-width: 340px) { .header-account:not(.is-in) span { display: none; } }
@media (max-width: 480px) {
  .board { grid-template-columns: 1fr; }
  .board-a, .board-b { clip-path: none; text-align: left; padding: .9rem 1rem; }
  .board-score { padding: .6rem; }
  .board-score .nums { font-size: 3rem; }
}

/* ---------- Inicio ---------- */
.home-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem; padding-block: 2.5rem 4rem; }
.home-grid > * { min-width: 0; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
@media (max-width: 900px) { .span-6, .span-4, .span-8 { grid-column: span 12; } }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.block-head h2 { margin: 0; font-size: 1.6rem; }
.block-head a { font-size: .9rem; font-weight: 600; }

.list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); }
.list li { display: flex; align-items: center; gap: .7rem; padding: .65rem .9rem; border-bottom: 1px solid #EDF0F3; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .big { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1; }

/* ---------- Premio especial ---------- */
.prize-head { background: var(--parquet-soft); border: 1px solid #E9D3B6; border-radius: var(--radius-m); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; display: flex; gap: 2rem; flex-wrap: wrap; align-items: center; }
.prize-head p { margin: 0; flex: 1; }
.streak-bar { display: flex; gap: 3px; align-items: center; }
.streak-bar i { width: 12px; height: 18px; border-radius: 2px; background: #E5E9ED; display: block; }
.streak-bar i.on { background: var(--win); }
.streak-bar i.gold { background: var(--parquet); }
.streak-n { font-family: var(--font-display); font-weight: 900; font-size: 1.6rem; min-width: 2ch; display: inline-block; text-align: right; }
.money { color: #8A5A22; font-weight: 700; }

/* ---------- Hoja de control ---------- */
.sheet th.d { text-align: center; padding: .45rem .25rem; min-width: 3.4rem; }
.sheet th.d small { display: block; font-weight: 400; }
.sheet th.d .r { display: block; color: var(--ink); font-weight: 700; font-size: .85rem; }
.sheet td.cell { text-align: center; padding: .3rem .25rem; }
.sheet td.cell .chip { width: 2.2rem; position: relative; }
.sheet .chip .tm { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 3px; border-radius: 2px; }
.sheet .tm-a { background: var(--team-a); }
.sheet .tm-b { background: var(--team-b); }
.sheet td.none { color: var(--line); text-align: center; }
.sheet td.sticky, .sheet th.sticky { position: sticky; left: 0; background: var(--paper); z-index: 1; }
.sheet thead th.sticky { background: #F7F9FA; z-index: 2; }

/* ---------- Resultados / partido ---------- */
.day { margin-bottom: 2rem; }
.day h2 { font-size: 1.5rem; }
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: .75rem; text-decoration: none; color: inherit; }
.match-row:hover { border-color: var(--ink-3); color: inherit; }
.match-side { padding: .8rem 1rem; font-size: .85rem; color: var(--ink-2); }
.match-side b { display: block; color: var(--ink); font-size: .95rem; margin-bottom: .2rem; }
.match-side.a { border-left: 6px solid var(--team-a); }
.match-side.b { border-right: 6px solid var(--team-b); text-align: right; }
.match-mid { display: grid; place-items: center; padding: .5rem 1.2rem; background: #F7F9FA; border-inline: 1px solid var(--line); text-align: center; }
.match-mid .cat { font-size: .75rem; color: var(--ink-3); }
.score { font-family: var(--font-display); font-weight: 900; font-size: 2rem; font-variant-numeric: tabular-nums; }
.score-sep { color: var(--ink-3); padding: 0 .15em; }
@media (max-width: 600px) { .match-row { grid-template-columns: 1fr; } .match-side.b { text-align: left; border-right: 0; border-left: 6px solid var(--team-b); } .match-mid { border-inline: 0; border-block: 1px solid var(--line); } }

.lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .lineups { grid-template-columns: 1fr; } }
.lineup { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.lineup h2 { margin: 0; padding: .8rem 1rem; font-size: 1.5rem; display: flex; justify-content: space-between; }
.lineup.a h2 { background: var(--team-a); color: var(--team-a-ink); }
.lineup.b h2 { background: var(--team-b); color: var(--team-b-ink); }
.lineup ul { list-style: none; margin: 0; padding: .4rem 0; }
.lineup li { display: flex; align-items: center; gap: .6rem; padding: .45rem 1rem; }

/* ---------- Jugadores ---------- */
.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.player-card { display: flex; align-items: center; gap: .8rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .8rem; text-decoration: none; color: var(--ink); }
.player-card:hover { border-color: var(--ink-3); color: var(--ink); }
.player-card .n { font-weight: 700; }
.player-card .s { font-size: .85rem; color: var(--ink-2); }
.player-card.gk .n { color: var(--gk); }

/* ---------- Ficha ---------- */
.profile-head { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "foto titulo" "foto datos"; column-gap: 1.75rem; row-gap: 1rem; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.5rem; margin-bottom: 1.5rem; }
.profile-head > .avatar { grid-area: foto; align-self: start; }
.profile-title { grid-area: titulo; align-self: end; min-width: 0; }
.profile-body { grid-area: datos; align-self: start; min-width: 0; }
.profile-head h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 900; margin: 0; line-height: 1.05; overflow-wrap: anywhere; }
.profile-head .gk-name { color: var(--gk); }
.profile-fullname { margin: .3rem 0 0; color: var(--ink-2); font-size: 1.05rem; }
.profile-title .badge { margin-top: .5rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); column-gap: 2rem; margin: 0 0 1rem; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.facts li { display: flex; justify-content: flex-start; align-items: baseline; gap: .35rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.facts li span { color: var(--ink-2); white-space: nowrap; }
.facts b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.profile-bio { color: var(--ink-2); max-width: 65ch; }
.profile-bio p { margin: 0 0 .6rem; }
@media (max-width: 600px) {
  .profile-head { grid-template-columns: auto 1fr; grid-template-areas: "foto titulo" "datos datos"; column-gap: 1rem; padding: 1.1rem; }
  .profile-head > .avatar { align-self: center; }
  .profile-title { align-self: center; }
  .avatar-xl { width: 84px; height: 84px; }
  .profile-head h1 { font-size: clamp(1.7rem, 8vw, 2.3rem); }
  .profile-fullname { font-size: .95rem; }
  .facts { grid-template-columns: 1fr; }
  .facts li { justify-content: space-between; gap: 1rem; }
  .facts b { text-align: right; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 1.5rem; }
.stat { padding: 1rem; border-right: 1px solid #EDF0F3; border-bottom: 1px solid #EDF0F3; }
.stat .v { font-family: var(--font-display); font-weight: 900; font-size: 2.2rem; line-height: 1; display: block; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .82rem; color: var(--ink-2); }

.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.ach { display: flex; gap: .7rem; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .75rem .9rem; }
.ach .ic { font-size: 1.5rem; line-height: 1; }
.ach b { display: block; font-size: .95rem; }
.ach small { color: var(--ink-3); }

.section { margin-bottom: 2rem; }

/* ---------- Muro ---------- */
.wall { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .wall { grid-template-columns: 1fr; } }
.composer, .post { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.composer textarea { min-height: 5rem; }
.post-head { display: flex; gap: .65rem; align-items: center; margin-bottom: .6rem; }
.post-head .meta { font-size: .82rem; color: var(--ink-3); }
.post-body { white-space: normal; overflow-wrap: anywhere; }
.post-img { margin-top: .6rem; border-radius: var(--radius-s); max-height: 520px; object-fit: contain; background: var(--wall); }
.post.logro { border-left: 4px solid var(--parquet); }
.post.logro .post-body strong { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; display: block; }
.post-actions { display: flex; gap: .8rem; align-items: center; margin-top: .7rem; font-size: .88rem; }
.post-actions button { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; font-weight: 600; }
.post-actions button:hover { color: var(--ink); }
.post-actions .liked { color: var(--loss); }
.comments { border-top: 1px solid #EDF0F3; margin-top: .7rem; padding-top: .6rem; display: grid; gap: .55rem; }
.comment { display: flex; gap: .5rem; font-size: .92rem; }
.comment .bubble { background: var(--wall); border-radius: var(--radius-m); padding: .45rem .7rem; flex: 1; overflow-wrap: anywhere; }
.comment .bubble a { font-weight: 700; }
.comment-form { display: flex; gap: .5rem; }
.comment-form input { flex: 1; }
.side-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.side-box h3 { margin-bottom: .6rem; }

/* ---------- Login ---------- */
.login-wrap { min-height: 60vh; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 2rem; }
.login-card h1 { font-size: 2.4rem; font-weight: 900; }

/* ---------- Paginación ---------- */
.pager { display: flex; gap: .5rem; justify-content: center; margin-top: 1rem; }

/* =========================================================
   Panel de administración
   ========================================================= */
.admin-body { background: #E8ECEF; }
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side { background: var(--ink); color: #C2CBD3; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side .brand-name { font-size: 1.5rem; color: #fff; }
.admin-side .brand-sub { display: block; font-size: .8rem; color: #8D99A5; margin-bottom: 1.5rem; }
.admin-side nav a { display: block; color: #C2CBD3; text-decoration: none; padding: .55rem .7rem; border-radius: var(--radius-s); font-weight: 500; margin-bottom: 2px; }
.admin-side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-side nav a[aria-current] { background: var(--court); color: #fff; }
.admin-side .side-foot { margin-top: 2rem; font-size: .85rem; border-top: 1px solid rgba(255,255,255,.12); padding-top: 1rem; display: grid; gap: .4rem; }
.admin-side .side-foot a, .admin-side .linklike { color: #C2CBD3; padding: 0; font-size: .85rem; text-align: left; }
.admin-main { padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; }
.admin-main .page-title { font-size: 2.4rem; }
.admin-toggle { display: none; }
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; }
  .admin-side nav { display: none; }
  .admin-side nav.open { display: block; }
  .admin-toggle { display: inline-block; float: right; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: var(--radius-s); padding: .3rem .7rem; }
}
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.panel h2 { font-size: 1.5rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.2rem; }
.kpi .v { font-family: var(--font-display); font-weight: 900; font-size: 2.4rem; line-height: 1; display: block; }
.kpi .k { color: var(--ink-2); font-size: .88rem; }
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--wall); color: var(--ink-2); }
.badge-gk { background: #F7E1EE; color: var(--gk); }
.badge-ok { background: #DDF2E5; color: #1F6E3F; }
.badge-off { background: #F6DEDC; color: #9C2F28; }

/* Editor de partido: reparto de equipos */
.picker { display: grid; gap: .35rem; }
.pick { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; padding: .4rem .6rem; border-radius: var(--radius-s); background: #F7F9FA; }
.pick .who { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.pick .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--paper); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: .4rem .7rem; font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--ink-2); border-left: 1px solid var(--line); display: block; }
.seg label:first-of-type { border-left: 0; }
.seg input:checked + label.o-n { background: var(--absent); color: var(--ink); }
.seg input:checked + label.o-a { background: var(--team-a); color: var(--team-a-ink); }
.seg input:checked + label.o-b { background: var(--team-b); color: var(--team-b-ink); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -3px; }
.pick.is-a { background: color-mix(in srgb, var(--team-a) 18%, white); }
.pick.is-b { background: color-mix(in srgb, var(--team-b) 14%, white); }
.score-inputs { display: grid; grid-template-columns: 1fr auto 1fr; gap: .8rem; align-items: end; max-width: 460px; }
.score-inputs input { font-family: var(--font-display); font-weight: 900; font-size: 2.2rem; text-align: center; padding: .3rem; }
.score-inputs .sep { font-size: 2rem; padding-bottom: .5rem; color: var(--ink-3); }
.team-count { font-size: .85rem; color: var(--ink-2); }
.sticky-save { position: sticky; bottom: 0; background: rgba(232,236,239,.95); padding: .8rem 0; border-top: 1px solid var(--line); margin-top: 1rem; }

.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .moves { grid-template-columns: 1fr; } }
.move { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; }
.arrow-up { color: var(--up); font-weight: 800; }
.arrow-down { color: var(--down); font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Ajustes para móvil y detalles de la hoja */
.sheet td.none .chip { opacity: .35; }
@media (max-width: 600px) {
  .t th, .t td { padding: .5rem .4rem; }
  .t td.name { white-space: normal; }
  .t .name-cell .avatar { display: none; }
  .t .pos { width: 2rem; }
  .block-head { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .t-mensual :is(th, td):nth-child(n+4):nth-child(-n+6), .t-mensual :is(th, td):nth-child(n+8):nth-child(-n+10),
  .t-general :is(th, td):nth-child(3), .t-general :is(th, td):nth-child(n+5):nth-child(-n+7), .t-general :is(th, td):nth-child(9),
  .t-goles :is(th, td):nth-child(3), .t-goles :is(th, td):nth-child(n+5):nth-child(-n+8) { display: none; }
}

/* Renuncia al ascenso */
.badge-ren { background: #E3ECF5; color: var(--court); margin-left: .35rem; }
.t tr.zone-renuncia td.pos { box-shadow: inset 4px 0 0 #9DB5CC; }
.move { flex-wrap: wrap; }

.move .actions { flex-wrap: nowrap; }
.sheet a.chip, .sheet a.chip:hover { color: #fff; }

/* Aviso de versión beta en la portada */
.beta-bar { background: var(--team-a); color: var(--team-a-ink); font-size: .92rem; padding: .55rem 0; }
.beta-tag { display: inline-block; background: var(--ink); color: #fff; font-weight: 700; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; margin-right: .4rem; }

/* ---------- Páginas de contenido ---------- */
.content-page { width: 100%; }
.prose { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: clamp(1.25rem, 4vw, 2.5rem); line-height: 1.7; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { font-size: 1.6rem; margin: 2rem 0 .6rem; }
.prose h3 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
.prose h4 { font-size: 1rem; margin: 1.3rem 0 .4rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1em; }
.prose li { margin-bottom: .3em; }
.prose blockquote { margin: 1.2em 0; padding: .6em 1em; border-left: 4px solid var(--line); color: var(--ink-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.prose th { background: #F7F9FA; }

/* Editor de páginas del panel */
.editor { border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); }
.editor-bar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .4rem; border-bottom: 1px solid var(--line); background: #F7F9FA; position: sticky; top: 0; z-index: 1; }
.editor-bar button { font: 600 .85rem var(--font-body); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .35rem .6rem; cursor: pointer; color: var(--ink); min-width: 2.1rem; }
.editor-bar button:hover { border-color: var(--ink-3); }
.editor-bar button[aria-pressed="true"] { background: var(--court); color: #fff; border-color: var(--court); }
.editor-bar .sep { width: 1px; background: var(--line); margin: 0 .2rem; }
.editor-area { min-height: 420px; padding: 1.2rem 1.4rem; outline: none; }
.editor-area:focus { box-shadow: inset 0 0 0 2px rgba(18,69,107,.25); }
.editor-html { display: none; width: 100%; min-height: 420px; border: 0; font: 400 .85rem/1.5 ui-monospace, Menlo, Consolas, monospace; padding: 1rem; }
.editor.source .editor-area { display: none; }
.editor.source .editor-html { display: block; }
.slug-preview { font-size: .85rem; color: var(--ink-3); word-break: break-all; }

/* Franja de información sobre la cabecera */
.topbar { background: var(--topbar-bg, #0D3452); color: var(--topbar-ink, #fff); font-size: .85rem; line-height: 1.4; padding: .45rem 0; text-align: center; }
.topbar a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.topbar a:hover { color: inherit; opacity: .85; }
@media (max-width: 600px) { .topbar { font-size: .78rem; padding: .4rem 0; } }

/* Usuarios del panel: casillas de secciones */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem 1rem; }
fieldset[hidden] { display: none; }

/* Generales: podio y trofeos */
.t tr.podium-1 td.pos { box-shadow: inset 4px 0 0 var(--gold); color: #9A7410; }
.t tr.podium-2 td.pos { box-shadow: inset 4px 0 0 var(--silver); color: #6B7884; }
.t tr.podium-3 td.pos { box-shadow: inset 4px 0 0 var(--bronze); color: #8E5527; }
.t tr.podium-t td.pos { box-shadow: inset 4px 0 0 var(--trophy); color: #0E7F97; }

[data-door] { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* Panel: filas de enlaces y logos del pie */
.link-rows { display: grid; gap: .4rem; }
.link-row { display: grid; grid-template-columns: 1fr 1.4fr 6.5rem; gap: .5rem; align-items: center; }
.link-head span { font-size: .78rem; font-weight: 600; color: var(--ink-3); }
.link-head span:last-child { text-align: center; }
.sponsor-row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid #EDF0F3; }
.sponsor-row img { height: 48px; width: 120px; object-fit: contain; border-radius: 4px; padding: 4px; }
[data-footer-col][hidden], [data-for-type][hidden] { display: none; }
@media (max-width: 600px) { .link-row { grid-template-columns: 1fr; } .link-head { display: none; } }

/* Medios */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.media-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; display: flex; flex-direction: column; }
.media-card.is-editing { grid-column: span 2; border-color: var(--court); }
@media (max-width: 520px) { .media-card.is-editing { grid-column: auto; } }
.media-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: repeating-conic-gradient(#EEF1F3 0% 25%, #F7F9FA 0% 50%) 0 0 / 16px 16px; text-decoration: none; }
.media-thumb img { width: 100%; height: 100%; object-fit: contain; }
.media-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 12px; background: var(--court); color: #fff; font-size: 1.8rem; font-weight: 800; }
.media-icon small { display: block; font-size: .65rem; font-weight: 700; margin-top: -.6rem; }
.media-icon.doc { background: var(--ink-2); font-size: .95rem; letter-spacing: .02em; }
.media-info { padding: .6rem .75rem 0; display: grid; gap: .15rem; font-size: .85rem; min-width: 0; }
.media-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-info .badge { justify-self: start; margin-top: .2rem; }
.media-actions { display: flex; gap: .4rem; flex-wrap: wrap; padding: .6rem .75rem .75rem; margin-top: auto; }
.media-edit { padding: 0 .75rem .75rem; gap: .6rem; }

/* Medios dentro de las páginas (web pública y editor) */
.prose figure { margin: 1.5rem 0; }
.prose figure.media-img img { display: block; height: auto; border-radius: var(--radius-s); margin-inline: auto; }
.prose figure.img-full img { width: 100%; }
.prose figure.img-half img { width: 50%; }
.prose figure.img-small img { width: 30%; }
@media (max-width: 600px) { .prose figure.img-half img, .prose figure.img-small img { width: 100%; } }
.prose figcaption { font-size: .85rem; color: var(--ink-3); text-align: center; margin-top: .4rem; }
.prose figure.media-video video { display: block; width: 100%; max-height: 70vh; border-radius: var(--radius-s); background: #000; }
.prose figure.media-yt { position: relative; aspect-ratio: 16 / 9; }
.prose figure.media-yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius-s); }
.prose a.doc-link { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: #F7F9FA; text-decoration: none; font-weight: 600; }
.prose a.doc-link::before { content: ""; width: 1rem; height: 1.25rem; flex: none; border-radius: 2px; background: var(--court); clip-path: polygon(0 0, 70% 0, 100% 25%, 100% 100%, 0 100%); }
.prose a.doc-link:hover { border-color: var(--court); }
.editor-area figure { outline: 1px dashed var(--line); outline-offset: 4px; }
.editor-area iframe { pointer-events: none; }

/* Selector de medios del editor */
dialog.picker { width: min(920px, 94vw); max-height: 88vh; border: 0; border-radius: var(--radius-m); padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.picker::backdrop { background: rgba(22,33,43,.55); }
dialog.picker[open] { display: flex; flex-direction: column; }
.picker-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.picker-head h2 { margin: 0; font-size: 1.5rem; }
.picker-tools { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); }
.picker-tools input { max-width: 240px; }
.picker-upload { position: relative; }
.picker-msg { font-size: .85rem; color: var(--ink-2); }
.picker-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; padding: 1rem 1.25rem; min-height: 200px; align-content: start; }
.picker-item { display: grid; gap: .25rem; justify-items: center; background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius-m); padding: .5rem; cursor: pointer; font: inherit; text-align: center; }
.picker-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--wall); border-radius: var(--radius-s); }
.picker-item .media-icon { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: var(--radius-s); }
.picker-item[aria-pressed="true"] { border-color: var(--court); box-shadow: 0 0 0 3px rgba(18,69,107,.2); }
.picker-name { font-weight: 600; font-size: .82rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-meta { font-size: .75rem; color: var(--ink-3); }
.picker-empty { grid-column: 1 / -1; color: var(--ink-2); }
.picker-foot { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-top: 1px solid var(--line); background: #F7F9FA; }
.picker-opts { display: flex; gap: 1rem; flex-wrap: wrap; }
.picker-opts label { display: grid; gap: .25rem; font-weight: 600; font-size: .85rem; color: var(--ink-2); }
.picker-opts[hidden] { display: none; }

/* Panel: árbol del menú */
.menu-tree { list-style: none; margin: 0; padding: 0; }
.menu-tree .menu-tree { margin-left: 1.6rem; border-left: 2px solid var(--line); padding-left: .8rem; }
.menu-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: #F7F9FA; margin: .35rem 0; flex-wrap: wrap; }
.menu-row.is-editing { border-color: var(--court); background: #EAF1F7; }
.menu-row-main { display: grid; gap: .1rem; min-width: 0; }
.menu-row-main .muted { font-size: .82rem; color: var(--ink-3); overflow-wrap: anywhere; }
label[data-menu-target][hidden] { display: none; }

/* Hoja de control: filas de resultados por categoría */
.sheet tr.res-row th, .sheet tr.res-row td { background: #EEF2F6; border-bottom: 1px solid var(--line); font-size: .85rem; position: static; }
.sheet tr.res-row th.sticky { position: sticky; left: 0; z-index: 1; color: var(--court); font-weight: 800; font-family: var(--font-display); font-size: 1rem; }
.sheet tr.res-last th, .sheet tr.res-last td { border-bottom: 2px solid var(--ink); }
.sheet td.res { text-align: center; padding: .35rem .25rem; white-space: nowrap; }
.sheet td.res a { color: var(--ink); font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.sheet td.res a:hover { color: var(--court); text-decoration: underline; }

/* Logros (panel) */
[data-ach-metric][hidden], [data-ach-minpj][hidden], [data-ach-rule][hidden] { display: none; }
.ach-rule { display: grid; gap: .9rem; padding: 1rem; border: 1px dashed var(--line); border-radius: var(--radius-m); background: #F7F9FA; }

/* Página de logros */
.ach-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.ach-item { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1.1rem; display: grid; gap: .8rem; align-content: start; }
.ach-item.is-empty { background: #F7F9FA; }
.ach-item.is-empty .ach-item-icon { filter: grayscale(1); opacity: .55; }
.ach-item-head { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: start; }
.ach-item-icon { font-size: 2rem; line-height: 1; }
.ach-item h3 { margin: 0 0 .2rem; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; }
.ach-item-head p { margin: 0; color: var(--ink-2); font-size: .9rem; }
.ach-count { font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; color: var(--court); min-width: 2ch; text-align: right; }
.ach-holders { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.ach-holders a { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem .2rem .2rem; border-radius: 999px; background: var(--wall); color: var(--ink); text-decoration: none; font-size: .82rem; font-weight: 600; }
.ach-holders a:hover { background: #E1E7EC; }
.ach-holders b { color: var(--court); }
.ach-none { margin: 0; color: var(--ink-3); font-size: .88rem; }
.ach-top { max-width: 520px; }
.ach-more summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--court); }
.ach-more[open] summary { margin-bottom: .4rem; }

/* Panel: barra superior con la cuenta */
.admin-content { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #C2CBD3; display: flex; justify-content: flex-end; align-items: center; gap: .5rem 1.5rem; flex-wrap: wrap; padding: .6rem clamp(1rem, 3vw, 2.5rem); min-height: 52px; font-size: .88rem; border-left: 1px solid rgba(255,255,255,.08); }
.topbar-user strong { color: #fff; }
.topbar-role { display: inline-block; margin-left: .3rem; padding: .1rem .5rem; border-radius: 999px; background: rgba(255,255,255,.1); color: #DCE7F0; font-size: .75rem; font-weight: 600; }
.topbar-links { display: flex; align-items: center; gap: .25rem; }
.topbar-links a, .topbar-logout { color: #C2CBD3; text-decoration: none; padding: .4rem .65rem; border-radius: var(--radius-s); font: 500 .88rem var(--font-body); background: none; border: 0; cursor: pointer; }
.topbar-links a:hover, .topbar-logout:hover { color: #fff; background: rgba(255,255,255,.08); }
.topbar-links a[aria-current] { color: #fff; background: var(--court); }
.topbar-logout { border: 1px solid rgba(255,255,255,.25); }
@media (max-width: 900px) { .admin-topbar { position: static; justify-content: space-between; border-left: 0; border-top: 1px solid rgba(255,255,255,.08); } }

/* Panel: visibilidad de los datos de la ficha */
.vis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.vis-item { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .55rem .7rem; display: grid; gap: .2rem; background: #F7F9FA; }
.vis-item.vis-blocked { border-color: #E8B4A8; background: #FDF1EE; }
.vis-note { font-size: .8rem; color: var(--ink-3); }
.vis-blocked .vis-note { color: #9C2F28; font-weight: 600; }
.vis-note.ok { color: #1F6E3F; }

/* Avisos flotantes (web pública) */
.toasts { position: fixed; top: 7rem; right: 1rem; z-index: 100; display: grid; gap: .5rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .75rem; background: var(--paper); color: var(--ink); border-radius: var(--radius-m); border-left: 5px solid var(--court); box-shadow: 0 10px 30px rgba(13,52,82,.25); padding: .8rem .8rem .8rem 1rem; font-size: .95rem; animation: toast-in .25s ease-out; }
.toast span { flex: 1; }
.toast-ok { border-left-color: var(--win); }
.toast-error { border-left-color: var(--loss); }
.toast-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 0 .2rem; }
.toast-close:hover { color: var(--ink); }
.toast-out { opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .toasts { top: auto; bottom: 1rem; right: 1rem; left: 1rem; width: auto; } }

/* Portada por bloques */
.home-subgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 1.5rem; }
.home-block { min-width: 0; }
.home-results .home-scores { display: flex; gap: .4rem 1rem; flex-wrap: wrap; justify-content: flex-end; }
.home-results .home-scores a { text-decoration: none; color: var(--ink); white-space: nowrap; }
.home-results .home-scores a:hover b { color: var(--court); text-decoration: underline; }
.home-results small { color: var(--ink-3); }
.home-results b { font-family: var(--font-display); font-size: 1.25rem; }
.home-ach-ic { font-size: 1.4rem; width: 2rem; text-align: center; }
.list li.is-today { background: #FFF8DE; }
.home-text { padding: clamp(1rem, 3vw, 1.75rem); }
.home-image { margin: 0; }
.home-image img { width: 100%; height: auto; border-radius: var(--radius-m); display: block; }
.home-button { padding: .5rem 0; }
.btn-big { font-size: 1.15rem; padding: 1rem 2rem; }
.home-sponsors { list-style: none; margin: 0; padding: 1.25rem; display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; justify-content: center; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); }
.home-sponsors img { max-height: 64px; max-width: 180px; width: auto; height: auto; }

/* Panel: bloques de portada */
.home-blocks-admin { display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; }
.hb-row { grid-column: span 6; display: flex; flex-direction: column; gap: .6rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-s, 6px); background: var(--paper); }
.hb-half { grid-column: span 3; } .hb-third { grid-column: span 2; }
.hb-row.is-off { opacity: .55; border-style: dashed; }
.hb-row.is-editing { border-color: var(--court); box-shadow: 0 0 0 2px var(--court); }
.hb-main { display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: baseline; }
.hb-main .muted { font-size: .88rem; }
.hb-row .actions { flex-wrap: wrap !important; gap: .35rem; }
@media (max-width: 900px) { .hb-half, .hb-third { grid-column: span 6; } }
.block-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; }
.form .block-type { display: flex; grid-template-columns: none; text-align: left; color: var(--ink); font-size: .95rem; gap: .6rem; align-items: flex-start; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-weight: 400; }
.block-type:has(input:checked) { border-color: var(--court); background: #EEF4FF; }
.block-type input { margin-top: .25rem; width: auto; }
.block-type span { display: flex; flex-direction: column; gap: .2rem; }
.block-type small { color: var(--ink-3); font-size: .82rem; line-height: 1.35; }

/* Resumen: acceso rápido a la jornada */
.quick-day { border-left: 4px solid var(--court); }
.quick-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.quick-head h2 { margin: 0 0 .2rem; }
.quick-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }
.quick-cat { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.quick-cat-name { font-weight: 700; font-size: 1.05rem; margin-right: auto; }
.quick-cat.is-done { background: #F1F8F3; border-color: #BFE3CB; }
.quick-score { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; line-height: 1; }

/* Seguridad */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 1.25rem; align-items: start; }
.account-grid > .panel { margin-bottom: 0; }
.account-grid + .panel, .account-grid + form { margin-top: 1.25rem; }
.qr-box { margin: .75rem 0; display: block; width: fit-content; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.qr-box svg { display: block; width: 220px; height: 220px; }
.secret-key { display: inline-block; margin: .4rem 0; padding: .4rem .7rem; font-size: 1.05rem; letter-spacing: .08em; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; word-break: break-all; }
.steps-2fa { padding-left: 1.3rem; line-height: 1.55; }
.steps-2fa li { margin-bottom: .6rem; }
.recovery-box { border-left: 4px solid var(--court); }
.recovery-codes { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.recovery-codes li { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.1rem; padding: .5rem .7rem; background: var(--paper); border: 1px dashed var(--line); border-radius: 4px; text-align: center; }
.t tr.log-bad td { background: #FDF1F0; }

/* Versión de la web en la barra del panel */
.admin-side { display: flex; flex-direction: column; }
.admin-side .side-version { margin-top: auto; padding: 1rem .7rem 0; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: .1rem; font-size: .78rem; color: #8D99A5; text-decoration: none; font-variant-numeric: tabular-nums; }
.admin-side .side-version:hover, .admin-side .side-version[aria-current] { color: #fff; }
.admin-side nav { margin-bottom: 1.5rem; }
@media (max-width: 900px) { .admin-side { display: block; } .admin-side nav:not(.open) ~ .side-version { display: none; } .admin-side .side-version { margin-top: 1rem; } }
/* Novedades */
.changelog { list-style: none; margin: 0; padding: 0; }
.changelog > li { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.changelog > li:first-child { border-top: 0; padding-top: 0; }
.changelog .cl-ver { font-weight: 700; font-size: 1.05rem; }
.changelog .cl-date { display: block; color: var(--ink-3); font-size: .85rem; font-weight: 400; }
.changelog ul { margin: 0; padding-left: 1.1rem; line-height: 1.5; }
.changelog .is-current .cl-ver { color: var(--court); }
@media (max-width: 600px) { .changelog > li { grid-template-columns: 1fr; gap: .3rem; } }

/* Resumen del panel */
.todo-panel { border-left: 4px solid #E0A100; }
.todo-panel.is-clear { border-left-color: #2E9E5B; }
.todo-panel h2 { margin-top: 0; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.todo-list li:first-child { border-top: 0; padding-top: 0; }
.todo-list .btn { flex-shrink: 0; }
.todo-birthday { margin: 0 0 .75rem; padding: .6rem .8rem; background: #FFF8DE; border-radius: 6px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.dash-grid > .panel { margin-bottom: 0; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-grid .block-head h2 { margin: 0; }
.dash-sub { font-size: .8rem; font-weight: 700; color: var(--ink-3); margin: 1rem 0 .3rem; }
.dash-total { margin: 1rem 0 0; padding-top: .75rem; border-top: 1px solid var(--line); }
.dash-kpi { margin: 0 0 .5rem; font-size: 1.05rem; }
.dash-kpi strong { font-size: 1.6rem; }
.month-cat { padding: .7rem 0; border-top: 1px solid var(--line); }
.month-cat:first-of-type { border-top: 0; }
.month-cat h3 { margin: 0 0 .35rem; font-size: 1rem; }
.month-cat p { margin: .2rem 0; line-height: 1.45; }
.mc-label { display: inline-block; min-width: 4.6rem; font-size: .78rem; font-weight: 700; color: var(--ink-3); }
.mc-label.mc-up { color: #1E7A45; }
.mc-label.mc-down { color: #B3261E; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: .7rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--line); }
.activity li:first-child { border-top: 0; }
.act-type { flex-shrink: 0; width: 4.2rem; font-size: .72rem; font-weight: 700; text-align: center; padding: .15rem 0; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-3); }
.act-logro { background: #FFF8DE; border-color: #F0DB9A; color: #7A5B00; }
.act-cuenta { background: #EEF4FF; border-color: #C7D8F5; color: #1D4E9E; }
.activity small { white-space: nowrap; }
details.how-to > summary { cursor: pointer; list-style: none; }
details.how-to > summary::-webkit-details-marker { display: none; }
details.how-to > summary h2 { display: inline; margin: 0; font-size: 1.1rem; }
details.how-to > summary::after { content: " (pulsa para ver)"; color: var(--ink-3); font-size: .85rem; }
details.how-to[open] > summary::after { content: ""; }
details.how-to[open] > summary { margin-bottom: .75rem; }

/* Mantenimiento */
.alert-warn { background: #FFF6DB; border: 1px solid #F0D58A; color: #5C4500; }
.maintenance-alert { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.maintenance-strip { background: #E0A100; color: #1B1500; text-align: center; padding: .45rem 1rem; font-size: .9rem; font-weight: 600; }
.maintenance-strip a { color: inherit; text-decoration: underline; }
.maintenance-panel.is-on { border-left: 4px solid #E0A100; }
.maintenance-page { min-height: 100vh; display: grid; place-items: center; background: var(--paper, #F4F5F2); margin: 0; padding: 1.5rem; }
.maintenance-box { max-width: 520px; text-align: center; background: #fff; border: 1px solid var(--line, #ddd); border-radius: 10px; padding: clamp(1.5rem, 5vw, 3rem); }
.maintenance-box h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 .75rem; line-height: 1.05; }
.maintenance-box p { line-height: 1.55; }
.maintenance-logo { max-height: 72px; width: auto; margin-bottom: 1rem; }

/* Viernes sin liga */
.no-play-notice { background: #FFF6DB; border-bottom: 1px solid #F0D58A; color: #5C4500; padding: .7rem 0; font-size: 1rem; }
.list li.is-past { opacity: .6; }

/* Cuotas */
.fee-summary { margin: .25rem 0 .6rem; }
.fee-bar { height: 10px; background: var(--paper, #eee); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.fee-bar span { display: block; height: 100%; background: #2E9E5B; border-radius: 999px; }
.badge.fee-pagada { background: #E3F4EA; color: #1E7A45; border-color: #BFE3CB; }
.badge.fee-parcial { background: #FFF6DB; color: #7A5B00; border-color: #F0D58A; }
.badge.fee-pendiente { background: #FDECEA; color: #B3261E; border-color: #F3C3BE; }
.badge.fee-exento { color: var(--ink-3); }
.t tr.is-selected td { background: #EEF4FF; }
.fee-box h3 { margin-top: 0; }
.fee-state { margin: 0 0 .3rem; }
.fee-state.fee-pagada { color: #1E7A45; font-weight: 700; }
.fee-dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: .6rem 0; }
.fee-dl dt { color: var(--ink-3); }
.fee-dl dd { margin: 0; font-weight: 700; text-align: right; }
.fee-payments { list-style: none; padding: 0; margin: .5rem 0; }
.fee-payments li { display: flex; justify-content: space-between; padding: .3rem 0; border-top: 1px solid var(--line); }
.fee-box details summary { cursor: pointer; color: var(--court); font-size: .92rem; }

/* Notas y textos */
.badge-note { background: #EEF4FF; color: #1D4E9E; border-color: #C7D8F5; cursor: help; }
.texts-form .text-item { padding: .9rem 0; border-top: 1px solid var(--line); }
.texts-form .text-item:first-of-type { border-top: 0; padding-top: 0; }
.texts-form .text-item label { display: block; font-weight: 600; margin-bottom: .35rem; }
.text-reset { margin-top: .35rem; color: var(--court); text-decoration: underline; font-size: .85rem; padding: 0; }

/* Comunicados */
.announcement-list summary { cursor: pointer; }
.announcement-body { margin: .6rem 0 .2rem; padding: .8rem 1rem; background: var(--paper); border-radius: 6px; line-height: 1.5; }
.announcement-list li { display: block; }

/* =========================================================
   Panel: modo noche (html[data-mode="dark"])
   ========================================================= */
html[data-mode="dark"] { color-scheme: dark; }
html[data-mode="dark"] .admin-body {
  --wall: #26323C; --paper: #1B2732; --ink: #E4EAF0; --ink-2: #B7C2CC; --ink-3: #8C99A6; --line: #33414E;
  --court: #6AA7DA; --court-2: #8BBCE4; --absent: #2C3842; --parquet-soft: #3A3024;
  --win: #43B474; --up: #43B474; --loss: #E4675F; --down: #E4675F;
  background: #121A21; color: var(--ink);
}
html[data-mode="dark"] .admin-body .admin-side,
html[data-mode="dark"] .admin-body .admin-topbar { background: #0B1116; }
html[data-mode="dark"] .admin-body .admin-side nav a[aria-current],
html[data-mode="dark"] .admin-body .tabs a[aria-current],
html[data-mode="dark"] .admin-body .btn-primary { background: #2D6A9C; border-color: #2D6A9C; color: #fff; }
html[data-mode="dark"] .admin-body .btn-primary:hover { background: #3A7DB3; border-color: #3A7DB3; }
html[data-mode="dark"] .admin-body .btn { background: #22303B; color: var(--ink); }
html[data-mode="dark"] .admin-body .btn-danger { color: #F08A83; }
html[data-mode="dark"] .admin-body .btn-danger:hover { background: #C0392F; color: #fff; }
html[data-mode="dark"] .admin-body .btn-primary { background: #2D6A9C; }
html[data-mode="dark"] .admin-body .alert { background: #1F2B36; }
html[data-mode="dark"] .admin-body input:focus, html[data-mode="dark"] .admin-body select:focus, html[data-mode="dark"] .admin-body textarea:focus { outline-color: rgba(106,167,218,.35); }
html[data-mode="dark"] .admin-body input::placeholder, html[data-mode="dark"] .admin-body textarea::placeholder { color: #6E7C89; }
html[data-mode="dark"] .admin-body .media-icon.doc { background: #3B4A57; }
html[data-mode="dark"] .admin-body .kpi .v { color: var(--ink); }
html[data-mode="dark"] .admin-body [contenteditable] { background: var(--paper); color: var(--ink); }
html[data-mode="dark"] .admin-body img { filter: none; }
html[data-mode="dark"] .admin-body .qr-box { background: #fff; }
html[data-mode="dark"] .admin-body .secret-key, html[data-mode="dark"] .admin-body .recovery-codes li { background: #22303B; }
html[data-mode="dark"] .admin-body .fee-bar span { background: #43B474; }
html[data-mode="dark"] .admin-body dialog { background: var(--paper); color: var(--ink); }
/* Botón día / noche de la barra de arriba */
.theme-toggle { display: inline-flex; align-items: center; gap: .4rem; background: transparent; border: 1px solid rgba(255,255,255,.25); color: #C2CBD3; border-radius: 999px; padding: .3rem .7rem; font: 600 .82rem var(--font-body); cursor: pointer; }
.theme-toggle:hover { color: #fff; border-color: rgba(255,255,255,.55); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .i-sun { display: none; }
html[data-mode="dark"] .theme-toggle .i-sun { display: block; }
html[data-mode="dark"] .theme-toggle .i-moon { display: none; }
/* Colores fijos adaptados al modo noche (generados a partir de los de día) */
html[data-mode="dark"] .admin-body .f-sponsors { border-bottom: 1px solid color-mix(in srgb, var(--f-ink, #404D59) 20%, transparent); }
html[data-mode="dark"] .admin-body .f-bottom { border-top: 1px solid color-mix(in srgb, var(--f-ink, #404D59) 20%, transparent); }
html[data-mode="dark"] .admin-body .btn-danger { border-color: #6B322E; }
html[data-mode="dark"] .admin-body .btn-on-dark:hover { background: #242F39; border-color: #33414E; }
html[data-mode="dark"] .admin-body .t th { background: #24323C; }
html[data-mode="dark"] .admin-body .t td { border-bottom: 1px solid #3D4C5C; }
html[data-mode="dark"] .admin-body .t tbody tr:hover td { background: #23333D; }
html[data-mode="dark"] .admin-body .t tr.me td { background: #393827; }
html[data-mode="dark"] .admin-body .list li { border-bottom: 1px solid #3D4C5C; }
html[data-mode="dark"] .admin-body .prize-head { border: 1px solid #6B512E; }
html[data-mode="dark"] .admin-body .streak-bar i { background: #25303B; }
html[data-mode="dark"] .admin-body .money { color: #EABB85; }
html[data-mode="dark"] .admin-body .match-mid { background: #24323C; }
html[data-mode="dark"] .admin-body .stat { border-right: 1px solid #3D4C5C; border-bottom: 1px solid #3D4C5C; }
html[data-mode="dark"] .admin-body .comments { border-top: 1px solid #3D4C5C; }
html[data-mode="dark"] .admin-body { background: #25313A; }
html[data-mode="dark"] .admin-body .badge-gk { background: #392237; }
html[data-mode="dark"] .admin-body .badge-ok { background: #1D3E32; color: #88E7AF; }
html[data-mode="dark"] .admin-body .badge-off { background: #392427; color: #E98C86; }
html[data-mode="dark"] .admin-body .pick { background: #24323C; }
html[data-mode="dark"] .admin-body .pick.is-a { background: color-mix(in srgb, var(--team-a) 18%, #242F39); }
html[data-mode="dark"] .admin-body .pick.is-b { background: color-mix(in srgb, var(--team-b) 14%, #242F39); }
html[data-mode="dark"] .admin-body .badge-ren { background: #1D3043; }
html[data-mode="dark"] .admin-body .prose th { background: #24323C; }
html[data-mode="dark"] .admin-body .editor-bar { background: #24323C; }
html[data-mode="dark"] .admin-body .t tr.podium-3 td.pos { color: #E7B288; }
html[data-mode="dark"] .admin-body .t tr.podium-t td.pos { color: #82DAED; }
html[data-mode="dark"] .admin-body .sponsor-row { border-bottom: 1px solid #3D4C5C; }
html[data-mode="dark"] .admin-body .media-thumb { background: repeating-conic-gradient(#26313A 0% 25%, #24323C 0% 50%) 0 0 / 16px 16px; }
html[data-mode="dark"] .admin-body .prose a.doc-link { background: #24323C; }
html[data-mode="dark"] .admin-body .picker-foot { background: #24323C; }
html[data-mode="dark"] .admin-body .menu-row { background: #24323C; }
html[data-mode="dark"] .admin-body .menu-row.is-editing { background: #1D3143; }
html[data-mode="dark"] .admin-body .ach-rule { background: #24323C; }
html[data-mode="dark"] .admin-body .ach-item.is-empty { background: #24323C; }
html[data-mode="dark"] .admin-body .ach-holders a:hover { background: #24313C; }
html[data-mode="dark"] .admin-body .vis-item { background: #24323C; }
html[data-mode="dark"] .admin-body .vis-item.vis-blocked { background: #392827; }
html[data-mode="dark"] .admin-body .vis-blocked .vis-note { color: #E98C86; }
html[data-mode="dark"] .admin-body .vis-note.ok { color: #88E7AF; }
html[data-mode="dark"] .admin-body .list li.is-today { background: #393827; }
html[data-mode="dark"] .admin-body .block-type:has(input:checked) { background: #1D2C43; }
html[data-mode="dark"] .admin-body .quick-cat.is-done { background: #213A30; border-color: #2F6A43; }
html[data-mode="dark"] .admin-body .t tr.log-bad td { background: #392427; }
html[data-mode="dark"] .admin-body .todo-birthday { background: #393827; }
html[data-mode="dark"] .admin-body .mc-label.mc-up { color: #85EAB0; }
html[data-mode="dark"] .admin-body .mc-label.mc-down { color: #ED8882; }
html[data-mode="dark"] .admin-body .act-logro { background: #393827; border-color: #6B5C2E; color: #EDD282; }
html[data-mode="dark"] .admin-body .act-cuenta { background: #1D2C43; border-color: #2E456B; color: #82ABED; }
html[data-mode="dark"] .admin-body .alert-warn { background: #393727; border: 1px solid #6B5B2E; color: #EDD282; }
html[data-mode="dark"] .admin-body .no-play-notice { background: #393727; border-bottom: 1px solid #6B5B2E; color: #EDD282; }
html[data-mode="dark"] .admin-body .fee-bar { background: var(--paper, #2D3741); }
html[data-mode="dark"] .admin-body .badge.fee-pagada { background: #1E3D33; border-color: #2F6A43; }
html[data-mode="dark"] .admin-body .badge.fee-parcial { background: #393727; border-color: #6B5B2E; }
html[data-mode="dark"] .admin-body .badge.fee-pendiente { background: #392527; border-color: #6B342E; }
html[data-mode="dark"] .admin-body .t tr.is-selected td { background: #1D2C43; }
html[data-mode="dark"] .admin-body .badge-note { background: #1D2C43; color: #82ABED; border-color: #2E456B; }

.theme-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
html[data-mode="dark"] .admin-body .sticky-save { background: rgba(18,26,33,.95); }
html[data-mode="dark"] .admin-body .topbar-links a[aria-current] { background: #2D6A9C; }

/* Calendario (panel) */
.cal-legend { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 1rem; }
.cal-pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; border: 1px solid transparent; vertical-align: middle; font-family: var(--font-body); }
.cal-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.cal-months .panel { margin: 0; }
.cal-month h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
.cal-days { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.cal-day { display: flex; gap: .7rem; align-items: center; padding: .45rem .6rem; border-radius: 6px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.cal-day:hover { border-color: var(--ink-3); }
.cal-day.is-selected { outline: 2px solid var(--court); outline-offset: 1px; }
.cal-num { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; width: 2rem; text-align: center; }
.cal-info { display: flex; flex-direction: column; font-size: .85rem; line-height: 1.3; }
.cal-info b { font-variant-numeric: tabular-nums; }
.cal-jugado { background: #E9F6EE; border-color: #BFE3CB; color: #1E5F39; }
.cal-sin_liga { background: #FFF6DB; border-color: #F0D58A; color: #6B5000; }
.cal-sin_apuntar { background: #FDECEA; border-color: #F3C3BE; color: #A1251E; }
.cal-proximo { background: #EEF4FF; border-color: var(--court); color: #12456B; box-shadow: inset 3px 0 0 var(--court); }
.cal-por_jugar { background: var(--paper); color: var(--ink-2); }
.cal-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.cal-noplay { display: flex; gap: .5rem; flex: 1 1 380px; }
.cal-noplay input { flex: 1; }
html[data-mode="dark"] .admin-body .cal-jugado { background: #1E3A2C; border-color: #2F6A43; color: #9BE2B5; }
html[data-mode="dark"] .admin-body .cal-sin_liga { background: #3A3424; border-color: #6B5B2E; color: #EDD282; }
html[data-mode="dark"] .admin-body .cal-sin_apuntar { background: #3E2426; border-color: #7A3530; color: #F2A39D; }
html[data-mode="dark"] .admin-body .cal-proximo { background: #1D2C43; color: #A9CCF0; }

/* Calendario público */
.pcal-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.pcal-month h2 { font-size: 1.5rem; margin: 0 0 .6rem; }
.pcal-days { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.pcal-day { display: flex; gap: .8rem; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .55rem .75rem; }
.pcal-date { display: flex; flex-direction: column; align-items: center; width: 2.6rem; line-height: 1; }
.pcal-date b { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.pcal-date small { font-size: .72rem; color: var(--ink-3); }
.pcal-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.pcal-state { font-weight: 600; font-size: .92rem; }
.pcal-scores { display: flex; gap: .3rem .9rem; flex-wrap: wrap; font-size: .88rem; }
.pcal-scores a { color: var(--ink-2); text-decoration: none; }
.pcal-scores a:hover { color: var(--court); text-decoration: underline; }
.pcal-jugado { box-shadow: inset 4px 0 0 var(--win); }
.pcal-jugado .pcal-state { color: var(--ink-3); }
.pcal-sin_liga { background: #FFF6DB; border-color: #F0D58A; }
.pcal-sin_liga .pcal-state { color: #6B5000; }
.pcal-proximo { border-color: var(--court); box-shadow: inset 4px 0 0 var(--court); }
.pcal-proximo .pcal-state { color: var(--court); }
.pcal-por_jugar .pcal-state { color: var(--ink-2); font-weight: 500; }
.pcal-sin_apuntar .pcal-state { color: var(--ink-3); font-weight: 500; }
.cal-jor { font-weight: 700; font-size: .78rem; opacity: .85; }
.pcal-jor { font-weight: 700; color: var(--ink); }
/* Jornadas junto a las fechas */
.day h2 .day-date { font-weight: 500; color: var(--ink-3); font-size: .75em; }
.t.sheet th.d .jn { font-weight: 800; color: var(--ink); font-size: .8rem; }

/* Actualizaciones */
.update-versions { font-size: 1.15rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.update-files { list-style: none; padding: 0; margin: .5rem 0; columns: 2 260px; font-size: .88rem; }
.update-files li { padding: .15rem 0; }
.rescue-key { font: 700 1.6rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; background: var(--paper); border: 1px dashed var(--line); border-radius: 6px; padding: .7rem 1rem; display: inline-block; }
.keep-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0 .5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.keep-form label { font-weight: 600; margin: 0; }

/* Menú del panel: ordenar arrastrando */
.sort-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .4rem; max-width: 560px; }
.sort-item { display: flex; align-items: center; gap: .75rem; padding: .55rem .7rem; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; cursor: grab; user-select: none; }
.sort-item.is-fixed { cursor: default; }
.sort-item.is-fixed .sort-handle, .sort-item.is-fixed .sort-note { opacity: .7; }
.sort-item.is-dragging { opacity: .45; border-style: dashed; border-color: var(--court); }
.sort-handle { color: var(--ink-3); font-weight: 700; letter-spacing: -.1em; width: 1.2rem; text-align: center; }
.sort-name { flex: 1; font-weight: 600; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.sort-input { user-select: text; font: inherit; font-weight: 600; padding: .3rem .5rem; border: 1px solid transparent; border-radius: 4px; background: transparent; color: inherit; width: 100%; cursor: text; }
.sort-input:hover { border-color: var(--line); }
.sort-input:focus { border-color: var(--court); background: var(--paper); outline: 2px solid transparent; box-shadow: 0 0 0 2px color-mix(in srgb, var(--court) 25%, transparent); }
.sort-default { font-size: .8rem; font-weight: 400; color: var(--ink-3); padding-left: .5rem; }
.sort-note { font-size: .85rem; }
.sort-btns { display: flex; gap: .3rem; }
.sort-btns .btn { padding: .2rem .55rem; line-height: 1.2; }
.sort-btns .btn:disabled { opacity: .35; cursor: default; }

/* Cuotas: pagos desde la tabla */
.fee-batch-top { display: flex; gap: 1rem 1.5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .9rem; }
.fee-batch-top label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9rem; }
.fee-batch-top input[type=date] { width: auto; }
.fee-batch-top .table-note { flex: 1 1 320px; }
.fee-pay-in { display: inline-flex; gap: .35rem; align-items: center; }
.fee-pay-in input { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.fee-note { width: 11rem; min-width: 8rem; }
.fee-err { display: block; color: #B3261E; font-size: .78rem; min-height: 0; }
.fee-err:empty { display: none; }
.fee-table tr.has-pay td { background: #F1F8F3; }
.fee-table tr.has-error td { background: #FDF1F0; }
.fee-table tr.has-error .fee-pay input { border-color: #B3261E; }
.fee-savebar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .75rem 1rem; margin: 1rem -1rem -1rem; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); z-index: 5; }
.fee-sum { font-weight: 700; }
html[data-mode="dark"] .admin-body .fee-savebar { background: rgba(27,39,50,.96); }
html[data-mode="dark"] .admin-body .fee-table tr.has-pay td { background: #1E3A2C; }
html[data-mode="dark"] .admin-body .fee-table tr.has-error td { background: #3E2426; }
html[data-mode="dark"] .admin-body .fee-err { color: #F2A39D; }

/* ---------- Premio mensual ---------- */
.switch-panel { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.tie-box { border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; margin-top: .8rem; }
.tie-box h3 { margin: 0 0 .6rem; font-size: 1rem; }
.tie-rows { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; margin-bottom: .6rem; }
.tie-rows label { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.tie-rows select { width: auto; }
.prize-list { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .3rem; }
.prize-list .pp { display: inline-block; min-width: 2rem; font-weight: 800; color: var(--parquet); }
.mprize-month { margin-bottom: 1.25rem; }
.mprize-month h2 { margin: 0 0 .6rem; }
.mprize-podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
.mprize-card { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.mprize-card .pp { font-family: var(--font-display); font-size: 1.6rem; font-weight: 900; color: var(--parquet); min-width: 2.2rem; }
.mprize-card .who { flex: 1; min-width: 0; }
.mprize-card .who a, .mprize-card .who strong { display: block; font-weight: 700; }
.mprize-card .amt { font-weight: 800; white-space: nowrap; }
.mprize-card.is-prov { border-style: dashed; }

/* ---------- Calendario: días añadidos y objetivo ---------- */
.cal-extra-tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 0 .35rem; border-radius: 3px; background: var(--court); color: #fff; vertical-align: middle; }
.cal-edit { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin: 0 0 1rem; }
.cal-edit label { display: grid; gap: .2rem; font-size: .85rem; font-weight: 600; margin: 0; }
.cal-edit label.grow { flex: 1; min-width: 220px; }
.cal-target { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; border-left: 6px solid var(--draw); }
.cal-target.is-ok { border-left-color: var(--win); }
.cal-target.is-off { border-left-color: var(--parquet); }
.cal-target-num { font-size: 1.1rem; white-space: nowrap; }
.cal-target-num strong { font-family: var(--font-display); font-size: 2.6rem; font-weight: 900; line-height: 1; }
.cal-target-txt { flex: 1; min-width: 220px; }
.cal-target-form { display: flex; align-items: end; gap: .5rem; }
.cal-target-form label { display: grid; gap: .2rem; font-size: .8rem; font-weight: 600; }
.cal-target-form input { width: 5rem; }
.alert-warn-panel { border-left: 6px solid var(--parquet); }
.no-play-notice.is-extra { background: var(--court); color: #fff; }

/* ---------- Vista previa de correos ---------- */
.mail-preview { background: #EEF2F5; border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 1.25rem; }
.mail-preview iframe { display: block; width: 100%; height: 820px; border: 0; background: #EEF2F5; }
.mail-preview-head .tabs { margin-bottom: .4rem !important; }
