:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: #202b36;
  background: #f6f7f8;
  font-size: 15px;
  line-height: 1.6;
  --border: #dce1e6;
  --muted: #5d6875;
  --accent: #235c68;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--accent);
  text-underline-offset: 4px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}
button:hover:not(:disabled) {
  background: #194955;
}
button.secondary {
  background: #fff;
  color: #344450;
  border-color: #c8d0d8;
}
button.secondary:hover:not(:disabled) {
  background: #eef2f4;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
input,
select,
textarea {
  padding: 9px 10px;
  border: 1px solid #b8c2cc;
  border-radius: 4px;
  background: #fff;
  color: inherit;
  width: 100%;
  min-height: 44px;
}
textarea {
  resize: vertical;
}
input:disabled {
  background: #f0f2f4;
  color: #6e7882;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 6px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: -0.4px;
  margin-bottom: 8px;
  font-weight: 650;
}
h2 {
  font-size: 16px;
  margin-bottom: 12px;
  font-weight: 650;
}
h3 {
  font-size: 14px;
  margin-bottom: 8px;
}
p {
  margin-bottom: 12px;
}
p:last-child {
  margin-bottom: 0;
}
.small {
  font-size: 13px;
  color: var(--muted);
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 22px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.brand {
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #243642;
}
.product-name {
  border-left: 1px solid var(--border);
  padding-left: 22px;
  font-size: 13px;
  color: var(--muted);
}
nav {
  margin-left: auto;
  display: flex;
  gap: 24px;
  font-size: 13px;
}
nav a {
  text-decoration: none;
}
.shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  max-width: 1680px;
  margin: auto;
}
.sidebar {
  padding: 30px 22px;
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 64px);
  background: #f0f2f4;
}
.sidebar label {
  margin-top: 20px;
}
.source-list {
  margin: 30px 0 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.source-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.source-list li {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e6ea;
}
.scope-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.runtime {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  font-size: 12px;
}
.runtime strong {
  font-size: 13px;
  font-weight: 600;
}
.runtime p {
  margin-top: 5px;
  color: var(--muted);
}
main {
  padding: 30px 32px;
  min-width: 0;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.page-heading p {
  color: var(--muted);
  font-size: 14px;
}
.page-heading .eyebrow {
  font-size: 11px;
  letter-spacing: 1.3px;
  margin-bottom: 10px;
}
.query-area {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  margin-bottom: 26px;
}
.query-controls {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}
#query-help {
  margin: 10px 0;
}
#status {
  font-size: 13px;
  min-height: 22px;
  color: var(--accent);
}
#status.error {
  color: #a12b27;
}
#retry {
  margin-top: 10px;
  padding: 7px 12px;
}
.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.results,
.source-panel {
  min-width: 0;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.section-heading h2 {
  margin-bottom: 12px;
}
.empty {
  padding: 28px 18px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  min-height: 158px;
}
.empty h3 {
  font-size: 15px;
  color: #3b4855;
}
.metric {
  background: white;
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 18px;
}
.metric .value {
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 650;
  color: #1c414a;
  line-height: 1.3;
  margin: 6px 0 12px;
}
.formula {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.table-scroll {
  overflow: auto;
  margin-top: 16px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
th,
td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-weight: 600;
}
th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.evidence-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-weight: 400;
  white-space: normal;
  padding: 13px 12px;
  margin-bottom: 3px;
}
.evidence-row:hover:not(:disabled) {
  background: #e8edef;
}
.evidence-row[aria-pressed="true"] {
  border-left-color: var(--accent);
  background: #e7eef0;
}
.evidence-row strong {
  font-size: 13px;
}
.evidence-row p {
  font-size: 13px;
  line-height: 1.6;
  margin: 5px 0;
}
.evidence-row .excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.source-sheet {
  background: #fff;
  border: 1px solid var(--border);
  padding: 22px;
  min-height: 260px;
}
.source-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.source-sheet blockquote {
  margin: 0 0 18px;
  white-space: pre-wrap;
  line-height: 1.85;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.source-sheet .context {
  color: var(--muted);
  font-size: 13px;
  margin-top: 16px;
  white-space: pre-wrap;
}
.digest {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
  color: var(--muted);
  margin: 18px 0;
}
.review-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.review-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}
.review-section {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.review-section h2 {
  margin-bottom: 6px;
}
.review-section textarea {
  margin-top: 12px;
}
.review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 12px;
}
.review-actions #save-state {
  margin: 0;
}
.review-actions button {
  flex-shrink: 0;
}
.help {
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
}
summary {
  cursor: pointer;
  color: #394956;
  padding: 6px 0;
}
.help p {
  margin-top: 12px;
}
.help pre {
  overflow: auto;
  padding: 15px;
  background: #e9edef;
  font-size: 12px;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.trace {
  font-size: 12px;
  margin: 12px 0 18px;
  color: var(--muted);
}
.trace ol {
  padding-left: 20px;
}
.skip {
  position: absolute;
  top: -80px;
  left: 10px;
  background: #fff;
  padding: 12px;
  z-index: 10;
}
.skip:focus {
  top: 6px;
}
:focus-visible {
  outline: 3px solid #3d7f98;
  outline-offset: 3px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
[hidden] {
  display: none !important;
}
@media (min-width: 1350px) {
  main {
    padding: 34px 44px;
  }
}
@media (max-width: 1050px) {
  .shell {
    grid-template-columns: 195px minmax(0, 1fr);
  }
  main {
    padding: 26px 24px;
  }
  .work-grid {
    grid-template-columns: 1fr;
  }
  .source-panel {
    margin-top: 10px;
  }
  .query-controls {
    grid-template-columns: 160px minmax(0, 1fr);
  }
  #run {
    grid-column: 2;
    justify-self: end;
  }
  .page-heading {
    align-items: flex-start;
  }
}
@media (max-width: 700px) {
  .topbar {
    padding: 0 16px;
    height: 58px;
    gap: 12px;
  }
  .product-name {
    display: none;
  }
  nav {
    gap: 14px;
    font-size: 12px;
  }
  .shell {
    display: block;
  }
  .sidebar {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 18px 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
  }
  .sidebar h2,
  .sidebar > .small,
  .source-list,
  .scope-note {
    display: none;
  }
  .sidebar label {
    margin: 0;
  }
  .sidebar #company {
    grid-column: 1;
    grid-row: 2;
  }
  .sidebar #year {
    grid-column: 2;
    grid-row: 2;
  }
  .sidebar label[for="year"] {
    grid-column: 2;
    grid-row: 1;
  }
  .runtime {
    grid-column: 1/-1;
    margin: 6px 0 0;
    padding-top: 10px;
  }
  .runtime p {
    display: none;
  }
  main {
    padding: 24px 18px;
  }
  .page-heading {
    display: block;
    margin-bottom: 20px;
  }
  h1 {
    font-size: 23px;
  }
  .query-controls {
    grid-template-columns: 1fr;
  }
  .query-controls #run {
    grid-column: 1;
    justify-self: stretch;
  }
  .query-area {
    padding-top: 18px;
  }
  .source-sheet {
    padding: 18px;
  }
  .metric {
    padding: 18px;
  }
  .section-heading {
    gap: 8px;
  }
  footer {
    display: block;
  }
  footer span {
    display: block;
    margin-bottom: 5px;
  }
}
@media (max-width: 360px) {
  .sidebar {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar label[for="company"] {
    grid-column: 1;
    grid-row: 1;
  }
  .sidebar label[for="year"] {
    grid-column: 1;
    grid-row: 3;
    margin-top: 8px;
  }
  .sidebar #year {
    grid-column: 1;
    grid-row: 4;
  }
}

