:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --line: #d8dee4;
  --text: #17212b;
  --muted: #68727d;
  --accent: #1c7c70;
  --accent-2: #315f9f;
  --warn: #9a5b12;
  --bad: #a43d3d;
  --ok: #257653;
  --soft: #f7faf9;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  flex: none;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
}

.brand {
  min-width: 180px;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: 19px;
  font-weight: 700;
}

h2 {
  font-size: 15px;
  font-weight: 700;
}

h3 {
  font-size: 14px;
  font-weight: 650;
}

.meta, .counter {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
}

.toolbar.hidden {
  display: none;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tab-button {
  height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.tab-button.active {
  background: #e9f4f2;
  color: #1d5f57;
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px;
  border: 1px solid #edf0f2;
  border-radius: 8px;
  background: #fff;
}

.group-label {
  padding: 0 4px 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.toggle, .field, .file-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  color: var(--muted);
}

.file-button {
  cursor: pointer;
  color: var(--text);
  font-weight: 650;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.field input, .field select {
  width: 48px;
  border: 0;
  outline: 0;
  font: inherit;
  color: var(--text);
  background: transparent;
}

#kafka-count {
  width: 42px;
}

.field select {
  width: 76px;
}

button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 650;
  cursor: pointer;
}

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(400px, 1.5fr) minmax(240px, 0.85fr);
  gap: 12px;
  padding: 12px;
}

.worker-layout {
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.worker-layout .pane {
  flex: 1;
  min-height: 0;
}

.view.hidden {
  display: none;
}

.pane {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane-head {
  flex: none;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
}

.list, .result {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.item {
  width: 100%;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px;
  height: auto;
  display: block;
  cursor: pointer;
}

.item:hover {
  background: #f5f8fa;
}

.item.active {
  border-color: #9fcfc7;
  background: #eef8f6;
  box-shadow: inset 3px 0 0 var(--accent);
}

.news-pane .item-body {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-pane .item.active .item-body {
  display: block;
  overflow: visible;
}

.item + .item {
  margin-top: 6px;
}

.item-title {
  font-size: 13px;
  font-weight: 650;
}

.item-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.item-body {
  margin-top: 7px;
  color: #34404a;
  font-size: 12px;
}

.empty-state {
  margin: 8px;
  padding: 14px;
  border: 1px dashed #cbd5dc;
  border-radius: 7px;
  color: var(--muted);
  background: #fbfcfc;
}

.empty-state h3 {
  color: var(--text);
}

.empty-state p {
  margin-top: 6px;
  font-size: 12px;
}

.review-strip {
  margin-top: 7px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: #34554f;
  font-size: 12px;
}

.review-strip span:not(.badge) {
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef7f5;
}

.compact .item-body {
  display: none;
}

.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 22px;
  border-radius: 5px;
  background: #eef2f5;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

.notice {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid #d7c48b;
  border-radius: 7px;
  background: #fff8df;
  color: #5d4a11;
  font-size: 12px;
}

.confidence {
  width: 94px;
  height: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid #d7e2e0;
  border-radius: 5px;
  background: #f1f4f5;
  color: #17342f;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.confidence-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #a8d7ca, #5db39e);
}

.confidence span {
  position: relative;
  z-index: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #edf1f4;
  color: #4f5963;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.done {
  background: #e8f6ee;
  color: var(--ok);
}

.badge.progress {
  background: #e9f1fb;
  color: var(--accent-2);
}

.badge.promised {
  background: #f1f4f7;
  color: #5c6873;
}

.badge.late {
  background: #fff1dc;
  color: var(--warn);
}

.badge.failed,
.badge.dropped {
  background: #faeaea;
  color: var(--bad);
}

.badge.blocked {
  background: #f2eafa;
  color: #7651a3;
}

.badge.muted {
  background: #f0f1f2;
  color: #747d86;
}

.badge.indexed {
  background: #e6f5f2;
  color: #21675e;
}

.match-strip {
  margin-top: 6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.match-chip {
  min-height: 20px;
  font-size: 11px;
}

.match-more {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.candidate {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  margin-bottom: 8px;
}

.pipeline-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.pipeline-strip span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #d9e4e1;
  border-radius: 5px;
  background: #f5faf8;
  color: #34554f;
  font-size: 12px;
  font-weight: 650;
}

.canonical-block {
  margin-top: 8px;
  border: 1px solid #e1e8ea;
  border-radius: 7px;
  background: #fbfcfc;
}

.canonical-block summary {
  cursor: pointer;
  padding: 7px 9px;
  color: #42615d;
  font-size: 12px;
  font-weight: 700;
}

.canonical-block p {
  padding: 0 9px 9px;
  color: #34404a;
  font-size: 12px;
}

.cycle-head,
.cycle-card,
.history-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  margin-bottom: 10px;
  background: #fff;
}

.cycle-head {
  background: #f7faf9;
}

.history-card.error {
  border-color: #e8b1b1;
  background: #fff8f8;
}

.history-action {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #edf0f2;
  color: #34404a;
  font-size: 12px;
}

.promise-confidence-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.promise-confidence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid #e4eaee;
  border-radius: 7px;
  background: #fff;
}

.promise-confidence-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.mini-list {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.mini-row {
  min-height: 34px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #edf0f2;
  color: #34404a;
  font-size: 12px;
}

.mini-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.terms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.term {
  padding: 2px 6px;
  border-radius: 5px;
  background: #f0f3f5;
  color: var(--muted);
  font-size: 12px;
}

.judge {
  margin-top: 12px;
}

.judge-row {
  border-left: 3px solid var(--accent);
  padding: 9px 10px;
  background: var(--soft);
  margin-top: 8px;
}

.judge-row .candidate-head h3 {
  min-width: 0;
  line-height: 1.35;
}

.judge-row .item-body strong,
.judge-row .item-meta strong {
  color: var(--text);
}

.judge-row.related,
.judge-row.unrelated {
  border-left-color: var(--warn);
}

.judge-row.contradicts,
.judge-row.blocked {
  border-left-color: var(--bad);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, .32);
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(20, 32, 42, .18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-card p {
  padding: 14px;
  color: #34404a;
  font-size: 13px;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f3f5f7;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  font-size: 12px;
}

@media (max-width: 980px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    display: flex;
    flex-direction: column;
  }

  .list, .result {
    max-height: 60vh;
  }
}
