:root {
  --text: #161616;
  --muted: #6a6a6a;
  --line: #dcdcdc;
  --accent: #1a6b3a;
  --bg: #ffffff;
  --notice: #fff8e1;
  --notice-line: #e0c15a;
  --field: #ffffff;
  --on-accent: #ffffff;
  --you: #124a2a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #ececec;
    --muted: #a3a3a3;
    --line: #3a3a3a;
    --accent: #6cc493;
    --bg: #121212;
    --notice: #2a2410;
    --notice-line: #8a7a2a;
    --field: #1c1c1c;
    --on-accent: #0b1f13;
    --you: #7cc79a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
main { max-width: 30rem; margin: 0 auto; padding: 0.5rem 1.1rem 3rem; }
.top {
  max-width: 30rem; margin: 0 auto; padding: 0.9rem 1.1rem 0;
  display: flex; align-items: baseline; gap: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: inherit; text-decoration: none; padding-bottom: 0.6rem; }
.top nav { display: flex; gap: 1.25rem; margin-left: auto; }
.top nav a {
  color: var(--muted); text-decoration: none; padding-bottom: 0.6rem;
  border-bottom: 2px solid transparent;
}
.top nav a[aria-current] { color: var(--text); border-bottom-color: var(--text); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 1.5rem 0 0.6rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
p { margin: 0.6rem 0; }
.meta { color: var(--muted); font-size: 0.95rem; }
.month { margin: 1.5rem 0 0.25rem; }
.totals { margin: 0.25rem 0 0.75rem; }
.person {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--line);
}
.person span { font-size: 1.05rem; }
.person strong {
  font-size: 2rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap;
}
.person.you span { font-weight: 600; }
.person.you span, .person.you strong { color: var(--you); }
th.you, td.you { color: var(--you); }
thead th.you { color: var(--you); }
.you-text { color: var(--you); }
.person.you strong { font-size: 2.75rem; }
.big { font-size: 3.25rem; font-weight: 700; margin: 0.25rem 0 0; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.who { margin-top: 0; font-size: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem 0.75rem; align-items: center; margin: 1.25rem 0; }
.actions .primary { flex: 1 1 100%; }
button, .button {
  font: inherit; padding: 0.6rem 1rem; min-height: 44px; border: 1px solid var(--text); border-radius: 4px;
  background: transparent; color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.2;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.link { border: 0; padding: 0; color: var(--accent); text-decoration: underline; background: none; font-size: inherit; }
form.inline { display: inline; }
.status { color: var(--muted); font-size: 0.95rem; }
.reveal { width: 100%; font: inherit; font-size: 0.95rem; margin-top: 0.5rem; padding: 0.5rem; border: 1px solid var(--line); background: var(--field); color: var(--text); }
details { margin: 1.25rem 0; }
summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; }
table { border-collapse: collapse; width: 100%; margin: 0.5rem 0 1rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 0.5rem 0.35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-weight: 600; font-size: 0.85rem; color: var(--muted); }
tfoot th, tfoot td, tr.subtotal th, tr.subtotal td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--text); }
td .meta { display: block; font-size: 0.8rem; }
.notice { border: 1px solid var(--notice-line); background: var(--notice); padding: 0.7rem 0.9rem; border-radius: 4px; margin: 1rem 0; }
.field { display: block; margin: 0.9rem 0; }
.field > span { display: block; font-size: 0.95rem; color: var(--muted); margin-bottom: 0.25rem; }
input[type=email], input[type=password], input[type=text], select {
  font: inherit; width: 100%; padding: 0.55rem 0.6rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--field); color: var(--text);
}
.upload-big, .upload {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--muted); border-radius: 6px; cursor: pointer; position: relative;
}
.upload-big { min-height: 55vh; font-size: 1.35rem; padding: 2rem; margin: 1rem 0; }
.upload { display: inline-flex; padding: 1.1rem 1.5rem; margin: 0.5rem 0; }
.upload-big input, .upload input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.upload-big:focus-within, .upload:focus-within { border-color: var(--accent); }
form.busy .upload-big, form.busy .upload { border-style: solid; color: var(--muted); }
dl.rules dt { font-weight: 600; margin-top: 0.75rem; }
dl.rules dd { margin: 0.1rem 0 0; color: var(--muted); }
.signed { margin-top: 2.5rem; }
@media (max-width: 30rem) {
  .person.you strong { font-size: 2.25rem; }
  .person strong { font-size: 1.6rem; }
  .big { font-size: 2.75rem; }
  th, td { padding: 0.45rem 0.25rem; font-size: 0.92rem; }
  .top { gap: 0.75rem; }
  .top nav { gap: 0.8rem; font-size: 0.95rem; }
}

/* "Replace it" is a file picker dressed as a link */
.linklike { color: var(--accent); text-decoration: underline; cursor: pointer; position: relative; }
.linklike input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.linklike:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
form.replace { margin: 0.6rem 0; }
form.replace p { margin: 0; }
form.replace button { margin-top: 0.5rem; }
form.replace.busy .linklike { color: var(--muted); text-decoration: none; }

/* Screenshot overlay */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.94); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px;
  width: 44px; height: 44px; min-height: 0; padding: 0; border: 0; border-radius: 22px;
  background: rgba(255, 255, 255, 0.18); color: #fff; font-size: 30px; line-height: 44px; text-align: center; cursor: pointer;
}
body.noscroll { overflow: hidden; }
