/* === CSS Variables === */
:root {
  --bg: #0b0d17;
  --surface: #151724;
  --surface2: #1d1f2e;
  --surface3: #252839;
  --border: #2a2d3e;
  --border-light: #353850;
  --text: #e8e6e3;
  --text2: #888ba0;
  --text3: #5c5f75;
  --accent: #d3a74b;
  --accent-subtle: rgba(211, 167, 75, 0.12);
  --accent2: #4ecdc4;
  --accent2-subtle: rgba(78, 205, 196, 0.12);
  --accent3: #f4a261;
  --accent3-subtle: rgba(244, 162, 97, 0.12);
  --accent4: #e76f55;
  --accent4-subtle: rgba(231, 111, 85, 0.12);
  --hover: #1e2132;
  --active: #282b3e;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  --page-bg: #0b0d17;
  --theme-toggle-border: var(--border);
  --theme-toggle-color: var(--text2);
  --hdr-gradient: linear-gradient(135deg, var(--accent) 0%, #e0c068 100%);
  /* Fit-level colors: 绿→蓝→黄→红 (高→低) */
  --fit-full: #4ecdc4;
  --fit-full-bg: rgba(78, 205, 196, 0.12);
  --fit-high: #6b9bf5;
  --fit-high-bg: rgba(107, 155, 245, 0.12);
  --fit-partial: #e8b84b;
  --fit-partial-bg: rgba(232, 184, 75, 0.12);
  --fit-low: #e76f55;
  --fit-low-bg: rgba(231, 111, 85, 0.12);
}

/* === Light Theme === */
[data-theme="light"] {
  --bg: #f5f0eb;
  --surface: #ffffff;
  --surface2: #f0ece6;
  --surface3: #e8e2da;
  --border: #d9d2c9;
  --border-light: #c9c1b6;
  --text: #1a1816;
  --text2: #6b655c;
  --text3: #999186;
  --accent: #b8863a;
  --accent-subtle: rgba(184, 134, 58, 0.10);
  --accent2: #2a9d8f;
  --accent2-subtle: rgba(42, 157, 143, 0.10);
  --accent3: #d4823e;
  --accent3-subtle: rgba(212, 130, 62, 0.10);
  --accent4: #c7553a;
  --accent4-subtle: rgba(199, 85, 58, 0.10);
  --hover: #ebe6df;
  --active: #e0d9d0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --page-bg: var(--bg);
  --theme-toggle-border: var(--border-light);
  --theme-toggle-color: var(--text3);
  --hdr-gradient: linear-gradient(135deg, var(--accent) 0%, #d4a04a 100%);
  --fit-full: #2a9d8f;
  --fit-full-bg: rgba(42, 157, 143, 0.10);
  --fit-high: #4a7fc7;
  --fit-high-bg: rgba(74, 127, 199, 0.10);
  --fit-partial: #c49a3a;
  --fit-partial-bg: rgba(196, 154, 58, 0.10);
  --fit-low: #c7553a;
  --fit-low-bg: rgba(199, 85, 58, 0.10);
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #e0c068; text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; color: var(--text); }

h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 600; margin: 1.4rem 0 0.8rem; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; margin: 1.2rem 0 0.6rem; }
h4 { font-size: 14px; font-weight: 600; margin: 0.8rem 0 0.4rem; }

/* === Loading === */
.loading-indicator {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1000;
  gap: 16px;
}
.loading-dots {
  display: flex;
  gap: 8px;
}
.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}
.loading-indicator span {
  font-size: 13px;
  color: var(--text2);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.hidden { display: none !important; }

/* === Layout === */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
  transition: background 0.3s;
}

/* === Header === */
.site-header {
  background: rgba(11, 13, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
}
.header-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.header-top h1 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #e0c068 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.header-subtitle {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}
.header-subtitle a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(211, 167, 75, 0.3); }
.header-subtitle a:hover { color: #e0c068; }

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--theme-toggle-color);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* === Stats Row === */
.stats-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  flex: 1;
  min-width: 120px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-value {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.stat-card .stat-label {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 3px;
  font-weight: 500;
}
.stat-card.stat-subjects .stat-value { color: var(--accent); }
.stat-card.stat-papers .stat-value { color: var(--accent2); }
.stat-card.stat-models .stat-value { color: var(--accent3); }
.stat-card.stat-score .stat-value { color: var(--accent); }

/* === Breadcrumb === */
.breadcrumb {
  font-size: 12px;
  color: var(--text3);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  letter-spacing: 0.01em;
}
.breadcrumb a { color: var(--accent); font-weight: 500; }
.breadcrumb-sep { color: var(--border-light); margin: 0 8px; font-size: 10px; }
.breadcrumb-current { color: var(--text); font-weight: 600; }

/* === Filter Bar === */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-group select,
.filter-group input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface2);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font-sans);
}
.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.filter-group input {
  min-width: 180px;
}
.filter-group input::placeholder { color: var(--text3); }
.filter-count {
  font-size: 11px;
  color: var(--text2);
  margin-left: auto;
  letter-spacing: 0.02em;
}
.filter-count strong { color: var(--text); }

