/* ==========================================================================
   TEAM MATCH — retos entre equipos (reutiliza la base visual de booking.css)
   ========================================================================== */
.tm-root .bk-head { position: relative; z-index: 2; }
.tm-tabs { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; margin: 4px 16px 6px; padding: 4px; border-radius: 14px; background: var(--bk-card); border: 1px solid var(--bk-line); flex-shrink: 0; }
.tm-tabs button { position: relative; z-index: 1; border: 0; background: transparent; padding: 10px 6px; border-radius: 10px; font-weight: 800; font-size: 13px; color: var(--bk-muted); display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: color 0.25s; }
.tm-tabs button.is-on { color: var(--bk-ink); }
.tm-tabs button b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #EF4444; color: #fff; font-size: 10.5px; display: grid; place-items: center; }
.tm-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 10px; background: linear-gradient(135deg, var(--bk-accent2), var(--bk-accent)); box-shadow: 0 6px 16px var(--bk-glow); transition: transform 0.4s cubic-bezier(0.34, 1.3, 0.5, 1); }

.tm-stage { position: relative; z-index: 1; flex: 1; min-height: 0; }
.tm-panel { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 16px 12px; scrollbar-width: none; }
.tm-panel::-webkit-scrollbar { display: none; }
.tm-panel.from-right { animation: bkInR 0.42s cubic-bezier(0.16, 1, 0.3, 1) both; }
.tm-panel.from-left { animation: bkInL 0.42s cubic-bezier(0.16, 1, 0.3, 1) both; }
.tm-panel [data-i] { animation: bkRise 0.45s calc(var(--i, 0) * 40ms + 80ms) cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ---- Explorar ---- */
.tm-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--bk-line); background: var(--bk-card); transition: border-color 0.2s, box-shadow 0.2s; }
.tm-search:focus-within { border-color: var(--bk-accent); box-shadow: 0 0 0 3px var(--bk-glow); }
.tm-search i { color: var(--bk-muted); }
.tm-search input { flex: 1; min-width: 0; padding: 14px 0; border: 0; outline: 0; background: transparent; color: var(--bk-text); font-size: 15px; font-family: inherit; }
.tm-chips { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 4px; padding: 2px 16px 6px; scrollbar-width: none; }
.tm-chips::-webkit-scrollbar { display: none; }
.tm-chips button { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--bk-line); background: var(--bk-card); color: var(--bk-text); font-size: 12.5px; font-weight: 700; transition: all 0.2s; }
.tm-chips button.is-on { background: var(--bk-accent); border-color: var(--bk-accent); color: var(--bk-ink); box-shadow: 0 6px 14px var(--bk-glow); }
.tm-count { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bk-muted); margin: 4px 2px 8px; }
.tm-list { display: grid; gap: 10px; }
.tm-team, .tm-ch { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; border: 1.5px solid var(--bk-line); background: var(--bk-card); cursor: pointer; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.2s; }
.tm-team:hover, .tm-ch:hover { border-color: var(--bk-accent); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22); }
.tm-team:active, .tm-ch:active { transform: scale(0.98); }
.tm-team:focus-visible, .tm-ch:focus-visible { outline: 2px solid var(--bk-accent); outline-offset: 2px; }
.tm-ch.is-act { border-color: var(--bk-accent); box-shadow: 0 0 0 1px var(--bk-accent), 0 8px 20px var(--bk-glow); }
.tm-crest { --s: 50px; flex: 0 0 var(--s); width: var(--s); height: var(--s); display: grid; place-items: center; border-radius: 28%; background: linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3); transform: skewX(-6deg); }
.tm-crest b { transform: skewX(6deg); font-family: var(--font-display); font-weight: 900; font-style: italic; font-size: calc(var(--s) * 0.3); letter-spacing: 0.02em; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.tm-team-main { flex: 1; min-width: 0; }
.tm-team-main h3 { font-family: var(--font-display); font-weight: 900; font-size: 15.5px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-team-main p { margin-top: 2px; font-size: 11.5px; color: var(--bk-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-team-main p i { margin-right: 5px; color: var(--bk-accent); }
.tm-go { color: var(--bk-muted); font-size: 12px; }
.tm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tm-tags span { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--bk-line); }
.tm-tags .lv-1 { color: #38BDF8; border-color: rgba(56, 189, 248, 0.5); }
.tm-tags .lv-2 { color: #F59E0B; border-color: rgba(245, 158, 11, 0.5); }
.tm-tags .lv-3 { color: #A78BFA; border-color: rgba(167, 139, 250, 0.55); }
.tm-tags .ok { color: var(--bk-accent); border-color: var(--bk-accent); }
.tm-tags .ok i { width: 6px; height: 6px; border-radius: 50%; background: var(--bk-accent); box-shadow: 0 0 8px var(--bk-accent); animation: bkBeat 1.6s infinite; }
.tm-tags .off { color: var(--bk-muted); }
.tm-tags .off i { width: 6px; height: 6px; border-radius: 50%; background: var(--bk-muted); }
.tm-tags .sent { color: var(--bk-gold); border-color: var(--bk-gold); }
.tm-empty, .tm-empty-big p { text-align: center; color: var(--bk-muted); font-size: 13px; padding: 18px 0; }
.tm-empty-big { display: grid; justify-items: center; gap: 4px; padding: 30px 0; }
.tm-empty-big i { font-size: 34px; color: var(--bk-accent); }

/* ---- Perfil del rival ---- */
.tm-hero { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; border: 1.5px solid var(--bk-line); background: linear-gradient(135deg, color-mix(in srgb, var(--c) 32%, transparent), var(--bk-card) 70%); }
.tm-hero small { font-size: 10px; font-weight: 800; letter-spacing: 0.2em; color: var(--bk-muted); }
.tm-hero h2 { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 23px; line-height: 1.05; margin-top: 2px; }
.tm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.tm-stat { text-align: center; padding: 11px 4px; border-radius: 14px; border: 1.5px solid var(--bk-line); background: var(--bk-card); }
.tm-stat strong { display: block; font-family: var(--font-display); font-weight: 900; font-size: 20px; }
.tm-stat span { display: block; margin-top: 2px; font-size: 9px; font-weight: 800; letter-spacing: 0.12em; color: var(--bk-muted); }
.tm-info { border-radius: 14px; border: 1.5px solid var(--bk-line); background: var(--bk-card); overflow: hidden; }
.tm-info > div { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; font-size: 13px; }
.tm-info > div + div { border-top: 1px solid var(--bk-line); }
.tm-info span { color: var(--bk-muted); }
.tm-sec { margin: 16px 0 8px; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 13px; letter-spacing: 0.1em; color: var(--bk-accent); padding-left: 10px; border-left: 3px solid var(--bk-accent); }
.tm-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.tm-pl { text-align: center; }
.tm-face { position: relative; width: 62px; height: 62px; margin: 0 auto 4px; border-radius: 50%; overflow: hidden; border: 2px solid var(--bk-accent); }
.tm-face svg { width: 100%; height: 100%; display: block; }
.tm-face em { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.62); color: #fff; font-style: normal; font-size: 9px; font-weight: 900; line-height: 14px; }
.tm-pl strong { display: block; font-size: 11.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-pl small { font-size: 10px; color: var(--bk-muted); }
.tm-demo { margin-top: 14px; font-size: 11px; color: var(--bk-muted); }
.tm-demo i { color: var(--bk-accent); }

/* ---- Dock inferior de acciones ---- */
.tm-dock { position: sticky; bottom: -12px; margin: 18px -16px -12px; padding: 22px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 10px; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bk-bg2) 92%, transparent) 30%); }
.tm-dock .bk-cta { width: 100%; }
.tm-dock-3 { grid-template-columns: 1fr 1fr; }
.tm-dock-3 .bk-cta { grid-column: 1 / -1; }
.bk-ghost.danger { color: #EF4444; border-color: rgba(239, 68, 68, 0.45); }
.bk-ghost.danger:hover { background: rgba(239, 68, 68, 0.1); border-color: #EF4444; color: #EF4444; }

/* ---- Crear reto ---- */
.tm-vs { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 4px; }
.tm-vs > span { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 24px; color: var(--bk-accent); text-shadow: 0 0 18px var(--bk-glow); animation: bkBeat 1.8s infinite; }
.tm-vs-names { text-align: center; margin-top: 8px; font-weight: 800; font-size: 14px; }
.tm-vs-names em { font-style: italic; color: var(--bk-accent); padding: 0 4px; }
.tm-courts > div { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-days { margin: 0 -16px; }
.tm-pick-hint { margin: 10px 2px 0; font-size: 11.5px; color: var(--bk-muted); }
.tm-picked { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; min-height: 30px; }
.tm-picked em { font-size: 12px; color: var(--bk-muted); font-style: normal; }
.tm-picked span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--bk-accent); color: var(--bk-ink); font-size: 12px; font-weight: 800; animation: bkPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tm-picked button { width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.2); color: inherit; font-size: 10px; display: grid; place-items: center; }
.tm-msg { width: 100%; margin-top: 4px; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--bk-line); background: var(--bk-card); color: var(--bk-text); font-family: inherit; font-size: 14.5px; resize: none; outline: none; }
.tm-msg:focus { border-color: var(--bk-accent); box-shadow: 0 0 0 3px var(--bk-glow); }

/* ---- Estado, pasos y detalle ---- */
.tm-pill { flex-shrink: 0; font-size: 9.5px; font-weight: 900; letter-spacing: 0.08em; padding: 5px 9px; border-radius: 999px; border: 1.5px solid var(--bk-line); color: var(--bk-muted); white-space: nowrap; }
.tm-pill.act { background: var(--bk-gold); border-color: var(--bk-gold); color: #231A00; animation: bkBeat 1.8s infinite; }
.tm-pill.wait { color: #60A5FA; border-color: rgba(96, 165, 250, 0.5); }
.tm-pill.ok { background: var(--bk-accent); border-color: var(--bk-accent); color: var(--bk-ink); }
.tm-pill.off { color: #EF4444; border-color: rgba(239, 68, 68, 0.45); }
.tm-center { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.tm-court { font-size: 12px; color: var(--bk-muted); }
.tm-court i { color: var(--bk-accent); margin-right: 5px; }
.tm-sent { margin: 12px auto 0; width: fit-content; padding: 7px 16px; border-radius: 999px; background: rgba(50, 199, 54, 0.16); border: 1.5px solid var(--bk-accent); color: var(--bk-accent); font-weight: 800; font-size: 12.5px; }
.tm-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); margin: 16px 0 4px; padding: 0; }
.tm-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: var(--bk-muted); }
.tm-steps li::before { content: ''; position: absolute; top: 13px; left: -50%; width: 100%; height: 3px; background: var(--bk-line); }
.tm-steps li:first-child::before { display: none; }
.tm-steps li.is-done::before, .tm-steps li.is-now::before { background: var(--bk-accent); }
.tm-steps i { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 900; background: var(--bk-card-solid); border: 2px solid var(--bk-line); }
.tm-steps li.is-done i { background: var(--bk-accent); border-color: var(--bk-accent); color: var(--bk-ink); }
.tm-steps li.is-now i { border-color: var(--bk-accent); color: var(--bk-accent); box-shadow: 0 0 0 4px var(--bk-glow); }
.tm-steps li.is-now em, .tm-steps li.is-done em { color: var(--bk-text); }
.tm-steps em { font-style: normal; }
.tm-thread { display: grid; gap: 8px; }
.tm-bub { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 13px; line-height: 1.4; border: 1px solid var(--bk-line); background: var(--bk-card); }
.tm-bub span { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bk-muted); margin-bottom: 2px; }
.tm-bub.me { justify-self: end; background: var(--bk-accent); border-color: var(--bk-accent); color: var(--bk-ink); border-bottom-right-radius: 4px; }
.tm-bub.me span { color: var(--bk-ink); opacity: 0.7; }
.tm-bub.them { border-bottom-left-radius: 4px; }
.tm-reply { display: flex; gap: 8px; margin-top: 10px; }
.tm-reply input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--bk-line); background: var(--bk-card); color: var(--bk-text); font-family: inherit; font-size: 14px; outline: none; }
.tm-reply input:focus { border-color: var(--bk-accent); }
.tm-reply button { width: 46px; border-radius: 12px; border: 0; background: var(--bk-accent); color: var(--bk-ink); }
.tm-slotsel { margin-top: 4px; display: grid; gap: 8px; }
.tm-slotbtn { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--bk-line); background: var(--bk-card); font-weight: 700; font-size: 14px; text-align: left; transition: all 0.2s; }
.tm-slotbtn i { color: var(--bk-accent); }
.tm-slotbtn b { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--bk-line); position: relative; }
.tm-slotbtn.is-sel { border-color: var(--bk-accent); background: rgba(50, 199, 54, 0.1); box-shadow: 0 0 0 1px var(--bk-accent); }
.tm-slotbtn.is-sel b { border-color: var(--bk-accent); }
.tm-slotbtn.is-sel b::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--bk-accent); animation: bkPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tm-proposal { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 14px; border: 1.5px solid var(--bk-gold); background: rgba(244, 201, 93, 0.1); font-family: var(--font-display); font-weight: 900; font-size: 18px; }
.tm-proposal i { color: var(--bk-gold); }
.tm-agreed { text-align: center; padding: 18px 14px; border-radius: 18px; border: 2px solid var(--bk-accent); background: linear-gradient(135deg, rgba(50, 199, 54, 0.18), rgba(50, 199, 54, 0.04)); }
.tm-agreed small { font-size: 10px; font-weight: 800; letter-spacing: 0.24em; color: var(--bk-accent); }
.tm-agreed strong { display: block; margin: 4px 0; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 24px; }
.tm-agreed span { font-size: 12.5px; color: var(--bk-muted); }
.tm-agreed em { display: block; margin-top: 8px; font-style: normal; font-weight: 800; font-size: 12.5px; color: var(--bk-accent); }
.tm-waiting { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px; border-radius: 16px; border: 1.5px dashed var(--bk-line); }
.tm-waiting p { font-weight: 700; font-size: 14px; }
.tm-waiting small { font-size: 11px; color: var(--bk-muted); }
.tm-pulse { width: 16px; height: 16px; border-radius: 50%; background: var(--bk-accent); animation: tmPulse 1.4s infinite; }
@keyframes tmPulse { 0% { box-shadow: 0 0 0 0 var(--bk-glow); } 100% { box-shadow: 0 0 0 18px transparent; } }
.tm-seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; border: 1px solid var(--bk-line); background: var(--bk-card); margin-bottom: 12px; }
.tm-seg button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 800; font-size: 13px; color: var(--bk-muted); transition: all 0.25s; }
.tm-seg button.is-on { background: var(--bk-accent); color: var(--bk-ink); box-shadow: 0 4px 12px var(--bk-glow); }
.tm-seg b { margin-left: 4px; opacity: 0.8; }
.tm-hint-act { margin: 0 2px 10px; font-size: 12px; font-weight: 700; color: var(--bk-gold); }

