.brand, .roles-preview, .panel-footer { position: relative; z-index: 1; }

.brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.logo-icon {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: #fff;
  line-height: 1;
}

.brand-sub {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.65);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: var(--space-1);
}

.brand-tagline {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: #fff;
  line-height: 1.25;
  margin-bottom: var(--space-6);
  font-style: italic;
}

.brand-desc {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  max-width: 36ch;
}

.roles-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.roles-label { font-size: var(--text-xs); color: var(--color-primary); letter-spacing: .1em; text-transform: uppercase; margin-bottom: var(--space-1); }

.role-chip { display: flex; align-items: center; gap: var(--space-3); width: fit-content; background: rgba(26,55,52,0.08); border: 1px solid rgba(26,55,52,0.12); border-radius: var(--radius-full); padding: var(--space-2) var(--space-4); }

.role-chip span { font-size: var(--text-xs); color: var(--color-primary); font-weight: 500; }

.role-dot { width: 8px; height: 8px; border-radius: 50%; }
.role-admin { background: #fbbf24; }
.role-doctor { background: #60a5fa; }
.role-psico { background: #a78bfa; }
.role-recep { background: #34d399; }
.role-special { background: #fb923c; }

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.8);
}

.offline-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse-green 2s infinite;
}

.panel-footer {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
}

.spacing-bottom-sm { margin-bottom: var(--space-3); }

.theme-toggle {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-muted);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-10);
  animation: fadeUp .5s cubic-bezier(0.16,1,0.3,1) both;
}

.login-header {
  margin-bottom: var(--space-8);
  text-align: center;
}

.login-icon {
  width: 56px;
  height: 56px;
  background: var(--color-primary-hl);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
}

.login-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.form-group {
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}

.input-wrap:focus-within .input-icon { color: var(--color-primary); }

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 28px);
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(3,105,161,0.12);
  background: var(--color-surface);
}

input.error { border-color: var(--color-error); }

.toggle-password {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-1);
  color: var(--color-text-faint);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.checkbox-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
}

.btn-primary {
  width: 100%;
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn-primary.loading .spinner { display: block; }
.btn-primary.loading .btn-text { opacity: .7; }

.error-msg {
  display: none;
  align-items: center;
  gap: var(--space-3, 12px);
  background: #ffffff;
  border: 1px solid #fee2e2;
  border-left: 4.5px solid #dc2626;
  border-radius: var(--radius-md, 8px);
  padding: 11px 15px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  color: #1e293b;
  margin-bottom: var(--space-4, 14px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.error-msg.visible { display: flex; }

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-divider);
}

.demo-accounts { display: grid; gap: var(--space-2); }

.demo-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  text-align: left;
}

.demo-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-hl);
}

.demo-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.demo-admin { background: #fef3c7; }
.demo-doctor { background: #dbeafe; }
.demo-psico { background: #ede9fe; }
.demo-recep { background: #d1fae5; }

.demo-info { flex: 1; min-width: 0; }

.demo-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}

.demo-role,
.version-tag,
.demo-arrow {
  font-size: 11px;
  color: var(--color-text-faint);
}

.success-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.success-overlay.visible { display: flex; }

.success-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.success-icon {
  width: 64px;
  height: 64px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
}

.success-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.success-msg {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.success-role-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-primary-hl);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: var(--space-3);
}

@keyframes pulse-green {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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