* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  padding: 20px;
}
.container {
  max-width: 1600px;
  margin: 0 auto;
}
.header {
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.header-content {
  flex: 1;
}
.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}
.user-info {
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
}
.btn-logout {
  padding: 8px 16px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-2px);
}
.header h1 {
  font-size: 28px;
  color: white;
  margin-bottom: 8px;
}
.header .doc-name {
  font-size: 14px;
  opacity: 0.9;
  color: #ffffff;
}
.controls {
  background: #161b22;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  gap: 15px;
  align-items: stretch;
  border: 1px solid #30363d;
  flex-wrap: wrap;
}
.controls label {
  color: #8b949e;
  font-weight: 600;
  font-size: 14px;
}
.controls select {
  padding: 8px 12px;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  min-width: 200px;
  max-width: 400px;
  flex: 1;
}
.controls select:hover {
  border-color: #58a6ff;
}
.controls button {
  padding: 8px 16px;
  background: #238636;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.controls button:hover:not(:disabled) {
  background: #2ea043;
}
.controls button:disabled {
  background: #30363d;
  color: #8b949e;
  cursor: not-allowed;
}
#analyze-btn {
  padding: 8px 48px;
  min-width: 180px;
}
.control-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  min-width: 300px;
}
.control-group:not(:last-child) {
  border-right: 1px solid #30363d;
  padding-right: 15px;
}
.control-group.full-width {
  flex: 1 1 100%;
  border-right: none;
  padding-right: 0;
}
.controls input[type="text"] {
  padding: 8px 12px;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  font-size: 14px;
  min-width: 200px;
  max-width: 300px;
  flex: 1;
}
.controls input[type="text"]:focus {
  outline: none;
  border-color: #58a6ff;
}
.file-count {
  font-size: 12px;
  color: #8b949e;
  font-weight: normal;
}
.processed-files-panel {
  background: #161b22;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #30363d;
  max-height: 300px;
  overflow-y: auto;
}
.processed-files-panel h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: #58a6ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.processed-file-item {
  background: #0d1117;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  border-left: 3px solid #238636;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.processed-file-item:hover {
  background: #1c2128;
  transform: translateX(4px);
  border-left-color: #2ea043;
}
.processed-file-item.active {
  border-left-color: #58a6ff;
  background: #1c2128;
}
.file-item-info {
  flex: 1;
}
.file-item-name {
  font-weight: 600;
  color: #c9d1d9;
  margin-bottom: 4px;
}
.file-item-meta {
  font-size: 12px;
  color: #8b949e;
}
.file-item-actions {
  display: flex;
  gap: 8px;
}
.btn-small {
  padding: 4px 8px;
  background: #21262d;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-small:hover {
  background: #30363d;
  color: #c9d1d9;
  border-color: #58a6ff;
}
.empty-state {
  text-align: center;
  padding: 40px;
  color: #8b949e;
}
.toggle-panel {
  cursor: pointer;
  user-select: none;
}
.toggle-panel:hover {
  color: #2ea043;
}
.status-indicator {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.status-indicator.processing {
  background: #ffa657;
  color: #1c2128;
}
.status-indicator.ready {
  background: #3fb950;
  color: #1c2128;
}
.status-indicator.error {
  background: #da3633;
  color: white;
}
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #1c2128;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.stats-bar {
  background: #161b22;
  padding: 15px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-around;
  border: 1px solid #30363d;
}
.stat-item {
  text-align: center;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #58a6ff;
  display: block;
}
.stat-label {
  font-size: 12px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.section {
  background: #161b22;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #30363d;
}
.section-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #30363d;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-header.headers {
  color: #58a6ff;
}
.section-header.footers {
  color: #f78166;
}
.count-badge {
  background: #238636;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}
.detection-list {
  max-height: 70vh;
  overflow-y: auto;
}
.detection-item {
  background: #0d1117;
  padding: 15px;
  margin-bottom: 12px;
  border-radius: 8px;
  border-left: 3px solid #238636;
  cursor: pointer;
  transition: all 0.2s;
}
.detection-item:hover {
  background: #1c2128;
}
.detection-item.headers {
  border-left-color: #58a6ff;
}
.detection-item.footers {
  border-left-color: #f78166;
}
.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.page-tag {
  background: #1c2128;
  color: #58a6ff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.confidence {
  color: #7ee787;
  font-size: 12px;
  font-weight: 600;
}
.text-preview {
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
  font-family: 'Monaco', 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.reason {
  background: #1c2128;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: #8b949e;
  border-left: 2px solid #f78166;
}
.reason strong {
  color: #f78166;
}
.loading {
  text-align: center;
  padding: 60px;
  color: #8b949e;
  font-size: 18px;
}
.error {
  background: #da3633;
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
}
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #0d1117;
}
::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}
.tab-nav {
  background: #161b22;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 20px;
  display: none;
  gap: 10px;
  border: 1px solid #30363d;
}
.tab-button {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  color: #8b949e;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-button:hover {
  background: #1c2128;
  color: #c9d1d9;
}
.tab-button.active {
  background: #238636;
  color: white;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}
