/* Review portal. Windows built-in fonts only: no web fonts, no CDN, no images, so it works offline.
   Bahnschrift carries figures, unit labels and decision stamps; Segoe UI carries the text. */

:root {
  --paper: #eef1f4;
  --surface: #ffffff;
  --ink: #1d2b3a;
  --muted: #5a6878;
  --line: #cbd3dc;
  --serve: #2f7d4f;
  --remove: #a63d32;
  --follow: #b7791f;
  --focus: #2d5bd7;
  --serve-wash: #e7f2eb;
  --remove-wash: #f6e6e4;
  --follow-wash: #f8efdf;
  --focus-wash: #e6ecfb;
  --text-font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --figure-font: "Bahnschrift", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 var(--text-font);
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--focus); }
a:hover { color: var(--ink); }

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

h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1.2rem; font-weight: 600; margin-top: 24px; }
h3 { font-size: 1rem; font-weight: 600; }

.num, .money {
  font-family: var(--figure-font);
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--muted); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10;
  background: var(--surface);
  padding: 8px;
}

.skip-link:focus { left: 16px; }

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.site-name { margin: 0; font-weight: 600; }
.site-name a { color: var(--ink); text-decoration: none; }

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
}

.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration-thickness: 2px; }
.nav-links .muted { font-weight: 400; }

.account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--muted); }

.inline-form { display: inline; margin: 0; }

/* Main column for the ordinary pages */

main.page {
  max-width: 64rem;
  margin: 24px auto;
  padding: 24px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

main.page section + section { margin-top: 8px; }

/* Controls */

button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  min-height: 40px;
  padding: 6px 16px;
  color: var(--surface);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}

button:hover, .button-link:hover { color: var(--surface); background: #2c3e52; }

button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--paper);
  border-color: var(--line);
}

.button-primary { background: var(--focus); border-color: var(--focus); color: var(--surface); }
.button-primary:hover { background: #2349b0; }

.button-secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.button-secondary:hover { color: var(--ink); background: var(--paper); }

.button-quiet {
  min-height: 32px;
  padding: 4px 10px;
  font-weight: 400;
  color: var(--focus);
  background: transparent;
  border-color: transparent;
}

.button-quiet:hover { color: var(--ink); background: var(--focus-wash); }

input[type="text"], input[type="password"], input[type="date"], textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  min-height: 40px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
}

input[type="text"], input[type="password"] { width: 100%; max-width: 24rem; }

textarea { width: 100%; max-width: 40rem; }

label { font-weight: 600; }

.login-form { max-width: 24rem; }

form.decision {
  display: grid;
  gap: 6px;
  max-width: 40rem;
  margin: 0 0 24px;
}

form.decision button { justify-self: start; }

details summary { cursor: pointer; }

/* Tables */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

caption { text-align: left; font-weight: 600; padding: 8px 0; }

th, td {
  text-align: left;
  vertical-align: top;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

th { font-weight: 600; color: var(--muted); }

td.money, th.money { text-align: right; }

/* A row's state group: attention needs a decision, serve will be served, not-served is out of this notice run. */
tr.attention { background: var(--follow-wash); }
tr.serve { background: var(--serve-wash); }
tr.not-served { color: var(--muted); }
tr.withdrawn { color: var(--muted); }

/* A value that changed since the earlier pull. */
.changed { font-weight: 600; }
.changed::after { content: " (changed)"; font-weight: 400; }

dl { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: 4px 16px; margin: 0 0 16px; }
dt { font-weight: 600; }
dd { margin: 0; }

blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 4px solid var(--line);
  background: var(--paper);
}

/* Messages */

.messages { list-style: none; padding: 0; margin: 0 0 16px; }

.message {
  padding: 8px 12px;
  margin: 0 0 8px;
  border-left: 4px solid var(--line);
  background: var(--paper);
}

.message.error { background: var(--remove-wash); border-left-color: var(--remove); }
.message.success { background: var(--serve-wash); border-left-color: var(--serve); }
.message.warning { background: var(--follow-wash); border-left-color: var(--follow); }

