/* Interactive evals assistant: the labelling cards, failure types, checks and judge results drawn inside answers.
   Only the chat tokens (--surface, --border, --ink, --muted, --tool, --good, --bad, --warn) are used, so light and
   dark mode follow kit/chat.css. */

.k-btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.k-btn:disabled { opacity: 0.4; cursor: default; }
.k-btn.ghost:disabled:hover { background: transparent; }

.e4-wait { border: 2px dashed var(--border); border-radius: 14px; padding: 18px; margin: 14px 0; }
.e4-muted { color: var(--muted); }
.e4-small { font-size: 13.5px; }
.e4-hint { margin: 10px 0 0; font-size: 14px; }
.e4-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- labelling ---------- */
.e4-label { margin: 14px 0; border: 1px solid var(--border); border-radius: 18px; padding: 16px; background: var(--surface); }
.e4-about { font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.e4-about summary { cursor: pointer; font-weight: 600; }
.e4-about ul { margin: 8px 0 0; padding-left: 20px; }
.e4-about li { margin: 5px 0; }
.e4-about q { font-style: italic; }
.e4-progress { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.e4-progress .e4-muted { font-weight: 400; }
.e4-strip { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.e4-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent;
  color: var(--muted); font: 500 12.5px/1 var(--font); cursor: pointer; padding: 0;
}
.e4-dot.pass { background: color-mix(in srgb, var(--good) 18%, transparent); border-color: var(--good); color: var(--ink); }
.e4-dot.fail { background: color-mix(in srgb, var(--bad) 18%, transparent); border-color: var(--bad); color: var(--ink); }
.e4-dot.on { outline: 2px solid var(--ink); outline-offset: 1px; }

.e4-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface-2); }
.e4-msg { margin-bottom: 10px; }
.e4-who { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.e4-text { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: 15px; line-height: 1.55; }
.e4-msg.reply .e4-text { border-left: 3px solid var(--tool); }
.e4-article { font-size: 14px; margin: 4px 0 10px; }
.e4-article summary { cursor: pointer; color: var(--muted); }
.e4-article-body { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--border-strong); }
.e4-article-body p { white-space: pre-wrap; margin: 4px 0 8px; }
.e4-verdict { display: flex; gap: 10px; margin: 6px 0 4px; }
.e4-pf {
  flex: 1; max-width: 160px; height: 42px; border-radius: 999px; font: 600 15px/1 var(--font); cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--border-strong);
}
.e4-pf.pass:hover, .e4-pf.pass.on { border-color: var(--good); }
.e4-pf.fail:hover, .e4-pf.fail.on { border-color: var(--bad); }
.e4-pf.pass.on { background: var(--good); color: #fff; }
.e4-pf.fail.on { background: var(--bad); color: #fff; }
.e4-note-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.e4-note {
  flex: 1; min-width: 0; resize: vertical; border: 1px solid var(--border-strong); border-radius: 12px; padding: 9px 11px;
  font: 15px/1.45 var(--font); color: var(--ink); background: var(--surface);
}
.e4-note:focus { outline: 2px solid var(--tool); outline-offset: 0; }
.e4-nav { display: flex; justify-content: space-between; margin-top: 12px; }
.e4-done { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.e4-done p { margin: 0 0 4px; }
.e4-compare { margin-top: 12px; font-size: 14.5px; }
.e4-tag { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 13px; font-weight: 600; }
.e4-tag.pass { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.e4-tag.fail { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }

/* ---------- failure types ---------- */
.e4-types { margin: 14px 0; border: 1px solid var(--border); border-radius: 18px; padding: 16px; }
.e4-types-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: 14px; }
.e4-types-head b { font: 500 19px/1.3 var(--font-display); }
.e4-type { padding: 10px 0; border-top: 1px solid var(--border); }
.e4-type-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.e4-type-name { font-weight: 600; }
.e4-count { font: 600 20px/1 var(--font-display); }
.e4-bar { height: 8px; border-radius: 99px; background: var(--surface-2); margin: 6px 0; overflow: hidden; }
.e4-bar i { display: block; height: 100%; background: var(--tool); border-radius: 99px; }
.e4-def { color: var(--muted); font-size: 14px; margin: 2px 0; }
.e4-notes { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.e4-notes li { margin: 2px 0; }
.e4-warn { margin-top: 10px; padding: 9px 12px; border-radius: 10px; font-size: 14px; color: var(--warn); border: 1px solid currentColor; }

/* ---------- checks ---------- */
.e4-checks { margin: 14px 0; display: grid; gap: 12px; }
.e4-check { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; }
.e4-check.judge { border-color: color-mix(in srgb, var(--tool) 55%, var(--border)); }
.e4-check-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.e4-kind { font-size: 12px; font-weight: 600; letter-spacing: 0.03em; border-radius: 6px; padding: 2px 8px; white-space: nowrap; border: 1px solid var(--border-strong); color: var(--muted); }
.e4-kind.judge { color: var(--tool); border-color: var(--tool); }
.e4-rule { font-size: 15px; margin: 4px 0; }
.e4-said { font-size: 13.5px; margin: 8px 0; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); }
.e4-said.no { border-left: 3px solid var(--warn); }
.e4-check .k-code { margin: 10px 0 0; }
.e4-check .k-code pre { max-height: 320px; }

/* ---------- judge results ---------- */
.e4-results:not(:empty) { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border-strong); }
.e4-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.e4-stat { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.e4-stat b { display: block; font: 500 26px/1.1 var(--font-display); color: var(--tool); }
.e4-stat span { font-size: 13px; color: var(--muted); }
.e4-stat.dim b { color: var(--ink); }
.e4-matrix td.good { color: var(--good); font-weight: 600; }
.e4-matrix td.bad { color: var(--bad); font-weight: 600; }
.e4-sub { font-weight: 600; margin: 14px 0 0; }
.e4-all { margin-top: 10px; font-size: 14px; }
.e4-all summary { cursor: pointer; color: var(--muted); }
.e4-all tr.diff td { background: color-mix(in srgb, var(--warn) 9%, transparent); }

@media (max-width: 560px) {
  .e4-label, .e4-types { padding: 12px; }
  .e4-card { padding: 10px; }
  .e4-stats { grid-template-columns: 1fr; }
  .e4-stat { display: flex; align-items: baseline; gap: 10px; }
  .e4-stat b { font-size: 22px; min-width: 64px; }
  .e4-note-row { flex-direction: column; align-items: stretch; }
}

/* short columns (run number, labels) never break mid-word; the reason column takes the rest */
.e4-results .k-table th, .e4-results .k-table td, .e4-compare .k-table th, .e4-compare .k-table td { overflow-wrap: normal; word-break: normal; }
.e4-results .k-table td:first-child, .e4-results .k-table th:first-child,
.e4-compare .k-table td:first-child, .e4-compare .k-table th:first-child { white-space: nowrap; }
.e4-results .k-table td:nth-child(2), .e4-compare .k-table td:nth-child(2) { min-width: 120px; }
.e4-results .k-table td:nth-child(3), .e4-compare .k-table td:nth-child(3) { white-space: nowrap; }
.e4-results .k-table td:last-child, .e4-compare .k-table td:last-child { min-width: 180px; }
.e4-note-row .k-btn { justify-content: center; }