/* === Subject Cards === */
.section-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  margin: 28px 0 14px;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Panel sub-headers inside the leaderboard table */
.lb-panel-header td {
  padding: 7px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border-light);
  border-top: 1px solid var(--border-light);
}
.lb-panel-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text2);
}
.lb-panel-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent3-subtle);
  color: var(--accent3);
  vertical-align: middle;
}

/* Panel divider row */
.lb-panel-divider td {
  padding: 0;
  height: 4px;
  background: var(--surface3);
  border-top: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
}

/* Placeholder rows (no results yet) */
.lb-placeholder td { opacity: 0.45; }
.lb-placeholder:hover { background: var(--hover) !important; }
.lb-placeholder:hover td { opacity: 0.65; }

/* Clickable vs non-clickable cells */
.lb-clickable { cursor: pointer; }
.lb-clickable:hover { background: var(--hover); }
.lb-no-click { cursor: default; }
td.lb-no-data { cursor: default; color: var(--text3); }
td.lb-clickable:hover { background: var(--active); }

/* Fit-level Legend */
.fit-legend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}
.fit-legend-label {
  color: var(--text3);
  margin-right: 6px;
  font-weight: 400;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fit-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
}
.fit-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.fit-legend-dot.full { background: var(--fit-full); }
.fit-legend-dot.high { background: var(--fit-high); }
.fit-legend-dot.partial { background: var(--fit-partial); }
.fit-legend-dot.low { background: var(--fit-low); }
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.subject-card {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
  transition: all 0.25s ease;
  cursor: pointer;
}
.subject-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
  text-decoration: none;
  background: var(--surface2);
}
.subject-card.fit-full { border-left-color: var(--fit-full); }
.subject-card.fit-full:hover { border-color: var(--fit-full); }
.subject-card.fit-high { border-left-color: var(--fit-high); }
.subject-card.fit-high:hover { border-color: var(--fit-high); }
.subject-card.fit-partial { border-left-color: var(--fit-partial); }
.subject-card.fit-partial:hover { border-color: var(--fit-partial); }
.subject-card.fit-low { border-left-color: var(--fit-low); }
.subject-card.fit-low:hover { border-color: var(--fit-low); }
.subject-card .subject-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.subject-card .subject-stats {
  font-size: 12px;
  color: var(--text2);
}

/* === Model Summary === */
.model-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.model-stat {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}
.model-stat:hover { border-color: var(--border-light); }
.model-stat .model-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.model-stat .model-detail { font-size: 11px; color: var(--text2); margin-top: 3px; letter-spacing: 0.01em; }

