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

 :root {
     --primary: #770063;
     --primary-light: #a6008b;
     --primary-dark: #560048;
     --secondary-color: #64748b;
     --success-color: #10b981;
     --warning-color: #f59e0b;
     --danger-color: #ef4444;
     --surface-color: #ffffff;
     --background-color: #f8fafc;
     --card-background: #ffffff;
     --border-color: #e2e8f0;
     --text-primary: #0f172a;
     --text-secondary: #64748b;
     --text-muted: #94a3b8;
     --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
     --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
     --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
     --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
     --radius-sm: 0.375rem;
     --radius-md: 0.5rem;
     --radius-lg: 0.75rem;
     --radius-xl: 1rem;
     --backdrop-blur: blur(8px);
     --space-xs: 0.5rem;
     --space-sm: 0.75rem;
     --space-md: 1rem;
     --space-lg: 1.5rem;
     --space-xl: 2rem;
     --space-2xl: 3rem;
     --space-3xl: 4rem;
 }

 body {
     margin: 0;
     padding: 0;
     height: 100vh;
     width: 100vw;
     font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
     background: var(--background-color);
     color: var(--text-primary);
 }

 /* Modern Header */
 .nav-header {
     background: #fdfdfd;
     backdrop-filter: blur(20px);
     border-bottom: 1px solid var(--gray-200);
     position: sticky;
     top: 0;
     z-index: 1000;
     box-shadow: var(--shadow-sm);
 }

 .nav-container {
     max-width: 100vw;
     display: flex;
     align-items: center;
     justify-content: space-between;
 }

 .logo-section {
     display: flex;
     align-items: center;
     gap: var(--space-md);
 }

 .logo-img {
     height: 100px;
     width: 500px;
     object-fit: contain;
     margin-left: -30px;
 }

 .logo-text {
     margin-left: 0;
 }

 .brand-text {
     display: flex;
     flex-direction: column;
 }

 .brand-title {
     font-size: 2.5rem;
     font-weight: 700;
     color: var(--primary);
     line-height: 1.2;
     margin: 0;
     margin-left: 25px;
 }

 .brand-subtitle {
     font-size: 0.875rem;
     color: #64748b;
     font-weight: 400;
 }

 .nav-actions {
     display: flex;
     align-items: center;
     gap: var(--space-xs);
     padding: 20px;
 }

 /* Main content area */
 .main-content {
     display: flex;
     height: calc(100vh - 100px);
 }

 /* Left Chat Pane */
 #chatContainer {
     width: 50%;
     display: flex;
     flex-direction: column;
     background: var(--surface-color);
     border-right: 1px solid var(--border-color);
 }

 .chat-header {
     padding: 1.5rem;
     border-bottom: 1px solid var(--border-color);
     background: var(--surface-color);
 }

 .chat-title {
     font-size: 1.25rem;
     font-weight: 600;
     color: var(--text-primary);
     margin-bottom: 0.5rem;
 }

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

 #chatLog {
     flex: 1;
     padding: 1.5rem;
     overflow-y: auto;
     background: #f3f3f3;
     display: flex;
     flex-direction: column;
     gap: 1rem;
 }

 .message {
     display: flex;
     align-items: flex-start;
     gap: 0.75rem;
     animation: slideIn 0.3s ease-out;
 }

 .message.user {
     flex-direction: row-reverse;
 }

 .message-avatar {
     width: 32px;
     height: 32px;
     border-radius: 50%;
     display: flex;
     align-items: center;
     justify-content: center;
     font-size: 0.75rem;
     font-weight: 600;
     flex-shrink: 0;
 }

 .message.user .message-avatar {
     background: var(--primary);
     color: white;
 }

 .message.assistant .message-avatar {
     background: var(--success-color);
     color: white;
 }

 .message-content {
     background: var(--surface-color);
     padding: 1rem;
     border-radius: var(--radius-lg);
     max-width: 85%;
     box-shadow: var(--shadow-sm);
     border: 1px solid var(--border-color);
     line-height: 1.6;
 }

 .message.user .message-content {
     background: var(--primary);
     color: white;
     border-color: var(--primary);
 }

 #chatInputArea {
     padding: 1.5rem;
     background: var(--surface-color);
     border-top: 1px solid var(--border-color);
 }

 .input-group {
     display: flex;
     gap: 0.75rem;
     align-items: flex-end;
 }

 #chatInput {
     flex: 1;
     padding: 0.875rem 1rem;
     border: 1px solid var(--border-color);
     border-radius: var(--radius-lg);
     font-size: 0.875rem;
     background: #f3f3f3;
     transition: all 0.2s ease;
     resize: none;
     min-height: 44px;
     max-height: 120px;
     font-family: inherit;
 }

 #chatInput:focus {
     outline: none;
     border-color: var(--primary);
     box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
     background: var(--surface-color);
 }

 #sendChatBtn {
     background: var(--primary);
     color: white;
     border: none;
     padding: 0.875rem 1.25rem;
     border-radius: var(--radius-lg);
     cursor: pointer;
     font-weight: 500;
     transition: all 0.2s ease;
     display: flex;
     align-items: center;
     gap: 0.5rem;
 }

 #sendChatBtn:hover {
     background: var(--primary-dark);
     transform: translateY(-1px);
 }

 /* Right Question Editor Pane */
 #questionContainer {
     width: 50%;
     padding: 1rem 1.5rem 1rem 1.5rem;
     display: flex;
     flex-direction: column;
     background: #fbfcff;
     min-height: 0;
     overflow-y: auto;
 }

 .question-header {
     display: flex;
     gap: 1rem;
     margin-bottom: 1rem;
     border-bottom: 1px solid var(--border-color);
     align-items: flex-start;
 }

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

 .nav-btn {
     display: flex;
     align-items: center;
     gap: 0.5rem;
     padding: 0.5rem 1rem;
     border: 1px solid var(--border-color);
     background: var(--surface-color);
     border-radius: var(--radius-md);
     font-size: 0.875rem;
     font-weight: 500;
     color: var(--text-secondary);
     cursor: pointer;
     transition: all 0.2s ease;
     text-decoration: none;
 }

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

 .nav-btn:disabled {
     opacity: 0.5;
     cursor: not-allowed;
 }

 .question-title {
     font-size: 2rem;
     font-weight: 630;
     color: var(--text-primary);
 }

 /* Status badges */
 .status-section {
     display: flex;
     margin-bottom: 0.5rem;
     justify-content: space-between;
 }

 .status-section h3 {
     font-size: 1.5rem;
     font-weight: 600;
     color: var(--text-primary);
     margin-top: 0.5rem;
     margin-bottom: 1rem;
     margin-right: 1rem;
 }

 .status-badges {
     margin-top: 12px;
     display: flex;
     gap: 0.3rem;
     flex: 1;
 }

 .status-badge {
     display: flex;
     align-items: center;
     gap: 0.5rem;
     max-height: 55px;
     padding: 0.75rem 1rem;
     border-radius: var(--radius-lg);
     font-size: 0.875rem;
     font-weight: 600;
     box-shadow: var(--shadow-sm);
     transition: all 0.2s ease;
     cursor: pointer;
     border: 1px solid transparent;
     flex: 1 1 0;
 }

 .status-badge.verified {
     background: var(--success-color);
     color: white;
 }

 .status-badge.not-verified {
     background: var(--danger-color);
     color: white;
 }

 .status-badge.difficulty {
     background: var(--primary);
     color: white;
 }

 .status-badge:hover {
     transform: translateY(-1px);
     box-shadow: var(--shadow-md);
 }

 /* Question fields */
 .form-section {
     flex: 1 1 auto;
     min-height: 0;
     overflow-y: auto;
 }

 .form-group {
     margin-bottom: 1rem;
 }

 .form-label {
     display: block;
     font-size: 0.875rem;
     font-weight: 600;
     color: var(--text-primary);
     margin-bottom: 0.5rem;
 }

 .form-textarea {
     width: 100%;
     min-height: 120px;
     padding: 1rem;
     border: 1px solid var(--border-color);
     border-radius: var(--radius-lg);
     font-size: 1.05rem;
     font-family: inherit;
     background: var(--background-color);
     transition: all 0.2s ease;
     resize: vertical;
     line-height: 1.6;
 }

 .form-textarea:focus {
     outline: none;
     border-color: var(--primary);
     box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
     background: var(--surface-color);
 }

 /* Action buttons */
 .action-section {
     flex-shrink: 0;
     margin-top: 2rem;
     padding-top: 2rem;
     border-top: 1px solid var(--border-color);
 }

 .button-group {
     display: flex;
     gap: 1rem;
     flex-wrap: wrap;
 }

 .btn {
     display: flex;
     align-items: center;
     gap: 0.5rem;
     padding: 0.875rem 1.5rem;
     border: none;
     border-radius: var(--radius-lg);
     font-size: 0.875rem;
     font-weight: 600;
     cursor: pointer;
     transition: all 0.2s ease;
     text-decoration: none;
     box-shadow: var(--shadow-sm);
 }

 .btn:hover {
     transform: translateY(-1px);
     box-shadow: var(--shadow-md);
 }

 .btn:disabled {
     opacity: 0.6;
     cursor: not-allowed;
     transform: none;
 }

 .btn.primary {
     background: var(--primary);
     color: white;
 }

 .btn.primary:hover {
     background: var(--primary-dark);
 }

 .btn.secondary {
     background: var(--surface-color);
     color: var(--text-secondary);
     border: 1px solid var(--border-color);
 }

 .btn.secondary:hover {
     background: var(--background-color);
     color: var(--primary);
 }

 .btn.success {
     background: var(--success-color);
     color: white;
 }

 .btn.success:hover {
     background: #059669;
 }

 /* Suggestions panel */
 .suggestions-panel {
     display: flex;
     flex-direction: column;
     background: #f3f3f3;
     border-bottom: 1px solid var(--border-color);
     padding: 1rem;
     overflow-y: auto;
 }

 .suggestions-panel.hidden {
     display: none;
 }

 .suggestions-header {
     display: flex;
     align-items: center;
     justify-content: space-between;
     margin-bottom: 1rem;
 }

 .suggestions-title {
     font-size: 1rem;
     font-weight: 600;
     color: var(--text-primary);
 }

 .suggestions-clear {
     background: var(--danger-color);
     color: white;
     border: none;
     padding: 0.5rem 0.75rem;
     border-radius: var(--radius-md);
     font-size: 0.75rem;
     font-weight: 500;
     cursor: pointer;
     transition: all 0.2s ease;
 }

 .suggestions-clear:hover {
     background: #dc2626;
 }

 .suggestions-list {
     display: flex;
     flex-direction: column;
     gap: 1rem;
 }

 .suggestion-card {
     background: var(--surface-color);
     border: 1px solid var(--border-color);
     border-radius: var(--radius-lg);
     padding: 1rem;
     box-shadow: var(--shadow-sm);
     transition: all 0.2s ease;
 }

 .suggestion-card:hover {
     box-shadow: var(--shadow-md);
 }

 .suggestion-card h4 {
     font-size: 0.875rem;
     font-weight: 600;
     color: var(--text-primary);
     margin-bottom: 0.5rem;
 }

 .suggestion-actions {
     display: flex;
     gap: 0.5rem;
     margin-top: 1rem;
     justify-content: flex-end;
 }

 /* .suggestion-btn {
     padding: 0.5rem 0.75rem;
     border: none;
     border-radius: var(--radius-md);
     font-size: 0.75rem;
     font-weight: 500;
     cursor: pointer;
     transition: all 0.2s ease;
 }

 .suggestion-add-btn {
     background: var(--success-color);
     color: white;
 }

 .suggestion-add-btn:hover {
     background: #059669;
 }

 .suggestion-rewrite-btn {
     background: var(--warning-color);
     color: white;
 }

 .suggestion-rewrite-btn:hover {
     background: #d97706;
 } */

 /* Shared button base */
 .suggestion-add-btn,
 .suggestion-rewrite-btn {
     appearance: none;
     border: none;
     border-radius: 8px;
     padding: 8px 12px;
     /* a bit larger so text isn’t cramped */
     font-weight: 600;
     cursor: pointer;
     color: #fff;
     box-shadow: 0 2px 3px rgba(0, 0, 0, .15);
     transition: transform .04s ease, filter .15s ease;
 }

 .suggestion-add-btn:active,
 .suggestion-rewrite-btn:active {
     transform: translateY(1px);
 }

 /* Distinct colors */
 .suggestion-add-btn {
     background: var(--success-color);
     /* green */
 }

 .suggestion-add-btn:hover {
     filter: brightness(0.95);
 }

 .suggestion-rewrite-btn {
     background: #0099e6;
     /* orange/amber */
 }

 .suggestion-rewrite-btn:hover {
     filter: brightness(0.95);
 }

 /* Auto-save notification */
 .auto-save-notification {
     position: fixed;
     bottom: 2rem;
     right: 2rem;
     background: var(--success-color);
     color: white;
     padding: 1rem 1.5rem;
     border-radius: var(--radius-lg);
     box-shadow: var(--shadow-lg);
     opacity: 0;
     transform: translateY(1rem);
     transition: all 0.3s ease;
     z-index: 1000;
     display: flex;
     align-items: center;
     gap: 0.5rem;
     font-size: 0.875rem;
     font-weight: 500;
 }

 .auto-save-notification.show {
     opacity: 1;
     transform: translateY(0);
 }

 /* Download menu */
 .download-container {
     position: relative;
     display: inline-block;
 }

 .download-menu {
     position: fixed;
     background: var(--surface-color);
     border: 1px solid var(--border-color);
     border-radius: var(--radius-md);
     box-shadow: var(--shadow-lg);
     padding: 0.5rem 0;
     min-width: 150px;
     max-height: 50vh;
     overflow: auto;
     z-index: 3000;
     list-style: none;
 }

 .download-menu.hidden {
     display: none;
 }

 .download-menu li {
     padding: 0.75rem 1rem;
     cursor: pointer;
     font-size: 0.875rem;
     color: var(--text-secondary);
     transition: all 0.2s ease;
 }

 .download-menu li:hover {
     background: var(--background-color);
     color: var(--text-primary);
 }

 /* Download menu: group labels + divider (single dropdown, no nested menus) */
