:root {
  --bg: #f4f5f4;
  --surface: #ffffff;
  --text: #2b2f2e;
  --muted: #747c79;
  --line: #e6e8e7;
  --accent: #25876d;
  --accent-bright: #5bc5a7;
  --accent-soft: #e3f4ee;
  --on-accent: #ffffff;
  --pos: #1e7d63;
  --neg: #d4480f;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 25, 0.05);
  --nav-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413;
    --surface: #1b1f1d;
    --text: #e9eceb;
    --muted: #98a19d;
    --line: #2a302d;
    --accent: #3fbd9a;
    --accent-bright: #3fbd9a;
    --accent-soft: #173229;
    --on-accent: #06251c;
    --pos: #4fd1a5;
    --neg: #ff9560;
    --danger: #ff8d80;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 520px; min-height: 100dvh; margin: 0 auto; }
.screen { padding: 0 14px 40px; }
.screen.has-nav { padding-bottom: calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.block { display: block; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.zero { color: var(--muted); font-weight: 400; }
.center-text { text-align: center; }
.pad { padding: 8px 16px 14px; }
.hint { margin: 6px 0 0; font-size: 0.82rem; color: var(--muted); }
.hint.block { display: block; font-weight: 400; }

/* ---------- icons and buttons ---------- */
.icon { flex: none; vertical-align: middle; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn:hover { background: var(--line); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: 0.9rem; border-radius: 10px; }
.btn.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.btn.outline { color: var(--accent); background: transparent; border-color: var(--accent); }
.btn.outline.danger, .btn.danger { color: var(--danger); background: transparent; border-color: var(--danger); }
.btn.danger-solid { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.screen > .btn.block { margin-top: 4px; }
.link-btn, .link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}
.link-btn.pad { padding: 10px 16px 14px; }
button.link-btn:only-child { margin: 4px 0; }

/* ---------- top bar, bottom bar, floating button ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 58px;
  margin: 0 -14px 4px;
  padding: 6px 8px;
  background: var(--bg);
}
.appbar .icon-btn:first-child { margin-left: -4px; }
.appbar-title { flex: 1; min-width: 0; padding-left: 6px; }
.appbar-title h1 { overflow: hidden; font-size: 1.35rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.appbar-sub { overflow: hidden; font-size: 0.82rem; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.appbar-actions { display: flex; align-items: center; gap: 2px; }
.form-bar { border-bottom: 1px solid var(--line); margin-bottom: 12px; }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 20;
  display: flex;
  width: min(100%, 520px);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  transform: translateX(-50%);
}
.tabbar a {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: var(--nav-h);
  padding: 9px 4px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.tabbar a.on { color: var(--accent); }
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  font-weight: 700;
  color: var(--on-accent);
  text-decoration: none;
  background: var(--accent);
  border-radius: 99px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
}

/* ---------- cards and lists ---------- */
.card {
  margin: 0 0 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 4px; font-size: 0.95rem; }
.card-title .muted { font-size: 0.82rem; font-weight: 400; }
.card:not(.flush) > .card-title { padding: 0 0 8px; }
.overall { margin: 0 2px 12px; font-size: 1rem; color: var(--muted); }
.overall b { font-size: 1.05rem; }
.empty { padding: 32px 20px; text-align: center; }
.empty h2 { margin: 8px 0 4px; font-size: 1.1rem; }
.empty .btn { margin-top: 14px; }
.empty-art { color: var(--accent-bright); }
.footnote { margin: 14px 4px; text-align: center; font-size: 0.8rem; color: var(--muted); }

.list { margin: 0; padding: 0; list-style: none; }
.list > li + li { border-top: 1px solid var(--line); }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  font: inherit;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
}
a.row, button.row, label.row { cursor: pointer; }
a.row:hover, button.row:hover { background: color-mix(in srgb, var(--line) 45%, transparent); }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.title { font-weight: 600; }
.sub { font-size: 0.85rem; color: var(--muted); }
.right { text-align: right; white-space: nowrap; }
.right .mini { display: block; font-size: 0.72rem; font-weight: 400; }
.right b { font-size: 1rem; }
.row.check input[type="checkbox"], .switch-row input { flex: none; width: 22px; height: 22px; accent-color: var(--accent); }
.lines { margin-top: 2px; font-size: 0.85rem; }
.line + .line { margin-top: 1px; }
.tag { padding: 1px 7px; font-size: 0.7rem; font-weight: 600; color: var(--muted); background: var(--line); border-radius: 99px; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  font-weight: 700;
  color: hsl(var(--h) 50% 24%);
  background: hsl(var(--h) 55% 84%);
  border-radius: 50%;
}
.avatar.sm { width: 26px; height: 26px; font-size: 0.75rem; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.2rem; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.5rem; }
.tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  color: hsl(var(--h) 50% 22%);
  background: hsl(var(--h) 60% 82%);
  border-radius: 12px;
}
.tile.sm { width: 26px; height: 26px; border-radius: 8px; }
.tile.sm .icon { width: 15px; height: 15px; }
.tile.lg { width: 64px; height: 64px; border-radius: 16px; }
.tile.plain { color: var(--muted); background: var(--bg); }
@media (prefers-color-scheme: dark) {
  .avatar { color: hsl(var(--h) 70% 85%); background: hsl(var(--h) 32% 25%); }
  .tile { color: hsl(var(--h) 70% 85%); background: hsl(var(--h) 32% 25%); }
  .tile.plain { color: var(--muted); background: var(--bg); }
}

/* expense rows */
.list.expenses > li.month, .list > li.month {
  padding: 12px 16px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border-top: 0;
}
.list > li.month:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.list > li.month + li { border-top: 0; }
.row.expense { gap: 10px; padding-left: 12px; }
.row .date { display: flex; flex: none; flex-direction: column; align-items: center; width: 30px; line-height: 1.1; }
.row .date span { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.row .date b { font-size: 1.05rem; color: var(--muted); }
.cat {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  font-size: 1.35rem;
  background: var(--bg);
  border-radius: 10px;
}
.cat.lg { width: 56px; height: 56px; font-size: 1.9rem; border-radius: 14px; }
.cat.pay { color: var(--accent); background: var(--accent-soft); }
.cat.dim { color: var(--muted); }
.row.deleted .title, .row.deleted .date b { text-decoration: line-through; color: var(--muted); }
.zero-strong { color: var(--muted); }
.repeat { color: var(--muted); }
.act-line { font-weight: 400; }
.act-line b { font-weight: 700; }
.when { margin-top: 2px; font-size: 0.75rem; color: var(--muted); }
.quote { font-style: italic; color: var(--muted); }
.row.comment { align-items: flex-start; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.row.group-row { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }

/* ---------- group and friend pages ---------- */
.group-hero { padding-bottom: 14px; }
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-name { font-size: 1.25rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.hero-status { margin: 14px 0 6px; font-size: 1.1rem; }
.hero-status b { font-size: 1.3rem; }
.chip-row { display: flex; gap: 8px; margin: 0 -14px 12px; padding: 2px 14px; overflow-x: auto; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
}
.chip.solid { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.chip.on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.search { position: relative; display: block; margin: 0 0 12px; }
.search .icon { position: absolute; top: 50%; left: 14px; color: var(--muted); transform: translateY(-50%); }
.search input { padding-left: 40px; }

/* ---------- forms ---------- */
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
textarea { resize: vertical; }
.form { display: block; }
.field { display: block; margin: 0 0 14px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field > span:first-child { display: block; margin-bottom: 5px; }
.field input { font-weight: 400; }
.form-section { margin: 20px 0 10px; font-size: 1rem; }
.form-error, .form-msg { min-height: 1.3em; margin: 0 0 10px; font-size: 0.9rem; color: var(--neg); }
.inline-save { display: flex; gap: 8px; }
.inline-save input { flex: 1; }
.inline-add { display: grid; gap: 8px; }
.inline-add .row-actions, .row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.copy-row { display: flex; gap: 8px; margin: 10px 0; }
.copy-row input { flex: 1; min-width: 0; font-size: 0.9rem; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row span { display: block; }
.danger-zone .hint { text-align: center; }
.switch-row[hidden] { display: none; }

/* a quiet one-line switch: small muted label on the left, a compact toggle on the right */
.mini-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 0;
  padding-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.mini-switch > span { display: inline-flex; align-items: center; gap: 6px; }
.field > .mini-switch { border-top: 0; margin-top: 4px; padding-top: 0; }
input[role="switch"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  min-height: 0;
  height: 20px;
  margin: 0;
  padding: 0;
  background: color-mix(in srgb, var(--muted) 45%, var(--line));
  border: 0;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s;
}
input[role="switch"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
input[role="switch"]:checked { background: var(--accent); }
input[role="switch"]:checked::before { transform: translateX(16px); }
@media (prefers-reduced-motion: reduce) {
  input[role="switch"], input[role="switch"]::before { transition: none; }
}
.split-all { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.card.banner { display: flex; flex-direction: column; gap: 10px; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card.banner p { margin: 0; font-size: 0.92rem; }
.card.banner .row-actions { justify-content: flex-end; }
.card > .link-btn { margin-top: 6px; }

/* a collapsible section: the whole header is the button, and the arrow turns when it is open */
.disclosure-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.disclosure-head:hover { background: color-mix(in srgb, var(--line) 45%, transparent); }
.disclosure-head .count {
  min-width: 26px;
  padding: 1px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  color: var(--muted);
  background: var(--bg);
  border-radius: 99px;
}
.disclosure-head .icon { color: var(--muted); transition: transform 0.2s; }
.disclosure.open .disclosure-head .icon { transform: rotate(180deg); }
.disclosure.open .disclosure-head { border-bottom: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .disclosure-head .icon { transition: none; } }
.comment-form { display: flex; gap: 8px; padding: 10px 16px 14px; }
.comment-form input { flex: 1; min-width: 0; }

.field-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-size: 0.95rem; }
.field-inline > span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.field-inline input, .field-inline select { width: 58%; max-width: 58%; }
.field-inline.stacked { flex-direction: column; align-items: stretch; }
.field-inline.stacked textarea { width: 100%; max-width: none; }
.xf .field-inline + .field-inline { border-top: 1px solid var(--line); padding-top: 8px; }
.xf .link-btn { display: flex; width: 100%; padding: 14px 0 4px; border-top: 1px solid var(--line); }

.affix { display: inline-flex; align-items: center; flex: none; gap: 6px; width: 140px; color: var(--muted); }
.affix input { min-height: 40px; text-align: right; }
.preview { font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.status { min-height: 1.4em; margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
.status.bad { color: var(--neg); }

.seg { display: flex; gap: 2px; margin: 4px 0 10px; padding: 3px; background: var(--line); border-radius: 10px; }
.seg button {
  flex: 1;
  min-height: 38px;
  padding: 0 4px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.seg button.on { color: var(--text); background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.split-list .row { padding-top: 8px; padding-bottom: 8px; min-height: 52px; }
.split-list label.row { padding: 8px 0; }
.sheet-body .list .row { padding-left: 4px; padding-right: 4px; }

/* the add-expense form */
.with-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 2px 0 12px;
  font: inherit;
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.with-label { flex: none; font-size: 0.9rem; color: var(--muted); }
.with-chips { display: flex; flex: 1; flex-wrap: wrap; gap: 6px; min-width: 0; }
.with-chip { min-height: 32px; padding: 3px 12px 3px 4px; font-size: 0.9rem; cursor: inherit; }
.desc-row { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; }
.desc-row input { min-height: 48px; font-size: 1.05rem; }
.cat-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  font-size: 1.6rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.amount-row { display: flex; align-items: center; gap: 8px; padding: 6px 0 14px; }
.rupee { flex: none; width: 52px; font-size: 1.4rem; font-weight: 600; text-align: center; color: var(--muted); }
.amount-row input { min-height: 56px; font-size: 1.7rem; font-weight: 700; }
.split-row { padding: 6px 0; font-size: 0.95rem; color: var(--muted); }
.pill {
  display: inline-block;
  min-height: 34px;
  margin: 2px 2px;
  padding: 4px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 0;
  border-radius: 99px;
  cursor: pointer;
}
.split-note { min-height: 1.3em; font-size: 0.85rem; font-weight: 600; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-heading { grid-column: 1 / -1; margin: 10px 0 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.cat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  font: inherit;
  font-size: 0.78rem;
  color: var(--text);
  text-align: center;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}
.cat-cell span { font-size: 1.5rem; }
.cat-cell.on { background: var(--accent-soft); border-color: var(--accent); }

/* settle up */
.settle { text-align: center; }
.settle-people { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 4px 0 8px; }
.settle-arrow { color: var(--muted); }
.settle-sentence { margin-bottom: 8px; font-size: 1.1rem; font-weight: 600; }
.settle .amount-row { justify-content: center; }
.settle .field-inline { text-align: left; }

/* ---------- sign in (kept compact so email login and the name-only option fit one phone screen) ---------- */
.auth { padding-top: 18px; }
.auth-top { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; }
.auth-top h1 { margin: 0; font-size: 1.45rem; }
.auth-logo {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 10px;
}
.auth .card { margin-bottom: 8px; padding: 14px; }
.auth .field { margin: 0 0 8px; }
.auth input { min-height: 44px; }
.auth .btn { min-height: 44px; }
.auth .form-error { min-height: 0; margin: 0 0 8px; font-size: 0.85rem; }
.auth .form-error:empty { display: none; }
.auth .card-title { padding: 0 0 8px; font-size: 0.95rem; }
.auth-switch { margin: 8px 0; text-align: center; font-size: 0.9rem; color: var(--muted); }
.auth-switch .link-btn { padding: 0 2px; font-size: inherit; }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 0.8rem; color: var(--muted); }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.note { margin: 2px 0 10px; font-size: 0.8rem; line-height: 1.35; color: var(--muted); }
.claim-intro { margin: 0 0 10px; }
.auth .join-group { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.auth .join-group .tile { width: 40px; height: 40px; border-radius: 10px; }
.auth .join-group .tile .icon { width: 20px; height: 20px; }
.auth .join-group h2 { margin: 0; font-size: 1rem; line-height: 1.2; }
.auth .join-group p { margin: 0; font-size: 0.82rem; }
.auth-contact { margin: 14px 0 6px; text-align: center; font-size: 0.8rem; color: var(--muted); }
.contact p { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- expense detail, totals, profile ---------- */
.detail-top { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.detail-title { font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.detail-amount { font-size: 1.7rem; font-weight: 800; }
.detail-head .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 4px; font-size: 0.85rem; color: var(--muted); }
.detail-head .meta b { color: var(--text); }
.detail-head .meta.neg { color: var(--neg); }
.is-deleted .detail-title, .is-deleted .detail-amount { text-decoration: line-through; color: var(--muted); }
.notes { margin-top: 10px; padding: 10px 12px; white-space: pre-wrap; background: var(--bg); border-radius: 10px; overflow-wrap: anywhere; }
.totals .stat { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; }
.totals .stat + .stat { border-top: 1px solid var(--line); }
.totals .stat b { font-size: 1.2rem; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 0; font-size: 0.9rem; }
.bar { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent-bright); border-radius: 99px; }
.profile { display: flex; align-items: center; gap: 16px; }
.profile-name { font-size: 1.25rem; font-weight: 700; }
.danger-text { color: var(--danger); }

/* ---------- bottom sheet and toast ---------- */
dialog {
  width: min(520px, 100%);
  max-width: 100%;
  max-height: 90dvh;
  margin: auto auto 0;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
}
@media (min-width: 560px) { dialog { margin: auto; border-radius: 20px; } }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.sheet-body { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-title { margin-bottom: 10px; font-size: 1.15rem; }
.sheet-body > .muted { margin-bottom: 12px; }
.sheet-sub { margin: 16px 0 6px; font-size: 0.95rem; }
.sheet-body > .sheet-title + .sheet-sub { margin-top: 4px; }
.inline-add-row { display: flex; gap: 8px; margin-top: 10px; }
.inline-add-row input { flex: 1; min-width: 0; }
.chip-x {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: -8px;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions .btn { flex: 1; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  font-size: 0.95rem;
  color: var(--bg);
  background: var(--text);
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
@media (min-width: 560px) {
  body { background: color-mix(in srgb, var(--bg) 70%, var(--line)); }
  #app { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
}

/* =====================================================================
   Polish: a lighter, more refined look without adding height or padding
   ===================================================================== */
:root {
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 10px 24px -14px rgba(16, 24, 20, 0.16);
  --grad: linear-gradient(135deg, #3aa385 0%, #1f7f66 100%);
  --ring: color-mix(in srgb, var(--accent) 24%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root { --grad: linear-gradient(135deg, #4fcfaa 0%, #2fa586 100%); }
}

/* numbers line up in columns */
.amt, .right b, .hero-status b, .detail-amount, .overall b, .line b, .stat b, .bar-row b, .preview, .big { font-variant-numeric: tabular-nums; }

/* a lighter top bar that lets the page show through */
.appbar {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
h1 { letter-spacing: -0.01em; }

/* cards: softer edge, a hint of depth */
.card { border-color: color-mix(in srgb, var(--line) 75%, transparent); }
.card.flush { box-shadow: var(--shadow); }

/* the group header takes a tint from the group's own colour */
.group-hero {
  background: linear-gradient(165deg, hsl(var(--h, 150) 62% 95%) 0%, var(--surface) 70%);
}
@media (prefers-color-scheme: dark) {
  .group-hero { background: linear-gradient(165deg, hsl(var(--h, 150) 26% 17%) 0%, var(--surface) 70%); }
}
.tile { background: linear-gradient(135deg, hsl(var(--h) 66% 89%), hsl(var(--h) 58% 80%)); }
.tile.plain { background: var(--bg); }
@media (prefers-color-scheme: dark) {
  .tile { background: linear-gradient(135deg, hsl(var(--h) 30% 28%), hsl(var(--h) 28% 22%)); }
  .tile.plain { background: var(--bg); }
}
.avatar { box-shadow: inset 0 0 0 1px hsl(var(--h) 40% 60% / 0.25); }

/* buttons: a little life, and they respond to a press */
.btn, .chip, .fab, .pill, .icon-btn, .seg button { transition: transform 0.08s ease, background 0.15s, box-shadow 0.15s; }
.btn:active, .chip:active, .fab:active, .pill:active { transform: scale(0.97); }
.btn.primary, .chip.solid { background: var(--grad); border-color: transparent; }
.btn.primary { box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.fab { min-height: 48px; padding: 0 20px; background: var(--grad); box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent) 60%, transparent), 0 2px 6px rgba(0, 0, 0, 0.18); }
.btn.danger-solid { background: var(--danger); }
.auth-logo { background: var(--grad); box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.logo { background: var(--grad); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
a.row:active, button.row:active { background: color-mix(in srgb, var(--line) 60%, transparent); }

/* the bottom bar: the open tab sits in a soft pill, and Activity shows what is new */
.tabbar { border-top-color: color-mix(in srgb, var(--line) 80%, transparent); background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.tabbar a { gap: 1px; padding: 6px 4px 4px; }
.tabbar a .ti { position: relative; display: grid; place-items: center; width: 54px; height: 28px; border-radius: 99px; transition: background 0.18s; }
.tabbar a.on .ti { background: var(--accent-soft); }
.badge-dot {
  position: absolute;
  top: -3px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font: 700 10px/16px system-ui, sans-serif;
  font-style: normal;
  text-align: center;
  color: #fff;
  background: var(--neg);
  border-radius: 99px;
  box-shadow: 0 0 0 2px var(--surface);
}

/* a quiet entrance when you move to another screen (not on background refreshes) */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen.enter { animation: rise 0.22s ease-out both; }
@media (prefers-reduced-motion: reduce) { .screen.enter { animation: none; } }

/* empty states get a soft badge instead of a bare icon */
.empty-art { display: inline-grid; place-items: center; width: 68px; height: 68px; margin-bottom: 4px; color: var(--accent); background: var(--accent-soft); border-radius: 50%; }

/* ---------- pieces added with the newer features ---------- */
.link-btn.tiny { padding: 0 2px; font-size: 0.82rem; font-weight: 600; }
.form > .link-btn.tiny { display: flex; margin: 8px auto 0; color: var(--muted); }
.delete-account { display: flex; margin: 4px auto 28px; font-size: 0.88rem; }
.card.banner.quiet { background: var(--surface); border-style: dashed; }
.card.banner p { display: flex; align-items: center; gap: 6px; }
.claim-names { padding: 12px 14px; }
.claim-names p { margin: 0 0 6px; font-size: 0.9rem; color: var(--muted); }
.offline { margin-top: 18vh; }
.heads-up {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--neg);
  background: color-mix(in srgb, var(--neg) 9%, var(--surface));
  border-radius: 10px;
}
.fx-box { padding: 10px 0 2px; border-top: 1px solid var(--line); }
.fx-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: center; }
.fx-row select, .fx-row input { width: 100%; max-width: none; min-height: 42px; }
.fx-at { padding-right: 4px; font-size: 0.82rem; text-align: right; color: var(--muted); }
.upi-pay { margin-top: 6px; }