.handoff {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 24px;
}
.handoff > p {
  max-width: 80ch;
}
.handoff input[type="file"] {
  max-width: 640px;
  margin-bottom: 10px;
  padding: 8px;
}
.handoff .section-heading {
  flex-wrap: wrap;
}
.replay-identity {
  max-width: 80ch;
  margin: 16px 0;
  font-size: 13px;
}
.replay-identity > div {
  display: grid;
  grid-template-columns: 5em minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
}
.replay-identity dt {
  color: var(--muted);
}
.replay-identity dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.replay-identity summary {
  cursor: pointer;
}
#replay-hash-full {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}
.replay-checks {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  max-width: 80ch;
}
.replay-checks li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.handoff .error {
  color: #a12b27;
}
.replay-detail {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.handoff-limit {
  margin-top: 14px;
}
.difference {
  white-space: pre-wrap;
  font-size: 12px;
  margin: 6px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pdf-intake {
  margin: 28px 0;
  border-top: 1px solid #d6dce0;
  padding-top: 20px;
}
.pdf-intake > p {
  max-width: 78ch;
}
.pdf-intake input[type="file"] {
  display: block;
  width: 100%;
  max-width: 640px;
  margin: 8px 0 12px;
}
.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.pdf-identity {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px 12px;
}
.pdf-identity dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.pdf-intake select {
  display: block;
  width: min(100%, 320px);
  margin: 8px 0 12px;
}
#pdf-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 360px;
  overflow: auto;
  padding: 16px;
  border: 1px solid #d6dce0;
  background: #fff;
  line-height: 1.65;
  font-family: inherit;
  font-size: 14px;
}

.fact-draft {
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 16px;
}
.fact-draft > summary {
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
}
.draft-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
}
.draft-grid select {
  width: 100%;
  margin: 0;
}
.draft-grid input,
.draft-grid select {
  font-weight: 400;
}
#draft-excerpt {
  display: block;
  margin-top: 10px;
}
#draft-status {
  margin-top: 12px;
}
#draft-count {
  font-size: 16px;
  margin-top: 24px;
}
#draft-list {
  list-style: none;
  padding: 0;
}
#draft-list li {
  border-top: 1px solid var(--border);
  padding: 12px 0;
  overflow-wrap: anywhere;
}
#draft-list li > p {
  margin-bottom: 6px;
  font-weight: 600;
}
#draft-list button {
  margin: 8px 8px 0 0;
}
#draft-list blockquote {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  white-space: pre-wrap;
}
@media (max-width: 600px) {
  .draft-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.source-catalog {
  margin: 20px 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.source-catalog summary {
  cursor: pointer;
  font-weight: 600;
}
.source-catalog > p {
  margin-top: 12px;
}
#source-catalog-list {
  list-style: none;
  padding: 0;
}
#source-catalog-list li {
  margin: 16px 0;
}
#source-catalog-list p {
  margin: 4px 0;
}
.source-match {
  margin: 16px 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  overflow-wrap: anywhere;
}
.source-match p {
  margin: 6px 0;
}

