* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: #222;
  background: #f5f5f7;
}

body { display: flex; flex-direction: column; height: 100vh; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

header h1 { margin: 0; font-size: 16px; font-weight: 600; }
header .left { display: flex; align-items: baseline; gap: 12px; }
header .right { display: flex; align-items: center; gap: 8px; }
header input[type=text] {
  margin-left: 6px;
  padding: 4px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 13px;
  width: 160px;
}

button {
  padding: 5px 10px;
  border: 1px solid #bbb;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { background: #f0f0f0; }
button.primary {
  background: #2b6cb0;
  color: #fff;
  border-color: #2b6cb0;
  font-weight: 600;
}
button.primary:hover { background: #2256a0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.muted { color: #777; font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(380px, 1fr);
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

#transcript-pane {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.meta-bar {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 18px;
  background: #fafafa;
}
.meta-bar .kv .k { color: #888; margin-right: 4px; }

#transcript {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.turn {
  margin-bottom: 12px;
  border-radius: 6px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid #e3e3e3;
}
.turn.user { background: #eef5ff; border-color: #c8dcf5; }
.turn.assistant { background: #f6f3ee; border-color: #e0d6c4; }
.turn .role {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #555;
  margin-bottom: 6px;
}
.turn.user .role { color: #1f4e8c; }
.turn.assistant .role { color: #6b4e1a; }

#review-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

#label-cards { display: flex; flex-direction: column; gap: 16px; }

.label-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px dashed #d4d4d4;
}
.label-block:last-child { border-bottom: none; }

.multi-banner {
  padding: 8px 12px;
  background: #fff7e0;
  border: 1px solid #e8d27a;
  border-radius: 6px;
  font-size: 13px;
  color: #6b5408;
}
.candidate-caveat {
  padding: 8px 12px;
  background: #eef5ff;
  border: 1px solid #c8dcf5;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #1f4e8c;
}

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px 14px;
}
.card-title {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  color: #666;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.card-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin: 10px 0 6px;
}

.claude-label {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.codebook-def {
  font-size: 12.5px;
  line-height: 1.45;
  color: #444;
  background: #f6f3ff;
  border: 1px solid #ddd1f0;
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 8px;
}
.codebook-def .def-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6a4cab;
  margin-right: 6px;
  vertical-align: 1px;
}
.boundary-disclosure {
  margin-bottom: 8px;
}
.boundary-disclosure summary {
  font-size: 12px;
  font-weight: 600;
  color: #6a4cab;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.boundary-disclosure summary:hover { color: #4a2d8a; }
.boundary-list {
  margin: 4px 0 4px 0;
  padding-left: 20px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #444;
}
.boundary-list li { margin-bottom: 3px; }
.claude-reasoning {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.45;
  color: #333;
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px dashed #eee;
  padding-top: 8px;
}

.agree-row { display: flex; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid #bbb;
  border-radius: 16px;
  cursor: pointer;
  background: #fff;
}
.pill:has(input[value="agree"]:checked) {
  background: #2f8a3b;
  color: #fff;
  border-color: #2f8a3b;
}
.pill:has(input[value="disagree"]:checked) {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

.labels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}
.labels-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}

.actions { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.save-status.save-error { color: #c0392b; font-weight: 600; }

.codebook-link {
  font-size: 13px;
  font-weight: 600;
  color: #6a4cab;
  background: #f6f3ff;
  border: 1px solid #ddd1f0;
  border-radius: 4px;
  padding: 3px 9px;
  text-decoration: none;
  margin-left: 4px;
}
.codebook-link:hover { background: #ede5ff; }

.button-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: #2b6cb0;
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid #bbb;
  border-radius: 4px;
}
.button-link:hover { background: #f0f0f0; }

.codebook-page main.codebook-main {
  display: block;
  overflow-y: auto;
  padding: 20px 32px;
  max-width: 900px;
  margin: 0 auto;
}
.annotator-guidelines {
  background: #eef5ff;
  border: 1px solid #c8dcf5;
  border-left: 4px solid #2b6cb0;
  border-radius: 6px;
  padding: 14px 22px 14px 22px;
  margin-bottom: 28px;
}
.annotator-guidelines h2 { color: #1f4e8c; }
.annotator-guidelines h2 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #6a4cab;
}
.annotator-guidelines ol {
  margin: 0;
  padding-left: 22px;
}
.annotator-guidelines li {
  font-size: 14px;
  line-height: 1.55;
  color: #333;
  margin-bottom: 8px;
}
.annotator-guidelines li:last-child { margin-bottom: 0; }
.codebook-entry {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.codebook-entry h2 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  color: #6a4cab;
}
.codebook-entry p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}
.codebook-entry h3 {
  margin: 10px 0 4px 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6a4cab;
}

.done-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #d6f5d6;
  color: #1f6f1f;
  font-size: 11px;
  font-weight: 700;
}

/* Conversations carried over from round 1 — parked at the end of the queue. */
.round1-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #ede4d3;
  color: #7a5c1e;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}

/* --- verification round additions --- */

.pill:has(input[value="accept"]:checked) {
  background: #2f8a3b;
  color: #fff;
  border-color: #2f8a3b;
}
.pill:has(input[value="not_english"]:checked) {
  background: #6b7280;
  color: #fff;
  border-color: #6b7280;
}
.pill:has(input[value="reject"]:checked) {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

.extra-card {
  background: #fbf9f2;
  border-color: #e0d8ba;
}
.extra-card .card-title { color: #8a6d1a; }

.peer-disclosure {
  margin-top: 10px;
  border-top: 1px dashed #e3e3e3;
  padding-top: 6px;
}
.peer-disclosure summary { color: #666; }
.peer-disclosure summary:hover { color: #333; }
.peer-list { list-style: none; padding-left: 4px; }
.peer-name { font-weight: 600; }
.peer-decision.accept { color: #1f6f1f; font-weight: 600; }
.peer-decision.reject { color: #a52a1c; font-weight: 600; }
.peer-decision.not_english { color: #6b7280; font-weight: 600; }
.peer-decision.extra_codes { color: #8a6d1a; }
.peer-note { color: #555; font-style: italic; margin-top: 2px; }

.hash-search { position: relative; }
.hash-search input {
  width: 200px;
  padding: 4px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.hash-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  min-width: 380px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.hash-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.hash-item:last-child { border-bottom: none; }
.hash-item:hover, .hash-item.active { background: #eef5ff; }
.hash-item .mono { font-size: 12px; }
.hash-labels { color: #777; font-size: 11px; }
.hash-empty { color: #999; cursor: default; }
.hash-empty:hover { background: #fff; }

.quote-link {
  color: #2b6cb0;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 2px;
  cursor: pointer;
}
.quote-link:hover { background: #eef5ff; }

mark.quote-mark {
  background: #ffe86b;
  border-radius: 2px;
  padding: 0 1px;
}

.turn-flash {
  border-color: #e0b800 !important;
  box-shadow: 0 0 0 2px #ffe86b;
  transition: box-shadow 0.3s;
}

.run-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.run-badge.running { background: #fff3cd; color: #7a5a00; border: 1px solid #e6cf7a; }
.run-badge.complete { background: #d6f5d6; color: #1f6f1f; border: 1px solid #a8dfa8; }

.verdict-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.verdict-chip.v1 { background: #e2efe2; color: #1f6f1f; }
.verdict-chip.v0 { background: #f3e2e2; color: #8a2a1f; }

.mode-toggle select {
  padding: 4px 6px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}

/* Advisory: automated guess that a conversation may not be in English.
   Never a decision — the annotator confirms and presses "Not English". */
.lang-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}

/* Conversation restored to the main queue after a human overruled the
   automated language flag. */
.restored-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #d6f5d6;
  color: #1f6f1f;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}

/* Language override control, shown on flagged conversations. */
.language-card { border-left: 4px solid #9ca3af; }
.language-note {
  margin: 0 0 10px 0;
  font-size: 13px;
  line-height: 1.45;
  color: #444;
}
.language-btn {
  padding: 6px 12px;
  border: 1px solid #bbb;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.language-btn.primary {
  background: #2b6cb0;
  color: #fff;
  border-color: #2b6cb0;
}
.language-btn.primary:hover { background: #2256a0; }
.language-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.language-card .save-status { margin-left: 10px; }