.chart-card {
  background: #161b22;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #30363d;
}
.chart-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 15px;
  color: #58a6ff;
  padding-bottom: 10px;
  border-bottom: 2px solid #30363d;
}
.chart-wrapper {
  position: relative;
  height: 300px;
}
.config-section {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.config-section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 15px 0;
  color: #c9d1d9;
}
.toggle-section {
  cursor: pointer;
  user-select: none;
}
.toggle-section:hover {
  color: #58a6ff;
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.config-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-item label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #c9d1d9;
}
.config-value {
  color: #58a6ff;
  font-weight: 700;
  font-family: 'Monaco', 'Courier New', monospace;
  background: #0d1117;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 50px;
  text-align: center;
}
.config-item input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #30363d;
  outline: none;
  -webkit-appearance: none;
}
.config-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #238636;
  cursor: pointer;
  transition: all 0.2s;
}
.config-item input[type="range"]::-webkit-slider-thumb:hover {
  background: #2ea043;
  transform: scale(1.2);
}
.config-item input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #238636;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.config-item input[type="range"]::-moz-range-thumb:hover {
  background: #2ea043;
  transform: scale(1.2);
}
.config-item small {
  color: #8b949e;
  font-size: 12px;
  line-height: 1.4;
}

/* ========== GROUND TRUTH STYLES ========== */

.gt-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.gt-left-panel,
.gt-right-panel {
  min-width: 0;
}

.gt-section {
  margin-bottom: 20px;
}

.gt-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.gt-section-header h4 {
  margin: 0;
  color: #58a6ff;
  font-size: 16px;
}

.gt-annotations-list {
  max-height: 300px;
  overflow-y: auto;
}

.gt-annotation-item {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.gt-annotation-item:hover {
  background: #1c2128;
  border-color: #58a6ff;
}

.gt-annotation-text {
  color: #c9d1d9;
  font-size: 14px;
  margin-bottom: 10px;
  font-weight: 600;
}

.gt-annotation-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
}

.gt-annotation-pages {
  color: #8b949e;
}

.gt-annotation-badge {
  background: #238636;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.gt-annotation-notes {
  color: #8b949e;
  font-size: 12px;
  font-style: italic;
  margin-bottom: 10px;
  padding: 8px;
  background: #1c2128;
  border-radius: 4px;
}

.gt-annotation-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.gt-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.gt-stat-card {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  transition: all 0.2s;
}

.gt-stat-card:hover {
  border-color: #58a6ff;
  transform: translateY(-2px);
}

.gt-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #58a6ff;
  margin-bottom: 5px;
}

.gt-stat-label {
  font-size: 12px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gt-accuracy-chart-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gt-accuracy-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gt-accuracy-label {
  min-width: 150px;
  font-size: 13px;
  color: #c9d1d9;
  font-weight: 600;
}

.gt-accuracy-bar-container {
  flex: 1;
  height: 24px;
  background: #0d1117;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #30363d;
}

.gt-accuracy-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 12px;
}

.gt-accuracy-value {
  min-width: 80px;
  text-align: right;
  font-size: 13px;
  color: #8b949e;
  font-family: 'Monaco', 'Courier New', monospace;
}

.gt-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.modal-title {
  margin: 0 0 20px 0;
  color: #58a6ff;
  font-size: 20px;
}

.modal-content .form-group {
  margin-bottom: 20px;
}

.modal-content label {
  display: block;
  margin-bottom: 8px;
  color: #c9d1d9;
  font-size: 14px;
  font-weight: 600;
}

.modal-content input[type="text"],
.modal-content textarea {
  width: 100%;
  padding: 10px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.modal-content input[type="text"]:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: #58a6ff;
}

.modal-content input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.modal-content small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 25px;
}

.modal-actions .btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

