/* NeoKollect — greenbar ledger.
   The visual language is continuous-feed accounting paper: pale green bands, hairline
   rules only where they encode structure, and figures set tabular so columns of money
   line up the way they do on a printed statement. */

:root {
  --paper:      #F6F7F2;
  --band:       #E6EDE3;
  --ink:        #1A2420;
  --ink-soft:   #5A6B62;
  --rule:       #C6D2C7;
  --recovered:  #1B6B4A;
  --overdue:    #A3341F;
  --unreached:  #D6DCD4;

  --gutter: clamp(1rem, 4vw, 3rem);
  --rail: 15rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-variation-settings: "SOFT" 20, "WONK" 1;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.12;
}

h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--recovered); }

:focus-visible {
  outline: 2px solid var(--recovered);
  outline-offset: 2px;
}

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--ink-soft); }

/* ---------------------------------------------------------------- shell */

.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }

.rail {
  border-right: 1px solid var(--rule);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.mark {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  font-variation-settings: "SOFT" 30, "WONK" 1;
  padding: 0 1.25rem 1.25rem;
  display: block;
  text-decoration: none;
}
.mark span { color: var(--recovered); }

.rail-group { padding: 0.75rem 0; border-top: 1px solid var(--rule); }
.rail-title {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 0 1.25rem 0.5rem;
}

.rail a.nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 1.25rem;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.rail a.nav:hover { background: var(--band); }
.rail a.nav[aria-current="page"] {
  border-left-color: var(--recovered);
  background: var(--band);
  font-weight: 600;
}
.rail a.nav .count { color: var(--ink-soft); font-size: 0.85rem; }

main { padding: 2.5rem var(--gutter) 5rem; max-width: 78rem; }

.crumb { color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 0.6rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.head { margin-bottom: 2rem; }
.head p { margin: 0.5rem 0 0; color: var(--ink-soft); max-width: 60ch; }

/* ---------------------------------------------------------------- totals */

.totals {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  padding: 1.25rem 0 1.5rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}
.total .k { font-size: 0.8rem; color: var(--ink-soft); }
.total .v {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.85rem;
  font-variation-settings: "SOFT" 20;
  line-height: 1.1;
}
.total .v.money { color: var(--overdue); }
.total .v.good { color: var(--recovered); }

/* ---------------------------------------------------------------- ledger */

.ledger { width: 100%; border-collapse: collapse; }

.ledger thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  padding: 0 0.75rem 0.5rem;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
.ledger thead th.r, .ledger td.r { text-align: right; }

/* The alternating band is the greenbar itself: it is how you keep your eye on one row
   across a wide table, which is the whole reason the paper was printed that way. */
.ledger tbody tr:nth-child(odd) { background: var(--band); }
.ledger tbody tr:hover { background: #DCE7D9; }

.ledger td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--rule); }
.ledger td.name { font-weight: 600; width: 40%; }
.ledger td.name a { text-decoration: none; }
.ledger td.name a:hover { text-decoration: underline; }
.ledger td .sub { display: block; font-size: 0.8rem; color: var(--ink-soft); font-weight: 400; }
.ledger .money { font-size: 1rem; }
.ledger .money.due { color: var(--overdue); }

.ledger tfoot td {
  padding: 0.8rem 0.75rem;
  border-top: 2px solid var(--ink);
  font-weight: 600;
}

/* --------------------------------------------------- reach bar (the signature) */

/* The product thesis in one graphic: how much of this money we can actually reach.
   Repeated down the ledger so the pattern across a whole book is readable at a glance. */
.reach { display: flex; align-items: center; gap: 0.6rem; min-width: 9rem; }
.reach-bar {
  flex: 1;
  height: 0.5rem;
  background: var(--unreached);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.reach-fill { height: 100%; background: var(--recovered); }
.reach-pct { font-size: 0.85rem; width: 3.2rem; text-align: right; }
.reach-pct.low { color: var(--overdue); }

/* ---------------------------------------------------------------- tags */

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  white-space: nowrap;
}
.tag.tier-soft       { border-color: #9FB8A6; }
.tag.tier-standard   { border-color: var(--rule); }
.tag.tier-firm       { border-color: #C9944A; color: #7A5312; }
.tag.tier-legal_fast { border-color: var(--overdue); color: var(--overdue); }

/* ---------------------------------------------------------------- forms */

.card {
  border: 1px solid var(--rule);
  background: #FCFDFA;
  padding: 1.5rem;
  max-width: 34rem;
}
label { display: block; font-size: 0.85rem; margin: 0 0 0.3rem; }
.field { margin-bottom: 1.1rem; }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 0;
}
input:focus, select:focus { border-color: var(--recovered); }
.hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.3rem; }

button, .btn {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  border-radius: 0;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--recovered); border-color: var(--recovered); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); }
button.ghost:hover, .btn.ghost:hover { background: var(--band); color: var(--ink); }
button.reject { background: transparent; color: var(--overdue); border-color: var(--overdue); }
button.reject:hover { background: var(--overdue); color: var(--paper); }

