:root {
  color-scheme: light;
  --paper: #eef2f7;
  --card: #ffffff;
  --ink: #142036;
  --muted: #5a6478;
  --line: #d9e0ea;

  /* Whole-amount buckets */
  --tithe: #c28a12;
  --personal: #3352c9;
  --pool: #18774e;

  /* Pool buckets: shades of the pool's green, because they come out of it */
  --dad: #135c3d;
  --mom: #3fa675;
  --misc: #8ccba9;

  --display: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--personal); outline-offset: 2px; }

.page {
  width: min(520px, 100% - 32px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 0 32px;
}

/* Header */
.top h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.top p { margin: 2px 0 18px; color: var(--muted); font-size: 14px; }

/* Amount input */
.amount-card {
  background: var(--ink);
  color: #fff;
  border-radius: 20px;
  padding: 18px 18px 16px;
}
.amount-card label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #aab4c8;
}
.amount-box { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 2px; }
.naira { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--tithe); }
#amount {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  font-family: var(--display);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
#amount:focus { outline: none; }
.amount-box:focus-within { box-shadow: 0 2px 0 var(--tithe); }
#amount::placeholder { color: #5f6b82; }
.error { margin: 6px 0 0; min-height: 0; color: #ffb4a6; font-size: 13px; }
.error:empty { display: none; }

.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick button {
  border: 1px solid #34425e;
  background: transparent;
  color: #d6dcea;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 12px;
}
.quick button:hover { border-color: #6f7d99; }
.quick button.active { background: #fff; border-color: #fff; color: var(--ink); }

/* Split sections */
.split {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 16px 6px;
  margin-top: 16px;
}
.split h2 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.pool-total {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pool);
  font-variant-numeric: tabular-nums;
}

.strip {
  display: flex;
  gap: 3px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
}
.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
}
.seg b { font-weight: 600; }
.seg.tithe { width: 10%; background: var(--tithe); }
.seg.personal { width: 70%; background: var(--personal); }
.seg.pool { width: 20%; background: var(--pool); }
.seg.dad { width: 40%; background: var(--dad); }
.seg.mom { width: 20%; background: var(--mom); color: var(--ink); }
.seg.misc { width: 10%; background: var(--misc); }
/* Hatched: this part of the pool isn't assigned to anyone yet */
.seg.unallocated {
  width: 30%;
  color: var(--pool);
  background: repeating-linear-gradient(-45deg, #e3f3ea 0 6px, #c9e8d6 6px 12px);
}

.rows { list-style: none; margin: 10px 0 0; padding: 0; }
.rows li {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.rows li:first-child { border-top: 0; }
.dot { width: 12px; height: 12px; border-radius: 4px; }
.dot.tithe { background: var(--tithe); }
.dot.personal { background: var(--personal); }
.dot.pool { background: var(--pool); }
.dot.dad { background: var(--dad); }
.dot.mom { background: var(--mom); }
.dot.misc { background: var(--misc); }
.dot.unallocated { background: repeating-linear-gradient(-45deg, #e3f3ea 0 3px, #9fd3b7 3px 6px); }
.name { font-weight: 600; }
.pct { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.value {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 7.5em;
}

/* The pool slice opening out into the second bar */
.zoom { position: relative; margin: 0 17px; height: 46px; }
.zoom svg { display: block; width: 100%; height: 100%; }
.zoom polygon { fill: var(--pool); opacity: 0.14; }
.zoom span {
  position: absolute;
  left: 0;
  bottom: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--pool);
}
.pool-split { margin-top: 0; border-top: 3px solid var(--pool); }
.note { margin: 2px 0 12px; color: var(--muted); font-size: 13px; }

/* Actions */
.actions { display: flex; gap: 10px; margin-top: 16px; }
.btn {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  font-weight: 700;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }

footer { margin-top: 18px; text-align: center; color: var(--muted); font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: opacity .2s, transform .2s;
  width: max-content;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 380px) {
  #amount { font-size: 36px; }
  .value { font-size: 16px; min-width: 6.5em; }
  .rows li { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
@media print {
  body { background: #fff; }
  .quick, .actions, .toast { display: none; }
  .amount-card, .seg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