/* Feedback Buttons */
.feedback-buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-feedback {
  padding: 6px 12px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0d1117;
  color: #8b949e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-feedback:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.btn-like.active,
.btn-like:hover {
  background: #238636;
  color: white;
  border-color: #238636;
}

.btn-dislike.active,
.btn-dislike:hover {
  background: #da3633;
  color: white;
  border-color: #da3633;
}

/* ========== ML METRICS STYLES ========== */

/* ML Metrics Layout */
.ml-metrics-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.ml-metrics-left,
.ml-metrics-right {
  display: flex;
  flex-direction: column;
}

/* Confusion Matrix Styles */
.ml-confusion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.ml-confusion-item {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 15px;
  transition: all 0.2s;
}

.ml-confusion-item:hover {
  border-color: #1f6feb;
  box-shadow: 0 0 10px rgba(31, 111, 235, 0.2);
}

.ml-confusion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.ml-confusion-header h4 {
  margin: 0;
  color: #c9d1d9;
  font-size: 14px;
  font-weight: 600;
}

.ml-confusion-metrics {
  display: flex;
  gap: 6px;
}

.ml-metric-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.ml-metric-badge.ml-f1 {
  background: #1f6feb;
  color: white;
}

.ml-metric-badge.ml-precision {
  background: #238636;
  color: white;
}

.ml-metric-badge.ml-recall {
  background: #ffa657;
  color: #1c2128;
}

/* Confusion Matrix Image */
.ml-confusion-image {
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 10px 0;
  background: white;
  padding: 10px;
}

/* Confusion Matrix Table */
.ml-confusion-table {
  margin: 10px 0;
  overflow-x: auto;
}

.ml-confusion-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ml-confusion-table th,
.ml-confusion-table td {
  padding: 10px;
  border: 1px solid #30363d;
  text-align: center;
}

.ml-confusion-table th {
  background: #161b22;
  color: #8b949e;
  font-weight: 600;
}

.ml-confusion-table td {
  background: #0d1117;
  color: #c9d1d9;
  font-weight: 600;
  font-size: 16px;
}

.ml-confusion-table .cm-tp {
  background: rgba(35, 134, 54, 0.2);
  color: #3fb950;
}

.ml-confusion-table .cm-tn {
  background: rgba(31, 111, 235, 0.2);
  color: #58a6ff;
}

.ml-confusion-table .cm-fp {
  background: rgba(218, 54, 51, 0.2);
  color: #f85149;
}

.ml-confusion-table .cm-fn {
  background: rgba(255, 166, 87, 0.2);
  color: #ffa657;
}

/* Confusion Matrix Counts */
.ml-confusion-counts {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #30363d;
}

.count-badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.count-badge.count-tp {
  background: rgba(35, 134, 54, 0.15);
  color: #3fb950;
  border: 1px solid #238636;
}

.count-badge.count-tn {
  background: rgba(31, 111, 235, 0.15);
  color: #58a6ff;
  border: 1px solid #1f6feb;
}

.count-badge.count-fp {
  background: rgba(218, 54, 51, 0.15);
  color: #f85149;
  border: 1px solid #da3633;
}

.count-badge.count-fn {
  background: rgba(255, 166, 87, 0.15);
  color: #ffa657;
  border: 1px solid #d29922;
}

/* Global Metrics Stat Cards */
.ml-stat-card-large {
  grid-column: span 1;
}

.gt-stat-sublabel {
  font-size: 11px;
  color: #6e7681;
  margin-top: 4px;
}

/* Metrics Comparison Chart */
.ml-comparison-chart {
  margin-top: 15px;
}

.ml-method-comparison-row {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #21262d;
}

.ml-method-comparison-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ml-method-name {
  font-weight: 600;
  color: #c9d1d9;
  margin-bottom: 12px;
  font-size: 14px;
}

.ml-metrics-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ml-metric-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ml-metric-label {
  min-width: 70px;
  font-size: 12px;
  color: #8b949e;
}

.ml-bar-container {
  flex: 1;
  height: 20px;
  background: #161b22;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #30363d;
}

.ml-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.ml-bar-precision {
  background: linear-gradient(90deg, #238636, #3fb950);
}

.ml-bar-recall {
  background: linear-gradient(90deg, #d29922, #ffa657);
}

.ml-bar-f1 {
  background: linear-gradient(90deg, #1f6feb, #58a6ff);
}

.ml-metric-value {
  min-width: 50px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: #c9d1d9;
}

/* False Positives Breakdown */
.ml-fp-container {
  max-height: 600px;
  overflow-y: auto;
  margin-top: 15px;
}

.ml-fp-method-section {
  margin-bottom: 20px;
  padding: 15px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
}

.ml-fp-method-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #21262d;
}

.ml-fp-method-header strong {
  color: #c9d1d9;
  font-size: 14px;
}

.ml-fp-count-badge {
  padding: 4px 10px;
  background: rgba(218, 54, 51, 0.15);
  color: #f85149;
  border: 1px solid #da3633;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.ml-fp-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ml-fp-item {
  padding: 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  transition: all 0.2s;
}

.ml-fp-item:hover {
  border-color: #da3633;
  background: rgba(218, 54, 51, 0.05);
}

.ml-fp-text {
  color: #c9d1d9;
  font-size: 13px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.ml-fp-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11px;
}

.ml-fp-type,
.ml-fp-page,
.ml-fp-reason {
  padding: 3px 8px;
  border-radius: 4px;
  background: #21262d;
  color: #8b949e;
}

.ml-fp-reason {
  background: rgba(218, 54, 51, 0.1);
  color: #f85149;
  border: 1px solid rgba(218, 54, 51, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .gt-container {
    grid-template-columns: 1fr;
  }

  .ml-metrics-layout {
    grid-template-columns: 1fr;
  }

  .ml-confusion-grid {
    grid-template-columns: 1fr;
  }
}
/* ========== Segmented Control for Mode Toggle ========== */
.segmented-control {
  display: inline-flex;
  background: #21262d;
  border-radius: 6px;
  padding: 4px;
  border: 1px solid #30363d;
}

.segmented-control input[type="radio"] {
  display: none;
}

.segmented-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #8b949e;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.segmented-btn:hover {
  color: #c9d1d9;
  background: rgba(110, 118, 129, 0.1);
}

.segmented-control input[type="radio"]:checked + .segmented-btn {
  background: #238636;
  color: #ffffff;
}

.segmented-control input[type="radio"]:checked + .segmented-btn:hover {
  background: #2ea043;
}

/* ========== All Documents ML Metrics Styles ========== */
.all-docs-metrics-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.all-docs-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  padding: 15px;
  background: #0d1117;
  border-radius: 6px;
  border: 1px solid #30363d;
}

.all-docs-stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.all-docs-stat .stat-label {
  font-size: 12px;
  color: #8b949e;
  font-weight: 500;
}

.all-docs-stat .stat-value {
  font-size: 16px;
  color: #c9d1d9;
  font-weight: 600;
}

/* Metrics by Type Grid (Headers vs Footers) */
.metrics-by-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.metrics-type-card {
  padding: 15px;
  background: #0d1117;
  border-radius: 6px;
  border: 1px solid #30363d;
}

.metrics-type-card h4 {
  margin: 0 0 12px 0;
  color: #c9d1d9;
  font-size: 14px;
  font-weight: 600;
}

/* Method-wise Metrics Table */
.all-docs-method-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.all-docs-method-table th,
.all-docs-method-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #21262d;
}

.all-docs-method-table th {
  background: #161b22;
  color: #8b949e;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.all-docs-method-table tbody tr:hover {
  background: rgba(56, 139, 253, 0.05);
}

.all-docs-method-table td {
  color: #c9d1d9;
}

/* Per-Document Breakdown */
.doc-breakdown-item {
  margin-bottom: 10px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0d1117;
}

.doc-breakdown-summary {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  font-weight: 500;
}

.doc-breakdown-summary:hover {
  background: rgba(56, 139, 253, 0.05);
}

.doc-breakdown-summary .doc-name {
  color: #58a6ff;
  font-size: 14px;
}

.doc-breakdown-summary .doc-metrics {
  color: #8b949e;
  font-size: 12px;
}

.doc-breakdown-content {
  padding: 16px;
  border-top: 1px solid #21262d;
}

.doc-breakdown-content h5 {
  margin: 15px 0 10px 0;
  color: #c9d1d9;
  font-size: 13px;
  font-weight: 600;
}

.doc-method-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.doc-method-table th,
.doc-method-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #21262d;
}