/* A lease on an approved list that went on Do Not Serve after the approval. */
.warning-block {
  padding: 8px 16px;
  margin: 0 0 16px;
  border: 2px solid var(--remove);
  border-left-width: 8px;
  background: var(--remove-wash);
}

/* The decision stamp: the one loud thing on the review screen. */

.stamp {
  display: inline-block;
  margin: 0;
  padding: 4px 12px;
  font-family: var(--figure-font);
  font-stretch: condensed;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--stamp);
  border: 4px double var(--stamp);
  border-radius: 3px;
  transform: rotate(-4deg);
  opacity: 0.92;
}

.stamp-serving { --stamp: var(--serve); }
.stamp-removed { --stamp: var(--remove); }
.stamp-follow_up { --stamp: var(--follow); }

.stamp-small {
  padding: 0 5px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-width: 3px;
}

/* The review screen (triage desk) */

main.triage { padding: 0 24px 32px; }

.triage-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  margin: 0 -24px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.triage-bar h1 { margin: 0; font-size: 1.25rem; }

.progress { display: flex; align-items: center; gap: 12px; flex: 1 1 16rem; }
.progress-label { font-weight: 400; white-space: nowrap; }

progress {
  appearance: none;
  flex: 1 1 auto;
  max-width: 20rem;
  height: 8px;
  border: 0;
  border-radius: 4px;
  background: var(--paper);
  color: var(--serve);
}

progress::-webkit-progress-bar { background: var(--paper); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--serve); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--serve); border-radius: 4px; }

.bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.signed { color: var(--serve); font-weight: 600; }

/* The tab row: the tabs, and the keyboard hint inline to their right; on a narrow screen the hint wraps under them. */
.tab-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px 16px;
  margin: 16px 0 12px;
}

.tab-row .tabs { flex: 1 1 auto; min-width: 0; }

.tabs ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  display: inline-block;
  padding: 8px 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.tabs .count { margin-left: 4px; color: var(--muted); font-weight: 400; }

