/* ═══════════════════════════════════════════════════════════════
   LAB — datasets · tuning · configs · eval gate
   Reuses .panel / .metric / .tbl / .fld / .pip from styles.css;
   only the tab strip, the plan sheet and the two charts are new.
   ═══════════════════════════════════════════════════════════════ */

/* ── tab strip ─────────────────────────────────────────────── */
.lab-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--b2);
}
.lab-tabs .tab {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  font-family: var(--mono);
  color: var(--t3);
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--r-c);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lab-tabs .tab:hover { color: var(--t1); border-color: var(--b3); }
.lab-tabs .tab.active {
  color: var(--t1);
  background: var(--s2);
  border-color: var(--t1);
}
.lab-tabs-rule { flex: 1; }

/* ── tables ────────────────────────────────────────────────── */
.lab-tbl th, .lab-tbl td { padding-left: 10px; padding-right: 10px; }
.lab-tbl th:first-child, .lab-tbl td:first-child { padding-left: 16px; }
.lab-tbl th:last-child, .lab-tbl td:last-child { padding-right: 16px; }

.lab-tbl tr.lab-sel td { background: var(--s3); }
.lab-tbl tbody tr { cursor: pointer; }

.lab-sub {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  margin-top: 2px;
}

.lab-up   { color: var(--mint); }
.lab-warn { color: var(--hold); }
.lab-err  { color: var(--fail); }

/* ── panel footers with an explanation ─────────────────────── */
.lab-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--b2);
  background: var(--s2);
  font-size: 11px;
  line-height: 1.6;
}
.lab-foot .kw { color: var(--t1); font-family: var(--mono); }

/* ── empty states ──────────────────────────────────────────── */
.lab-empty {
  padding: 30px 24px;
  text-align: center;
  color: var(--t3);
  font-size: 12px;
  line-height: 1.7;
}
.lab-empty .big {
  font-size: 13px;
  font-weight: 700;
  color: var(--t2);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.lab-empty a { color: var(--t1); }

/* ── key/value plan sheet ──────────────────────────────────── */
.lab-kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--b1);
  font-size: 12px;
}
.lab-kv:last-child { border-bottom: 0; }
.lab-kv > span:first-child {
  color: var(--t3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.lab-kv > span:last-child { text-align: right; }
.lab-kv.lab-diff > span:last-child { color: var(--t1); }
.lab-kv.lab-diff s { color: var(--t3); text-decoration-color: var(--t2); }

.lab-alert {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--fail);
  border-radius: var(--r-c);
  color: var(--t1);
  background: var(--fail-wash);
  font-size: 11px;
  line-height: 1.6;
}

.lab-hint {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
  color: var(--t3);
}

/* ── loss curve ────────────────────────────────────────────── */
.lab-loss { width: 100%; height: 130px; display: block; }
.lab-loss .line { fill: none; stroke: color-mix(in srgb, var(--t1) 72%, transparent); stroke-width: 1.6; }
.lab-loss .grid { stroke: var(--b2); stroke-width: 1; stroke-dasharray: 3 4; }

.lab-prog {
  position: relative;
  height: 6px;
  margin-top: 10px;
  background: var(--s3);
  border: 1px solid var(--b2);
  border-radius: var(--r-chip);
  overflow: hidden;
}
.lab-prog > i {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  background: var(--t1);
  transition: width 0.5s linear;
}

/* ── dataset composition bar ───────────────────────────────── */
.lab-comp { margin-bottom: 18px; }
.lab-comp:last-child { margin-bottom: 0; }
.lab-comp-h {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 6px;
}
.lab-comp-bar {
  display: flex;
  height: 14px;
  border: 1px solid var(--b2);
  border-radius: var(--r-chip);
  overflow: hidden;
}
.lab-comp-bar > i { display: block; height: 100%; }
.lab-comp-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
}
.lab-comp-key span { display: inline-flex; align-items: center; gap: 5px; }
.lab-comp-key i { width: 8px; height: 8px; display: inline-block; }

/* op categories, not states: neutral tones told apart by fill pattern */
.lab-comp-bar > i.c0, .lab-comp-key i.c0 { background: var(--t1); }
.lab-comp-bar > i.c1, .lab-comp-key i.c1 { background: repeating-linear-gradient(135deg, var(--t1) 0 2px, transparent 2px 5px); }
.lab-comp-bar > i.c2, .lab-comp-key i.c2 { background: radial-gradient(var(--t1) 1px, transparent 1.3px) 0 0 / 4px 4px; }
.lab-comp-bar > i.c3, .lab-comp-key i.c3 { background: repeating-linear-gradient(90deg, var(--t1) 0 1px, transparent 1px 3px); }
.lab-comp-bar > i.c4, .lab-comp-key i.c4 { background: var(--t3); }
.lab-comp-bar > i.c5, .lab-comp-key i.c5 { background: var(--b3); }

/* ── explanatory notes ─────────────────────────────────────── */
.lab-note {
  padding: 10px 0;
  border-bottom: 1px solid var(--b1);
  font-size: 12px;
  line-height: 1.65;
  color: var(--t2);
}
.lab-note:last-child { border-bottom: 0; }
.lab-note b { color: var(--t1); font-family: var(--mono); font-size: 11px; }

/* ── config grid ───────────────────────────────────────────── */
.lab-cfg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.lab-cfg .fld.lab-changed label { color: var(--t1); }
.lab-cfg .fld.lab-changed .input,
.lab-cfg .fld.lab-changed .select { border-color: var(--t1); }

@media (max-width: 1200px) {
  .lab-cfg { grid-template-columns: repeat(2, 1fr); }
}
