:root {
  --primary: #2ED8B6;
  --primary-dark: #1FAF98;
  --primary-glow: rgba(46, 216, 182, 0.3);
  --secondary: #667eea;
  --bg-body: #0E0E0E;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius: 16px;
  --radius-sm: 10px;
  --success: #2ED8B6;
  --hover-bg: #f0f9ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

.wizard {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Sidebar */
.sidebar {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}
.sidebar-header img { height: 40px; filter: brightness(0) invert(1); }
.sidebar-header span { font-size: 1.5rem; font-weight: 700; }

.steps { display: none; }

.btn-home {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  visibility: hidden;
  opacity: 0;
}
.btn-home:hover {
  background: var(--hover-bg);
  color: var(--primary);
  border-color: var(--primary);
}
.btn-home.visible {
  visibility: visible;
  opacity: 1;
}

.logo-container {
  margin-bottom: 1rem;
  text-align: center;
}
.card-dos .logo-container {
  margin-bottom: 0.5rem;
}
.card-dos .logo-ia {
  max-width: 180px;
}
.logo-ia {
  max-width: 280px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.card-top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 1rem;
  padding: 0;
  flex-shrink: 0;
}
.logo-ia.small {
  height: 40px;
}
.card-top-bar.compact {
  margin-bottom: 0.75rem;
  padding: 0.25rem 0;
}
.card-top-bar.compact .btn-home {
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
}
.card-top-bar.compact .spacer {
  width: 28px;
  height: 28px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  position: relative;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.3s;
}
.step-item.active, .step-item.done { opacity: 1; }
.step-item.clickable:hover { opacity: 0.8; }

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 52px;
  width: 2px;
  height: calc(100% - 32px);
  background: rgba(255,255,255,0.2);
}
.step-item.done:not(:last-child)::after { background: var(--success); }

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all 0.3s;
}
.step-item.active .step-number {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(102,126,234,0.3);
}
.step-item.done .step-number {
  background: var(--success);
  border-color: var(--success);
}
.step-item.done .step-number i { display: block; }
.step-item .step-number i { display: none; }

.step-text h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
.step-text p { font-size: 0.75rem; color: var(--text-light); opacity: 0.7; }
.step-item.done .step-text p, .step-item.active .step-text p { opacity: 1; color: #fff; }

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 2rem 4rem;
  background: var(--bg-body);
  overflow: hidden;
}

/* Cards Container */
.cards-container {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  width: 100%;
  max-width: 1000px;
  height: calc(100vh - 4rem);
  justify-content: center;
  align-items: stretch;
}

/* Card Uno: Paso 1 (Email) */
.card-uno {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Card Accesos: Accesos Rápidos (paso 1) */
.card-accesos {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  overflow: hidden;
  max-width: 480px;
  min-height: 0;
}
.card-accesos .section-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Card Dos: Pasos 2, 3, 4 */
.card-dos {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  overflow: hidden;
  max-width: 480px;
  min-height: 0;
}

/* Móvil: tarjetas apiladas */
@media (max-width: 768px) {
  .cards-container {
    flex-direction: column;
    height: calc(100dvh - 2rem);
    gap: 0.75rem;
    padding: 0.75rem;
  }
  .card-uno {
    flex: 0 0 50%;
    max-width: 100%;
    overflow-y: auto;
    padding: 1rem;
  }
  .card-uno .logo-container {
    margin-bottom: 0.5rem;
  }
  .card-uno .logo-ia {
    max-width: 120px;
  }
  .card-uno .content-header {
    margin-bottom: 0.75rem;
  }
  .card-uno .content-header h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
  }
  .card-uno .content-header p {
    font-size: 0.8rem;
  }
  .card-uno .form-group {
    margin-bottom: 0.75rem;
  }
  .card-uno .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
  }
  .card-uno .input-wrapper input {
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    font-size: 0.9rem;
  }
  .card-uno .btn {
    padding: 0.7rem;
    font-size: 0.9rem;
  }
  .card-accesos {
    flex: 0 0 calc(50% - 0.75rem);
    max-width: 100%;
    padding: 1rem;
  }
  .card-accesos .logo-container {
    display: none;
  }
  .card-dos {
    max-width: 100%;
    height: 100%;
  }
}

/* Teléfonos muy pequeños: ocultar logo */
@media (max-width: 768px) and (max-height: 580px) {
  .card-uno .logo-container {
    display: none;
  }
}
.bottom-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-header h3 i { color: var(--primary); margin-right: 0.5rem; }
.section-header .count {
  font-size: 0.75rem;
  background: var(--hover-bg);
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-weight: 500;
  margin-left: 0.5rem;
}
.section-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.25rem;
}
.section-list .qa-entry {
  border: 1px solid var(--border);
  border-radius: 12px;
}

.qa-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.qa-entry:hover { background: var(--hover-bg); }
.qa-entry .qa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.qa-entry .qa-info { flex: 1; min-width: 0; }
.qa-entry .qa-empresa {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qa-entry .qa-usuario {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.qa-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-light);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.15s;
  flex-shrink: 0;
  opacity: 0;
}
.qa-entry:hover .qa-remove { opacity: 1; }
.qa-remove:hover { background: #fee2e2; color: #ef4444; }


.quick-access-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(46, 216, 182, 0.1);
  border: 1px solid rgba(46, 216, 182, 0.3);
  animation: pulseHighlight 2s ease-in-out infinite;
}
@keyframes pulseHighlight {
  0%, 100% {
    background: rgba(46, 216, 182, 0.1);
    border-color: rgba(46, 216, 182, 0.3);
    box-shadow: 0 0 0 0 rgba(46, 216, 182, 0);
  }
  50% {
    background: rgba(46, 216, 182, 0.2);
    border-color: rgba(46, 216, 182, 0.5);
    box-shadow: 0 0 12px 3px rgba(46, 216, 182, 0.25);
  }
}
.quick-access-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.quick-access-check label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.content-header {
  text-align: center;
  margin-bottom: 2rem;
}
.content-header img { height: 60px; margin-bottom: 1rem; }
.content-header h2 { font-size: 1.5rem; color: var(--text); margin-bottom: 0.5rem; }
.content-header p { color: var(--text-muted); }

