/* ============================================================
   BookingBridge — Reconciliation File
   A paper document, not a SaaS page.
   Desk: warm grey. Sheet: paper white. Ink: near-black.
   Audit red for the break and the stamp. Nothing else.
   Type: Newsreader (document serif) + IBM Plex Mono (ledger)
   ============================================================ */

:root {
  --desk: #DEDAD1;
  --paper: #FBFAF5;
  --ink: #1A1712;
  --ink-soft: #433D34;
  --faint: #7A7263;
  --rule: rgba(26, 23, 18, 0.22);
  --rule-light: rgba(26, 23, 18, 0.12);
  --red: #B23A2E;
  --red-soft: rgba(178, 58, 46, 0.08);
  --serif: "Newsreader", "Times New Roman", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  background: var(--desk);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ink); color: var(--paper); }

.mono { font-family: var(--mono); }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---------- the desk and the sheet ---------- */

.desk {
  min-height: 100dvh;
  padding: 56px 20px 96px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    var(--desk);
}

.sheet {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.02 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--paper);
  border: 1px solid rgba(26, 23, 18, 0.18);
  box-shadow:
    0 1px 2px rgba(26, 23, 18, 0.10),
    0 12px 40px -18px rgba(26, 23, 18, 0.35);
  padding: 72px 84px 56px;
}

/* ---------- slim file bar ---------- */

.filebar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
.filebar.visible { transform: translateY(0); }
.fb-ref { color: var(--faint); text-transform: uppercase; }
.filebar a { color: var(--ink); text-transform: uppercase; }

/* ---------- letterhead ---------- */

.letterhead { border-bottom: 2.5px solid var(--ink); padding-bottom: 26px; }

.lh-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 32px;
}

.lh-issuer { display: flex; gap: 14px; align-items: flex-start; }
.lh-mark { width: 34px; height: 34px; color: var(--ink); flex: none; margin-top: 3px; }
.lh-mark svg { width: 100%; height: 100%; }
.lh-name {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.lh-sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 5px;
}

.lh-meta { border-collapse: collapse; font-family: var(--mono); font-size: 0.72rem; flex: none; }
.lh-meta th, .lh-meta td { text-align: left; padding: 3px 0; vertical-align: baseline; }
.lh-meta th {
  font-weight: 400; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding-right: 18px;
}
.lh-meta td { font-weight: 500; }
.status-open {
  color: var(--red);
  border: 1px solid currentColor;
  padding: 1px 7px;
  letter-spacing: 0.08em;
}

.lh-re { margin-top: 34px; }
.re-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-right: 10px;
}
.re-line {
  font-size: clamp(1.7rem, 3.6vw, 2.35rem);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.015em;
  text-wrap: balance;
  font-optical-sizing: auto;
}
.re-line .re-label { position: relative; top: -0.5em; }
.re-prepared { margin-top: 14px; font-size: 0.98rem; color: var(--ink-soft); font-style: italic; }

/* ---------- sections ---------- */

.doc-section { padding: 44px 0 8px; }
.doc-section + .doc-section { border-top: 1px solid var(--rule-light); margin-top: 36px; }

.sec-head {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 26px;
}
.sec-no {
  font-weight: 400;
  color: var(--faint);
  border: 1px solid var(--rule);
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  font-size: 0.72rem;
}

.sec-lede, .sec-body { color: var(--ink-soft); max-width: 62ch; }
.sec-body + .sec-body { margin-top: 16px; }
.sec-note {
  margin-top: 18px;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 60ch;
}

.plain-statement {
  margin-top: 26px;
  font-size: 1.28rem;
  font-style: italic;
  font-weight: 500;
  color: var(--ink);
  max-width: 32em;
}

.mono-inline {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--red-soft);
  color: var(--red);
  padding: 1px 6px;
}

.xref { color: var(--faint); font-style: italic; white-space: nowrap; }

/* footnote refs */
.fn-ref { text-decoration: none; color: var(--red); }
.fn-ref sup { font-family: var(--mono); font-size: 0.62em; margin-left: 1px; }

/* ---------- findings list ---------- */

.findings { list-style: none; max-width: 66ch; }
.findings li {
  position: relative;
  padding: 13px 0 13px 62px;
  border-top: 1px solid var(--rule-light);
  color: var(--ink-soft);
}
.findings li:last-child { border-bottom: 1px solid var(--rule-light); }
.f-no {
  position: absolute; left: 0; top: 15px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--faint);
}

