/* ═══════════════════════════════════════════════════════════════════════════
   POT — styles
   Design tokens del handoff original (oklch dark theme + Oswald/Inter).
   Mobile-first: layout base para ~375px, expande a desktop >= 720px.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Paleta por lugar (1º-6º) — visual quick-read del ranking */
  --place-1: #e0a83c;   /* amarillo — 1º */
  --place-2: #5f9fe0;   /* azul — 2º */
  --place-3: #e0685f;   /* rojo — 3º */
  --place-4: #5fbf8f;   /* verde — 4º */
  --place-5: #a879e0;   /* morado — 5º */
  --place-6: #f0996a;   /* naranja — 6º (backup) */

  --bg-deep:    oklch(0.13 0.02 250);
  --bg-body:    oklch(0.15 0.02 250);
  --bg-card:    oklch(0.19 0.02 250);
  --bg-input:   oklch(0.15 0.02 250);
  --border:     oklch(1 0 0 / 0.08);
  --border-str: oklch(1 0 0 / 0.15);
  --text:       oklch(0.95 0.01 90);
  --text-mid:   oklch(0.65 0.02 250);
  --text-mute:  oklch(0.55 0.02 250);
  --accent:     #e0a83c;
  --accent-soft: rgba(224,168,60,0.15);
  --pos:        #5fbf8f;
  --neg:        #e0685f;
  --info:       #5f9fe0;
  --danger:     #e0685f;
  --radius:     10px;
  --radius-lg:  14px;
}

* { box-sizing: border-box; }
[v-cloak] { display: none; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-body);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: oklch(0.35 0.02 250); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

button {
  font: inherit;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  transition: background 0.15s, border-color 0.15s;
  min-height: 40px;
}
button:hover:not(:disabled) { background: oklch(0.22 0.02 250); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.danger { color: var(--danger); }
button.p-btn-primary {
  background: var(--accent);
  color: #241f16;
  font-weight: 600;
  border-color: transparent;
}
button.p-btn-primary:hover:not(:disabled) { background: oklch(from var(--accent) calc(l - 0.05) c h); }

input, select {
  font: inherit;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-str);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 40px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input[type=number]::-webkit-inner-spin-button { opacity: 0.6; }
input[type=checkbox] { width: 20px; height: 20px; min-height: auto; accent-color: var(--accent); }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
label input, label select { font-size: 14px; text-transform: none; letter-spacing: normal; font-weight: 400; color: var(--text); }
label.p-inline { flex-direction: row; align-items: center; text-transform: none; letter-spacing: normal; color: var(--text); }

small.p-muted, .p-muted { color: var(--text-mute); font-weight: 400; font-size: 12px; }

/* ─── Header ───────────────────────────────────────────────────────────── */
.p-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-deep);
  flex-wrap: wrap;
}
.p-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.p-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 1px;
  color: var(--accent);
}

/* Selector de liga siempre visible en el header */
.p-league-picker select {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.4px;
  padding: 8px 32px 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  min-height: 36px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0a83c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
.p-league-picker select:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.p-subtitle { font-size: 12px; color: var(--text-mid); margin-top: 2px; }

.p-header-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.p-mode-switch {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.p-mode-opt {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-mid);
  transition: background 0.15s;
}
.p-mode-opt.active {
  background: var(--accent);
  color: #241f16;
}
.p-btn-login {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  padding: 6px 14px;
  min-height: auto;
}
.p-btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-str);
  color: var(--text-mid);
  border-radius: 999px;
  font-size: 12px;
  padding: 6px 14px;
  min-height: auto;
  /* margin-left removido — ahora el gap de .p-header-right da la separación */
  position: relative;
}
/* Separador visual sutil antes del logout — línea vertical del color del border */
.p-btn-logout::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 25%;
  bottom: 25%;
  width: 1px;
  background: var(--border-str);
}
.p-btn-logout:hover {
  border-color: var(--neg);
  color: var(--neg);
  background: transparent;
}

