:root {
  --bg: #edefe8;          /* page canvas, soft green-cream */
  --card: #f9faf4;        /* sheets / cards */
  --inset: #eef0e6;       /* inputs, drop zone (receives content, slightly darker) */
  --ink: #1c2127;
  --muted: #5a5e54;       /* secondary text */
  --ink-3: #888c7e;       /* tertiary text */
  --line: rgba(28,33,39,.10);
  --line-2: rgba(28,33,39,.18);
  --accent: #1f5a3a;      /* deep legal green */
  --accent-d: #16432b;    /* hover */
  --accent-cream: #eef4ec;/* text on green */
  --accent-tint: rgba(31,90,58,.10);
  --brass: #94672c;       /* secondary metallic */
  --brass-tint: rgba(148,103,44,.12);
  --danger: #a3402f;
  --danger-tint: rgba(163,64,47,.07);
  --danger-line: rgba(163,64,47,.28);
  --ok: #2f7a4f;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- letterhead ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
  padding: 12px 26px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.seal { flex: none; }
.word-main { font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: .2px; }

main { max-width: 1040px; margin: 0 auto; padding: 30px 20px 80px; }
.hidden { display: none !important; }

/* ---------- intake ---------- */
.intake { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px 30px 26px; }
.reject { display: flex; align-items: flex-start; gap: 12px; background: var(--danger-tint); border: 1px solid var(--danger-line); border-radius: 10px; padding: 14px 16px; margin-bottom: 20px; }
.reject svg { flex: none; margin-top: 1px; }
.reject-text { display: flex; flex-direction: column; gap: 3px; }
.reject-title { font-family: var(--serif); font-weight: 600; font-size: 14.5px; color: var(--danger); }
.reject-text span { font-size: 13px; color: var(--muted); }
.kicker {
  font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--brass); margin-bottom: 10px;
}
h1 {
  font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.12;
  letter-spacing: -.2px; margin: 0 0 12px;
}
.lede { font-size: 14.5px; line-height: 1.6; color: var(--muted); margin: 0 0 20px; }

.bundle { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 14px; margin-bottom: 16px; }
.file-list { list-style: none; margin: 0 0 8px; padding: 0; }
.file-list:empty { margin: 0; }
.file-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px;
  font-size: 13.5px; background: var(--card);
}
.file-list .fl-n { font-family: var(--mono); font-size: 12px; color: var(--ink-3); flex: none; min-width: 16px; }
.file-list .fl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fl-size { font-family: var(--mono); color: var(--ink-3); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.file-list .fl-x {
  border: none; background: transparent; color: var(--ink-3); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 3px 6px; border-radius: 6px;
}
.file-list .fl-x:hover { background: var(--brass-tint); color: var(--brass); }

.drop {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px;
  border: 1.5px dashed var(--line-2); border-radius: 10px; background: var(--inset);
  padding: 26px 16px; cursor: pointer; transition: .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-tint); }
.drop-icon { display: flex; }
.drop-text { font-size: 13.5px; color: var(--muted); }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.formats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 2px; }
.fmt {
  font-size: 11px; letter-spacing: .3px; color: var(--muted);
  background: rgba(28,33,39,.035); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px;
}
.file-name { display: none; }