.doc-method-table th {
  background: #161b22;
  color: #8b949e;
  font-weight: 600;
}

.doc-method-table td {
  color: #c9d1d9;
}

.doc-method-table tbody tr:hover {
  background: rgba(56, 139, 253, 0.05);
}

/* ============================================================================
   Confidence Filters Section
   ============================================================================ */

.confidence-filters-section {
  margin: 15px 0;
  padding: 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
}

.confidence-filters-summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #c9d1d9;
  padding: 8px;
  user-select: none;
  list-style: none;
}

.confidence-filters-summary::-webkit-details-marker {
  display: none;
}

.confidence-filters-summary:hover {
  color: #58a6ff;
}

.confidence-filters-content {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #30363d;
}

.filter-description {
  font-size: 13px;
  color: #8b949e;
  margin: 0 0 15px 0;
  line-height: 1.5;
}

.filter-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-control {
  display: grid;
  grid-template-columns: 150px 1fr 60px;
  align-items: center;
  gap: 15px;
}

.filter-control label {
  font-size: 13px;
  color: #c9d1d9;
  font-weight: 500;
  text-align: right;
}

.filter-control input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #21262d;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.filter-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #58a6ff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-control input[type="range"]::-webkit-slider-thumb:hover {
  background: #79c0ff;
  transform: scale(1.1);
}

.filter-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #58a6ff;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.filter-control input[type="range"]::-moz-range-thumb:hover {
  background: #79c0ff;
  transform: scale(1.1);
}

.filter-control .threshold-value {
  min-width: 45px;
  text-align: right;
  font-size: 13px;
  color: #58a6ff;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.btn-primary {
  background: #238636 !important;
  color: white !important;
}

.btn-primary:hover {
  background: #2ea043 !important;
}
