:root{
  --bg: #1e1f22;
  --panel: #2a2c31;
  --muted: #8b8f98;
  --accent: #4ea1ff;
  --grid: #34363b;
  --grid-alt: #2f3136;
  --selection: rgba(78,161,255,0.25);
  --text: #e8e8e8;
  --rowh: 28px;
  --colw: 175px;
}
*{ box-sizing: border-box; }
html, body { 
  margin:0; padding:0; height:100%; background: var(--bg); color: var(--text);
  font-family: ui-sans-serif,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji"; 
}
.toolbar {
  display:flex; justify-content: space-between; align-items:center; gap: 12px;
  padding: 10px 12px; background: var(--panel); border-bottom: 1px solid #3a3d44;
  position: sticky; top: 0; z-index: 10; max-height: 52px; height: 52px;
  overflow: auto;
}
.toolbar .left, .toolbar .right { display:flex; gap: 8px; align-items:center; }
button, .file-btn, .btn { 
  background:#3a3d44; color:var(--text); border:1px solid #4a4e57; border-radius:8px;
  padding:6px 10px; cursor:pointer; font-weight:700;
  font-family: inherit; font-size: 14px;
}
button:hover, .file-btn:hover, .btn:hover { border-color: var(--accent); }
.file-btn { position: relative; overflow: hidden; min-width: 70px; }
.file-btn input { position:absolute; inset:0; opacity:0; cursor:pointer; }
a.btn:link {  text-decoration: none; }
a.btn:visited { text-decoration: none; }
a.btn:hover { text-decoration: none; }
a.btn:active { text-decoration: none; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.hidden { display:none !important; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  background: #2b2d33; border: 1px solid #42454d; border-radius: 12px; z-index: 101;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.modal-header { display:flex; align-items:center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #3a3d44; }
.modal-close { background: transparent; border: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.modal-body { padding: 14px; }
.modal-footer { display:flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid #3a3d44; }
.btn-primary { background: var(--accent); border: none; color: #0b0c0f; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; line-height: 14px; }
.btn-secondary { background: #3a3d44; border: 1px solid #4a4e57; color: var(--text); padding: 8px 12px; border-radius: 8px; cursor: pointer; line-height: 14px; }
.modal .danger { color: #ff5d5d; }
.modal details summary { cursor: pointer; color: var(--muted); }
.modal ul { margin: 8px 0 0; padding-left: 20px; max-height: 160px; overflow: auto; }
.grid-wrapper {
  overflow:auto; height: calc(100vh - 58px); position: relative;
}
.grid-wrapper.noselect,
.grid-wrapper.noselect * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}
.grid-outer {
  position: relative; width: 100%; min-width: 800px;
}
.sheet {
  border-collapse: separate; border-spacing: 0; width: max-content; table-layout: fixed;
}
.sheet th, .sheet td {
  border: 1px solid #42454d; padding: 0; min-width: var(--colw); max-width: var(--colw); width: var(--colw); height: var(--rowh);
}
#sheet-head { position: sticky; top: 0px; z-index: 5; background: var(--panel); }
#sheet-body { position: absolute; top: 34px; left: 0; }
#sheet-body tbody { will-change: transform; }
.sheet thead th .header-content {
  display:flex; gap: 6px; align-items:center; padding: 4px 6px;
}
.col-name {
  width: 100%; background:#2f3136; border:1px solid #4a4e57; color:var(--text);
  border-radius:6px; padding:3px 6px;
}
.col-type {
  background:#2f3136; border:1px solid #4a4e57; color:var(--text);
  border-radius:6px; padding:3px 6px;
}
tbody tr:nth-child(even) td { background: var(--grid); }
tbody tr:nth-child(odd) td { background: var(--grid-alt); }
.cell {
  padding: 0 8px;
  outline: none;
  display: block;
  height: var(--rowh);
  line-height: var(--rowh);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell.editing {
  white-space: pre-wrap;
  padding-top: 4px;
  line-height: 1.3;
  min-height: var(--rowh);
  max-height: 40vh;
  overflow: auto;
  text-overflow: clip;
}
.cell[contenteditable="true"]:focus { box-shadow: inset 0 0 0 2px var(--accent); }

.spacer { position: relative; width: 1px; pointer-events: none; }
.selection-rect {
  position: absolute; border:2px solid var(--accent); background: var(--selection); pointer-events:none; z-index: 20;
}
.status { position: fixed; bottom:10px; left:12px; background:#2a2c31; padding:6px 10px; border-radius:8px; opacity:.9; }
.auth-status { margin-left: 8px; color: var(--muted); }

/* Overlay root */
#busy-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#busy-overlay.is-active {
  display: flex;
}
#busy-overlay .busy-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 28, 40, 0.35);
  backdrop-filter: blur(2px);
}
#busy-overlay .busy-panel {
  position: relative;
  min-width: 220px;
  max-width: min(90vw, 420px);
  padding: 18px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  background: #111827;
  color: #e5e7eb;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-gap: 12px;
  align-items: center;
}
#busy-overlay .spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}
#busy-overlay .busy-text {
  font: 500 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
@media (prefers-reduced-motion: reduce) {
  #busy-overlay .spinner { animation: none; border-top-color: rgba(255,255,255,0.8); }
}
@keyframes spin { to { transform: rotate(360deg); } }
body.busy {cursor: progress !important;}
[data-inert="true"] {
  pointer-events: none !important;
  user-select: none !important;
}

/* ==============================================================================
   FILE LIST STYLES (Controlled Sets / Uploaded Files)
   ============================================================================== */
.files-wrap { max-width: 1200px; margin: 16px auto; padding: 0 12px; }
.files-toolbar { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
.files-list { width:100%; border-collapse: collapse; }
.files-list th, .files-list td { border-bottom: 1px solid #2a2f3a; padding: 8px 10px; text-align:left; }
.files-list th { color:#9ca3af; font-weight:600; }
.files-list tr:hover { background: rgba(255,255,255,0.03); }
.size-col { min-width: 100px; max-width: 100px; width: 100px; }
.mod-col { min-width: 180px; max-width: 180px; width: 180px; }
.nav-col { min-width: 200px; max-width: 200px; width: 200px; }
.btn-danger { border-color:#7f1d1d; background:#991b1b; }
.btn-danger:hover { background:#7f1d1d; }
.btn-edit { border-color:#1d7f1d; background:#1b991b; }
.btn-edit:hover { background:#1d7f1d; }
.btn-analysis { border-color:#1d4f7f; background:#1b5f99; }
.btn-analysis:hover { background:#1d4f7f; }
.muted { color:#9ca3af; }
.spacer { flex:1; }
#files-table { margin-top: 20px; }

/* Modal styles */
.sheet-modal-outer { position: fixed; inset: 0; display: none; z-index: 10000; }
.sheet-modal-outer.is-open { display: block; }
.sheet-modal-backdrop { position:absolute; inset:0; background:rgba(28,28,40,0.45); backdrop-filter: blur(2px); }
.sheet-modal-panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 92vw); background:#111827; color:#e5e7eb;
  border:1px solid #374151; border-radius: 12px; padding:16px; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  display: grid; grid-template-rows: auto 1fr auto; gap:12px;
  max-height: 80vh; overflow: hidden;
}
.sheet-modal-panel h3 { margin:0 0 6px; font-weight:600; font-size: 16px; color:#e5e7eb; }
.sheet-list { overflow:auto; max-height: 50vh; border:1px solid #2a2f3a; border-radius:8px; }
.sheet-item {
  padding:8px 10px; display:flex; align-items:center; gap:10px; cursor:pointer;
  border-bottom:1px solid #2a2f3a;
}
.sheet-item:last-child { border-bottom:none; }
.sheet-item input[type='radio'] { accent-color:#60a5fa; }
.sheet-item:hover { background: rgba(255,255,255,0.04); }
.sheet-item.selected { background: rgba(96,165,250,0.15); }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; }

.selector-modal-outer { position: fixed; inset: 0; display: none; z-index: 10000; }
.selector-modal-outer.is-open { display: block; }
.selector-modal-backdrop { position:absolute; inset:0; background:rgba(28,28,40,0.45); backdrop-filter: blur(2px); }
.selector-modal-panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 92vw); background:#111827; color:#e5e7eb;
  border:1px solid #374151; border-radius: 12px; padding:16px; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  display: grid; grid-template-rows: auto 1fr auto; gap:12px;
  max-height: 80vh; overflow: hidden;
}
.selector-modal-panel h3 { margin:0 0 6px; font-weight:600; font-size: 16px; color:#e5e7eb; }
.selector-list { overflow:auto; max-height: 50vh; border:1px solid #2a2f3a; border-radius:8px; }
.selector-item {
  padding:8px 10px; display:flex; align-items:center; gap:10px; cursor:pointer; min-width: 400px;
  border-bottom:1px solid #2a2f3a;
}
.selector-item:last-child { border-bottom:none; }
.selector-item input[type='radio'] { accent-color:#60a5fa; }
.selector-item input[type='number'] { width:50px; margin-top: 5px; }
.selector-item input[type='number'] { -moz-appearance:textfield; }
.selector-item input[type='number']::-webkit-outer-spin-button, .selector-item input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.selector-item:hover { background: rgba(255,255,255,0.04); }
.selector-item.selected { background: rgba(96,165,250,0.15); }
.selector-modal-actions { display:flex; justify-content:flex-end; gap:10px; }
.selector-name { width: 125px; }

a.file-download {
  color: var(--text);
  text-decoration: none;
}

/* ==============================================================================
   COLUMN SELECTOR MODAL
   ============================================================================== */
.column-selector-modal-outer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10000;
}
.column-selector-modal-outer.is-open {
  display: block;
}
.column-selector-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 28, 40, 0.55);
  backdrop-filter: blur(3px);
}
.column-selector-modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(600px, 94vw);
  max-height: 85vh;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.column-selector-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #374151;
}
.column-selector-header h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  color: #f3f4f6;
}
.column-selector-subtitle {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}
.column-selector-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.column-section {
  margin-bottom: 20px;
}
.column-section:last-child {
  margin-bottom: 0;
}
.column-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.column-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #d1d5db;
}
.column-section-count {
  font-size: 12px;
  color: #6b7280;
}
.column-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}
.column-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 20px;
  font-size: 13px;
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.column-chip:hover {
  border-color: #4ea1ff;
  background: #1e3a5f;
}
.column-chip .chip-remove {
  font-size: 14px;
  color: #9ca3af;
  font-weight: bold;
  line-height: 1;
}
.column-chip:hover .chip-remove {
  color: #ef4444;
}
.excluded-section .column-chips {
  min-height: 0;
}
.excluded-section .column-chip {
  background: #292524;
  border-color: #44403c;
  color: #a8a29e;
}
.excluded-section .column-chip:hover {
  border-color: #22c55e;
  background: #14532d;
  color: #bbf7d0;
}
.excluded-section .column-chip .chip-add {
  font-size: 14px;
  color: #6b7280;
  font-weight: bold;
  line-height: 1;
}
.excluded-section .column-chip:hover .chip-add {
  color: #22c55e;
}
.column-empty-msg {
  margin: 0;
  padding: 8px 0;
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}
.column-selector-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #374151;
  background: #0d1117;
}
.column-selector-footer .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.step-indicator {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  font-weight: 600;
}
.chip-type {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
  text-transform: uppercase;
}
.chip-type.num {
  background: rgba(78, 161, 255, 0.2);
  color: #4ea1ff;
}
.chip-type.txt {
  background: rgba(156, 163, 175, 0.2);
  color: #9ca3af;
}
.footer-spacer {
  flex: 1;
}

/* ==============================================================================
   TARGET SELECTOR MODAL
   ============================================================================== */
.target-selector-modal-outer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}
.target-selector-modal-outer.is-open {
  display: flex;
}
.target-selector-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.target-selector-modal-panel {
  position: relative;
  background: #1f2937;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.target-selector-header {
  margin-bottom: 20px;
}
.target-selector-header h3 {
  margin: 0 0 8px;
  color: #f3f4f6;
  font-size: 1.25rem;
}
.target-selector-subtitle {
  margin: 0;
  color: #9ca3af;
  font-size: 0.875rem;
}
.target-selector-body {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
}
.target-section {
  margin-bottom: 20px;
}
.target-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.target-section-title {
  font-weight: 600;
  color: #e5e7eb;
  font-size: 0.875rem;
}
.target-section-count {
  font-size: 0.75rem;
  color: #6b7280;
}
.target-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}
.target-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: #374151;
  border-radius: 20px;
  font-size: 0.875rem;
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.target-chip:hover {
  background: #4b5563;
  border-color: #6b7280;
}
.target-chip .chip-name {
  margin-right: 8px;
}
.target-chip .chip-select,
.target-chip .chip-remove {
  font-size: 1rem;
  font-weight: bold;
  color: #9ca3af;
}
.target-chip .chip-select {
  color: #10b981;
}
.target-chip .chip-remove {
  color: #ef4444;
}
.selected-target-section {
  background: rgba(16, 185, 129, 0.1);
  border-radius: 8px;
  padding: 16px;
}
.target-empty-msg {
  color: #6b7280;
  font-size: 0.875rem;
  font-style: italic;
  margin: 0;
}
.target-selector-footer {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #374151;
}

/* ==============================================================================
   ANALYSIS SECTION
   ============================================================================== */
.analysis-section {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #1f2937;
  border-radius: 8px;
  border: 1px solid #374151;
  width: 100%;
  box-sizing: border-box;
}
.analysis-section.hidden {
  display: none;
}
.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #374151;
}
.analysis-header h2 {
  margin: 0;
  color: #e5e7eb;
  font-size: 1.1rem;
  font-weight: 600;
}
.analysis-header .btn-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}
.analysis-header .btn-close:hover {
  background: #374151;
  color: #e5e7eb;
}
.charts-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.analysis-info-section {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.analysis-columns-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
}
.info-label {
  color: #9ca3af;
  font-weight: 600;
  min-width: 140px;
  flex-shrink: 0;
}
.info-value {
  color: #d1d5db;
  word-break: break-word;
}
.charts-row {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  width: 100%;
}
.charts-row .chart-wrapper {
  flex: 1;
  min-width: 0;
}
.chart-wrapper {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 1rem;
  flex: 1;
  min-width: 300px;
}
.chart-wrapper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.chart-wrapper-title {
  color: #e5e7eb;
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
}
.chart-wrapper-info {
  color: #9ca3af;
  font-size: 0.8rem;
}
.chart-canvas-container {
  position: relative;
  width: 100%;
  height: 300px;
  min-height: 300px;
}
.chart-canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.analysis-footer-section {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #374151;
  margin-top: 0.5rem;
}
.btn-submit-training {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border: none;
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.btn-submit-training:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}
.btn-submit-training:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
@media (max-width: 900px) {
  .charts-row {
    flex-direction: column;
  }
  .charts-row .chart-wrapper {
    flex: none;
    width: 100%;
  }
}

/* ==============================================================================
   ANALYSIS COLUMN CATEGORIES GRID
   ============================================================================== */
.analysis-columns-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.column-category {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px;
  transition: border-color 0.2s ease;
}
.column-category:hover {
  border-color: #484f58;
}
.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #21262d;
}
.category-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  flex-shrink: 0;
}
.category-icon.clustering-icon {
  background: rgba(78, 161, 255, 0.2);
  color: #4ea1ff;
}
.category-icon.target-icon {
  background: rgba(255, 99, 132, 0.2);
  color: #ff6384;
}
.category-icon.other-num-icon {
  background: rgba(75, 192, 192, 0.2);
  color: #4bc0c0;
}
.category-icon.textual-icon {
  background: rgba(156, 163, 175, 0.2);
  color: #9ca3af;
}
.category-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #c9d1d9;
  flex: 1;
}
.category-count {
  font-size: 0.75rem;
  color: #8b949e;
  background: #21262d;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.category-columns {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}
.column-tag {
  display: inline-block;
  padding: 4px 10px;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 16px;
  font-size: 0.8rem;
  color: #c9d1d9;
  white-space: nowrap;
}
.no-columns {
  font-size: 0.8rem;
  color: #6e7681;
  font-style: italic;
  padding: 4px 0;
}
.column-sum-verification {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  margin-top: 0.5rem;
}
.sum-label {
  font-size: 0.8rem;
  color: #8b949e;
}
.sum-formula {
  font-size: 0.85rem;
  color: #58a6ff;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: #0d1117;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #21262d;
}

/* Analyzed status on button */
.btn-analysis.analyzed {
  background: #065f46;
  border-color: #059669;
  color: #a7f3d0;
}
.btn-analysis.analyzed:hover {
  background: #047857;
}

/* ==============================================================================
   TRAINING CONFIGS SECTION — styled like files-list tables (NO green border)
   ============================================================================== */

#controlled-files-table { margin-top: 20px; }

.training-configs-section {
  width: 100%;
  max-width: none;
  margin: 20px 0 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.training-configs-section.hidden {
  display: none;
}

.training-configs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #2a2f3a;
  background: transparent;
}

.training-configs-col-headers {
  display: none; /*flex*/
  align-items: center;
  padding: 6px 16px;
  border-bottom: 1px solid #2a2f3a;
  color: #9ca3af;
  font-size: 0.75rem;
  font-weight: 600;
}

.training-configs-col-headers .col-name-header {
  flex: 1;
}

.training-configs-col-headers .col-modified-header {
  min-width: 160px;
  max-width: 160px;
  width: 160px;
  text-align: left;
}

.training-configs-col-headers .col-actions-header {
  min-width: 140px;
  max-width: 140px;
  width: 140px;
  text-align: right;
}

.training-configs-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
}

.training-configs-title-area h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #9ca3af;
}