/* ─── Tabs ─────────────────────────────────────────────────────────────── */
.p-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scroll-behavior: smooth;
}
.p-tab {
  padding: 10px 16px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.4px;
  cursor: pointer;
  color: var(--text-mid);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.p-tab.active {
  background: var(--bg-deep);
  border-color: var(--border);
  color: var(--accent);
}

/* ─── Main content ─────────────────────────────────────────────────────── */
.p-main {
  padding: 16px 20px 60px;
  background: var(--bg-deep);
  min-height: calc(100vh - 130px);
}

.p-label {
  font-size: 11px;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.p-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Config card ──────────────────────────────────────────────────────── */
.p-config-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.p-config-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
}
.p-config-row label { min-width: 90px; }

.p-toggle {
  display: flex;
  border: 1px solid var(--border-str);
  border-radius: 8px;
  overflow: hidden;
}
.p-toggle button {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 6px 12px;
  font-size: 13px;
  min-height: 38px;
}
.p-toggle button.on { background: var(--accent); color: #241f16; font-weight: 600; }

/* ─── Chips ────────────────────────────────────────────────────────────── */
.p-chips-block { margin-bottom: 20px; }
.p-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.p-chip {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-mid);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.p-chip:hover { border-color: var(--accent); }
.p-chip.selected {
  background: var(--accent);
  color: #241f16;
  border-color: var(--accent);
}
.p-chip-add {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: transparent;
  border: 1px dashed var(--text-mid);
  color: var(--text-mid);
  font-size: 20px;
  padding: 0;
  min-height: 44px;
}

/* ─── Scores table ─────────────────────────────────────────────────────── */
.p-scores-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}
.p-scores {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 500px;
}
/* Solo las tablas del Tablero necesitan layout fijo (por los <colgroup> de alineación).
   Historial y Resumen usan layout auto (default) para adaptarse al contenido. */
.p-scores-main, .p-prizes-table {
  table-layout: fixed;
  min-width: 820px;
}

/* Colores por lugar aplicados a los scores individuales (por juego + serie) —
   pinta la celda del jugador con el color del puesto que gana en ese juego */
.p-score-place-1 { background: rgba(224,168,60,0.14); color: var(--place-1) !important; font-weight: 700; }
.p-score-place-2 { background: rgba(95,159,224,0.14); color: var(--place-2) !important; font-weight: 700; }
.p-score-place-3 { background: rgba(224,104,95,0.14); color: var(--place-3) !important; font-weight: 700; }
.p-score-place-4 { background: rgba(95,191,143,0.14); color: var(--place-4) !important; font-weight: 700; }
.p-score-place-5 { background: rgba(168,121,224,0.14); color: var(--place-5) !important; font-weight: 700; }
.p-score-place-6 { background: rgba(240,153,106,0.14); color: var(--place-6) !important; font-weight: 700; }
/* En inputs (celdas J1..Jn) el color del score se aplica al input directamente */
.p-cell-score.p-score-place-1 input,
.p-cell-score.p-score-place-2 input,
.p-cell-score.p-score-place-3 input,
.p-cell-score.p-score-place-4 input,
.p-cell-score.p-score-place-5 input,
.p-cell-score.p-score-place-6 input { color: inherit; font-weight: 700; }
/* La columna LUGAR de premios (372px) matchea la suma de POS+JUGADOR+PROMEDIO+HC
   de scores (48+180+88+56 = 372). Y J1..Jn son 82px en ambas tablas.
   Por eso J1/J2/J3/J4/J5 quedan verticalmente alineadas — el offset horizontal
   desde el inicio del wrapper es idéntico en scores y premios. */
.p-row-tie-extra td { background: rgba(255,255,255,0.02); }
.p-row-tie-extra .p-place-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

/* Fila con highlight del color del lugar (border-left) */
.p-place-row-1 td:first-child { box-shadow: inset 4px 0 0 var(--place-1); }
.p-place-row-2 td:first-child { box-shadow: inset 4px 0 0 var(--place-2); }
.p-place-row-3 td:first-child { box-shadow: inset 4px 0 0 var(--place-3); }
.p-place-row-4 td:first-child { box-shadow: inset 4px 0 0 var(--place-4); }
.p-place-row-5 td:first-child { box-shadow: inset 4px 0 0 var(--place-5); }
.p-place-row-6 td:first-child { box-shadow: inset 4px 0 0 var(--place-6); }

/* Fila extra por empate: montos $0 no distraen — quedan en gris */
.p-row-tie-extra .p-prize-amount { opacity: 0.55; }
.p-scores th, .p-scores td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.p-scores th {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-mid);
  background: var(--bg-deep);
  position: sticky; top: 0;
}
.p-scores tr:last-child td { border-bottom: none; }
.p-cell-name { text-align: left; white-space: nowrap; }
.p-cell-hc { color: var(--text-mid); font-weight: 500; }
.p-cell-avg { color: var(--text-mid); }
.p-cell-avg input {
  width: 60px;
  text-align: center;
  padding: 6px 4px;
  min-height: 34px;
  font-size: 13px;
}
.p-hc-auto {
  font-size: 9px;
  color: var(--text-mute);
  margin-left: 3px;
  vertical-align: super;
}
.p-cell-score { position: relative; }
.p-cell-score input {
  width: 60px;
  text-align: center;
  padding: 6px 8px;
  min-height: 36px;
}
.p-cell-score small {
  display: block;
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 2px;
}
.p-cell-serie { font-weight: 500; }
.p-cell-gain { font-weight: 600; }
.p-cell-gain.pos { color: var(--pos); }
.p-cell-gain.neg { color: var(--neg); }