.triage-panes {
  display: grid;
  grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.queue, .detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.queue {
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}

.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li + li { border-top: 1px solid var(--line); }

.queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 10px 14px 10px 11px;
  color: var(--ink);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.queue-item:hover { background: var(--paper); color: var(--ink); }
.queue-item[aria-current="true"] { background: var(--focus-wash); border-left-color: var(--focus); }
.queue-item:focus-visible { outline-offset: -3px; }

.q-unit { font-family: var(--figure-font); font-weight: 600; overflow-wrap: anywhere; }
.q-amount { text-align: right; }
.q-tenants { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.q-mark { text-align: right; align-self: center; }
.q-state { font-size: 0.8rem; color: var(--muted); }
.q-papers { font-size: 0.8rem; color: var(--follow); font-weight: 600; border: 1px solid currentColor; border-radius: 3px; padding: 0 0.25rem; }
/* Status words in the list: plain boxes like Papers. Removed shows why (owner, 2026-11-18). */
.q-tag { font-size: 0.8rem; font-weight: 600; border: 1px solid currentColor; border-radius: 3px; padding: 0 0.25rem; white-space: nowrap; }
.q-tag-removed { color: var(--remove); }
.q-tag-serving { color: var(--serve); }
.q-tag-follow_up { color: var(--follow); }
.q-changed { font-size: 0.8rem; color: var(--follow); font-weight: 600; }

.queue-empty, .detail-empty { padding: 16px; color: var(--muted); }

.keys { flex: 0 1 auto; margin: 0; padding: 0 0 9px; font-size: 0.8rem; line-height: 1.6; color: var(--muted); }

kbd {
  font-family: var(--figure-font);
  font-size: 0.8rem;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
}

.detail { padding: 20px 24px 24px; min-width: 0; }

.detail-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 24px;
}

.detail-head .unit {
  margin: 0;
  font-family: var(--figure-font);
  font-size: 1.6rem;
  font-weight: 600;
}

.tenants { margin: 2px 0 0; font-size: 1.05rem; }
.meta { margin: 2px 0 0; color: var(--muted); font-size: 0.875rem; }

.detail-head .stamp { margin: 6px 8px 0 0; }

.step { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 0; font-size: 0.9rem; }

.block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.block h3 { margin-bottom: 10px; }

.figures { display: flex; flex-wrap: wrap; gap: 8px 40px; margin: 0 0 12px; }
.figures div { display: grid; gap: 0; }
.figures dt { font-weight: 400; color: var(--muted); font-size: 0.875rem; }
.figures dd { font-size: 1.35rem; }
.figures dd .muted { font-size: 0.875rem; font-family: var(--text-font); }

table.lines { font-size: 0.9rem; }
table.lines th, table.lines td { padding: 4px 8px; }

/* A long table in its own box: at most 15 rows show at a time (portal.js sets the exact height; this is the estimate
   without script), the header row stays put while the rows scroll under it. */
.scroll-box {
  --box-rows: 15;
  position: relative;
  max-height: calc((var(--box-rows) + 1) * (0.9rem * 1.5 + 9px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.scroll-box:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.scroll-box table.lines td, .scroll-box table.lines th { line-height: 1.5; }
.scroll-box tbody tr:last-child td { border-bottom: 0; }

.scroll-box thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--line);  /* the header's rule, kept while it is stuck (a collapsed border scrolls away) */
}

.scroll-note { margin: 0 0 6px; font-size: 0.875rem; }

/* What the notice asks for: its lines as they print, and the total. */
table.notice-items { width: auto; min-width: min(100%, 24rem); margin: 0 0 12px; }
table.notice-items td .muted { font-size: 0.85em; }
table.notice-items tfoot th, table.notice-items tfoot td {
  color: var(--ink);
  font-weight: 600;
  border-top: 2px solid var(--line);
  border-bottom: 0;
}

.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.reason {
  padding: 6px 10px;
  border-left: 3px solid var(--line);
  background: var(--paper);
}

.reason.is-flag { border-left-color: var(--follow); }
.reason.is-exclude { border-left-color: var(--remove); }
.reason.is-follow { border-left-color: var(--follow); background: var(--follow-wash); }
.reason.is-ready { border-left-color: var(--serve); background: var(--serve-wash); }

/* The approval panel on the batch summary: the review screen's figures, reasons and buttons. */
.approval-panel .figures { margin-top: 8px; }
.decision-counts dt a { color: var(--focus); }
.blockers a { margin-left: 4px; }
.clear-many { margin-top: 12px; }
.clear-many summary { font-weight: 600; margin-bottom: 8px; }
.consequence { max-width: 44rem; }
.approve-block .button-primary { min-height: 48px; font-size: 1.05rem; }

.decide { display: grid; gap: 6px; max-width: 44rem; }
.decide textarea { max-width: none; }
.fee-input { max-width: 10rem !important; }
.blocker { margin: 4px 0; padding: 6px 10px; background: var(--remove-wash); border-left: 3px solid var(--remove); }
.hint { margin: 0; min-height: 1.5em; color: var(--remove); font-weight: 600; }

.decide-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 10px;
}

.decide-button {
  min-height: 56px;
  font-size: 1.05rem;
  color: var(--surface);
}

.decide-button.is-serve { background: var(--serve); border-color: var(--serve); }
.decide-button.is-remove { background: var(--remove); border-color: var(--remove); }
.decide-button.is-follow { background: var(--follow); border-color: var(--follow); color: var(--ink); }
.decide-button.is-dns { background: var(--ink); border-color: var(--ink); }
.decide-button:hover { color: var(--surface); filter: brightness(0.92); }
.decide-button.is-follow:hover { color: var(--ink); }
.decide-button:disabled { color: var(--muted); background: var(--paper); border-color: var(--line); filter: none; }

.decide-more { margin: 4px 0 0; font-size: 0.875rem; }

.undo-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
  padding: 8px 12px;
  background: var(--paper);
  border-radius: var(--radius);
}