#trained-configs-section .training-configs-title-area h3 {
  color: #9ca3af;
}

.training-configs-count {
  font-size: 0.75rem;
  color: var(--muted, #8b8f98);
  background: transparent;
  padding: 2px 8px;
  border-radius: 10px;
}

.training-configs-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 300px;
  overflow-y: auto;
  background: transparent;
  padding: 0;
}

/* Highlight styles for hover cross-referencing ===== */
.training-config-item.highlight-related {
  background: rgba(78, 161, 255, 0.10) !important;
  box-shadow: inset 3px 0 0 #4ea1ff;
}

.files-list tr.highlight-related {
  background: rgba(78, 161, 255, 0.10) !important;
  box-shadow: inset 3px 0 0 #4ea1ff;
}

/* ==============================================================================
   TRAINING CONFIG ITEM — Compact, single-line, matching file list rows
   ============================================================================== */

.training-config-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: var(--grid-alt, #2f3136);
  border: none;
  border-bottom: 1px solid #2a2f3a;
  border-radius: 0;
  padding: 22px 10px;
  transition: background 0.15s;
  flex-wrap: nowrap;
  min-height: 0;
}
.training-config-item:nth-child(even) {
  background: var(--grid, #34363b);
  /*background: transparent;*/
}

.training-config-item:last-child {
  border-bottom: none;
}

.training-config-item:hover {
  /*background: rgba(255,255,255,0.06);*/
  background: rgba(255,255,255,0.03);
}

/* Selected config highlight */
.training-config-item:has(.config-checkbox:checked) {
  background: rgba(78, 161, 255, 0.06);
}

.config-info {
  flex: 1;
  min-width: 0;
}

.config-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.config-name {
  font-weight: 500;
  color: var(--text, #e8e8e8);
  font-size: inherit; 
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

/* Fixed-width "Modified" column (matching .mod-col from file tables) */
.config-modified-col {
  min-width: 160px;
  max-width: 160px;
  width: 160px;
  font-size: inherit;        /* was 0.75rem — now matches file table muted text */
  color: #9ca3af;            /* match .muted color */
  white-space: nowrap;
  flex-shrink: 0;
  text-align: left;
}

/* Hide old inline date — replaced by .config-modified-col */
.config-time-inline {
  display: none;
}

/* Hide the old separate-line date */
.config-info .config-time {
  display: none;
}

.config-status {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 500;
  flex-shrink: 0;
}

.status-pending {
  background: #45475a;
  color: #a6adc8;
}

.status-training {
  background: #1e66f5;
  color: white;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-completed {
  background: #40a02b;
  color: white;
}

.status-failed {
  background: #d20f39;
  color: white;
}

.status-aborted {
  background: #df8e1d;
  color: white;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Inline stats for User Configs */
.config-stats-inline {
  display: flex;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--muted, #8b8f98);
  flex-shrink: 0;
}

.config-stats-inline .stat {
  background: #3a3d44;
  padding: 1px 5px;
  border-radius: 3px;
}

/* Bottom stats line (for trained configs) */
.config-stats {
  display: flex;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--muted, #8b8f98);
  margin-top: 1px;
}

.config-stats .stat {
  background: #3a3d44;
  padding: 1px 5px;
  border-radius: 3px;
}

.config-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  min-width: 140px;
  max-width: 140px;
  width: 140px;
  flex-shrink: 0;
}

.btn-config-view,
.btn-config-train,
.btn-config-abort,
.btn-config-delete {
  padding: 3px 8px;
  border: 1px solid #4a4e57;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-config-view {
  background: #3a3d44;
  color: var(--text, #e8e8e8);
}
.btn-config-view:hover {
  border-color: var(--accent, #4ea1ff);
}
.btn-config-train {
  background: #1b5f99;
  border-color: #1d4f7f;
  color: white;
}
.btn-config-train:hover:not(:disabled) {
  background: #1d4f7f;
}
.btn-config-train:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-config-abort {
  background: #b45309;
  border-color: #92400e;
  color: white;
}
.btn-config-abort:hover {
  background: #92400e;
}
.btn-config-delete {
  background: #991b1b;
  border-color: #7f1d1d;
  color: white;
  padding: 3px 6px;
}
.btn-config-delete:hover:not(:disabled) {
  background: #7f1d1d;
}
.btn-config-delete:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==============================================================================
   CONFIG NUMBER BADGE (next to checkbox)
   ============================================================================== */

.config-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;          /* was 22px — slightly wider for "cs12" etc. */
  height: 16px;
  padding: 0 5px;           /* was 0 4px */
  background: rgba(78, 161, 255, 0.15);
  border: 1px solid rgba(78, 161, 255, 0.35);
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #4ea1ff;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Checkbox + number badge container */
.config-select-checkbox {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 8px;
  flex-shrink: 0;
}

.config-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #4ea1ff;
  cursor: pointer;
  border-radius: 4px;
}

.config-checkbox:hover {
  transform: scale(1.1);
}

/* ==============================================================================
   INLINE PROGRESS BAR (compact — inside config-name-row)
   ============================================================================== */

.training-progress-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  flex-shrink: 1;
  min-width: 100px;
  max-width: 180px;
}

.training-progress-bar-inline {
  flex: 1;
  height: 4px;
  background: rgba(55, 65, 81, 0.6);
  border-radius: 2px;
  overflow: hidden;
  min-width: 40px;
}

.training-progress-fill-inline {
  height: 100%;
  background: linear-gradient(90deg, #4ea1ff, #6dd5ed);
  border-radius: 2px;
  transition: width 0.5s ease-in-out;
}

.training-progress-text-inline {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
  min-width: 50px;
}

/* Block progress bar (fallback / legacy) */
.training-progress-container {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.training-progress-bar {
  flex: 1;
  height: 5px;
  background: rgba(55, 65, 81, 0.6);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.training-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ea1ff, #6dd5ed);
  border-radius: 3px;
  transition: width 0.5s ease-in-out;
}

.training-progress-text {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
  min-width: 80px;
}

/* ==============================================================================
   CONFIG DETAILS PANEL
   ============================================================================== */

.training-config-details {
  width: 100%;
  background: var(--panel, #2a2c31);
  border: 1px solid #42454d;
  border-radius: 0;
  padding: 16px;
  margin-bottom: 0;
  border-top: none;
}

.training-config-details.hidden {
  display: none;
}

.config-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #42454d;
}

.config-details-header h3 {
  margin: 0;
  color: var(--text, #e8e8e8);
  font-size: 1rem;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--muted, #8b8f98);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.btn-close:hover {
  color: var(--text);
}

.config-detail-section {
  margin-bottom: 16px;
}

.detail-row {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.detail-label {
  color: var(--muted, #8b8f98);
  min-width: 110px;
}

.detail-value {
  color: var(--text, #e8e8e8);
}

.detail-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.detail-status.training {
  background: #1e66f5;
  color: white;
}
.detail-status.completed {
  background: #40a02b;
  color: white;
}
.detail-status.failed {
  background: #d20f39;
  color: white;
}
.detail-status.aborted {
  background: #df8e1d;
  color: white;
}
.detail-status.pending {
  background: #45475a;
  color: #a6adc8;
}

.config-columns-section h4 {
  margin: 0 0 10px 0;
  color: var(--text, #e8e8e8);
  font-size: 0.95rem;
}

.column-category-detail {
  background: var(--bg, #1e1f22);
  border: 1px solid #42454d;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}

.category-header-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.category-header-detail .category-title {
  font-weight: 500;
  color: var(--text, #e8e8e8);
  font-size: 0.85rem;
}

.category-header-detail .category-count {
  background: #3a3d44;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.7rem;
  color: var(--muted, #8b8f98);
}

.category-columns-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.category-columns-detail .column-tag {
  background: #3a3d44;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text, #e8e8e8);
}

.category-columns-detail .column-tag.num {
  border-left: 2px solid var(--accent, #4ea1ff);
}

.category-columns-detail .column-tag.txt {
  border-left: 2px solid #9ca3af;
}

.category-columns-detail .no-columns {
  color: var(--muted, #8b8f98);
  font-style: italic;
  font-size: 0.8rem;
}

.config-note {
  margin-top: 16px;
  padding: 10px;
  background: #3a3d44;
  border-radius: 6px;
  border-left: 3px solid var(--accent, #4ea1ff);
}

.config-note p {
  margin: 0;
  color: var(--muted, #8b8f98);
  font-size: 0.8rem;
}

/* ==============================================================================
   TRAINING RESULTS SECTION
   ============================================================================== */

.training-results-section {
  width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 0;
  margin-top: 1rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.training-results-section.hidden {
  display: none;
}

.training-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #374151;
  background: var(--panel, #2a2c31);
}

.training-results-header h3 {
  margin: 0;
  color: #e5e7eb;
  font-size: 1rem;
  font-weight: 600;
}

.training-results-content {
  padding: 16px;
}

.training-results-chart-container {
  position: relative;
  width: 100%;
  height: 450px;
  min-height: 300px;
}

.training-results-chart-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.no-results {
  color: #6b7280;
  font-style: italic;
  text-align: center;
  padding: 2rem 0;
  margin: 0;
}

/* Results button */
.btn-config-results {
  padding: 3px 8px;
  border: 1px solid #059669;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.15s;
  background: #065f46;
  color: #a7f3d0;
}

.btn-config-results:hover {
  background: #047857;
  border-color: #10b981;
}

.config-charts-section {
  margin-top: 16px;
}

.config-charts-section h4 {
  margin: 0 0 10px 0;
  color: var(--text, #e8e8e8);
  font-size: 0.95rem;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid #42454d;
}

/* Ensure charts-row inside config details works correctly */
.training-config-details .charts-row {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  width: 100%;
}

.training-config-details .charts-row .chart-wrapper {
  flex: 1;
  min-width: 0;
}

.training-config-details .training-results-chart-container {
  position: relative;
  width: 100%;
  height: 450px;
  min-height: 300px;
}

.training-config-details .training-results-chart-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 900px) {
  .training-config-details .charts-row {
    flex-direction: column;
  }
  .training-config-details .charts-row .chart-wrapper {
    flex: none;
    width: 100%;
  }
}

/* ==============================================================================
   MULTI-SELECT TRAINING STYLES
   ============================================================================== */

.training-configs-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-multi-train {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border: none;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.btn-multi-train:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.btn-multi-train:active {
  transform: translateY(0);
}

.btn-multi-train.hidden {
  display: none !important;
}

/* ==============================================================================
   PREVIOUS MODEL SELECTOR
   ============================================================================== */

.prev-model-list-container {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background: #1f2937;
}

.prev-model-list {
  padding: 4px;
}

.prev-model-option {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 4px;
  gap: 8px;
  transition: background 0.1s ease;
}

.prev-model-option:hover {
  background: rgba(55, 65, 81, 0.5);
}

.prev-model-option input[type="radio"] {
  accent-color: #4ea1ff;
  flex-shrink: 0;
}

.prev-model-option-text {
  color: #e5e7eb;
  font-size: 13px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.prev-model-option-date {
  color: #6b7280;
  font-size: 11px;
}

/* ==============================================================================
   PROJECT DROPDOWN
   ============================================================================== */

.project-dropdown-container {
  position: relative;
  display: inline-block;
}

.project-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-width: 120px;
  max-width: 250px;
}

.project-icon {
  font-size: 14px;
  flex-shrink: 0;
}

#project-name-display {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.project-arrow {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.project-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1000;
  min-width: 240px;
  max-width: 320px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.project-dropdown.hidden {
  display: none;
}

.project-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #374151;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
}

.btn-new-project {
  background: #059669;
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-new-project:hover {
  background: #047857;
}

.project-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background 0.1s;
  gap: 8px;
}

.project-item:hover {
  background: rgba(55, 65, 81, 0.5);
}

.project-item.active {
  background: rgba(78, 161, 255, 0.15);
  border: 1px solid rgba(78, 161, 255, 0.3);
}

.project-item-name {
  font-size: 13px;
  color: #e5e7eb;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.project-item.active .project-item-name {
  font-weight: 600;
  color: #4ea1ff;
}

.project-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.project-active-badge {
  color: #4ea1ff;
  font-size: 10px;
}

.project-item-select {
  background: #374151;
  color: #e5e7eb;
  border: 1px solid #4b5563;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.project-item-select:hover {
  background: #4ea1ff;
  border-color: #4ea1ff;
  color: white;
}

.project-item-delete {
  background: transparent;
  color: #6b7280;
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 3px;
  transition: all 0.15s;
}

.project-item-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.project-item-empty {
  padding: 16px 12px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  font-style: italic;
}

.project-item-rename {
  background: transparent;
  color: #6b7280;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 3px;
  transition: all 0.15s;
}

.project-item-rename:hover {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

.training-description,
.clustering-description {
  background: rgba(78, 161, 255, 0.08);
  border-left: 3px solid #4ea1ff;
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #b0c4de;
}

.target-selector-subtitle {
  margin-top: 4px;
}

/* Lock styling for target columns in training step */
.column-chip[style*="not-allowed"] {
  border-color: rgba(255, 99, 132, 0.3) !important;
  background: rgba(255, 99, 132, 0.05) !important;
}

/* Multi-target config name styling */
.config-base {
  color: #e5e7eb;
}
.config-num {
  color: #9ca3af;
  font-size: 11px;
  margin: 0 4px;
}
.config-target {
  color: #4ea1ff;
  font-weight: 500;
  font-size: 12px;
}

.active-file-label {
  color: #9ca3af;
  font-size: 13px;
  padding: 4px 10px;
  background: rgba(78, 161, 255, 0.1);
  border: 1px solid rgba(78, 161, 255, 0.25);
  border-radius: 6px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* FLASH NOTIFICATIONS */
#flash-notifications {
  pointer-events: auto;
}
#flash-notifications > div {
  pointer-events: auto;
}
#flash-notifications > div b,
#flash-notifications > div strong {
  color: #ffffff;
}

/* ==============================================================================
   BATCH CONFIG STYLES
   ============================================================================== */

.batch-badge {
  display: inline-block;
  padding: 2px 6px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
  flex-shrink: 0;
}

/* Batch results button (purple to match batch badge) */
.btn-config-batch-results {
  padding: 3px 8px;
  border: 1px solid #7c3aed;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.15s;
  background: #4c1d95;
  color: #c4b5fd;
}

.btn-config-batch-results:hover {
  background: #5b21b6;
  border-color: #8b5cf6;
  color: #ede9fe;
}

/* ==============================================================================
   BATCH TABS STYLES
   ============================================================================== */

.batch-results-container {
  width: 100%;
}

.batch-tabs-section {
  width: 100%;
}

.batch-tabs-header {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #374151;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.batch-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-bottom: -2px;
}

.batch-tab-btn:hover {
  color: #e5e7eb;
  background: rgba(55, 65, 81, 0.3);
}

.batch-tab-btn.active {
  color: #4ea1ff;
  border-bottom-color: #4ea1ff;
  font-weight: 600;
}

.tab-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tab-status-dot.completed {
  background: #10b981;
}

.tab-status-dot.failed {
  background: #ef4444;
}

.tab-status-dot.pending {
  background: #6b7280;
}

.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.batch-tab-panel {
  animation: fadeIn 0.2s ease;
}

.batch-tab-panel.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.batch-tab-info {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.batch-tab-info .detail-row {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.batch-tab-info .detail-row:last-child {
  margin-bottom: 0;
}

.batch-tab-info .detail-label {
  color: #8b949e;
  min-width: 80px;
}

.batch-tab-info .detail-value {
  color: #e5e7eb;
}

/* ==============================================================================
   RESPONSIVE
   ============================================================================== */
@media (max-width: 800px) {
  .config-name-row {
    flex-wrap: wrap;
  }
  .config-time-inline {
    margin-left: 0;
    width: 100%;
  }
  .training-progress-inline {
    margin-left: 0;
    width: 100%;
    max-width: none;
  }
  .config-stats-inline {
    display: none;
  }
}

@media (max-width: 700px) {
  .analysis-columns-grid {
    grid-template-columns: 1fr;
  }
}

/* Known property highlighting */
.target-chip.known-property,
.column-chip.known-property {
  border-color: rgba(78, 161, 255, 0.5);
  background: rgba(78, 161, 255, 0.08);
}

.chip-known-badge {
  color: #4ea1ff;
  font-size: 11px;
  margin-right: 4px;
  flex-shrink: 0;
}

.known-separator {
  width: 100%;
  text-align: center;
  padding: 8px 0;
  color: #6b7280;
  font-size: 11px;
  border-top: 1px dashed #374151;
  margin-top: 6px;
}

.known-separator span {
  background: #111827;
  padding: 0 8px;
  position: relative;
  top: -1px;
}

/* ==============================================================================
   PROGRESS BAR — WAITING / ERROR STATES
   ============================================================================== */

/* Waiting state (yellow/orange pulsing) */
.training-progress-fill-inline.progress-waiting,
.training-progress-fill.progress-waiting {
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
  animation: progress-pulse 1.5s ease-in-out infinite;
}

/* Error state (red, no animation) */
.training-progress-fill-inline.progress-error,
.training-progress-fill.progress-error {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
  animation: none;
}

/* Waiting text */
.training-progress-text-inline.progress-text-waiting,
.training-progress-text.progress-text-waiting {
  color: #fbbf24;
}

/* Error text */
.training-progress-text-inline.progress-text-error,
.training-progress-text.progress-text-error {
  color: #fca5a5;
}

/* Pulse animation for waiting state */
@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Progress bar waiting/error states */
.training-progress-fill-inline.progress-waiting,
.training-progress-fill.progress-waiting {
  background: linear-gradient(90deg, #f59e0b, #d97706) !important;
  animation: progress-pulse 1.5s ease-in-out infinite;
}

.training-progress-fill-inline.progress-error,
.training-progress-fill.progress-error {
  background: linear-gradient(90deg, #ef4444, #dc2626) !important;
  animation: none;
}

.training-progress-text-inline.progress-text-waiting,
.training-progress-text.progress-text-waiting {
  color: #fbbf24;
}

.training-progress-text-inline.progress-text-error,
.training-progress-text.progress-text-error {
  color: #fca5a5;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ==============================================================================
   REGISTER FOR INFERENCE BUTTON
   ============================================================================== */

.btn-config-register {
  padding: 3px 8px;
  border: 1px solid #7c3aed;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.15s;
  background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
  color: #e9d5ff;
  white-space: nowrap;
}

.btn-config-register:hover:not(:disabled) {
  background: linear-gradient(135deg, #5b21b6 0%, #6d28d9 100%);
  border-color: #8b5cf6;
  color: #f5f3ff;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
  transform: translateY(-1px);
}

.btn-config-register:active:not(:disabled) {
  transform: translateY(0);
}

.btn-config-register.registered {
  background: #065f46;
  border-color: #059669;
  color: #a7f3d0;
  cursor: default;
  opacity: 0.85;
}

.btn-config-register:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Interrupted status */
.status-interrupted {
  background: #b45309;
  color: white;
}

.detail-status.interrupted {
  background: #b45309;
  color: white;
}

/* ==============================================================================
   ORGANIZATION DISPLAY
   ============================================================================== */

.org-display {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(153, 102, 255, 0.12);
  border: 1px solid rgba(153, 102, 255, 0.3);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #c4b5fd;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-display .org-icon {
  font-size: 11px;
  flex-shrink: 0;
}

.org-display .org-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-display.hidden {
  display: none !important;
}

.btn-config-restart {
  padding: 3px 8px;
  border: 1px solid #d97706;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.15s;
  background: #78350f;
  color: #fcd34d;
}

.btn-config-restart:hover {
  background: #92400e;
  border-color: #f59e0b;
  color: #fef3c7;
}

/* Unregister button */
.btn-config-unregister {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-config-unregister:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
}