:root {
  --paper: #fffdf8;
  --ink: #1f1f1a;
  --muted: #66624f;
  --line: #e2ddcf;
  --ok: #2c8a4f;
  --review: #d49d2a;
  --problem: #c5443f;
  --scope: #8a8a8a;
  --accent: #1b6ef3;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Source Sans 3", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: #f3f0e7;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bind-banner {
  padding: 10px 32px;
  background: #b92f2f;
  color: #fff;
  font-size: 0.9rem;
}

.bar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 32px;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.logo {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.logo span {
  color: var(--accent);
}

.tabs {
  display: flex;
  gap: 4px;
  height: 100%;
}

.tabs a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}

.tabs a.on {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.trust {
  position: relative;
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
  line-height: 1.3;
}

.trust b {
  color: var(--ink);
  font-weight: 600;
}

.privacy {
  display: inline;
}

.privacy summary {
  display: inline;
  cursor: pointer;
  text-decoration: underline;
  list-style: none;
}

.privacy summary::-webkit-details-marker {
  display: none;
}

.privacy p {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  width: 320px;
  max-width: calc(100vw - 32px);
  margin: 8px 0 0;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.where-exposed .trust b {
  color: #b92f2f;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.empty {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 32px;
}

.empty h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.5rem;
}

.lede {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.5;
}

textarea {
  width: 100%;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.6;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.upload-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
}

.file-pick {
  color: var(--accent);
  cursor: pointer;
}

.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-chip {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  background: #fff;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.actions-row {
  margin-top: 14px;
}

.actions-row .corpus-pill {
  margin-left: auto;
}

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn.small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.stale {
  font-size: 0.82rem;
  color: #8a5a00;
  background: color-mix(in srgb, var(--review) 14%, #fff);
  border: 1px solid color-mix(in srgb, var(--review) 45%, #fff);
  border-radius: 999px;
  padding: 3px 10px;
}

.stale.fresh {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
}

.hint-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.hint {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
}

.hint b {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

.verdict-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--problem);
  margin-bottom: 18px;
}

.verdict-banner h1 {
  margin: 0;
  font-size: 1.15rem;
}

.result-summary {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-summary-refused,
.result-summary-partial {
  color: #a3341a;
  font-weight: 600;
}

.big-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--problem);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.verdict-banner.ok { border-left-color: var(--ok); }
.verdict-banner.review { border-left-color: var(--review); }
.verdict-banner.scope { border-left-color: var(--scope); }
.verdict-banner.ok .big-mark { background: var(--ok); }
.verdict-banner.review .big-mark { background: var(--review); }
.verdict-banner.scope .big-mark { background: var(--scope); }

.counts {
  display: flex;
  gap: 14px;
  font-size: 0.88rem;
  white-space: nowrap;
}

.counts span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot.ok { background: var(--ok); }
.dot.problem { background: var(--problem); }
.dot.review { background: var(--review); }
.dot.scope { background: var(--scope); }

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.page {
  padding: 36px 44px;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.75;
  max-width: 72ch;
  white-space: pre-wrap;
}

.upload-note {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
  white-space: normal;
}

.margin {
  border-left: 1px solid var(--line);
  padding: 28px 20px;
  background: #fbf9f3;
  border-radius: 0 12px 12px 0;
}

.margin-title {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

mark {
  padding: 1px 2px;
  border-radius: 3px;
  cursor: pointer;
  color: inherit;
}

mark.ok { background: color-mix(in srgb, var(--ok) 16%, #fff); border-bottom: 2px solid var(--ok); }
mark.problem { background: color-mix(in srgb, var(--problem) 18%, #fff); border-bottom: 2px solid var(--problem); }
mark.review { background: color-mix(in srgb, var(--review) 22%, #fff); border-bottom: 2px solid var(--review); }
mark.scope { background: color-mix(in srgb, var(--scope) 16%, #fff); border-bottom: 2px solid var(--scope); }
mark.focus { outline: 2px solid var(--ink); outline-offset: 1px; }

mark sup {
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 700;
  margin-left: 2px;
  color: var(--muted);
}

.verdict-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--problem);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.note.ok { border-left-color: var(--ok); }
.note.review { border-left-color: var(--review); }
.note.scope { border-left-color: var(--scope); }
.note.focus { box-shadow: 0 0 0 2px var(--ink); }

.note .ref {
  font-family: var(--serif);
  font-weight: 700;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.verdict-number {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

.verdict-locator {
  white-space: nowrap;
}

.verdict-publication {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.verdict-as-written {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.tag {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.note .label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.note.problem .label { color: var(--problem); }
.note.ok .label { color: var(--ok); }
.note.review .label { color: #9a6c00; }
.note.scope .label { color: var(--muted); }

.verdict-title,
.verdict-detail,
.verdict-warn {
  margin: 4px 0 0;
}

.verdict-detail {
  color: var(--muted);
  font-size: 0.84rem;
}

.verdict-warn {
  font-size: 0.82rem;
  color: #8a5a00;
  background: color-mix(in srgb, var(--review) 10%, #fff);
  border-radius: 6px;
  padding: 4px 6px;
}

.verdict-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
}

.verdict-link:hover {
  text-decoration: underline;
}

.verdict-subsection {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.verdict-subsection summary {
  cursor: pointer;
  color: var(--accent);
}

.verdict-subsection-text {
  margin: 4px 0 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.04);
  border-left: 2px solid var(--muted);
  font-family: var(--serif);
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 220px;
  overflow-y: auto;
}

.empty-hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.pii-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.6rem 0.6rem;
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.9rem;
  background: #fff;
}

.pii-picker legend {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 0 0.3rem;
}

.pii-picker label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
}

.pii-counts {
  list-style: none;
  margin: 12px 0 0.6rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pii-counts li {
  display: flex;
  gap: 0.35rem;
  align-items: baseline;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.85rem;
  background: #fff;
}

.pii-n {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pii-limitation {
  color: #a3341a;
  font-size: 0.85rem;
  margin: 0.4rem 0 0.6rem;
}

.pii-limitation.ok-note {
  color: var(--ok);
}

.pii-covered {
  min-height: 140px;
  margin-top: 6px;
}

.pii-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.pii-map {
  font-size: 0.8rem;
  color: #a3341a;
}

.pii-reveal {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.pii-reveal-load {
  margin-top: 16px;
  font-size: 0.85rem;
}

#pii-panel label[for] {
  display: block;
  margin-top: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

.pii-banner {
  border-left-color: #274b9a;
}

.pii-banner .big-mark {
  background: #274b9a;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  font-size: 0.88rem;
}

.chip.suspect {
  border-color: color-mix(in srgb, var(--review) 60%, #fff);
  background: color-mix(in srgb, var(--review) 10%, #fff);
}

.chip.off {
  opacity: 0.6;
}

.chip .x {
  font: inherit;
  font-size: 0.78rem;
  color: var(--muted);
  background: none;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 2px 8px;
  cursor: pointer;
}

.chip-note {
  font-size: 0.82rem;
  color: #8a5a00;
  margin: -4px 0 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 6px;
}

.split > div {
  padding: 20px 24px;
  min-width: 0;
}

.split > div + div {
  border-left: 1px solid var(--line);
  background: #fff;
  border-radius: 0 12px 12px 0;
}

.col-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.col-head h2 {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.col-text {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ph {
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  background: #eef2fb;
  color: #274b9a;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

.ph i {
  font-style: normal;
  font-weight: 400;
  color: #7a8fbd;
}

mark.pii {
  background: #eef2fb;
  border-bottom: 2px solid #9db4e6;
  cursor: default;
}

mark.pii.off {
  background: none;
  border-bottom: 2px dashed #c9c3b3;
}

.linkish {
  font: inherit;
  font-size: 0.82rem;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.next {
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}

.next b {
  color: var(--ink);
}

.doc-page h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin: 28px 0 8px;
}

.doc-page p,
.doc-page li,
.doc-page dd {
  line-height: 1.55;
  max-width: 72ch;
}

.doc-warn {
  background: color-mix(in srgb, var(--review) 10%, #fff);
  border-left: 4px solid var(--review);
  padding: 8px 12px;
  border-radius: 6px;
}

.doc-ask {
  margin: 8px 0 16px;
  padding: 8px 14px;
  border-left: 4px solid var(--line);
  color: var(--muted);
  max-width: 72ch;
}

.doc-shot {
  margin: 0 0 8px;
}

.doc-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.doc-shot figcaption {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 72ch;
}

.doc-cmd {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .doc-shot-img {
    display: block;
    overflow-x: auto;
  }

  .doc-shot img {
    min-width: 760px;
  }

  .empty {
    padding: 20px 16px;
  }

  .chip {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    border-radius: 12px;
  }

  .chip .x {
    border-left: 0;
    padding-left: 0;
  }

  .ph {
    white-space: normal;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .split > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
  }

  .bar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 10px;
  }

  .privacy p {
    left: 0;
    right: auto;
  }

  .trust {
    margin-left: 0;
    text-align: left;
    width: 100%;
  }

  .wrap {
    padding: 16px;
  }

  .sheet,
  .hint-list,
  .verdict-banner {
    grid-template-columns: 1fr;
  }

  .margin {
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
  }

  .page {
    padding: 20px;
  }
}