.download-menu .download-menu-label {
  padding: 0.5rem 1rem 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: default;
}

.download-menu .download-menu-label:hover {
  background: transparent;
  color: var(--text-muted);
}

.download-menu .download-menu-divider {
  height: 1px;              /* force thin line */
  margin: 4px 12px;         /* small vertical spacing */
  background: var(--border-color);
  padding: 0;               /* override li padding */
  list-style: none;         /* remove bullet space */
}

.download-menu .download-menu-item {
  padding-left: 1.25rem; /* subtle indent under the label */
}

 /* Modals */
 .modal-overlay {
     position: fixed;
     top: 0;
     left: 0;
     right: 0;
     bottom: 0;
     background: rgba(0, 0, 0, 0.5);
     backdrop-filter: var(--backdrop-blur);
     display: flex;
     align-items: center;
     justify-content: center;
     z-index: 2000;
     opacity: 0;
     visibility: hidden;
     transition: all 0.3s ease;
 }

 .modal-overlay.show {
     opacity: 1;
     visibility: visible;
 }

 .modal-content {
     background: var(--surface-color);
     border-radius: var(--radius-xl);
     padding: 2rem;
     max-width: 500px;
     width: 90%;
     max-height: 80vh;
     overflow-y: auto;
     box-shadow: var(--shadow-xl);
     transform: translateY(1rem);
     transition: all 0.3s ease;
 }

 .modal-overlay.show .modal-content {
     transform: translateY(0);
 }

 .modal-header {
     display: flex;
     align-items: center;
     justify-content: space-between;
     margin-bottom: 1.5rem;
 }

 .modal-title {
     font-size: 1.25rem;
     font-weight: 600;
     color: var(--text-primary);
 }

 .modal-close {
     background: none;
     border: none;
     font-size: 1.5rem;
     color: var(--text-muted);
     cursor: pointer;
     padding: 0.25rem;
     border-radius: var(--radius-sm);
     transition: all 0.2s ease;
 }

 .modal-close:hover {
     background: var(--background-color);
     color: var(--text-primary);
 }

 /* Animations */
 @keyframes slideIn {
     from {
         opacity: 0;
         transform: translateY(0.5rem);
     }

     to {
         opacity: 1;
         transform: translateY(0);
     }
 }

 @keyframes pulse {

     0%,
     100% {
         opacity: 1;
     }

     50% {
         opacity: 0.5;
     }
 }

 .loading {
     animation: pulse 2s infinite;
 }

 /* Responsive design */
 @media (max-width: 1024px) {
     .main-content {
         flex-direction: column;
     }

     #chatContainer {
         width: 100%;
         height: 50%;
     }

     #questionContainer {
         width: 100%;
         height: 50%;
     }

     .question-nav {
         flex-wrap: wrap;
     }

     .button-group {
         flex-direction: column;
     }
 }

 @media (max-width: 768px) {
     .app-header {
         padding: 0 1rem;
     }

     .header-actions {
         gap: 0.5rem;
     }

     #questionContainer {
         padding: 1rem;
     }

     .status-badges {
         flex-direction: column;
         align-items: flex-start;
     }
 }

 /* Utility classes */
 .hidden {
     display: none !important;
 }

 .sr-only {
     position: absolute;
     width: 1px;
     height: 1px;
     padding: 0;
     margin: -1px;
     overflow: hidden;
     clip: rect(0, 0, 0, 0);
     white-space: nowrap;
     border: 0;
 }

 h1 {
     margin-top: 12px;
     margin-left: 12px;
     margin-bottom: 12px;
 }

 #pageTitle {
     cursor: pointer;
 }

 /* Right Question Editor Pane */


 h2 {
     text-align: center;
     margin-bottom: 20px;
     font-weight: 600;
     font-size: 1.7rem;
 }

 .question-field {
     margin-bottom: 15px;
 }

 .question-field label {
     font-weight: bold;
     display: block;
     margin-bottom: 5px;
 }

 .question-field textarea {
     font-family: Inria Serif;
     width: 100%;
     height: 100px;
     font-size: 14px;
 }

 /* Specific variants */
 .info-button {
     width: 38px;
     height: 38px;
     margin-left: 20px;
     margin-top: 30px;
     border-radius: 50%;
     border: none;
     background: var(--primary);
     color: white;
     cursor: pointer;
     position: absolute;
     align-items: center;
     justify-content: center;
     font-size: 1.125rem;
     transition: all 0.2s ease;
     box-shadow: var(--shadow-sm);
 }

 .info-button:hover {
     background: var(--primary-dark);
     transform: translateY(-1px);
     box-shadow: var(--shadow-md);
 }

 .nav-button {
     display: flex;
     align-items: center;
     gap: var(--space-xs);
     padding: var(--space-xs) var(--space-md);
     background: var(--primary);
     color: white;
     border: none;
     border-radius: var(--radius-md);
     font-weight: 500;
     cursor: pointer;
     transition: all 0.2s ease;
     font-size: 0.875rem;
 }

 .nav-button:hover {
     background: var(--primary-dark);
     transform: translateY(-1px);
     box-shadow: var(--shadow-md);
 }

 /* Auto-save notification */
 #autoSaveNotification {
     position: fixed;
     bottom: 20px;
     right: 20px;
     background-color: #4CAF50;
     color: white;
     padding: 10px 20px;
     border-radius: 5px;
     opacity: 0;
     transition: opacity 0.5s ease;
     z-index: 1001;
 }

 /* Buttons container - AI verify, Manual Verify */
 .btn-container {
     display: flex;
     justify-content: center;
     gap: 20px;
     margin-top: 30px;
     margin-bottom: 30px;
 }

 /* Info Modal Styles */
 /* Enhanced Info Modal (match upload page) */
 .info-modal {
     display: none;
     position: fixed;
     inset: 0;
     background: rgba(0, 0, 0, .6);
     backdrop-filter: blur(4px);
     z-index: 2000;
     overflow-y: auto;
     padding: var(--space-xl);
 }

 .info-modal-content {
     background: #fff;
     max-width: 800px;
     margin: var(--space-xl) auto;
     border-radius: var(--radius-xl);
     box-shadow: var(--shadow-xl);
     overflow: hidden;
     animation: modalSlideUp .3s ease;
 }

 @keyframes modalSlideUp {
     from {
         opacity: 0;
         transform: translateY(2rem)
     }

     to {
         opacity: 1;
         transform: translateY(0)
     }
 }

 .modal-header {
     display: flex;
     align-items: center;
     justify-content: space-between;
     padding: var(--space-lg);
     background: var(--primary);
     color: #fff;
 }

 .modal-header h2 {
     font-size: 1.5rem;
     font-weight: 600;
     display: flex;
     gap: var(--space-sm);
     margin: 0
 }

 .close-modal {
     width: 32px;
     height: 32px;
     border: none;
     background: rgba(255, 255, 255, .2);
     color: #fff;
     border-radius: 50%;
     cursor: pointer;
     display: flex;
     align-items: center;
     justify-content: center;
     transition: all .2s ease;
 }

 .close-modal:hover {
     background: rgba(255, 255, 255, .3)
 }

 .modal-body {
     padding: var(--space-xl);

 }

 .info-section {
     margin-bottom: var(--space-lg)
 }

 .info-section:last-child {
     margin-bottom: 0
 }

 .info-section h3 {
     font-size: 1.25rem;
     font-weight: 600;
     color: var(--text-primary);
     margin-bottom: var(--space-md);
     display: flex;
     gap: var(--space-sm);
     align-items: center
 }

 .intro-text {
     font-size: 1.05rem;
     color: var(--text-secondary);
     line-height: 1.7
 }

 .step-title {
     display: inline-flex;
     align-items: center;
     gap: .5rem;
 }

 .steps-grid {
     display: grid;
     grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
     gap: var(--space-lg);
     margin-top: var(--space-lg);
 }

 .step-item {
     display: flex;
     align-items: flex-start;
     gap: var(--space-md);
     padding: var(--space-lg);
     background: var(--background-color);
     border-radius: var(--radius-lg);
     border: 1px solid var(--border-color);
 }

 .step-number {
     width: 32px;
     height: 32px;
     background: var(--primary);
     color: #fff;
     border-radius: 50%;
     display: flex;
     align-items: center;
     justify-content: center;
     font-weight: 700;
     font-size: .875rem;
     flex-shrink: 0;
 }

 .step-content strong {
     display: block;
     font-weight: 600;
     color: var(--text-primary);
     margin-bottom: var(--space-xs)
 }

 .step-content p {
     color: var(--text-secondary);
     font-size: .9rem
 }


 /* Style for comments tooltip */
 .tooltip {
     position: relative;
     display: inline-block;
 }

 .tooltip .tooltiptext {
     visibility: hidden;
     width: 27vw;
     max-height: 500px;
     max-width: 250px;
     overflow-y: auto;
     background-color: #fff;
     color: #333;
     text-align: left;
     border-radius: 6px;
     padding: 15px;
     position: absolute;
     z-index: 3000;
     top: 75%;
     right: 0%;
     opacity: 0;
     transition: opacity 0.3s;
     font-weight: normal;
     font-size: 14px;
     line-height: 1.4;
     white-space: normal;
     word-wrap: break-word;
     box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
     border: 1px solid #ddd;
 }

 .tooltip:hover .tooltiptext {
     visibility: visible;
     opacity: 1;
 }

 .tooltip .tooltiptext table {
     width: 100%;
     border-collapse: collapse;
     margin-bottom: 10px;
     font-size: 13px;
 }

 .tooltip .tooltiptext th {
     background-color: #f5f5f5;
     text-align: left;
     padding: 5px;
 }

 .tooltip .tooltiptext td {
     border-bottom: 1px solid #eee;
     padding: 3px 5px;
 }

 /*Popup when 'Back' button is clicked*/
 #btnDownload {
     display: inline-flex;
     align-items: center;
     gap: 0.5rem;
     white-space: nowrap;
 }

 .popup-buttons {
     display: flex;
     justify-content: center;
     align-items: center;
     gap: 1rem;
     flex-wrap: nowrap;
 }

 .popup-buttons .download-container {
     position: relative;
     display: inline-flex;
     flex-direction: column;
     align-items: center;
 }

 .popup-overlay {
     position: fixed;
     top: 0;
     left: 0;
     width: 100vw;
     height: 100vh;
     background-color: rgba(0, 0, 0, 0.4);
     display: flex;
     justify-content: center;
     align-items: center;
     z-index: 2000;
 }

 .popup-overlay.hidden {
     display: none;
 }

 .popup-content {
     background: white;
     padding: 25px 30px;
     border-radius: 12px;
     min-height: 250px;
     max-width: 600px;
     box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
     text-align: center;
 }

 .popup-content h2 {
     margin-top: 20px;
     margin-bottom: 12px;
     font-size: 1.5rem;
 }

 .popup-content p {
     margin-bottom: 24px;
     font-size: 1.1rem;
 }

 .popup-buttons button {
     background-color: #4a90e2;
     color: white;
     border: none;
     padding: 10px 20px;
     margin: 0 8px;
     border-radius: 8px;
     font-weight: 600;
     cursor: pointer;
     min-width: 90px;
     transition: background-color 0.3s ease;
 }

 #btnCancel {
     background-color: #e24a4f;
 }

 .popup-buttons button:hover {
     background-color: #357abd;
 }

 /* Utility */
 .hidden {
     display: none !important;
 }

 /* Positioning wrapper for the FAB and its caption */
 .chat-fab-wrap {
     position: fixed;
     right: 20px;
     bottom: 20px;
     display: flex;
     flex-direction: column;
     /* caption below the circle */
     align-items: center;
     gap: 8px;
     z-index: 2200;
 }

 /* Pure circular FAB */
 .chat-fab {
     position: static;
     width: 56px;
     height: 56px;
     border-radius: 50%;
     border: none;
     cursor: pointer;
     background: var(--primary);
     color: #fff;
     box-shadow: var(--shadow-xl);
     display: grid;
     place-items: center;
     font-size: 20px;
     padding: 0;
 }

 .chat-fab:hover {
     background: var(--primary-dark);
 }

 /* The caption pill */
 .chat-fab-caption {
     background: var(--primary);
     color: #fff;
     font-weight: 600;
     font-size: 0.85rem;
     padding: 6px 10px;
     border-radius: 10px;
     box-shadow: var(--shadow-xl);
     white-space: nowrap;
     user-select: none;
     cursor: pointer;
 }

 /* Hide caption on small screens (optional) */
 @media (max-width: 640px) {
     .chat-fab-caption {
         display: none;
     }
 }

 .mini-chat {
     position: fixed;
     right: 20px;
     bottom: 88px;
     width: 360px;
     background: #fff;
     border: 1px solid var(--border-color);
     border-radius: var(--radius-lg);
     box-shadow: var(--shadow-xl);
     z-index: 2200;
     display: flex;
     flex-direction: column;
     max-height: 60vh;
 }

 .mini-chat.hidden {
     display: none;
 }

 .mini-chat-header {
     display: flex;
     justify-content: space-between;
     align-items: center;
     padding: 10px 12px;
     border-bottom: 1px solid var(--border-color);
     font-weight: 600;
     gap: .5rem;
     /* background: var(--primary);
     color: #fff;
     border-radius: var(--radius-lg); */
 }

 .mini-chat-tools {
     display: flex;
     align-items: center;
     gap: .5rem;
 }

 .mode-label {
     font-size: .85rem;
     display: flex;
     align-items: center;
     gap: .25rem;
 }

 .mini-hint {
     flex: 1;
     min-width: 220px;
 }

 .mini-chat-log {
     padding: 10px;
     overflow: auto;
     flex: 1;
     background: #f7f7f8;
 }

 .mini-chat-input {
     display: flex;
     flex-direction: column;
     gap: 8px;
     padding: 10px;
     border-top: 1px solid var(--border-color);
 }

 .mini-chat-input input {
     flex: 1;
     padding: 8px 10px;
     border: 1px solid var(--border-color);
     border-radius: 8px;
 }

 .mini-chat-input button {
     border: none;
     background: var(--primary);
     color: #fff;
     border-radius: 8px;
     padding: 8px 12px;
     cursor: pointer;
 }

 /* Right suggested-fix panel */
 .suggested-fix {
     padding: 1rem 3rem 1rem 3rem;
     width: 50%;
     display: flex;
     flex-direction: column;
     background: var(--surface-color);
     border-left: 1px solid var(--border-color);
 }

 .suggested-fix-header {
     margin-bottom: 1rem;
     padding: 0rem 1.5rem .5rem 1.5rem;
     border-bottom: 1px solid var(--border-color);
 }

 .suggested-fix-header h3 {
     font-size: 2rem;
 }

 .suggested-fix .muted {
     color: var(--text-muted);
     font-size: .9rem;
 }

 /* When a suggestion is rejected (dim visuals only) */
 .suggested-fix.dimmed {
     opacity: .5;
     filter: grayscale(.15);
 }

 .notification {
     font-family: var(--font-sans, 'Inter', sans-serif);
     font-size: 13px;
     line-height: 1.2;
     border-radius: var(--radius-lg, 8px);
 }

 .notification-content {
     display: flex;
     align-items: center;
     gap: 12px;
 }

 .notification-close {
     background: none;
     border: none;
     color: white;
     cursor: pointer;
     opacity: 0.8;
     transition: opacity 0.2s ease;
     padding: 4px;
     margin-left: auto;
 }

 .notification-close:hover {
     opacity: 1;
 }

 /* Dim only the three textareas (NOT the whole pane) */
 .dimmed-field {
     opacity: .55;
     filter: grayscale(.15);
     transition: opacity .2s ease;
 }

 /* Chat message cards */
 .chat-row {
     display: flex;
     margin: 8px 0
 }

 .chat-row.right {
     justify-content: flex-end
 }

 .chat-message {
     display: inline-block;
     padding: 10px 14px;
     border-radius: var(--radius-lg);
     box-shadow: var(--shadow-sm);
     max-width: 95%;
     word-wrap: break-word;
     font-size: 0.9rem;
     line-height: 1.5;
     word-break: break-word;
 }

 .chat-message.user {
     background: var(--primary);
     color: white;
     margin-left: auto;
     border-top-right-radius: 4px;
 }

 .chat-message.assistant {
     background: #fff;
     color: var(--text-primary);
     border: 1px solid var(--border-color);
     border-top-left-radius: 4px;
 }

 /* Wrap the select to draw a custom chevron */
 .select-wrap {
     position: relative;
     display: inline-flex;
     align-items: center;
 }

 /* Nicer select */
 #miniChatMode {
     -webkit-appearance: none;
     -moz-appearance: none;
     appearance: none;
     border: 1px solid var(--border-color);
     background: #f3f4f6;
     border-radius: 9999px;
     padding: .4rem 2rem .4rem .8rem;
     font-size: .9rem;
     font-weight: 600;
     color: var(--text-primary);
     cursor: pointer;
     line-height: 1;
 }

 #miniChatMode:focus {
     outline: none;
     border-color: var(--primary-light);
     box-shadow: 0 0 0 3px rgba(119, 0, 99, .08);
 }

 /* Chevron using Font Awesome (already loaded in your HTML) */
 .select-wrap::after {
     content: "\f078";
     /* fa-chevron-down */
     font-family: "Font Awesome 6 Free";
     font-weight: 900;
     position: absolute;
     right: .7rem;
     top: 50%;
     transform: translateY(-50%);
     pointer-events: none;
     color: var(--text-muted);
     font-size: .8rem;
 }

 /* Mini chat close button */
 #miniChatClose {
     background: #f3f4f6;
     border: none;
     font-size: 1.25rem;
     color: #000000;
     cursor: pointer;
     border-radius: 10px;
     width: 32px;
     height: 32px;
     display: flex;
     align-items: center;
     justify-content: center;
     transition: background 0.2s ease, color 0.2s ease;
 }

 #miniChatClose:hover {
     background: var(--background-color);
     color: var(--text-primary);
 }

 .form-textarea.one-line {
     min-height: 42px;
     /* same vertical rhythm as others */
     resize: none;
     /* single-line look & feel */
     line-height: 1.2;
 }

 /* Results filter select (header) */
 #resultFilter {
     -webkit-appearance: none;
     -moz-appearance: none;
     appearance: none;
     border: 1px solid var(--border-color);
     background: #f3f4f6;
     border-radius: 9999px;
     padding: .4rem 2rem .4rem .8rem;
     font-size: .9rem;
     font-weight: 600;
     color: var(--text-primary);
     cursor: pointer;
     line-height: 1;
 }

 #resultFilter:focus {
     outline: none;
     border-color: var(--primary-light);
     box-shadow: 0 0 0 3px rgba(119, 0, 99, .08);
 }

 /* chevron for the dropdown */
 .select-wrap {
     position: relative;
     display: inline-block;
     margin-right: .5rem;
 }

 .select-wrap::after {
     content: "\f078";
     /* fa-chevron-down */
     font-family: "Font Awesome 6 Free";
     font-weight: 900;
     position: absolute;
     right: .7rem;
     top: 50%;
     transform: translateY(-50%);
     pointer-events: none;
     color: var(--text-muted);
     font-size: .8rem;
 }

 /* Flow steps layout */
 .steps-flow {
     display: flex;
     flex-wrap: nowrap;
     align-items: stretch;
     gap: var(--space-md);
     overflow-x: auto;
     padding-bottom: 0.5rem;
 }

 .steps-flow .step-item {
     flex: 1 1 220px;
     display: flex;
     align-items: flex-start;
     gap: var(--space-md);
     padding: var(--space-md);
     background: var(--background-color);
     border-radius: var(--radius-lg);
     border: 1px solid var(--border-color);
 }

 .flow-arrow {
     display: flex;
     align-items: center;
     font-size: 1.25rem;
     color: var(--text-muted);
 }

 /* ——— Flow card = number on top, text centered below ——— */
 .steps-flow .step-item {
     /* switch from row to column layout */
     flex-direction: column;
     align-items: center;
     text-align: center;

     /* tighten spacing and ensure consistent width */
     gap: .5rem;
     min-width: 140px;
     /* tweak if you want narrower cards */
     padding: var(--space-lg);
 }

 .steps-flow .step-number {
     margin: 0 0 .5rem 0;
     /* number at top with small gap */
 }

 .steps-flow .step-content {
     width: 100%;
 }

 .steps-flow .step-content strong {
     margin: 0 0 .25rem 0;
     /* title just above the paragraph */
 }

 .steps-flow .step-content p {
     margin: 0;
     /* remove any left/extra spacing */
 }

 /* keep the arrow vertically centered beside the taller, stacked cards */
 .steps-flow .flow-arrow {
     display: flex;
     align-items: center;
     margin: 0 .25rem;
 }

 /* Replace number circle with icon */
 .step-icon {
     width: 36px;
     height: 36px;
     border-radius: 50%;
     background: var(--primary);
     color: #fff;
     display: flex;
     align-items: center;
     justify-content: center;
     font-size: 1rem;
     flex-shrink: 0;
 }

 /* Remove old number style */
 .step-number {
     display: none;
 }

 #houseStyleIndicator .status-text {
     display: block;
     text-align: left;
     line-height: 1.2;
 }

 #houseStyleIndicator {
     background: #0c6490;
     color: white;
     padding-top: 0.6rem !important;
     padding-bottom: 0.6rem !important;
     min-width: 120px;
 }

 /* Fixed color for Criteria badge (always blue) */
 .status-badge.criteria {
     background-color: #52529c;
     /* dark blue */
     color: #ffffff;
     border: none;
 }

 .status-badge.criteria i {
     color: #ffffff;
 }

 /* --- AI Model selector (Results header) --- */
 .model-select {
     display: inline-flex;
     align-items: center;
     gap: 8px;
     padding: 6px 10px;
     border: 1px solid var(--border-color);
     background: #fff;
     border-radius: 999px;
     box-shadow: var(--shadow-sm);
 }

 .model-select i {
     color: var(--primary);
     font-size: 0.95rem;
 }

 .model-dropdown {
     border: none;
     outline: none;
     background: transparent;
     font-weight: 600;
     color: var(--text-primary);
     cursor: pointer;
     padding-right: 2px;
 }

 .mini-chat-files {
     display: flex;
     flex-wrap: wrap;
     gap: 6px;
     margin: 0;
     width: 100%;
 }

