/*
 * Proyecto Isaías — Pulido visual 11.7.0
 * -------------------------------------------------------------------------
 * Se carga al final. Corrige detalles visuales en todo el sistema:
 *  1. Blindaje frente al tema de WordPress (mayúsculas, espaciado, subrayados)
 *  2. Avatares, fotos y escudos de Dinastía
 *  3. Desafío (todas las vistas y Gestión del Staff)
 *  4. Planificador y creador de retos del Staff en modo noche
 *  5. Ajustes de diseño por pantalla (responsive, ancho, alto)
 *  6. Herramienta «Fotos de los Dinastas»
 */

/* ======================================================================== */
/* 1. Blindaje frente al tema                                                */
/* ======================================================================== */
/* El navegador del teléfono (modo oscuro automático de Chrome / Samsung Internet)
   no debe repintar los colores: el sistema ya tiene su propio modo noche. */
html:has(.fj-v11-shell) { color-scheme: only light; }
html[data-fj-theme="night"]:has(.fj-v11-shell) { color-scheme: only dark; }

/* El tema del sitio no debe cambiar la tipografía de los botones del sistema. */
.fj-v11-shell :is(button, [type="button"], [type="submit"], [type="reset"], .fj-btn, [role="tab"]),
.fj-v11-shell :is(button, [type="button"], [type="submit"], .fj-btn, [role="tab"]) :is(span, small, strong, b, em, i) {
  text-transform: none !important;
  letter-spacing: normal !important;
  font-family: inherit !important;
  text-shadow: none !important;
}
/* Etiquetas que el sistema sí muestra en mayúsculas a propósito. */
.fj-v11-shell :is(button, .fj-btn) :is([class*="kicker"], [class*="eyebrow"]) { text-transform: uppercase !important; }
.fj-v11-shell a:is(.fj-btn, [class*="-btn"], [class*="card"], [class*="chip"], [class*="tab"], [class*="pill"]) { text-decoration: none !important; }
.fj-v11-shell :is(ul, ol)[class] { margin-left: 0; }
.fj-v11-shell .fj-v11-bell__count { text-transform: none !important; }

/* Chips de conteo que se estiraban a todo el ancho. */
.fj-v11-shell :is(.fj-desafio-count, .fj-team-pill, .fj-xp-count, .fj-v11-body [class*="-count"]:not(div):not(section):not(ul):not(ol)) {
  justify-self: start;
  align-self: start;
  width: auto !important;
  max-width: 100%;
}