.actions { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  padding: 11px 18px; border-radius: 9px; cursor: pointer; transition: .12s;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--accent); border-color: var(--accent-d); color: var(--accent-cream);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.13);
}
.btn.primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-tint); border-color: transparent; }
.hint { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.hint b { color: var(--ink); font-weight: 600; }

/* what verification returns, inside the intake card */
.returns { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.rail-head, .acc-head { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 15px; font-weight: 500; margin-bottom: 12px; }
.ret-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .ret-tiles { grid-template-columns: 1fr; } }
.ret { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.ret h3 { font-family: var(--serif); font-weight: 600; font-size: 15.5px; margin: 0 0 6px; }
.ret p { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin: 0; }
.tag { font-size: 12px; color: var(--brass); background: var(--brass-tint); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }

/* ---------- accuracy (full-width card, 3 across) ---------- */
.accuracy { margin-top: 22px; }
.acc-card { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.acc-item { padding: 20px 22px; }
.acc-item + .acc-item { border-left: 1px solid var(--line); }
.acc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.acc-ico {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent-tint);
}
.acc-item h4 { font-family: var(--serif); font-weight: 600; font-size: 15px; margin: 0; }
.acc-item p { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin: 0; }
@media (max-width: 700px) { .acc-card { grid-template-columns: 1fr; } .acc-item + .acc-item { border-left: none; border-top: 1px solid var(--line); } }

/* ---------- comparison (full width, below) ---------- */
.compare { margin-top: 26px; }
.cmp-head { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 16px; font-weight: 500; margin-bottom: 13px; }
.cmp-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cmp th, .cmp td { text-align: left; padding: 13px 18px; vertical-align: top; }
.cmp thead th { font-weight: 600; font-size: 12px; letter-spacing: .3px; color: var(--muted); background: var(--bg); }
.cmp thead th.hl { color: var(--accent-d); }
.cmp tbody th { font-family: var(--serif); font-weight: 500; font-size: 13px; color: var(--ink); width: 168px; background: var(--bg); border-top: 1px solid var(--line); }
.cmp tbody td { color: var(--muted); line-height: 1.5; border-top: 1px solid var(--line); }
.cmp td.hl { color: var(--ink); }
.cmp td.hl::before { content: "\2713"; color: var(--accent); font-weight: 600; margin-right: 8px; }

/* ---------- progress ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.card h2 { font-family: var(--serif); font-weight: 600; margin: 0 0 4px; font-size: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-sub { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; }
.progress-sub.err { color: var(--danger); }
.steps { list-style: none; margin: 22px 0 0; padding: 0; max-width: 420px; }
.step { display: flex; align-items: center; gap: 12px; padding: 13px 2px; font-size: 14px; color: var(--ink-3); }
.step + .step { border-top: 1px solid var(--line); }
.step-ic { width: 22px; height: 22px; flex: none; display: flex; align-items: center; justify-content: center; }
.ic-check { display: none; color: var(--accent); }
.step.pending .step-ic::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.step.active { color: var(--ink); font-weight: 500; }
.step.active .step-ic::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.step.done { color: var(--muted); }
.step.done .ic-check { display: block; }

/* ---------- result ---------- */
.toolbar {
  position: sticky; top: 54px; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg); padding: 10px 2px;
}
.tabs { display: flex; gap: 6px; }
.tab { font: inherit; border: 1px solid var(--line-2); background: var(--card); padding: 8px 16px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-cream); font-weight: 500; }
.tool-actions { display: flex; gap: 8px; align-items: center; }
.edit-toggle { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }

.paper-wrap { background: #d8ddd2; border-radius: 12px; padding: 18px; }
.report-pane { outline: none; }
.report-pane[contenteditable="true"] { box-shadow: 0 0 0 2px var(--accent); border-radius: 8px; }
.report-pane[contenteditable="true"] :focus { outline: none; }

/* ---------- sign-in modal (gates only the verify action) ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(28,33,39,.42); }
.modal { position: relative; width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: 0 12px 40px rgba(28,33,39,.20); }
.modal-x { position: absolute; top: 11px; right: 11px; border: none; background: transparent; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.modal-x:hover { background: rgba(28,33,39,.05); color: var(--ink); }
.modal-title { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0 0 6px; }
.modal-sub { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 18px; max-width: 42ch; }
.signin-input { width: 100%; font-family: var(--sans); font-size: 14px; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--bg); color: var(--ink); }
.signin-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.signin-err { font-size: 12.5px; color: var(--danger); margin: 9px 0 0; }
.signin-submit { width: 100%; justify-content: center; margin-top: 14px; }

@media print {
  .app-bar, .toolbar, #upload, #progress { display: none !important; }
  main { max-width: none; padding: 0; }
  .paper-wrap { background: #fff; padding: 0; border-radius: 0; }
}
