/* Orión Fitness Boutique — tema claro basado en el logo (violeta #6240B0, tinta #121413) */
:root {
  --bg: #F6F4FA;
  --card: #FFFFFF;
  --ink: #121413;
  --muted: #6B6880;
  --line: #E7E3F0;
  --violet: #6240B0;
  --violet-dark: #32216A;
  --violet-soft: #F3EFFC;
  --ok: #1F9D63;
  --danger: #D64545;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(50, 33, 106, .06), 0 6px 20px rgba(50, 33, 106, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Montserrat", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--violet); }
.muted { color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.marca { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 800; letter-spacing: .14em; font-size: 17px; }
.marca:hover { text-decoration: none; }
.marca img { width: 28px; height: 28px; }
.marca small { display: block; font-size: 8.5px; letter-spacing: .2em; color: var(--violet); font-weight: 600; margin-top: -2px; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; white-space: nowrap; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13px; }
.nav a:hover, .nav a.activo { background: var(--violet-soft); color: var(--violet); text-decoration: none; }

.contenedor { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.volver { display: inline-block; margin-bottom: 10px; font-size: 13px; font-weight: 600; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.kpi { background: var(--violet-soft); border-radius: 12px; padding: 12px 14px; }
.kpi > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 22px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 12px; font-weight: 600; color: var(--muted); }
dl.datos { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.datos dt { color: var(--muted); }
dl.datos dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 14px; border: 0; border-radius: 10px;
  padding: 11px 18px; background: var(--violet); color: #fff; cursor: pointer;
}
.boton:hover { background: var(--violet-dark); text-decoration: none; }
.boton:disabled { opacity: .45; cursor: not-allowed; }
.boton.sec { background: var(--violet-soft); color: var(--violet); }
.boton.sec:hover { background: #E6DEF9; }
.boton.peligro { background: #FCEBEB; color: var(--danger); }
.boton.grande { padding: 15px 22px; font-size: 16px; width: 100%; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acciones form { margin: 0; }

/* ---------- Formularios ---------- */
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 4px; margin: 0 0 16px; background: var(--card); }
legend { padding: 0 6px; font-weight: 700; color: var(--violet); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.campo { margin-bottom: 14px; flex: 1; min-width: 140px; }
.fila { display: flex; gap: 12px; flex-wrap: wrap; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(98, 64, 176, .25); border-color: var(--violet); }
input[type=checkbox] { width: auto; }
input[type=range] { padding: 0; accent-color: var(--violet); }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tabla td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: var(--violet-soft); }
.vacio { text-align: center; color: var(--muted); padding: 28px 10px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--violet-soft); color: var(--violet); }
.chip.zona { color: var(--ink); min-width: 64px; text-align: center; }

/* ---------- Mensajes ---------- */
.flash { background: var(--violet-soft); border: 1px solid #DCD2F5; color: var(--violet-dark); padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; font-weight: 500; }
.aviso { background: #FFF6E0; border: 1px solid #F3DD9E; color: #6E5512; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, #EDE6FB 0%, var(--bg) 60%); }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login img.logo { display: block; width: 150px; margin: 0 auto 6px; }
.login .lema { text-align: center; font-weight: 800; font-size: 12px; letter-spacing: .08em; margin: 0 0 22px; color: var(--violet-dark); }

/* ---------- Sesión en vivo ---------- */
.paso { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.paso .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--violet); color: #fff; font-weight: 800; font-size: 13px; flex: none; }
.paso h2 { margin: 0; }
.estado { font-size: 13px; color: var(--muted); font-weight: 600; }
.estado.ok { color: var(--ok); }
.monitor { border-radius: 18px; padding: 22px 18px; text-align: center; transition: background .4s; background: var(--violet-soft); }
.monitor .bpm { font-size: 84px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.monitor .bpm small { font-size: 18px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.monitor .zona-act { font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: 14px; margin-top: 6px; }
.reloj { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.barras { display: grid; gap: 7px; }
.barra { display: grid; grid-template-columns: 54px 1fr 52px; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; }
.barra .pista { height: 12px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.barra .relleno { height: 100%; width: 0; transition: width .5s; }
.barra .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
canvas.grafica { width: 100%; height: 240px; display: block; }
.musculos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 14px; }
.musculos label { display: flex; justify-content: space-between; margin-bottom: 2px; }
.musculos output { color: var(--violet); font-weight: 800; }
details > summary { cursor: pointer; font-weight: 700; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: " ▾"; color: var(--violet); }
.fijo-abajo { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }

@media (max-width: 640px) {
  h1 { font-size: 20px; }
  .marca small { display: none; }
  .nav a { padding: 6px 9px; font-size: 12.5px; }
  .ocultar-movil { display: none; }
  .monitor .bpm { font-size: 72px; }
}