.tm-locked { display: grid; place-content: center; justify-items: center; text-align: center; gap: 10px; padding: 30px; }
.tm-locked h2 { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 26px; }
.tm-locked p { font-size: 13px; color: var(--bk-muted); max-width: 300px; }
.tm-lock-ico { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; background: var(--bk-card); border: 2px solid var(--bk-accent); color: var(--bk-accent); }

/* ---- Toasts de notificación ---- */
.tm-toasts { position: absolute; top: 10px; left: 12px; right: 12px; z-index: 900; display: grid; gap: 8px; pointer-events: none; }
.tm-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #0B1511; color: #fff; border: 1.5px solid #32C736; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 18px rgba(50, 199, 54, 0.3); font-size: 13px; font-weight: 700; cursor: pointer; animation: tmToastIn 0.45s cubic-bezier(0.34, 1.4, 0.5, 1) both; }
.tm-toast i { color: #F4C95D; }
.tm-toast.out { animation: tmToastOut 0.35s ease-in both; }
@keyframes tmToastIn { from { transform: translateY(-30px) scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tmToastOut { to { transform: translateY(-20px); opacity: 0; } }

/* ---- Puntos de entrada (Inicio / Perfil) ---- */
.tm-entry-badge, .tm-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #EF4444; color: #fff; font-size: 10.5px; font-weight: 900; display: inline-grid; place-items: center; }
.quick-chip-btn { position: relative; }
.quick-chip-btn .tm-badge { position: absolute; top: -4px; right: 8px; border: 2px solid var(--km-black); }
.chip-circle.red { background: rgba(239, 68, 68, 0.16); color: #EF4444; border-color: rgba(239, 68, 68, 0.4); }
.tm-cta-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px 16px; border: 0; border-radius: 14px; cursor: pointer; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 15px; letter-spacing: 0.06em; color: #0B0C0E; background: linear-gradient(135deg, #FFE08A, #F4C95D); box-shadow: 0 8px 22px rgba(244, 201, 93, 0.35); overflow: hidden; }
.tm-cta-btn::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.6), transparent); transform: skewX(-20deg); animation: bkShine 2.8s infinite; }
.tm-cta-btn .tm-badge { position: absolute; top: 8px; right: 10px; }

[data-theme="light"] .tm-toast { background: #FFFFFF; color: #0F1A13; }
[data-theme="light"] .tm-tags .lv-1 { color: #0369A1; }
[data-theme="light"] .tm-tags .lv-2 { color: #B45309; }
[data-theme="light"] .tm-tags .lv-3 { color: #6D28D9; }
[data-theme="light"] .tm-tags .sent { color: #92680A; border-color: #92680A; }
[data-theme="light"] .tm-pill.wait { color: #1D4ED8; border-color: rgba(29, 78, 216, 0.4); }
[data-theme="light"] .quick-chip-btn .tm-badge { border-color: #F5F8F6; }

/* Fila de accesos rápidos con 5 botones */
.home-quick-row { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.home-quick-row .quick-chip-btn span { font-size: 11px; white-space: nowrap; }

.tm-agreed, .tm-waiting, .tm-slotsel { margin-top: 16px; }

/* Dock siempre al fondo de la pantalla aunque el contenido sea corto */
.tm-panel:not(.tm-locked) { display: flex; flex-direction: column; }
.tm-panel > * { flex-shrink: 0; }
.tm-panel > .tm-dock { margin-top: auto; }

/* Team Match: escudo real del club y modo lectura */
.tm-crest-svg { --s: 50px; flex: 0 0 auto; display: inline-grid; place-items: center; line-height: 0; filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.4)); }
.tm-ro { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--bk-gold); font-size: 12px; color: var(--bk-muted); }
.tm-ro i { color: var(--bk-gold); margin-right: 6px; }