.p-ini {
  display: inline-block;
  width: 28px; height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  vertical-align: middle;
}

/* ─── Estado sin día activo ──────────────────────────────────────────── */
.p-no-active {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  max-width: 480px;
  margin: 20px auto 0;
}
.p-no-active-icon { font-size: 48px; margin-bottom: 8px; }
.p-no-active h3 {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin: 8px 0;
}
.p-no-active p {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.6;
  margin: 12px 0 20px;
}
.p-no-active-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.p-no-active-actions button { padding: 10px 20px; font-size: 13px; font-weight: 600; }

/* Hint para admin cuando el día está vacío */
.p-hint {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ─── POS + TOTAL + TOTAL+HC en tabla scores ──────────────────────────── */
.p-th-pos { width: 44px; }
/* Especificidad alta para vencer al .p-scores th (que centra por default) */
.p-scores th.p-th-name,
.p-scores td.p-cell-name,
.p-scores td.p-cell-place {
  text-align: left;
}
.p-th-accent { color: var(--accent) !important; }
.p-cell-pos {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  color: var(--accent);
}
.p-cell-total { color: var(--text-mid); font-weight: 500; }
/* TOTAL+HC neutral por default; se colorea con .p-score-place-N solo si el jugador ganó en la serie */
.p-cell-total-hc { color: var(--text); font-weight: 700; }
.p-scores-total-row td {
  background: var(--bg-deep);
  border-top: 2px solid var(--border-str);
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.5px;
}
.p-cell-total-label {
  text-align: right;
  font-weight: 700;
  color: var(--text-mid);
  font-size: 12px;
}
.p-organizer-tag {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 400;
  font-style: italic;
}
.p-tag-tie {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  background: var(--info);
  color: #0b1220;
  margin-left: 6px;
  vertical-align: middle;
  font-family: 'Oswald', sans-serif;
  line-height: 1;
}

/* ─── Tabla de premios (matriz) ───────────────────────────────────────── */
.p-prizes-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.4px;
  color: var(--text);
  margin: 28px 0 10px;
}
.p-prizes-wrap { margin-bottom: 16px; }
.p-prizes-table th, .p-prizes-table td { padding: 10px 12px; }
.p-cell-place { text-align: left; }
.p-place-editor {
  display: flex;
  align-items: center;
  gap: 10px;
}
.p-place-label {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  color: var(--accent);
  font-size: 14px;
}
.p-place-input {
  display: flex;
  align-items: center;
  gap: 4px;
}
.p-place-input input {
  width: 66px;
  text-align: center;
  padding: 6px 4px;
  min-height: 34px;
  font-weight: 700;
  border-color: var(--accent);
}
.p-cell-prize {
  text-align: center;
}
.p-prize-winner {
  font-size: 12px;
  color: var(--text-mid);
  margin-bottom: 4px;
}
.p-prize-amount {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ─── Fix responsive tabla premios (parte 133 día 4) ───────────────────
   El wrapper .p-prizes-wrap ya tiene scroll horizontal cuando aplique.
   En mobile los cells se ven bien porque siguen alineados a las columnas
   del scroll horizontal. Sin este fix, columnas J1/J2/J3/SERIE en 3+ juegos
   se apilaban unas encima de otras dando el efecto "montado" que Carlos
   reportó. */
.p-prizes-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.p-prizes-table {
  min-width: 640px;         /* fuerza scroll horizontal antes que colapso */
}
.p-cell-prize {
  min-width: 90px;          /* cada celda con winner + amount necesita espacio */
  white-space: nowrap;      /* nombres no se parten */
}
.p-prize-winner {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

/* Tabla de premios en historial (más compacta que en tablero, no editable) */
.p-prizes-history .p-place-input {
  font-size: 12px;
  color: var(--text-mid);
}
.p-prizes-history .p-place-label {
  display: inline-block;
  margin-right: 6px;
}

/* ─── Tab LÍNEAS JUGADAS (parte 133 día 4 · columnas fijas v50) ───────
   Layout: [JUGADOR fijo] [ fechas con scroll ] [ACUMULADO fijo].
   Sólo presentación — ni un dato, cálculo ni orden cambia acá.

   Los offsets `right:` de las 3 columnas del ACUMULADO se calculan a mano
   a partir de sus anchos, así que esos anchos TIENEN que ser fijos. Viven
   en variables para que el override de mobile los reduzca en un solo lugar
   y los offsets se recalculen solos.
--------------------------------------------------------------------- */
.p-lines-wrap {
  max-width: 100%;
  /* Encierra el scroll horizontal acá: ni la página entera se mueve, ni el
     swipe de las fechas se encadena al scroll del documento en mobile. */
  overscroll-behavior-x: contain;
}
/* El indicador de scroll por gradientes del wrapper genérico (mobile) se
   apagaría igual detrás de las columnas opacas; acá el borde lo dan las
   sombras de las propias columnas fijas. */
@media (max-width: 500px) {
  /* Especificidad 0,2,0 a propósito: el `.p-scores-wrap` con gradientes de
     mobile se declara más abajo en este mismo archivo y si no, gana él. */
  .p-scores-wrap.p-lines-wrap { background: var(--bg-card); }
}
.p-lines-table {
  --ln-name:  172px;
  --ln-pins:   58px;
  --ln-games:  56px;
  --ln-avg:    64px;
  min-width: 100%;
  font-size: 12px;
  /* sticky + border-collapse:collapse pierde los bordes al desplazar: los
     bordes pertenecen a la tabla, no a la celda, y no viajan con ella. */
  border-collapse: separate;
  border-spacing: 0;
}
.p-lines-table th,
.p-lines-table td {
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
}
.p-lines-date-header {
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}
.p-lines-sub-header th {
  font-size: 11px;
  color: var(--text-mid);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.p-lines-ts {
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border);
  font-weight: 700;
}
.p-lines-avg {
  color: var(--accent);
  font-size: 14px;
}
.p-lines-score.p-muted {
  color: rgba(255, 255, 255, 0.20);
}

/* ── Columna JUGADOR: fija a la izquierda ────────────────────────────── */
.p-lines-table th.p-th-name,
.p-lines-table td.p-cell-name {
  position: sticky;
  left: 0;
  width:     var(--ln-name);
  min-width: var(--ln-name);
  max-width: var(--ln-name);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Fondo OPACO obligatorio: es lo que hace que las fechas desaparezcan
     por debajo en vez de leerse encima del nombre. */
  background: var(--bg-card);
  box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.65);
}
.p-lines-table thead th.p-th-name { background: var(--bg-deep); }

/* ── Bloque ACUMULADO: fijo a la derecha (3 columnas + su encabezado) ── */
.p-lines-table .p-lines-acc,
.p-lines-table .p-lines-total-header {
  position: sticky;
  background-color: var(--bg-card);
  background-image: linear-gradient(rgba(224, 168, 60, 0.10), rgba(224, 168, 60, 0.10));
}
.p-lines-table thead .p-lines-acc,
.p-lines-table .p-lines-total-header { background-color: var(--bg-deep); }

.p-lines-table .p-lines-acc-avg   { right: 0; }
.p-lines-table .p-lines-acc-games { right: var(--ln-avg); }
.p-lines-table .p-lines-acc-pins  { right: calc(var(--ln-avg) + var(--ln-games)); }
.p-lines-table .p-lines-total-header { right: 0; }

.p-lines-table .p-lines-acc-pins  { width: var(--ln-pins);  min-width: var(--ln-pins);  max-width: var(--ln-pins); }
.p-lines-table .p-lines-acc-games { width: var(--ln-games); min-width: var(--ln-games); max-width: var(--ln-games); }
.p-lines-table .p-lines-acc-avg   { width: var(--ln-avg);   min-width: var(--ln-avg);   max-width: var(--ln-avg); }

/* .p-lines-total ya no pinta fondo ni borde propios: el fondo lo pone
   .p-lines-acc de forma opaca y el borde sólo va en la primera columna del
   bloque. Se conserva la clase porque el HTML del historial también la usa.
   Va ANTES del borde de acento: misma especificidad, gana la última. */
.p-lines-table .p-lines-total { border-left: none; }

/* La sombra va sólo en la primera columna del bloque: marca el corte contra
   las fechas que pasan por detrás, sin dibujar líneas entre Pines/Juegos/Prom. */
.p-lines-table .p-lines-acc-pins,
.p-lines-table .p-lines-total-header {
  border-left: 2px solid var(--accent);
  box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.65);
}
.p-lines-table .p-lines-total-header {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}
/* ── Apilado: encabezados fijos > esquinas > columnas fijas > fechas ──── */
.p-lines-table tbody .p-cell-name,
.p-lines-table tbody .p-lines-acc      { z-index: 2; }
.p-lines-table thead th                { z-index: 3; }
.p-lines-table thead th.p-th-name,
.p-lines-table thead .p-lines-acc,
.p-lines-table thead .p-lines-total-header { z-index: 4; }

