body {
  font-family: "Inter", sans-serif;
  background-color: #f5f6f8;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 40px;
}

/* CRITICAL: Main card styling for white background */
.main-card {
  background-color: #ffffff;
  padding: 40px;
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo {
  display: block;
  margin: 20px auto 40px auto;
  max-width: 250px;
  transition: all 0.3s ease;
}

.hero-title {
  font-family: "Poppins", sans-serif;
  font-weight: 200;
  font-size: 36px;
  color: #6B6B6B;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: -0.2px;
  margin-bottom: 40px;
}

.hero-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: nowrap;
}

.hero-image {
  flex: 0 0 50%;
  max-width: 50%;
  box-sizing: border-box;
  padding-left: 20px;
  padding-right: 10px;
}

.hero-image img {
  width: 100%;
  height: 400px;
  display: block;
  object-fit: cover;
  border-radius: 4px;
}

.hero-form {
  flex: 0 0 50%;
  max-width: 50%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-right: 20px;
  padding-left: 10px;
}

.subtitle {
  font-size: 16px;
  color: #555;
  margin-bottom: 20px;
}

/* Form styling */
form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}

label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

/* Label styling for checkboxes */
label[for="enableCommentary"] {
  display: flex;
  align-items: center;
  font-weight: 400;
  cursor: pointer;
}

label[for="enableCommentary"] input[type="checkbox"] {
  margin-right: 8px;
  width: auto;
}

select {
  width: 100%;
  padding: 14px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
  background-color: #f9f9f9;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
}

button {
  padding: 14px 24px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  align-self: center;
}

button:hover {
  background-color: #218838;
  transform: scale(1.03);
}

.center-button {
  align-items: center;
  text-align: center;
}

/* Loading states */
.loading {
  background-color: #f1c40f !important;
  color: #000 !important;
  cursor: wait;
}

.loading .spinner,
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border: 3px solid #fff;
  border-top: 3px solid #000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Header styling (for sticky headers) */
#header {
  display: none;
  padding: 10px 40px;
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
}

#header.sticky-compact {
  display: flex;
}

#header.sticky-compact .logo {
  max-width: 160px;
  margin: 0;
}

.report-title {
  font-family: "Poppins", sans-serif;
  font-weight: 200;
  font-size: 20px;
  color: #6B6B6B;
  letter-spacing: -0.2px;
  margin: 0;
  flex-grow: 1;
  text-align: right;
  text-transform: uppercase;
}

/* Status page specific - Progress log */
#log-box {
  font-family: 'Courier New', monospace;
  background-color: #f3f3f3;
  padding: 16px;
  border-radius: 6px;
  height: 345px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  white-space: pre-wrap;
}
.log-entry {
  margin-bottom: 4px;
}
/* HITL section - improved layout and styling */
#hitl-section {
  margin: 30px 0;
  width: 100%;
  box-sizing: border-box;
}

.hitl-content {
  background: #f9f9f9;
  border: 1px solid #ddd;
  padding: 20px;
  margin-bottom: 15px;
  border-radius: 6px;
  font-family: Inter, sans-serif;
  line-height: 1.4;
  max-width: 100%;
  box-sizing: border-box;
}

/* Fix paragraph spacing in HITL content */
.hitl-content p {
  margin: 0 0 12px 0;
}

.hitl-content h3 {
  margin: 0 0 15px 0;
}

.hitl-content h4 {
  margin: 20px 0 10px 0;
}

.hitl-content ul {
  margin: 10px 0;
  padding-left: 20px;
}

.hitl-content li {
  margin-bottom: 8px;
}

#hitl-response {
  width: 100%;
  max-width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 15px;
}

#hitl-submit {
  background-color: #28a745;
  color: white;
  padding: 14px 24px;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.2s;
}

#hitl-submit:hover {
  background-color: #218838;
  transform: scale(1.03);
}

/* PDF and preview sections */
#preview-container {
  display: none;
  background-color: #fff;
  padding: 20px 0;
  margin-top: 30px;
  width: 100%;
  box-sizing: border-box;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.download-link {
  color: #1c90f3;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #1c90f3;
  background-color: #e6f1fc;
  font-size: 14px;
}

.download-link:hover {
  background-color: #d3e9fc;
}

#pdf-frame {
  width: 100%;
  height: 1325px;
  border: 1px solid #cccccc;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.5s ease;
  display: none;
}

#pdf-frame.visible {
  opacity: 1;
  display: block;
}

/* Regenerate bar (if needed) */
.regenerate-bar {
  background: #fff;
  padding: 12px 40px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: center;
  margin-bottom: 0;
}

#regenerate-form .form-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

#regen-company {
  flex: 1 1 200px;
}

#regen-month {
  flex: 1 1 140px;
}

