:root {
  --pine: #1e3a34;
  --pine-deep: #142823;
  --pine-mid: #3f6b5a;
  --cream: #f6f1e6;
  --cream-dark: #ece4d2;
  --sand: #d7c4a8;
  --text: #142823;
  --muted: #5a6b64;
  --line: #d9d0bf;
  --white: #fffdf8;
  --ok: #1f6b45;
  --ok-bg: #e4f3ea;
  --wait: #8a5a12;
  --wait-bg: #f8ecd4;
  --tab-h: 64px;
  --banner-h: 36px;
}

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

html, body {
  background: var(--cream-dark);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100%;
}

body {
  max-width: 430px;
  margin: 0 auto;
  background: var(--cream);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }

.banner {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--wait-bg);
  color: var(--wait);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 1px solid #ead7b0;
}

.company {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pine-mid);
  padding: 10px 20px 0;
}

.appbar { padding: 8px 20px 12px; }
.appbar .hello { font-size: 13px; color: var(--muted); }
.appbar h1 { font-size: 22px; font-weight: 700; line-height: 1.2; }
.appbar .addr { font-size: 13px; color: var(--muted); margin-top: 2px; }
.back {
  display: inline-block;
  font-size: 13px;
  color: var(--pine-mid);
  font-weight: 600;
  margin-bottom: 6px;
}

.content {
  flex: 1;
  padding: 8px 16px calc(var(--tab-h) + 16px);
}

.card {
  display: block;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
}

.balance-card {
  background: var(--pine);
  color: var(--cream);
  border: 0;
}
.balance-card .kicker {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
  font-weight: 600;
}
.amount {
  font-size: 40px;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 4px 0 2px;
}
.due { font-size: 14px; opacity: 0.9; }
.split {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(246, 241, 230, 0.25);
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.92;
}

.pay, .primary {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: var(--cream);
  color: var(--pine-deep);
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  padding: 14px 12px;
  border-radius: 14px;
  letter-spacing: -0.01em;
}
.primary { background: var(--pine); color: var(--cream); margin-top: 0; margin-bottom: 12px; }

.list-card .title, .title { font-weight: 700; font-size: 15px; }
.list-card .meta, .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--wait-bg); color: var(--wait); }

.notice { font-size: 13.5px; line-height: 1.4; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 8px; }
.coming {
  text-align: center;
  padding: 28px 12px 8px;
}
.coming h2 { font-size: 20px; margin-bottom: 8px; }
.coming p { color: var(--muted); font-size: 14px; line-height: 1.45; }

.line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  padding: 8px 0;
}
.line + .line { border-top: 1px solid var(--line); }
.line { align-items: flex-start; }
.line > span:last-child { text-align: right; max-width: 62%; overflow-wrap: anywhere; }
.muted { color: var(--muted); }

.menu {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 12px;
}
.menu a, .menu button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 15px 16px;
  font-size: 15.5px;
  font-weight: 600;
  text-align: left;
  border-top: 1px solid var(--line);
}
.menu a:first-child, .menu button:first-child { border-top: 0; }
.menu .count {
  background: var(--pine);
  color: var(--cream);
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  text-align: center;
  line-height: 20px;
  padding: 0 6px;
}
.chev { color: var(--sand); font-weight: 500; }

.doc { padding: 10px 0; }
.doc + .doc { border-top: 1px solid var(--line); }
.doc span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }

.tabs {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: var(--white);
  padding: 8px 4px calc(10px + env(safe-area-inset-bottom));
  z-index: 15;
}
.tab {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.2;
  padding: 4px 0;
}
.tab .ico { display: block; font-size: 18px; margin-bottom: 2px; }
.tab.on, .tab[aria-current="page"] { color: var(--pine); }

