:root {
  --paper: #efece4;
  --paper-deep: #e3ddd0;
  --card: #f7f5ef;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #d5cfc2;
  --green: #0c6b4d;
  --green-deep: #084b36;
  --green-soft: #e4f3ec;
  --amber: #8a5a12;
  --amber-soft: #f8efd8;
  --red: #8d2f2f;
  --red-soft: #f8e6e2;
  --shadow: 0 18px 40px rgba(48, 38, 18, 0.06);
  --sans: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background:
    linear-gradient(var(--green), var(--green)) top / 100% 6px no-repeat,
    var(--paper);
}

h1, h2, p { margin: 0; }

h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h2 {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 560;
  letter-spacing: -0.02em;
}

a { color: var(--green-deep); }

button, input, select { font: inherit; color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background:
    linear-gradient(var(--paper), var(--paper)) center / 16px 2px no-repeat,
    linear-gradient(var(--paper), var(--paper)) center / 2px 16px no-repeat,
    var(--green);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.brand-name {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.session {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--muted);
  font-size: 0.85rem;
}

.pill.live {
  background: var(--green-soft);
  color: var(--green-deep);
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px 48px;
}

.intro { max-width: 38rem; padding: 18px 0 28px; }

.intro p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1.05rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.8fr);
  gap: 20px;
}

.layout > * { min-width: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.pay-card, .side { padding: 22px; }

.signed-out p { margin: 0 0 16px; color: var(--muted); }

.signed-out .button { margin-top: 0; }

.ledger { grid-column: 1 / -1; padding: 22px; }

.field, fieldset.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.field > span, fieldset.field legend, .treasury-head {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.note { margin-top: 8px; color: var(--muted); font-size: 0.92rem; }

.note.warn {
  color: var(--amber);
}

.segmented, .presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented label, .presets button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.segmented label:has(input:focus-visible), .presets button:focus-visible, .button:focus-visible, .text-button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.amount-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
}

.amount-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 8vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.amount-row:focus-within { border-bottom-color: var(--green); }

.amount-row input:focus { outline: none; }

.amount-row span {
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.treasury { margin-top: 22px; }

.treasury-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.address {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.button {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.button:hover:not(:disabled) { background: var(--green-deep); }

.button:disabled {
  background: #d4cec2;
  color: #6f695e;
  cursor: not-allowed;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--green-deep);
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  padding: 0;
}

.account {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper-deep);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.status { min-height: 1.4em; margin-top: 12px; }

.status.bad { color: var(--red); }

.status.ok { color: var(--green-deep); }

.status a { font-weight: 600; }

.steps {
  margin: 12px 0 0;
  padding-left: 1.2rem;
  color: var(--ink);
}

.steps li { margin: 8px 0; }

.steps li::marker { color: var(--green); font-weight: 600; }

.callout {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green-soft);
}

.balances-heading { margin-top: 26px; }

.balances {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.balances li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.balances li span:last-child {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ledger-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.table-wrap { overflow-x: auto; margin-top: 8px; }

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td.num, td.mono { font-family: var(--mono); font-size: 0.86rem; }

td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

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

.more { margin-top: 12px; }

footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 800px) {
  .top, main, footer { padding-left: 16px; padding-right: 16px; }
  .top { align-items: flex-start; flex-direction: column; padding-top: 16px; }
  main { padding-top: 0; padding-bottom: 32px; }
  .intro { padding: 8px 0 16px; }
  h1 { font-size: 2rem; }
  .layout { grid-template-columns: 1fr; }
  .pay-card, .side, .ledger { padding: 16px; }
  .session { width: 100%; justify-content: flex-start; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; }
  thead { display: none; }
  tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border: 0;
    padding: 3px 0;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  td.num { white-space: normal; }
}