/* ---------------------------------------------------------------- verify queue */

.review { border: 1px solid var(--rule); background: #FCFDFA; margin-bottom: 0.75rem; }
.review-head {
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--rule); background: var(--band);
}
.review-body { display: flex; justify-content: space-between; gap: 1.5rem; align-items: center;
  padding: 1rem; flex-wrap: wrap; }
.candidate { font-size: 1.1rem; font-weight: 600; }
.provenance { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.15rem; }
.review-actions { display: flex; gap: 0.5rem; }

/* ---------------------------------------------------------------- empty */

.empty {
  border: 1px dashed var(--rule);
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--ink-soft);
}
.empty h3 { color: var(--ink); margin-bottom: 0.4rem; }
.empty p { margin: 0 auto 1.2rem; max-width: 42ch; }

.flash {
  border-left: 3px solid var(--recovered);
  background: var(--band);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
}
.flash.bad { border-left-color: var(--overdue); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  main { padding-top: 1.5rem; }
  .ledger thead { display: none; }
  .ledger tbody tr { display: grid; grid-template-columns: 1fr auto; padding: 0.5rem 0; }
  .ledger td { border: 0; padding: 0.2rem 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- attention */

.attention { margin-top: 3.5rem; }
.attention h2 { margin-bottom: 0.4rem; }
.attention > p { margin: 0 0 1.25rem; color: var(--ink-soft); max-width: 60ch; }
.attention-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 0.85rem 1rem; border: 1px solid var(--rule); background: #FCFDFA;
  margin-bottom: 0.5rem; flex-wrap: wrap;
}
.attention-row .what { font-weight: 600; }
.attention-row .why { font-size: 0.85rem; color: var(--ink-soft); }
.attention-row .why strong { color: var(--overdue); font-weight: 600; }
.attention-row.calm { background: var(--band); border-style: dashed; }

/* ---------------------------------------------------------------- assessment */

/* The assessor's opinion is advice, not a decision, so it reads as a short judgement
   with its reasoning underneath rather than a score or a confidence bar. */
.verdict { font-size: 0.85rem; font-weight: 600; margin-top: 0.2rem; }
.verdict-yes   { color: var(--recovered); }
.verdict-maybe { color: #7A5312; }
.verdict-no    { color: var(--overdue); }

.enrich { margin: 0 0 2rem; }
.enrich-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  flex-wrap: wrap; padding: 1rem 1.25rem;
  border: 1px solid var(--rule); border-left: 3px solid var(--recovered);
  background: #FCFDFA;
}
.enrich-row .what { font-weight: 600; }
.enrich-row .why { font-size: 0.85rem; color: var(--ink-soft); max-width: 62ch; margin-top: 0.15rem; }

/* ---------------------------------------------------------------- messages */

/* A drafted message is shown as the thing itself, not as a form field with a label.
   The operator is reading a letter, so it should look like one. */
.msg { padding: 1rem 1.25rem; }
.msg-subject { font-weight: 600; margin-bottom: 0.5rem; }
.msg-body { white-space: pre-wrap; font-family: Georgia, serif; line-height: 1.6;
            max-width: 68ch; }
.msg-edit { padding: 1rem 1.25rem 0; }
.msg-edit textarea { font-family: Georgia, serif; line-height: 1.6; resize: vertical; }
.msg-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
               padding: 0.85rem 1.25rem; }
.msg-actions form { margin: 0; }

/* Sign out is a POST (a cross-site link must not end a session), drawn as a link. */
form.signout { display: inline; margin: 0; }
form.signout button { all: unset; cursor: pointer; color: inherit; text-decoration: underline; }
.rail form.signout { display: block; }
.rail form.signout button.nav { display: block; box-sizing: border-box; width: 100%;
  padding: 0.4rem 1.25rem; border-left: 3px solid transparent; text-decoration: none;
  color: var(--ink-soft); }
.rail form.signout button.nav:hover { background: var(--band); }
form.signout button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
