/* Complementos de la demo web (la interfaz es la misma de la app). */
.demo-cinta {
  position: fixed; top: 7px; left: 50%; transform: translateX(-50%); z-index: 2147483000;
  display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px; border-radius: 999px;
  background: #fff6df; border: 1px solid #ecd9a6; color: #7a5b00; font: 500 12.5px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.08); white-space: nowrap;
}
.demo-cinta strong { letter-spacing: 0.08em; font-weight: 800; }
.demo-cinta a { padding: 4px 11px; border-radius: 999px; background: #1e40af; color: #fff; text-decoration: none; font-weight: 600; }
.demo-cinta a:hover { background: #172f85; }
@media (max-width: 1100px) { .demo-cinta span { display: none; } }

.demo-aviso { border: 0; border-radius: 14px; padding: 26px 28px 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 70px rgb(0 0 0 / 0.3); color: #1b1f23; font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; }
.demo-aviso::backdrop { background: rgb(20 30 60 / 0.45); }
.demo-aviso h2 { margin: 0 0 8px; font-size: 19px; line-height: 1.25; letter-spacing: -0.01em; }
.demo-aviso-texto { margin: 0 0 14px; color: #3a424a; }
.demo-precio { margin: 0 0 18px; padding: 9px 12px; border-radius: 8px; background: #e8edfb; color: #172f85; font-weight: 600; font-size: 13px; }
.demo-aviso-acciones { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.demo-boton { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid #c3c8c2; background: #fff; color: #1b1f23; font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1; text-decoration: none; cursor: pointer; }
.demo-boton-primario { background: #1e40af; border-color: #1e40af; color: #fff; }
.demo-boton-primario:hover { background: #172f85; }

.demo-nota-config { margin: 0 0 14px; padding: 9px 12px; border-radius: 8px; background: #e8edfb; color: #172f85; font-size: 13px; font-weight: 500; }

/* La demo entra sin PIN: la pantalla de acceso nunca se muestra (evita el destello al cargar). */
html[data-bloqueado="true"] .acceso { display: none !important; }

/* =====================================================================================
   Versión para celular (hasta 820 px de ancho): la misma app, reacomodada.
   Navegación abajo, columnas apiladas, campos grandes y la hoja a pantalla completa.
   ===================================================================================== */
.demo-ver-hoja, .demo-cerrar-hoja, .demo-nota-movil { display: none; }

@media (max-width: 820px) {
  html, body { height: 100dvh; overflow: hidden; }
  body, .cuerpo, .contenido { overflow: clip; }
  body { user-select: auto; }

  /* Cinta: franja arriba, sin tapar la barra */
  .demo-cinta { position: static; order: -1; transform: none; width: 100%; box-sizing: border-box; border-radius: 0; border-width: 0 0 1px; justify-content: space-between; padding: 6px 10px 6px 12px; gap: 8px; }
  .demo-cinta span { display: inline; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
  .demo-cinta a { flex: none; padding: 7px 12px; }

  .demo-nota-movil { display: block; order: -1; margin: 0; padding: 7px 12px; background: #e8edfb; color: #172f85; font-size: 12px; line-height: 1.35; font-weight: 500; border-bottom: 1px solid #c5d0ef; }
  body.demo-hoja-grande .demo-nota-movil { display: none; }

  /* Barra superior: solo iconos */
  .barra { height: 46px; padding: 0 8px 0 12px; }
  .barra-acciones { gap: 0; }
  .btn-barra span { display: none; }
  .btn-barra { width: 44px; height: 44px; justify-content: center; padding: 0; }

  /* Navegación inferior */
  .cuerpo { flex-direction: column; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .lateral { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; width: auto; flex-direction: row; justify-content: space-around; gap: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--borde); }
  .lateral-grupo { display: none; }
  .lateral-boton { flex: 1; min-height: 50px; justify-content: center; font-size: 11px; }
  .buscador-pop { position: fixed; left: 8px; right: 8px; top: 52px; width: auto; z-index: 70; }
  .buscador-pop .resultados { top: 46px; width: auto; max-height: 55dvh; }
  .buscador-pop .buscador-atajo { display: none; }
  .resultado { padding: 10px; }
  .resultado-acciones { flex-wrap: wrap; justify-content: flex-end; }
  .resultado-acciones .enlace { padding: 8px 6px; }

  /* Receta: el área entera se desplaza, el editor y la vista previa se apilan */
  .area { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .editor { overflow: visible; padding: 14px 14px 8px; }
  .previa { border-left: 0; border-top: 1px solid var(--borde); padding: 14px 12px 18px; }
  .previa-encabezado { flex-wrap: wrap; }
  .previa-encabezado p { display: none; }
  .previa-lienzo { flex: none; width: 100%; aspect-ratio: 612 / 396; height: auto; }
  .previa-acciones { flex-wrap: wrap; gap: 8px; }
  .previa-acciones .boton { height: 46px; flex: 1 1 40%; justify-content: center; }
  .previa-acciones #btn-guardar { order: 1; flex: 1 1 100%; }
  .previa-acciones #btn-imprimir { order: 2; }
  .previa-acciones #btn-nueva { order: 3; margin-right: 0; }

  /* Filas de campos */
  .fila-paciente { grid-template-columns: 1fr 1fr; }
  .fila-paciente > .campo:first-child { grid-column: 1 / -1; }
  .fila-2, .fila-consulta, .fila-consultorio, .exp-rejilla, .exp-ficha { grid-template-columns: minmax(0, 1fr); }
  .fila-signos, .fila-4, .fila-signos-consulta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fila-3 { grid-template-columns: minmax(0, 1fr); }
  input, select, textarea { font-size: 16px; }
  input[type="text"], input[type="date"], input[type="email"], input[type="tel"], input[type="datetime-local"], select { height: 44px; }
  .boton, .btn-barra { min-height: 44px; }

  /* Inicio */
  .inicio { padding: 16px; }
  .inicio-botones { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .inicio-boton { min-height: 120px; }

  /* Expediente */
  .exp-cabecera { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 14px 10px; }
  .exp-acciones { flex-wrap: wrap; }
  .exp-acciones .boton { flex: 1 1 30%; justify-content: center; }
  .exp-pestanas { padding: 0 8px; overflow-x: auto; }
  .exp-pestanas [role="tab"] { white-space: nowrap; padding: 12px 12px 12px; }
  .exp-cuerpo { padding: 14px 12px 24px; }
  .consulta { grid-template-columns: minmax(0, 1fr); }

  /* Diálogos casi a pantalla completa */
  .dialogo, .dialogo-chico, .dialogo-config, .dialogo-consulta, .demo-aviso { width: calc(100vw - 16px); max-width: none; max-height: calc(100dvh - 16px); padding: 18px 16px 16px; }
  .dialogo-config, .dialogo-consulta { overflow-y: auto; }
  .seguridad .fila-pin, .seguridad .fila-medico { grid-template-columns: minmax(0, 1fr); }
  .notificacion { bottom: calc(68px + env(safe-area-inset-bottom)); max-width: calc(100vw - 20px); }
  .demo-aviso-acciones { flex-direction: column-reverse; }
  .demo-aviso-acciones .demo-boton { width: 100%; justify-content: center; height: 46px; }

  /* Hoja a pantalla completa (gira para llenar el celular en vertical) */
  .demo-ver-hoja { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid #c3c8c2; background: #fff; color: #1b1f23; font-family: inherit; font-weight: 600; font-size: 13px; }
  body.demo-hoja-grande .previa { position: fixed; inset: 0; z-index: 3000; padding: 0; background: #14181c; border: 0; overflow: hidden; }
  body.demo-hoja-grande .demo-cinta, body.demo-hoja-grande .lateral { display: none; }
  body.demo-hoja-grande .previa > :not(.previa-lienzo) { display: none; }
  body.demo-hoja-grande .previa-lienzo { position: fixed; top: 0; left: 100vw; width: 100dvh; height: 100vw; aspect-ratio: auto; box-sizing: border-box; padding: 14px; transform-origin: 0 0; transform: rotate(90deg); align-items: center; }
  body.demo-hoja-grande .demo-cerrar-hoja { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 3100; display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px; border: 0; background: #fff; color: #1b1f23; font-family: inherit; font-weight: 700; font-size: 14px; box-shadow: 0 4px 16px rgb(0 0 0 / 0.4); }
}
@media (max-width: 820px) and (orientation: landscape) {
  body.demo-hoja-grande .previa-lienzo { left: 0; width: 100vw; height: 100dvh; transform: none; }
}

.demo-cinta .demo-volver { background: transparent; color: #7a5b00; padding: 4px 6px; font-weight: 600; }
.demo-cinta .demo-volver:hover { background: transparent; text-decoration: underline; }