.added-text label { font-weight: 400; color: var(--muted); font-size: 0.875rem; }
.added-text-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.added-text-block h4 { margin: 0 0 6px; font-size: 1rem; }
.fee-reading { margin-top: 10px; }
.field-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.field-row input[type="text"] { flex: 1 1 18rem; max-width: none; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history li { display: grid; gap: 0; padding-left: 12px; border-left: 2px solid var(--line); }
.h-what { font-weight: 600; }
.h-who { color: var(--muted); font-size: 0.85rem; }
.h-comment { white-space: pre-wrap; }
.history .withdrawn { color: var(--muted); }

@media (max-width: 900px) {
  main.triage { padding: 0 16px 24px; }
  .triage-bar { margin: 0 -16px; padding: 10px 16px; }
  .triage-panes { grid-template-columns: minmax(0, 1fr); }
  .queue { position: static; max-height: 22rem; }
  .detail { padding: 16px; }
  main.page { margin: 0; padding: 16px; border: 0; border-radius: 0; }
}

@media (max-width: 560px) {
  .site-header { flex-direction: column; align-items: flex-start; padding: 10px 16px; }
  .decide-buttons { grid-template-columns: minmax(0, 1fr); }
  .triage-bar { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Review screen, second round (G83): search and order, the tool's suggestion, who paid, the ledger. */
.queue-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 12px; margin: 8px 0; }
.queue-tools label { font-size: 0.85rem; }
.queue-tools input[type="search"] { min-width: 16rem; }
.suggestion { margin: 0 0 8px; font-size: 0.9rem; }
.payers { margin-top: 8px; padding: 8px 12px; background: var(--follow-wash); border-radius: var(--radius); }
.payers p { margin: 0 0 4px; }
.payers ul { margin: 0; padding-left: 20px; }
table.ledger tr.is-debit td:nth-child(4) { color: var(--remove); }
table.ledger tr.is-credit td:nth-child(4) { color: var(--serve); }
.dns-add { display: grid; gap: 4px; max-width: 32rem; }
/* Notice fee review page (G94): one lease per tbody, the fee and the lease's wording side by side. */
.fee-progress { font-family: var(--figure-font); }
.fee-table { background: var(--surface); }
.fee-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; border-bottom: 2px solid var(--line); }
.fee-table tbody tr:first-child > * { border-bottom: 0; }
.fee-table tbody.is-needs-fee > tr { background: var(--follow-wash); }
.fee-table tbody.is-checked > tr:first-child > th { border-left: 3px solid var(--serve); }
.fee-table th[scope="row"] { font-family: var(--figure-font); font-weight: 600; min-width: 11rem; }
.fee-table td > span, .fee-table th > span, .fee-table td > a { display: block; }
.fee-table td > span.q-tag { display: inline-block; margin-bottom: 2px; }
.fee-table td.money strong { font-family: var(--figure-font); font-size: 1.1rem; }
.fee-missing { color: var(--follow); font-weight: 600; }
.fee-by, .fee-tenants { font-size: 0.85rem; font-weight: 400; font-family: var(--text-font); }
.fee-amounts { margin: 4px 0 0; padding-left: 18px; font-family: var(--figure-font); }
.fee-check form { margin-top: 4px; }
.fee-more td { padding-top: 0; }
.fee-more details { margin: 0 0 6px; }
.fee-more blockquote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--line); max-width: 75ch; white-space: pre-line; }
.fee-set { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 12px; margin-top: 6px; }
.fee-set label { display: block; font-size: 0.85rem; }
.fee-set input[name="comment"] { width: min(24rem, 70vw); }
.fee-wording-pair { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px 20px; align-items: start; margin-top: 6px; }
.fee-wording-pair figure { margin: 0; }
.fee-wording-pair figcaption { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.fee-wording-pair img { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
.fee-wording-pair blockquote { margin: 0; }
@media (max-width: 900px) { .fee-wording-pair { grid-template-columns: minmax(0, 1fr); } }
