@font-face {
  font-family: "Material Symbols Rounded";
  src: url("material-symbols-rounded.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
}

:root {
  --page: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #f1f3f6;
  --text: #1f2530;
  --muted: #697386;
  --border: #dde1e7;
  --border-strong: #cbd1da;
  --selected: #e7f0ff;
  --selected-edge: #3973db;
  --blue: #3068d6;
  --green: #2f7d58;
  --amber: #9a640d;
  --red: #b23a43;
  --binder: #7254a5;
  --critic: #9a640d;
  --verifier: #2f7d58;
  --system: #697386;
  --header-height: 122px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--page);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

button, input, select { font: inherit; }

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 21px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr) 150px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.task-picker,
.task-summary,
.score-summary {
  min-width: 0;
  padding: 18px 20px;
}

.task-picker {
  border-right: 1px solid var(--border);
}

.product-name {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 600;
}

.product-name .material-symbols-rounded {
  color: var(--blue);
}

.product-button {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
}

.task-picker label,
.score-label,
.task-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

#task-select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface-muted);
}

.task-summary {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  align-content: center;
}

.task-icon {
  margin-top: 17px;
  color: var(--blue);
  font-size: 25px;
}

.task-instruction {
  display: -webkit-box;
  overflow: hidden;
  color: #3b4556;
  font-size: 16px;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.score-summary {
  display: flex;
  flex-direction: column;
  gap: 13px;
  align-items: flex-end;
  justify-content: center;
  border-left: 1px solid var(--border);
  text-align: right;
}

.score-value {
  display: block;
  font-size: 25px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-chip,
.role-chip,
.meta-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-chip {
  color: var(--muted);
  background: var(--surface-muted);
}

.status-chip.pass { color: var(--green); background: #e9f5ef; }
.status-chip.zero { color: var(--red); background: #fbecee; }
.status-chip.partial { color: var(--blue); background: #eaf1ff; }
.status-chip.failed { color: var(--amber); background: #fff4df; }

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 36%) minmax(0, 64%);
  height: calc(100vh - var(--header-height));
}

.task-list-view {
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 22px max(24px, calc((100vw - 1180px) / 2)) 60px;
  background: var(--page);
}

.task-list-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 180px;
  gap: 10px;
  padding: 0 0 14px;
  background: var(--page);
}

.task-list-search {
  display: flex;
  height: 40px;
  gap: 8px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
}

.task-list-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
}

.task-list-count {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.task-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.task-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 80px 90px 100px 34px;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  align-items: center;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #e8ebef;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row:hover {
  background: #f7f9fc;
}

.task-row-id {
  color: var(--muted);
  font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.task-row-instruction {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.task-row-score {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.task-row-calls {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.task-row-status {
  display: flex;
  justify-content: flex-end;
}

.task-row-arrow {
  color: var(--muted);
}

.timeline-pane {
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.timeline-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 135px 36px;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.filter-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: var(--page);
  cursor: pointer;
}

.filter-button[aria-pressed="true"] {
  color: var(--red);
  border-color: #e4a9ae;
  background: #fbecee;
}

.filter-button .material-symbols-rounded {
  font-size: 18px;
}

.search-box,
.compact-select {
  display: flex;
  height: 36px;
  gap: 7px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: var(--page);
}

.search-box input,
.compact-select select {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 13px;
}

.search-box .material-symbols-rounded,
.compact-select .material-symbols-rounded {
  font-size: 18px;
}

.timeline-count {
  height: 29px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.timeline {
  height: calc(100% - 78px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  min-height: 66px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #e8ebef;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.timeline-item:hover {
  background: #f7f9fc;
}

.timeline-item.selected {
  box-shadow: inset 4px 0 0 var(--selected-edge);
  background: var(--selected);
}

.timeline-item.child {
  padding-left: 35px;
  background: #fafbfc;
}

.timeline-item.child.selected {
  background: var(--selected);
}

.timeline-item .event-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  color: var(--system);
  background: var(--surface-muted);
}

.timeline-item .event-icon .material-symbols-rounded {
  font-size: 18px;
}

.timeline-item[data-role="Actor"] .event-icon {
  color: var(--blue);
  background: #eaf1ff;
}

.timeline-item[data-role="Binder"] .event-icon {
  color: var(--binder);
  background: #f1ebf8;
}

.timeline-item[data-role="Critic"] .event-icon {
  color: var(--critic);
  background: #fff3df;
}

.timeline-item[data-role="Verifier"] .event-icon {
  color: var(--verifier);
  background: #e9f5ef;
}

.timeline-item.error .event-icon {
  color: var(--red);
  background: #fbecee;
}

.timeline-row-top {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.timeline-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.timeline-time {
  color: #8992a1;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.timeline-title {
  overflow: hidden;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-note {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expand-button {
  position: absolute;
  top: 37px;
  left: 7px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.expand-button .material-symbols-rounded {
  font-size: 18px;
}

.detail-pane {
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--page);
}

.detail {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 26px 30px 70px;
}

.detail-empty {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.detail-empty .material-symbols-rounded {
  font-size: 36px;
}

.detail-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.detail-header h1 {
  margin: 5px 0 0;
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.role-chip.Actor { color: var(--blue); background: #eaf1ff; }
.role-chip.Binder { color: var(--binder); background: #f1ebf8; }
.role-chip.Critic { color: var(--critic); background: #fff3df; }
.role-chip.Verifier { color: var(--verifier); background: #e9f5ef; }
.role-chip.System { color: var(--system); background: var(--surface-muted); }

.meta-chip {
  color: var(--muted);
  background: var(--surface-muted);
  font-weight: normal;
}

.detail-nav {
  display: flex;
  gap: 6px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--blue);
  border-color: #abc2ed;
}

.detail-section {
  margin-top: 22px;
}

.section-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 9px;
  color: #4a5566;
  font-size: 13px;
  font-weight: 600;
}

.section-heading .material-symbols-rounded {
  color: var(--muted);
  font-size: 18px;
}

.text-panel,
.reasoning-panel,
.report-panel,
.meta-panel {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reasoning-panel {
  border-left: 3px solid #8db0ed;
  background: #f7faff;
}

.report-panel {
  border-left: 3px solid #a89ac2;
}

.formatted-report p {
  margin: 0 0 11px;
}

.formatted-report p:last-child {
  margin-bottom: 0;
}

.formatted-report ul {
  margin: 6px 0 12px 21px;
  padding: 0;
}

.formatted-report li {
  margin: 4px 0;
}

.semibold {
  font-weight: 600;
}

.inline-code {
  padding: 1px 4px;
  border-radius: 4px;
  color: #374151;
  background: #edf0f4;
  font: 0.92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-panel {
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: #20242b;
}

.code-toolbar {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 13px;
  color: #c6ccd6;
  border-bottom: 1px solid #353b45;
  background: #292e36;
  font-size: 12px;
}

.copy-button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid #454c58;
  border-radius: 5px;
  color: #d8dde5;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.copy-button .material-symbols-rounded {
  font-size: 15px;
}

pre {
  max-height: 560px;
  margin: 0;
  overflow: auto;
  padding: 15px;
  color: #edf0f5;
  background: #20242b;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.observation-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.observation-summary .material-symbols-rounded {
  font-size: 18px;
}

.observation-summary.error {
  color: var(--red);
}

.image-panel {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: #eef1f5;
}

.image-panel button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-panel img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.image-panel figcaption {
  padding: 9px 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
}

.budget {
  min-width: 130px;
}

.budget-track {
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e6ec;
}

.budget-track span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.unresolved {
  margin: 10px 0 0 20px;
  padding: 0;
}

.raw-details {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.raw-details summary {
  padding: 13px 0;
  cursor: pointer;
}

.raw-details pre {
  max-height: 400px;
  border-radius: 7px;
}

.loading {
  position: fixed;
  z-index: 20;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  box-shadow: 0 5px 18px rgba(35, 42, 53, 0.1);
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

dialog {
  width: min(96vw, 1800px);
  max-width: none;
  max-height: 96vh;
  padding: 48px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

dialog::backdrop {
  background: rgba(15, 18, 24, 0.82);
}

dialog img {
  display: block;
  width: 100%;
  max-height: 86vh;
  object-fit: contain;
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
}

@media (max-width: 900px) {
  :root { --header-height: 164px; }

  .topbar {
    grid-template-columns: minmax(230px, 40%) minmax(0, 60%);
    grid-template-rows: 114px 50px;
  }

  .score-summary {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding: 7px 16px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .workspace {
    grid-template-columns: 42% 58%;
  }

  .detail {
    padding: 18px 18px 60px;
  }
}

@media (max-width: 640px) {
  html, body { overflow: auto; }
  :root { --header-height: auto; }

  .topbar {
    position: static;
    display: block;
    height: auto;
  }

  .task-picker,
  .task-summary,
  .score-summary {
    border: 0;
    border-bottom: 1px solid var(--border);
  }

  .workspace {
    display: block;
    height: auto;
  }

  .timeline-pane {
    height: 48vh;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .detail-pane {
    min-height: 60vh;
  }
}