/* === Leaderboard === */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 1.4rem;
}
.section-title-row .section-title {
  margin: 0;
}
.leaderboard-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  flex-shrink: 0;
}
.leaderboard-toggle button {
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  padding: 7px 11px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.leaderboard-toggle button:last-child {
  border-right: 0;
}
.leaderboard-toggle button:hover {
  color: var(--accent);
  background: var(--hover);
}
.leaderboard-toggle button.active {
  color: var(--accent);
  background: var(--accent-subtle);
}
.leaderboard-wrap {
  overflow-x: auto;
  margin: 14px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.leaderboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 900px;
  table-layout: fixed;
}
.leaderboard-table thead th {
  padding: 10px 12px;
  text-align: center;
  background: var(--surface2);
  border-bottom: 2px solid var(--border-light);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text2);
  white-space: nowrap;
  user-select: none;
}
.leaderboard-table thead th.lb-model { text-align: left; width: 180px; }
.leaderboard-table thead th.lb-rank { width: 40px; }
.leaderboard-table thead th.lb-overall {
  color: var(--accent);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  width: 76px;
}
.leaderboard-table thead th.lb-subj { width: 58px; }
.leaderboard-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}
.leaderboard-table tbody tr:last-child td { border-bottom: none; }

/* Inline harness label above model name */
.lb-harness-inline {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 2px;
}

/* Model row */
.lb-model-row { transition: background 0.15s; }
.lb-model-row:hover { background: var(--hover); }