.action-required {
  margin-top: 24px;
  padding: 14px 18px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink);
  font-size: 0.95rem;
  color: var(--ink-soft);
  max-width: 62ch;
}

/* ---------- figure / exhibit A ---------- */

.figure { margin: 0; }
.fig-frame {
  border: 1px solid var(--rule);
  padding: 34px 30px 26px;
}

.hop { display: flex; align-items: stretch; gap: 14px; }
.hop-node {
  flex: 1;
  border: 1.5px solid var(--ink);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.hop-node.lost { border-style: dashed; border-color: var(--red); }
.hn-label { font-weight: 600; font-size: 0.96rem; line-height: 1.3; }
.hn-label em { font-style: italic; font-weight: 400; color: var(--faint); font-size: 0.85em; white-space: nowrap; }
.hn-note { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.hop-node.lost .hn-note { color: var(--red); }

.hop-arrow {
  align-self: center;
  font-size: 1.3rem;
  color: var(--ink-soft);
  position: relative;
  flex: none;
  padding: 0 2px;
}
.hop-arrow.broken { color: rgba(26, 23, 18, 0.3); }
.hop-x {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -54%);
  color: var(--red);
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--paper);
  padding: 0 2px;
}

.hop-verdict {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--rule);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  text-align: right;
}

figcaption {
  margin-top: 14px;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--faint);
  max-width: 64ch;
}
.fig-no { font-style: normal; font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); margin-right: 6px; }

/* ---------- exhibit B: the trail ---------- */

.trail { margin-top: 26px; border: 1px solid var(--rule); }

.trail-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 18px;
  border-bottom: 1.5px solid var(--ink);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.tier-stamp {
  color: var(--red);
  border: 1.5px solid currentColor;
  padding: 2px 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  white-space: nowrap;
  transform: rotate(-1.5deg);
}

.trail-table { width: 100%; border-collapse: collapse; }
.trail-table td { padding: 13px 18px; vertical-align: baseline; border-top: 1px solid var(--rule-light); }
.trail-table tr:first-child td { border-top: none; }
.tt-date { width: 72px; font-size: 0.74rem; color: var(--faint); text-transform: uppercase; white-space: nowrap; }
.tt-event { font-size: 0.94rem; color: var(--ink-soft); }
.tt-obj { font-size: 0.74rem; text-align: right; white-space: nowrap; color: var(--ink); }
.tt-contrast td { background: var(--red-soft); }
.tt-contrast .tt-event { font-style: italic; }
.strike { text-decoration: line-through; text-decoration-color: var(--red); color: var(--faint); }

/* redaction bars */
.redact {
  background: var(--ink);
  color: var(--ink);
  border-radius: 1px;
  padding: 0 2px;
  user-select: none;
  letter-spacing: -0.05em;
}
.redact.sm { font-size: 0.9em; }

/* ---------- exhibit C: ledger ---------- */

.ledger { width: 100%; border-collapse: collapse; margin-top: 26px; border: 1px solid var(--rule); }
.ledger th, .ledger td { padding: 15px 18px; vertical-align: baseline; text-align: left; border-top: 1px solid var(--rule-light); }
.ledger tr:first-child th, .ledger tr:first-child td { border-top: none; }
.ledger th { font-weight: 500; font-size: 0.98rem; color: var(--ink-soft); }
.lg-amt { font-size: 0.95rem; font-weight: 600; text-align: right; white-space: nowrap; width: 150px; }
.lg-basis { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); text-align: right; white-space: nowrap; width: 210px; }

.lg-dim th { color: var(--faint); font-style: italic; }
.lg-dim .lg-amt { font-weight: 400; color: var(--faint); }

.lg-strong th { font-weight: 600; color: var(--ink); }
.lg-strong td { border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.lg-strong th { border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.lg-strong .lg-amt { font-size: 1.12rem; }

.ledger-note { margin-top: 18px; font-size: 0.92rem; font-style: italic; color: var(--ink-soft); max-width: 62ch; }

/* ---------- tier definitions ---------- */

.tier-defs { margin-top: 28px; max-width: 62ch; }
.td-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 20px;
  padding: 11px 0;
  border-top: 1px solid var(--rule-light);
  align-items: baseline;
}
.td-row:last-child { border-bottom: 1px solid var(--rule-light); }
.td-row dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; }
.td-row dd { font-size: 0.94rem; color: var(--ink-soft); }

/* ---------- request form ---------- */

.req-form { margin-top: 30px; position: relative; }

.req-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px 36px;
}

