/* Group Expense Splitter — toolkityourlife.com/ExpenseSplitter/
   Matches the site's look (same tokens as Warranty & Receipt Vault): black, Inter + Archivo Black, lime accent. Mobile first. */
:root {
  --bg: #000; --bg2: #0b0b0c; --card: #121214; --card2: #18181b; --line: rgba(255,255,255,.12); --line2: rgba(255,255,255,.2);
  --ink: #f4f4f2; --muted: #9a9aa0; --accent: #c9ff3d; --accent-ink: #000;
  --ok: #c9ff3d; --soon: #ffc44d; --bad: #ff6b6b; --none: #77777d; --info: #7cc4ff;
  --pos: #c9ff3d; --neg: #ff8a7a;
  --r: 14px; --tab-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
html.big { font-size: 112.5%; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 1rem/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
}
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(ellipse 70% 40% at 50% 0%, rgba(255,255,255,.06), transparent 70%); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #000; padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; background: rgba(0,0,0,.78);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-nav { flex: 1; min-width: 0; min-height: 38px; display: flex; align-items: center; }
.acct { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 6px; border-radius: 999px;
  background: rgba(18,18,20,.9); border: 1px solid var(--line); cursor: pointer; font-size: .82rem; font-weight: 600; letter-spacing: .04em; }
.acct:hover { border-color: rgba(201,255,61,.6); }
.acct-av { width: 26px; height: 26px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; overflow: hidden; font-size: .8rem; color: var(--muted); }
.acct-av img { width: 100%; height: 100%; object-fit: cover; }
.acct.signed-in .acct-av { background: var(--accent); color: #000; }
.acct-label { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu { position: absolute; right: 12px; top: calc(100% + 6px); min-width: 230px; padding: 6px; background: rgba(18,18,20,.97);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.6); }
.acct-menu p { margin: 8px 10px; color: var(--muted); font-size: .82rem; }
.acct-menu button, .acct-menu a { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-decoration: none; cursor: pointer; }
.acct-menu button:hover, .acct-menu a:hover { background: rgba(255,255,255,.07); color: var(--accent); }

/* ---------- layout ---------- */
.view { max-width: 980px; margin: 0 auto; padding: 16px 14px 24px; outline: none; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font: 400 clamp(1.45rem, 5.5vw, 2.2rem)/1.05 "Archivo Black", "Inter", sans-serif; text-transform: uppercase; letter-spacing: -.01em; }
h1 .accent { color: var(--accent); }
h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: .01em; }
h3 { font-size: .95rem; font-weight: 600; }
.sub { color: var(--muted); margin: 6px 0 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.tight { gap: 6px; }
.spread { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.section { margin-top: 22px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card.tight { padding: 10px 12px; }
.card + .card { margin-top: 12px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
.crumbs { margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.crumbs a:hover { color: var(--accent); }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } .view { padding: 22px 20px 28px; } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line2); background: var(--card2); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; font-size: .95rem; }
.btn:hover { border-color: rgba(201,255,61,.6); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: none; }
.btn.danger { color: var(--bad); border-color: rgba(255,107,107,.4); background: none; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.btn.xs { min-height: 30px; padding: 0 9px; font-size: .8rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.big-actions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (min-width: 560px) { .big-actions { grid-template-columns: repeat(3, 1fr); } }
.big-actions .btn { min-height: 76px; flex-direction: column; gap: 6px; font-size: .98rem; border-radius: 16px; }
.big-actions .btn svg { width: 26px; height: 26px; }
.iconbtn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; flex: none; }
.iconbtn:hover { color: var(--bad); border-color: rgba(255,107,107,.4); }
.iconbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

label.f { display: block; }
label.f > span, .f-label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.in, select.in, textarea.in { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 16px; background: #0e0e10; color: var(--ink);
  border: 1px solid var(--line2); border-radius: 10px; }
textarea.in { min-height: 64px; resize: vertical; }
.in:focus { outline: none; border-color: rgba(201,255,61,.7); box-shadow: 0 0 0 3px rgba(201,255,61,.12); }
.in.flash { animation: flash .9s; }
.in.bad { border-color: rgba(255,107,107,.7); }
.in.big { font-size: 1.6rem; font-weight: 700; min-height: 56px; }
.in.num { text-align: right; font-variant-numeric: tabular-nums; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px rgba(201,255,61,.6); } 100% { box-shadow: none; } }
.fgrid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.fgrid .full { grid-column: 1 / -1; }
@media (min-width: 720px) { .fgrid { grid-template-columns: repeat(4, 1fr); } .fgrid .half { grid-column: span 2; } }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: #0e0e10; border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .88rem; }
.seg button[aria-pressed="true"] { background: var(--card2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line2); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }

/* tap-to-fill chips from a scanned receipt */
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow: auto; padding: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2);
  background: #0e0e10; font-size: .85rem; cursor: pointer; user-select: none; -webkit-user-select: none; max-width: 100%; color: var(--ink); }
.chip.kind-amount { border-color: rgba(201,255,61,.45); }
.chip.kind-date { border-color: rgba(124,196,255,.5); }
.chip:hover { border-color: var(--accent); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-hint { font-size: .78rem; color: var(--accent); min-height: 1.1em; margin: 6px 0 0; }
.in.target { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,255,61,.25); }

/* ---------- people ---------- */
.av { width: 30px; height: 30px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 700; color: #000; background: var(--accent); }
.av.sm { width: 22px; height: 22px; font-size: .6rem; }
.av.lg { width: 40px; height: 40px; font-size: .9rem; }
.avs { display: inline-flex; }
.avs .av + .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--card); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 3px 11px 3px 4px; border-radius: 999px; border: 1px solid var(--line2);
  background: #0e0e10; color: var(--muted); cursor: pointer; font-size: .85rem; font-weight: 600; }
.pill .av { width: 24px; height: 24px; font-size: .62rem; opacity: .45; }
.pill[aria-pressed="true"] { color: var(--ink); border-color: rgba(201,255,61,.6); background: rgba(201,255,61,.08); }
.pill[aria-pressed="true"] .av { opacity: 1; }
.pill.all { padding-left: 11px; }

/* member list on a group */
.mem { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mem:last-child { border-bottom: 0; }
.mem .nm { flex: 1; min-width: 0; }
.mem .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem .nm span { font-size: .78rem; color: var(--muted); }

/* split rows in the form */
.sp-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sp-row:last-child { border-bottom: 0; }
.sp-row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sp-row .amt { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; text-align: right; min-width: 74px; }
.sp-row .in { width: 96px; min-height: 38px; padding: 6px 8px; }
.sp-row.off .nm, .sp-row.off .amt { opacity: .45; }
.sp-msg { margin-top: 10px; font-size: .85rem; }
.sp-msg.bad { color: var(--bad); }
.sp-msg.ok { color: var(--ok); }

/* receipt items */
.it { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #0f0f11; }
.it + .it { margin-top: 8px; }
.it-top { display: grid; grid-template-columns: 1fr 64px 104px 36px; gap: 8px; align-items: center; }
.it-top .in { min-height: 40px; padding: 8px 10px; }
@media (max-width: 520px) {
  .it-top { grid-template-columns: 64px 1fr 36px; }
  .it-top > :first-child { grid-column: 1 / -1; }
}
.it .pills { margin-top: 8px; }
.it .pill { min-height: 30px; font-size: .8rem; }
.it .pill .av { width: 20px; height: 20px; }
.it-share { font-size: .75rem; color: var(--muted); margin-top: 6px; }
.rcheck { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .9rem; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rcheck b { text-align: right; }
.rcheck .diff { color: var(--soon); }
.rcheck .good { color: var(--ok); }

/* ---------- group list / tiles ---------- */
.list { display: grid; gap: 10px; margin-top: 14px; }
.gc { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.gc:hover { border-color: rgba(201,255,61,.5); }
.gicon { width: 44px; height: 44px; border-radius: 12px; background: var(--card2); display: grid; place-items: center; color: var(--accent); }
.gicon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gc-main { min-width: 0; }
.gc-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-meta { color: var(--muted); font-size: .82rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-amt { text-align: right; font-weight: 700; font-size: .92rem; white-space: nowrap; }
.gc-amt small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); } .zero { color: var(--muted); }

.tiles { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.tile { text-align: left; padding: 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.tile b { display: block; font: 400 1.25rem/1.05 "Archivo Black", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile span { display: block; margin-top: 6px; color: var(--muted); font-size: .76rem; }

.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }

/* expense rows */
.daylabel { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 2px 6px; }
.ex { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.ex + .ex { margin-top: 8px; }
.ex:hover { border-color: rgba(201,255,61,.5); }
.ex .thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--card2); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.ex .thumb img { width: 100%; height: 100%; object-fit: cover; }
.ex .thumb svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ex-main { min-width: 0; }
.ex-desc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-meta { color: var(--muted); font-size: .8rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex-amt b { display: block; font-size: .95rem; }
.ex-amt small { display: block; font-size: .74rem; }
.ex.settle .thumb { color: var(--accent); }
.tag { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.info { color: var(--info); border-color: rgba(124,196,255,.4); }

/* balances */
.bal { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bal:last-child { border-bottom: 0; }
.bal .bar { height: 8px; border-radius: 999px; background: var(--card2); position: relative; overflow: hidden; margin-top: 6px; }
.bal .bar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.bal .bar i.p { left: 50%; background: var(--pos); }
.bal .bar i.n { right: 50%; background: var(--neg); }
.bal .v { font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bal .v small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.pay { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: #0f0f11; border: 1px solid var(--line); }
.pay + .pay { margin-top: 8px; }
.pay .who { font-size: .92rem; } .pay .who b { color: var(--ink); }
.pay .amt { font-weight: 700; font-variant-numeric: tabular-nums; }

/* detail */
.dhead { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.shares .sh { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shares .sh:last-child { border-bottom: 0; }
.shares .sh .nm { flex: 1; min-width: 0; }
.shares .sh .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.pairbox { border-left: 3px solid var(--accent); }
.works { display: flex; flex-wrap: wrap; gap: 8px; }
.works a { font-size: .8rem; color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
.works a:hover { color: var(--accent); border-color: rgba(201,255,61,.5); }
.feed .fe { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.feed .fe:last-child { border-bottom: 0; }
.feed .fe time { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.feed .fe a { color: var(--ink); text-decoration: none; } .feed .fe a:hover { color: var(--accent); }

/* ---------- capture / review ---------- */
.drop { border: 2px dashed var(--line2); border-radius: 18px; padding: 16px; text-align: center; transition: border-color .2s, background .2s; }
.drop.over { border-color: var(--accent); background: rgba(201,255,61,.05); }
.prog { height: 8px; border-radius: 999px; background: var(--card2); overflow: hidden; margin-top: 10px; }
.prog > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.preview { position: relative; border-radius: 14px; overflow: hidden; background: #0e0e10; border: 1px solid var(--line); }
.preview img, .preview canvas { display: block; width: 100%; max-height: min(460px, 42vh); object-fit: contain; background: #fff; cursor: zoom-in; }
.preview .pdfph { padding: 30px; text-align: center; color: var(--muted); }
.preview .rm { position: absolute; top: 8px; right: 8px; }
.review { display: grid; gap: 16px; }
@media (min-width: 900px) { .review.has-side { grid-template-columns: 330px 1fr; align-items: start; } .review .side { position: sticky; top: 76px; } }
.review:not(.has-side) .side { display: none; }

.empty { text-align: center; padding: 34px 18px; border: 1px dashed var(--line2); border-radius: 18px; margin-top: 16px; }
.empty h2 { font: 400 1.25rem "Archivo Black", sans-serif; text-transform: uppercase; }
.empty p { color: var(--muted); max-width: 440px; margin: 8px auto 16px; }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); margin-top: 14px;
  background: rgba(201,255,61,.08); border: 1px solid rgba(201,255,61,.35); }
.banner.warn { background: rgba(255,196,77,.08); border-color: rgba(255,196,77,.4); }
.banner.info { background: rgba(124,196,255,.07); border-color: rgba(124,196,255,.35); }
.banner p { margin: 0; }
.banner .row { margin-top: 10px; }
.syncline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; margin-top: 8px; }
.syncline i { width: 8px; height: 8px; border-radius: 50%; background: var(--none); }
.syncline.cloud i { background: var(--ok); }
.syncline.off i { background: var(--soon); }
.copybox { display: flex; gap: 8px; } .copybox .in { flex: 1; font-size: .85rem; }

/* ---------- sheet / lightbox / toast ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 2147482000; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: #0c0c0e; border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b)); }
.sheet h2 { margin-bottom: 12px; }
@media (min-width: 720px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }
.sheet.wide { max-width: 980px; padding: 10px; background: #000; }
.sheet.wide img { display: block; width: 100%; height: auto; background: #fff; border-radius: 10px; }
.pick { display: grid; gap: 8px; }
.pick a, .pick button { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; cursor: pointer; text-align: left; width: 100%; font-weight: 600; }
.pick a:hover, .pick button:hover { border-color: rgba(201,255,61,.5); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 2147482500;
  background: #151515; border: 1px solid var(--accent); color: var(--ink); padding: 10px 16px; border-radius: 999px; font-size: .9rem; box-shadow: 0 8px 30px rgba(0,0,0,.6); max-width: calc(100vw - 24px); }
.toast.err { border-color: var(--bad); }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(8,8,9,.94); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted);
  text-decoration: none; font-size: .72rem; font-weight: 600; letter-spacing: .04em; }
.tabbar a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar .tab-add svg { width: 30px; height: 30px; padding: 4px; border-radius: 50%; background: var(--accent); color: #000; stroke: #000; }
@media (min-width: 900px) {
  .tabbar { left: 50%; right: auto; bottom: 14px; width: 440px; transform: translateX(-50%); border-radius: 999px; border: 1px solid var(--line); height: 60px; padding: 0; }
  body { padding-bottom: 96px; }
}

/* ---------- ads ---------- */
.ad { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 18px 0; width: 100%; }
.ad-label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #666; }
.ad ins, .ad .mn { width: 100%; min-height: 90px; }
.ad-ph { width: 100%; max-width: 970px; min-height: 90px; border: 1px dashed #444; border-radius: 8px; display: grid; place-items: center; color: #777; font-size: 13px; text-align: center; padding: 8px; }

.foot { max-width: 760px; margin: 18px auto 0; padding: 10px 16px 20px; text-align: center; color: #6a6a70; font-size: .78rem; }
.foot a { color: inherit; }
.foot p { margin: 4px 0; }

/* per-person breakdown & sending */
.shd { border-bottom: 1px solid var(--line); }
.shd:last-child { border-bottom: 0; }
.shd > summary { list-style: none; cursor: pointer; }
.shd > summary::-webkit-details-marker { display: none; }
.shd .sh { border-bottom: 0; }
.shd[open] { padding-bottom: 10px; }
.bd { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .88rem; padding: 4px 0 8px 40px; font-variant-numeric: tabular-nums; }
.bd b { text-align: right; font-weight: 600; }
.bd .line { border-top: 1px solid var(--line); padding-top: 4px; }
.bd .tot { color: var(--accent); font-weight: 700; }
.sendrow { padding-left: 40px; }
.msgprev { white-space: pre-wrap; font: .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: #0e0e10; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 8px 0; max-height: 260px; overflow: auto; }
.sheet .sendrow { padding-left: 0; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.fchip { display: inline-flex; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); text-decoration: none; font-size: .82rem; font-weight: 600; }
.fchip.on, .fchip:hover { color: var(--ink); border-color: rgba(201,255,61,.6); background: rgba(201,255,61,.08); }
.tripsum { border-bottom: 1px solid var(--line); padding: 8px 0; }
.tripsum:last-child { border-bottom: 0; }
.tripsum > summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; align-items: center; }
.tripsum > summary::-webkit-details-marker { display: none; }
/* household */
.hht { width: 100%; border-collapse: collapse; font-size: .86rem; font-variant-numeric: tabular-nums; }
.hht th, .hht td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.hht th { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hht .num { text-align: right; }
.hht tfoot td { font-weight: 700; border-bottom: 0; }
.res { display: grid; grid-template-columns: minmax(140px, 1fr) 1fr 1fr; gap: 10px; align-items: end; padding: 8px 0; border-bottom: 1px solid var(--line); }
.res:last-child { border-bottom: 0; }
.res-n { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; }
.res-n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .f, .res .in, .bill-row > * { min-width: 0; }
.res .in { width: 100%; padding-left: 8px; padding-right: 6px; }
.bill-row { grid-template-columns: 1fr 160px 160px 36px; }
@media (max-width: 600px) {
  .res { grid-template-columns: 1fr 1fr; }
  .res-n { grid-column: 1 / -1; min-height: 0; }
  .bill-row { grid-template-columns: 1fr 1fr 36px; }
  .it-top.bill-row > input { grid-column: 1 / 3; grid-row: 1; }
  .bill-row > .iconbtn { grid-column: 3; grid-row: 1; }
}

/* ---------- print / export view ---------- */
.pv { background: #fff; color: #111; border-radius: 12px; padding: 22px; font-size: 13px; line-height: 1.45; }
.pv h1 { color: #111; font-size: 22px; }
.pv h2 { font-size: 15px; margin: 18px 0 6px; color: #111; }
.pv table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.pv th, .pv td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #ddd; vertical-align: top; }
.pv th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #555; }
.pv td.num, .pv th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pv tfoot td { font-weight: 700; border-top: 2px solid #111; }
.pv .pv-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px 18px; margin-top: 10px; }
.pv .pv-meta div span { display: block; font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: .05em; }
.pv .pv-foot { margin-top: 18px; font-size: 11px; color: #666; border-top: 1px solid #ddd; padding-top: 8px; }
.pv .p { color: #2f7d00; } .pv .n { color: #b00020; }
.pv-tools { margin-bottom: 12px; }
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; color: #111 !important; padding: 0 !important; }
  body::before { display: none; }
  [data-noprint], .ad, .toast, .sheet-bg, tyl-nav, .tylp-foot, .noprint, .pv-tools { display: none !important; }
  .view { max-width: none; padding: 0; }
  .pv { padding: 0; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