/* Rank column */
.lb-rank { width: 36px; }
.lb-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}
.rank-1 { background: rgba(212, 175, 55, 0.2); color: #d4af37; border: 1px solid rgba(212, 175, 55, 0.4); }
.rank-2 { background: rgba(192, 192, 192, 0.2); color: #c0c0c0; border: 1px solid rgba(192, 192, 192, 0.4); }
.rank-3 { background: rgba(205, 127, 50, 0.2); color: #cd7f32; border: 1px solid rgba(205, 127, 50, 0.4); }
.lb-rank-num { font-size: 11px; color: var(--text3); font-weight: 500; }

/* Model name cell */
td.lb-model { text-align: left; min-width: 160px; }
.lb-model-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-serif);
}
.lb-model-sub {
  display: block;
  font-size: 10px;
  color: var(--text3);
  margin-top: 1px;
  letter-spacing: 0.02em;
}

/* Overall column */
td.lb-overall {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.lb-score {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
}
.lb-score-high { background: rgba(78,205,196,0.14); color: var(--accent2); }
.lb-score-mid  { background: rgba(244,162,97,0.14); color: var(--accent3); }
.lb-score-low  { background: rgba(231,111,85,0.14); color: var(--accent4); }
.lb-score-na   { color: var(--text3); font-weight: 400; }

/* Subject cells */
td.lb-subj { font-size: 12px; white-space: nowrap; width: 58px; overflow: hidden; }
td.lb-score-high { color: var(--accent2); font-weight: 600; }
td.lb-score-mid  { color: var(--accent3); font-weight: 600; }
td.lb-score-low  { color: var(--accent4); font-weight: 600; }

.metric-guide {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px 14px;
  margin: 0 0 24px;
}
.metric-guide-kicker {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 6px;
}
.metric-guide-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.metric-guide-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.metric-guide p {
  margin: 0;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.55;
}
.metric-guide-scale {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

/* === Tables === */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border-light);
  background: var(--surface2);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  position: sticky;
  top: 0;
}
.data-table thead tr {
  border-bottom: 2px solid var(--accent);
}
.data-table thead th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}
.data-table thead th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}
.data-table thead th:hover { color: var(--accent); }
.data-table thead th.sort-active { color: var(--accent); }
.data-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background 0.15s;
  cursor: pointer;
}
.data-table tbody tr:hover { background: var(--hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.score-cell {
  text-align: center;
  white-space: nowrap;
  min-width: 78px;
}
.score-high { color: var(--accent2); font-weight: 600; }
.score-mid { color: var(--accent3); font-weight: 600; }
.score-low { color: var(--accent4); font-weight: 600; }
.score-na { color: var(--text-muted, #999); font-weight: 400; }

/* === Badges === */
.badge {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-subject {
  background: var(--accent-subtle);
  color: var(--accent);
}
.badge-model {
  background: rgba(136, 139, 160, 0.12);
  color: var(--text2);
}
.badge-harness {
  background: rgba(78, 205, 196, 0.12);
  color: var(--accent2);
}
.brief-id-cell {
  max-width: 230px;
  width: 230px;
}
.brief-id {
  display: -webkit-box;
  color: var(--text2);
  font-size: 11px;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.brief-id:hover {
  color: var(--text);
}
code.brief-id {
  font-family: var(--font-sans);
}
.brief-id,
.brief-id:hover {
  text-decoration: none;
}
.badge-green { background: var(--accent2-subtle); color: var(--accent2); }
.badge-amber { background: var(--accent3-subtle); color: var(--accent3); }
.badge-purple { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.badge-red { background: var(--accent4-subtle); color: var(--accent4); }

/* === Subject Page === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 14px;
  letter-spacing: 0.01em;
}
.back-link:hover { color: var(--accent); text-decoration: none; }
.back-link::before { content: "\2190 "; font-size: 13px; }

.subject-header {
  margin-bottom: 24px;
}
.subject-header h1 { font-family: var(--font-serif); margin-bottom: 6px; }
.subject-header .subject-subtitle {
  font-size: 13px;
  color: var(--text2);
}

/* === Model Tabs === */
.model-tabs {
  display: flex;
  gap: 0;
  margin: 18px 0;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.model-tab {
  padding: 10px 22px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.model-tab:hover { color: var(--accent); background: var(--hover); }
.model-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* =============================================
   PAPER PAGE — Complete Redesign
   ============================================= */
#page-paper {
  animation: pageFadeIn 0.4s ease;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Paper Header */
.paper-header {
  margin-bottom: 24px;
  position: relative;
}
.paper-header h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--text);
}
.paper-header::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
  margin-top: 12px;
}

/* Meta Tags */
.paper-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.paper-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.02em;
  transition: border-color 0.2s;
}
.paper-meta-tag:hover {
  border-color: var(--border-light);
}
.paper-meta-tag .meta-icon {
  font-size: 11px;
  opacity: 0.6;
}
.paper-meta-tag strong {
  color: var(--text);
  font-weight: 600;
}

/* Score Card — Hero Section */
.score-card {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 28px 32px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 20px 0 28px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.score-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}

/* Score Ring */
.overall-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 130px;
  position: relative;
}
.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.score-ring svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.score-ring .ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.04);
  stroke-width: 6;
}
.score-ring .ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.score-ring .ring-fill.high { stroke: var(--accent2); }
.score-ring .ring-fill.mid { stroke: var(--accent3); }
.score-ring .ring-fill.low { stroke: var(--accent4); }
.score-ring .ring-fill.na  { stroke: rgba(255,255,255,0.08); }
.score-ring-value {
  font-family: var(--font-serif);
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  z-index: 1;
}
.score-ring-value.high { color: var(--accent2); }
.score-ring-value.mid  { color: var(--accent3); }
.score-ring-value.low  { color: var(--accent4); }
.score-ring-value.na   { color: var(--text3); font-size: 32px; }
.overall-label {
  font-size: 11px;
  color: var(--text3);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* Score card: divider + dimension mini-grid */
.score-card-divider {
  width: 1px;
  background: rgba(255,255,255,0.08);
  align-self: stretch;
  margin: 0 4px;
  flex-shrink: 0;
}
.dim-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  align-content: center;
}
.dim-item {
  display: grid;
  grid-template-columns: 80px 28px 1fr;
  align-items: center;
  gap: 6px;
}
.dim-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dim-val {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.dim-val.high { color: var(--accent2); }
.dim-val.mid  { color: var(--accent3); }
.dim-val.low  { color: var(--accent4); }
.dim-val.na   { color: var(--text3); }
.dim-bar-bg {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.dim-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.dim-bar.high { background: var(--accent2); }
.dim-bar.mid  { background: var(--accent3); }
.dim-bar.low  { background: var(--accent4); }
.dim-bar.na   { background: rgba(255,255,255,0.1); }

/* Dimension Bars */
.dimensions-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}
.score-row {
  display: grid;
  grid-template-columns: 110px 1fr 32px;
  align-items: center;
  gap: 12px;
}
.score-label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.score-bar-bg {
  height: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.score-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1);
  position: relative;
}
.score-bar.high {
  background: linear-gradient(90deg, var(--accent2), #6ee7de);
}
.score-bar.mid {
  background: linear-gradient(90deg, var(--accent3), #f6ad55);
}
.score-bar.low {
  background: linear-gradient(90deg, var(--accent4), #f0866e);
}
.score-value {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.score-value.high { color: var(--accent2); }
.score-value.mid  { color: var(--accent3); }
.score-value.low  { color: var(--accent4); }
.score-value.na   { color: var(--text3); }
.score-bar.na { background: rgba(255,255,255,0.06); }

/* === Rubric reasoning inline beneath score bar === */
.score-reasoning {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.6;
  padding: 3px 0 12px 122px; /* 110px label + 12px gap */
  margin-top: -4px;
}

/* === Checklist rediscovery section === */
.checklist-summary {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.checklist-metric {
  min-width: 150px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.checklist-metric-label {
  display: block;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.checklist-metric-value {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.checklist-metric-value.high { color: var(--accent2); }
.checklist-metric-value.mid { color: var(--accent3); }
.checklist-metric-value.low { color: var(--accent4); }
.checklist-metric-value.na { color: var(--text3); }
.checklist-metric-scale {
  color: var(--text3);
  font-size: 12px;
  margin-left: 3px;
}
.checklist-meta {
  display: flex;
  align-items: center;
  color: var(--text2);
  font-size: 12px;
  padding: 0 4px;
}
.checklist-items {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.checklist-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px 12px;
}
.checklist-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.checklist-item-reason {
  color: var(--text2);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* === Validity Audit section === */
.validity-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.validity-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.validity-chip.critical { background: var(--accent4-subtle); color: var(--accent4); }
.validity-chip.major    { background: var(--accent3-subtle); color: var(--accent3); }
.validity-chip.minor    { background: rgba(255,255,255,0.05); color: var(--text2); }

.issue-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 12px;
  border-left: 3px solid transparent;
  border-radius: 0 5px 5px 0;
  background: var(--bg3);
  margin-bottom: 6px;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text);
}
.issue-row.critical { border-left-color: var(--accent4); }
.issue-row.major    { border-left-color: var(--accent3); }
.issue-row.minor    { border-left-color: rgba(255,255,255,0.15); }
.issue-area {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255,255,255,0.06);
  color: var(--text3);
  white-space: nowrap;
  flex-shrink: 0;
}
.issue-summary {
  color: var(--text2);
}

/* === Paper PDF === */
.paper-pdf {
  margin: 24px 0;
}
.paper-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.paper-pdf-header h3 {
  font-family: var(--font-serif);
  font-size: 16px;
  margin: 0;
  letter-spacing: -0.01em;
}
.paper-pdf-header .pdf-ext-link {
  font-size: 12px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pdf-object {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-md);
  display: block;
}
.pdf-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 600px;
  gap: 16px;
  color: var(--text3);
  font-size: 14px;
  background: var(--bg3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.paper-pdf iframe {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-md);
}

/* === Tab Navigation === */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 16px 0 0 0;
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 20px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text2);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 0.2s;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--accent);
}
.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}
.tab-panels {
  margin-top: 16px;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* === Extracted Paper Content Images === */
.extracted-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  display: block;
}
.collapse-body .extracted-img {
  border: 1px solid var(--border);
}

/* === Collapsible / Accordion === */
.collapse-wrapper {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
}
.collapse-wrapper:hover {
  border-color: var(--border-light);
}
.collapse-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  user-select: none;
  transition: background 0.2s;
  letter-spacing: -0.01em;
}
.collapse-header:hover {
  background: var(--hover);
}
.collapse-header .collapse-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  color: var(--accent);
  font-size: 12px;
}
.collapse-header.open .collapse-arrow {
  transform: rotate(90deg);
}
.collapse-body {
  padding: 0 18px 18px;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--text);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
  padding-top: 0;
  padding-bottom: 0;
}
.collapse-body.open {
  max-height: 10000px;
  opacity: 1;
  padding: 16px 18px 18px;
}
.collapse-body h1, .collapse-body h2, .collapse-body h3, .collapse-body h4 {
  font-family: var(--font-serif);
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.collapse-body h4 { font-size: 14px; }
.collapse-body p { margin-bottom: 0.6rem; }
.collapse-body ul, .collapse-body ol { padding-left: 1.5rem; margin-bottom: 0.6rem; }
.collapse-body li { margin-bottom: 0.25rem; }
.collapse-body code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: var(--font-mono);
  color: var(--accent2);
}
.collapse-body pre {
  background: rgba(0,0,0,0.25);
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 12px;
  margin-bottom: 0.6rem;
  line-height: 1.5;
  border: 1px solid var(--border);
}
.collapse-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--text2);
  margin: 0.6rem 0;
  opacity: 0.85;
}
.collapse-body hr { border: none; border-top: 1px solid var(--border); margin: 0.8rem 0; }
.collapse-body table { font-size: 12px; width: 100%; border-collapse: collapse; }
.collapse-body th, .collapse-body td {
  padding: 6px 10px;
  border: 1px solid var(--border);
}

