/* FORJA - carbon + naranja fuego, mobile-first */
:root {
  --fondo: #101014;
  --panel: #191922;
  --panel2: #21212c;
  --borde: #2c2c3a;
  --texto: #f2f0ec;
  --texto2: #a9a7b0;
  --primario: #ff6b35;
  --primario2: #ffb347;
  --ok: #45d483;
  --error: #ff5d6c;
  --radio: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--fondo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 92px; }
.cargando { text-align: center; padding-top: 30vh; color: var(--texto2); }
.cargando img { animation: latir 1.2s infinite; }
@keyframes latir { 50% { transform: scale(1.08); } }

h1, h2, .stat b, .marca b, .precio-card .monto {
  font-family: 'Barlow Condensed', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .5px;
}
h1 { font-size: 32px; margin-bottom: 4px; font-weight: 700; }
h2 { font-size: 22px; margin: 18px 0 10px; font-weight: 600; }
h3 { font-size: 16px; margin: 12px 0 6px; }
p { line-height: 1.5; }
.sub { color: var(--texto2); font-size: 14px; margin-bottom: 16px; }
.marca { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.marca img { width: 40px; height: 40px; }
.marca b { font-size: 22px; letter-spacing: 2px; }

.card { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; margin-bottom: 14px; }
.card.suave { background: var(--panel2); }

label { display: block; font-size: 14px; color: var(--texto2); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 12px 13px; border-radius: 10px; border: 1px solid var(--borde);
  background: var(--panel2); color: var(--texto); font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primario); }
/* sin spinners nativos blancos de Windows en los campos numericos */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.btn {
  display: inline-block; width: 100%; padding: 14px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--primario), #ff8f4d); color: #1a1108;
  font-weight: 700; font-size: 16px; cursor: pointer; text-align: center; margin-top: 14px;
}
.btn:disabled { background: var(--panel2); color: var(--texto2); border: 1px solid var(--borde); opacity: 1; }
.btn.sec { background: var(--panel2); color: var(--texto); border: 1px solid var(--borde); }
.btn.chico { width: auto; padding: 11px 16px; font-size: 15px; margin-top: 8px; min-height: 44px; }
.btn.peligro { background: transparent; border: 1px solid var(--error); color: var(--error); }

.error-msg { background: rgba(255,93,108,.12); border: 1px solid var(--error); color: var(--error); padding: 10px 12px; border-radius: 10px; margin-top: 12px; font-size: 14px; }
.ok-msg { background: rgba(69,212,131,.12); border: 1px solid var(--ok); color: var(--ok); padding: 10px 12px; border-radius: 10px; margin-top: 12px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  padding: 11px 16px; border-radius: 999px; border: 1px solid var(--borde);
  background: var(--panel2); color: var(--texto2); font-size: 15px; cursor: pointer; user-select: none;
  min-height: 44px; display: inline-flex; align-items: center;
}
.chip.activo { border-color: var(--primario); color: var(--primario); background: rgba(255,107,53,.1); font-weight: 600; }

.paso-barra { display: flex; gap: 6px; margin: 10px 0 18px; }
.paso-barra i { flex: 1; height: 5px; border-radius: 3px; background: var(--borde); }
.paso-barra i.on { background: var(--primario); }

.fila { display: flex; gap: 10px; }
.fila > * { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; color: var(--primario); }
.stat span { font-size: 12px; color: var(--texto2); }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; text-align: center; padding: 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--borde); color: var(--texto2); cursor: pointer; font-size: 14px; }
.tab.activo { color: var(--primario); border-color: var(--primario); font-weight: 700; }

.ejercicio { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--borde); gap: 8px; }
.ejercicio:last-child { border-bottom: 0; }
.ejercicio .nom { font-weight: 600; font-size: 15px; }
.ejercicio .det { color: var(--texto2); font-size: 14px; }
.ejercicio.clicable { cursor: pointer; }
.panel-ejercicio { background: var(--panel2); border: 1px solid var(--borde); border-radius: 10px; padding: 12px; margin: 4px 0 10px; }
.ejercicio .esquema { color: var(--primario2); font-weight: 700; white-space: nowrap; font-size: 14px; }

.macros-fila { display: flex; gap: 8px; margin: 8px 0; }
.macro { flex: 1; background: var(--panel2); border-radius: 10px; padding: 8px; text-align: center; font-size: 12px; color: var(--texto2); }
.macro b { display: block; font-size: 15px; color: var(--texto); }

