:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #68716d;
  --paper: #f6f4ed;
  --card: #fffef9;
  --line: #dcded7;
  --green: #16734a;
  --green-soft: #e2f3e9;
  --red: #a8473c;
  --red-soft: #f9e9e5;
  --blue: #315b87;
  --blue-soft: #e7eef6;
  --amber: #9b6722;
  --shadow: 0 16px 48px rgba(38, 48, 43, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  min-height: 106px;
  padding: 22px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: white;
  background:
    radial-gradient(circle at 15% 0%, rgba(118, 190, 154, 0.24), transparent 28%),
    linear-gradient(115deg, #132a22, #214739 62%, #2a5d4a);
}
.topbar h1 { margin: 2px 0 0; font-family: Georgia, serif; font-size: clamp(24px, 3vw, 38px); font-weight: 500; }
.eyebrow { margin: 0; color: #6c7771; font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.topbar .eyebrow { color: #9fd5bb; }
.legend { display: flex; gap: 18px; font-size: 13px; color: #d8e9e0; white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.covered { background: #51cf8d; box-shadow: 0 0 0 4px rgba(81,207,141,.14); }
.dot.missed { background: #d98578; box-shadow: 0 0 0 4px rgba(217,133,120,.14); }

.app-shell { min-height: calc(100vh - 106px); display: grid; grid-template-columns: 330px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; align-self: start; height: calc(100vh - 0px); padding: 22px 16px; border-right: 1px solid var(--line); background: #ecebe5; overflow: hidden; display: flex; flex-direction: column; }
.search-wrap label { display: block; margin: 0 0 7px 4px; font-size: 12px; font-weight: 750; color: #56615c; }
.search-wrap input { width: 100%; padding: 11px 13px; border: 1px solid #cfd3cc; border-radius: 10px; outline: none; background: #fff; color: var(--ink); }
.search-wrap input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,115,74,.11); }
.filter-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 12px 0 9px; }
.filter { border: 0; border-radius: 8px; padding: 7px 3px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.filter.active { color: white; background: #274c3e; }
.paper-count { padding: 3px 4px 9px; color: var(--muted); font-size: 12px; }
.paper-list { overflow-y: auto; padding-right: 4px; }
.paper-item { width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; display: block; text-align: left; background: transparent; cursor: pointer; }
.paper-item:hover { background: rgba(255,255,255,.58); }
.paper-item.active { background: var(--card); box-shadow: 0 3px 16px rgba(38,48,43,.08); }
.paper-item strong { display: block; margin-bottom: 5px; font-size: 13px; line-height: 1.3; }
.paper-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.delta.positive { color: var(--blue); }
.delta.negative { color: var(--green); }

.main { min-width: 0; padding: 26px clamp(20px, 4vw, 58px) 80px; }
.main article { max-width: 1240px; margin: 0 auto; }
.empty-state { min-height: 55vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.loader { margin: auto; width: 30px; height: 30px; border: 3px solid #d5d9d3; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.paper-hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(350px, .8fr); gap: 34px; padding: 26px 28px; border-radius: 18px; color: #f3fbf7; background: linear-gradient(130deg, #173529, #245641); box-shadow: var(--shadow); }
.paper-hero .eyebrow { color: #8fcbae; }
.paper-title { margin: 7px 0 8px; font-family: Georgia, serif; font-size: clamp(26px, 3vw, 42px); font-weight: 500; line-height: 1.13; }
.authors { margin: 0; color: #c6d9d0; }
.paper-links { display: flex; gap: 8px; margin-top: 19px; }
.button { padding: 9px 13px; border: 1px solid rgba(255,255,255,.28); border-radius: 9px; color: white; text-decoration: none; font-size: 13px; font-weight: 700; }
.button.primary { color: #173529; background: #c9eedb; border-color: #c9eedb; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; align-content: center; }
.metric { padding: 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; background: rgba(255,255,255,.07); }
.metric span { display: block; color: #bcd1c7; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.metric strong { display: block; margin-top: 3px; font-size: 24px; font-variant-numeric: tabular-nums; }

.section-nav { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; margin: 16px 0; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: rgba(246,244,237,.93); backdrop-filter: blur(10px); }
.section-nav button { border: 0; border-radius: 8px; padding: 8px 11px; background: transparent; color: #4d5853; cursor: pointer; font-size: 12px; font-weight: 700; }
.section-nav button:hover { background: white; }

.panel { scroll-margin-top: 70px; margin-top: 16px; padding: 23px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 6px 28px rgba(38,48,43,.045); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h3 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.section-count { color: var(--muted); font-size: 13px; }
.section-note { margin: -7px 0 18px; color: var(--muted); font-size: 13px; }
.abstract { margin: 0; white-space: pre-wrap; }
.control-group { display: flex; gap: 6px; }
.toggle { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; cursor: pointer; font-size: 12px; font-weight: 700; }
.toggle.active { color: white; background: #2b5645; border-color: #2b5645; }

.human-review { border: 1px solid var(--line); border-radius: 13px; margin-top: 11px; overflow: hidden; }
.human-review summary { list-style: none; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; background: #faf9f4; }
.human-review summary::-webkit-details-marker { display: none; }
.human-review summary strong { font-size: 14px; }
.review-meta { display: flex; gap: 7px; color: var(--muted); font-size: 12px; }
.review-body { padding: 17px; border-top: 1px solid var(--line); }
.review-field + .review-field { margin-top: 18px; }
.review-field h4 { margin: 0 0 6px; color: #4f5b55; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.review-field p { margin: 0; white-space: pre-wrap; }
.review-issues { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.mini-issue { margin: 6px 0; padding: 8px 10px; border-left: 3px solid #c4c9c3; border-radius: 5px; background: #f5f4ef; font-size: 12px; }
.mini-issue.covered { border-color: var(--green); background: var(--green-soft); }

.human-issue-list, .candidate-list { display: grid; gap: 10px; }
.issue-card, .candidate-card { padding: 15px; border: 1px solid var(--line); border-left: 4px solid #bfc5bf; border-radius: 11px; background: #fff; }
.issue-card.covered { border-left-color: var(--green); }
.issue-card.missed-by-both { border-left-color: var(--red); background: #fffaf8; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-top h4 { margin: 0; font-size: 14px; line-height: 1.45; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 6px; background: #eef0ec; color: #5e6863; font-size: 11px; }
.tag.success { color: #0f633e; background: var(--green-soft); }
.tag.failure { color: var(--red); background: var(--red-soft); }
.tag.profile { color: var(--blue); background: var(--blue-soft); }
.tag.severity-major, .tag.severity-critical { color: #8b4b19; background: #f8ead9; }
.probability { font-weight: 800; font-variant-numeric: tabular-nums; }
.issue-match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.match-box { padding: 9px 10px; border-radius: 8px; background: #f0f1ed; color: #5e6863; font-size: 12px; }
.match-box.covered { color: #0d5c39; background: var(--green-soft); }
.match-box strong { display: flex; justify-content: space-between; gap: 8px; }
.match-box a { color: inherit; text-decoration-color: currentColor; text-underline-offset: 2px; }

.candidate-card.accepted { border-left-color: var(--green); background: #fbfffc; }
.candidate-card.rejected { border-left-color: #c7cbc6; }
.candidate-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; color: #56615c; font-size: 13px; }
.candidate-detail p { margin: 0; }
.candidate-detail strong { display: block; margin-bottom: 2px; color: #36413c; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.evidence { margin-top: 11px; padding: 10px 12px; border-radius: 8px; color: #505c56; background: #f3f2ed; font-family: Georgia, serif; font-size: 13px; }
.evidence::before { content: "Evidence"; display: block; margin-bottom: 3px; color: #78817c; font-family: Inter, sans-serif; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hidden { display: none !important; }
.error { padding: 25px; border: 1px solid #e3b8af; border-radius: 12px; color: #7d3129; background: #fff1ed; }

@media (max-width: 940px) {
  .app-shell { grid-template-columns: 260px minmax(0, 1fr); }
  .paper-hero { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .candidate-detail { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { padding: 17px 18px; align-items: flex-start; flex-direction: column; }
  .legend { white-space: normal; }
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; max-height: 380px; border-right: 0; border-bottom: 1px solid var(--line); }
  .paper-list { max-height: 220px; }
  .main { padding: 18px 12px 60px; }
  .paper-hero, .panel { padding: 18px; border-radius: 13px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .section-nav { overflow-x: auto; }
  .section-nav button { white-space: nowrap; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .issue-match-grid { grid-template-columns: 1fr; }
}