/* ─── Barra de validación (Pote / Asignado / Pagan / cuadra) ──────────── */
.p-validation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 12px;
}
.p-validation.match {
  background: rgba(95,191,143,0.10);
  border: 1px solid rgba(95,191,143,0.35);
}
.p-validation.diff {
  background: rgba(224,104,95,0.10);
  border: 1px solid rgba(224,104,95,0.35);
}
.p-validation-metrics { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; }
.p-validation-status {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 14px;
}
.p-validation.match .p-validation-status { color: var(--pos); }
.p-validation.diff  .p-validation-status { color: var(--neg); }

.p-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Jugadores tab ────────────────────────────────────────────────────── */
.p-player-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.p-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
}
.p-player-header:hover { background: oklch(0.22 0.02 250); }
.p-player-info { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.p-also-plays {
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.p-arrow { color: var(--text-mid); font-size: 16px; }

.p-player-body {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.p-player-contact { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-mid); }
.p-player-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-deep);
  border-radius: 8px;
}
.p-player-stats > div { font-size: 12px; color: var(--text-mid); }
.p-player-stats b { display: block; font-size: 16px; color: var(--text); }
.p-player-stats b.pos { color: var(--pos); }
.p-player-stats b.neg { color: var(--neg); }

.p-mini-label { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.p-league-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.p-league-chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text-mid);
}
.p-league-chip.current {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.p-player-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Historial tab ────────────────────────────────────────────────────── */
.p-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.p-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  flex-wrap: wrap;
}
.p-history-header:hover { background: oklch(0.22 0.02 250); }
.p-history-pot { font-size: 12px; color: var(--text-mid); text-align: right; }
.p-history-body { padding: 0; border-top: 1px solid var(--border); overflow-x: auto; }
.p-history-body .p-scores { border-radius: 0; }