/* --- MiniChat attached file chip (Results) --- */
.mini-file-chip{
  position: relative;                 /* anchor the X */
  overflow: visible;                  /* allow X to sit outside pill border */
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 30px 8px 12px;         /* reserve space on right for X */
  border-radius: 14px;                /* not a full capsule; looks closer to your example */
  border: 1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.85);
  font-size: 12px;
  max-width: 100%;
}

.mini-file-chip span{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

/* the remove X (top-right, slightly outside the border like your 3rd pic) */
.mini-file-chip .x {
  position: absolute;
  top: -7px;
  right: -7px;

  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;

  background: #ef4444;
  color: #fff;

  font-size: 14px;
  font-weight: 700;

  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;          /* NOT px-based */

  padding: 0;
  z-index: 10;
  cursor: pointer;

  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.mini-file-chip .x:hover{
  filter: brightness(0.95);
}

 .mini-chat-input-row {
     display: flex;
     gap: 8px;
     align-items: center;
     width: 100%;
 }

 .mini-chat-input-row #miniChatText{
  flex: 1 1 auto;
  min-width: 0;                /* IMPORTANT: allows flex item to shrink without overflow */
}

/* keep send button fixed size so textbox uses the rest */
.mini-chat-input-row #miniChatSend{
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

 .mini-chat-file-btn {
     width: 34px;
     height: 34px;
     display: grid;
     place-items: center;
     border-radius: 10px;
     cursor: pointer;
     border: 1px solid rgba(0, 0, 0, .15);
     background: #fff
 }

 .mini-chat-file-btn:hover {
     filter: brightness(.98)
 }

 .mini-chat-drag-overlay {
     position: absolute;
     inset: 0;
     background: rgba(0, 0, 0, .35);
     backdrop-filter: blur(2px);
     display: flex;
     align-items: center;
     justify-content: center;
     color: #fff;
     font-weight: 600;
     border-radius: 16px
 }

 .mini-chat-drag-overlay.hidden {
     display: none
 }

 /* Only show file UI when .mini-chat supports it (Results: only in new mode; Upload: always) */
 .mini-chat[data-filemode="off"] .mini-chat-file-btn,
 .mini-chat[data-filemode="off"] #miniChatFileContainer {
     display: none
 }

 /* ---- File chips shown inside the chat log (sent attachments) ---- */
