:root {
  --login-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  --login-card-bg: rgba(255, 255, 255, 0.08);
  --login-card-border: rgba(255, 255, 255, 0.15);
  --login-text: #ffffff;
  --login-muted: rgba(255, 255, 255, 0.6);
  --login-primary: #667eea;
  --login-primary-dark: #764ba2;
  --login-radius: 20px;
  --login-shadow: 0 32px 64px rgba(0, 0, 0, 0.4);
}

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

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--login-bg);
  position: relative;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  padding: 16px;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  top: -200px;
  left: -200px;
  animation: float 8s ease-in-out infinite;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  bottom: -150px;
  right: -150px;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, 30px); }
}

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  background: var(--login-card-bg);
  border: 1px solid var(--login-card-border);
  border-radius: var(--login-radius);
  box-shadow: var(--login-shadow);
  backdrop-filter: blur(20px);
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
  display: flex;
  flex-direction: column;
  max-height: none;
}

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

.login-header {
  text-align: center;
  padding: 24px 32px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--login-text);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--login-muted);
}

.login-body {
  padding: 20px 32px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
}

.login-tab {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--login-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-tab:hover {
  color: var(--login-text);
}

.login-tab.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: var(--login-text);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

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

.login-form-group {
  position: relative;
}

.login-form-group label {
  display: block;
  font-size: 12px;
  color: var(--login-muted);
  margin-bottom: 6px;
  padding-left: 4px;
}

.login-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--login-text);
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
}

.login-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
  background: rgba(0, 0, 0, 0.25);
}

.login-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--login-muted);
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #667eea;
  cursor: pointer;
}

.login-forgot {
  color: #9fb3ff;
  text-decoration: none;
  transition: color 0.3s;
}

.login-forgot:hover {
  color: #ffffff;
}

.login-btn {
  width: 100%;
  padding: 13px;
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.login-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
}

.login-btn:hover::after {
  left: 100%;
}

.login-btn:active {
  transform: translateY(0);
}

.login-accounts {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.login-accounts-title {
  font-size: 13px;
  color: var(--login-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.account-section {
  margin-bottom: 14px;
}

.account-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--login-text);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
}

.account-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.account-item:active { transform: translateX(4px) scale(0.99); }
.account-item:focus-visible { outline: 2px solid #6c8cff; outline-offset: 2px; }

.account-empty {
  padding: 10px;
  font-size: 12px;
  color: rgba(226, 232, 240, 0.45);
  text-align: center;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-name {
  font-size: 14px;
  color: var(--login-text);
  font-weight: 600;
}

.account-role {
  font-size: 12px;
  color: var(--login-muted);
}

.account-cred {
  font-size: 12px;
  color: #9fb3ff;
  font-family: 'SF Mono', monospace;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 10px;
  border-radius: 6px;
}

.login-error {
  color: #ff6b6b;
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.role-hint {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.2);
  color: var(--login-muted);
}

.role-hint strong {
  color: var(--login-text);
}

.role-hint.resident {
  background: rgba(46, 213, 115, 0.1);
  border-color: rgba(46, 213, 115, 0.2);
}

@media (max-width: 600px) {
  .login-body {
    padding: 24px;
  }

  .login-header {
    padding: 32px 24px 20px;
  }

  .login-title {
    font-size: 22px;
  }

  .account-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
