:root {
  --bg: #f6f4ef; --card: #fff; --ink: #1c1c1a; --muted: #5d5a52; --line: #e3dfd5;
  --green: #2f5d3a; --green-soft: #e3ede4; --red: #a5362b; --red-soft: #f6e3e0;
  --amber-soft: #f7efd9;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161715; --card: #212320; --ink: #eeece6; --muted: #aaa69b; --line: #34362f;
    --green: #7fb98a; --green-soft: #26372a; --red: #e3897e; --red-soft: #3d2522; --amber-soft: #3a331f; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
header { position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 8px; display: flex;
  align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--line); }
h1 { font-size: 22px; margin: 0; }
#who { color: var(--muted); font-size: 14px; }
main { max-width: 760px; margin: 0 auto; padding: 12px 12px calc(env(safe-area-inset-bottom) + 90px); }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav#tabs button { flex: 1; border: 0; background: none; color: var(--muted); font-size: 20px;
  padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav#tabs button span { font-size: 12px; }
nav#tabs button.on { color: var(--green); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row > .grow { flex: 1; min-width: 0; }
.list .item { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.item .name { font-weight: 500; }
.small, .muted { color: var(--muted); font-size: 14px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.minus { color: var(--red); } .plus { color: var(--green); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; width: 100%; min-height: 44px; }
input[type=number] { text-align: right; }
label { display: block; font-size: 14px; color: var(--muted); margin: 8px 0 4px; }
button.btn { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px;
  min-height: 46px; background: var(--green); color: #fff; width: 100%; margin-top: 10px; }
button.btn.ghost { background: var(--green-soft); color: var(--green); }
button.btn.red { background: var(--red-soft); color: var(--red); }
button.x { border: 0; background: none; color: var(--muted); font-size: 22px; width: 36px; min-height: 44px; }
.line { display: grid; grid-template-columns: 1fr 36px; gap: 6px; align-items: center;
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px dashed var(--line); }
.line select { grid-column: 1 / -1; }
.line.money { grid-template-columns: 1fr 1fr 36px; }
.grp { font-weight: 700; margin: 4px 0 2px; }
.total { font-weight: 700; display: flex; justify-content: space-between; padding-top: 10px; }
.menu a { display: flex; justify-content: space-between; padding: 14px 4px; color: var(--ink);
  text-decoration: none; border-bottom: 1px solid var(--line); font-weight: 500; }
.menu a:last-child { border-bottom: 0; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--amber-soft); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 80px);
  transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px;
  border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: 90vw; z-index: 10; }
#toast.on { opacity: 1; } #toast.err { background: var(--red); color: #fff; }
.search { margin-bottom: 8px; }
