/* FitCamp · Mi Progreso — paleta Mi Turno: lima solo acentos · noche · papel · tinta */
:root {
  --lime: #C8F03E;
  --night: #0B0B0F;
  --ink: #121118;
  --paper: #F5F5F2;

  --bg: var(--paper);
  --surface: #FFFFFF;
  --text: var(--ink);
  --muted: #5F5E68;
  --line: #E2E2DC;
  --field: #FFFFFF;
  --field-line: #CBCBC4;
  --banner: var(--night);

  --card: var(--night);
  --card-border: transparent;
  --card-text: #F5F5F2;
  --card-muted: #A3A3AD;
  --card-chip: rgba(255, 255, 255, .09);

  --danger: #B42318;
  --skew: -10deg;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0B0F;
    --surface: #15151B;
    --text: #F2F2EE;
    --muted: #A3A3AD;
    --line: #2A2A33;
    --field: #1B1B22;
    --field-line: #3A3A45;
    --banner: #1F1F27;
    --card: #15151B;
    --card-border: #26262F;
    --danger: #FF8A80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 "Montserrat", system-ui, sans-serif;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }

/* ---------- Cabecera ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--night);
  border-bottom: 3px solid var(--lime);
}
.logo { height: 34px; width: auto; display: block; }
.top-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hola { color: #F5F5F2; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.demo {
  padding: 10px 16px; font-size: 13px;
  background: rgba(200, 240, 62, .32); color: var(--text);
  border-bottom: 1px solid var(--line);
}
.demo code { font-size: 12px; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- Tipografía de marca ---------- */
.banner {
  position: relative; display: inline-block;
  margin: 4px 0 8px; padding: 6px 22px 2px;
  font: 400 clamp(34px, 7vw, 52px)/1 "Bebas Neue", sans-serif;
  letter-spacing: .02em; color: #fff;
}
.banner::before {
  content: ""; position: absolute; inset: 0;
  background: var(--banner); border-radius: 6px; transform: skewX(var(--skew));
}
.banner > span { position: relative; }
.hl { color: var(--lime); }
.eyebrow {
  margin: 0; font-weight: 800; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.summary { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.section {
  margin: 32px 0 12px; font: 400 30px/1 "Bebas Neue", sans-serif; letter-spacing: .03em;
}
.section small {
  font: 700 12px "Montserrat", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-left: 8px;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap; transition: transform .08s, box-shadow .12s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--lime); color: var(--night); box-shadow: 3px 3px 0 var(--night); }
.btn.primary:hover { box-shadow: 5px 5px 0 var(--night); }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { box-shadow: none; } }
.btn.ghost { background: transparent; border-color: var(--field-line); color: var(--text); }
.btn.ghost:hover { border-color: var(--text); }
.btn.ghost-dark { background: transparent; border-color: rgba(255, 255, 255, .28); color: #F5F5F2; }
.btn.danger { background: transparent; border-color: transparent; color: var(--danger); padding: 0 8px; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 11px; }
.btn.block { width: 100%; }
.link {
  background: none; border: 0; padding: 6px 0; cursor: pointer;
  color: var(--text); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px;
}
.back { text-decoration: none; margin-bottom: 8px; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

/* ---------- Formularios ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
label small { font-weight: 500; color: var(--muted); }
input, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  font-size: 16px; font-weight: 500;
  background: var(--field); border: 1.5px solid var(--field-line); border-radius: 12px;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(200, 240, 62, .75); }
.msg { min-height: 1.5em; margin: 12px 0 0; font-weight: 700; font-size: 14px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--text); }
.hint { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Entrar / crear cuenta ---------- */
.auth-card {
  max-width: 440px; margin: 12px auto 0; padding: 28px 22px;
  background: var(--surface); border-radius: 22px;
  box-shadow: 6px 6px 0 var(--lime);
}
@media (prefers-color-scheme: dark) { .auth-card { border: 1px solid var(--line); } }
.auth-card .banner { margin-bottom: 22px; }
.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 20px;
  background: var(--bg); border-radius: 999px; border: 1px solid var(--line);
}
.tabs button {
  min-height: 42px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font-weight: 800; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.tabs button[aria-selected="true"] { background: var(--night); color: #fff; }
@media (prefers-color-scheme: dark) { .tabs button[aria-selected="true"] { background: var(--lime); color: var(--night); } }

/* ---------- Encabezado de página ---------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
}
.page-head > div { min-width: 0; }

/* ---------- Tarjetas de cada medida / ejercicio ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid-med { grid-template-columns: repeat(2, 1fr); } /* 4 tarjetas: 2 × 2 */
}
.card {
  background: var(--card); color: var(--card-text);
  border: 1px solid var(--card-border); border-radius: 18px;
  padding: 18px 18px 12px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card h3 {
  margin: 2px 0 0; font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--card-muted);
}
.delta {
  flex: none; padding: 4px 10px; border-radius: 999px;
  background: var(--card-chip); color: var(--card-text);
  font-weight: 700; font-size: 12px; white-space: nowrap;
}
.delta.good { background: var(--lime); color: var(--night); }
.big { margin-top: 6px; font-weight: 800; font-size: 40px; line-height: 1.1; }
.big small { font-weight: 500; font-size: 14px; color: var(--card-muted); margin-left: 2px; }
.foot { margin: 2px 0 0; font-size: 12px; color: var(--card-muted); }
.chart-box { position: relative; height: 150px; margin-top: 10px; }
.chart-box.solo { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; color: var(--card-muted); border: 1px dashed var(--card-chip); border-radius: 12px; padding: 12px; }

/* ---------- Historial ---------- */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { padding: 12px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tabla th { font-weight: 800; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tabla td { font-variant-numeric: tabular-nums; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla th:first-child, .tabla td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.tabla tbody tr { cursor: pointer; }
.tabla tbody tr:hover td { background: var(--bg); }
.tabla .editar { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700; text-align: left; }
.tabla .nota { display: block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 500; color: var(--muted); }
.tabla .grupo th { padding-bottom: 0; border-bottom: 0; color: var(--text); }

.empty {
  margin-top: 20px; padding: 28px 22px; text-align: center;
  background: var(--surface); border: 2px dashed var(--field-line); border-radius: 18px;
}
.empty p { margin: 0 auto; max-width: 460px; color: var(--muted); }
.empty .empty-title { font: 400 30px/1.1 "Bebas Neue", sans-serif; color: var(--text); margin-bottom: 8px; letter-spacing: .03em; }

/* ---------- Panel del coach ---------- */
.search { margin: 20px 0 12px; }
.clients { display: flex; flex-direction: column; gap: 8px; }
.client {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 14px 16px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.client:hover { border-color: var(--text); }
.client .who { min-width: 0; }
.client .name { display: block; font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client .mail { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client .meta { flex: none; text-align: right; font-size: 13px; color: var(--muted); }
.client .meta b { display: block; color: var(--text); font-size: 14px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 700; }

/* ---------- Pestañas de sección ---------- */
.nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; max-width: 560px; margin: 0 0 22px; }
.tabs button[aria-current="page"] { background: var(--night); color: #fff; }
@media (prefers-color-scheme: dark) { .tabs button[aria-current="page"] { background: var(--lime); color: var(--night); } }
.persona-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.persona-bar .back { margin: 0; }
.persona-bar .tabs { margin: 0; min-width: 240px; }

/* ---------- Rutinas (tarjetas) ---------- */
.rutinas { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 20px; }
@media (min-width: 720px) { .rutinas { grid-template-columns: repeat(2, 1fr); } }
.rutinas > .empty { grid-column: 1 / -1; margin-top: 0; }
.rutina {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; min-width: 0;
  padding: 18px; text-align: left; cursor: pointer;
  background: var(--card); color: var(--card-text);
  border: 1px solid var(--card-border); border-radius: 18px;
  transition: transform .08s;
}
.rutina:active { transform: translateY(1px); }
.rutina.oculta { opacity: .6; }
.r-nombre { font: 400 34px/1 "Bebas Neue", sans-serif; letter-spacing: .03em; overflow-wrap: anywhere; }
.r-meta { font-size: 13px; font-weight: 700; color: var(--card-muted); }
.r-desc { font-size: 14px; }
.r-lista { font-size: 13px; color: var(--card-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.r-go {
  margin-top: 8px; padding: 9px 16px; border-radius: 999px;
  background: var(--lime); color: var(--night);
  font-weight: 800; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}

/* ---------- Historial de entrenos ---------- */
.historial { display: flex; flex-direction: column; gap: 8px; }
.historial > .btn { align-self: center; margin-top: 4px; }
.hist {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 10px 16px 10px 10px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.hist:hover { border-color: var(--text); }
.hist-fecha {
  flex: none; width: 54px; height: 54px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--banner); color: #F5F5F2;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1;
}
.hist-fecha b { font: 400 26px/1 "Bebas Neue", sans-serif; color: var(--lime); letter-spacing: 0; }
.hist-info { flex: 1; min-width: 0; }
.hist-nombre { display: block; font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { display: block; font-size: 13px; color: var(--muted); }
.chev { flex: none; color: var(--muted); font-size: 24px; line-height: 1; }
.aviso { padding: 16px 18px; font-size: 14px; color: var(--muted); background: var(--surface); border: 2px dashed var(--field-line); border-radius: 16px; }

/* ---------- Anotar entreno ---------- */
.ses-opciones { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px; }
.fecha-ses { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.ses-opciones .switch { border-top: 1px solid var(--line); }
.fecha-ses input { width: auto; min-height: 42px; }
.switch { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; font-size: 15px; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative;
  width: 52px; height: 30px; min-height: 0; padding: 0; margin: 0;
  border: 0; border-radius: 999px; background: var(--field-line); cursor: pointer; transition: background .15s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s;
}
.switch input:checked { background: var(--lime); }
.switch input:checked::after { transform: translateX(22px); }
.switch input:focus { box-shadow: 0 0 0 3px rgba(200, 240, 62, .75); }

.ej {
  margin-top: 16px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--lime); border-radius: 16px;
}
.ej-head { display: flex; align-items: center; gap: 12px; }
.ej-img {
  flex: none; width: 64px; height: 64px; border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--banner); color: var(--lime); font: 400 28px/1 "Bebas Neue", sans-serif;
}
.ej-img img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.ej-info { flex: 1; min-width: 0; }
.ej-info h3 { margin: 0; font-weight: 800; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.ej-meta { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.ej-nota { margin: 2px 0 0; font-size: 13px; font-weight: 700; }
.ej-video {
  flex: none; align-self: flex-start; padding: 7px 12px; border-radius: 999px; text-decoration: none;
  background: var(--night); color: var(--lime); font-weight: 800; font-size: 12px; letter-spacing: .04em;
}
@media (prefers-color-scheme: dark) { .ej-video { background: var(--lime); color: var(--night); } }
.como { margin-top: 10px; font-size: 14px; }
.como summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.como p { margin: 6px 0 0; white-space: pre-line; }
.descanso-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  margin-top: 12px; padding: 6px 6px 6px 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--bg); font-weight: 700; font-size: 14px; text-align: left;
}
.descanso-chip b { padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.sets { margin-top: 10px; }
.set-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 70px 76px; gap: 8px; align-items: center; padding: 4px 0; }
.set-head { padding-bottom: 0; font-weight: 800; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.set-head span:first-child, .set-head span:nth-child(n+3) { text-align: center; }
.set-n { font-weight: 800; font-size: 16px; text-align: center; }
.set-row input { min-height: 46px; padding: 8px 4px; text-align: center; font-weight: 700; -moz-appearance: textfield; }
.set-row input::-webkit-outer-spin-button, .set-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-row input::placeholder { color: var(--muted); opacity: .5; font-weight: 500; }
.prev {
  min-width: 0; padding: 6px 0; border: 0; background: none; cursor: pointer; text-align: left;
  color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3;
}
.prev:not(:disabled):hover { color: var(--text); }
.prev:disabled { cursor: default; }
.ej-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.mas, .menos { padding: 8px 0; border: 0; background: none; cursor: pointer; font-weight: 800; font-size: 14px; }
.menos { color: var(--muted); font-weight: 700; font-size: 13px; }
.ej-ultima { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.ej-drop { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.ej-drop b { color: var(--text); }
.set-row.es-drop .set-n { font-size: 13px; color: var(--muted); }
.set-row.es-drop input { border-style: dashed; }
.letra {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 6px;
  border-radius: 6px; background: var(--lime); color: var(--night); font-size: 12px; vertical-align: 2px;
}

/* Rounds y super-sets al anotar */
.round { margin-top: 30px; }
.round h2 {
  display: inline-block; margin: 0; padding: 6px 16px 3px; border-radius: 6px;
  font: 400 28px/1 "Bebas Neue", sans-serif; letter-spacing: .04em;
  background: var(--lime); color: var(--night); transform: skewX(var(--skew));
}
.round p { margin: 8px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.round + .ej, .round + .superset { margin-top: 12px; }
.superset {
  margin-top: 16px; padding: 12px 10px 10px;
  border: 2px solid var(--lime); border-radius: 20px; background: rgba(200, 240, 62, .10);
}
.superset-tit { margin: 0 6px; font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.superset-tit small { margin-left: 6px; font-weight: 600; font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--muted); }
.superset .ej { margin-top: 10px; border-left-width: 1px; }
.ses-notas { margin-top: 16px; }
.sensacion { margin-top: 24px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.sens-tit { margin: 0 0 12px; font-weight: 800; font-size: 15px; }
.sens-tit small { margin-left: 6px; font-weight: 500; font-size: 13px; color: var(--muted); }
.cuadritos { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.cuadritos button {
  height: 46px; min-width: 0; padding: 0; cursor: pointer;
  border: 2px solid var(--field-line); border-radius: 8px; background: var(--field);
  font-weight: 800; font-size: 14px; color: var(--muted);
  transition: background .12s, border-color .12s, transform .08s;
}
.cuadritos button:active { transform: scale(.92); }
.cuadritos button.lleno { background: var(--lime); border-color: var(--night); color: var(--night); }
@media (prefers-color-scheme: dark) { .cuadritos button.lleno { border-color: var(--lime); } }
.sens-pie { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.sens-pie b { color: var(--text); font-size: 14px; text-align: center; }
#sesBorrar { margin-top: 8px; }

/* Barra fija abajo (Cancelar / Guardar) */
.barra-fija {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 10px;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
}
.barra-fija .btn { flex: 1; max-width: 260px; }
body.con-barra main { padding-bottom: 130px; }
body.con-barra .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }

/* Cronómetro de descanso */
.timer {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(86px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 6px; width: max-content; max-width: calc(100% - 24px);
  padding: 6px 6px 6px 16px; border-radius: 999px;
  background: var(--night); color: #F5F5F2; border: 2px solid var(--lime);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.timer-txt { font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #A3A3AD; }
.timer b { min-width: 3.2ch; margin-right: 4px; font: 400 32px/1 "Bebas Neue", sans-serif; color: var(--lime); text-align: center; }
.timer button {
  min-height: 38px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .28); background: transparent; color: #F5F5F2;
  font-weight: 800; font-size: 12px;
}
.timer.listo { background: var(--lime); }
.timer.listo b, .timer.listo .timer-txt { color: var(--night); }
.timer.listo button { color: var(--night); border-color: rgba(11, 11, 15, .3); }

/* ---------- Editor de rutina ---------- */
.radios { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 6px; }
.radio, .check { flex-direction: row; align-items: center; gap: 10px; padding: 6px 0; font-weight: 600; font-size: 15px; cursor: pointer; }
.radio input, .check input { flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; accent-color: var(--night); }
@media (prefers-color-scheme: dark) { .radio input, .check input { accent-color: var(--lime); } }
.checks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px;
  margin-top: 8px; padding: 8px 14px; max-height: 300px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.checks .hint { grid-column: 1 / -1; padding: 6px 0; font-size: 13px; }
.bloque {
  display: flex; flex-direction: column; gap: 10px; margin: 10px 0 12px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.bloque-top { display: flex; align-items: center; gap: 6px; }
.bloque-top .num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--banner); color: var(--lime); font-weight: 800; font-size: 13px;
}
.bloque-tit { flex: 1; font-weight: 800; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.icono {
  flex: none; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 16px; font-weight: 700;
}
.icono:disabled { opacity: .35; cursor: default; }
.icono.peligro { color: var(--danger); }
.bloque-campos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bloque-campos label { gap: 4px; font-size: 12px; color: var(--muted); }
.bloque-campos input { text-align: center; padding: 10px 6px; }
.rut-extra { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.rut-agregar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rut-agregar .btn { padding: 6px 10px; white-space: normal; line-height: 1.2; text-align: center; }
.bloque-extra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.bloque-extra .drops { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; }
.bloque-extra .drops input { width: 64px; min-height: 40px; padding: 6px; text-align: center; }
.check.apagado { opacity: .45; cursor: default; }
.bloque.junto { margin-bottom: 0; border-color: var(--lime); }
.enlace {
  position: relative; z-index: 1; width: max-content; margin: -10px auto; padding: 5px 14px; border-radius: 999px;
  background: var(--lime); color: var(--night); font-weight: 800; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
}
.enlace + .bloque { margin-top: 0; border-color: var(--lime); }
.bloque-seccion { background: var(--banner); border-color: transparent; }
.bloque-seccion .bloque-tit { color: var(--lime); }
.bloque-seccion input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); color: #F5F5F2; }
.bloque-seccion input::placeholder { color: rgba(245, 245, 242, .5); }
.bloque-seccion input[data-f="nombre"] { font: 400 24px/1 "Bebas Neue", sans-serif; letter-spacing: .04em; }
.bloque-seccion .icono { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #F5F5F2; }

/* ---------- Biblioteca de ejercicios ---------- */
.ej-lista { display: flex; flex-direction: column; gap: 8px; }
.ej-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px 10px 10px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.ej-item:hover { border-color: var(--text); }
.ej-item .ej-img { width: 52px; height: 52px; font-size: 24px; }
.ej-item-info { flex: 1; min-width: 0; }
.ej-item-info .name { display: block; font-weight: 800; font-size: 15px; overflow-wrap: anywhere; }
.ej-item-info .mail { display: block; font-size: 13px; color: var(--muted); }

/* ---------- Formularios en ventana ---------- */
dialog {
  width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(11, 11, 15, .62); }
#fPrueba, .dlg-form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-head h2 { margin: 0; font: 400 32px/1 "Bebas Neue", sans-serif; letter-spacing: .03em; }
.dlg-para { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
.x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg); font-size: 24px; line-height: 1; cursor: pointer; }
fieldset { margin: 0; padding: 4px 0 0; border: 0; min-width: 0; }
legend { padding: 0; font-weight: 800; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
legend small { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); margin-left: 6px; font-size: 13px; }
.campo {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px;
}
.campo .entrada { display: flex; align-items: center; gap: 8px; flex: none; }
.campo input { width: 112px; text-align: right; }
.campo .u { width: 34px; font-size: 13px; font-weight: 500; color: var(--muted); }
.dlg-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dlg-actions .spacer { flex: 1; }

/* ---------- Fotos: antes / después ---------- */
.antes-despues { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 760px; }
.foto-marco { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.foto-btn {
  display: block; width: 100%; aspect-ratio: 3 / 4; padding: 0; border: 0; cursor: zoom-in;
  background: var(--card); border-radius: 16px; overflow: hidden;
}
.foto-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-marco figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.foto-marco figcaption b { color: var(--text); }
.etiqueta {
  display: inline-block; padding: 5px 12px 2px; border-radius: 6px;
  font: 400 20px/1 "Bebas Neue", sans-serif; letter-spacing: .06em;
  background: var(--banner); color: #fff;
}
.etiqueta.lima { background: var(--lime); color: var(--night); }
.foto-hueco {
  aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; padding: 16px;
  text-align: center; font-size: 13px; color: var(--muted);
  border: 2px dashed var(--field-line); border-radius: 16px;
}
.foto-aviso {
  grid-column: 1 / -1; padding: 16px 18px; font-size: 14px; color: var(--muted);
  background: var(--surface); border: 2px dashed var(--field-line); border-radius: 16px;
}
.tira { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.mini { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: zoom-in; font-size: 11px; font-weight: 700; color: var(--muted); }
.mini img { width: 64px; height: 85px; object-fit: cover; border-radius: 10px; background: var(--card); }

.foto-campo { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.foto-campo img { flex: none; width: 72px; height: 96px; object-fit: cover; border-radius: 10px; }
.foto-campo img.cuadrada { height: 72px; }
.foto-campo .hint { font-size: 13px; margin-bottom: 8px; }
.foto-botones { display: flex; flex-wrap: wrap; gap: 8px; }

.visor { width: min(720px, calc(100% - 24px)); background: var(--night); color: #F5F5F2; }
.visor::backdrop { background: rgba(11, 11, 15, .85); }
.visor img { display: block; width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; background: #000; }
.visor-pie { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 14px; font-size: 14px; font-weight: 700; }
.visor-pie .spacer { flex: 1; }
.visor .btn.ghost { color: #F5F5F2; border-color: rgba(255, 255, 255, .28); text-decoration: none; }
.visor a[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* ---------- Aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 50; width: max-content; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 12px; border-left: 5px solid var(--lime);
  background: var(--night); color: #F5F5F2; font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

@media (max-width: 480px) {
  .page-head .btn { width: 100%; }
  .hola { max-width: 40vw; }
  .tabla th, .tabla td { padding: 10px; }
  .tabla .nota { max-width: 120px; }
  .chart-box { height: 130px; }
  .persona-bar .tabs { min-width: 0; width: 100%; }
  .ej { padding: 14px 12px; }
  .sensacion { padding: 14px 12px; }
  .set-row { grid-template-columns: 40px minmax(0, 1fr) 60px 68px; gap: 6px; }
}