.chat-caja { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; min-height: 40vh; }
.burbuja { max-width: 85%; padding: 11px 14px; border-radius: 16px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
.burbuja.yo { align-self: flex-end; background: var(--primario); color: #1a1108; border-bottom-right-radius: 4px; }
.burbuja.coach { align-self: flex-start; background: var(--panel2); border: 1px solid var(--borde); border-bottom-left-radius: 4px; }
.burbuja.seguridad { border-color: var(--error); background: rgba(255,93,108,.1); }
.chat-input { display: flex; gap: 8px; }
.chat-input input { flex: 1; }
.chat-input button { width: auto; margin: 0; padding: 0 18px; }

.notif { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--borde); font-size: 14px; }
.notif:last-child { border-bottom: 0; }
.notif.noleida::before { content: ""; min-width: 8px; height: 8px; border-radius: 50%; background: var(--primario); margin-top: 6px; }

.banner { border: 1px solid var(--primario); background: rgba(255,107,53,.08); border-radius: var(--radio); padding: 14px; margin-bottom: 14px; }
.banner b { color: var(--primario); }

.aviso-salud { font-size: 12px; color: var(--texto2); line-height: 1.5; border-top: 1px solid var(--borde); margin-top: 22px; padding-top: 12px; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: rgba(16,16,20,.96);
  border-top: 1px solid var(--borde); backdrop-filter: blur(8px); z-index: 50;
}
.nav-inner { max-width: 560px; margin: 0 auto; display: flex; }
.nav a { flex: 1; text-align: center; padding: 10px 4px calc(10px + env(safe-area-inset-bottom)); color: var(--texto2); text-decoration: none; font-size: 12px; }
.nav a.activo { color: var(--primario); }
.nav a span { display: block; font-size: 20px; margin-bottom: 2px; }

canvas.chart { width: 100%; height: 160px; background: var(--panel2); border-radius: 10px; }

/* biblioteca guia */
.guia-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.guia-card { background: var(--panel); border: 1px solid var(--borde); border-radius: 12px; padding: 8px; cursor: pointer; }
.guia-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; background: #fff; border: 1px solid var(--borde); filter: brightness(.92) saturate(.85); }
.guia-placeholder { width: 100%; aspect-ratio: 4/3; border-radius: 8px; background: var(--panel2); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.guia-nombre { font-weight: 600; font-size: 14px; margin-top: 7px; line-height: 1.3; }
.thumb { width: 52px; height: 44px; object-fit: cover; border-radius: 8px; background: #fff; flex-shrink: 0; border: 1px solid var(--borde); filter: brightness(.92) saturate(.85); }
.thumb-ph { display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--panel2); }

.precio-card { border: 1px solid var(--borde); border-radius: var(--radio); padding: 18px; margin-bottom: 14px; background: var(--panel); }
.precio-card.destacado { border-color: var(--primario); box-shadow: 0 0 24px rgba(255,107,53,.15); }
.precio-card .monto { font-size: 32px; font-weight: 800; color: var(--primario); }
.precio-card ul { margin: 10px 0 0 18px; color: var(--texto2); font-size: 14px; line-height: 1.7; }
.etiqueta { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px; background: rgba(255,107,53,.15); color: var(--primario); font-weight: 700; margin-bottom: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--borde); }
th { color: var(--texto2); font-weight: 600; }
.mono { font-family: ui-monospace, monospace; }
.copiable { cursor: pointer; color: var(--primario2); }
.mini { font-size: 14px; color: var(--texto2); }

/* home hero */
.card.hero { border-color: rgba(255,107,53,.45); box-shadow: 0 0 28px rgba(255,107,53,.08); }

/* coach con cara */
.fila-coach { display: flex; gap: 8px; align-items: flex-end; }
.avatar-coach {
  width: 30px; height: 30px; min-width: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primario), #ff8f4d); color: #1a1108;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 17px;
}

/* macros con color (proteina verde, carbos azul, grasa ambar) */
.mac-p b { color: #45d483; } .mac-c b { color: #5aa9ff; } .mac-g b { color: #ffb347; }
.barra-macros { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 4px 0 10px; }
.barra-macros i { display: block; height: 100%; }
.seg-p { background: #45d483; } .seg-c { background: #5aa9ff; } .seg-g { background: #ffb347; }

/* calendario de asistencia (estilo Hevy: sin dias "fallados", solo logro) */
.cal-cabecera { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav { background: var(--panel2); border: 1px solid var(--borde); color: var(--texto); border-radius: 8px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; }
.cal-dia { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 13px; color: var(--texto2); position: relative; }
.cal-dia.hoy { border: 1px solid var(--primario2); }
.cal-dia.entreno { background: var(--primario); color: #1a1108; font-weight: 700; }
.cal-dia.visita { background: var(--panel2); border: 1px solid var(--texto2); color: var(--texto); }
.punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 2px; }
.punto.naranja { background: var(--primario); }
.punto.gris { background: var(--panel2); border: 1px solid var(--texto2); }

/* celebracion post-entreno: chispas de fragua */
.celebracion { position: relative; overflow: hidden; }
.chispa {
  position: absolute; bottom: 8px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--primario2); opacity: 0;
  animation: chispa-sube 950ms ease-out forwards;
}
.chispa:nth-child(odd) { background: var(--primario); width: 4px; height: 4px; }
@keyframes chispa-sube {
  0% { opacity: 0; transform: translateY(0) scale(1); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-150px) scale(.2); }
}
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay-caja { max-width: 420px; width: 100%; max-height: 92dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; }
.overlay-caja img { width: 100%; border-radius: 10px; }
.centrado { text-align: center; }
.mt0 { margin-top: 0; }
