:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #e8743b;
  --accent-ink: #ffffff;
  --accent-soft: #fdf0e9;
  --blue: #2b6cb8;
  --side: #0f1b2d;
  --side-text: #c7d2e1;
  --side-active: #1b2c45;
  --win: #16a34a; --win-bg: #dcfce7;
  --draw: #b45309; --draw-bg: #fef3c7;
  --loss: #dc2626; --loss-bg: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #121b2c; --surface-2: #172236; --text: #e5ecf5; --muted: #8fa1b8; --border: #24324a;
    --accent-soft: #3a2418; --side: #070d18; --side-active: #142238;
    --win-bg: #12341f; --draw-bg: #3a2c0c; --loss-bg: #3d1515;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.55rem; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; }
h3 { font-size: .98rem; }
p { margin: .3em 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.pre { white-space: pre-wrap; }
.loading { padding: 40px; color: var(--muted); }
.spacer { flex: 1; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #2b6cb833, transparent), radial-gradient(900px 500px at 110% 110%, #e8743b33, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 18px 0 6px; font-size: 1.3rem; }
.stack { display: grid; gap: 12px; margin-top: 14px; }
.form-error { color: var(--loss); min-height: 1em; margin: 0; font-size: .9rem; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand strong { display: block; color: #fff; font-size: .98rem; }
.brand small { color: var(--side-text); opacity: .7; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.brand.big strong { color: var(--text); font-size: 1.1rem; }
.brand.big small { color: var(--muted); }
.logo { display: inline-flex; }
.team-pick { padding: 10px 8px 14px; border-bottom: 1px solid #ffffff14; margin-bottom: 10px; }
.team-pick small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-bottom: 5px; }
.team-select { width: 100%; background: #ffffff10; color: #fff; border: 1px solid #ffffff22; border-radius: 8px; padding: 7px 8px; font: inherit; }
.team-select option { color: #000; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--side-text); font-weight: 500; }
.nav a:hover { background: #ffffff0d; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.me { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 4px; border-top: 1px solid #ffffff14; }
.me strong { display: block; color: #fff; font-size: .9rem; }
.me small { opacity: .7; font-size: .78rem; }
.me .icon-btn { color: var(--side-text); }
.content { min-width: 0; }
.main { padding: 26px 30px 60px; max-width: 1280px; margin: 0 auto; }
.mobile-bar { display: none; }
.scrim { display: none; }
.row { display: flex; gap: 4px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: #0006; z-index: 40; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 30; }
  .mobile-bar .icon-btn { color: #fff; }
  .main { padding: 18px 16px 50px; }
}

/* ---------- Componentes ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.back:hover { color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card h2 { margin-bottom: 10px; }
.card h3 { margin: 6px 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 .card { margin: 0; }
.grid-2 + * { margin-top: 16px; }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.link-card { text-decoration: none; transition: border-color .15s, transform .15s; margin: 0; }
.link-card:hover { border-color: var(--accent); transform: translateY(-1px); }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #94a3b8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 10px; font-size: .86rem; border-radius: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--loss); border-color: var(--loss); color: #fff; }
.btn.ghost-danger { color: var(--loss); }
.btn.ghost-danger:hover { border-color: var(--loss); background: var(--loss-bg); }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 1rem; }
.icon-btn:hover { background: #94a3b822; color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; font-size: .9rem; }
.icon-btn.danger:hover { color: var(--loss); background: var(--loss-bg); }
.icon-btn:disabled { opacity: .3; cursor: default; }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; width: 100%; }
input[type=color] { padding: 2px; width: 44px; height: 34px; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
input[type=search] { min-width: 220px; }
.field { display: grid; gap: 5px; font-size: .88rem; }
.field > span { color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; }
.field.check { display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; }
.field.check > span { color: var(--text); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-section { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }
.form-section:empty { display: none; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); margin-left: 6px; vertical-align: middle; }
.tag.anim { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tags .tag:first-child { margin-left: 0; }
.badge { display: inline-block; min-width: 22px; text-align: center; padding: 2px 8px; border-radius: 99px; font-size: .76rem; font-weight: 700; }
.badge.win { background: var(--win-bg); color: var(--win); }
.badge.draw { background: var(--draw-bg); color: var(--draw); }
.badge.loss { background: var(--loss-bg); color: var(--loss); }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 24px 12px; display: grid; gap: 10px; justify-items: center; }
.switch { display: inline-flex; gap: 7px; align-items: center; font-size: .86rem; color: var(--muted); cursor: pointer; }

/* Tablas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }
.tbl.compact td, .tbl.compact th { padding: 6px 8px; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sorted { color: var(--accent); }
.stats-grid td { padding: 5px 6px; }
.stats-grid tr.dim td { opacity: .45; }
.num-in { width: 50px; padding: 5px 6px; text-align: right; }
.counter { min-width: 40px; height: 32px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; color: var(--muted); }
.counter.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.counter:active { transform: scale(.94); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: grid; gap: 2px; box-shadow: var(--shadow); }
.kpi-v { font-size: 1.65rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi-l { color: var(--muted); font-size: .82rem; font-weight: 600; }
.kpi.win .kpi-v { color: var(--win); } .kpi.draw .kpi-v { color: var(--draw); } .kpi.loss .kpi-v { color: var(--loss); }
a.kpi:hover { border-color: var(--accent); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border: 0; }
.list a { text-decoration: none; }
.list a:hover strong { color: var(--accent); }
.steps { padding-left: 20px; margin: 4px 0 14px; display: grid; gap: 4px; }

/* Equipos */
.team-cards { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.team-card { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; cursor: pointer; font: inherit; color: inherit; min-width: 180px; }
.team-card .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--tc); grid-row: span 2; }
.team-card small { color: var(--muted); }
.team-card.active { border-color: var(--tc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 30%, transparent); }

/* Partido */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; background: linear-gradient(135deg, #0f1b2d, #1d3557); color: #fff; border-radius: 16px; padding: 22px; margin-bottom: 14px; }
.sb-team { font-weight: 700; font-size: 1.15rem; text-align: center; }
.sb-score { font-size: 2.4rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; display: grid; }
.sb-score small { font-size: .78rem; font-weight: 500; opacity: .75; }
.sb-meta { grid-column: 1 / -1; text-align: center; opacity: .75; font-size: .88rem; }

/* Clasificación */
.standings .pos { font-weight: 800; width: 40px; }
.standings .pts { font-weight: 800; font-size: 1rem; }
.standings tr.own td { background: var(--accent-soft); }
.form-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; font-weight: 800; font-size: .8rem; }
.chip.sm { width: 20px; height: 20px; font-size: .68rem; border-radius: 5px; }
.chip.win { background: var(--win); color: #fff; } .chip.draw { background: #d97706; color: #fff; } .chip.loss { background: var(--loss); color: #fff; }
.rounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.rounds .card { margin: 0; }
@media (max-width: 420px) { .rounds { grid-template-columns: 1fr; } }
.fixture { display: grid; grid-template-columns: 1fr 48px 10px 48px 1fr 28px; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.fixture:last-child { border: 0; }
.fixture.own { font-weight: 700; }
.fx-home { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-away { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-sep { text-align: center; color: var(--muted); }
.goal-in { width: 48px; text-align: center; padding: 5px 2px; font-weight: 700; }

/* Barras */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 110px; gap: 10px; align-items: center; font-size: .9rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 100px 1fr 80px; } }

/* Planificación */
.timeline { padding: 14px 18px; }
.tl-track { position: relative; height: 34px; background: var(--surface-2); border-radius: 8px; }
.tl-seg { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; color: #fff; font-size: .76rem; font-weight: 700; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; }
.tl-seg.c0 { background: #2b6cb8; } .tl-seg.c1 { background: #e8743b; } .tl-seg.c2 { background: #16a34a; } .tl-seg.c3 { background: #8e4ec6; } .tl-seg.c4 { background: #0891b2; }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--loss); }
.tl-labels { display: flex; justify-content: space-between; margin-top: 6px; }
.meso h2 .tag { font-size: .74rem; }
.micros { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.micro { border: 1px solid var(--border); border-left: 4px solid #94a3b8; border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.micro.load-baja { border-left-color: #22c55e; } .micro.load-media { border-left-color: #eab308; } .micro.load-alta { border-left-color: #f97316; } .micro.load-muy-alta { border-left-color: #dc2626; }
.micro-head { display: flex; justify-content: space-between; gap: 6px; }
.micro-head .tag { margin-left: 4px; }
.micro .actions { gap: 0; flex-wrap: nowrap; align-items: flex-start; }
.sess-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.sess-list a { display: grid; grid-template-columns: auto 1fr; min-width: 0; gap: 8px; text-decoration: none; padding: 6px 8px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border); font-size: .88rem; align-items: center; }
.sess-list a:hover { border-color: var(--accent); }
.sess-list a > :last-child { grid-column: 2; }
.micro { min-width: 0; }
.sess-date { font-weight: 700; color: var(--accent); font-size: .8rem; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 4px; min-width: 780px; }
.cal-h { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding: 4px; }
.cal-d { min-height: 104px; border: 1px solid var(--border); border-radius: 8px; padding: 5px; display: flex; flex-direction: column; gap: 3px; position: relative; background: var(--surface); }
.cal-d.out { background: transparent; border-style: dashed; opacity: .4; }
.cal-d.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-n { font-size: .8rem; font-weight: 700; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.cal-micro { font-size: .66rem; background: var(--surface-2); border: 1px solid var(--border); padding: 0 5px; border-radius: 5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev { font-size: .76rem; text-decoration: none; padding: 2px 6px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-ev.sess { background: #2b6cb81f; color: var(--blue); }
.cal-ev.match { background: var(--accent-soft); color: var(--accent); }
.cal-add { position: absolute; right: 4px; top: 3px; border: 0; background: transparent; color: var(--muted); cursor: pointer; opacity: 0; font-size: 1rem; }
.cal-d:hover .cal-add, .cal-add:focus { opacity: 1; }
@media (hover: none) { .cal-add { opacity: .7; } }

/* Sesión */
.info-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.info-strip > div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; display: grid; }
.info-strip small { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.time-bar { height: 6px; background: var(--surface-2); border-radius: 99px; margin: -4px 0 14px; overflow: hidden; }
.time-bar span { display: block; height: 100%; background: var(--win); }
.time-bar span.over { background: var(--loss); }
.sess-item { display: grid; grid-template-columns: 32px 220px 1fr auto; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); align-items: start; }
.si-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.si-thumb { width: 100%; height: auto; border-radius: 8px; display: block; }
.si-body { display: grid; gap: 6px; min-width: 0; }
.si-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.si-actions { display: flex; flex-direction: column; }
.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.thumb-empty { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: .8rem; aspect-ratio: 1.9; }
.thumb-empty.sm { width: 120px; }
@media (max-width: 760px) { .sess-item { grid-template-columns: 30px 1fr; } .sess-item > a { grid-column: 2; } .si-body { grid-column: 2; } .si-actions { grid-column: 2; flex-direction: row; } }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.att { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; }
.att select { padding: 4px 6px; }
.pick-list { display: grid; gap: 6px; max-height: 55vh; overflow-y: auto; margin-top: 10px; }
.pick { display: grid; grid-template-columns: auto 120px 1fr; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.pick canvas { width: 120px; height: auto; border-radius: 6px; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Biblioteca */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ex-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.ex-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.ex-thumb { width: 100%; height: auto; display: block; }
.ex-card .thumb-empty { border-radius: 0; border: 0; }
.ex-body { padding: 10px 12px 12px; display: grid; gap: 6px; }

/* ---------- Pizarra ---------- */
.board-card { padding: 12px; }
.board-editor { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.board-editor.ro { grid-template-columns: 1fr; }
.be-tools { display: grid; gap: 10px; align-content: start; }
.be-glabel { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.be-gbtns { display: grid; gap: 3px; }
.be-tool { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid transparent; background: transparent; color: var(--text); padding: 5px 7px; border-radius: 7px; cursor: pointer; font: inherit; font-size: .84rem; text-align: left; }
.be-tool:hover { background: var(--surface-2); }
.be-tool.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.be-tool .glyph { width: 18px; text-align: center; font-size: 1rem; line-height: 1; }
.be-main { min-width: 0; display: grid; gap: 10px; }
.be-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.be-top select { padding: 6px 8px; font-size: .86rem; }
.be-props { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.be-props select { padding: 5px 6px; font-size: .84rem; }
.be-stage { width: 100%; display: flex; justify-content: center; }
.be-canvas { border-radius: 10px; touch-action: none; box-shadow: 0 2px 10px rgba(0,0,0,.15); display: block; }
.be-anim { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.be-scrub { flex: 1; min-width: 140px; accent-color: var(--accent); padding: 0; border: 0; }
.be-time { font-variant-numeric: tabular-nums; min-width: 92px; }
.be-frames { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; align-items: flex-start; }
.be-frame { display: grid; gap: 4px; justify-items: center; flex: none; }
.be-fbtn { position: relative; padding: 0; border: 2px solid var(--border); border-radius: 8px; background: none; cursor: pointer; overflow: hidden; display: block; }
.be-frame.active .be-fbtn { border-color: var(--accent); }
.be-thumb { display: block; width: 120px; height: auto; }
.be-fnum { position: absolute; left: 4px; top: 3px; background: #000a; color: #fff; font-size: .7rem; font-weight: 700; padding: 0 5px; border-radius: 4px; }
.be-durl { font-size: .75rem; display: inline-flex; gap: 3px; align-items: center; color: var(--muted); }
.be-dur { width: 52px; padding: 2px 4px; font-size: .78rem; }
.be-frame-actions { display: grid; gap: 5px; flex: none; align-self: center; }
.be-hint { margin: 0; }
@media (max-width: 760px) {
  .board-editor { grid-template-columns: 1fr; }
  .be-tools { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .be-gbtns { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
  .be-tool .tl { display: none; }
  .be-tool { justify-content: center; padding: 7px; }
}

/* Modales y avisos */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px; }
.modal-body { padding: 10px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-weight: 600; font-size: .9rem; transition: opacity .3s, transform .3s; max-width: 360px; }
.toast.error { background: var(--loss); }
.toast.out { opacity: 0; transform: translateY(6px); }
.roles-help { margin-top: 14px; }

/* Importación */
.imp-step { display: flex; gap: 14px; align-items: flex-start; }
.imp-step h2 { margin-bottom: 4px; }
.imp-step .actions { margin-top: 12px; }
.imp-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.dropzone { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 28px 16px; margin-top: 12px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.imp-file { margin: 18px 0 10px; }
.imp-msgs { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; font-size: .9rem; }
.imp-det { margin: 10px 0; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.imp-det summary { cursor: pointer; font-weight: 700; }
.imp-msg { white-space: normal; color: var(--loss); font-size: .84rem; min-width: 220px; }
.imp-confirm { margin-top: 14px; }
.imp-done { margin-top: 16px; padding: 16px; border-radius: 10px; background: var(--win-bg); }
.imp-done h3 { color: var(--win); }
@media (max-width: 560px) { .imp-step { flex-direction: column; } }

/* Imágenes de diagrama e importación PDF */
.diagram-img { display: block; width: 100%; height: auto; aspect-ratio: 1.66; object-fit: contain; background: var(--surface-2); }
.ex-card .diagram-img { border-radius: 0; }
.si-thumb.diagram-img { border-radius: 8px; }
.pick .pick-thumb { width: 120px; height: auto; border-radius: 6px; }
.pick .thumb-empty.pick-thumb { aspect-ratio: 1.66; font-size: .7rem; }
.diagram-full { display: block; max-width: 100%; max-height: 60vh; margin: 6px auto 0; border-radius: 10px; }
.imp-opts { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.imp-opts select { margin-left: 4px; }
.imp-progress { display: grid; gap: 4px; margin-top: 12px; }
.imp-progress progress { width: 100%; accent-color: var(--accent); }
.imp-n { font-size: .8rem; }
.imp-pdf-link { display: block; margin-bottom: 16px; border-color: var(--accent); background: var(--accent-soft); }
.pdf-rows { display: grid; gap: 8px; }
.pdf-row { display: grid; grid-template-columns: auto 190px 1fr auto; gap: 12px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.pdf-row.off { opacity: .5; }
.pdf-thumb { width: 190px; height: auto; border-radius: 8px; display: block; }
.pdf-info { display: grid; gap: 5px; min-width: 0; }
.pdf-title { font-weight: 700; width: 100%; }
.pdf-detail dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 14px 0 0; font-size: .9rem; }
.pdf-detail dt { font-weight: 700; color: var(--muted); }
.pdf-detail dd { margin: 0; }
@media (max-width: 700px) { .pdf-row { grid-template-columns: auto 1fr; } .pdf-thumb { width: 100%; grid-column: 2; } .pdf-info, .pdf-row .si-actions { grid-column: 2; } .pdf-detail dl { grid-template-columns: 1fr; } }

/* ---------- v3: plantilla visual, sesión completa, carga, agenda, presentación ---------- */
.avatar { border-radius: 50%; object-fit: cover; object-position: top; flex: none; background: var(--surface-2); display: inline-block; vertical-align: middle; }
.avatar.ini { display: inline-grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); color: var(--accent); font-weight: 800; }
.crest { object-fit: contain; flex: none; vertical-align: middle; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.tag.warn { background: var(--draw-bg); color: var(--draw); border-color: transparent; }
.team-card { grid-template-columns: auto 1fr; }
.team-card .crest { grid-row: span 2; }
.team-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; border-top: 4px solid var(--tc); }
.team-head .crest { width: 64px; height: 64px; }
.team-dot-big { width: 48px; height: 48px; border-radius: 50%; background: var(--tc); flex: none; }
.team-head-info { flex: 1; min-width: 220px; }
.team-head-info p { margin: 2px 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.player-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.player-card { position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; cursor: pointer; font: inherit; color: inherit; text-align: center; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.player-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.pc-photo { margin-bottom: 4px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border); }
.pc-num { position: absolute; top: 8px; left: 12px; font-size: 1.5rem; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.pc-name { font-size: .98rem; line-height: 1.2; }
.pc-pos { font-size: .8rem; color: var(--muted); font-weight: 600; }
.player-card.staff .pc-pos { color: var(--accent); }
.player-dialog { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: start; }
@media (max-width: 600px) { .player-dialog { grid-template-columns: 1fr; } }
.media-ctl { display: grid; gap: 8px; justify-items: center; text-align: center; }
.media-prev { width: 150px; height: 150px; border-radius: 12px; border: 1px dashed var(--border); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.media-ctl.round .media-prev { border-radius: 50%; }
.media-prev img { width: 100%; height: 100%; object-fit: contain; }
.media-ctl.round .media-prev img { object-fit: cover; object-position: top; }
.media-info .actions { justify-content: center; margin-top: 4px; }
.media-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.out-players summary { cursor: pointer; font-weight: 700; }
.day-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.day-pick .day { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); display: grid; place-items: center; font-weight: 800; cursor: pointer; color: var(--muted); user-select: none; }
.day-pick .day input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick .day.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-pick .day:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.season-players { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; }
.season-players h3 { margin: 10px 0 2px; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.check-row { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 7px; cursor: pointer; }
.check-row:hover { background: var(--surface-2); }
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lists-grid .card { margin: 0; }
.lists-grid textarea { font-size: .9rem; line-height: 1.55; }

/* Planificación y sesión */
.rival-line { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; }
.rival { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-size: .84rem; font-weight: 600; }
.rival:hover { border-color: var(--accent); }
.rival-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.sess-n { color: var(--accent); font-size: .8rem; }
.info-strip > div { gap: 1px; }
.lock-banner { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--draw-bg); color: var(--draw); font-weight: 600; margin-bottom: 14px; }
.block-head { display: flex; align-items: center; gap: 4px; margin: 14px 0 0; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border-left: 4px solid var(--accent); }
.block-head strong { text-transform: uppercase; font-size: .82rem; letter-spacing: .04em; }
.block-head .icon-btn { margin-left: auto; }
.att-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mini-kpi { display: grid; padding: 8px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); min-width: 110px; }
.mini-kpi strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.mini-kpi span { font-size: .76rem; color: var(--muted); font-weight: 600; }
.att-table td { padding: 5px 8px; }
.att-table tr.dim td { opacity: .55; }
.att-table select { padding: 4px 6px; }

/* Carga */
.wk-chart { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 10px; overflow-x: auto; }
.wk-col { flex: 1; min-width: 44px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.wk-bar { width: 70%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 2px; }
.wk-val { font-size: .74rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.wk-lbl { font-size: .72rem; color: var(--muted); }
.load-tbl th.wk { font-size: .68rem; }
.load-tbl td.heat { background: color-mix(in srgb, var(--accent) calc(var(--a) * 70%), transparent); font-size: .82rem; }

/* Agenda */
.agenda-teams { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.team-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 12px; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); }
.team-chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tc); }
.team-chip.off { opacity: .45; text-decoration: line-through; }
.agenda-ev { background: color-mix(in srgb, var(--tc) 16%, transparent) !important; color: var(--text) !important; border-left: 3px solid var(--tc); white-space: nowrap; }
.agenda-ev.match { font-weight: 800; }
.week-list { display: grid; gap: 8px; }
.week-day { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.week-day.today { border-color: var(--accent); }
.week-day strong { text-transform: capitalize; }
.week-evs { display: grid; gap: 4px; }
.week-evs .cal-ev { white-space: normal; }
@media (max-width: 600px) { .week-day { grid-template-columns: 1fr; } }

/* Modo presentación */
.presentation { position: fixed; inset: 0; z-index: 150; background: #0b1220; color: #e5ecf5; display: grid; grid-template-rows: auto 1fr; outline: none; }
.pr-top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: #070d18; flex-wrap: wrap; }
.pr-title { flex: 1; display: grid; min-width: 200px; }
.pr-title span { opacity: .65; font-size: .85rem; }
.pr-btn { display: inline-flex; align-items: center; gap: 6px; background: #ffffff12; border: 1px solid #ffffff22; color: #fff; border-radius: 8px; padding: 7px 12px; font: inherit; cursor: pointer; }
.pr-btn:hover { background: #ffffff22; }
.pr-count { font-variant-numeric: tabular-nums; opacity: .7; }
.pr-clock { font: inherit; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; background: none; border: 0; color: #3dd68c; cursor: pointer; min-width: 80px; }
.pr-clock.over { color: #ff6b6b; }
.pr-stage { overflow: auto; padding: 18px 70px; display: grid; }
.pr-task { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 24px; align-items: start; height: 100%; }
.pr-diagram { min-height: 300px; height: calc(100vh - 120px); display: grid; place-items: center; }
.pr-diagram img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }
.pr-diagram canvas { border-radius: 10px; }
.pr-empty { opacity: .5; }
.pr-info { overflow-y: auto; max-height: calc(100vh - 120px); padding-right: 6px; }
.pr-info h1 { font-size: 2rem; margin: 6px 0; }
.pr-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pr-tags span { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: 900; }
.pr-tags em { font-style: normal; padding: 3px 10px; border-radius: 99px; background: #ffffff14; font-size: .85rem; }
.pr-meta { opacity: .75; font-size: 1.05rem; text-transform: none; }
.pr-sec h3 { color: var(--accent); text-transform: uppercase; font-size: .85rem; letter-spacing: .06em; margin: 16px 0 4px; }
.pr-sec p { white-space: pre-wrap; font-size: 1.12rem; line-height: 1.5; margin: 0; }
.pr-cover { max-width: 900px; margin: auto; display: grid; gap: 10px; }
.pr-cover h1 { font-size: 2.8rem; }
.pr-kicker { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.pr-obj { font-size: 1.25rem; white-space: pre-wrap; }
.pr-list { display: grid; gap: 8px; padding-left: 26px; font-size: 1.2rem; }
.pr-list button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; display: flex; gap: 12px; align-items: baseline; }
.pr-list button span { opacity: .6; font-size: .9rem; }
.pr-list button:hover { color: var(--accent); }
.pr-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 48px; height: 80px; border: 0; background: #ffffff10; color: #fff; font-size: 2.4rem; cursor: pointer; border-radius: 10px; }
.pr-nav:hover { background: #ffffff25; }
.pr-nav.prev { left: 10px; } .pr-nav.next { right: 10px; }
@media (max-width: 900px) { .pr-task { grid-template-columns: 1fr; } .pr-diagram { height: 50vh; } .pr-info { max-height: none; } .pr-stage { padding: 14px 56px; } }

.att-table .num-in { width: 64px; }

/* ---------- Página de acceso ---------- */
.landing { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); background: var(--bg); }
.landing-brand { position: relative; overflow: hidden; background: linear-gradient(150deg, #0f1b2d 0%, #1d3557 60%, #2b6cb8 140%); color: #fff; display: grid; place-items: center; padding: 48px; }
.landing-court { position: absolute; width: 130%; left: -15%; top: 50%; transform: translateY(-50%) rotate(-8deg); color: #ffffff12; pointer-events: none; }
.landing-brand-inner { position: relative; max-width: 460px; display: grid; gap: 14px; justify-items: start; }
.landing-brand h1 { font-size: 2.4rem; letter-spacing: -.02em; }
.landing-tag { font-size: 1.15rem; opacity: .85; margin: 0; }
.landing-points { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.landing-points li { padding-left: 26px; position: relative; opacity: .9; }
.landing-points li::before { content: ''; position: absolute; left: 0; top: .45em; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); }
.landing-powered { margin-top: 26px; font-size: .78rem; letter-spacing: .14em; opacity: .55; font-weight: 700; }
.landing-brand .logo svg { width: 96px; height: 58px; }
.club-crest { object-fit: contain; flex: none; }
.landing-brand .club-crest { filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
.landing-form { display: grid; place-items: center; padding: 32px 20px; }
.landing-form .auth-card { box-shadow: var(--shadow); max-width: 420px; }
.landing-form h2 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 18px; }
.auth-foot { margin-top: 16px; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { width: 100%; padding-right: 84px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.pw-toggle:hover { background: var(--accent-soft); }
.remember { padding: 0; font-size: .9rem; color: var(--muted); }
.remember:hover { background: none; }
.brand .club-crest { width: 40px; height: 40px; }
.team-access .season-players { max-height: 260px; }
.team-access .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.club-card { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; }
@media (max-width: 860px) {
  .landing { grid-template-columns: 1fr; }
  .landing-brand { display: none; }
  .auth-mobile-brand { display: flex; }
  .landing-form { min-height: 100vh; background: radial-gradient(900px 500px at 0% -10%, #2b6cb833, transparent), radial-gradient(700px 400px at 110% 110%, #e8743b2a, transparent), var(--bg); }
  .club-card { grid-template-columns: 1fr; }
}
.field.check input { width: auto; flex: none; }

/* Importar copia en la configuración inicial */
.migrate-box { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.migrate-box p { margin: 0; }
