:root {
  color-scheme: dark;
  --bg: #111a1f;
  --surface: #19252b;
  --raised: #24343b;
  --line: #334851;
  --control: #607781;
  --ink: #f0f5f2;
  --muted: #b7c8c9;
  --mint: #9edcc6;
  --mint-strong: #c5f0df;
  --mint-ink: #10261f;
  --error: #ffc8bd;
  --radius: 20px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: var(--mint); text-underline-offset: 4px; }
a:hover { color: var(--mint-strong); }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--mint-strong); outline-offset: 4px; }
.skip { position: fixed; inset: 12px auto auto 12px; z-index: 2; transform: translateY(-150%); background: var(--bg); padding: var(--space-2); }
.skip:focus { transform: none; }
.shell { max-width: 540px; padding: 0 var(--space-4) max(32px, env(safe-area-inset-bottom)); margin: 0 auto; }
.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); font-weight: 750; letter-spacing: -.025em; font-size: 1.16rem; text-decoration: none; padding: 10px 0; }
.account { display: flex; align-items: center; gap: var(--space-3); color: var(--muted); font-size: .88rem; }
.text-button { color: var(--mint); background: none; border: 0; min-height: 44px; padding: 0 var(--space-2); text-decoration: underline; text-underline-offset: 4px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: 22px 0 var(--space-4); }
.intro a { padding: 10px var(--space-1); font-size: .9rem; }
h1 { font-size: clamp(2rem, 8vw, 2.65rem); font-weight: 720; line-height: 1.12; letter-spacing: -.055em; }
h2 { font-size: 1.23rem; line-height: 1.25; font-weight: 720; letter-spacing: -.025em; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-3); }
.summary { background: #203631; border-color: #45675d; color: var(--mint-strong); padding: 18px var(--space-4); }
.summary h2 { font-size: .94rem; font-weight: 650; letter-spacing: 0; }
.total { font-size: clamp(2.35rem, 12vw, 3.5rem); line-height: 1.12; letter-spacing: -.068em; font-weight: 760; margin-top: var(--space-1); overflow-wrap: anywhere; }
.total span { font-size: .37em; letter-spacing: -.01em; font-weight: 650; }
.settled { color: var(--ink); margin-top: var(--space-2); font-size: .9rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.provider { color: var(--muted); font-size: .83rem; font-weight: 700; }
.quiet { color: var(--muted); font-size: .89rem; }
.status { color: var(--mint); font-size: .89rem; margin-bottom: var(--space-2); }
.facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: 7px 0; font-size: .89rem; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { text-align: right; font-weight: 650; }
.utility-foot { margin-top: var(--space-3); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.clean-list { list-style: none; padding: 0; margin: 0; }
.payable, .pending { margin-top: var(--space-3); color: var(--ink); }
.ledger-row, .association-row { padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.ledger-row:last-child, .association-row:last-child { padding-bottom: 0; }
.summary .ledger-row { border-color: #45675d; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); font-size: .925rem; }
.row-head > div { min-width: 0; }
.row-head .quiet { display: block; font-size: .83rem; }
.row-amount { font-weight: 720; text-align: right; }
.ledger-row form, .editor form { margin-top: var(--space-2); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  transition: background .16s, border-color .16s;
}
.primary { background: var(--mint); color: var(--mint-ink); }
.primary:hover { background: var(--mint-strong); color: var(--mint-ink); }
.primary:active { background: #86c6b0; }
.secondary, .danger { background: transparent; border-color: var(--control); }
.secondary:hover, .danger:hover { background: var(--raised); color: var(--ink); border-color: var(--muted); }
.secondary:active, .danger:active { background: var(--bg); }
.danger, .danger:hover { color: var(--error); }
.button:disabled { opacity: .6; cursor: default; }
.association-form { margin-top: var(--space-3); }
.association-form summary::-webkit-details-marker { display: none; }
.association-form summary::before { content: '+'; margin-right: var(--space-2); font-size: 1.2em; line-height: 1; }
.association-form[open] summary::before { content: '−'; }
.editor { margin-top: var(--space-2); }
.editor summary { color: var(--mint); font-size: .85rem; min-height: 44px; padding: 11px 0; }
.editor summary:hover { color: var(--mint-strong); }
.subheading { font-size: .89rem; font-weight: 720; margin: var(--space-4) 0 var(--space-2); }
.fields, .fields label { display: grid; gap: var(--space-2); }
.fields { gap: var(--space-3); align-items: start; }
.fields label { min-width: 0; font-size: .89rem; font-weight: 650; }
label .quiet { display: inline; font-weight: 400; }
label:has(.quiet) { display: block; }
label:has(.quiet) input { margin-top: var(--space-2); }
.fields input, .fields select {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--control);
  color: var(--ink);
  border-radius: 8px;
  font-size: 16px;
}
.fields input::placeholder { color: var(--muted); opacity: .85; }
.fields input:hover, .fields select:hover { border-color: var(--muted); }
.fields button { justify-self: start; }
.form-row { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: var(--space-2); }
.compact { padding-top: var(--space-3); }
.notice { border: 1px solid var(--control); background: var(--raised); border-radius: 12px; color: var(--mint-strong); padding: var(--space-3); margin-bottom: var(--space-3); }
.notice.error { color: var(--error); border-color: var(--error); }
.login-panel { margin-top: var(--space-5); padding: var(--space-5); }
.login-panel .quiet { margin: var(--space-2) 0 var(--space-5); }
@media (min-width: 400px) {
  .shell { padding-inline: var(--space-5); }
  .panel { padding: var(--space-5); }
}
@media (max-width: 335px) {
  .form-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
