:root {
  --bg: #0b1016;
  --bg2: #111821;
  --card: #151e29;
  --card2: #1b2633;
  --line: #263344;
  --text: #e6edf5;
  --muted: #8a9bb0;
  --accent: #a3e635;
  --accent2: #f97316;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #38bdf8;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
small, .muted { color: var(--muted); }
b, strong { font-weight: 700; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem;
  background: rgba(11, 16, 22, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; color: var(--text); font-size: 1.05rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: .45rem .75rem; border-radius: 9px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.nav a.active { color: #0b1016; background: var(--accent); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); font-size: 1.2rem; border-radius: 8px; padding: .2rem .6rem; cursor: pointer; }

.container { max-width: 1240px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem 2rem; border-top: 1px solid var(--line); }

/* ---------- Layout ---------- */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.mt { margin-top: 1rem; }
.mt2 { margin-top: 2rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.right { margin-left: auto; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  min-width: 0;
}
.card--hero { background: linear-gradient(135deg, #17222f 0%, #12301f 100%); border-color: #2c4a2c; }
.card__title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card__title h2 { margin: 0; }

/* ---------- KPI ---------- */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.kpi__label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi__value { font-size: 1.7rem; font-weight: 800; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: .85rem; font-weight: 600; }
.kpi__sub { color: var(--muted); font-size: .82rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.stat { background: var(--card2); border-radius: 10px; padding: .6rem .75rem; }
.stat__l { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat__v { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Progreso objetivo ---------- */
.goalbar { position: relative; height: 14px; background: var(--card2); border-radius: 99px; overflow: hidden; margin: .6rem 0 .3rem; }
.goalbar__fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 99px; }
.goalbar__labels { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.badge--baja { background: rgba(59,130,246,.18); color: #93c5fd; }
.badge--media { background: rgba(234,179,8,.18); color: #fde047; }
.badge--alta { background: rgba(239,68,68,.18); color: #fca5a5; }
.badge--test { background: rgba(168,85,247,.2); color: #d8b4fe; }
.badge--pesas { background: rgba(249,115,22,.18); color: #fdba74; }
.badge--descanso { background: rgba(100,116,139,.2); color: #cbd5e1; }
.badge--done { background: rgba(34,197,94,.18); color: #86efac; }
.tgt { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ---------- Mensajes / insights ---------- */
.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.flash--ok { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.4); }
.flash--error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.4); }
.flash--info { background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.4); }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.insights li { padding: .6rem .8rem .6rem 2.2rem; border-radius: 10px; background: var(--card2); position: relative; }
.insights li::before { position: absolute; left: .75rem; top: .6rem; }
.insights .ok::before { content: "✅"; }
.insights .info::before { content: "💡"; }
.insights .alerta::before { content: "⚠️"; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
td.num, th.num { text-align: right; }
tbody tr:hover { background: var(--card2); }

/* ---------- Formularios ---------- */
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; font-weight: 500; }
input, select, textarea {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: .55rem .7rem; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field { margin-bottom: .8rem; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  background: var(--accent); color: #0b1016; border: 0; border-radius: 9px;
  padding: .55rem 1rem; font: inherit; font-weight: 700; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn--danger { background: transparent; color: var(--bad); border: 1px solid rgba(239,68,68,.5); }
.btn--sm { padding: .3rem .65rem; font-size: .82rem; }

/* ---------- Plan ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .75rem; display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.day--today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.day--past { opacity: .8; }
.day__head { display: flex; justify-content: space-between; align-items: baseline; font-size: .8rem; color: var(--muted); font-weight: 600; }
.day__title { font-weight: 700; font-size: .92rem; line-height: 1.25; }
.day__meta { font-size: .78rem; color: var(--muted); }
.day__done { font-size: .8rem; background: rgba(34,197,94,.1); border-radius: 8px; padding: .35rem .5rem; }
.day__done a { color: #86efac; }
.wprofile { width: 100%; height: 46px; display: block; background: var(--bg2); border-radius: 6px; }
.wprofile .ftpline { stroke: rgba(255,255,255,.35); stroke-dasharray: 6 6; stroke-width: 1; vector-effect: non-scaling-stroke; }
.session-detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; }
.session-detail .wprofile { height: 90px; }
.blocks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; }
.block { background: var(--card2); border-radius: 10px; padding: .6rem .7rem; font-size: .82rem; border: 1px solid transparent; }
.block--current { border-color: var(--accent); }
.block__n { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.block__name { font-weight: 700; }

/* ---------- Zonas ---------- */
.zbar { display: grid; grid-template-columns: 42px 1fr 118px; gap: .5rem; align-items: center; font-size: .82rem; margin-bottom: .3rem; }
.zbar__track { height: 12px; background: var(--card2); border-radius: 6px; overflow: hidden; }
.zbar__fill { height: 100%; border-radius: 6px; }
.zbar .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.zone-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

/* ---------- Subida ---------- */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 2.5rem 1rem; text-align: center;
  background: var(--card); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: #16241a; }
.dropzone__icon { font-size: 2.6rem; }

.chart-box { position: relative; height: 300px; }
.chart-box--sm { height: 220px; }
#map { height: 340px; border-radius: 10px; }

/* ---------- Login ---------- */
.login { max-width: 360px; margin: 12vh auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blocks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .session-detail { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem; }
  body.nav-open .nav { display: flex; }
  .container { padding: 1rem 16px 2.5rem; }
  .week { grid-template-columns: minmax(0, 1fr); }
  .blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.35rem; }
  .kpi__value { font-size: 1.4rem; }
}
@media (max-width: 480px) {
  .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Tabla de pasos del entrenamiento */
.steps th, .steps td { padding: .45rem .4rem; font-size: .85rem; }
.steps td:first-child { white-space: normal; }

/* Barra de progreso (importación de iGPSPORT) */
.progress { height: 10px; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--accent); transition: width .3s ease; }
.mb { margin-bottom: 16px; }

/* Lugar de la sesión y ayuda de MyWhoosh */
.lugar { font-size: .88rem; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .75rem; }
.mywhoosh { font-size: .86rem; margin-top: .5rem; }
.mywhoosh summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.mywhoosh ol { margin: .5rem 0; padding-left: 1.3rem; }
.mywhoosh p { font-size: .8rem; margin: .25rem 0 0; }
