:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #20242a;
  --muted: #667085;
  --line: #d9dee5;
  --green: #18794e;
  --blue: #1f6feb;
  --amber: #b26a00;
  --red: #c62828;
  --violet: #6f42c1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  line-height: 1.5;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.data-note,
.muted {
  color: var(--muted);
}

.run-meta {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 12px;
  min-width: 280px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  font-size: 13px;
}

.run-meta dt {
  color: var(--muted);
}

.run-meta dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
}

main {
  display: grid;
  gap: 18px;
  padding: 20px 32px 32px;
}

.band {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.summary-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.agent-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.agent-card {
  min-width: 0;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.agent-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-top: 5px;
  font-size: 13px;
}

.metric-row span:first-child {
  color: var(--muted);
  flex: 0 0 auto;
}

.metric-row span:last-child,
.metric-row code {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.metric-row code {
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.score {
  display: inline-flex;
  width: 58px;
  justify-content: center;
  padding: 3px 0;
  border-radius: 6px;
  background: #f0f6ff;
  color: var(--blue);
  font-weight: 760;
}

.status-approved,
.status-completed {
  background: #e9f7ef;
  color: var(--green);
}

.status-conditional,
.status-completed_after_dependencies {
  background: #fff7e8;
  color: var(--amber);
}

.status-downgraded {
  background: #f3edff;
  color: var(--violet);
}

.status-rejected {
  background: #fdecec;
  color: var(--red);
}

.review-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.52fr);
  gap: 18px;
}

.review-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.review-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.review-column ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-column li {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.review-column li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.briefing-panel {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.briefing-content {
  max-height: 620px;
  overflow: auto;
  padding-right: 8px;
  font-size: 14px;
}

.briefing-content h1 {
  font-size: 20px;
}

.briefing-content h2 {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 16px;
}

.briefing-content h3 {
  margin-top: 14px;
}

.briefing-content ul,
.briefing-content ol {
  padding-left: 20px;
}

.error {
  padding: 14px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: #fff5f5;
  color: var(--red);
}

@media (max-width: 980px) {
  .topbar,
  .review-layout {
    grid-template-columns: 1fr;
  }

  .agent-grid,
  .review-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .run-meta {
    min-width: 0;
    width: 100%;
  }

  .briefing-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 16px;
  }
}

@media (max-width: 640px) {
  .topbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 22px;
  }

  .agent-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-pill,
  .badge {
    white-space: normal;
  }
}
