:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #667085;
  --line: #dedbd2;
  --accent: #1f6f78;
  --accent-text: #ffffff;
  --danger: #b42318;
  --good: #1a7f4b;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --surface: #1e2226;
    --text: #e6e8ea;
    --muted: #98a2b3;
    --line: #343a40;
    --accent: #58b5bf;
    --accent-text: #0d1b1d;
    --danger: #f97066;
    --good: #5fd39a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 880px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--danger); font-weight: 600; }
.notice { border-left: 3px solid var(--accent); padding: .4rem .7rem; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.good { color: var(--good); }
.owes { color: var(--danger); }

header.site {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
footer.site { text-align: center; padding: 1.5rem; font-size: .8rem; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.trip-head { margin-bottom: .5rem; }
.tabs {
  display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: .5rem .8rem; text-decoration: none; color: var(--muted); white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
}
.card.narrow { max-width: 420px; margin: 2rem auto; }
.card.danger { border-color: var(--danger); }
.cards { list-style: none; padding: 0; margin: 0; }
a.card { color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); }
a.card strong, a.card span { display: block; }

.badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px;
  border: 1px solid var(--line); font-size: .85rem; white-space: nowrap;
}

form.stack { display: grid; gap: .75rem; }
form.inline, .inline { display: inline-flex; gap: .5rem; align-items: center; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.row > label { flex: 1 1 10rem; }
.row > input { flex: 1 1 14rem; }
label { display: grid; gap: .2rem; font-size: .9rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: .4rem; color: var(--text); }
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: .6rem .8rem; }
legend { font-size: .9rem; color: var(--muted); padding: 0 .3rem; }

input, select, textarea, button, .button { font: inherit; }
input, select, textarea {
  width: 100%; padding: .45rem .55rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px;
}
input[type=checkbox], input[type=radio] { width: auto; }
input[type=file] { padding: .3rem; }
button, .button {
  display: inline-block; padding: .45rem .9rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  text-decoration: none; white-space: nowrap;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link {
  background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline;
}
button.vote { background: transparent; color: var(--text); border-color: var(--line); min-width: 3.5rem; }
button.vote.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }

table { width: 100%; border-collapse: collapse; margin-bottom: .75rem; }
th, td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.removed td { color: var(--muted); }

.invite { padding: .6rem 0; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
.item { display: flex; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: none; }
.item .when { flex: 0 0 3.5rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .body { flex: 1; min-width: 0; }
.item .actions { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; }
details > summary { cursor: pointer; color: var(--accent); margin-bottom: .75rem; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: .4rem 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

details.dates { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; }
details.dates > summary { margin-bottom: 0; }
details.dates[open] > summary { margin-bottom: .6rem; }
.cal-top { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; margin-bottom: .5rem; }
.cal-nav { display: flex; justify-content: space-between; margin-bottom: .25rem; }
.cal-nav button { padding: .1rem .7rem; font-size: 1.2rem; line-height: 1.2; }
.cal-months { display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
.cal-month { flex: 1 1 15rem; }
.cal-title { text-align: center; font-weight: 600; margin-bottom: .25rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid span { text-align: center; font-size: .8rem; color: var(--muted); }
.cal-grid button {
  padding: .45rem 0; background: transparent; color: var(--text);
  border: 1px solid transparent; border-radius: 6px; font-variant-numeric: tabular-nums;
}
.cal-grid button:hover { border-color: var(--accent); }
.cal-grid button.today { text-decoration: underline; }
.cal-grid button.in { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 0; }
.cal-grid button.edge { background: var(--accent); color: var(--accent-text); font-weight: 700; }

label.suggest { position: relative; }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin: 2px 0 0; padding: .25rem;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 18%); font-size: 1rem; color: var(--text);
}
.suggestions li { padding: .4rem .5rem; border-radius: 4px; cursor: pointer; }
.suggestions li:hover, .suggestions li.on { background: color-mix(in srgb, var(--accent) 20%, transparent); }

.cal-month.avail { max-width: 26rem; margin-bottom: 1rem; }
.avail .cal-grid b {
  display: block; text-align: center; padding: .4rem 0; border-radius: 6px; font-weight: 400;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.avail .cal-grid b.free { background: color-mix(in srgb, var(--good) 25%, transparent); }
.avail .cal-grid b.busy { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.avail .cal-grid b small { display: block; font-size: .7rem; color: var(--danger); }
label.pick { display: block; cursor: pointer; }
label.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
label.pick span {
  display: block; text-align: center; padding: .45rem 0; border-radius: 6px; color: var(--text);
  border: 1px solid var(--line); font-size: 1rem; font-variant-numeric: tabular-nums;
}
label.pick input:checked + span {
  background: var(--danger); border-color: var(--danger); color: #fff; text-decoration: line-through;
}
label.pick input:focus-visible + span { outline: 2px solid var(--accent); }

@media (max-width: 560px) {
  th, td { padding: .4rem .2rem; font-size: .9rem; }
}
table.compare td:first-child, table.compare th:first-child { width: 1%; }
table.compare { display: block; overflow-x: auto; }
.tick { display: inline-block; width: 1.9rem; height: 1.9rem; padding: 0; line-height: 1.7rem; text-align: center; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--text); white-space: pre; }
.tick.on { background: var(--good); border-color: var(--good); color: #fff; font-weight: 700; }
.next-row { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.next { flex: 1 1 16rem; padding: .75rem 1rem; margin: .5rem 0 1rem; border: 1px solid var(--accent); border-radius: 8px; }
.next h3 { margin: .1rem 0 .4rem; }
.next p { margin: 0 0 .6rem; }
.item .body a.done { color: var(--muted); text-decoration: line-through; }
.item .body.done { color: var(--muted); text-decoration: line-through; }
.split-row { display: flex; align-items: center; gap: .75rem; margin-top: .4rem; }
.split-row label { flex: 1 1 8rem; }
.split-row input[name=part] { flex: 0 1 9rem; }
.leg { margin: .1rem 0 .1rem 4.25rem; font-size: .85rem; color: var(--muted); }
.offline-note { margin: 0; padding: .5rem 1rem; text-align: center; background: var(--danger); color: #fff; font-size: .9rem; }
@media print {
  header.site, footer.site, .noprint, .tabs, .offline-note { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .card { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  .muted { color: #444; }
}
.badge.alert { border-color: var(--accent); color: var(--accent); }
#map { height: 28rem; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; z-index: 0; }
.dot { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.dot.booked { background: #2563eb; }
.dot.option { background: #d97706; }
.dot.plan { background: #059669; }
.dot.destination { background: #6b7280; }
