/* Componentes (docs/11-frontend.md). Solo variables de tokens.css; prefijo rp-. */
.rp-h1 { font: 600 clamp(30px, 5vw, 40px)/1.12 var(--font-display); margin: 0; }
.rp-h2 { font: 600 24px/1.12 var(--font-display); margin: 0; }
.rp-lead { color: var(--text-2); font-size: 18px; line-height: 1.5; max-width: 60ch; }
.rp-eyebrow { color: var(--text-2); font: 500 13px var(--font-body); text-transform: uppercase; letter-spacing: .08em; }
.rp-coverage, .rp-source { color: var(--text-2); font-size: 14px; }

/* Botones */
.rp-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 15px/1 var(--font-body);
  padding: 11px 16px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none;
  white-space: nowrap; background: var(--accent-text); color: var(--on-accent); }
.rp-button:hover { background: var(--accent); }
.rp-button--secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.rp-button--secondary:hover { background: var(--surface-sunk); }
.rp-button--ghost { background: transparent; color: var(--text); padding-inline: 10px; }
.rp-button--ghost:hover { background: var(--surface-sunk); }
.rp-button--danger { background: var(--surface); color: var(--discrepancy); border-color: var(--discrepancy); }
.rp-button--sm { padding: 8px 12px; font-size: 14px; }
.rp-link { background: none; border: 0; padding: 0; color: var(--text); font: inherit; text-decoration: underline; cursor: pointer; }

/* Perfil */
.rp-profile { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; }
.rp-profile__info { display: grid; gap: 4px; min-width: 0; flex: 1 1 220px; }
.rp-avatar { width: 88px; height: 88px; border-radius: 50%; background: var(--surface-sunk); border: 1px solid var(--border);
  display: grid; place-items: center; flex: none; font: 600 32px/1 var(--font-display); color: var(--text-2); }
.rp-source-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--verified); font-weight: 600; }
.rp-source-tag svg { width: 18px; height: 18px; }

/* KPI unidos en una franja */
.rp-kpis { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.rp-kpi { background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; align-content: start; min-width: 0; margin: 0; }
.rp-kpi dt, .rp-kpi dd { margin: 0; }
.rp-kpi__label { font-size: 14px; color: var(--text-2); }
.rp-kpi__value { font: 600 32px/1.05 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-kpi__note { font-size: 13px; color: var(--text-2); }

/* Paneles y tablas */
.rp-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px;
  min-width: 0; display: grid; gap: 12px; align-content: start; }
.rp-panel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.rp-panel__head h2 { font-size: 21px; }
.rp-table-scroll { overflow-x: auto; max-width: 100%; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 15px; background: transparent; border: 0; }
.rp-table th, .rp-table td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.rp-table th { font-weight: 600; font-size: 14px; color: var(--text-2); background: transparent; }
.rp-table tbody tr:hover td { background: var(--surface-sunk); }
.rp-table .rp-num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-body); }
.rp-table .rp-wrap-cell { white-space: normal; min-width: 160px; }
.rp-sub { display: block; color: var(--text-2); font-size: 13px; }