.req-field { display: flex; flex-direction: column; gap: 4px; }
.req-field label {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
}
.req-field input, .req-field select {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--rule);
  padding: 7px 2px;
  border-radius: 0;
  appearance: none;
  transition: border-color 0.2s ease;
}
.req-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%237A7263' stroke-width='1.4' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  cursor: pointer;
}
.req-field input:focus, .req-field select:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
.req-field.invalid input { border-bottom-color: var(--red); }
.req-err { display: none; font-size: 0.78rem; font-style: italic; color: var(--red); }
.req-field.invalid .req-err { display: block; }

.req-actions {
  margin-top: 34px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.req-submit {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 1.5px solid var(--ink);
  padding: 13px 30px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.req-submit:hover { background: var(--paper); color: var(--ink); }
.req-submit:active { transform: translateY(1px); }
.req-fine { font-size: 0.64rem; color: var(--faint); letter-spacing: 0.04em; max-width: 34ch; line-height: 1.6; }

.req-done {
  position: absolute; inset: 0;
  background: var(--paper);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  gap: 10px;
}
.req-done[hidden] { display: none; }
.rd-head {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em;
  color: var(--red);
  border: 1.5px solid currentColor;
  padding: 3px 10px;
  transform: rotate(-1deg);
}
.req-done p:last-child { color: var(--ink-soft); max-width: 46ch; }

/* ---------- anticipated questions ---------- */

.qa-list { max-width: 66ch; }
.qa-row { padding: 16px 0; border-top: 1px solid var(--rule-light); }
.qa-row:last-child { border-bottom: 1px solid var(--rule-light); }
.qa-row dt { font-weight: 600; font-size: 1.02rem; margin-bottom: 6px; }
.qa-row dt::before { content: "Q. "; color: var(--faint); font-weight: 400; font-style: italic; }
.qa-row dd { color: var(--ink-soft); font-size: 0.96rem; }
.qa-row dd::before { content: "A. "; color: var(--faint); font-style: italic; }

/* ---------- signoff ---------- */

.signoff {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 2.5px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}

.sig-line { font-size: 0.9rem; font-style: italic; color: var(--faint); }
.sig-name {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 4px;
  line-height: 1.1;
}
.sig-sub { font-family: var(--mono); font-size: 0.68rem; color: var(--faint); margin-top: 8px; letter-spacing: 0.05em; }
.sig-sub a { color: var(--ink-soft); }

.stamp {
  width: 132px; height: 132px; flex: none;
  color: var(--red);
  opacity: 0.82;
  transform: rotate(8deg);
}
.stamp svg { width: 100%; height: 100%; }
.stamp-text {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 2.5px;
  fill: currentColor;
}
.stamp-center {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  fill: currentColor;
}
.stamp-center-sm {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 2px;
  fill: currentColor;
}

/* ---------- footnotes ---------- */

.footnotes { margin-top: 48px; }
.fn-rule {
  border: none;
  border-top: 1px solid var(--ink);
  width: 180px;
  margin: 0 0 16px;
}
.footnotes ol { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footnotes li { font-size: 0.82rem; color: var(--faint); max-width: 70ch; }
.fn-back { font-family: var(--mono); font-size: 0.74rem; text-decoration: none; color: var(--ink-soft); margin-right: 4px; }

.doc-foot {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-light);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  flex-wrap: wrap;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .filebar { transition: none; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 860px) {
  .sheet { padding: 52px 44px 44px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .desk { padding: 28px 10px 64px; }
  .sheet { padding: 40px 22px 36px; }

  .lh-row { flex-direction: column; gap: 24px; }
  .lh-re { margin-top: 26px; }

  .findings li { padding-left: 46px; }

  .hop { flex-direction: column; gap: 10px; }
  .hop-arrow { transform: rotate(90deg); padding: 2px 0; }
  .hop-x { transform: translate(-50%, -54%) rotate(-90deg); }
  .fig-frame { padding: 22px 18px 18px; }
  .hop-verdict { text-align: left; }

  .trail-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .trail-table td { padding: 11px 12px; }
  .tt-obj { white-space: normal; word-break: break-all; }

  .ledger th, .ledger td { padding: 12px 12px; }
  .lg-basis { display: none; }
  .lg-amt { width: auto; }

  .td-row { grid-template-columns: 1fr; gap: 4px; }

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

  .signoff { flex-direction: column; align-items: flex-start; }
  .stamp { align-self: flex-end; margin-top: -30px; }

  .doc-foot { flex-direction: column; gap: 4px; }
}