.step-content { display: none; animation: slideIn 0.4s ease; }
.step-content.active { display: block; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Form elements */
.form-group { margin-bottom: 1.5rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.input-wrapper { position: relative; }
.input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.input-wrapper input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: all 0.2s;
  background: var(--bg-input);
  color: var(--text);
}
.input-wrapper input::placeholder {
  color: var(--text-muted);
}
.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary {
  background: var(--primary);
  color: #0E0E0E;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px var(--primary-glow);
  background: var(--primary-dark);
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(46, 216, 182, 0.1);
}

/* ===== LISTA COMPACTA ===== */
.compact-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-input);
}

.compact-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  border-radius: 12px;
  gap: 0.5rem;
  color: var(--text);
  background: var(--bg-input);
}

.compact-item:hover {
  background: var(--hover-bg);
  border-color: var(--primary);
}
.compact-item.selected {
  background: rgba(46, 216, 182, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.compact-item .mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
}
.compact-item .mini-avatar.gradient {
  background: var(--bg-gradient);
  color: #fff;
}
.compact-item .mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.compact-item .item-info {
  flex: 1;
  min-width: 0;
}
.compact-item .item-name {
  font-weight: 500;
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compact-item .item-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: none;
}

.compact-item .item-arrow {
  color: var(--text-light);
  font-size: 0.75rem;
  transition: transform 0.15s;
}
.compact-item:hover .item-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* Counter badge */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.list-header .label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.list-header .count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--hover-bg);
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
}

/* Search */
.search-box {
  position: relative;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.search-box input {
  width: 100%;
  padding: 0.6rem 0.75rem 0.6rem 2.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

/* User info card */
.user-info {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.user-info .avatar {
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}
.user-info .details h4 { font-weight: 600; }
.user-info .details p { opacity: 0.8; font-size: 0.875rem; }

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span { padding: 0 1rem; }

/* Alert */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}
.alert.show { display: flex; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile */
@media (max-width: 768px) {
  .wizard { flex-direction: column; }
  .main-content { padding: 1rem; }
  .content-card { padding: 1.25rem; }
  .content-header img { height: 50px; }
  .content-header h2 { font-size: 1.25rem; }
  .cards-container {
    flex-direction: column;
    gap: 1rem;
    max-height: calc(100dvh - 2rem);
    max-width: 100%;
  }
  .cards-container .content-card {
    flex: 1;
    justify-content: center;
    max-width: 100%;
  }
  .cards-container .bottom-card {
    flex: 1;
    max-width: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .quick-access-card { padding: 1rem; }
  .qa-remove { opacity: 1; }
}

.hidden { display: none !important; }

/* Campo de contraseña disfrazado (evita que el navegador lo detecte) */
.password-field {
  -webkit-text-security: disc !important;
  text-security: disc !important;
  font-family: 'password', monospace !important;
}
@font-face {
  font-family: 'password';
  src: url('data:font/woff2;base64,d09GMgABAAAAAADcAAoAAAAAAggAAACWAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgkIKGAsGAAE2AiQDCAsGAAQgBYRtBy4b8gXIHge5KfNRkpRk+n4k+N5//+1z730BELhIIsAhQWZrrmgKBZnP//ff/vfaO8B/9v4N/N0FC2IFC1YMlAHl+vz/OufrS+9a8KOPdn6rktMjWNi4EVBRQQeADDaH6Hd6BKKJR0HAAwA=') format('woff2');
}

/* Modal de confirmación sesión activa */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  width: 90%;
  max-width: 420px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.modal-overlay.show .modal-box {
  transform: scale(1);
}
.modal-icon {
  width: 64px;
  height: 64px;
  background: #fef3c7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}
.modal-icon i {
  font-size: 2rem;
  color: #f59e0b;
}
.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.modal-message {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.modal-session-info {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.modal-session-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.modal-session-info .info-row:last-child {
  border-bottom: none;
}
.modal-session-info .info-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.modal-session-info .info-value {
  font-weight: 500;
  color: var(--text);
  font-size: 0.875rem;
}
.modal-buttons {
  display: flex;
  gap: 1rem;
}
.modal-buttons .btn {
  flex: 1;
}
.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
}
.btn-warning {
  background: #f59e0b;
  color: #fff;
}
.btn-warning:hover {
  background: #d97706;
}

.empty-msg {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* Toast notification */
.toast-notification {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #fee2e2;
  color: #991b1b;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 9999;
  animation: toastIn 0.3s ease;
  max-width: 90%;
}
.toast-notification i { font-size: 1.25rem; }
.toast-notification.hide { animation: toastOut 0.3s ease forwards; }

/* Tipos de toast */
.toast-notification.toast-error {
  background: #fee2e2;
  color: #991b1b;
}
.toast-notification.toast-success {
  background: #d1fae5;
  color: #065f46;
}
.toast-notification.toast-info {
  background: #dbeafe;
  color: #1e40af;
}
.toast-notification.toast-warning {
  background: #fef3c7;
  color: #92400e;
}

@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(-50%) translateY(-20px); } }

.last-email-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.last-email-hint a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.last-email-hint a:hover {
  text-decoration: underline;
}
