:root {
  --ink: #0a0a0a;
  --muted: #9a9a9a;
  --line: #e6e6e6;
  --paper: #ffffff;
  --white: #ffffff;
  --delft: #0a0a0a;
  --water: #0a0a0a;
  --leave: #0a0a0a;
  --ok: #0a0a0a;
  --radius: 2px;
  --font: "Schibsted Grotesk", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

a { color: inherit; }

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

.shell {
  min-height: 100dvh;
  width: 100%;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
}

.screen {
  padding: 24px 24px calc(28px + env(safe-area-inset-bottom));
}
.screen.has-dock {
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
}

.screen.auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
}

.auth-mark { text-align: center; }
.auth-mark.compact { text-align: left; }
.auth-mark h1 {
  font-size: 36px;
  font-weight: 600;
  margin: 16px 0 8px;
  letter-spacing: -0.03em;
}
.auth-mark p {
  margin: 0 auto;
  max-width: 16rem;
  color: var(--muted);
}

.mark-wrap {
  display: inline-flex;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.mark-wrap.lg {
  width: 64px;
  height: 64px;
}
.mark {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 0;
  background: none;
}
.mark.lg {
  width: 100%;
  height: 100%;
  padding: 0;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.top h1, .screen > h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.05;
}
.kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lede {
  color: var(--muted);
  margin: 10px 0 18px;
  font-weight: 400;
  font-size: 14px;
}
.fine {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  font-weight: 400;
}
.fine.left { text-align: left; margin: 8px 0 0; }
.fine a { font-weight: 600; color: var(--ink); }

.back, .text-btn {
  background: none;
  border: 0;
  padding: 0;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid var(--ink);
  display: inline-block;
  width: fit-content;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: -6px -4px 0 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  text-decoration: none;
}
.icon-btn:active { transform: translateY(1px); }

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.menu-list a {
  display: block;
  padding: 16px 0;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  text-decoration: none;
}
.menu-list li:last-child a { border-bottom: 1px solid var(--line); }
.menu-list a span {
  display: block;
  font-weight: 600;
  color: var(--ink);
  font-size: 16px;
}
.menu-list a small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.stack.tight { gap: 12px; margin-top: 12px; }
.row-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.field span {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.field em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  border-radius: 0;
  padding: 10px 0;
  outline: none;
  font-size: 16px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
}
.field textarea { resize: vertical; min-height: 84px; border: 1px solid var(--line); padding: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 0;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}
.btn.primary {
  background: var(--ink);
  color: var(--white);
}
.btn.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn.close-pot {
  border: 1px solid var(--ink);
  color: var(--ink);
  background: none;
}
.btn.leave {
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
}
.btn.warn { color: var(--ink); text-decoration: underline; }
.btn.tiny {
  min-height: 38px;
  width: auto;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--ink);
  color: var(--white);
}
.btn.tiny.ghost {
  background: none;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn:active { transform: translateY(1px); }

.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  transform: translateX(-50%);
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 16px 24px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
}
.dock-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.list { display: flex; flex-direction: column; gap: 0; }

.join-panel {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  background: none;
  border-radius: 0;
}

.history-panel {
  margin-top: 8px;
}

.join-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.join-inline .field { flex: 1; }
.join-inline .btn { width: auto; padding: 0; border: 0; min-height: auto; background: none; color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--ink); border-radius: 0; padding-bottom: 10px; }

.settings-card {
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 20px 0 0;
  margin-top: 16px;
}

.pot-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: none;
  border-radius: 0;
  padding: 18px 0;
  text-decoration: none;
  border: 0;
  border-top: 1px solid var(--line);
}
.list a.pot-card:last-child,
.history-panel .list a.pot-card:last-child {
  border-bottom: 1px solid var(--line);
}
.pot-card-body { flex: 1; min-width: 0; }
.pot-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.pot-card-top strong {
  font-size: 18px;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.pot-card-sum {
  margin: 6px 0 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.pot-card-sum em {
  font-style: normal;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.pot-card .date {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.jar {
  flex: 0 0 26px;
  height: 40px;
  width: 26px;
  border: 1.5px solid var(--ink);
  border-radius: 3px 3px 10px 10px;
  background: none;
  position: relative;
  overflow: hidden;
}
.jar i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--fill);
  background: var(--ink);
}

.pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
}
.pill.closed, .pill.left {
  background: none;
  color: #c8c8c8;
}
.pill.tiny {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

.empty {
  text-align: center;
  padding: 56px 12px 24px;
}
.empty.compact { padding: 18px 0; text-align: left; }
.empty h2 {
  margin: 14px 0 6px;
}
.empty p { color: var(--muted); margin: 0; }

.plate {
  width: 100%;
  height: auto;
  margin: 8px 0 0;
  text-align: center;
  padding: 32px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.plate-rim {
  width: 100%;
  height: auto;
  border-radius: 0;
  background: none;
  padding: 0;
}
.plate-bowl {
  width: 100%;
  height: auto;
  border-radius: 0;
  background: none;
  position: relative;
  overflow: visible;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.water {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 22px;
  background: #efefef;
  position: relative;
  overflow: hidden;
}
.water::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--fill, 0%);
  background: var(--ink);
}
.well-copy {
  position: static;
  inset: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}
.amount {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  margin: 24px 0 0;
  text-align: center;
}
.stats div {
  background: none;
  border-radius: 0;
  padding: 0 8px;
  border: 0;
  border-left: 1px solid var(--line);
}
.stats div:first-child { border-left: 0; }
.stats dt {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stats dd {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 36px 0 4px;
}

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.people.dim { opacity: 0.5; }
.people li {
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 0;
}
.people li:last-child { border-bottom: 1px solid var(--line); }
.people-who {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.people-who strong {
  font-size: 16px;
  letter-spacing: -0.01em;
  font-weight: 600;
}
.people-who em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.people-money {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 0;
}
.people-money dt {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}
.people-money dd {
  margin: 3px 0 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
}

.feed, .balances, .pay-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.feed li, .balances li, .pay-list li {
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 0;
}
.feed li:last-child, .balances li:last-child, .pay-list li:last-child { border-bottom: 1px solid var(--line); }
.feed li, .balances li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.feed small, .balances small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.feed-right {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.feed-right a {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 4px;
  text-decoration: underline;
}

.more {
  margin-top: 32px;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
}
.more summary {
  cursor: pointer;
  font-weight: 500;
  padding: 16px 0;
  font-size: 13px;
}

.choices {
  border: 1px solid var(--line);
  background: none;
  border-radius: 0;
  padding: 8px 0 4px;
  margin: 0;
}
.choices legend {
  font-size: 12px;
  font-weight: 500;
  padding: 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.choice {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 14px;
}

.qr-wrap {
  background: none;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 22px;
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}
.qr-wrap img { width: 220px; height: 220px; filter: grayscale(1) contrast(1.1); }

.leave-card {
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 22px 0;
  margin-bottom: 18px;
}
.leave-card p { margin: 0 0 10px; color: var(--muted); }
.leave-card strong { color: var(--ink); }
.hero-line {
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 16px 0 0 !important;
  font-weight: 600;
}
.hero-line.dark { color: var(--ink); }

.plus { color: var(--ink); font-weight: 700; }
.minus { color: var(--muted); font-weight: 700; }

.pay-list p { margin: 0; font-size: 15px; }
.pay-list p span {
  float: right;
  font-weight: 600;
}
.pay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.pay-list li.done { opacity: 0.4; }

.toast {
  margin: 12px 0 0;
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .water, .btn { transition: none; }
}