.hidden { display: none !important; }
.err { color: var(--clay, #8d4329); font-size: 14px; padding: 16px; }

.appbar { padding-left: 4px; padding-right: 4px; }
.kicker-plain {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.amount-dark { color: var(--pine); }
.history-heading { margin: 4px 4px 10px; }
.docs-heading { margin-bottom: 4px; }
.msg-body { margin-top: 8px; font-size: 14px; line-height: 1.45; }
.line.plain { border-top: 0; padding-top: 0; }
.retry { color: inherit; text-decoration: underline; }

.preview-note {
  font-size: 12.5px;
  color: var(--wait);
  background: var(--wait-bg);
  border-radius: 12px;
  padding: 6px 10px;
  margin: 0 0 8px;
  line-height: 1.35;
}
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 12px 12px;
  min-height: 102px;
  text-align: left;
  color: var(--text);
}
.tile .glyph { width: 28px; height: 28px; margin-bottom: 8px; color: var(--pine); }
.tile .name { font-size: 14px; font-weight: 700; line-height: 1.25; }
.tile:focus-visible,
.choice:focus-within,
.add-photos:focus-within,
.send:focus-visible,
.secondary:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
}
.hint {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.35;
  color: #8d4329;
  background: #f6e7df;
  border-radius: 12px;
  padding: 8px 10px;
}
.chip {
  display: inline-block;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}
.label-sm {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 8px 0 4px;
}
.choice-set { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.note-input {
  width: 100%;
  min-height: 72px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  resize: vertical;
}
.add-photos {
  display: block;
  background: var(--white);
  border: 1px dashed var(--sand);
  border-radius: 14px;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--pine-mid);
  cursor: pointer;
}
.add-photos .fine { display: block; font-weight: 500; margin-top: 2px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--white);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--pine-deep);
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}
.choices { display: flex; gap: 8px; }
.choice {
  position: relative;
  flex: 1;
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 4px;
  font-size: 13px;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.choice:has(input:checked) {
  background: var(--pine);
  color: var(--cream);
  border-color: var(--pine);
}
.send {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: var(--pine);
  color: var(--cream);
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  padding: 14px 12px;
  border-radius: 14px;
}
.send:disabled { opacity: 0.6; cursor: wait; }
.secondary {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: var(--cream);
  color: var(--pine);
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.sent-hero { text-align: center; padding: 8px 8px 4px; }
.check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  margin: 10px auto 12px;
}
.sent-hero h2 { font-size: 22px; margin-bottom: 6px; }
.sent-hero p { color: var(--muted); font-size: 14px; line-height: 1.45; }
.form-error { padding: 0 0 8px; }
.char-count { font-size: 11.5px; color: var(--muted); text-align: right; margin-top: 4px; }

.text-input {
  width: 100%;
  min-height: 48px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  font: inherit;
  font-size: 18px;
  color: var(--text);
}
.text-input:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }
.login-lead { margin: 0 0 8px; }
#login-code { letter-spacing: 0.3em; text-align: center; font-size: 24px; }
.line .meta { display: block; }

/* ---- staff screens ---- */
.tabs.staff {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.tabs.staff .tab { font-size: 10px; padding: 4px 1px; overflow: hidden; }
.tabs.staff .tab .ico { font-size: 16px; margin-bottom: 1px; }
.staff-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 4px 0; }
.linklike { background: none; border: 0; font: inherit; font-size: 12px; font-weight: 800; color: var(--pine); text-decoration: underline; padding: 8px 0 8px 12px; }
.flash { background: var(--ok-bg); color: var(--ok); border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 700; margin: 0 0 12px; }
.filters { display: flex; gap: 6px; margin-bottom: 12px; }
.filters a { flex: 1; text-align: center; font-size: 12px; font-weight: 700; padding: 10px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.filters a.on { background: var(--pine); color: var(--cream); border-color: var(--pine); }
.fold summary { font-weight: 700; font-size: 15px; cursor: pointer; min-height: 24px; }
.fold[open] summary { margin-bottom: 8px; }
.fold .block, .meta.block { display: block; }
.link-btn { text-decoration: none; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 10px 0 2px; min-height: 44px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--pine); }
.office-note { background: var(--wait-bg); color: var(--wait); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-top: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.job-msg { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 13px; background: var(--cream); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 8px 0; line-height: 1.45; }
.msg-actions { display: grid; grid-template-columns: 1fr; gap: 0; }
.msg-actions .secondary { margin-top: 8px; font-size: 15px; }
.secondary.disabled { opacity: 0.45; pointer-events: none; }
.audit-row { padding: 9px 0; border-top: 1px solid var(--line); }
.audit-row:first-child { border-top: 0; }
.audit-row strong { font-size: 13px; word-break: break-all; }
.audit-row .meta { word-break: break-all; }
select.text-input { appearance: auto; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge.alert { background: #f6e7df; color: #8d4329; }
.attention { display: block; background: #f6e7df; color: #8d4329; border: 1px solid #e3c4b4; border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.answer-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.filters { flex-wrap: wrap; }
.filters a { flex: 1 1 28%; }
.quote-row { padding: 10px 0; border-top: 1px solid var(--line); }
.quote-row:first-of-type { border-top: 0; }
.quote-row .secondary { font-size: 14px; margin-top: 8px; }
.fee-row { padding: 10px 0; border-top: 1px solid var(--line); }
.fee-row:first-child { border-top: 0; }
.charge-review, .decision { margin-top: 10px; }
.charge-review .msg-actions, .decision .msg-actions { margin-top: 8px; flex-wrap: wrap; }

/* Records: list rows are links; printing shows only the record */
.list-link { color: inherit; text-decoration: none; display: block; }
@media print {
  .tabs, .staff-top, .msg-actions, .appbar .back, .flash { display: none !important; }
  body { background: #fff; }
}
.sha-line { word-break: break-all; text-align: right; }
.receipts { margin-top: 6px; }