/* === Brief Page Content === */
.brief-content {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.8;
}
.brief-content h1, .brief-content h2, .brief-content h3, .brief-content h4 {
  font-family: var(--font-serif);
  margin-top: 1.4rem;
  margin-bottom: 0.6rem;
}
.brief-content p { margin-bottom: 0.8rem; }
.brief-content ul, .brief-content ol { padding-left: 1.5rem; margin-bottom: 0.8rem; }
.brief-content li { margin-bottom: 0.3rem; }
.brief-content code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: var(--font-mono);
  color: var(--accent2);
}
.brief-content pre {
  background: rgba(0,0,0,0.25);
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border);
}
.brief-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--text2);
  margin: 0.8rem 0;
}
.brief-content hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.brief-content table { font-size: 13px; width: 100%; border-collapse: collapse; }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
  font-size: 14px;
}
.empty-state svg { opacity: 0.2; margin-bottom: 12px; }

/* === Footer === */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 60px;
  font-size: 12px;
  color: var(--text3);
  letter-spacing: 0.02em;
}
footer a { color: var(--accent); }
.footer-disclaimer {
  font-size: 11px;
  color: var(--text3);
  font-style: italic;
  margin-top: 12px;
  line-height: 1.4;
  text-align: center;
}

/* === Back to Top === */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--active);
  border-color: var(--accent);
  color: var(--accent);
}