/* Estados (icono + texto, nunca solo color) */
.rp-st { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.rp-st svg { width: 15px; height: 15px; flex: none; }
.rp-st--ok { color: var(--verified); } .rp-st--bad { color: var(--discrepancy); } .rp-st--na { color: var(--unverifiable); }

/* Listas, vacíos, formularios */
.rp-list { list-style: none; padding: 0; display: grid; gap: 8px; margin: 0; }
.rp-list a { font-weight: 500; }
.rp-inline { list-style: none; padding: 0; display: flex; gap: 12px; flex-wrap: wrap; margin: 0; }
.rp-role { color: var(--text-2); font-family: var(--font-mono); font-size: 13px; margin-right: 8px; }
.rp-empty { background: var(--surface-sunk); border-radius: var(--radius-lg); padding: 24px; color: var(--text-2); }
.rp-empty__title { font-weight: 600; color: var(--text); margin-top: 0; }
.rp-search { display: flex; gap: 8px; max-width: 32rem; }
.rp-search input { flex: 1; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; min-width: 0; }
.rp-more { text-align: center; }
.rp-form { display: grid; gap: 12px; max-width: 28rem; }
.rp-form input:not([type="hidden"]), .rp-form textarea { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
.rp-error { color: var(--discrepancy); font-weight: 600; }
.rp-messages { list-style: none; padding: 12px; background: var(--surface-sunk); border-radius: var(--radius-lg); }
.rp-card-count { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.rp-card-count__chip { width: .75rem; height: 1rem; border-radius: 2px; display: inline-block; }
.rp-card-count--yellow .rp-card-count__chip { background: var(--yellow-card); }
.rp-card-count--red .rp-card-count__chip { background: var(--red-card); }

/* Portada */
.rp-hero { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); padding: 40px 28px; }
.rp-hero > * { position: relative; }
.rp-hero__pitch { position: absolute; right: -2rem; top: 50%; width: min(34rem, 80%); transform: translateY(-50%); color: var(--border); pointer-events: none; }
.rp-hero .rp-h1 { max-width: 16ch; font-size: clamp(34px, 6vw, 52px); }
.rp-hero .rp-search { margin-top: 16px; }
.rp-value { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 16px; }
.rp-value h3 { margin: 0 0 4px; }
.rp-value p { color: var(--text-2); }
.rp-tight { gap: 8px; }

@media (max-width: 560px) {
  .rp-hide-sm { display: none; }
  .rp-table th, .rp-table td { white-space: normal; padding-right: 8px; }  /* sin desbordar la tabla */
  .rp-table .rp-num { white-space: nowrap; }
  .rp-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }  /* sin celda vacía en la rejilla de 2 columnas */
}

/* Escudos */
.rp-crest { width: 22px; height: 22px; flex: none; object-fit: contain; vertical-align: middle; }
.rp-crest--empty { display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-sunk);
  border: 1px solid var(--border); color: var(--text-2); font: 600 11px/1 var(--font-display); }
.rp-team { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }

/* Lista con recuento */
.rp-rows { list-style: none; padding: 0; margin: 0; }
.rp-rows > li { display: flex; align-items: center; gap: 10px; padding-block: 7px; border-bottom: 1px solid var(--border); min-width: 0; }
.rp-rows > li:last-child { border-bottom: 0; }
.rp-rows__grow { flex: 1; min-width: 0; }
.rp-rows__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-rows__count { font: 600 18px/1 var(--font-display); font-variant-numeric: tabular-nums; flex: none; }

/* Tabla de calor: temporada por competición, celdas partidas por rol */
.rp-heat { width: auto; table-layout: fixed; border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.rp-heat th { font-weight: 500; color: var(--text-2); white-space: nowrap; padding: 0 4px; text-align: left; }
.rp-heat thead th { font-size: 12px; vertical-align: bottom; width: 96px; white-space: normal; line-height: 1.2; padding-bottom: 4px; }
.rp-heat thead th:first-child { width: 72px; }
.rp-heat thead th.rp-heat__total { width: 52px; }
.rp-heat tbody th, .rp-heat tfoot th { color: var(--text); padding-right: 10px; }
.rp-heat td { padding: 0; min-width: 44px; }
.rp-heat .rp-heat__total { text-align: center; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.rp-split { display: flex; gap: 2px; height: 26px; border-radius: 3px; overflow: hidden; min-width: 36px; }
.rp-split > span { display: grid; place-items: center; font: 600 12px/1 var(--font-body); font-variant-numeric: tabular-nums; min-width: 14px; }
.rp-split__main { background: var(--role-main); color: var(--on-role-main); }
.rp-split__assist { background: var(--role-assist); color: var(--on-role-assist); }
.rp-split__other { background: var(--line-strong); color: var(--text); }
.rp-split__zero { background: var(--surface-sunk); color: var(--text-2); font-weight: 400; flex: 1; }
.rp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--text-2); }
.rp-legend__key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Mapa */
.rp-map { width: 100%; height: 340px; border-radius: var(--radius); background: var(--surface-sunk); border: 1px solid var(--border);
  overflow: hidden; position: relative; }
