:root {
  --latin: Arial, "Helvetica Neue", Roboto, "DejaVu Sans";
  font-family: var(--latin), "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-variant-numeric: lining-nums tabular-nums;
  color: #253c2a;
  background: #fbf6eb;
  line-height: 1.55;
  --ink: #23472f;
  --muted: #52665f;
  --line: #ded4c2;
  --paper: #fffbf3;
  --display: var(--latin), "Kaiti SC", KaiTi, STKaiti, "Songti SC", "Noto Serif CJK SC", serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  border-bottom: 1px solid var(--line);
  background: #fbf6eb;
}
.bar,
main {
  max-width: 880px;
  margin: auto;
  padding: 0 24px;
}
.bar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  text-decoration: none;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.mark {
  width: 33px;
  height: 24px;
  background: linear-gradient(110deg,#789981 34%,#285940 35% 68%,#99b299 69%);
  clip-path: polygon(0 88%, 32% 24%, 44% 46%, 65% 5%, 100% 88%, 79% 77%, 65% 49%, 42% 92%, 29% 62%, 14% 89%);
}
.brand { font-family: var(--display); }
main {
  padding-top: 20px;
  padding-bottom: 68px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
  color: var(--ink);
  border-radius: 9px;
  min-height: 44px;
  font-weight: 650;
  padding: 9px 15px;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #be7e24;
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #acb9ac;
  border-radius: 8px;
  color: #192e28;
  font-size: 16px;
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #407a62;
  outline-offset: 1px;
}
label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}
label small,
.muted,
small {
  color: var(--muted);
  font-weight: 400;
}
.light {
  background: #e6eddf;
}
.primary {
  background: var(--ink);
  color: white;
  width: 100%;
  margin-top: 8px;
}
.hero, .masthead {
  color: var(--ink);
  background: linear-gradient(90deg,#fbf6eb 18%,transparent 75%), url("/hills.webp") right center / auto 100% no-repeat;
}
.hero { padding: 28px 18px; border-radius: 12px; }
.hero p { margin: .3em 0 0; color: #394f3b; }
.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.035em;
}
.card {
  background: var(--paper);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-top: 18px;
}
h1,
h2,
h3,
summary,
.familyName {
  overflow-wrap: anywhere;
}
h2 {
  margin: 0 0 18px;
  font-size: 22px;
}
h3 {
  font-size: 16px;
  margin: 0 0 10px;
}
.stack {
  display: grid;
  gap: 16px;
}
.nav,
.mode {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #e6e9df;
  border-radius: 12px;
  margin-top: 18px;
}
.nav button,
.mode button {
  flex: 1;
  background: transparent;
}
.nav .active,
.mode .active {
  background: var(--paper);
  box-shadow: 0 1px 4px #23372b20;
}
.mode {
  margin: 0;
}
.titleRow,
.pair,
.family,
.actions,
.receipt summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.titleRow h2 {
  margin: 0;
}
.titleRow {
  margin-bottom: 15px;
}
.pair,
.family {
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}
.pair:last-child,
.family:last-child {
  border: 0;
}
.family label {
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  min-width: 0;
  min-height: 36px;
}
.family input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
  flex: none;
}
.family .shareInput {
  width: 112px;
}
.money {
  white-space: nowrap;
}
.amountBox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #acb9ac;
  border-radius: 8px;
  background: white;
  font-size: 22px;
}
.amountBox input {
  border: 0;
  padding-left: 0;
  font-size: 25px;
  font-weight: 650;
}
.amountBox:focus-within {
  outline: 2px solid #407a62;
}
.amountBox input:focus {
  outline: 0;
}
.error {
  color: #a1331d;
  margin: 0;
}
.summary {
  margin: 0;
  background: #eef2e6;
  border-radius: 8px;
  padding: 12px;
}
.receipt {
  border-top: 1px dashed var(--line);
  padding: 12px 0;
}
.receipt summary {
  cursor: pointer;
  min-height: 44px;
}
.receipt summary::after {
  content: "⌄";
  color: var(--muted);
}
.receipt summary .money {
  margin-left: auto;
}
.receipt small {
  display: block;
}
.receipt[open] summary::after {
  content: "⌃";
}
.chip {
  background: #edf0e6;
  padding: 6px 12px;
  border-radius: 20px;
}
.textBtn {
  background: transparent;
  text-decoration: underline;
}
.households {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
#notice:not(:empty) {
  position: fixed;
  bottom: 19px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  padding: 10px 17px;
  color: #fff;
  background: #193e33;
  border-radius: 12px;
  max-width: 94%;
  width: max-content;
}
dialog {
  max-width: min(420px, 92vw);
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
dialog::backdrop {
  background: #17352e66;
}
textarea {
  resize: vertical;
}
.hidden,
[hidden] {
  display: none !important;
}
.num {
  font-weight: 700;
}
.fine {
  font-size: 14px;
}
.pair > span:first-child {
  overflow-wrap: anywhere;
}
.actions button {
  flex: 1;
}
@media (min-width: 720px) {
  .home {
    display: grid;
    grid-template-columns: 1fr 1.12fr;
    align-items: start;
    gap: 20px;
  }
  .home > .card {
    margin: 0;
  }
  .home > .hero {
    min-height: 285px;
    display: flex;
    flex-direction: column;
    justify-content: end;
  }
  .home > .recent {
    grid-column: 2;
  }
  .book {
    max-width: 660px;
    margin: auto;
  }
}
@media (max-width: 520px) {
  .bar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .bar {
    height: 60px;
  }
  main {
    padding-top: 18px;
  }
  .hero,
  .card {
    padding: 20px;
  }
  .family .shareInput {
    width: 90px;
  }

  .family {
    gap: 8px;
  }
}

.bar-actions,
.auth-links,
.capture-actions,
.capture-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.auth-links {
  justify-content: space-between;
}
.auth-links button {
  font-size: 14px;
  padding-inline: 3px;
}
.auth-card {
  max-width: 500px;
  margin: 20px auto;
}
#accountBox details {
  margin: 16px 0;
}
#accountBox summary {
  cursor: pointer;
  padding: 8px 0;
}
#captureSlot {
  margin-bottom: 18px;
}
.capture {
  padding: 14px 16px;
  border: 1px solid #cad7bf;
  border-radius: 12px;
  background: #eff3e8;
}
.capture-actions button {
  color: var(--ink);
  background: #fffef8;
  border: 1px solid #a8baaa;
}
.capture-status {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.review-warning {
  background: #fff3d7;
  border-radius: 9px;
  padding: 12px;
}
.review-warning ul {
  padding-inline-start: 20px;
  margin: 6px 0;
}
.review-warning label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}
.review-warning input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.book { max-width: 660px; margin: auto; }
.masthead { padding: 24px 0; }
.masthead h1, .hero h1, .titleRow h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .02em;
}
.masthead h1::after, .titleRow h2::after {
  content: "";
  display: block;
  width: 54px;
  height: 4px;
  margin-top: 7px;
  border-radius: 80% 20% 70% 30%;
  background: #df9a57;
  transform: rotate(-3deg);
}
.recent { display: grid; gap: 12px; margin: 12px 0 18px; }
.recent:empty { display: none; }
.recent a {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.45;
}
.recent a::before {
  content: "";
  align-self: stretch;
  min-height: 60px;
  background: url("/bamboo.webp") center / cover;
}
.recent a span { padding: 12px 16px; overflow-wrap: anywhere; }
.recent a i { padding-right: 18px; font-size: 24px; font-style: normal; }
.recent a:first-child { grid-template-columns: 1fr auto; font-size: 26px; }
.recent a:first-child::before {
  grid-column: 1/-1;
  height: clamp(140px, 32vw, 245px);
  background-image: url("/lakeside.webp");
}
.create-trip { margin: 16px 0; }
.create-trip summary {
  cursor: pointer;
  list-style: none;
  padding: 12px;
  border-radius: 10px;
  color: white;
  text-align: center;
  background: var(--ink);
  font-weight: 650;
}
.create-trip summary::-webkit-details-marker { display: none; }
.create-trip:not([open]) summary::before { content: "＋ "; }
.create-trip[open] summary {
  color: var(--ink);
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.5;
  background: url("/travel-map.webp") center top / auto 76px no-repeat;
  padding-top: 78px;
}
.create-trip form { margin-top: 12px; }
.invite-hint { text-align: center; color: var(--muted); font-size: 14px; }
.trips-back { display: inline-block; padding: 5px 0; color: var(--muted); text-decoration: none; }
.trip-heading { padding: 4px 0 14px; }
.trip-heading h1 { font-size: 22px; }
.trip-heading h1::after { display: none; }
.trip-heading p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
#body { padding-bottom: 75px; }
#panel { border: 0; padding: 16px 0; background: transparent; border-radius: 0; margin-top: 0; }
#body .nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 690px);
  z-index: 3;
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
  margin: 0;
  background: #fffaf1;
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
}
.nav button { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 13px; }
.nav .active { color: var(--ink); background: #ecf0df; box-shadow: none; }
.nav-icon { width: 20px; height: 20px; }
.nav-icon svg { display: block; width: 100%; height: 100%; }
body:has(.nav) #notice { bottom: calc(75px + env(safe-area-inset-bottom)); }
.amount-label { margin: 18px 0 10px; font-size: 14px; color: var(--muted); }
.amountBox, .amountBox input {
  color: var(--ink);
  border: 0;
  background: transparent;
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 0;
}
.amountBox input::placeholder { color: #8c967e; }
.capture { padding: 0; border: none; background: transparent; }
.capture-actions button { background: #f2eadb; border: none; border-radius: 24px; padding-inline: 22px; }
input, textarea { background: #fffcf5; border-color: #c9c4b4; }
.split { background: #f2ebdb; padding: 0 16px; border-radius: 12px; }
.split-heading { padding: 13px 0; }
.split small { display: block; color: #845024; font-size: 15px; }
.split-fields { display: grid; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.split-fields .chip { justify-self: start; }
.error:empty { display: none; }
.primary { min-height: 48px; }
.ledger-total { display: flex; align-items: center; justify-content: space-between; margin: 16px 0; color: var(--muted); }
.ledger-total span:last-child { text-align: right; font-size: 13px; }
.ledger-total strong { display: block; font-size: clamp(24px, 5vw, 30px); font-weight: 600; line-height: 1.25; color: var(--ink); }
.day { width: fit-content; margin: 20px 0 6px; padding: 1px 12px; background: #e2e9d1; border-radius: 45% 23% 38% 19%; }
.receipt { border-top: 0; border-bottom: 1px solid var(--line); }
.receipt summary strong { font-size: 17px; }
.receipt summary .money, .pair .money { font-size: 18px; font-weight: 600; }
.my-share { color: var(--ink); background: #edf0e1; padding: 7px 12px; border-radius: 6px; }
.balance-card {
  display: grid; justify-items: center; gap: 6px;
  background: linear-gradient(#e5ead5dd,#e5ead5c7), url("/hills.webp") right bottom / cover;
  padding: 25px 12px; margin: 16px 0 24px; border-radius: 15px 11px 18px 8px;
  text-align: center; overflow-wrap: anywhere;
}
.balance-card b { font-size: clamp(30px, 7vw, 48px); font-weight: 600; line-height: 1.2; }
@media (max-width: 520px) {
  .bar { height: 52px; }
  main { padding-top: 10px; }
  .bar-actions { gap: 2px; }
  .bar-actions button { padding-inline: 7px; font-size: 14px; }
  .nav { border-radius: 0; }
}