#regen-year {
  flex: 1 1 100px;
}

.form-row select {
  padding: 10px;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background-color: #f9f9f9;
}

.form-row button {
  flex: 0 0 auto;
  background-color: #28a745;
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 14px;
}

.form-row button:hover {
  background-color: #218838;
}

.hero-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 1.25rem;
  text-align: center;
  font-weight: 400;
  margin-top: -10px;
}

/* ================================================= */
/* NEW: Toggle Switch Styling for Preflight/Commentary */
/* ================================================= */

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 400;
  cursor: pointer;
  padding: 12px 0;
  margin-bottom: 8px;
}

.toggle-text {
  flex: 1;
  margin-right: 15px;
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.toggle-switch {
  position: relative;
  width: 60px;
  height: 30px;
  flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s ease;
  border-radius: 30px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #28a745;
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(30px);
}

/* Hover effects for toggle switches */
.toggle-switch:hover .toggle-slider {
  background-color: #bbb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.toggle-switch:hover input:checked + .toggle-slider {
  background-color: #218838;
}

/* Active state for toggle switches */
.toggle-switch:active .toggle-slider:before {
  width: 28px;
}

/* Focus styles for accessibility */
.toggle-switch input:focus + .toggle-slider {
  outline: 2px solid #28a745;
  outline-offset: 2px;
}

/* ================================================= */
/* Authentication Styles */
/* ================================================= */

.form-input {
  width: 100%;
  padding: 14px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
  background-color: #f9f9f9;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

.form-input:focus {
  outline: none;
  border-color: #28a745;
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1);
}

.form-help {
  color: #666;
  font-size: 12px;
  margin-top: 4px;
  display: block;
  font-style: italic;
}

.message-box {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.4;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.success-message {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.info-message {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  color: #555;
}

.auth-link a {
  color: #28a745;
  text-decoration: none;
  font-weight: 600;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* 2FA Setup Styles */
.qr-container {
  text-align: center;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin: 20px;
}

.qr-container h3 {
  margin-bottom: 20px;
  color: #333;
  font-family: "Inter", sans-serif;
}

.qr-code {
  max-width: 280px;
  width: 100%;
  border: 1px solid #ddd;
  padding: 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.setup-instructions {
  text-align: left;
  color: #555;
  line-height: 1.6;
  padding-left: 20px;
}

.setup-instructions li {
  margin-bottom: 12px;
}

.app-list {
  margin: 10px 0;
  padding-left: 20px;
}

.app-list li {
  margin-bottom: 6px;
}

.secret-key {
  background: #f5f5f5;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  word-break: break-all;
  display: inline-block;
  margin: 8px 0;
  border: 1px solid #ddd;
}

.button-link {
  display: inline-block;
  padding: 14px 24px;
  background-color: #28a745;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  transition: background-color 0.2s;
  font-family: "Inter", sans-serif;
}

.button-link:hover {
  background-color: #218838;
  transform: scale(1.03);
}

/* User info display in header */
.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #666;
  font-size: 14px;
}

.user-info .username {
  font-weight: 600;
  color: #333;
}

.logout-link {
  color: #dc3545;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid #dc3545;
  transition: all 0.2s;
}

.logout-link:hover {
  background-color: #dc3545;
  color: white;
}

/* Enhanced loading states for auth */
button.loading {
  background-color: #f1c40f !important;
  color: #000 !important;
  cursor: wait;
  position: relative;
}

button.loading:hover {
  transform: none;
}

/* ================================================= */
/* Preflight Status Display Styling */
/* ================================================= */

.status-display {
  transition: all 0.3s ease;
  font-size: 16px;
  font-weight: 600;
  padding: 15px;
  border-radius: 6px;
  text-align: center;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
}

.status-display.complete {
  background: #d4edda !important;
  color: #155724;
  border-color: #c3e6cb !important;
}

.status-display.processing {
  background: #fff3cd !important;
  color: #856404;
  border-color: #ffeaa7 !important;
}

.status-display.error {
  background: #f8d7da !important;
  color: #721c24;
  border-color: #f5c6cb !important;
}

/* Continue button specific styling */
#continue-btn {
  transition: all 0.3s ease;
  background-color: #007bff;
  padding: 16px 32px;
  font-size: 16px;
}

#continue-btn:hover {
  background-color: #0056b3 !important;
  transform: scale(1.05);
}

#continue-btn:disabled {
  background-color: #6c757d !important;
  cursor: not-allowed;
  transform: none;
}

/* Animation for continue section */
#continue-section {
  animation: fadeIn 0.5s ease-in-out;
}

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

/* ================================================= */
/* FIXED: Alert Banner Z-Index and Button Styling */
/* ================================================= */

