:root {
  --tinta: #10241c;
  --pizarra: #1f4d3a;
  --pizarra-osc: #163a2b;
  --maiz: #e9b949;
  --maiz-borde: #c99a1e;
  --papel: #f7f8f6;
  --linea: #e4ebe6;
  --borde: #cfdcd3;
  --borde-suave: #dbe4de;
  --menta: #eef4f0;
  --menta-2: #e7f1ea;
  --gris: #4e5f57;
  --gris-2: #2f3f38;
  --ok: #1f6b45;
  --error: #b3261e;
  --crema: #fbf1d6;
  --crema-tinta: #7a5a0c;
  --radio: 16px;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --texto: "DM Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--texto); color: var(--tinta); font-size: 16px; line-height: 1.5;
  background: #e9eee9;
}
.app {
  max-width: 480px; margin: 0 auto; min-height: 100%; background: var(--papel);
  display: flex; flex-direction: column; position: relative;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 520px) { .app { box-shadow: 0 0 40px rgba(16,36,28,.08); } }
.cuadricula {
  background-image: linear-gradient(var(--linea) 1px, transparent 1px), linear-gradient(90deg, var(--linea) 1px, transparent 1px);
  background-size: 22px 22px;
}
h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.015em; }
h1 { font-weight: 800; font-size: clamp(30px, 8vw, 38px); line-height: 1.04; margin: 0; }
h2 { font-weight: 700; font-size: 20px; margin: 22px 0 6px; }
h3 { font-weight: 700; font-size: 16px; margin: 0; }
p { margin: 0; }
.ayuda { color: var(--gris); font-size: 14px; }
.pantalla { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.cuerpo { flex: 1; padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.pie { position: sticky; bottom: 0; padding: 12px 22px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--papel); border-top: 1px solid #e1e8e3; display: grid; gap: 10px; z-index: 5; }
.pie.dos { grid-template-columns: 1fr 1fr; }

/* Barra superior */
.barra { display: flex; align-items: center; gap: 8px; padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 0; }
.barra .titulo { font-family: var(--display); font-weight: 700; font-size: 18px; flex: 1; }
.icono-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 12px; color: var(--tinta); cursor: pointer; }
.icono-btn:hover { background: var(--menta); }
.marca { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 17px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--pizarra); display: flex; align-items: center; justify-content: center; }
.saldo { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--borde);
  border-radius: 999px; padding: 0 14px; min-height: 44px; font-weight: 600; font-size: 14px; color: var(--tinta);
  text-decoration: none; cursor: pointer; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: var(--maiz); }

/* Pasos */
.pasos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 22px 0; }
.pasos span { height: 5px; border-radius: 3px; background: #d5e0d8; }
.pasos span.on { background: var(--pizarra); }
.paso-txt { margin: 8px 22px 0; font-size: 13px; color: var(--gris); }

/* Botones */
.btn { font: inherit; font-weight: 700; font-size: 16px; border: 0; border-radius: var(--radio); min-height: 56px;
  padding: 0 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; width: 100%; }
.btn-maiz { background: var(--maiz); color: var(--tinta); box-shadow: 0 3px 0 var(--maiz-borde); }
.btn-maiz:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--maiz-borde); }
.btn-pizarra { background: var(--pizarra); color: #fff; }
.btn-claro { background: #fff; border: 1.5px solid var(--borde); color: var(--pizarra); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.enlace { font: inherit; font-weight: 600; font-size: 14px; color: var(--pizarra); background: none; border: 0;
  min-height: 44px; padding: 0 4px; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--maiz); outline-offset: 2px; }