/* «Necesario» junto al texto, no flotando al borde. */
.fj-v11-shell .fj-xp-required-mark {
  display: inline-flex !important;
  flex: none !important;
  align-self: center;
  width: auto !important;
  margin: 0 0 0 6px !important;
  vertical-align: middle;
}
.fj-v11-shell label:has(> input[type="checkbox"], > input[type="radio"]) > .fj-xp-required-mark { align-self: flex-start; margin-top: 2px !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-xp-required-mark {
  background: #3e3218 !important; color: #ffd27a !important; border-color: #6b5426 !important;
}

/* ======================================================================== */
/* 2. Avatares, fotos y escudos                                              */
/* ======================================================================== */
/* Adiós al sello «PI» sobre fotos que no cargan: quedan las iniciales. */
.fj-v11-shell .is-image-missing::after,
.fj-game-shell-v1000 .is-image-missing::after { content: none !important; display: none !important; }

/* Iniciales siempre centradas, del tamaño del avatar. */
.fj-v11-shell :is(.fj-avatar-fallback, .fj-identity-avatar-fallback, .fj-staff646-avatar-fallback, .fj-avatar-fallback-auto) {
  display: grid !important;
  place-items: center !important;
  text-align: center !important;
  line-height: 1 !important;
  white-space: nowrap;
  overflow: hidden;
}
.fj-avatar-fallback-auto {
  position: absolute; inset: 0; z-index: 0;
  display: grid; place-items: center;
  border-radius: inherit;
  background: linear-gradient(135deg, #5b3ee4, #8f74ed);
  color: #fff;
  font-weight: 800;
  font-size: calc(var(--fj-avatar-size, 44px) * .34);
}
/* Con la foto cargada, las iniciales de respaldo no se asoman. */
.fj-has-photo > :is(.fj-avatar-fallback, .fj-identity-avatar-fallback, .fj-staff646-avatar-fallback, .fj-team-icon-fallback, .fj-fichero-avatar-letter, .fj-avatar-fallback-auto) { visibility: hidden !important; }
.fj-v11-shell .fj-fichero-avatar-letter.fj-has-photo { color: transparent !important; }

/* Las fotos llenan su marco sin deformarse. */
.fj-v11-shell :is(.fj-avatar-wrap, .fj-avatar-frame, .fj-identity-avatar, .fj-staff646-avatar, .fj-staff-avatar, .fj-wall642-comment-avatar) > img {
  width: 100% !important; height: 100% !important;
  object-fit: cover !important;
  max-width: none !important;
}

/* Logos de Dinastía: completos (contain) sobre fondo blanco, sin la letra detrás. */
.fj-v11-shell .fj-team-icon-image-wrap { overflow: hidden; border-radius: 22%; }
.fj-v11-shell .fj-team-icon-image-wrap > img.fj-team-icon {
  width: 100% !important; height: 100% !important; max-width: none !important;
  object-fit: contain !important; background: #fff !important;
  border-radius: inherit !important;
}
.fj-v11-shell .fj-dynasty-crest { flex: none; min-width: 0; aspect-ratio: 1 / 1; }
.fj-v11-shell .fj-dynasty-crest > .fj-team-icon-image-wrap { aspect-ratio: 1 / 1; flex: none; }
.fj-v11-shell .fj-dynasty-crest .fj-team-icon-image-wrap > :is(img, .fj-team-icon-fallback) { width: 100% !important; height: 100% !important; }

/* Insignia de Dinastía sobre el avatar: legible, con su logo o su inicial. */
.fj-v11-shell .fj-avatar-team-badge {
  --fj-b: max(20px, var(--fj-avatar-team-size, 20px));
  width: var(--fj-b) !important; height: var(--fj-b) !important;
  min-width: var(--fj-b) !important; min-height: var(--fj-b) !important;
  max-width: var(--fj-b) !important; max-height: var(--fj-b) !important;
  padding: 0 !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  background: var(--fj-avatar-team-color, #0f6e56) !important;
  overflow: hidden !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .28) !important;
  right: -4px !important; bottom: -4px !important;
}
.fj-v11-shell .fj-avatar-team-badge > .fj-avatar-team-monogram {
  position: absolute !important; inset: 0 !important;
  display: grid !important; place-items: center !important;
  width: 100% !important; height: 100% !important;
  border-radius: 50% !important;
  color: #fff !important;
  font-size: calc(var(--fj-b) * .52) !important;
  font-weight: 900 !important; line-height: 1 !important;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.fj-v11-shell .fj-avatar-team-badge > .fj-avatar-team-logo {
  position: absolute !important; inset: 0 !important;
  display: block !important;
  width: 100% !important; height: 100% !important; max-width: none !important;
  object-fit: cover !important;
  background: #fff;
  border-radius: 50% !important;
}
.fj-v11-shell .fj-avatar-team-badge.fj-has-photo > .fj-avatar-team-monogram { visibility: hidden; }
html[data-fj-theme="night"] .fj-v11-shell .fj-avatar-team-badge { border-color: #141e33 !important; }

/* Encabezado del Centro Staff: avatar cuadrado, no alargado. */
.fj-v11-shell .fj-sp651-hero-avatar { line-height: 0; }

/* Miembro en Puestos: avatar sin estirarse. */
.fj-pz-member__avatar { display: grid; place-items: center; line-height: 0; }

/* ======================================================================== */
/* 3. Desafío                                                                */
/* ======================================================================== */
/* «¿Qué quieres hacer?»: colores fijos en cada estado (el tema no los cambia). */
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"],
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"]:hover,
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"]:focus,
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"]:active {
  background: var(--ch-surface-2, #f7f8fc) !important;
  border: 1px solid var(--ch-line, #d7ddea) !important;
  color: var(--ch-ink, #172036) !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
  filter: none !important;
}
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"] strong { color: var(--ch-ink, #172036) !important; }
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"] small { color: var(--ch-muted, #5d687e) !important; opacity: 1 !important; }
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"] > span { color: var(--ch-accent, #6346d8) !important; background: var(--ch-surface, #fff) !important; }
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"][aria-selected="true"],
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"].is-active {
  background: var(--ch-accent-soft, #eee9ff) !important;
  border: 2px solid var(--tone-strong, #0a7352) !important;
}
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"][aria-selected="true"] strong,
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"].is-active strong { color: var(--ch-accent-2, #4d31b9) !important; }
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"][aria-selected="true"] small,
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"].is-active small { color: var(--ch-ink-2, #35415a) !important; }
.fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"]:focus-visible { outline: 3px solid var(--v11-focus, #1d6fe8) !important; outline-offset: 2px !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"],
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"]:hover,
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"]:focus,
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"]:active {
  background: #1a2640 !important; border-color: #43537a !important; color: #f4f7ff !important;
}
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"] strong { color: #f4f7ff !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"] small { color: #c2cce0 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"] > span { background: #0f172b !important; color: #c9bdff !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"][aria-selected="true"],
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"].is-active { background: #2a2350 !important; border-color: #3fcf9a !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"][aria-selected="true"] strong,
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"].is-active strong { color: #ffffff !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"][aria-selected="true"] small,
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] [role="tab"].is-active small { color: #e2e8f4 !important; }
/* «Gestión del Staff» se distingue con el color del Staff. */
.fj-v11-shell .fj-exp-page [role="tablist"] .fj-desafio-staff-tab > span { color: #165cb6 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-page [role="tablist"] .fj-desafio-staff-tab > span { color: #bcd8ff !important; }

/* Ruta de 5 pasos: «Resultado» nunca se parte. */
.fj-v11-shell .fj-challenge-journey { gap: 4px !important; }
.fj-v11-shell .fj-challenge-journey li { min-width: 0; }
.fj-v11-shell .fj-challenge-journey strong {
  word-break: keep-all !important; overflow-wrap: normal !important; hyphens: none !important;
  white-space: nowrap; font-size: clamp(11px, 3vw, 13px) !important;
}

/* Barra de avance del reto en teléfono y noche: barra, no anillo. */
@media (max-width: 820px) {
  html[data-fj-theme="night"] .fj-exp-page .fj-exp-progress,
  body[data-fj-theme="night"] .fj-exp-page .fj-exp-progress {
    background: linear-gradient(90deg, var(--ch-accent, #8c74ff) calc(var(--fj-progress) * 1%), #2c3a57 0) !important;
  }
}

/* Logros (vitrinas): textos legibles también en la historia. */
.fj-v11-shell .fj-desafio-trophy { opacity: 1 !important; }
.fj-v11-shell .fj-desafio-trophy :is(small, span) { color: #3d4860 !important; opacity: 1 !important; }
.fj-v11-shell .fj-desafio-trophy > em { color: #2f3a51 !important; background: #e3e7ef !important; opacity: 1 !important; }
.fj-v11-shell .fj-desafio-trophy.is-current > em { color: #5f4200 !important; background: #ffe8a8 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-desafio-trophy :is(small, span) { color: #c2cce0 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-desafio-trophy > em { color: #e2e8f4 !important; background: #2c3a57 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-desafio-trophy.is-current > em { color: #241900 !important; background: #f3c04a !important; }
.fj-v11-shell .fj-desafio-champion-card { overflow: hidden; }

/* Modo noche: cajas que seguían blancas. */
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-exp-privacy-note, .fj-exp-no-evidence, .fj-kp-badge-stake, .fj-desafio-result-card .is-winner, .fj-kp-cost, .fj-planner-all-clear) {
  background: #1a2640 !important; border-color: #43537a !important; color: #e2e8f4 !important;
}
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-exp-privacy-note, .fj-exp-no-evidence, .fj-kp-badge-stake, .fj-desafio-result-card .is-winner) :is(strong, b, h3, h4) { color: #ffffff !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-exp-privacy-note, .fj-exp-no-evidence, .fj-kp-badge-stake, .fj-desafio-result-card .is-winner) :is(p, small, span, em) { color: #c2cce0 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-privacy-note { border-left: 4px solid #3fcf9a !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-exp-status, .fj-kp-scope, .fj-kp-discipline, .fj-exp-page small[class=""], .fj-desafio-result-card em) {
  background: #23314f !important; color: #e2e8f4 !important; border-color: #43537a !important;
}
html[data-fj-theme="night"] .fj-v11-shell .fj-exp-status.is-progress { background: #133628 !important; color: #a7f0d2 !important; }

/* ======================================================================== */
/* 4. Creador de retos y planificador del Staff — modo noche                  */
/* ======================================================================== */
html[data-fj-theme="night"] .fj-v11-shell :is(
  .fj-master-hero, .fj-master-template, .fj-master-form, .fj-master-steps, .fj-master-form-actions,
  .fj-master-quality, .fj-master-quality-ring, .fj-master-live-grid > article, .fj-master-inline-form,
  .fj-master-reward-advice, .fj-master-final-check,
  .fj-method, .fj-method-rules article, .fj-method-projects article, .fj-planner-toolbar,
  .fj-planner-metrics article, .fj-planner-alerts, .fj-planner-alert-grid article, .fj-planner-block,
  .fj-planner-item, .fj-planner-item-actions form, .fj-planner-bulk, .fj-planner-coverage-grid article,
  .fj-planner-block-purpose, .fj-planner-scroll-controls button, .fj-master-hero-metrics article
) {
  background: #141e33 !important;
  border-color: #2c3a57 !important;
  color: #e2e8f4 !important;
  box-shadow: none !important;
}
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-method-rules, .fj-method-projects, .fj-planner-metrics, .fj-planner-block.is-empty, .fj-master-steps, .fj-master-form-actions, .fj-planner-block-stats span, .fj-planner-block > header em, .fj-master-template-meta span, .fj-master-quality li span) {
  background: #1a2640 !important; border-color: #2c3a57 !important; color: #e2e8f4 !important;
}
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-method-projects article.is-camp, .fj-master-final-check) { background: #3e3218 !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-planner-alert-grid .is-critical, .fj-master-notice.is-error) { background: #45202a !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-master-notice.is-ok, .fj-master-quality li.is-passed span, .fj-planner-item.is-scheduled) { background: #133628 !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-master-library > summary b, .fj-master-template header em, .fj-master-section-head > em, .fj-method-rules b, .fj-planner-metric-icon, .fj-planner-block-number, .fj-planner-block-choose, .fj-master-steps button.is-active, .fj-master-icons label input:checked + span, .fj-planner-template-list input:checked + span) {
  background: #2a2350 !important; color: #c9bdff !important;
}
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-master-hero, .fj-master-template, .fj-master-form, .fj-master-quality, .fj-method, .fj-planner-block, .fj-planner-item, .fj-planner-metrics, .fj-planner-alerts, .fj-planner-coverage-grid, .fj-planner-toolbar, .fj-master-live-grid) :is(h1, h2, h3, h4, strong, b, legend, label) { color: #f4f7ff !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-master-hero, .fj-master-template, .fj-master-form, .fj-master-quality, .fj-method, .fj-planner-block, .fj-planner-item, .fj-planner-metrics, .fj-planner-alerts, .fj-planner-coverage-grid, .fj-planner-toolbar, .fj-master-live-grid) :is(p, small, span:not([class*="badge"]):not([class*="pill"]), li, em:not([class]), time, dd, dt) { color: #c2cce0 !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-planner-load, .fj-planner-coverage-grid i) { background: #2c3a57 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-planner-item-actions select { background: #1a2640 !important; color: #f4f7ff !important; border-color: #43537a !important; }

/* ======================================================================== */
/* 5. Ajustes por pantalla                                                   */
/* ======================================================================== */
/* El Muro en tableta: barra lateral en una columna para que el perfil respire. */
@media (max-width: 1024px) {
  .fj-v11-shell .fj-wall641-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .fj-v11-shell .fj-wall641-sidebar { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important; }
}
.fj-v11-shell .fj-wall641-profile-metrics { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)) !important; }
.fj-v11-shell .fj-wall641-profile-metrics > span { min-width: 0; }

/* Centro Staff: el formulario de seguimiento abierto ocupa toda la fila. */
.fj-v11-shell .fj-sp651-comm-tools > details[open] { flex: 1 1 100% !important; width: 100% !important; }
.fj-v11-shell .fj-sp651-mini-form { width: 100% !important; }

/* Filtros del Plan de Adelanto: sin palabras partidas. */
.fj-v11-shell .fj-adv-filter { white-space: nowrap; word-break: keep-all; overflow-wrap: normal; min-width: max-content; }

/* Configuración en teléfono: sin desbordes horizontales. */
@media (max-width: 640px) {
  .fj-v11-shell .fj-sys659-field-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .fj-v11-shell .fj-sys659-field :is(input, select, textarea) { min-width: 0 !important; width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; }
  .fj-v11-shell .fj-wrap.fj-wrap-fullwidth { overflow-x: clip; }
}

/* Solicitudes: la cabecera de resultados no se monta sobre la barra de filtros. */
.fj-v11-shell .fj-app652-toolbar { position: relative; z-index: 1; margin-bottom: 12px; }
.fj-v11-shell .fj-app652-results-head { position: relative; clear: both; }

/* Secciones de Mi ficha con texto cortado en tarjetas de crecimiento. */
.fj-v11-shell .fj-profile-growth-card { min-width: 0; overflow-wrap: anywhere; }
.fj-v11-shell .fj-profile-transfer-titlecopy h4 { word-break: normal; overflow-wrap: break-word; }

/* Mi ficha · «01 Mi enfoque / 02 Mi crecimiento…»: textos completos. */
.fj-v11-shell :is(.fj-xp-steps, .fj-profile-steps, .fj-xp-step-nav) :is(small, span) { white-space: normal !important; text-overflow: clip !important; }

/* ======================================================================== */
/* 6. Herramienta «Fotos de los Dinastas»                                     */
/* ======================================================================== */
.fj-ph { display: grid; gap: 16px; }
.fj-ph-head { display: grid; gap: 12px; padding: 18px 20px; border: 1px solid var(--v11-line, #d8dfeb); border-radius: var(--v11-radius, 18px); background: var(--v11-surface, #fff); }
.fj-ph-back { font-weight: 600; color: var(--tone-ink, #874700) !important; text-decoration: none !important; }
.fj-ph-head__title { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: center; }
.fj-ph-head__title > span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--tone-soft, #fff1dc); font-size: 26px; }
.fj-ph-head h2 { margin: 0 0 4px !important; font-size: 22px !important; color: var(--v11-ink, #121a2f) !important; }
.fj-ph-head p { margin: 0 !important; color: var(--v11-muted, #4d5872); font-size: 15px; }
.fj-ph-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.fj-ph-stats > div { display: grid; padding: 10px 16px; border-radius: 14px; background: var(--v11-surface-2, #f6f8fc); min-width: 120px; }
.fj-ph-stats > div.is-warn { background: var(--v11-warn-soft, #fff4d6); }
.fj-ph-stats b { font-size: 22px; color: var(--v11-ink, #121a2f); }
.fj-ph-stats span { font-size: 13px; color: var(--v11-muted, #4d5872); }
.fj-ph-notice { padding: 14px 16px; border-radius: 14px; font-weight: 600; }
.fj-ph-notice.is-ok { background: var(--v11-ok-soft, #e3f6ec); border: 1px solid var(--v11-ok, #157a4f); color: var(--v11-ink, #121a2f); }
.fj-ph-notice.is-error { background: var(--v11-danger-soft, #fdecef); border: 1px solid var(--v11-danger, #c0283f); color: var(--v11-ink, #121a2f); }
.fj-ph-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 14px 16px; border: 1px solid var(--v11-line, #d8dfeb); border-radius: 16px; background: var(--v11-surface, #fff); }
.fj-ph-filters label { display: grid; gap: 6px; flex: 1 1 220px; margin: 0 !important; }
.fj-ph-filters label > span { font-size: 14px; font-weight: 600; color: var(--v11-ink, #121a2f); }
.fj-ph-filters :is(select, input) { min-height: 48px; width: 100%; font-size: 16px !important; }
.fj-ph-filters .fj-btn { min-height: 48px; }
.fj-ph-count { margin: 0 !important; font-size: 14px; color: var(--v11-muted, #4d5872); }
.fj-ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fj-ph-card {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 14px; align-items: center;
  padding: 14px; border: 1px solid var(--v11-line, #d8dfeb); border-radius: 18px; background: var(--v11-surface, #fff);
  scroll-margin-top: 90px;
}
.fj-ph-card.is-missing { border-style: dashed; }
.fj-ph-card.is-focus { box-shadow: 0 0 0 3px var(--tone, #c76a00); }
.fj-ph-card.is-preview { border-color: var(--tone, #c76a00); background: var(--tone-soft, #fff1dc); }
.fj-ph-card__photo { display: grid; justify-items: center; gap: 4px; }
.fj-ph-card__photo em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--tone-ink, #874700); }
.fj-ph-preview-img { display: block; width: 96px; height: 96px; border-radius: 14px; overflow: hidden; }
.fj-ph-preview-img img { width: 100%; height: 100%; object-fit: cover; }
.fj-ph-card__id { display: grid; gap: 2px; min-width: 0; }
.fj-ph-card__id strong { font-size: 16px; color: var(--v11-ink, #121a2f); overflow-wrap: anywhere; }
.fj-ph-card__id span { font-size: 13.5px; color: var(--v11-muted, #4d5872); }
.fj-ph-state { justify-self: start; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-style: normal; font-size: 12px; font-weight: 700; background: var(--v11-surface-2, #f6f8fc); color: var(--v11-ink-2, #2c3750); }
.fj-ph-card.has-photo .fj-ph-state { background: var(--v11-ok-soft, #e3f6ec); color: var(--v11-ok, #157a4f); }
.fj-ph-upload, .fj-ph-remove { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 !important; }
.fj-ph-pick { position: relative; flex: 1 1 auto; margin: 0 !important; }
.fj-ph-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.fj-ph-pick span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--tone-strong, #a85900); border-radius: 14px; background: var(--v11-surface, #fff);
  color: var(--tone-ink, #874700); font-weight: 700; font-size: 15px;
}
.fj-ph-pick input:focus-visible + span { outline: 3px solid var(--v11-focus, #1d6fe8); outline-offset: 2px; }
.fj-ph-upload .fj-btn { flex: 1 1 auto; min-height: 48px; }
.fj-ph-link { min-height: 40px; padding: 0 4px !important; border: 0 !important; background: none !important; color: var(--v11-danger, #c0283f) !important; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; box-shadow: none !important; }
.fj-ph-empty, .fj-ph-tip { margin: 0 !important; font-size: 14px; color: var(--v11-muted, #4d5872); }
.fj-ph-entry {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  margin: 0 0 16px; padding: 14px 18px; border: 1px solid var(--v11-line, #d8dfeb); border-left: 5px solid var(--tone, #c76a00);
  border-radius: 16px; background: var(--v11-surface, #fff); color: var(--v11-ink, #121a2f) !important; text-decoration: none !important;
}
.fj-ph-entry > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--tone-soft, #fff1dc); font-size: 24px; }
.fj-ph-entry strong { display: block; font-size: 16px; color: var(--v11-ink, #121a2f); }
.fj-ph-entry small { font-size: 13.5px; color: var(--v11-muted, #4d5872); }
.fj-ph-entry em { font-style: normal; font-weight: 700; color: var(--tone-ink, #874700); white-space: nowrap; }
@media (max-width: 480px) {
  .fj-ph-card { grid-template-columns: 80px minmax(0, 1fr); }
  .fj-ph-card__photo .fj-avatar-wrap, .fj-ph-preview-img { width: 80px !important; height: 80px !important; }
  .fj-ph-entry { grid-template-columns: 44px minmax(0, 1fr); }
  .fj-ph-entry em { grid-column: 2; }
}

/* Plan de Adelanto: el resumen se veía desvaído (opacidad .88 → textos por debajo de 4.5:1). */
html .fj-v11-screen-adelanto .fj-adv-summary,
html .fj-v11-shell .fj-adv-summary { opacity: 1 !important; }
html .fj-v11-shell .fj-adv-summary > div > span { color: var(--v11-muted, #4f5b70) !important; }

/* Escudo de la Dinastía sin logo: la inicial proporcional al escudo en teléfonos. */
@media (max-width: 400px) {
  .fj-v11-shell .fj-dynasty-crest .fj-team-icon-fallback { font-size: 26px !important; }
}

/* Modo noche: últimos bloques claros (Hacer una misión, Continuar lo mío, Configuración). */
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-kp-economy > span, .fj-kp-state, .fj-kp-scope, .fj-exp-form-intro > small) {
  background: #1a2540 !important; color: #c2cce0 !important; border-color: rgba(255,255,255,.12) !important;
}
html[data-fj-theme="night"] .fj-v11-shell .fj-kp-economy strong { color: #ffffff !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-kp-discipline { background: rgba(63,207,154,.16) !important; color: #7ff0c4 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-kp-scope.is-challenge { background: rgba(251,113,133,.16) !important; color: #ffb3c1 !important; }
.fj-v11-shell .fj-sys659-demo-state { white-space: nowrap; align-self: flex-start; }
html[data-fj-theme="night"] .fj-v11-shell .fj-sys659-demo-state { background: rgba(167,139,250,.18) !important; color: #d9ccff !important; }

/* Contenedores de foto que se estiraban (la foto quedaba bien, pero el marco no era cuadrado). */
.fj-v11-shell :is(.fj-sp651-hero-avatar, .fj-sp650-avatar, .fj-pz-member__avatar) {
  display: inline-flex !important; align-self: flex-start !important; justify-self: start !important;
  width: max-content !important; height: max-content !important; line-height: 0 !important; flex: none !important;
}
.fj-v11-shell :is(.fj-sp651-hero-avatar, .fj-sp650-avatar, .fj-pz-member__avatar) > * { margin: 0 !important; }

/* Solicitudes: en tablet la barra de filtros (210 px) no se queda fija tapando las tarjetas. */
@media (max-width: 1024px) {
  .fj-v11-shell .fj-app652-toolbar { position: relative !important; top: auto !important; }
}

/* Mi Ficha · Transferencias: en tarjetas estrechas el contador baja de línea y el título respira. */
@media (max-width: 1180px) {
  .fj-v11-shell .fj-profile-transfer-titlebar { grid-template-columns: 42px minmax(0, 1fr) !important; }
  .fj-v11-shell .fj-profile-transfer-titlebar > .fj-transfer-count { grid-column: 2; justify-self: start; }
}

/* Planificador de temporada: casillas de plantillas sin tapar el texto y pie legible. */
.fj-v11-shell .fj-planner-template-list input[type="checkbox"] {
  width: 18px !important; height: 18px !important; min-width: 0 !important; min-height: 0 !important;
  margin: 0 !important; padding: 0 !important; top: 11px !important; left: 10px !important; transform: none !important;
}
.fj-v11-shell .fj-planner-template-list label > span { padding-left: 38px !important; }
.fj-v11-shell .fj-planner-bulk footer { flex-wrap: wrap; }
.fj-v11-shell .fj-planner-bulk footer > span { white-space: nowrap; flex: 1 0 100%; }
.fj-v11-shell .fj-ph-card.is-broken .fj-ph-state { background: #fff4e5 !important; color: #8a4b00 !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-ph-card.is-broken .fj-ph-state { background: rgba(251,191,36,.16) !important; color: #ffd27a !important; }
.fj-v11-shell .fj-ph-card .fj-avatar-wrap > :is(.fj-avatar-fallback, .fj-avatar-fallback-auto, img.fj-avatar-image) {
  width: 100% !important; height: 100% !important; inset: 0 !important; border-radius: inherit !important;
}

/* v12.3 · Noche: textos del Plan de Adelanto que quedaban oscuros sobre fondo oscuro. */
html[data-fj-theme="night"] .fj-v11-shell .fj-v11-body .fj-adv-vert-tabs a.fj-adv-vert-tab em, html[data-fj-theme="night"] .fj-v11-shell .fj-v11-body .fj-adv-vert-tabs a.fj-adv-vert-tab em * { color: #ffd27a !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-adv1150-journey > li.is-current > span { background: color-mix(in srgb, var(--adv-route-strong, #4528c9) 68%, #000) !important; color: #fff !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-adv1150-journey > li.is-done > span { background: #0b6b55 !important; color: #fff !important; }
html[data-fj-theme="night"] .fj-v11-shell .fj-adv-vert-bar-top > span { color: #e6ebf5 !important; }
html[data-fj-theme="night"] .fj-v11-shell :is(.fj-adv-progress-meter-top > span, .fj-adv-progress-stat > span) { color: #b9c4da !important; }
