/* GymLog — negro real, blanco y un solo acento azul. Sobria, rápida, táctil. */

:root {
  --bg: #0a0a0b;
  --surface: #141418;
  --surface-2: #1b1b21;
  --text: #f2f2f2;
  --text-dim: #9a9aa3;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --border: #26262c;
  --danger: #ef4444;
  --ok: #34d399;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

.num { font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0; font-weight: 650; }
h2 { font-size: 15px; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-dim); }

/* ── Layout ─────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.app-header .logo { width: 22px; height: 22px; }
.app-header h1 { font-size: 18px; letter-spacing: 0.2px; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 12px calc(84px + env(safe-area-inset-bottom));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card > h2 { margin-bottom: 10px; }

.muted { color: var(--text-dim); }
.small { font-size: 13px; }

/* ── Barra inferior ─────────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  min-height: 56px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.activa { color: var(--accent-light); }

/* ── Controles ──────────────────────────────────────────────────────── */
input, select, textarea, button { font: inherit; color: inherit; }

.campo {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
}
.campo:focus { border-color: var(--accent); }
select.campo { appearance: none; }

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.boton:active { transform: translateY(1px); }
.boton-primario {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 650;
  width: 100%;
}
.boton-primario:disabled { opacity: 0.6; }
.boton-peligro { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.boton-mini {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  font-size: 14px;
}

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

label.etiqueta { display: block; margin: 10px 0 6px; font-size: 13px; color: var(--text-dim); }

/* ── Main: fuerza ───────────────────────────────────────────────────── */
.pct-grande {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
}
.pct-grande.positivo { color: var(--accent-light); }
.pct-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.grafica-wrap { position: relative; height: 200px; margin: 12px 0 4px; }

.top-lista { list-style: none; margin: 10px 0 0; padding: 0; }
.top-lista li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.top-lista .pct { color: var(--accent-light); font-weight: 650; white-space: nowrap; }

/* ── Main: semana ───────────────────────────────────────────────────── */
.sets-total { font-size: 28px; font-weight: 700; }
.semana-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.semana-nav span { font-variant-numeric: tabular-nums; }
.semana-nav .boton-mini:disabled { opacity: 0.35; }
.grafica-semana { height: 190px; }
.semana-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 2px 0 4px;
}
.leyenda { font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.leyenda .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.leyenda .dot-dir { background: var(--accent); }
.leyenda .dot-ind { background: rgba(96, 165, 250, 0.38); margin-left: 10px; }

/* Hueco extra para que el FAB no tape la última tarjeta de Main. */
#view-main { padding-bottom: 56px; }

/* ── FAB ────────────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}
.fab[hidden] { display: none; }

/* ── Registrar ──────────────────────────────────────────────────────── */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.activa {
  border-color: var(--accent);
  color: var(--accent-light);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.lista-ejercicios { list-style: none; margin: 0; padding: 0; }
.lista-ejercicios li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.lista-ejercicios li:last-child { border-bottom: 0; }
.lista-ejercicios li:active { background: var(--surface-2); }
.ej-nombre { font-size: 15px; }
.ej-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.ej-hint {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--accent-light);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tag-acc,
.tag-ind {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  vertical-align: 1px;
}
.tag-ind {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-light);
}

.hoy-contador {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.registro-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.registro-fila .datos { font-size: 14px; }
.registro-fila .acciones { display: flex; gap: 6px; }

/* ── Hoja modal (formulario) ────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform 0.22s ease-out;
  max-height: 88vh;
  overflow-y: auto;
}
body.sheet-abierta .sheet-backdrop { opacity: 1; pointer-events: auto; }
body.sheet-abierta .sheet { transform: translateY(0); }

.sheet h3 { font-size: 17px; padding-right: 40px; }
.sheet .estado-ej { margin: 6px 0 4px; font-size: 13px; color: var(--text-dim); }
.sheet .estado-ej .pct { color: var(--accent-light); font-weight: 600; }
.sheet-cerrar {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
}

.stepper { display: flex; gap: 6px; }
.stepper .campo { text-align: center; font-size: 20px; font-weight: 650; }
.stepper button {
  flex: 0 0 52px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

/* ── Toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); }

/* ── Login ──────────────────────────────────────────────────────────── */
.login-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 22px;
  text-align: center;
}
.login-card .logo { width: 48px; height: 48px; margin-bottom: 10px; }
.login-card h1 { font-size: 22px; margin-bottom: 18px; }
.login-error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 10px 0 0; }

/* ── Ajustes ────────────────────────────────────────────────────────── */
.paginacion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.check-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chips label {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}
.check-chips input { display: none; }
.check-chips label:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent-light);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.vacio { text-align: center; color: var(--text-dim); padding: 18px 0; font-size: 14px; }
