/* ===== LOGIN SCREEN ===== */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0f1b4c 0%, #1a2d6e 50%, #0c1538 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; font-family: 'Inter', sans-serif;
}
.login-screen.hidden { display: none; }

.login-container {
  width: 100%; max-width: 420px;
  animation: loginFadeIn 0.5s ease;
}

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

/* Brand Header */
.login-brand {
  text-align: center; margin-bottom: 36px;
}
.login-brand-icon {
  width: 68px; height: 68px; border-radius: 18px;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 0 auto 14px;
  box-shadow: 0 8px 32px rgba(255,107,53,0.45);
}
.login-brand-name {
  font-size: 26px; font-weight: 800; color: #fff; letter-spacing: 0.5px;
}
.login-brand-sub {
  font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 4px;
}

/* Step 1 — Select User */
.login-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 32px 28px;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-card h2 {
  font-size: 17px; font-weight: 700; color: #fff;
  margin-bottom: 6px;
}
.login-card p {
  font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 24px;
}

.user-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px;
}
.user-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; cursor: pointer; transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.user-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,107,53,0.6);
  transform: translateY(-2px);
}
.user-btn.selected {
  background: rgba(255,107,53,0.15);
  border-color: #ff6b35;
  box-shadow: 0 0 0 2px rgba(255,107,53,0.3);
}
.user-btn-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; border: 2px solid rgba(255,255,255,0.15);
}
.user-btn-name { font-size: 12.5px; font-weight: 700; color: #fff; text-align: center; line-height: 1.3; }
.user-btn-role { font-size: 10.5px; color: rgba(255,255,255,0.45); text-align: center; }

/* Step 2 — PIN Entry */
.pin-screen { display: none; }
.pin-screen.active { display: block; }
.select-screen { display: block; }
.select-screen.hidden { display: none; }

.back-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: rgba(255,255,255,0.5);
  cursor: pointer; font-size: 13px; font-family: 'Inter', sans-serif;
  margin-bottom: 20px; padding: 0;
}
.back-btn:hover { color: #fff; }

.pin-user-info {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.06); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 24px;
}
.pin-user-avatar { font-size: 28px; }
.pin-user-name { font-size: 16px; font-weight: 700; color: #fff; }
.pin-user-role { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }

.pin-label {
  font-size: 13px; color: rgba(255,255,255,0.6); margin-bottom: 14px; text-align: center;
}
.pin-dots {
  display: flex; justify-content: center; gap: 14px; margin-bottom: 28px;
}
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.2s;
}
.pin-dot.filled {
  background: #ff6b35; border-color: #ff6b35;
  box-shadow: 0 0 10px rgba(255,107,53,0.5);
}

.pin-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.pin-key {
  height: 58px; border-radius: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff; font-size: 20px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  font-family: 'Inter', sans-serif; display: flex;
  align-items: center; justify-content: center;
}
.pin-key:hover { background: rgba(255,255,255,0.15); transform: scale(1.04); }
.pin-key:active { transform: scale(0.97); background: rgba(255,107,53,0.25); }
.pin-key.del { font-size: 16px; background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.2); }
.pin-key.del:hover { background: rgba(239,68,68,0.3); }
.pin-key.zero { grid-column: 2; }
.pin-key.login-btn {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  border-color: transparent;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(255,107,53,0.4);
}
.pin-key.login-btn:hover { box-shadow: 0 6px 20px rgba(255,107,53,0.5); }

.pin-error {
  text-align: center; color: #f87171; font-size: 13px; font-weight: 600;
  margin-top: 14px; min-height: 20px;
}

.pin-hint {
  text-align: center; font-size: 11px; color: rgba(255,255,255,0.3);
  margin-top: 16px;
}

/* Demo bypass button */
.demo-strip {
  margin-top: 18px; text-align: center;
}
.demo-link {
  font-size: 11.5px; color: rgba(255,255,255,0.3);
  background: none; border: none; cursor: pointer;
  font-family: 'Inter', sans-serif; text-decoration: underline;
  text-underline-offset: 2px;
}
.demo-link:hover { color: rgba(255,255,255,0.6); }

/* Logout button in topbar */
.logout-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: 1px solid #e8eaed;
  border-radius: 10px; padding: 6px 12px;
  font-size: 12.5px; font-weight: 600; color: #6b7280;
  cursor: pointer; font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.logout-btn:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

/* ===== USER MANAGEMENT PANEL (Owner only) ===== */
.user-mgmt-card {
  background: #fff; border-radius: 14px; padding: 24px;
  border: 1px solid #e8eaed; box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.user-mgmt-card h3 { font-size: 15px; font-weight: 700; color: #1a1d2e; margin-bottom: 4px; }
.user-mgmt-card p { font-size: 13px; color: #6b7280; margin-bottom: 20px; }
.user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #f3f4f6;
}
.user-row:last-child { border-bottom: none; }
.user-row-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; border: 2px solid #e8eaed; flex-shrink: 0;
}
.user-row-info { flex: 1; }
.user-row-name { font-size: 14px; font-weight: 700; color: #1a1d2e; }
.user-row-role { font-size: 12px; color: #6b7280; margin-top: 1px; }
.user-row-pin {
  font-size: 11.5px; color: #9ca3af;
  background: #f3f4f6; padding: 3px 10px; border-radius: 6px; font-weight: 600;
}
.user-row-actions { display: flex; gap: 6px; }
.edit-name-input {
  border: 1px solid #3b82f6; border-radius: 6px;
  padding: 5px 10px; font-size: 13px; font-family: 'Inter', sans-serif;
  outline: none; width: 160px;
}

/* Permission badge */
.perm-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 10.5px; font-weight: 700;
}
.perm-full { background: #dcfce7; color: #15803d; }
.perm-limited { background: #dbeafe; color: #1d4ed8; }
.perm-restricted { background: #fef9c3; color: #b45309; }

/* Mobile login */
@media (max-width: 480px) {
  .login-card { padding: 24px 18px; }
  .user-grid { grid-template-columns: 1fr 1fr; }
  .pin-key { height: 52px; font-size: 18px; }
  .login-brand-name { font-size: 22px; }
}