/* ─── Resumen tab ──────────────────────────────────────────────────────── */
.p-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.p-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.p-kpi-label { font-size: 11px; color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.p-kpi-value { font-family: 'Oswald', sans-serif; font-size: 26px; font-weight: 700; color: var(--accent); }
.p-section-title { font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 600; margin: 20px 0 10px; letter-spacing: 0.5px; }
.p-tab-scope {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}
.p-tab-scope b { color: var(--accent); font-weight: 700; }
.p-summary-tables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 900px) {
  .p-summary-tables { grid-template-columns: 1fr 1fr; }
}

/* ─── Modales ─────────────────────────────────────────────────────────── */
.p-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.p-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-str);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.p-modal-wide { max-width: 520px; }
.p-modal h3 { font-family: 'Oswald', sans-serif; margin: 0 0 4px; font-size: 20px; letter-spacing: 0.5px; }
.p-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.p-hc-input { display: flex; gap: 4px; align-items: center; }
.p-hc-input button { padding: 6px 8px; font-size: 13px; min-height: 38px; }
.p-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* Password input con toggle de ojo */
.p-password-input {
  position: relative;
  display: flex;
  align-items: center;
}
.p-password-input input {
  padding-right: 42px;
  width: 100%;
}
.p-password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 8px;
  min-height: auto;
  color: var(--text-mid);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-password-toggle:hover {
  color: var(--accent);
  background: transparent;
}