.pdf-preview {
  margin: 20px 0;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
#pdf-preview-status {
  overflow-wrap: anywhere;
}
#pdf-preview-image {
  max-height: 70vh;
  max-width: 100%;
  overflow: auto;
}
#pdf-preview-image.actual-size canvas {
  max-width: none;
}
#pdf-preview-tools {
  align-items: end;
}
#pdf-preview-image canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  margin-top: 12px;
}
#pdf-preview-tools label,
#pdf-preview-tools select {
  margin-bottom: 0;
}

#draft-import {
  border-bottom: 1px solid var(--line, #d8dce0);
  margin-bottom: 20px;
  padding-bottom: 16px;
}
.draft-import-preview {
  overflow-wrap: anywhere;
}
#draft-import button {
  max-width: 100%;
  white-space: normal;
}

.startup {
  margin: 24px auto;
  padding: 16px 24px;
  max-width: 920px;
  border-block: 1px solid var(--border);
  background: #fff;
}
.startup p {
  margin: 0 0 10px;
}

#draft-review-groups details {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
#draft-review-groups summary {
  cursor: pointer;
  font-weight: 600;
}
#draft-review-groups p {
  margin: 8px 0;
}
.draft-group-members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
#draft-list .draft-findings {
  font-weight: 400;
}
#draft-list [tabindex="-1"]:focus {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}
#draft-download,
#draft-review-download,
#draft-edit-cancel {
  margin: 8px 8px 0 0;
}

.review-ledger { border-top: 1px solid var(--border); padding: 20px 0; margin: 20px 0; }
.review-ledger > summary { font-weight: 600; cursor: pointer; }
.review-ledger label { display: block; margin: 14px 0 6px; }
.review-ledger textarea, .review-ledger input, .review-ledger select { display: block; width: 100%; max-width: 680px; }
.review-ledger button { margin: 8px 8px 8px 0; }
.review-ledger li { border-top: 1px solid var(--border); padding: 12px 0; }
.ledger-snapshot { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
