.teams-page,.team-detail-page{
  --teams-bg:#ffffff;
  --teams-panel:#ffffff;
  --teams-panel-2:#ffffff;
  --teams-line:#d9dee7;
  --teams-muted:#5f6b7a;
  --teams-text:#111827;
  --teams-accent:#2563eb;
  --teams-shadow:0 4px 16px rgba(15,23,42,.08);
}
.teams-page *,.team-detail-page *{box-sizing:border-box}
body.teams-page,body.team-detail-page{
  margin:0;
}
.teams-page,.team-detail-page{
  min-height:100vh;
  background:#fff;
  color:#111827;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
body.teams-page a,body.team-detail-page a,.lbps-dinamic-stage.teams-page a,.lbps-dinamic-stage.team-detail-page a{color:inherit}
.teams-shell,.team-detail-shell{width:min(1440px,calc(100% - 32px));margin:0 auto;padding:28px 0 72px}
.teams-intro{display:none}
.conference-section{margin-top:32px;background:#fff;color:#111827}
.conference-section:first-child{margin-top:0}
.conference-title{margin:0 0 16px;padding-bottom:10px;border-bottom:2px solid #e5e7eb;font-size:clamp(1.35rem,2.3vw,2rem);color:#111827}
.divisions-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}
.division-card{background:#fff;border:1px solid var(--teams-line);border-radius:14px;box-shadow:var(--teams-shadow);overflow:hidden;color:#111827}
.division-heading{margin:0;padding:14px 18px;border-bottom:1px solid var(--teams-line);font-size:.86rem;letter-spacing:.08em;text-transform:uppercase;color:#374151;background:#f8fafc}
.division-team-list{display:grid;background:#fff}
.team-index-link{display:grid;grid-template-columns:58px 1fr;align-items:center;gap:14px;min-height:80px;padding:12px 18px;text-decoration:none;border-bottom:1px solid #edf0f4;transition:.18s ease;background:#fff;color:#111827}
.team-index-link:last-child{border-bottom:0}
.team-index-link:hover{background:#f8fafc;transform:translateX(3px)}
.team-index-logo{width:54px;height:54px;object-fit:contain}
.team-index-name{font-weight:750;line-height:1.2;color:#111827}
.loading-state,.error-state{padding:30px;border:1px solid var(--teams-line);border-radius:14px;background:#fff;color:#5f6b7a}
.team-back{display:inline-flex;margin-bottom:18px;color:#374151;text-decoration:none;font-weight:700}
.team-back:hover{color:#111827}
.team-hero{position:relative;min-height:auto;border-radius:16px;overflow:hidden;border:1px solid var(--teams-line);box-shadow:var(--teams-shadow);background:#fff !important;color:#111827}
.team-hero::before{display:none}
.team-hero-content{position:relative;z-index:1;display:flex;align-items:center;gap:28px;min-height:190px;padding:28px;background:#fff;color:#111827}
.team-hero-logo{width:132px;height:132px;object-fit:contain;filter:none}
.team-hero-copy{min-width:0}
.team-hero-copy h1{margin:0 0 12px;font-size:clamp(2rem,5vw,3.8rem);line-height:1;color:#111827;text-shadow:none}
.team-meta{display:flex;flex-wrap:wrap;gap:9px}
.team-meta span{padding:7px 10px;border:1px solid #d9dee7;border-radius:999px;background:#f8fafc;font-size:.86rem;color:#374151}
.team-tabs{display:flex;gap:8px;overflow-x:auto;margin:20px 0;padding-bottom:3px}
.team-tab{border:1px solid #cfd6df;background:#fff;color:#374151;border-radius:999px;padding:10px 15px;font-weight:750;cursor:pointer;white-space:nowrap}
.team-tab:hover:not([disabled]){background:#f3f4f6;color:#111827}
.team-tab.is-active{background:var(--teams-accent);border-color:var(--teams-accent);color:#fff}
.team-tab[disabled]{opacity:.45;cursor:not-allowed}
.team-panel{display:none;color:#111827;background:#fff}
.team-panel.is-active{display:block}
.summary-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:18px;background:#fff}
.info-card{grid-column:span 4;background:#fff;color:#111827;border:1px solid var(--teams-line);border-radius:14px;padding:20px;box-shadow:var(--teams-shadow)}
.info-card.wide{grid-column:span 8}.info-card.full{grid-column:1/-1}
.info-card h2{margin:0 0 14px;font-size:1.05rem;color:#111827}
.data-list{display:grid;gap:10px;margin:0}
.data-row{display:flex;justify-content:space-between;gap:20px;padding-bottom:9px;border-bottom:1px solid #edf0f4;color:#111827}
.data-row:last-child{border:0;padding-bottom:0}.data-row dt{color:#5f6b7a}.data-row dd{margin:0;text-align:right;font-weight:750;color:#111827}
.staff-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.staff-item{padding:12px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc;color:#111827}
.staff-role{display:block;color:#5f6b7a;font-size:.76rem;text-transform:uppercase;letter-spacing:.06em}.staff-name{display:block;margin-top:3px;font-weight:800;color:#111827}
.draft-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px}
.draft-pick{position:relative;padding:13px 76px 13px 18px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc;overflow:hidden;color:#111827;min-height:66px}
.draft-pick::before{content:"";position:absolute;left:0;top:0;bottom:0;width:6px;background:var(--pick-color,#94a3b8);z-index:2}
.draft-pick::after{content:"";position:absolute;right:8px;top:50%;width:58px;height:58px;transform:translateY(-50%);background-image:var(--draft-logo);background-size:contain;background-repeat:no-repeat;background-position:center;opacity:.42;z-index:0;pointer-events:none}
.draft-title,.draft-origin{position:relative;z-index:1}.draft-title{display:block;font-weight:850}.draft-origin{display:block;margin-top:3px;color:#5f6b7a;font-size:.84rem}
.roster-table-wrap{overflow:auto;border:1px solid var(--teams-line);border-radius:14px;background:#fff;box-shadow:var(--teams-shadow);color:#111827}
.roster-table{width:100%;border-collapse:collapse;min-width:760px;background:#fff;color:#111827}
.roster-table th,.roster-table td{padding:12px 14px;border-bottom:1px solid #edf0f4;text-align:left;color:#111827;background:#fff}
.roster-table th{color:#374151;font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;background:#f8fafc}
.roster-table tbody tr:hover td{background:#fafafa}
.roster-table tr:last-child td{border-bottom:0}.player-cell{display:flex;align-items:center;gap:11px}.player-photo{width:44px;height:44px;border-radius:50%;object-fit:cover;background:#eef2f7}.player-link{text-decoration:none;font-weight:800;color:#111827}.player-link:hover{text-decoration:underline}.muted{color:#5f6b7a}
@media(max-width:980px){.divisions-grid{grid-template-columns:1fr}.info-card,.info-card.wide{grid-column:span 6}.team-hero-logo{width:112px;height:112px}}
@media(max-width:640px){.teams-shell,.team-detail-shell{width:min(100% - 20px,1440px);padding-top:18px}.team-hero-content{min-height:auto;align-items:flex-start;flex-direction:column;padding:22px}.team-hero-logo{width:92px;height:92px}.summary-grid{display:block}.info-card{margin-bottom:14px}.staff-grid{grid-template-columns:1fr}.team-index-link{grid-template-columns:48px 1fr;min-height:70px}.team-index-logo{width:44px;height:44px}}

/* =========================================================
   v0.2.1 · ficha de franquicia integrada con Player
   El índice de equipos conserva intactas sus reglas anteriores.
   ========================================================= */
body.team-detail-page{background:var(--bg);color:var(--ink)}
.team-detail-shell{width:min(1440px,calc(100% - 44px));margin:0 auto;padding:18px 0 64px}
.team-toolbar{margin-bottom:12px}
.franchise-hero{min-height:310px;border-radius:24px;overflow:hidden;position:relative;display:grid;grid-template-columns:190px minmax(0,1fr) 235px;align-items:center;background-size:cover;background-position:center;color:#fff;box-shadow:var(--shadow);isolation:isolate}
.franchise-hero::after{content:"";position:absolute;inset:0;background:radial-gradient(circle at 82% 18%,rgba(255,255,255,.16),transparent 30%);z-index:-1}
.franchise-hero__logo{width:155px;height:155px;object-fit:contain;justify-self:center;filter:drop-shadow(0 10px 18px rgba(0,0,0,.34))}
.franchise-hero__copy{padding:28px 12px;min-width:0}
.franchise-hero__copy>p{margin:0 0 8px;text-transform:uppercase;letter-spacing:.14em;font-size:12px;font-weight:800;color:#d8e4f2}
.franchise-hero__copy h1{margin:0 0 22px;font-size:clamp(40px,5vw,68px);line-height:.98;letter-spacing:-.025em;text-shadow:0 3px 14px rgba(0,0,0,.28)}
.franchise-hero__meta{display:flex;flex-wrap:wrap;gap:9px}
.franchise-hero__meta span{min-width:145px;padding:9px 12px;border:1px solid rgba(255,255,255,.24);border-radius:11px;background:rgba(3,14,29,.48);backdrop-filter:blur(4px)}
.franchise-hero__meta small{display:block;margin-bottom:3px;color:#c8d8e8;font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.1em}
.franchise-hero__meta strong{display:block;font-size:13px;line-height:1.3}
.franchise-hero__record{justify-self:center;width:165px;height:165px;border-radius:50%;display:grid;place-items:center;align-content:center;text-align:center;background:rgba(5,20,38,.63);border:2px solid rgba(255,255,255,.55);box-shadow:0 10px 24px rgba(0,0,0,.22);backdrop-filter:blur(5px)}
.franchise-hero__record small{font-size:11px;text-transform:uppercase;letter-spacing:.12em;color:#d7e3ef;font-weight:800}
.franchise-hero__record strong{font-size:40px;line-height:1.05;margin:5px 0}
.franchise-hero__record span{font-size:11px;color:#d7e3ef}
.team-detail-page .team-tabs{display:flex;gap:6px;overflow-x:auto;background:#fff;padding:8px;margin:18px 0;border-radius:14px;box-shadow:0 5px 16px rgba(16,24,40,.06);position:sticky;top:8px;z-index:40}
.team-detail-page .team-tabs button{border:0;background:transparent;padding:10px 15px;border-radius:10px;font-weight:700;color:#596579;cursor:pointer;white-space:nowrap}
.team-detail-page .team-tabs button.is-active{background:var(--navy);color:#fff}
.team-detail-page .team-tabs button[disabled]{opacity:.42;cursor:not-allowed}
.team-detail-page .team-panel{display:none;background:transparent;color:inherit}
.team-detail-page .team-panel.is-active{display:block}
.team-bio-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-bottom:18px}
.team-bio-grid article{position:relative;overflow:hidden;min-height:92px;background:#fff;border:1px solid #e5e9ef;border-radius:14px;padding:16px;box-shadow:0 6px 18px rgba(16,24,40,.055)}
.team-bio-grid article::before{content:"";position:absolute;left:0;top:0;width:100%;height:3px;background:linear-gradient(90deg,var(--blue),var(--gold));opacity:.78}
.team-bio-grid small,.team-metrics span{display:block;color:var(--muted);font-size:10px;margin-bottom:6px;text-transform:uppercase;letter-spacing:.06em;font-weight:800}
.team-bio-grid strong{font-size:17px;line-height:1.25}
.team-dashboard{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;align-items:start}
.team-dashboard .card{margin-bottom:0}
.team-card-full{grid-column:1/-1}
.team-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.team-metrics article{min-height:88px;border:1px solid #e1e6ec;border-radius:14px;padding:14px 15px;background:#fff;display:flex;flex-direction:column;justify-content:center}
.team-metrics strong{font-size:27px;line-height:1.05;color:#0b1f3a}
.team-data-list{display:grid;gap:0;margin:0}
.team-data-list>div{display:flex;justify-content:space-between;gap:18px;padding:11px 2px;border-bottom:1px solid #e8ecf1}
.team-data-list>div:last-child{border-bottom:0}
.team-data-list dt{color:var(--muted)}
.team-data-list dd{margin:0;text-align:right;font-weight:800;color:#0b1f3a}
.team-detail-page .staff-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.team-detail-page .staff-item{background:#f8fafc;border-color:#e1e6ec}
.team-detail-page .draft-grid{grid-template-columns:repeat(auto-fit,minmax(185px,1fr))}
.team-detail-page .draft-pick{background:#f8fafc}
.team-roster-table{min-width:1120px}
.team-roster-table th,.team-roster-table td{vertical-align:middle}
.team-roster-table th:first-child,.team-roster-table td:first-child{text-align:left}
.team-player-cell{display:flex;align-items:center;gap:11px;min-width:210px}
.team-player-cell>span:last-child{display:flex;flex-direction:column;gap:2px}
.team-player-cell small{color:var(--muted);font-size:11px}
.team-player-photo{width:52px;height:52px;flex:0 0 52px;border-radius:50%;overflow:hidden;display:grid;place-items:center;background:#eef2f7;border:1px solid #dfe5ec}
.team-player-photo img{width:100%;height:100%;object-fit:cover;object-position:center top;border-radius:50%}
.team-player-photo--small{width:38px;height:38px;flex-basis:38px}
.team-nationality{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
.team-nationality img{width:24px;height:16px;object-fit:cover;border-radius:2px;box-shadow:0 0 0 1px rgba(15,23,42,.12)}
.team-grade{display:inline-grid;place-items:center;min-width:42px;height:34px;padding:0 8px;border-radius:8px;color:#fff;font-size:16px;font-weight:900;border:2px solid rgba(255,255,255,.7);box-shadow:0 3px 8px rgba(0,0,0,.15)}
.team-grade.grade-green{background:#2e9f5b}.team-grade.grade-blue{background:#2868b2}.team-grade.grade-red{background:#c83f3f}.team-grade.grade-orange{background:#df7b25}.team-grade.grade-yellow{background:#d8b62b;color:#172033}.team-grade.grade-purple{background:#7549a8}.team-grade.grade-black{background:#151515}.team-grade.grade-gray,.team-grade.grade-grey{background:#677281}
.attributes-wrap{max-height:720px}
.attributes-table{min-width:1500px}
.attributes-table th{position:sticky;top:0;z-index:2;text-align:center}
.attributes-table th:first-child{left:0;z-index:4;text-align:left;min-width:225px}
.attributes-table td{text-align:center;font-weight:800}
.attributes-table td:first-child{position:sticky;left:0;z-index:1;background:#fff;text-align:left}
.attributes-table tbody tr:hover td:first-child{background:#f8fafc}
.attributes-player{display:flex;align-items:center;gap:9px}
.attributes-player a{font-weight:800;text-decoration:none;color:#111827}
.attributes-player a:hover{text-decoration:underline}
@media(max-width:1050px){.franchise-hero{grid-template-columns:150px minmax(0,1fr) 190px}.franchise-hero__logo{width:125px;height:125px}.franchise-hero__record{width:140px;height:140px}.team-bio-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:760px){.team-detail-shell{width:calc(100% - 20px);padding-top:10px}.franchise-hero{min-height:390px;grid-template-columns:105px 1fr;align-items:start}.franchise-hero__logo{width:90px;height:90px;margin-top:25px}.franchise-hero__copy{padding:28px 12px 145px 2px}.franchise-hero__copy h1{font-size:40px}.franchise-hero__meta span{min-width:0;padding:7px 9px}.franchise-hero__record{position:absolute;right:18px;bottom:18px;width:125px;height:125px}.franchise-hero__record strong{font-size:31px}.team-bio-grid{grid-template-columns:repeat(2,1fr)}.team-dashboard{grid-template-columns:1fr}.team-card-full{grid-column:auto}.team-detail-page .staff-grid{grid-template-columns:1fr}.team-detail-page .card{padding:15px}.team-metrics strong{font-size:23px}}


/* =========================================================
   v0.2.2 · navegación, logos contextuales y tablas compactas
   ========================================================= */
.division-heading{background:#eef1f5;color:#263447;border-bottom-color:#d7dde5}
.team-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px}
.team-switcher{display:grid;grid-template-columns:minmax(150px,1fr) minmax(220px,320px) minmax(150px,1fr);align-items:center;gap:10px;flex:1;max-width:930px}
.team-nav-arrow{display:flex;align-items:center;gap:7px;min-height:40px;padding:8px 11px;border:1px solid #d5dde7;border-radius:10px;background:#fff;color:#174a7e!important;text-decoration:none;font-weight:800;font-size:12px;box-shadow:0 3px 10px rgba(15,23,42,.05);overflow:hidden}
.team-nav-arrow span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.team-nav-arrow--next{justify-content:flex-end;text-align:right}
.team-nav-arrow:hover{background:#eef4fa;border-color:#b8c9db}
.team-search input{width:100%;height:40px;min-height:40px;box-sizing:border-box;margin:0;border:1px solid #cbd5e1;border-radius:10px;padding:8px 12px;background:#fff;color:#172033;font:inherit;line-height:22px;outline:none}
.team-search input:focus{border-color:#2c6fa5;box-shadow:0 0 0 3px rgba(44,111,165,.13)}
.franchise-hero:not(.has-background) .franchise-hero__logo{filter:drop-shadow(0 10px 18px rgba(0,0,0,.24))}
.staff-profile-link{color:#174a7e!important;text-decoration:none}
.staff-profile-link:hover{text-decoration:underline}
.team-roster-table th:nth-child(6),.team-roster-table td:nth-child(6){text-align:left}
.team-nationality{justify-content:flex-start;text-align:left}
@media(min-width:1101px){
  .attributes-wrap{overflow-x:visible}
  .attributes-table{width:100%;min-width:0;table-layout:fixed;font-size:11px}
  .attributes-table th,.attributes-table td{padding:8px 3px}
  .attributes-table th:first-child{width:170px;min-width:170px}
  .attributes-table th:not(:first-child){width:auto;font-size:9px;letter-spacing:0}
  .attributes-table td:not(:first-child){font-size:12px}
  .attributes-player{gap:6px;min-width:0}
  .attributes-player .team-player-photo--small{width:30px;height:30px;flex-basis:30px}
  .attributes-player a{display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px}
}
@media(max-width:1100px){
  .attributes-table{min-width:1250px}
  .team-switcher{grid-template-columns:44px minmax(190px,1fr) 44px;max-width:520px}
  .team-nav-arrow{justify-content:center;padding:8px}
  .team-nav-arrow span{display:none}
}
@media(max-width:760px){
  .team-toolbar{align-items:stretch;flex-direction:column}
  .team-switcher{width:100%;max-width:none;grid-template-columns:42px minmax(0,1fr) 42px}
  .team-nav-arrow{min-height:42px}
}

/* Importes económicos negativos */
.team-data-list dd .negative-money{
  color:#dc3545;
  font-weight:800;
}


/* Team detail v0.3.0: estadísticas, contratos y calendario */
.team-stats-table,.team-contracts-table,.team-schedule-table{min-width:980px}
.team-stats-table th,.team-stats-table td,.team-contracts-table th,.team-contracts-table td,.team-schedule-table th,.team-schedule-table td{white-space:nowrap}
.team-contracts-table td:not(:first-child),.team-contracts-table th:not(:first-child){text-align:center}
.team-contracts-table .contract-salary{font-weight:850}
.team-contracts-table .contract-option-rookie{color:#2563eb}
.team-contracts-table .contract-option-team{color:#15803d}
.team-contracts-table .contract-option-player{color:#dc2626}
.team-contracts-table tfoot th{background:#eef4fa;border-top:2px solid #bdd0e2;font-weight:800}
.team-schedule-table .schedule-result{font-weight:800}
.team-schedule-table .schedule-result.win{color:#15803d}
.team-schedule-table .schedule-result.loss{color:#dc2626}
.team-schedule-table .boxscore-link{display:inline-flex;padding:.3rem .65rem;border:1px solid #bfd0e1;border-radius:999px;font-size:.78rem;font-weight:750;text-decoration:none}
.team-schedule-table .boxscore-link:hover{background:#eaf2f9}
@media (max-width:760px){.team-tabs{overflow-x:auto;justify-content:flex-start}.team-tabs button{flex:0 0 auto}.team-stats-table,.team-contracts-table,.team-schedule-table{font-size:.78rem}}


/* Team detail v0.3.1: tablas ampliadas */
.team-stats-group{margin-top:14px;border:1px solid #dbe4ee;border-radius:12px;overflow:hidden;background:#fff}
.team-stats-group>summary{cursor:pointer;list-style:none;padding:13px 16px;background:#f6f9fc;color:#173a5e;font-weight:850;user-select:none}
.team-stats-group>summary::-webkit-details-marker{display:none}
.team-stats-group>summary::after{content:'+';float:right;font-size:20px;line-height:1}
.team-stats-group[open]>summary::after{content:'−'}
.team-stats-group .table-wrap{border-top:1px solid #dbe4ee}
.team-stats-table .team-player-cell{min-width:185px}
.team-contracts-table .team-player-cell{min-width:230px}
.team-stats-table .team-player-photo,.team-contracts-table .team-player-photo{width:52px;height:52px;flex-basis:52px}
.team-stats-table .player-link,.team-contracts-table .player-link{font-weight:800;text-decoration:none;color:#111827}
.team-stats-table .player-link:hover,.team-contracts-table .player-link:hover{text-decoration:underline}
.team-stats-table th,.team-stats-table td{padding-left:9px;padding-right:9px}
.team-shooting-table{min-width:1360px}
.team-advanced-table{min-width:1280px}
.team-shooting-table th:nth-child(n+3),.team-shooting-table td:nth-child(n+3){padding-left:6px;padding-right:6px;text-align:center}
.team-shooting-table th:nth-child(3),.team-shooting-table td:nth-child(3),
.team-shooting-table th:nth-child(4),.team-shooting-table td:nth-child(4),
.team-shooting-table th:nth-child(6),.team-shooting-table td:nth-child(6),
.team-shooting-table th:nth-child(7),.team-shooting-table td:nth-child(7),
.team-shooting-table th:nth-child(9),.team-shooting-table td:nth-child(9),
.team-shooting-table th:nth-child(10),.team-shooting-table td:nth-child(10),
.team-shooting-table th:nth-child(12),.team-shooting-table td:nth-child(12),
.team-shooting-table th:nth-child(13),.team-shooting-table td:nth-child(13),
.team-shooting-table th:nth-child(15),.team-shooting-table td:nth-child(15),
.team-shooting-table th:nth-child(16),.team-shooting-table td:nth-child(16){width:48px}
.team-advanced-table th:not(:first-child),.team-advanced-table td:not(:first-child){padding-left:6px;padding-right:6px;text-align:center}
.team-advanced-table th:nth-child(3),.team-advanced-table td:nth-child(3),
.team-advanced-table th:nth-child(4),.team-advanced-table td:nth-child(4){width:52px}
.team-contracts-table{min-width:1280px}
.team-contracts-table .contract-player-total{font-weight:850;background:#f8fafc}
.team-contracts-table tfoot tr+tr th{border-top:1px solid #d8e2ec}
.team-contracts-table tfoot .contract-grand-total th{background:#dfeaf5;color:#102d4a;border-top:2px solid #9db7cf}
.team-contracts-table tfoot th:not(:first-child){white-space:nowrap}

/* =========================================================
   Team detail v0.4.0 · lesionados, finanzas y staff
   ========================================================= */
.empty-team-state{padding:20px;border:1px dashed #cbd5e1;border-radius:12px;background:#f8fafc;color:#64748b;font-weight:700;text-align:center}
.injury-wrap{max-height:360px}
.team-injury-table{width:100%;min-width:560px}
.team-injury-table th,.team-injury-table td{white-space:nowrap}
.team-injury-table .team-player-cell{min-width:210px}

.team-finance-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.team-finance-grid .team-card-full{grid-column:1/-1}
.team-data-list--finance dd{font-weight:850}
.exception-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.exception-grid article{display:flex;flex-direction:column;gap:5px;padding:16px;border:1px solid #dbe4ee;border-radius:12px;background:#f8fafc}
.exception-grid article>span{font-size:12px;color:#64748b;font-weight:750;text-transform:uppercase;letter-spacing:.03em}
.exception-grid article>strong{font-size:23px;color:#102d4a}
.exception-status{display:inline-flex;align-self:flex-start;padding:4px 8px;border-radius:999px;background:#e7eef6;color:#174a7e;font-weight:800}
.exception-detail{font-size:12px;color:#64748b}
.finance-attendance{grid-template-columns:repeat(4,1fr)}
.finance-pending{border-style:dashed}

.team-staff-table{min-width:1220px}
.team-staff-table th,.team-staff-table td{white-space:nowrap;text-align:center}
.team-staff-table th:first-child,.team-staff-table td:first-child{text-align:left}
.team-staff-table td:last-child{text-align:left;white-space:normal;min-width:250px}
.staff-person{display:flex;flex-direction:column;gap:2px;min-width:170px}
.staff-person strong{font-size:14px;color:#111827}
.staff-person small{font-size:11px;color:#64748b}
.staff-rating{font-weight:850;color:#173a5e}
.staff-history summary{cursor:pointer;color:#174a7e;font-weight:800;white-space:nowrap}
.staff-career-summary{display:grid;grid-template-columns:repeat(4,minmax(70px,1fr));gap:6px;margin-top:10px}
.staff-career-summary span{padding:7px 8px;border-radius:8px;background:#f1f5f9;color:#64748b;font-size:11px}
.staff-career-summary strong{display:block;color:#172033;font-size:13px}
.staff-history-list{display:grid;gap:4px;margin-top:8px}
.staff-history-list>div{display:grid;grid-template-columns:55px 90px minmax(100px,1fr);gap:8px;font-size:11px;color:#475569}
.staff-history-list>div span:first-child{font-weight:800;color:#172033}
.staff-rating-note{margin:12px 0 0;color:#64748b;font-size:12px}

@media(max-width:760px){
  .team-finance-grid{grid-template-columns:1fr}
  .team-finance-grid .team-card-full{grid-column:auto}
  .exception-grid{grid-template-columns:1fr}
  .finance-attendance{grid-template-columns:repeat(2,1fr)}
  .team-staff-table{font-size:.76rem}
}

/* Team detail v0.4.1 · lesiones, excepciones y total de staff */
.team-injury-table tr.injury-day-to-day .injury-diagnosis,
.team-injury-table tr.injury-day-to-day .injury-duration{color:#c65f00;font-weight:800}
.team-injury-table tr.injury-out .injury-diagnosis,
.team-injury-table tr.injury-out .injury-duration{color:#c62828;font-weight:800}
.exception-status--available{background:#dcfce7;color:#166534}
.exception-status--partial{background:#ffedd5;color:#9a3412}
.exception-status--used,.exception-status--unavailable{background:#fee2e2;color:#991b1b}
.staff-total{display:flex;justify-content:flex-end;align-items:center;gap:14px;margin-top:14px;padding:12px 14px;border-top:1px solid #e2e8f0;font-size:13px;color:#64748b}
.staff-total strong{font-size:18px;color:#172033}

.exception-status--unknown{background:#e2e8f0;color:#475569}


/* Teams v0.4.3 · ratings visuales sin publicar letras/números */
.team-grade{
  min-width:28px;width:28px;height:28px;padding:0;border-radius:7px;
  font-size:0;color:transparent;
}
.staff-rating{vertical-align:middle}
.staff-color-box{display:inline-block;width:27px;height:27px;border-radius:7px;border:2px solid rgba(255,255,255,.82);box-shadow:0 2px 7px rgba(15,23,42,.18)}
.staff-color-a{background:#2868b2}
.staff-color-b{background:#2e9f5b}
.staff-color-c{background:#d8b62b}
.staff-color-d{background:#df7b25}
.staff-color-f{background:#c83f3f}
.staff-color-unknown{background:#94a3b8}
.staff-module-link{display:inline-flex;margin-top:10px;font-weight:850;color:#174a7e;text-decoration:none}
.staff-module-link:hover{text-decoration:underline}
/* Teams v0.5.0 */
.team-season-info-table{min-width:900px}.team-season-info-table th:not(:first-child),.team-season-info-table td:not(:first-child){text-align:right}.team-finance-balance dd{font-weight:800}

/* Teams v0.5.1 · métricas avanzadas en Season Info */
.team-season-advanced-card{margin-top:16px}
.team-season-advanced-table{width:100%;border-collapse:collapse}
.team-season-advanced-table th,.team-season-advanced-table td{padding:10px 12px;border-bottom:1px solid #e5eaf0;text-align:center;white-space:nowrap}
.team-season-advanced-table th:first-child,.team-season-advanced-table td:first-child{text-align:left}

/* Historia v0.6.0 */
.history-summary-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:14px;margin-bottom:18px}
.history-stat{padding:18px}
.history-stat span{display:block;font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted,#687789);font-weight:700}
.history-stat strong{display:block;font-size:1.65rem;margin-top:6px}
.history-stat small{display:block;margin-top:3px;color:var(--muted,#687789)}
.history-detail-grid{display:grid;grid-template-columns:1fr 1.35fr;gap:18px;margin-top:18px}
.team-history-table th,.team-history-table td{white-space:nowrap}
.team-history-table td:nth-child(2){font-weight:600}
.history-badge{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-size:.72rem;font-weight:800}
.history-badge--division{background:#e8f1ff;color:#164b8c}
@media(max-width:1100px){.history-summary-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:720px){.history-summary-grid{grid-template-columns:repeat(2,1fr)}.history-detail-grid{grid-template-columns:1fr}}

.history-division-star{font-weight:900;font-size:.92rem;vertical-align:baseline}

.team-draft-history-table td,.team-draft-history-table th{vertical-align:middle}
.team-draft-history-table .attributes-player{min-width:190px}
.team-draft-history-table a{text-decoration:none;color:inherit}
.team-draft-history-table .team-nationality img{width:24px;height:24px;object-fit:contain}

/* Fotos históricas en la pestaña Draft del equipo. */
.team-draft-history-table .team-player-photo{
  width:46px;
  height:46px;
  min-width:46px;
  border-radius:50%;
  overflow:hidden;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.team-draft-history-table .team-player-photo img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center top;
  display:block;
}

/* Ajuste exclusivo para fotos históricas JPG de 90x65. */
.team-draft-history-table .team-player-photo--small-jpg{
  width:46px;
  height:46px;
  min-width:46px;
  border-radius:50%;
  overflow:hidden;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.team-draft-history-table .team-player-photo--small-jpg img{
  width:36px;
  height:36px;
  object-fit:contain;
  object-position:center;
  border-radius:50%;
  display:block;
}

.team-draft-history-table th:nth-child(4),
.team-draft-history-table td:nth-child(4),
.team-draft-history-table th:nth-child(5),
.team-draft-history-table td:nth-child(5){
  text-align:left !important;
}


/* =========================================================
   v0.9.6 · Vista móvil unificada de Plantilla
   ========================================================= */
.mobile-roster-cards{display:none}

@media(max-width:760px){
  /* En móvil, Atributos y Contratos pasan dentro de Plantilla. */
  .desktop-only-team-tab{display:none!important}
  .desktop-roster-table{display:none!important}
  .mobile-roster-cards{
    display:grid;
    gap:12px;
  }

  .mobile-player-card{
    border:1px solid #dde4ed;
    border-radius:14px;
    background:#fff;
    box-shadow:0 4px 14px rgba(15,23,42,.05);
    overflow:hidden;
  }
  .mobile-player-head{
    display:grid;
    grid-template-columns:52px minmax(0,1fr) auto;
    gap:10px;
    align-items:center;
    padding:12px;
    background:#f8fafc;
    border-bottom:1px solid #e8edf3;
  }
  .mobile-player-title{
    min-width:0;
    display:grid;
    gap:3px;
  }
  .mobile-player-title a{
    color:#111827;
    font-weight:900;
    text-decoration:none;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .mobile-player-title span{
    color:#64748b;
    font-size:11px;
    font-weight:700;
  }
  .mobile-rating-pair{
    display:flex;
    gap:6px;
  }
  .mobile-rating-pair>span{
    display:grid;
    justify-items:center;
    gap:3px;
  }
  .mobile-rating-pair small{
    color:#64748b;
    font-size:8px;
    font-weight:900;
    letter-spacing:.05em;
  }
  .mobile-rating-pair .team-grade{
    min-width:24px;
    width:24px;
    height:24px;
    padding:0;
    border-width:1px;
    border-radius:6px;
  }

  .mobile-player-facts{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    border-bottom:1px solid #edf0f4;
  }
  .mobile-player-facts>span{
    display:grid;
    gap:2px;
    padding:9px 12px;
    border-right:1px solid #edf0f4;
    border-bottom:1px solid #edf0f4;
  }
  .mobile-player-facts>span:nth-child(even){border-right:0}
  .mobile-player-facts>span:nth-last-child(-n+2){border-bottom:0}
  .mobile-player-facts small,
  .mobile-section-label{
    color:#64748b;
    font-size:9px;
    font-weight:900;
    letter-spacing:.06em;
    text-transform:uppercase;
  }
  .mobile-player-facts strong{
    color:#172033;
    font-size:13px;
  }

  .mobile-player-contracts{
    padding:10px 12px 8px;
  }
  .mobile-section-label{margin-bottom:6px}
  .mobile-contract-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    min-height:29px;
    padding:3px 0;
    border-top:1px solid #f0f2f5;
    font-size:12px;
  }
  .mobile-contract-row:first-of-type{border-top:0}
  .mobile-contract-row span{color:#526071;font-weight:800}
  .mobile-contract-row strong{font-size:12px}

  .mobile-player-attributes{
    border-top:1px solid #e8edf3;
  }
  .mobile-player-attributes summary{
    cursor:pointer;
    list-style:none;
    padding:10px 12px;
    color:#174a7e;
    font-size:12px;
    font-weight:900;
  }
  .mobile-player-attributes summary::-webkit-details-marker{display:none}
  .mobile-player-attributes summary::after{
    content:"+";
    float:right;
    font-size:16px;
    line-height:12px;
  }
  .mobile-player-attributes[open] summary::after{content:"−"}
  .mobile-attribute-head,
  .mobile-attribute-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) 46px 46px;
    gap:6px;
    align-items:center;
    padding:6px 12px;
  }
  .mobile-attribute-head{
    background:#eef3f8;
    color:#526071;
    font-size:9px;
    font-weight:900;
    text-transform:uppercase;
  }
  .mobile-attribute-head strong,
  .mobile-attribute-row strong{text-align:center}
  .mobile-attribute-row{
    border-top:1px solid #edf0f4;
    font-size:11px;
  }
  .mobile-attribute-row span{color:#526071;font-weight:700}
  .mobile-attribute-row strong{
    color:#172033;
    font-size:12px;
  }
}

/* v0.12.8 - bandera circular en Plantilla de Team */
.team-roster-table .team-nationality img,
.mobile-roster-cards .team-nationality img {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  aspect-ratio: 1 / 1;
  border-radius: 50% !important;
  object-fit: contain !important;
  box-shadow: none;
  flex-shrink: 0;
}


/* v0.18.16 · tablas ordenables en ficha de equipo */
.team-table-sort{
  width:100%;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:3px;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  font-weight:800;
  text-transform:inherit;
  letter-spacing:inherit;
  padding:0;
  cursor:pointer;
  white-space:nowrap;
}
.team-table-sort:hover,
.team-table-sort.is-active{color:#174a7e}
.table-sort-indicator{min-width:12px;color:#2563eb;font-size:.7rem}
.attributes-table th:not(:first-child) .team-table-sort,
.team-contracts-table th:not(:first-child) .team-table-sort,
.team-history-table th:not(:first-child) .team-table-sort{
  justify-content:center;
}