/* Refresh Alert Banner - HIGHEST Z-INDEX */
#refresh-alert-banner {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99999 !important; /* ✅ HIGHEST Z-INDEX - Above everything */
  background: #ffc107;
  color: #212529;
  padding: 15px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25) !important;
  font-weight: 600;
  font-family: Inter, sans-serif;
  border-bottom: 2px solid #e0a800;
}

#refresh-alert-banner.force-refresh {
  background: #dc3545 !important;
  color: white !important;
  border-bottom: 2px solid #c82333 !important;
}

/* Alert Banner Buttons - Consistent Sizing */
#refresh-alert-banner button {
  margin: 0 5px !important;
  padding: 10px 20px !important;
  border: none !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  font-family: Inter, sans-serif !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
  min-width: 120px !important; /* ✅ CONSISTENT BUTTON WIDTH */
  height: 40px !important; /* ✅ CONSISTENT BUTTON HEIGHT */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Primary Button (Refresh) */
#refresh-alert-banner button:first-of-type {
  background: #007bff !important;
  color: white !important;
}

#refresh-alert-banner button:first-of-type:hover {
  background: #0056b3 !important;
  transform: scale(1.05) !important;
}

/* Secondary Button (Continue/Dismiss) */
#refresh-alert-banner button:last-of-type {
  background: #6c757d !important;
  color: white !important;
}

#refresh-alert-banner button:last-of-type:hover {
  background: #545b62 !important;
  transform: scale(1.05) !important;
}

/* Force Refresh Alert Styling */
#refresh-alert-banner.force-refresh button:first-of-type {
  background: white !important;
  color: #dc3545 !important;
}

#refresh-alert-banner.force-refresh button:first-of-type:hover {
  background: #f8f9fa !important;
  transform: scale(1.05) !important;
}

/* Recovery Banner - SECOND HIGHEST Z-INDEX */
#recovery-banner {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99998 !important; /* ✅ SECOND HIGHEST - Below refresh alert */
  background: #ffc107;
  color: #212529;
  padding: 15px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
  font-weight: 600;
  font-family: Inter, sans-serif;
  border-bottom: 2px solid #e0a800;
}

#recovery-banner button {
  margin: 0 5px !important;
  padding: 8px 16px !important;
  border: none !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  font-family: Inter, sans-serif !important;
  transition: all 0.2s ease !important;
  min-width: 100px !important; /* ✅ CONSISTENT BUTTON WIDTH */
  height: 36px !important; /* ✅ CONSISTENT BUTTON HEIGHT */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#recovery-banner button:first-of-type {
  background: #007bff !important;
  color: white !important;
}

#recovery-banner button:first-of-type:hover {
  background: #0056b3 !important;
  transform: scale(1.05) !important;
}

#recovery-banner button:last-of-type {
  background: #6c757d !important;
  color: white !important;
}

#recovery-banner button:last-of-type:hover {
  background: #545b62 !important;
  transform: scale(1.05) !important;
}

/* Header Z-Index - BELOW Alert Banners */
#main-header {
  z-index: 1000 !important; /* ✅ BELOW alert banners */
}

/* Modal/Dropdown Z-Index - BELOW Alert Banners */
#user-dropdown {
  z-index: 1001 !important; /* ✅ BELOW alert banners but above header */
}

/* Debug Panel Z-Index - BELOW Alert Banners */
#debug-panel {
  z-index: 900 !important; /* ✅ BELOW everything else */
}

/* Connection Status Indicator Z-Index */
#connection-status {
  z-index: 800 !important; /* ✅ LOWEST priority */
}

/* ================================================= */
/* Responsive Design Adjustments */
/* ================================================= */

@media (max-width: 768px) {
  .hero-section {
    flex-direction: column;
  }
  
  .hero-image,
  .hero-form {
    flex: none;
    max-width: 100%;
    padding: 0;
  }
  
  .hero-image {
    order: 2;
    margin-top: 20px;
  }
  
  .hero-form {
    order: 1;
  }
  
  .qr-container {
    margin: 10px 0;
    padding: 15px;
  }
  
  .qr-code {
    max-width: 200px;
  }
  
  /* Toggle switch responsive adjustments */
  .toggle-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0;
  }
  
  .toggle-text {
    margin-right: 0;
    margin-bottom: 5px;
  }
  
  .toggle-switch {
    align-self: flex-end;
  }
  
  /* Alert Banner Responsive */
  #refresh-alert-banner {
    padding: 12px 8px !important;
  }
  
  #refresh-alert-banner button {
    min-width: 90px !important;
    font-size: 13px !important;
    padding: 8px 12px !important;
  }
  
  #recovery-banner {
    padding: 10px 8px !important;
  }
  
  #recovery-banner button {
    min-width: 80px !important;
    font-size: 13px !important;
    padding: 6px 10px !important;
  }
}