/* Tarjetas */
.tarjeta { background: #fff; border: 1.5px solid var(--borde-suave); border-radius: var(--radio); padding: 16px; }
.tarjeta-osc { background: var(--pizarra); color: #fff; border-radius: 18px; padding: 18px; }
.tarjeta-osc .mini { color: #cfe3d6; font-size: 12px; font-weight: 600; }
.tarjeta-osc p { color: #e2eee6; font-size: 14px; margin-top: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.dato { background: var(--menta); border-radius: 12px; padding: 10px; }
.dato b { display: block; font-family: var(--display); font-weight: 800; font-size: 22px; }
.dato span { font-size: 12px; color: var(--gris); }
.sello { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ok);
  background: var(--menta-2); border-radius: 999px; padding: 4px 9px; }
.num { width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--crema); color: var(--crema-tinta);
  font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.fila { display: flex; gap: 10px; align-items: flex-start; }

/* Acción principal del inicio */
.accion { display: flex; align-items: center; justify-content: space-between; background: var(--pizarra); color: #fff;
  border: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; border-radius: 20px;
  padding: 20px 20px 20px 22px; box-shadow: 0 14px 30px -14px rgba(16,36,28,.55); }
.accion b { font-family: var(--display); font-size: 22px; display: block; }
.accion small { color: #cfe3d6; font-size: 14px; }
.accion .mas { width: 48px; height: 48px; border-radius: 14px; background: var(--maiz); display: flex; align-items: center; justify-content: center; }

/* Listas */
.item { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px 14px;
  min-height: 60px; border: 0; width: 100%; text-align: left; font: inherit; color: var(--tinta); cursor: pointer; }
.item .chip-area { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--crema);
  display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 800; color: var(--crema-tinta); font-size: 13px; }
.item .txt { flex: 1; min-width: 0; }
.item .txt b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .txt small { color: var(--gris); font-size: 13px; }
.opcion { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 64px;
  padding: 12px 14px; border-radius: 14px; font: inherit; color: var(--tinta); cursor: pointer; text-align: left;
  background: #fff; border: 1.5px solid var(--borde-suave); }
.opcion.on { background: var(--menta-2); border: 2px solid var(--pizarra); }
.opcion small { display: block; font-size: 12px; font-weight: 600; color: var(--gris); }
.opcion b { font-size: 15px; font-weight: 600; }
.check { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--pizarra); display: none; align-items: center; justify-content: center; }
.opcion.on .check { display: flex; }
.modo { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 92px; padding: 14px;
  border-radius: 14px; font: inherit; color: var(--tinta); text-align: left; cursor: pointer; background: #fff; border: 1.5px solid var(--borde-suave); }
.modo.on { border: 2px solid var(--pizarra); }
.modo b { font-size: 15px; } .modo small { font-size: 13px; color: var(--gris); } .modo strong { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: var(--menta); color: var(--pizarra); border: 1.5px solid var(--menta); }
.chip.on { background: var(--pizarra); color: #fff; border-color: var(--pizarra); }

/* Formularios */
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 6px; }
label .op { font-weight: 400; color: var(--gris); }
input, select, textarea { width: 100%; font: inherit; color: var(--tinta); padding: 12px; border: 1.5px solid var(--borde);
  border-radius: 12px; background: #fff; min-height: 48px; }
textarea { min-height: 100px; resize: vertical; }
.casilla { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; margin: 10px 0; }
.casilla input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 1px; accent-color: var(--pizarra); }
.subir { border: 1.5px dashed #9fb8a8; border-radius: var(--radio); padding: 16px; background: #fff; text-align: center; cursor: pointer; display: block; }
.subir input { display: none; }
.editable { border: 1.5px dashed transparent; border-radius: 8px; padding: 2px 4px; margin: -2px -4px; }
.editable:focus { border-color: var(--maiz); outline: none; background: #fffdf5; }
.tarjeta-osc .editable:focus { background: var(--pizarra-osc); }

/* Avisos */
.aviso { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.aviso.error { background: #fdecea; color: var(--error); }
.aviso.ok { background: var(--menta-2); color: var(--ok); }
.aviso.nota { background: #fff8e1; color: var(--tinta); white-space: pre-line; }
.oculto { display: none !important; }

/* Preparando */
.lista-pasos { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.lista-pasos li { padding: 10px 0 10px 36px; position: relative; color: var(--gris); }
.lista-pasos li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #d5e0d8; }
.lista-pasos li.activo { color: var(--tinta); font-weight: 600; }
.lista-pasos li.activo::before { border-color: var(--pizarra); border-top-color: transparent; animation: girar 1s linear infinite; }
.lista-pasos li.hecho { color: var(--ok); }
.lista-pasos li.hecho::before { background: var(--ok); border-color: var(--ok); }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lista-pasos li.activo::before { animation: none; } }

/* Hoja de vista previa */
.vitrina { position: relative; height: 220px; border-radius: 18px; background: var(--pizarra); overflow: hidden; display: flex; justify-content: center; align-items: flex-end; }
.vitrina .hoja { width: 220px; height: 180px; background: #fff; border-radius: 10px 10px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 7px;
  background-image: linear-gradient(var(--linea) 1px, transparent 1px), linear-gradient(90deg, var(--linea) 1px, transparent 1px); background-size: 12px 12px; box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
.vitrina .raya { height: 6px; background: #d5e0d8; border-radius: 3px; }
.vitrina .estampa { position: absolute; right: 20px; bottom: 24px; width: 76px; height: 76px; border-radius: 50%; border: 2.5px solid var(--maiz);
  color: var(--maiz); display: flex; align-items: center; justify-content: center; text-align: center; transform: rotate(-12deg);
  font-family: var(--display); font-weight: 800; font-size: 11px; line-height: 1.1; background: rgba(16,36,28,.55); }
.estrellas { display: flex; gap: 4px; }
.estrellas button { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; padding: 0; color: #c9d3cc; }
.estrellas button.on { color: var(--maiz); }
.plan { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 16px; border-radius: 16px; background: #fff; border: 1.5px solid var(--borde-suave); }
.plan .arriba { display: flex; justify-content: space-between; align-items: baseline; }
.plan b { font-family: var(--display); font-size: 18px; } .plan strong { font-family: var(--display); font-size: 24px; font-weight: 800; }
.etiqueta { align-self: flex-start; margin-top: 4px; font-size: 12px; font-weight: 700; background: var(--maiz); border-radius: 999px; padding: 3px 10px; }
.modo-prueba { background: var(--maiz); color: var(--tinta); font-size: 12px; font-weight: 700; text-align: center; padding: 6px; }
.portada { padding: calc(28px + env(safe-area-inset-top, 0px)) 22px 22px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 12px 18px;
  border-radius: 12px; font-size: 14px; z-index: 50; max-width: 90%; }

/* Unidad y lista de sesiones */
.subir.grande { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 18px; border-width: 2px; background: var(--menta); }
.lista-sesiones { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; padding-right: 2px; }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: " ▾"; color: var(--gris); }
.columnas, .col { display: flex; flex-direction: column; gap: 12px; }
.planes { display: flex; flex-direction: column; gap: 10px; }

/* ===== Computadora y laptop ===== */
@media (min-width: 900px) {
  body { font-size: 16px; }
  .app { max-width: 1120px; box-shadow: none; background: transparent; }
  body { background: var(--papel); }
  .pantalla { min-height: 100vh; }
  .barra { padding-left: 32px; padding-right: 32px; padding-top: 22px; }
  .pasos { padding-left: 32px; padding-right: 32px; max-width: 584px; }
  .paso-txt { margin: 8px 32px 0; }
  .cuerpo { padding: 24px 32px 32px; }
  .columnas { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 28px; align-items: start; }
  .pie { position: sticky; background: rgba(247,248,246,.94); backdrop-filter: blur(6px); padding-left: 32px; padding-right: 32px;
         display: flex; justify-content: flex-end; gap: 12px; }
  .pie .btn { width: auto; min-width: 240px; }
  h1 { font-size: 44px; }
  .portada { max-width: 640px; margin: 0 auto; padding-top: 72px; }
  .pantalla.cuadricula > .pie { max-width: 640px; margin: 0 auto; width: 100%; background: transparent; justify-content: stretch; }
  .pantalla.cuadricula > .pie .btn { width: 100%; }
  .formulario-ancho { max-width: 760px; }
  .planes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .vitrina { height: 260px; }
  .lista-sesiones { max-height: 560px; }
  .toast { bottom: 110px; }
}

/* Subir nómina */
.subir-nomina { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; margin: 4px 0 8px;
  border: 1.5px dashed #9fb8a8; border-radius: 12px; background: var(--menta); color: var(--pizarra); font-weight: 600;
  font-size: 14px; cursor: pointer; }
.subir-nomina:hover { border-color: var(--pizarra); }
.subir-nomina.chico { min-height: 40px; padding: 6px 12px; font-size: 13px; }
.subir-nomina svg { flex: none; }

/* Diagnóstico */
.diag summary { font-weight: 700; font-size: 16px; cursor: pointer; min-height: 28px; }
.diag-lista { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; font-size: 14px; }
.diag-lista .fila { align-items: flex-start; }
.marca { width: 22px; height: 22px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; margin-top: 1px; }
.marca.ok { background: var(--menta-2); color: var(--ok); }
.marca.aviso { background: var(--crema); color: var(--crema-tinta); }
.etapas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.etapa { background: var(--menta); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.etapa b { font-family: var(--display); font-size: 14px; color: var(--pizarra); }
.etapa span { line-height: 1.3; }
@media (max-width: 420px) { .etapas { grid-template-columns: 1fr; } }