.rp-map__fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--text-2); font-size: 14px; }
.rp-grid-map { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .rp-grid-map { grid-template-columns: minmax(0, 1fr); } }

/* Pesos del reparto por rol (1..20) y colores de la leyenda: sin estilos en línea */
.rp-f1 { flex: 1; }
.rp-f2 { flex: 2; }
.rp-f3 { flex: 3; }
.rp-f4 { flex: 4; }
.rp-f5 { flex: 5; }
.rp-f6 { flex: 6; }
.rp-f7 { flex: 7; }
.rp-f8 { flex: 8; }
.rp-f9 { flex: 9; }
.rp-f10 { flex: 10; }
.rp-f11 { flex: 11; }
.rp-f12 { flex: 12; }
.rp-f13 { flex: 13; }
.rp-f14 { flex: 14; }
.rp-f15 { flex: 15; }
.rp-f16 { flex: 16; }
.rp-f17 { flex: 17; }
.rp-f18 { flex: 18; }
.rp-f19 { flex: 19; }
.rp-f20 { flex: 20; }
.rp-legend__key--main { background: var(--role-main); }
.rp-legend__key--assist { background: var(--role-assist); }
.rp-legend__key--other { background: var(--line-strong); }
.rp-legend__key--zero { background: var(--surface-sunk); border: 1px solid var(--border); }

.rp-match { white-space: nowrap; }
.rp-match .rp-team { vertical-align: middle; }
@media (max-width: 560px) { .rp-match { white-space: normal; } }
.rp-match .rp-team:last-child { margin-left: 4px; }

.rp-division { display: grid; gap: 8px; min-width: 0; }
.rp-division + .rp-division { border-top: 1px solid var(--border); padding-top: 14px; }
.rp-division h3 { font-size: 18px; }

/* Gráficos SVG (barras por mes y línea de AURA) */
.rp-chart { width: 100%; height: auto; display: block; overflow: visible; }
.rp-chart text { font: 11px var(--font-body); fill: var(--text-2); }
.rp-chart__value { font: 600 11px var(--font-body); fill: var(--text) !important; }
.rp-chart__axis { stroke: var(--line-strong); stroke-width: 1; }
.rp-chart__grid { stroke: var(--border); stroke-width: 1; }
.rp-chart__bar { fill: var(--chart-bar); }
.rp-chart__bar-last, .rp-chart__dot { fill: var(--accent); }
.rp-chart__hit { fill: transparent; }
.rp-chart__hit:hover { fill: var(--surface-sunk); opacity: .6; }
.rp-chart__line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.rp-chart__area { fill: var(--accent); opacity: .08; }
.rp-chart-caption { font: 600 14px var(--font-body); color: var(--text-2); margin: 4px 0 0; }
.rp-scroll-x { overflow-x: auto; max-width: 100%; }

