/* ---------- Barra de apps (desktop: barra de acción al centro; móvil: pestañas abajo) ---------- */
.appbar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; display: flex; gap: 6px; padding: 6px; border-radius: 12px; background: linear-gradient(#241a12, #120c08); border: 1px solid #6b5326; box-shadow: 0 0 0 2px #0b0705, 0 10px 30px rgba(0,0,0,.55); }
/* Botón tipo barra de acción: marco metálico, bisel interior y brillo */
.appbar button { position: relative; width: 52px; height: 52px; border-radius: 6px; border: 2px solid #2a1e12; background: radial-gradient(circle at 50% 35%, #3b2c1c, #1a120b); color: #e9c46a; cursor: pointer; display: grid; place-items: center; padding: 0; overflow: visible;
  box-shadow: 0 0 0 1px #8a6a32, inset 0 1px 0 rgba(255,230,170,.25), inset 0 -6px 12px rgba(0,0,0,.55); transition: transform .08s, box-shadow .15s; }
.appbar button::before { content: ''; position: absolute; inset: 0; border-radius: 4px; pointer-events: none; z-index: 2;
  background: linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,0) 38%), radial-gradient(circle at 50% 50%, transparent 55%, rgba(0,0,0,.55)); }
.appbar button:active { transform: translateY(1px) scale(.97); }
.appbar .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 4px; z-index: 1; }
.appbar button.has-art svg, .sheet .has-art svg { display: none; }
.appbar .key, .appbar .n { z-index: 3; }
.appbar button svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 0 #000); }
.appbar button:hover { color: #fff1c2; box-shadow: 0 0 0 1px #f5d36a, 0 0 10px rgba(245,211,106,.55), inset 0 1px 0 rgba(255,230,170,.25), inset 0 -6px 12px rgba(0,0,0,.55); }
.appbar button:hover .art { filter: brightness(1.18); }
.appbar button.on { color: #fff1c2; box-shadow: 0 0 0 2px #f5d36a, 0 0 14px rgba(245,211,106,.7), inset 0 0 14px rgba(232,184,74,.5); }
.appbar .key { position: absolute; top: 1px; left: 4px; font: 800 11px Inter, sans-serif; color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000, 1px 1px 0 #000; }
.appbar .lbl { display: none; }
.appbar .n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #9b1c1c; border: 1px solid #f5d36a; color: #fff; font: 700 11px Inter, sans-serif; display: grid; place-items: center; }
.appbar button[data-id="mas"] { display: none; }
.appbar button:hover::after { content: attr(aria-label); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 4px 8px; border-radius: 6px; background: #120c08; border: 1px solid #6b5326; color: var(--text); font: 600 12px Inter, sans-serif; pointer-events: none; }

/* Hoja "Más" (solo móvil) */
.sheet { position: fixed; left: 8px; right: 8px; bottom: 72px; z-index: 25; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.6); display: none; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sheet.open { display: grid; }
.sheet button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 12px Inter, sans-serif; position: relative; }
.sheet .ic { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; overflow: hidden; border: 1px solid #8a6a32; }
.sheet .ic .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sheet svg { width: 26px; height: 26px; stroke: var(--gold); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sheet .n { position: absolute; top: 4px; right: 8px; min-width: 18px; height: 18px; border-radius: 9px; background: #9b1c1c; color: #fff; font-size: 11px; display: grid; place-items: center; }

/* ---------- Pantalla de cada app ---------- */
.appview { position: fixed; inset: 0; bottom: 0; z-index: 10; overflow-y: auto; overflow-x: hidden; background: radial-gradient(1200px 500px at 50% -10%, #241a2e, transparent), var(--bg); padding: 0 0 110px; }
.appview[hidden] { display: none; }
.app-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 14px 24px; background: linear-gradient(rgba(16,12,20,.97), rgba(16,12,20,.9)); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.app-head.A { box-shadow: inset 0 -2px 0 #4c6cd8; }
.app-head.H { box-shadow: inset 0 -2px 0 #c0392b; }
.app-head .back { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 10px; padding: 8px 12px; font: 600 13px Inter, sans-serif; cursor: pointer; }
.app-head .back:hover { border-color: var(--gold); color: var(--gold); }
.app-head .faces { display: flex; }
.app-head canvas { width: 52px; height: 52px; border-radius: 50%; border: 2px solid #b8892e; background: radial-gradient(#5a3d22, #2a1a0c); }
.app-head .faces canvas + canvas { margin-left: -12px; }
.app-head h1 { margin: 0; font: 800 22px Cinzel, serif; color: var(--gold); }
.app-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.app-head .grow { flex: 1; min-width: 0; }
.btn { border: 1px solid #6b5326; background: linear-gradient(#3a2a14, #24180c); color: #f3dfb0; border-radius: 10px; padding: 9px 14px; font: 600 13px Inter, sans-serif; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--gold); color: #fff; }
.btn.ghost { background: var(--panel-2); border-color: var(--line); color: var(--text); }

.app-body { max-width: 1180px; margin: 0 auto; padding: 22px 24px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.panel h2 { margin: 0 0 4px; font: 800 18px Cinzel, serif; }
.panel .sub { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }

/* Entrenamiento */
.progress { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin: 6px 0 16px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #c47f00, #f7c600); transition: width .3s; }
.ex { padding: 12px 0; border-top: 1px solid var(--line); }
.ex-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ex b { font-size: 15px; }
.kg { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.kg button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 16px Inter, sans-serif; cursor: pointer; }
.kg span { min-width: 56px; text-align: center; color: var(--text); font-weight: 600; }
.sets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sets button { min-width: 64px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 13px Inter, sans-serif; cursor: pointer; }
.sets button.done { background: #1f4d2c; border-color: #4ade80; color: #d9ffe5; }
.finish { width: 100%; margin-top: 16px; padding: 14px; font-size: 15px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: center; padding: 8px 2px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11px; }
.day b { display: block; font-size: 13px; margin-bottom: 4px; }
.day.hecho { border-color: #4ade80; }
.day.hecho b::after { content: ' ✓'; color: #4ade80; }
.day.hoy { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.day.descanso { opacity: .55; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-t { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat-t b { display: block; font: 800 22px Cinzel, serif; color: var(--gold); }
.stat-t span { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 10px; color: var(--muted); }
.bars i { width: 100%; border-radius: 6px 6px 2px 2px; background: linear-gradient(#f7c600, #8a5a00); }
.bars div:last-child i { background: linear-gradient(#fff1a8, #c47f00); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.hist li span { color: var(--muted); font-size: 13px; }
.rest { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 15; display: none; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 999px; background: #1f4d2c; border: 1px solid #4ade80; color: #eafff0; font: 600 14px Inter, sans-serif; box-shadow: 0 10px 30px rgba(0,0,0,.5); cursor: pointer; }
.rest.on { display: flex; }

/* Próximamente y tablero de misiones */
.soon ul { margin: 0; padding-left: 18px; line-height: 1.9; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.board .panel { padding: 14px; }
.board header { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 8px; }
.board header canvas { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #b8892e; }
.board header b { font: 800 16px Cinzel, serif; }
.board header span { display: block; font-size: 12px; color: var(--muted); }
.mis { display: grid; grid-template-columns: 20px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mis .ico { font: 900 18px Georgia, serif; color: #f5c400; text-align: center; }
.mis .ico.wip { color: #9a948a; }
.mis p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* Chat con el agente */
.chat { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100vw; z-index: 30; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0,0,0,.5); transform: translateX(105%); transition: transform .25s ease; }
.chat.open { transform: none; }
.chat header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat header canvas { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #b8892e; }
.chat header b { flex: 1; font: 800 16px Cinzel, serif; }
.chat header button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat .msg { max-width: 85%; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.chat .msg.note { align-self: center; max-width: 100%; background: transparent; border-style: dashed; color: var(--muted); font-size: 12px; text-align: center; }
.chat form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 14px Inter, sans-serif; }

/* Botón "abrir app" dentro del diario de misiones */
.qapp { display: none; margin: 12px 0 0; width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #7a5524; background: linear-gradient(#4a2e18, #2e1c0e); color: #f3dfb0; font: 700 14px Inter, sans-serif; cursor: pointer; }
.qapp.on { display: block; }

/* Las capas de la oficina solo se ven en la oficina */
body:not([data-view="oficina"]) .hud,
body:not([data-view="oficina"]) .roster,
body:not([data-view="oficina"]) .zoom,
body:not([data-view="oficina"]) .quest,
body:not([data-view="oficina"]) .editbar { display: none; }

/* ---------- Móvil ---------- */
@media (max-width: 700px) {
  .appbar { left: 0; right: 0; bottom: 0; transform: none; border-radius: 0; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-width: 1px 0 0; justify-content: space-around; }
  .appbar button::before { display: none; }
  .appbar .art { position: static; width: 28px; height: 28px; border-radius: 6px; box-shadow: 0 0 0 1px #8a6a32; }
  .appbar button { width: auto; flex: 1; height: 56px; border: 0; box-shadow: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
  .appbar button svg { width: 24px; height: 24px; }
  .appbar button.on { box-shadow: none; background: rgba(232,184,74,.12); border-radius: 10px; }
  /* por ahora se muestran las 6 secciones; para volver a 4 + "Más": ocultar :not(.tab) y mostrar [data-id="mas"] */
  .appbar button[data-id="mas"] { display: none; }
  .appbar button { padding: 0 1px; }
  .appbar .lbl { white-space: nowrap; font-size: 9.5px !important; letter-spacing: -.1px; }
  .appbar .key { display: none; }
  .appbar .lbl { display: block; font: 600 10px Inter, sans-serif; }
  .appbar .n { top: 2px; right: calc(50% - 22px); }
  .appbar button:hover::after { display: none; }
  .appview { padding-bottom: 90px; }
  .app-head { padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
  .app-head .back { display: none; }
  .app-head canvas { width: 42px; height: 42px; }
  .app-head h1 { font-size: 18px; }
  .app-head .btn { width: 100%; }
  .app-body { padding: 14px 12px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .day { font-size: 10px; }
  .stats { gap: 6px; }
  .stat-t { padding: 10px 8px; }
  .stat-t b { font-size: 18px; }
  .ex-top { flex-wrap: wrap; }
  .rest { bottom: 80px; }
  .chat { top: auto; height: 80vh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; transform: translateY(105%); }
}

/* ---------- Emblemas de clase ---------- */
.emblem { display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 6px; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 85%, #fff) 0%, color-mix(in srgb, var(--c) 70%, #1a1008) 38%, color-mix(in srgb, var(--c) 25%, #0b0705) 100%); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, #000), inset 0 -6px 10px rgba(0,0,0,.6); }
.emblem svg { width: 64%; height: 64%; fill: none; stroke: #fffaf0; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 1.5px rgba(0,0,0,.9)) drop-shadow(0 1px 1px #000); }
.emblem.fill { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; border-radius: 4px; }
.appbar button.has-art > svg { display: none; }
.appbar button.has-art .emblem.fill svg { display: block; }
.sheet .ic .emblem.fill { position: absolute; inset: 0; width: 100%; height: 100%; }
.sheet .ic.has-art > svg { display: none; }
.roster .face { position: relative; flex: 0 0 auto; display: grid; }
.emblem.badge { position: absolute; right: -5px; bottom: -4px; width: 16px; height: 16px; border-radius: 4px; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px color-mix(in srgb, var(--c) 60%, #000); }
.emblem.badge svg { stroke-width: 2.4; filter: none; }
.emblem.big { width: 44px; height: 44px; margin-left: auto; align-self: flex-start; border-radius: 8px; box-shadow: 0 0 0 2px #7a5524, inset 0 -6px 10px rgba(0,0,0,.6); }
.emblem.title { width: 26px; height: 26px; margin-right: 8px; vertical-align: -5px; }
@media (max-width: 700px) {
  .appbar .emblem.fill { position: static; width: 30px; height: 30px; box-shadow: 0 0 0 1px #8a6a32, inset 0 -4px 8px rgba(0,0,0,.6); }
  .appbar button.has-art .emblem.fill svg { width: 70%; height: 70%; }
}
.sheet .has-art .emblem svg { display: block; }
/* con imagen pintada, el trazo de reserva se oculta */
.emblem { position: relative; overflow: hidden; }
.emblem img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.emblem img + svg { display: none !important; }
.emblem.fill { box-shadow: none; }
.emblem.badge { width: 18px; height: 18px; border-radius: 4px; box-shadow: 0 0 0 1px #000, 0 0 0 2px #8a6a32; }
.emblem.big { width: 52px; height: 52px; border-radius: 6px; box-shadow: 0 0 0 2px #2a1e12, 0 0 0 3px #b8892e; }
.emblem.title { width: 30px; height: 30px; border-radius: 5px; box-shadow: 0 0 0 1px #8a6a32; vertical-align: -7px; }

.kg small { color: var(--muted); font-size: 11px; margin-right: 2px; }

/* ---------- Entrenamiento: estética de la Horda ---------- */
.appview.horde { background: linear-gradient(rgba(10,4,2,.28), rgba(10,4,2,.42)), radial-gradient(ellipse at 50% 55%, rgba(0,0,0,0), rgba(0,0,0,.45) 80%), url(assets/entrenador/sala_horizontal.webp) center / cover fixed, #1a0a05; }
@media (orientation: portrait) { .appview.horde { background-image: linear-gradient(rgba(10,4,2,.28), rgba(10,4,2,.42)), radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0), rgba(0,0,0,.45) 80%), url(assets/entrenador/sala_vertical.webp); } }
.horde .app-head { background: linear-gradient(rgba(40,10,6,.95), rgba(25,8,4,.9)); border-bottom: 2px solid #7a1c12; box-shadow: 0 3px 0 #2a0c06, 0 8px 20px rgba(0,0,0,.5); }
.horde .app-head h1 { color: #ffb347; text-shadow: 0 2px 0 #3a0c04; }
.horde .panel { background: transparent; border: 52px solid transparent; border-image: url(assets/entrenador/panel_horda.webp) 260 fill / 52px round; border-radius: 0; padding: 4px 6px; color: #f3e2c8; filter: drop-shadow(0 10px 18px rgba(0,0,0,.55)); }
.horde .panel h2 { color: #ffcf7a; text-shadow: 0 2px 0 #2a0a04; }
.horde .panel .sub, .horde .muted { color: #d9b99a; }
.horde .stat-t, .horde .day, .horde .sets button, .horde .kg button { background: rgba(20,8,4,.6); border-color: #6b3a1e; color: #f3e2c8; }
.horde .stat-t b { color: #ffb347; }
.horde .day.hoy { border-color: #ff6a3d; box-shadow: 0 0 0 1px #ff6a3d; }
.horde .hist li, .horde .ex { border-top-color: rgba(122,60,30,.6); }
.horde .btn { background: linear-gradient(#8a1c12, #4a0c06); border-color: #c0392b; color: #ffe8c8; }
.horde .btn.ghost { background: rgba(20,8,4,.6); border-color: #6b3a1e; }
.horde .progress { background: rgba(20,8,4,.7); border: 1px solid #6b3a1e; height: 10px; }
.horde .progress i { background: linear-gradient(90deg, #8a1c12, #ff6a3d, #ffb347); }
.horde .sets button.done { background: #5c2a0a; border-color: #ffb347; color: #fff3d6; }
.quest-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.quest-kicker { font: 800 12px Cinzel, serif; letter-spacing: .12em; text-transform: uppercase; color: #ffb347; }
.quest-head h2 .opt { font: 500 12px Inter, sans-serif; color: #d9b99a; }
.ex .cnt { font: 700 13px Inter, sans-serif; color: #ffd100; white-space: nowrap; }
.ex.done b, .ex.done .cnt { color: #7fd38f; }
.kgrow { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.notas { width: 100%; margin-top: 10px; min-height: 60px; padding: 10px; border-radius: 10px; border: 1px solid #6b3a1e; background: rgba(20,8,4,.6); color: #f3e2c8; font: 14px Inter, sans-serif; }
.focus .ex { border-top: 0; padding: 10px 0; }
.focus .ex-top b { font-size: 20px; }
.focus .ex .cnt { font-size: 18px; }
.focus .sets { gap: 10px; }
.focus .sets button { flex: 1 1 40%; min-height: 64px; font-size: 17px; border-radius: 12px; }
.focus .kg button { width: 52px; height: 52px; font-size: 24px; border-radius: 12px; }
.focus .kg span { min-width: 80px; font-size: 20px; }
.focus-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.focus-nav span { color: #d9b99a; font-weight: 600; }
.focus-nav .btn { padding: 14px 16px; font-size: 15px; }
.focus-nav .btn:disabled { opacity: .4; }
/* Descanso como barra de lanzamiento */
.rest { overflow: hidden; border-radius: 6px; background: #1a0a05; border: 2px solid #c79a3a; box-shadow: 0 0 0 2px #000, 0 10px 30px rgba(0,0,0,.6); color: #fff3d6; text-shadow: 0 1px 2px #000; min-width: 280px; justify-content: center; }
.rest::before { content: ''; position: absolute; inset: 0; background: linear-gradient(#ffd56a, #c47f00); transform-origin: left; transform: scaleX(0); z-index: -1; }
.rest.on::before { animation: cast var(--dur, 90s) linear forwards; }
.rest { isolation: isolate; }
@keyframes cast { to { transform: scaleX(1); } }
/* Ventana de misión completada */
.qdone { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0,0,0,.6); padding: 16px; }
.qdone-card { width: min(420px, 100%); text-align: center; border: 52px solid transparent; border-image: url(assets/entrenador/panel_horda.webp) 260 fill / 52px round; padding: 4px; color: #f3e2c8; animation: pop .25s ease-out; }
.qdone-card h2 { margin: 4px 0 14px; font: 800 24px Cinzel, serif; color: #ffcf7a; }
.qdone-card .stats { margin-bottom: 10px; }
.qdone-card .stat-t { background: rgba(20,8,4,.6); border-color: #6b3a1e; }
.qdone-card .stat-t b { color: #ffb347; }
.qdone-card .btn { margin-top: 8px; width: 100%; padding: 12px; background: linear-gradient(#8a1c12, #4a0c06); border-color: #c0392b; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@media (max-width: 700px) {
  .horde .panel, .qdone-card { border-width: 38px; border-image-width: 38px; }
  .horde .app-body { padding: 10px 6px; }
}

/* Misión del día del Entrenador en su diario (oficina) */
.tm { margin-top: 2px; }
.tm-head { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; background: rgba(255,248,225,.55); border: 1px solid rgba(58,40,20,.2); }
.tm-ico { font: 900 26px Georgia, serif; color: #f5c400; -webkit-text-stroke: 1.5px #3a2000; width: 22px; text-align: center; }
.tm-head b { display: block; font-size: 15px; color: #2a1a08; }
.tm-head span { font-size: 12px; color: #6b4a2e; }
.tm-note { font-size: 12px; color: #7a4a12; margin: 8px 0 0; }
.tm-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px !important; }
.tm-list li { display: block !important; padding: 0 !important; background: none !important; border: 0 !important; }
.tm-list label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; border-radius: 6px; cursor: pointer; font-size: 14px; color: #2a1a08; line-height: 1.35; }
.tm-list label:hover { background: rgba(255,248,225,.5); }
.tm-list input { width: 18px; height: 18px; margin-top: 1px; accent-color: #3f7d34; flex: 0 0 auto; }
.tm-list input:checked + span { color: #2e7d3a; text-decoration: line-through; text-decoration-color: rgba(46,125,58,.5); }
.tm-rpe { margin-top: 12px; }
.tm-rpe b { font-size: 13px; color: #2a1a08; }
.tm-rpe div { display: flex; gap: 6px; margin-top: 6px; }
.tm-rpe button { flex: 1; padding: 7px 0; border-radius: 6px; border: 1px solid #b08850; background: #f0dfbd; color: #3a1c08; font: 700 13px Inter, sans-serif; cursor: pointer; }
.tm-rpe button.on { background: #3f7d34; border-color: #2a5a22; color: #fff; }
.tm-btn { width: 100%; margin-top: 12px; padding: 10px; border-radius: 8px; border: 1px solid #7a5524; background: linear-gradient(#4a2e18, #2e1c0e); color: #f3dfb0; font: 700 13px Inter, sans-serif; cursor: pointer; }
.tm-btn.ghost { background: transparent; color: #7a4a12; }
.tm-done { margin: 12px 0 0; font: 800 15px Cinzel, serif; color: #2e7d3a; text-align: center; }
.tabs { margin-top: 4px; }
.tabs button { flex: 1 1 auto; }

/* Entrenamiento en escritorio: rutinas a la izquierda y el seguimiento en una cuadrícula de 2 columnas, sin scroll */
@media (min-width: 1101px) {
  .horde .app-body { max-width: 1560px; padding-top: 14px; }
  .horde .grid2 { grid-template-columns: 1.25fr 1fr 1fr; gap: 6px 10px; }
  .horde .grid2 > .col { display: contents; }
  .horde #routines { grid-row: span 3; }
  .horde .grid2 > .col > :nth-child(4) { order: 5; grid-column: 2 / 4; }
  .horde .grid2 > .col > :nth-child(5) { order: 4; }
  .horde .panel { border-width: 44px; border-image-width: 44px; }
  .horde .panel h2 { font-size: 17px; }
}

/* ---------- Entrenamiento como dashboard ---------- */
.dash { display: flex; flex-direction: column; gap: 4px; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.horde .kpi { border-width: 36px; border-image-width: 36px; padding: 0 2px; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.kpi .kpi-l { font: 800 11px Cinzel, serif; letter-spacing: .12em; text-transform: uppercase; color: #d9b99a; }
.kpi b { font: 800 30px/1.1 Cinzel, serif; color: #ffb347; text-shadow: 0 2px 0 #2a0a04; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi b small { font-size: 16px; color: #d9b99a; }
.kpi .kpi-s { font-size: 12px; color: #f3e2c8; }
.kpi .progress { margin: 6px 0 0; height: 7px; }
.weekbig { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.wday { padding: 10px 10px; border-radius: 10px; background: rgba(20,8,4,.6); border: 1px solid #6b3a1e; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.wday.descanso { cursor: default; opacity: .55; }
.wday .wd { font: 700 11px Inter, sans-serif; color: #d9b99a; text-transform: uppercase; letter-spacing: .05em; }
.wday b { font-size: 13px; color: #f3e2c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wday .ws { font-size: 11px; color: #d9b99a; }
.wday.hecho { border-color: #4ade80; }
.wday.hecho .ws { color: #7fd38f; }
.wday.hoy { border-color: #ff6a3d; box-shadow: 0 0 0 1px #ff6a3d; }
.wday.sel { background: #5c2a0a; border-color: #ffb347; }
.dash-cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 4px; align-items: stretch; }
.dash-cols .hist li { padding: 7px 0; }
.dash .bars { height: 140px; }
.dash .note { margin: 12px 0 0; font-size: 12px; line-height: 1.45; color: #d9b99a; }
@media (min-width: 1101px) {
  .horde .app-body { max-width: 1640px; }
  .horde .dash .panel:not(.kpi) { border-width: 42px; border-image-width: 42px; }
  .horde .dash h2 { font-size: 17px; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .weekbig { grid-template-columns: repeat(7, minmax(64px, 1fr)); overflow-x: auto; }
  .kpi b { font-size: 24px; }
}

/* Mapa de seguimiento del plan (12 semanas × 7 días) */
.heat { display: grid; grid-template-columns: 16px repeat(12, 1fr); gap: 4px; align-items: center; }
.heat .hw { font: 700 10px Inter, sans-serif; text-align: center; color: #d9b99a; padding: 2px 0; border-bottom: 2px solid; }
.heat .hw.b0 { border-color: #a07a52; } .heat .hw.b1 { border-color: #d0662a; } .heat .hw.b2 { border-color: #e23b2a; }
.heat .hw.dl::after { content: 'D'; display: block; font-size: 8px; color: #8fb3ff; }
.heat .hw.now { color: #ffb347; background: rgba(255,179,71,.12); border-radius: 4px 4px 0 0; }
.heat .hd { font: 700 10px Inter, sans-serif; color: #d9b99a; }
.hc { display: block; height: 18px; border-radius: 4px; background: rgba(255,255,255,.04); border: 1px solid rgba(107,58,30,.5); }
.hc.done { background: #3fae5a; border-color: #7fd38f; }
.hc.part { background: #c9921e; border-color: #ffd56a; }
.hc.miss, .hc.skip { background: #5a1a12; border-color: #8a2a1a; }
.hc.todo { background: rgba(255,179,71,.18); border-color: #8a5a2a; }
.hc.opt { background: transparent; border: 1px dashed #8a5a2a; }
.hc.free { background: transparent; border-color: transparent; }
.hc.today { box-shadow: 0 0 0 2px #ff6a3d; }
.heat-leg, .heat-blocks { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; font-size: 11px; color: #d9b99a; }
.heat-leg span { display: inline-flex; align-items: center; gap: 5px; }
.heat-leg .hc { width: 12px; height: 12px; }
.heat-blocks span { padding-left: 14px; position: relative; }
.heat-blocks span::before { content: ''; position: absolute; left: 0; top: 50%; width: 10px; height: 3px; transform: translateY(-50%); }
.heat-blocks .b0::before { background: #a07a52; } .heat-blocks .b1::before { background: #d0662a; } .heat-blocks .b2::before { background: #e23b2a; }
.heat-blocks .dl { color: #8fb3ff; padding-left: 0; } .heat-blocks .dl::before { display: none; }
