/* Mi Rutina Gym — estilos */
:root {
  --bg: #0F1115;
  --bg2: #13161B;
  --card: #1A1D24;
  --card2: #15181E;
  --line: #262A33;
  --line2: #3A3F4B;
  --text: #F2F4F7;
  --muted: #A3A9B6;
  --dim: #7D8494;
  --lime: #C6F432;
  --orange: #FFB547;
  --blue: #6EC1FF;
  --red: #FF8A80;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--lime); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
input::placeholder { color: var(--dim); }
[hidden] { display: none !important; }

/* Quita flechas de los number */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ---------------------------------------------------------- Login */
body.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-wrap { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 28px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.auth-logo { width: 72px; height: 72px; border-radius: 20px; background: var(--lime); color: var(--bg); display: grid; place-items: center; }
.auth-kicker { margin: 4px 0 0; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); }
.auth-brand h1 { margin: 0; font-family: var(--display); font-size: 40px; line-height: 1.05; }
.auth-sub { margin: 0 auto; max-width: 320px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.fld input {
  height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line2);
  background: var(--card); color: var(--text); font-size: 16px; font-weight: 500;
}
.keep { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--card); cursor: pointer; }
.keep input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--lime); }
.keep span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.keep small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.auth-err { margin: 0; text-align: center; font-size: 14px; color: var(--red); }
.btn-main {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px;
  border: 0; border-radius: 16px; background: var(--lime); color: var(--bg);
  font-family: var(--display); font-weight: 700; font-size: 17px;
}
.auth-foot { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.auth-foot a { font-weight: 600; }

/* ---------------------------------------------------------- Estructura */
.shell { height: 100%; display: flex; justify-content: center; }
.col {
  position: relative; width: 100%; max-width: 640px; height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  border-left: 1px solid var(--card); border-right: 1px solid var(--card);
}
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

.hdr { padding: calc(20px + env(safe-area-inset-top)) 16px 14px; display: flex; flex-direction: column; gap: 14px; border-bottom: 1px solid var(--line); }
.hdr-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hdr h1 { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 700; }
.hdr-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 99px; border: 1px solid var(--line2); background: transparent;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill.on { background: var(--lime); color: var(--bg); border-color: var(--lime); }
.pill.dash { border-style: dashed; color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.dayedit { display: flex; gap: 8px; align-items: flex-end; }
.dayedit .fld { flex: 1; }
.dayedit .fld input { height: 44px; font-size: 15px; border-radius: 12px; }

.prog { display: flex; align-items: center; gap: 10px; }
.prog-bar { flex: 1; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.prog-bar > div { height: 100%; background: var(--lime); border-radius: 99px; transition: width .3s; }
.prog span { font-size: 12px; font-weight: 600; color: var(--muted); }

.content { padding: 16px 16px 28px; display: flex; flex-direction: column; gap: 22px; }

/* ---------------------------------------------------------- Avisos */
.note {
  display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line2);
}
.note p { margin: 0; flex: 1; font-size: 13px; line-height: 1.45; color: var(--muted); }
.note strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.note .btn-sm { flex: none; }
.btn-sm {
  min-height: 40px; padding: 0 14px; border-radius: 10px; border: 0;
  background: var(--lime); color: var(--bg); font-weight: 700; font-size: 13px;
}
.btn-sm.ghost { background: transparent; color: var(--text); border: 1px solid var(--line2); }

/* ---------------------------------------------------------- Resumen final */
.summary { background: var(--lime); color: var(--bg); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.summary .k { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.summary .big { margin: 4px 0 0; font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.summary .s { margin: 4px 0 0; font-size: 13px; font-weight: 500; }
.sum-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sum-grid div { background: rgba(15,17,21,.1); border-radius: 12px; padding: 10px; }
.sum-grid p { margin: 0; font-size: 11px; font-weight: 600; }
.sum-grid b { display: block; margin-top: 2px; font-family: var(--display); font-size: 18px; font-variant-numeric: tabular-nums; }
.summary .btn-save { min-height: 50px; border: 0; border-radius: 12px; background: var(--bg); color: var(--lime); font-family: var(--display); font-weight: 700; font-size: 16px; }

/* ---------------------------------------------------------- Secciones y ejercicios */
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-head { display: flex; align-items: center; gap: 10px; }
.sec-head .dot { width: 10px; height: 10px; border-radius: 99px; background: var(--c); }
.sec-head h2 { margin: 0; flex: 1; font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.sec-head span { font-size: 12px; font-weight: 600; color: var(--muted); }
.empty { margin: 0; padding: 14px; border-radius: 14px; background: var(--card2); font-size: 13px; color: var(--muted); }

.ej { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.ej.done { border-color: var(--c); }
.ej-row { display: flex; align-items: center; gap: 12px; }
.check {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: transparent; color: transparent; border: 2px solid var(--line2);
}
.check.on { background: var(--c); border-color: var(--c); color: var(--bg); }
.ej-info { flex: 1; min-width: 0; }
.ej-info h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ej.done .ej-info h3 { color: var(--muted); text-decoration: line-through; }
.ej-info p { margin: 3px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.crono {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line2); background: transparent;
  font-family: var(--display); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
}
.crono.has { border-color: var(--blue); }
.crono.on { background: var(--blue); border-color: var(--blue); color: var(--bg); }

.ed-btns { display: flex; gap: 6px; flex: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line2); background: transparent;
}
.icon-btn.danger { border-color: #5A2A2A; color: var(--red); }

.sets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-left: 56px; }
.set {
  min-width: 52px; height: 40px; padding: 0 12px; border-radius: 10px;
  font-size: 13px; font-weight: 600; background: transparent;
  border: 1px dashed var(--line2); color: var(--dim);
}
.set.next { border: 2px solid var(--c); color: var(--text); }
.set.on { background: var(--c); border: 1px solid var(--c); color: var(--bg); }

.peso-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-left: 56px; flex-wrap: wrap; }
.peso {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px;
  border: 1px solid var(--line2); border-radius: 10px; background: var(--bg);
}
.peso span { font-size: 12px; color: var(--muted); }
.peso input {
  width: 58px; background: transparent; border: 0; color: var(--text); text-align: right;
  font-family: var(--display); font-weight: 700; font-size: 15px; outline: none;
}
.peso-ult { font-size: 12px; color: var(--muted); }

.add-btn {
  min-height: 44px; border-radius: 12px; border: 1px dashed var(--line2); background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.ghost-btn {
  min-height: 48px; border-radius: 14px; border: 1px solid var(--line2); background: transparent;
  font-size: 14px; font-weight: 600;
}

/* ---------------------------------------------------------- Barra de descanso */
.rest { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--card); border-top: 2px solid var(--orange); }
.rest-info { flex: 1; min-width: 0; }
.rest-info p { margin: 0; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rest-info b { display: block; font-family: var(--display); font-size: 22px; color: var(--orange); font-variant-numeric: tabular-nums; }
.rest .btn-sm { background: var(--orange); }

/* ---------------------------------------------------------- Navegación */
.nav { display: flex; border-top: 1px solid var(--line); background: var(--bg2); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); }
.nav-btn {
  flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500;
}
.nav-btn.on { color: var(--lime); font-weight: 600; }

/* ---------------------------------------------------------- Formulario (hoja inferior) */
.overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); display: flex; flex-direction: column; justify-content: flex-end; z-index: 20; }
.overlay.center { justify-content: center; align-items: center; padding: 24px; }
.sheet {
  background: var(--card); border-radius: 22px 22px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; max-height: 92%; overflow-y: auto;
}
.sheet h2 { margin: 0; font-family: var(--display); font-size: 20px; }
.sheet .fld { font-size: 12px; }
.sheet .fld input { height: 44px; border-radius: 12px; font-size: 15px; background: var(--bg); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 6px; text-align: center;
  border-radius: 12px; border: 1px solid var(--line2); font-size: 12px; font-weight: 600; cursor: pointer;
}
.seg input:checked + span { background: var(--c); border-color: var(--c); color: var(--bg); }
.seg input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 2px; }
.legend { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border-radius: 12px; background: var(--bg); border: 1px solid var(--line2); cursor: pointer;
}
.toggle-row span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; }
.toggle-row small { font-size: 12px; font-weight: 400; color: var(--muted); }
.toggle-row input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--lime); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hint { margin: -4px 0 0; font-size: 12px; color: var(--dim); }
.err { margin: -6px 0 0; font-size: 12px; color: var(--red); }
.row-btns { display: flex; gap: 10px; margin-top: 4px; }
.row-btns button { flex: 1; min-height: 50px; border-radius: 14px; font-weight: 600; font-size: 15px; }
.btn-cancel { border: 1px solid var(--line2); background: transparent; }
.btn-ok { border: 0; background: var(--lime); color: var(--bg); font-family: var(--display); font-weight: 700 !important; }
.btn-danger { border: 0; background: var(--red); color: var(--bg); font-family: var(--display); font-weight: 700 !important; }