.mini-msg-files{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.mini-msg-file-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;

  padding:8px 12px;
  border-radius:999px;
  background:#770063;
  font-size:14px;
  max-width: 100%;
}

.mini-msg-file-chip span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 240px;
}

/* --- MiniChat header tools (expand/close buttons) --- */
.mini-chat-tools{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mini-chat-iconbtn{
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #000000;
  background: #f3f4f6;
  transition: background .15s ease, transform .15s ease;
}

.mini-chat-iconbtn:hover{
  background: #f3f4f6;
  transform: translateY(-1px);
}

.mini-chat-iconbtn:active{
  transform: translateY(0);
}

/* Expanded overlay (no page resize) */
.mini-chat.expanded{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;

  width: 30vw;
  height: 100vh;
  max-height: none;

  border-radius: 0;
  z-index: 5000;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

@media (max-width: 900px){
  .mini-chat.expanded{ width: 100vw; }
}

/* ---------------------------
   MiniChat "More questions" carousel (compact)
---------------------------- */
.mq-mini-actions{
  display:flex;
  gap:8px;
  margin-top:10px;
  flex-wrap:wrap;
}

.mq-mini-btn{
  border:none;
  background:#f3f4f6;
  color:var(--text-primary);
  border-radius:12px;
  padding:10px 16px;
  min-height: 30px;
  font-weight:700;
  cursor:pointer;
  font-size:.85rem;
  border:1px solid var(--border-color);
}

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

.mq-mini-btn:disabled{
  opacity:.6;
  cursor:not-allowed;
}

.mq-mini-carousel{
  margin-top:10px;
  border-radius:12px;
  background:#fff;
}

.mq-mini-carousel-track{
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding-bottom:6px;
  scroll-snap-type:x mandatory;
}

.mq-mini-card{
  flex:0 0 220px;              /* compact width */
  max-width:220px;
  border:1px solid var(--border-color);
  border-radius:12px;
  padding:10px;
  background:#fafafa;
  scroll-snap-align:start;
  box-shadow:var(--shadow-sm);
}

.mq-mini-card .mq-mini-kicker{
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:center;
  font-size:.78rem;
  color:var(--text-muted);
  margin-bottom:6px;
}

.mq-mini-tag{
  font-size:.72rem;
  font-weight:800;
  padding:2px 8px;
  border-radius:9999px;
  border:1px solid var(--border-color);
  background:#fff;
  color:var(--text-primary);
}

.mq-mini-card .mq-mini-title{
  font-weight:800;
  font-size:.9rem;
  margin-bottom:6px;
}

.mq-mini-card .mq-mini-snippet{
  font-size:.82rem;
  color:var(--text-secondary);
  line-height:1.25;
  max-height:4.9em;            /* ~4 lines */
  overflow:hidden;
}

.mq-mini-card .mq-mini-card-actions{
  margin-top:8px;
  display:flex;
  gap:8px;
}

.mq-mini-card .mq-mini-use{
  flex:1;
  border:none;
  background:var(--primary);
  color:#fff;
  border-radius:10px;
  padding:6px 8px;
  font-weight:800;
  cursor:pointer;
  font-size:.82rem;
}

.mq-mini-card .mq-mini-view{
  border:none;
  background:#e5e7eb;
  color:#111827;
  border-radius:10px;
  padding:6px 8px;
  font-weight:800;
  cursor:pointer;
  font-size:.82rem;
}

/* ===============================
   Mini Chat – Primary CTA Buttons
   =============================== */

.mini-chat-cta {
  appearance: none;
  border: none;
  background: var(--primary);          /* same purple */
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;

  padding: 10px 16px;
  min-height: 30px;

  border-radius: 12px;                 /* rectangular with rounded corners */
  cursor: pointer;

  box-shadow: var(--shadow-sm);
  transition: transform 0.06s ease,
              box-shadow 0.15s ease,
              filter 0.15s ease;
}

.mini-chat-cta:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow-md);
}

.mini-chat-cta:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

.mini-chat-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.left-content-source {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}

.left-content-source span {
  font-weight: 600;
  color: var(--text-color, #111827);
}

.toast.toast-loading{
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(20,20,20,0.92);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
}

.toast-spinner{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: rgba(255,255,255,1);
  animation: toastSpin .9s linear infinite;
}

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