/* ==============================================================================
   VisaFlow Design System - Pure Vanilla CSS
   Theme & Palette: #1F4E5F (Primary) + Crisp Modern B2B SaaS Aesthetics
   ============================================================================== */

:root {
  --primary: var(--primary-color, #1F4E5F);
  --primary-hover: #153643;
  --primary-light: rgba(31, 78, 95, 0.08);
  --primary-border: rgba(31, 78, 95, 0.2);
  --accent: #E07A5F;
  --accent-hover: #cb6b51;
  --bg-main: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --border-color: #E2E8F0;
  --border-focus: #1F4E5F;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 0 3px rgba(31, 78, 95, 0.15);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', 'Inter', sans-serif;
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

/* App Header */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #2d6f87);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(31, 78, 95, 0.25);
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.agency-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.agency-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-item:hover, .nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
}

.btn-nav-cta {
  background: var(--primary);
  color: #fff !important;
  box-shadow: var(--shadow-sm);
}

.btn-nav-cta:hover {
  background: var(--primary-hover) !important;
  color: #fff !important;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.2;
}

.user-email {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.btn-logout {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.btn-logout:hover {
  color: #EF4444;
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.05);
}

/* Main Content Area */
.main-content {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 4.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-alert {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.25s ease-out;
  min-width: 300px;
  max-width: 450px;
}

.toast-success { border-left-color: #10B981; }
.toast-warning { border-left-color: #F59E0B; }
.toast-danger { border-left-color: #EF4444; }
.toast-info { border-left-color: #3B82F6; }

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}

.toast-close:hover { color: var(--text-main); }

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Auth Page Layout */
.auth-body {
  background: radial-gradient(circle at 50% 20%, #173642 0%, #0c1c24 100%);
  min-height: 100vh;
}

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 2rem 1rem;
}

.auth-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 440px;
  padding: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), #2b6d85);
  color: #fff;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: 0 8px 16px rgba(31, 78, 95, 0.3);
}

.auth-logo-symbol {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-light);
  pointer-events: none;
}

.input-wrapper .form-control {
  padding-left: 2.75rem;
}

.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.925rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.auth-footer-notes {
  margin-top: 1.75rem;
  text-align: center;
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.775rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

/* Dashboard Layout */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  text-decoration: none;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}

.metric-card.metric-active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-total { background: #EEF2F6; color: #475569; }
.icon-recolectando { background: #FEF3C7; color: #D97706; }
.icon-listo { background: #E0E7FF; color: #4F46E5; }
.icon-en-cola { background: #F3E8FF; color: #9333EA; }
.icon-llenando { background: #E0F2FE; color: #0284C7; }
.icon-completado { background: #D1FAE5; color: #059669; }

.metric-data {
  display: flex;
  flex-direction: column;
}

.metric-number {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-main);
}

.metric-label {
  font-size: 0.785rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: var(--transition);
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Cases Table */
.cases-card {
  box-shadow: var(--shadow-sm);
}

.table-responsive {
  overflow-x: auto;
}

.table-cases {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table-cases th {
  background: var(--bg-subtle);
  padding: 0.85rem 1.25rem;
  font-size: 0.785rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.table-cases td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.case-row {
  cursor: pointer;
  transition: var(--transition);
}

.case-row:hover {
  background: rgba(31, 78, 95, 0.02);
}

.col-applicant {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.applicant-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border: 1px solid var(--primary-border);
}

.applicant-meta {
  display: flex;
  flex-direction: column;
}

.applicant-fullname {
  font-weight: 600;
  color: var(--text-main);
}

.applicant-id {
  font-size: 0.75rem;
  color: var(--text-light);
  font-family: monospace;
}

.text-italic-muted {
  font-style: italic;
  color: var(--text-light);
}

.badge-mode {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-mode-definitivo {
  background: #E0F2FE;
  color: #0369A1;
}

.badge-mode-temporal {
  background: #FEF3C7;
  color: #B45309;
}

.consulate-name {
  font-weight: 600;
  display: block;
}

.visa-type-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-recolectando { background: #FEF3C7; color: #B45309; }
.status-recolectando .status-dot { background: #D97706; }

.status-listo { background: #DBEAFE; color: #1D4ED8; }
.status-listo .status-dot { background: #2563EB; }

.status-en_cola { background: #F3E8FF; color: #7E22CE; }
.status-en_cola .status-dot { background: #9333EA; }

.status-llenando { background: #E0E7FF; color: #4338CA; }
.status-llenando .status-dot { background: #4F46E5; }

.status-completado { background: #D1FAE5; color: #047857; }
.status-completado .status-dot { background: #10B981; }

.status-fallido { background: #FEE2E2; color: #B91C1C; }
.status-fallido .status-dot { background: #EF4444; }

/* Progress Bar */
.progress-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 120px;
}

.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-bar-fill.fill-complete {
  background: #10B981;
}

.progress-pct-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 32px;
}

.date-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.text-right {
  text-align: right;
}

/* Empty State */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-icon {
  width: 80px;
  height: 80px;
  background: var(--bg-subtle);
  color: var(--text-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-title {
  font-size: 1.25rem;
}

.empty-desc {
  max-width: 440px;
  color: var(--text-muted);
  font-size: 0.925rem;
}

/* ==============================================================================
   New Case Page
   ============================================================================== */
.form-page-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.breadcrumb-back:hover {
  color: var(--primary);
}

.card-header-styled {
  padding: 2rem 2rem 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-icon-circle {
  width: 52px;
  height: 52px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-styled-title {
  font-size: 1.4rem;
  line-height: 1.2;
}

.card-styled-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.new-case-form {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.section-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: block;
  margin-bottom: 0.75rem;
}

.radio-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.radio-card-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.radio-card-input {
  position: absolute;
  opacity: 0;
}

.radio-card-content {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background: var(--bg-surface);
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-card-input:checked + .radio-card-content {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.radio-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.radio-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.badge-tag {
  background: #E0F2FE;
  color: #0369A1;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
}

.badge-tag-warning {
  background: #FEF3C7;
  color: #B45309;
}

.radio-card-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-help {
  font-size: 0.775rem;
  color: var(--text-light);
}

.form-submit-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

/* ==============================================================================
   18-Step Stepper Layout & Detail View
   ============================================================================== */
.stepper-page-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stepper-header-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  gap: 1.5rem;
}

.stepper-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-back-nav {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-subtle);
}

.btn-back-nav:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.applicant-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.applicant-headline {
  font-size: 1.4rem;
  font-weight: 800;
}

.case-meta-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.case-meta-line code {
  background: var(--bg-subtle);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
}

.stepper-header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.autosave-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-light);
}

.status-icon-saved {
  color: #10B981;
  display: flex;
  align-items: center;
}

.autosave-saving {
  color: #F59E0B;
}

.autosave-saving .status-icon-saved {
  display: none;
}

.header-completion-box {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.completion-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
}

.completion-label {
  color: var(--text-muted);
}

.completion-val {
  color: var(--primary);
}

.header-progress-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 9999px;
  overflow: hidden;
}

.header-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Phase 3 Actions Toolbar */
.stepper-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  gap: 1rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-passport-scan {
  background: linear-gradient(135deg, #1F4E5F, #2B6B82);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 2px 4px rgba(31, 78, 95, 0.2);
}

.btn-passport-scan:hover {
  background: linear-gradient(135deg, #153643, #1F4E5F) !important;
  color: #fff !important;
}

.toolbar-photo-box {
  display: flex;
  align-items: center;
}

.applicant-photo-thumb-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--primary-border);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  transition: var(--transition);
}

.applicant-photo-thumb-wrapper:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.applicant-photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.applicant-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
  text-align: center;
  padding: 2px;
}

.field-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.btn-ai-desc {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  color: #2563EB;
  border-color: #BFDBFE;
  background: #EFF6FF;
  border-radius: var(--radius-sm);
}

.btn-ai-desc:hover {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #1D4ED8;
}

/* Stepper Body Layout */
.stepper-main-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Stepper Sidebar Navigation Rail */
.stepper-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 7rem);
  display: flex;
  flex-direction: column;
}

.sidebar-title-box {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.sidebar-steps-heading {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stepper-nav-list {
  padding: 0.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stepper-nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.stepper-nav-btn:hover {
  background: var(--bg-subtle);
}

.stepper-nav-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.step-num-pill {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.stepper-nav-btn.active .step-num-pill {
  background: var(--primary);
  color: #fff;
}

.step-nav-label-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.step-nav-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stepper-nav-btn.active .step-nav-title {
  color: var(--primary);
}

.step-nav-desc {
  font-size: 0.7rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-check-mark {
  display: none;
  color: #10B981;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: rgba(16, 185, 129, 0.12);
  border-radius: 50%;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.stepper-nav-btn.step-completed .step-check-mark {
  display: flex;
}

.stepper-nav-btn.step-completed .step-num-pill {
  border: 1.5px solid #10B981;
  color: #10B981;
  background: rgba(16, 185, 129, 0.08);
}

.stepper-nav-btn.step-completed.active .step-num-pill {
  background: #10B981;
  color: #ffffff;
}

/* AI Job duties assistant tools (§X) */
.field-ai-tools-box {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-lang-select {
  height: 28px;
  font-size: 0.75rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
}

.btn-generate-ai-desc {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* Custom checkbox / toggle container (§T) */
.field-checkbox-container {
  padding: 0.5rem 0;
}

.custom-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.custom-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.custom-toggle-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Disabled inactive fields (§W) */
.field-disabled-inactive {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.85);
  transition: opacity 0.2s ease;
}

/* Stepper Content Form Panel */
.stepper-content-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
}

.step-pane {
  display: none;
}

.step-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

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

.step-pane-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
}

.step-pane-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.step-pane-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.step-pane-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Fields Grid */
.step-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.form-field-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: opacity 0.2s, max-height 0.2s;
}

.form-field-card.field-col-textarea {
  grid-column: span 2;
}

.form-field-card.field-hidden {
  display: none !important;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.field-required-star {
  color: #EF4444;
  font-weight: 700;
}

.field-control-wrapper {
  position: relative;
}

.field-help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Optional Fields Accordion (§Q) */
.optional-fields-accordion {
  margin-top: 1.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.optional-fields-accordion[open] {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.optional-fields-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-subtle);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-main);
  transition: background var(--transition);
}

.optional-fields-summary:hover {
  background: rgba(31, 78, 95, 0.05);
}

.optional-fields-summary::-webkit-details-marker {
  display: none;
}

.optional-summary-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.optional-fields-accordion[open] .optional-summary-chevron {
  transform: rotate(90deg);
  color: var(--primary);
}

.optional-summary-title {
  flex: 1;
}

.optional-summary-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
  font-weight: 500;
}

.optional-fields-accordion[open] .optional-summary-badge {
  background: var(--primary-light);
  color: var(--primary);
}

.optional-fields-body {
  padding: 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
}

/* Step Footer Navigation Controls */
.step-footer-controls {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-step-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Validation Drawer */
.validation-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: var(--bg-surface);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.validation-drawer.drawer-open {
  right: 0;
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--primary);
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.drawer-close-btn:hover {
  color: var(--text-main);
}

.drawer-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.drawer-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.missing-fields-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.missing-field-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: #FFF1F2;
  border: 1px solid #FFE4E6;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #9F1239;
}

.missing-bullet {
  font-weight: 900;
  color: #E11D48;
}

.all-fields-complete-msg {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem;
  background: #ECFDF5;
  border: 1px solid #D1FAE5;
  border-radius: var(--radius-md);
  color: #065F46;
  font-size: 0.9rem;
  font-weight: 600;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.backdrop-active {
  opacity: 1;
  pointer-events: auto;
}

/* App Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  padding: 1rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-tag {
  font-weight: 600;
  color: var(--text-light);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .stepper-main-layout {
    grid-template-columns: 1fr;
  }
  .stepper-sidebar {
    position: static;
    max-height: none;
  }
  .stepper-nav-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.75rem;
  }
  .stepper-nav-btn {
    width: auto;
    min-width: 160px;
  }
}

@media (max-width: 768px) {
  .step-fields-grid,
  .radio-card-grid,
  .form-row-2col {
    grid-template-columns: 1fr;
  }
  .form-field-card.field-col-textarea {
    grid-column: span 1;
  }
  .stepper-header-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .stepper-header-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* ==============================================================================
   Phase 4: Bot Execution & Live Queue Monitoring
   ============================================================================== */
.btn-send-to-bot {
  background: linear-gradient(135deg, #059669, #10B981);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
  font-weight: 600;
  transition: var(--transition);
}

.btn-send-to-bot:hover {
  background: linear-gradient(135deg, #047857, #059669) !important;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-send-to-bot:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline-danger {
  background: transparent;
  color: #DC2626;
  border-color: #FCA5A5;
}

.btn-outline-danger:hover {
  background: #FEF2F2;
  border-color: #DC2626;
  color: #B91C1C;
}

.bot-status-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.bot-status-card.bot-card-hidden {
  display: none !important;
}

.bot-status-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 5px;
  background: var(--text-light);
}

.status-card-en_cola {
  border-color: #A5B4FC;
  background: linear-gradient(to right, rgba(238, 242, 255, 0.5), var(--bg-surface));
}
.status-card-en_cola::before { background: #6366F1; }

.status-card-corriendo {
  border-color: #93C5FD;
  background: linear-gradient(to right, rgba(239, 246, 255, 0.6), var(--bg-surface));
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.12);
}
.status-card-corriendo::before { background: #3B82F6; }

.status-card-completado {
  border-color: #A7F3D0;
  background: linear-gradient(to right, rgba(236, 253, 245, 0.6), var(--bg-surface));
}
.status-card-completado::before { background: #10B981; }

.status-card-fallido {
  border-color: #FECACA;
  background: linear-gradient(to right, rgba(254, 242, 242, 0.6), var(--bg-surface));
}
.status-card-fallido::before { background: #EF4444; }

.status-card-detenido {
  border-color: #FDE68A;
  background: linear-gradient(to right, rgba(254, 252, 232, 0.6), var(--bg-surface));
}
.status-card-detenido::before { background: #F59E0B; }

.bot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.bot-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.bot-icon-spinner {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.status-card-corriendo .bot-icon-spinner {
  background: #DBEAFE;
  color: #1D4ED8;
  animation: pulseRotate 2s infinite linear;
}

@keyframes pulseRotate {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.08) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

.bot-card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  flex-wrap: wrap;
}

.bot-card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.bot-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bot-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.bot-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #059669);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.status-card-corriendo .bot-progress-fill {
  background: linear-gradient(90deg, #3B82F6, #2563EB);
  background-size: 200% 100%;
  animation: shimmerProgress 1.5s infinite linear;
}

@keyframes shimmerProgress {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.status-card-fallido .bot-progress-fill {
  background: #EF4444;
}

.status-card-detenido .bot-progress-fill {
  background: #F59E0B;
}

.bot-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bot-appid-success-banner {
  margin-top: 0.85rem;
  padding: 0.75rem 1rem;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.appid-success-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.appid-success-icon {
  font-size: 1.5rem;
}

.appid-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #065F46;
  letter-spacing: 0.05em;
}

.appid-code-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.15rem;
}

.appid-code {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #065F46;
  letter-spacing: 0.08em;
}

.btn-copy-appid {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy-appid:hover {
  background: #A7F3D0;
}

/* -------------------------------------------------------------------------
 * Consular Verification Banner & Modal (§I / §K)
 * ------------------------------------------------------------------------- */
.consular-verification-banner {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.consular-verification-banner.banner-pending {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
}

.consular-verification-banner.banner-failed {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
}

.banner-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.banner-message {
  font-size: 0.925rem;
  line-height: 1.45;
}

.banner-message code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
}

.banner-action {
  flex-shrink: 0;
}

.modal-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
}

.modal-dialog-container {
  background: var(--bg-card, #ffffff);
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
  border: 1px solid var(--border-color, #e2e8f0);
  width: 90%;
  max-width: 480px;
  overflow: hidden;
}

.modal-dialog-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--primary-color, #1F4E5F);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-main, #0f172a);
}

