body { font-family: 'Inter', sans-serif; }
.menu-item { padding: 8px 12px; cursor: pointer; transition: background-color 0.2s; }
.menu-item:hover { background-color: #e5e7eb; }
.dropdown-content { display: none; position: absolute; background-color: white; min-width: 180px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1000; border-radius: 0.375rem;}
.dropdown:hover .dropdown-content { display: block; }
.submenu-item { padding-left: 20px; }
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fefefe; margin: 5% auto; padding: 24px; border: 1px solid #888; width: 90%; max-width: 1000px; border-radius: 0.5rem; max-height: 90vh; display: flex; flex-direction: column; }
.modal-body { overflow-y: auto; }
/* FIX: Added cursor: pointer to all close buttons */
.close-button, #help-panel-close { cursor: pointer; }
#status-bar { padding: 8px; background-color: #f3f4f6; text-align: center; font-size: 0.9em; color: #4b5563; }
#drop-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; display: none; justify-content: center; align-items: center; }
select[multiple] { height: 150px; }
.report-table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; font-size: 0.875rem; }
.report-table th, .report-table td { border: 1px solid #ddd; padding: 6px; text-align: left; }
.report-table th { background-color: #f2f2f2; }
.col-header-container { display: flex; flex-direction: column; align-items: center; padding: 4px 0; }
.col-header-dtype { font-size: 0.7rem; color: #6b7280; font-weight: normal; margin-top: 2px; }
.htCore td.outlier { background-color: #fecaca !important; }
.htCore td.pattern { background-color: #bfdbfe !important; }
#help-panel { position: fixed; top: 0; right: -450px; width: 400px; height: 100%; background-color: white; box-shadow: -2px 0 8px rgba(0,0,0,0.1); z-index: 1500; transition: right 0.3s ease-in-out; display: flex; flex-direction: column; }
#help-panel.open { right: 0; }
#global-tooltip { position: fixed; background-color: #333; color: #fff; padding: 8px 12px; border-radius: 6px; font-size: 0.875rem; white-space: normal; max-width: 300px; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.tooltip { cursor: pointer; border-bottom: 1px dotted #007bff; color: #007bff; font-weight: 600; }
.prose h1, .prose h2, .prose h3 { font-weight: bold; margin-top: 1em; margin-bottom: 0.5em; }
.prose h1 { font-size: 1.5rem; } .prose h2 { font-size: 1.25rem; } .prose h3 { font-size: 1.1rem; }
.prose p { margin-bottom: 1em; } .prose ul { list-style-type: disc; margin-left: 2em; margin-bottom: 1em; }
.report-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ccc; margin-bottom: 1rem; }
.tab-container { display: flex; }
.tab-button { padding: 10px 15px; cursor: pointer; border: none; background-color: transparent; border-bottom: 3px solid transparent; margin-right: 4px; margin-bottom: -1px; }
.tab-button.active { border-bottom-color: #3b82f6; font-weight: 600; color: #3b82f6; }
.tab-content { display: none; padding-top: 1rem; }
.tab-content.active { display: block; }
.modal-content-split {
    background-color: #fefefe;
    margin: 5% auto;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: row;
    width: 450px; /* Base width */
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
.modal-content-split.expanded { width: 850px; }

.modal-main { flex: 0 0 450px; padding: 24px; }
.modal-side { 
    flex: 0 0 400px; 
    background-color: #f9fafb; 
    border-left: 1px solid #e5e7eb; 
    padding: 24px; 
    display: none; 
    overflow-y: auto;
}
.modal-content-split.expanded .modal-side { display: block; }

/* Level 2+ accordion styling */
.complexity-level { margin-top: 1rem; border-top: 1px solid #e5e7eb; padding-top: 1rem; }
.complexity-header { font-weight: 600; color: #4b5563; cursor: pointer; display: flex; justify-content: space-between; }
.complexity-body { display: none; margin-top: 0.5rem; }
.complexity-body.open { display: block; }

.complexity-level:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.htCore td.excluded-row-cell {
  position: relative;
  color: #6b7280 !important;
  background-color: #f9fafb !important;
}

.htCore td.excluded-row-cell::after {
  content: '';
  position: absolute;
  left: -10%;
  top: 50%;
  width: 150%;
  border-top: 1px solid rgba(75, 85, 99, 0.55);
  transform: rotate(-28deg);
  pointer-events: none;
}

.filter-options-box {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.5rem;
  background: #fff;
}

.filter-option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid #f3f4f6;
}

.filter-option-row:last-child {
  border-bottom: none;
}
/* Drag and Drop Smart Menu */
.sortable-item {
    padding: 8px 12px;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: grab;
    display: flex;
    align-items: center;
    user-select: none;
}
.sortable-item:active {
    cursor: grabbing;
}
.sortable-item.dragging {
    opacity: 0.5;
    background-color: #f3f4f6;
    border: 2px dashed #3b82f6;
}
.drag-handle {
    margin-right: 10px;
    color: #9ca3af;
    font-weight: bold;
}
/* Imputation UI Styles */
.htCore td.cell-imputed-high {
  background-color: #f0f9ff !important; /* Very subtle blue */
  color: #0369a1;
}
.htCore td.cell-imputed-low {
  background-color: #fff7ed !important; /* Warning orange */
  color: #c2410c;
}
.imputed-icon {
  font-size: 0.85em;
  margin-right: 4px;
  cursor: help;
}
.reality-toggle-container {
  display: flex;
  align-items: center;
  margin-left: 1rem;
  font-size: 0.875rem;
  color: #4b5563;
}
.reality-toggle-container input {
  margin-right: 0.5rem;
}

.highlighted-column-cell {
  box-shadow: inset 2px 0 0 #2563eb, inset -2px 0 0 #2563eb;
  background-color: rgba(37, 99, 235, 0.06) !important;
}

/* Random Effects Builder */
.re-block {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 12px;
  background: #fff;
}
.re-block.re-primary {
  border-color: #93c5fd;
  background: #f0f7ff;
}
.re-block .re-field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 2px;
}
.re-block select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 4px 8px;
  font-size: 0.85rem;
}
.re-block select[multiple] {
  height: 80px;
}
.re-info-note {
  font-size: 0.75rem;
  color: #6b7280;
  background: #f9fafb;
  border-left: 3px solid #93c5fd;
  padding: 6px 10px;
  margin-top: 8px;
}

/* Interaction Builder */
.ix-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 10px;
  background: #f9fafb;
}
.ix-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ix-dropdowns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ix-dropdowns select {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 5px 8px;
  font-size: 0.85rem;
  max-width: 150px;
  background: #fff;
}
.ix-times {
  font-weight: 600;
  color: #9ca3af;
  font-size: 0.85rem;
  padding: 0 2px;
}
.ix-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid #e5e7eb;
}
.ix-add-term-btn {
  font-size: 0.8rem;
  color: #6b7280;
  border: 1px dashed #d1d5db;
  border-radius: 0.375rem;
  padding: 5px 12px;
  cursor: pointer;
  background: transparent;
  white-space: nowrap;
}
.ix-add-term-btn:hover {
  border-color: #9ca3af;
  color: #374151;
}
.ix-add-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: 0.375rem;
  padding: 5px 16px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: auto;
}
.ix-add-btn:hover {
  background: #1d4ed8;
}
.ix-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 8px;
}
.ix-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: #1e40af;
  font-weight: 500;
}
.ix-chip-remove {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  font-weight: bold;
}
.ix-chip-remove:hover {
  color: #dc2626;
}