* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Open Sans', sans-serif;
  background: #003A78;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


.screen { display: none; width: 100%; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; }

/* Login */
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.login-card h1 { color: #003A78; font-size: 1.2rem; text-align: center; margin-bottom: 4px; }
.login-card p.subtitle { color: #666; font-size: 0.85rem; text-align: center; margin-bottom: 24px; }
.login-card label { display: block; font-size: 0.82rem; font-weight: 600; color: #003A78; margin-bottom: 4px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid #ccc;
  border-radius: 8px; font-size: 1rem; margin-bottom: 16px; letter-spacing: 2px;
}
.login-card input:focus { outline: none; border-color: #003A78; }
.pin-wrapper {
  position: relative;
  margin-bottom: 16px;
}
.pin-wrapper input {
  margin-bottom: 0;
  padding-right: 40px;
  width: 100%;
}
.btn-toggle-pin {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.btn-primary {
  width: 100%; background: #003A78; color: #fff; border: none;
  padding: 12px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: #004FA8; }
.error-msg { color: #c0392b; font-size: 0.85rem; text-align: center; margin-top: 8px; display: none; }

/* Credencial PNG — fullscreen, carrusel horizontal con scroll nativo */
#screen-credencial {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #003A78;
  display: none;
  z-index: 100;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#screen-credencial.active {
  display: block;
}

.credencial-container {
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.credencial-container::-webkit-scrollbar { display: none; }

.cred-page {
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cred-img {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}


.btn-install {
  width: 100%;
  background: #D4A857;
  color: #003A78;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  display: none;
}

.btn-install:hover { background: #c49a45; }

.offline-notice {
  position: absolute;
  bottom: max(env(safe-area-inset-bottom), 8px);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
  z-index: 101;
}


@media (orientation: portrait) {
  .cred-img {
    width: 100vh;
    height: 100vw;
    max-width: 100vh;
    max-height: 100vw;
    transform: rotate(90deg);
    transform-origin: center center;
  }
}