/* === Selection === */
::selection {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* === Animations === */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Responsive === */
@media (max-width: 768px) {
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .score-card {
    flex-direction: column;
    gap: 20px;
    padding: 24px 20px;
  }
  .score-card-divider { width: auto; height: 1px; margin: 0; }
  .dim-grid { grid-template-columns: 1fr 1fr; }
  .overall-section { flex-direction: column; min-width: auto; }
  .paper-pdf iframe, .pdf-object { height: 400px; }
  .stats-row { flex-direction: row; flex-wrap: wrap; }
  .stat-card { min-width: calc(50% - 5px); flex: none; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-group input { min-width: 0; }
  .filter-count { margin-left: 0; }
  .model-summary { grid-template-columns: repeat(2, 1fr); }
  .section-title-row { align-items: flex-start; flex-direction: column; }
  .metric-guide-main { flex-direction: column; gap: 10px; }
  .metric-guide-scale { max-width: none; }
  .page-container { padding: 0 16px 40px; }
  .paper-header h1 { font-size: 22px; }
  .score-row { grid-template-columns: 90px 1fr 28px; }
}

@media (max-width: 480px) {
  .subject-grid { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .stat-card { min-width: auto; }
  .header-top { flex-direction: column; gap: 4px; }
  .model-summary { grid-template-columns: 1fr; }
  .data-table { font-size: 12px; }
  .data-table thead th, .data-table tbody td { padding: 6px 10px; }
  .paper-pdf iframe, .pdf-object { height: 300px; }
  .paper-header h1 { font-size: 19px; }
}

/* ============================================================
   VALIDITY AUDIT DISPLAY (LLM verdicts on overview tab)
   ============================================================ */
.va-table { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.va-row {
  display: grid;
  grid-template-columns: 160px 52px auto 1fr;
  align-items: start;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-size: 0.82rem;
}
.va-reason { grid-column: 4; }
.va-dim-label { color: var(--text2); font-weight: 500; }
.va-verdict {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.va-pass  { background: rgba(64,196,128,0.15); color: #40c480; }
.va-fail  { background: rgba(231,111,85,0.18); color: #e76f55; }
.va-skip  { background: rgba(92,95,117,0.22);  color: var(--text3); }
.va-reason { color: var(--text3); line-height: 1.4; grid-column: 3; }
.va-human-badge {
  font-size: 0.70rem;
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(211,167,75,0.18);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.section-subtitle { font-size: 0.75rem; color: var(--text3); font-weight: 400; margin-left: 6px; }

/* ============================================================
   ANNOTATION TOOLBAR (header)
   ============================================================ */
.annot-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  margin-top: 4px;
}
.annot-export-btn, .annot-import-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.annot-export-btn:hover, .annot-import-btn:hover {
  background: var(--surface3);
  color: var(--text);
}
.annot-badge {
  background: var(--accent);
  color: #111;
  border-radius: 99px;
  padding: 1px 6px;
  font-size: 0.70rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.annot-tab-btn { color: var(--accent); }

/* ============================================================
   ANNOTATION FORM (Annotate tab)
   ============================================================ */
.annot-wrap { padding: 20px 0; }
.annot-intro { color: var(--text3); font-size: 0.82rem; margin-bottom: 20px; }
.annot-dims { display: flex; flex-direction: column; gap: 10px; }

.annot-dim-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.annot-dim-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.annot-dim-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text2);
  min-width: 140px;
}
.annot-llm-verdict {
  font-size: 0.70rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.annot-llm-reason {
  font-size: 0.75rem;
  color: var(--text3);
  line-height: 1.35;
  flex: 1;
}

/* Guiding question and hint */
.annot-dim-question {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text1);
  line-height: 1.4;
  margin: 2px 0 0;
}
.annot-dim-hint {
  font-size: 0.78rem;
  color: var(--text3);
  line-height: 1.5;
  margin: 3px 0 0;
  padding: 5px 8px;
  border-left: 2px solid var(--border-light);
  background: color-mix(in srgb, var(--surface3) 60%, transparent);
  border-radius: 0 4px 4px 0;
}

/* LLM verdict reason as a block (replaces inline span) */
.annot-llm-reason-block {
  font-size: 0.76rem;
  color: var(--text3);
  line-height: 1.45;
  margin: 4px 0 0;
  display: flex;
  gap: 5px;
  align-items: baseline;
}
.annot-llm-reason-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  opacity: 0.7;
  flex-shrink: 0;
}

/* ── Reference material collapsible inside annotation rows ────────────────── */
.annot-dim-row .collapse-wrapper {
  border: none;
  background: transparent;
  margin: 0;
}
.annot-dim-row .collapse-header {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--accent);
  padding: 4px 0;
  gap: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.annot-dim-row .collapse-body {
  padding: 0;
  background: transparent;
}

/* Container: single block or split two-column */
.annot-ref-blocks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.annot-ref-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 760px) {
  .annot-ref-split { grid-template-columns: 1fr; }
}

/* Each individual reference block card */
.annot-ref-block {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface1);
}
.annot-ref-title {
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px 4px;
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
}
.annot-ref-body {
  max-height: 360px;
  overflow-y: auto;
  padding: 10px 12px;
}

/* ── Prose (markdown text) ─── */
.ref-prose { font-size: 0.82rem; color: var(--text1); line-height: 1.65; }
.ref-prose .ref-h { font-weight: 600; color: var(--text2); margin: 0.7em 0 0.2em; }
h3.ref-h { font-size: 0.84rem; }
h4.ref-h { font-size: 0.80rem; }
h5.ref-h, h6.ref-h { font-size: 0.78rem; }
.ref-prose .ref-p { margin: 0 0 0.55em; }
.ref-prose .ref-p:last-child { margin-bottom: 0; }

/* ── JSON card ──────────────── */
.ref-jcard { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; }
.ref-jrow  { display: flex; gap: 8px; align-items: baseline; }
.ref-jkey  {
  font-size: 0.68rem; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.04em;
  min-width: 120px; flex-shrink: 0;
}
.ref-jdd   { margin: 0; flex: 1; }
.ref-jval  { font-size: 0.80rem; color: var(--text1); line-height: 1.4; word-break: break-word; }
.ref-tag {
  display: inline-block; font-size: 0.72rem; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 4px; padding: 1px 5px; margin: 2px 2px 2px 0;
  line-height: 1.4;
}

/* ── Inline code & pre blocks ─ */
.ref-ic {
  font-family: var(--font-mono, monospace); font-size: 0.78em;
  background: var(--surface3); border-radius: 3px; padding: 0 3px;
  color: var(--text2);
}
.ref-pre {
  font-family: var(--font-mono, monospace); font-size: 0.74rem;
  color: var(--text2); white-space: pre-wrap; line-height: 1.5;
  margin: 0; background: transparent;
}

.annot-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.annot-opt {
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 99px;
  border: 1px solid var(--border-light);
  background: var(--surface3);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.annot-opt:hover { background: var(--hover); color: var(--text); }
.annot-opt.annot-sel {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* Overall quality */
.annot-quality {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}
.annot-stars { display: flex; gap: 4px; }
.annot-star {
  font-size: 1.4rem;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.1s, transform 0.1s;
  line-height: 1;
}
.annot-star:hover { transform: scale(1.2); }
.annot-star.annot-star-sel { color: var(--accent); }

/* Notes */
.annot-notes-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}
.annot-notes {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  padding: 10px 12px;
  resize: vertical;
  font-family: var(--font-sans);
  line-height: 1.5;
  box-sizing: border-box;
}
.annot-notes:focus { outline: none; border-color: var(--accent); }

/* Footer */
.annot-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.annot-status {
  font-size: 0.75rem;
  color: var(--text3);
  transition: color 0.3s;
}
.annot-status.annot-status-highlight {
  color: var(--accent);
  font-weight: 500;
}
.annot-footer-btns { display: flex; gap: 8px; align-items: center; }

.annot-submit {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}
.annot-submit:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.annot-clear {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: none;
  color: var(--text3);
  cursor: pointer;
}
.annot-clear:hover { color: var(--accent4); border-color: var(--accent4); }