/* Enlazado interno: compañeros y vecinos de AURA */
.rp-person { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; min-width: 0; min-height: 44px; }
.rp-person:hover { border-color: var(--accent); }
.rp-person__avatar { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-sunk); border: 1px solid var(--border); display: grid; place-items: center; font: 600 16px var(--font-display); color: var(--text-2); }
.rp-person__aura { position: absolute; right: -6px; bottom: -4px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent, #fff); font: 600 10px var(--font-body); }
.rp-person__body { display: flex; flex-direction: column; min-width: 0; }
.rp-person__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-person__meta { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-person--sm { padding: 6px 8px; } .rp-person--sm .rp-person__avatar { width: 36px; height: 36px; font-size: 13px; }
.rp-partners { display: grid; gap: 20px; grid-template-columns: 1fr; }
.rp-partners__grid, .rp-partners__recent { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rp-partners h3 { font: 600 14px var(--font-body); color: var(--text-2); margin: 0 0 8px; }
@media (min-width: 900px) {
  .rp-partners { grid-template-columns: 2fr 1fr; }
  .rp-partners--solo { grid-template-columns: 1fr; }
  .rp-partners__grid { grid-template-columns: 1fr 1fr; }
}
.rp-aura-list { counter-reset: none; }
.rp-aura-badge { font: 600 13px var(--font-body); font-variant-numeric: tabular-nums; color: var(--text-2); }
.rp-is-self { background: var(--surface-sunk); font-weight: 700; }
.rp-is-self .rp-aura-badge { color: var(--accent-text); }

/* Clubes: fila con fondo verde/gris/rojo según el balance del club en los partidos arbitrados */
.rp-club { position: relative; border-radius: var(--radius); }
.rp-club__track { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; padding: 4px 8px; border-radius: var(--radius); overflow: hidden; }
.rp-club__bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.rp-club__bg .rp-won { fill: var(--won-soft); } .rp-club__bg .rp-drawn { fill: var(--drawn-soft); } .rp-club__bg .rp-lost { fill: var(--lost-soft); }
.rp-club__name { position: relative; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--text-2); }
.rp-legend__key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.rp-legend__key--won { background: var(--won-soft); border: 1px solid var(--accent); } .rp-legend__key--drawn { background: var(--drawn-soft); border: 1px solid var(--text-2); } .rp-legend__key--lost { background: var(--lost-soft); border: 1px solid var(--discrepancy); }
.rp-home-stats { margin-block: 24px 32px; }
.rp-home-feds { margin-block: 0 32px; }
.rp-feds { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.rp-fed { display: grid; justify-items: center; gap: 8px; padding: 16px 12px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.rp-fed--link { text-decoration: none; color: inherit; height: 100%; box-sizing: border-box; }
.rp-fed--link:hover { border-color: var(--accent); }
.rp-fed--link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rp-fed__logo { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--surface-sunk); border: 1px solid var(--border); font: 600 18px/1 var(--font-display); color: var(--text); }
.rp-fed__note { font-size: 12px; color: var(--text-2); }
.rp-fed__logo img { width: 44px; height: 44px; object-fit: contain; }
.rp-fed__name { font-size: 14px; color: var(--text-2); min-height: 2.6em; }
.rp-fed__figures { display: flex; gap: 16px; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rp-fed__figures strong { display: block; font: 600 22px/1.1 var(--font-display); color: var(--text); }

/* Fila con columna de 300x600 a la derecha que acompaña al hacer scroll; en móvil desaparece */
.rp-grid-rail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.rp-rail { position: sticky; top: 16px; }
.rp-ad { display: flex; justify-content: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-sunk); color: var(--text-2); font-size: 12px; }
.rp-ad__label { margin-top: 6px; }
.rp-ad--rail { width: 300px; min-height: 600px; }
@media (max-width: 860px) {
  .rp-grid-rail { grid-template-columns: minmax(0, 1fr); }
  .rp-rail { display: none; }
}

/* Partidos recientes: celdas a dos líneas, equipos apilados y resultado en pastilla */
.rp-mt { line-height: 1.35; }
.rp-mt > span { display: block; }
.rp-mt__sub { color: var(--text-2); font-size: 13px; }
.rp-mt--teams { display: table-cell; }
.rp-mt__team { display: flex !important; align-items: center; gap: 8px; min-width: 0; }
.rp-mt__team + .rp-mt__team { margin-top: 3px; }
.rp-mt__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.rp-score { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 56px; height: 30px; padding-inline: 10px; border-radius: var(--radius); background: var(--surface-sunk); border: 1px solid var(--border); font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; }
.rp-table td.rp-mt--teams, .rp-table td.rp-wrap-cell { white-space: normal; }

/* Ranking por federación: podio con las competiciones de más nivel */
.rp-podium { margin: 0 0 24px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.rp-podium__item { display: grid; gap: 8px; align-content: start; justify-items: start; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.rp-podium__item--1 { border-color: var(--accent); }
.rp-podium__pos { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-sunk); font: 600 18px/1 var(--font-display); }
.rp-podium__name { font: 600 20px/1.2 var(--font-display); color: var(--text); text-decoration: none; }
.rp-podium__name:hover { text-decoration: underline; }
.rp-podium__comps { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; width: 100%; font-size: 14px; }
.rp-podium__comps li { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; border-top: 1px solid var(--border); }
.rp-podium__comps span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.rp-podium__comps strong { font-variant-numeric: tabular-nums; }