.p-error {
  background: rgba(224,104,95,0.15);
  color: var(--neg);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

/* ─── Toast ───────────────────────────────────────────────────────────── */
.p-toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-str);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 2000;
  animation: p-toast-in 0.2s;
}
.p-toast.success { border-color: var(--pos); color: var(--pos); }
.p-toast.error   { border-color: var(--neg); color: var(--neg); }
@keyframes p-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ─── Desktop overrides ────────────────────────────────────────────────── */
@media (min-width: 720px) {
  html, body { font-size: 15px; }
  .p-header { padding: 20px 32px; }
  .p-title { font-size: 28px; }
  .p-subtitle { font-size: 13px; }
  .p-tabs { padding: 16px 32px 0 32px; }
  .p-main { padding: 24px 32px 60px; }
  .p-scores { min-width: unset; }
}

/* ─── Mobile overrides (fix números montados) ─────────────────────────── */
@media (max-width: 500px) {
  /* Tabla scores: reducir padding + font + iniciales para caber más en el ancho */
  .p-scores { font-size: 11px; }
  .p-scores th, .p-scores td { padding: 6px 4px; }
  .p-ini { width: 22px; height: 22px; line-height: 22px; font-size: 10px; margin-right: 4px; }
  .p-cell-score input { width: 46px; padding: 4px 2px; min-height: 32px; font-size: 12px; }
  .p-cell-score small { font-size: 9px; }
  .p-cell-total, .p-cell-total-hc, .p-cell-gain { font-size: 12px; }
  /* Prevenir wrap raro en celdas numéricas */
  .p-cell-total, .p-cell-total-hc, .p-cell-gain,
  .p-cell-pos, .p-cell-hc, .p-cell-avg { white-space: nowrap; }
  /* Indicador visual de scroll horizontal — sombras de bordes cuando hay overflow */
  .p-scores-wrap {
    background:
      linear-gradient(to right, var(--bg-card) 30%, rgba(0,0,0,0)),
      linear-gradient(to right, rgba(0,0,0,0), var(--bg-card) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.4), rgba(0,0,0,0)),
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.4), rgba(0,0,0,0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 30px 100%, 30px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  /* Líneas Jugadas: columnas fijas más angostas para dejarle ancho real a las
     fechas. Los offsets `right:` se recalculan solos desde estas variables. */
  .p-lines-table {
    --ln-name:  116px;
    --ln-pins:   48px;
    --ln-games:  44px;
    --ln-avg:    50px;
    font-size: 11px;
  }
  .p-lines-table th, .p-lines-table td { padding: 6px 5px; }
  .p-lines-table .p-ini { margin-right: 3px; }
  .p-lines-avg { font-size: 12px; }
  /* Config del día en mobile: apilar en vez de wrap horizontal */
  .p-config-row { flex-direction: column; gap: 10px; }
  .p-config-row label { min-width: 100%; }
  /* Modal grid en mobile: single column */
  .p-modal-grid { grid-template-columns: 1fr; }
  /* KPI cards en mobile: 2x2 en vez de 4 en línea */
  .p-summary-grid { grid-template-columns: 1fr 1fr; }
  .p-kpi-value { font-size: 20px; }
  .p-kpi-label { font-size: 11px; }
}
