:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273549;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --accent: #00b4d8;
  --danger: #e63946;
  --ok: #06d6a0;
  --radius: 14px;
  --keyboard-offset: 0px; /* app.js la actualiza en vivo con el alto real del teclado */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh; /* respaldo si JS no corrió aún; app.js la sobreescribe en px con el alto real visible */
  display: flex;
  flex-direction: column;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto; /* red de seguridad: si el teclado deja menos espacio del que cabe, se puede hacer scroll en vez de recortar contenido */
}

.screen { display: none; flex: 1; flex-direction: column; padding-bottom: 24px; }
.screen.active { display: flex; }

/* Botón(es) principal(es) de cada pantalla: fijo al fondo visible, empujado hacia arriba por
   --keyboard-offset cuando el teclado está abierto, para que nunca quede tapado. */
.fixed-cta,
.nav-row {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom) + var(--keyboard-offset));
  width: calc(100% - 36px);
  max-width: 444px;
  z-index: 20;
}
.nav-row { display: flex; gap: 10px; }
.fixed-cta .btn,
.nav-row .btn { margin-top: 0; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; color: var(--text-dim); font-weight: 600; }
p.subtitle { color: var(--text-dim); margin-top: 0; }

.field { margin-bottom: 18px; }
label { display: block; font-size: 14px; color: var(--text-dim); margin-bottom: 6px; }

input[type="text"], input[type="number"], input[type="tel"] {
  width: 100%;
  font-size: 22px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid #334155;
  background: var(--surface);
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); }

.pin-input {
  letter-spacing: 12px;
  text-align: center;
  font-size: 32px;
}

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  margin-top: 8px;
}
.btn-primary { background: var(--accent); color: #04222c; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.choice-row { display: flex; gap: 10px; margin-bottom: 18px; }
.choice-btn {
  flex: 1;
  padding: 18px 10px;
  border-radius: var(--radius);
  border: 2px solid #334155;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.choice-btn.selected { border-color: var(--accent); background: #103642; }

.error-msg { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 6px; }
.hint { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.progress-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-bottom: 20px; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.2s; }

.insumo-card { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.insumo-categoria { color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.insumo-nombre { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.insumo-unidad { color: var(--text-dim); margin-bottom: 24px; }

.entradas-toggle { background: none; border: none; color: var(--accent); font-size: 14px; padding: 8px 0; cursor: pointer; text-align: left; }
.entradas-field { display: none; margin-top: 10px; }
.entradas-field.visible { display: block; }

.no-revisado-row { margin-top: 10px; }

.resumen-list { flex: 1; overflow-y: auto; }
.resumen-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--surface-2); cursor: pointer;
}
.resumen-item .nombre { font-weight: 600; }
.resumen-item .valor { color: var(--text-dim); }
.resumen-item .valor.no-revisado { color: var(--danger); }

.top-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-link { color: var(--text-dim); background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px 8px 4px 0; }

.success-icon { font-size: 64px; text-align: center; margin: 24px 0; }

.banner {
  background: var(--surface-2); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 8px; font-size: 14px; color: var(--text-dim); margin-bottom: 16px;
}
