/* ── reset & base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #222;
  background: #fafafa;
  display: flex;
  flex-direction: column;
}

/* ── toolbar (mirrors compare.css for visual consistency) ───────────── */
#toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 16px; background: #fff;
  border-bottom: 1px solid #e0e0e0; flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.app-title { font-weight: 700; font-size: 16px; margin-right: 6px; }
.back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  background: #f0f0f0; color: #444; text-decoration: none;
  font-size: 16px; font-weight: 700; flex-shrink: 0; transition: background 0.15s;
}
.back-btn:hover { background: #ddd; }
#toolbar label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #555; }
#toolbar select {
  padding: 4px 8px; border: 1px solid #ccc; border-radius: 4px;
  font-size: 13px; background: #fff;
}
.filter-toggle { cursor: pointer; user-select: none; }
.annotators-tag { font-size: 12px; color: #555; }
.stats { font-size: 12px; color: #888; margin-left: auto; }

#readonly-note {
  padding: 5px 16px; font-size: 12px; color: #6b5e00;
  background: #fff7d6; border-bottom: 1px solid #f0e6a8; flex-shrink: 0;
}

/* ── summary header ────────────────────────────────────────────────── */
#summary {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start;
  padding: 12px 16px; background: #fff; border-bottom: 1px solid #e0e0e0;
}
.summary-block { display: flex; flex-direction: column; gap: 4px; }
.summary-block h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: #999; font-weight: 700; margin-bottom: 2px;
}
.metric-row { display: flex; gap: 14px; }
.metric { display: flex; flex-direction: column; align-items: flex-start; }
.metric .val { font-size: 20px; font-weight: 700; line-height: 1; }
.metric .lbl { font-size: 11px; color: #888; }

/* confusion matrix */
table.confusion { border-collapse: collapse; font-size: 12px; }
table.confusion th, table.confusion td {
  border: 1px solid #e2e2e2; padding: 3px 8px; text-align: center; min-width: 34px;
}
table.confusion th { background: #f6f6f6; color: #555; font-weight: 600; }
table.confusion td.diag { background: #eef7f0; font-weight: 700; }
table.confusion td.off { background: #fdeef0; }
table.confusion td.zero { color: #ccc; }
.confusion-axislabel { font-size: 10px; color: #aaa; }

/* per-annotator correction chips */
.ann-counts { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.ann-counts .ann-name { font-weight: 700; }
.count-chip {
  display: inline-block; padding: 1px 6px; border-radius: 9px;
  font-size: 11px; margin-right: 4px;
}

/* ── main ──────────────────────────────────────────────────────────── */
#main { padding: 14px 16px 60px; overflow-y: auto; }
.section { margin-bottom: 26px; }
.section-heading {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em;
  color: #777; border-bottom: 2px solid #eee; padding-bottom: 5px; margin-bottom: 12px;
}

/* ── model policy rows ─────────────────────────────────────────────── */
.policy-row {
  background: #fff; border: 1px solid #e6e6e6; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
}
.policy-row.divergent { border-left: 4px solid #D41159; }
.policy-row.consensus-corr { border-left: 4px solid #FFD400; }
.policy-row.agreed-approved { border-left: 4px solid #00BF7F; }

.pr-head { display: flex; align-items: baseline; gap: 8px; }
.pr-idx { font-size: 11px; color: #999; font-variant-numeric: tabular-nums; }
.pr-title { font-weight: 700; }
.pr-area { font-size: 11px; color: #999; }
.pr-desc { color: #444; margin: 4px 0 6px; }

.pr-labels { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.lab-pair { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.lab-pair .who { color: #888; }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; color: #fff;
}
.badge.approved { background: #00BF7F; }
.badge.split    { background: #1A85FF; }
.badge.merged   { background: #4F2C99; }
.badge.deleted  { background: #D41159; }
.badge.added    { background: #ff6333; }
.badge.missing  { background: #ccc; color: #fff; }

.div-flag {
  margin-left: auto; font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: 10px;
}
.div-flag.diverge { background: #fdeef0; color: #D41159; }
.div-flag.agree   { background: #eef7f0; color: #00875a; }

.pr-notes { margin-top: 6px; font-size: 12px; }
.pr-note { color: #555; }
.pr-note .who { font-weight: 700; color: #444; }

.excerpt-toggle {
  font-size: 11px; color: #1A85FF; cursor: pointer; user-select: none;
  margin-top: 4px; display: inline-block;
}
.excerpt-body {
  display: none; margin-top: 5px; padding: 7px 10px;
  background: #f7f8fa; border-left: 3px solid #cdd6e0;
  font-size: 12.5px; color: #333; border-radius: 0 4px 4px 0; white-space: pre-wrap;
}
.excerpt-body.open { display: block; }

/* ── added policies ────────────────────────────────────────────────── */
.added-cols { display: flex; gap: 16px; align-items: flex-start; }
.added-col { flex: 1; min-width: 0; }
.added-col h4 { font-size: 12px; color: #777; margin-bottom: 8px; }
.added-card {
  background: #fff; border: 1px solid #e6e6e6; border-radius: 8px;
  padding: 9px 11px; margin-bottom: 8px;
}
.added-card.matched { border-left: 4px solid #00BF7F; }
.added-card.only    { border-left: 4px solid #ff6333; }
.added-card .ac-title { font-weight: 700; font-size: 13px; }
.added-card .ac-exc { font-size: 12px; color: #444; margin-top: 4px; }
.added-card .ac-tag { font-size: 10px; color: #999; }

.matched-pair {
  display: flex; gap: 12px; background: #f4fbf7; border: 1px solid #cfeede;
  border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
}
.matched-pair .mp-col { flex: 1; min-width: 0; }
.matched-pair .mp-who { font-size: 11px; font-weight: 700; color: #00875a; }

/* ── merge groups ──────────────────────────────────────────────────── */
.merge-block { margin-bottom: 12px; }
.merge-block h4 { font-size: 12px; color: #777; margin-bottom: 6px; }
.merge-grp {
  background: #fff; border: 1px solid #e6e6e6; border-left: 4px solid #4F2C99;
  border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.merge-grp .mg-idx { font-size: 11px; color: #4F2C99; font-weight: 700; }
.merge-grp .mg-member { font-size: 12px; color: #444; }
.merge-grp .mg-note { font-size: 12px; color: #666; font-style: italic; margin-top: 4px; }

.empty { color: #aaa; font-size: 13px; font-style: italic; }
.gap-note {
  background: #fff7d6; border: 1px solid #f0e6a8; color: #6b5e00;
  padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px;
}
