/* ──────────────────────────────
   LOGIN SCREEN
────────────────────────────── */

.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0d0d0f;
  padding: 24px;
  font-family: var(--font);
}

/* Logo */
.logo-block {
  text-align: center;
  margin-bottom: 48px;
  animation: fadeDown 0.5s ease both;
}

.logo-wordmark {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  line-height: 1;
}

.logo-wordmark span {
  color: var(--brand);
}

.logo-tagline {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ── User select ── */
#screen-user-select {
  width: 100%;
  max-width: 460px;
  animation: fadeUp 0.4s ease both;
}

#screen-user-select h2 {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

#user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  color: inherit;
}

.user-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(83, 74, 183, 0.2);
}

.user-card:active {
  transform: translateY(0);
}

.user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.user-role {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: capitalize;
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── PIN screen ── */
#screen-pin {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  animation: fadeUp 0.35s ease both;
}

.pin-user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#pin-user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: #fff;
}

#pin-user-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.pin-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Dots */
.pin-dots {
  display: flex;
  gap: 16px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.pin-dot.filled {
  background: var(--brand);
  border-color: var(--brand);
  transform: scale(1.15);
}

/* Error */
#pin-error {
  font-size: 0.78rem;
  color: #ef4444;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 8px 16px;
  width: 100%;
}

/* PIN pad */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.pin-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  height: 64px;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}

.pin-btn:hover {
  background: var(--surface-2);
  border-color: var(--brand-dim);
}

.pin-btn:active {
  transform: scale(0.93);
  background: var(--brand-dim);
}

.pin-btn.pin-btn-sub {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.pin-btn.pin-btn-back {
  font-size: 1.2rem;
}

.pin-btn-empty {
  background: transparent;
  border: none;
  pointer-events: none;
}

/* Back link */
.back-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s;
  font-family: var(--font);
}

.back-link:hover {
  color: var(--text);
}

/* Success flash */
#screen-pin.success #pin-user-avatar {
  box-shadow: 0 0 0 4px var(--brand), 0 0 24px rgba(83, 74, 183, 0.5);
  transition: box-shadow 0.3s;
}

/* Shake animation */
.shake {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Password screen ── */
#screen-password {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeUp 0.35s ease both;
}

#password-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pw-field-wrap {
  position: relative;
  width: 100%;
}

.pw-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 48px 14px 16px;
  font-size: 1rem;
  color: var(--text);
  font-family: var(--font);
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.pw-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(83, 74, 183, 0.15);
}

.pw-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.pw-toggle svg {
  width: 18px;
  height: 18px;
}

.pw-toggle:hover {
  color: var(--text);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.remember-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

.pw-submit {
  width: 100%;
  background: var(--brand);
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: var(--font);
}

.pw-submit:hover { opacity: 0.9; }
.pw-submit:active { transform: scale(0.98); }
.pw-submit:disabled { opacity: 0.5; cursor: not-allowed; }

#pw-error {
  font-size: 0.78rem;
  color: #ef4444;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 8px 16px;
  width: 100%;
}

/* ── Biometric screen ── */
#screen-biometric {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.35s ease both;
  text-align: center;
}

.biometric-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(83, 74, 183, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  margin-bottom: 4px;
}

.biometric-icon svg {
  width: 28px;
  height: 28px;
}

.biometric-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.biometric-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.biometric-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Passcode gate screen ── */
#screen-passcode {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: fadeUp 0.35s ease both;
}

.passcode-prompt {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
}

.passcode-dots {
  display: flex;
  gap: 16px;
}

.passcode-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.passcode-dot.filled {
  background: var(--brand);
  border-color: var(--brand);
  transform: scale(1.15);
}

/* ── Login form screen ── */
#screen-login {
  width: 100%;
  max-width: 320px;
  animation: fadeUp 0.35s ease both;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lf-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ── Generic error message ── */
.pw-error-msg {
  font-size: 0.78rem;
  color: #ef4444;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 8px 16px;
  width: 100%;
  box-sizing: border-box;
}

/* ── Biometric register screen (same layout as biometric) ── */
#screen-biometric-register {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeUp 0.35s ease both;
  text-align: center;
}