/* ---------------------------------------------------------- Confirmación */
.modal {
  width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line2); border-radius: 20px;
  padding: 22px 18px 18px; display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.modal-ico { width: 52px; height: 52px; margin: 0 auto; border-radius: 16px; background: #3A1F1F; color: var(--red); display: grid; place-items: center; }
.modal h2 { margin: 0; font-family: var(--display); font-size: 20px; }
.modal p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---------------------------------------------------------- Toast */
.toast {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 14px; right: 14px; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; border-radius: 16px;
  background: var(--blue); color: var(--bg); box-shadow: 0 12px 32px rgba(0,0,0,.45);
}
.toast.bad { background: var(--red); }
.toast div { flex: 1; min-width: 0; }
.toast b { display: block; font-size: 15px; }
.toast span { font-size: 13px; font-weight: 500; }
.toast button { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 0; background: rgba(15,17,21,.12); display: grid; place-items: center; }

/* ---------------------------------------------------------- Progreso */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats div { background: var(--card); border-radius: 14px; padding: 12px; }
.stats p { margin: 0; font-size: 11px; color: var(--muted); }
.stats b { display: block; margin-top: 4px; font-family: var(--display); font-size: 22px; }
.stats b.up { color: var(--lime); }
.chart { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chart h2 { margin: 0; font-size: 15px; font-weight: 600; }
.chart .sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.bars { height: 180px; display: grid; gap: 8px; align-items: end; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bar .v { font-size: 11px; font-weight: 600; }
.bar .b { width: 100%; border-radius: 8px 8px 4px 4px; background: var(--line2); }
.bar.last .b { background: var(--lime); }
.bar .d { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.bar .d b { font-size: 12px; }
.bar .d small { font-size: 10px; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card); }
.li div { flex: 1; min-width: 0; }
.li p { margin: 0; font-size: 14px; font-weight: 600; }
.li small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.li .r { flex: none; text-align: right; }
.li .r b { font-family: var(--display); font-size: 17px; }

/* ---------------------------------------------------------- Administración */
a.nav-btn, a.icon-btn { text-decoration: none; color: inherit; }
a.nav-btn { color: var(--muted); }
a.nav-btn.on { color: var(--lime); }
a.icon-btn.danger { color: var(--red); }
.btn-link { display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text); }
.li.user { align-items: flex-start; }
.li.user p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line2); font-size: 11px; font-weight: 600; color: var(--muted); }
.tag-admin { border-color: var(--lime); color: var(--lime); }
.seg2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.note-ok { border-color: var(--lime); }
.note-bad { border-color: var(--red); }
form.modal { margin: 0; }

@media (min-width: 700px) {
  .hdr h1 { font-size: 32px; }
}
