/* TILAK: Passbook's look in indigo, so the two apps are never mistaken for each other.
   Indigo is the brand and "owed to you"; red is "you owe"; slate is plain spending. */

:root {
  --brand: #4F46E5; --brand-soft: #E0E7FF;
  --recv: #4338CA; --recv-soft: #E0E7FF;
  --focus: #4F46E5;
  --btn: #4F46E5; --btn-hover: #4338CA;
  --cover: #4F46E5; --cover-2: #312E81;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #A5B4FC; --brand-soft: #2B2C55; --recv: #A5B4FC; --recv-soft: #2B2C55; --focus: #A5B4FC;
    --btn: #6366F1; --btn-hover: #818CF8; --cover: #3730A3; --cover-2: #1E1B4B;
  }
}
:root[data-theme="dark"] {
  --brand: #A5B4FC; --brand-soft: #2B2C55; --recv: #A5B4FC; --recv-soft: #2B2C55; --focus: #A5B4FC;
  --btn: #6366F1; --btn-hover: #818CF8; --cover: #3730A3; --cover-2: #1E1B4B;
}
.hero { --recv: #E0E7FF; }

/* the mark: two coins overlapping, one person's and the other's */
.mark { width: 30px; height: 24px; border-radius: 0; background: none; box-shadow: none; position: relative; flex: none; }
.mark::before, .mark::after { content: ""; position: absolute; top: 0; width: 24px; height: 24px; border-radius: 50%; clip-path: none; }
.mark::before { left: 0; background: var(--mark, var(--cover)); }
.mark::after { right: 0; left: auto; background: color-mix(in srgb, var(--mark, var(--cover)) 45%, #FFFFFF); mix-blend-mode: normal; opacity: 0.9; box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.35); }
.brand.big .mark { width: 44px; height: 34px; }
.brand.big .mark::before, .brand.big .mark::after { width: 34px; height: 34px; }
.side { --mark: #6366F1; }
.login-card .brand { color: var(--ink); }

/* page bar: no month switch here */
.top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title add" "crumbs crumbs"; }
.crumbs:has(> :nth-child(3)) { display: flex; }
@media (min-width: 720px) {
  .top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title add" "crumbs add"; }
  .top:not(:has(.crumbs > :nth-child(3))) .page-title { grid-row: 1 / -1; }
  .crumbs:has(> :nth-child(3)) { display: flex; }
}
#view { display: grid; gap: 12px; }
@media (min-width: 720px) { #view { gap: 14px; } }
.loading-note { color: var(--muted); padding: 24px 4px; }

/* ---------- home ---------- */
.hero-lbl b { color: var(--ink); }
.settle-btn { margin-top: 16px; justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 999px; background: #FFFFFF; color: var(--cover-2); font: 650 0.92rem var(--font); cursor: pointer; }
.settle-btn:hover { background: #EEF2FF; }
.settle-btn .ic { width: 17px; height: 17px; }
.square-note { margin: 6px 0 0; color: var(--ink-2); }
.home-grid { display: grid; gap: 12px; }
@media (min-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); align-items: start; gap: 14px; }
  .home-col { display: grid; gap: 14px; align-content: start; }
}
@media (max-width: 1099px) { .home-col { display: contents; } }

/* rows that open something */
.rows { display: grid; margin-inline: -6px; }
.rowlink { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; width: 100%; padding: 9px 6px; border: 0; border-bottom: 1px solid var(--rule-soft); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 8px; text-decoration: none; }
.rowlink:last-child { border-bottom: 0; }
.rowlink:hover { background: var(--sunk); }
.rowlink .who { min-width: 0; display: grid; gap: 1px; }
.rowlink .who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowlink .who small { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowlink .right { display: grid; justify-items: end; gap: 1px; white-space: nowrap; }
.rowlink .right b { font-weight: 650; }
.rowlink .right small { font-size: 0.78rem; }
.row-ic.pay { background: var(--recv-soft); color: var(--recv); }
.row-ic.ev { background: #FCE7F3; color: #BE185D; }
:root[data-theme="dark"] .row-ic.ev { background: #4A1D35; color: #F9A8D4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .row-ic.ev { background: #4A1D35; color: #F9A8D4; } }
.pos { color: var(--recv); }
.neg { color: var(--owe); }
.zero { color: var(--muted); }
.act-time { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

/* ---------- ledger ---------- */
.toolbar .chips.types { margin: 0 -14px; }
@media (min-width: 720px) { .toolbar .chips.types { margin: 0; } }
.toolbar-row select { min-height: 38px; }
.tl { background: var(--sheet); border-radius: var(--r-l); overflow: clip; }
.tl-head { display: none; }
.tl-month { display: flex; justify-content: space-between; gap: 12px; padding: 7px 14px; font-size: 0.78rem; font-weight: 650; color: var(--muted); background: var(--sunk); border-bottom: 1px solid var(--rule-soft); position: sticky; top: var(--top-h); z-index: 1; }
.tl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; align-items: center; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--rule-soft); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.tl-row:hover { background: var(--sunk); }
.tl-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 0; }
.tl-desc { min-width: 0; display: grid; gap: 3px; }
.tl-desc .d-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tl-desc .d-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tl-desc .d-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding-left: 28px; font-size: 0.78rem; color: var(--muted); min-width: 0; }
.tl-amt { display: grid; justify-items: end; gap: 1px; white-space: nowrap; }
.tl-amt b { font-weight: 650; }
.tl-amt small { font-size: 0.78rem; font-weight: 600; }
.tl-row .c-who, .tl-row .c-run, .tl-row .c-amt-d, .tl-row .c-eff { display: none; }
.kind-ic.payment { color: var(--recv); background: var(--recv-soft); }
.kind-ic.for { color: var(--spend-ink); background: var(--spend-soft); }
.chip-proj { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 999px; background: var(--brand-soft); color: var(--recv); font-size: 0.72rem; font-weight: 650; line-height: 1.6; }
.chip-proj .ic { width: 11px; height: 11px; }
.tl-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: flex-end; align-items: baseline; color: var(--muted); font-size: 0.86rem; padding: 2px 4px; }
.tl-foot b { color: var(--ink); }
.tl-foot .link { font-size: 0.86rem; padding: 0; }
@media (min-width: 1100px) {
  .tl-head, .tl-row { grid-template-columns: minmax(0, 1fr) 130px 130px 150px 150px; gap: 0; padding: 0; }
  .tl-head { display: grid; font-size: 0.76rem; font-weight: 650; color: var(--muted); border-bottom: 1px solid var(--rule); }
  .tl-head > div, .tl-row > div { padding: 9px 16px; min-width: 0; }
  .tl-head .num, .tl-row .num { text-align: right; }
  .tl-row .c-who { display: block; color: var(--ink-2); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tl-row .c-amt-d, .tl-row .c-eff, .tl-row .c-run { display: block; white-space: nowrap; }
  .tl-row .c-amt-d { font-weight: 650; }
  .tl-row .c-eff, .tl-row .c-run { font-size: 0.88rem; font-weight: 600; }
  .tl-row .tl-amt { display: none; }
  .tl-desc .d-sub .d-mob { display: none; }
  .tl-month { padding: 7px 16px; }
}
.no-run .c-run, .no-run .tl-head .h-run { visibility: hidden; }

/* ---------- events and projects ---------- */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card { display: grid; gap: 10px; align-content: start; padding: 16px; border: 0; border-radius: var(--r-l); background: var(--sheet); color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: none; box-shadow: 0 0 0 1px transparent; }
.card:hover { box-shadow: 0 0 0 1px var(--rule); }
.card.muted { opacity: 0.7; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-top h3 { font-size: 1.05rem; }
.card-top .meta { display: block; margin-top: 2px; }
.card-fig { font: 700 1.5rem var(--display); letter-spacing: -0.01em; }
.card-fig small { font: 500 0.8rem var(--font); color: var(--muted); margin-left: 4px; }
.card-lines { display: grid; gap: 4px; font-size: 0.86rem; }
.card-lines > span { display: flex; justify-content: space-between; gap: 10px; }
.card-lines > span > b { font-weight: 650; white-space: nowrap; }
.section-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.section-bar h2 { font-size: 1.05rem; }
.section-bar .meta { flex: 1 1 200px; }

.detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.detail-head .meta { margin: 2px 0 0; }
.detail-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.people-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.people-table th, .people-table td { padding: 9px 8px; border-bottom: 1px solid var(--rule-soft); text-align: right; white-space: nowrap; }
.people-table th:first-child, .people-table td:first-child { text-align: left; }
.people-table th { font-size: 0.76rem; color: var(--muted); font-weight: 650; }
.people-table tr.pick { cursor: pointer; }
.people-table tr.pick:hover td { background: var(--sunk); }
.people-table tr.on td { background: var(--brand-soft); }
.people-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--rule); }
.transfer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border-radius: var(--r-m); background: var(--sunk); }
.transfer + .transfer { margin-top: 8px; }
.transfer .t-what { flex: 1 1 200px; min-width: 0; }
.transfer .t-what b { font-weight: 650; }
.transfer .t-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.settled-note { display: flex; align-items: center; gap: 8px; color: var(--recv); font-weight: 600; }
.settled-note .ic { width: 18px; height: 18px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* costing */
.cost-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cost-table th, .cost-table td { padding: 8px; border-bottom: 1px solid var(--rule-soft); text-align: right; }
.cost-table th:first-child, .cost-table td:first-child { text-align: left; }
.cost-table th { font-size: 0.76rem; color: var(--muted); font-weight: 650; }
.cost-table tfoot td { font-weight: 700; border-top: 2px solid var(--rule); border-bottom: 0; }
.cost-table input { min-height: 36px; padding: 5px 8px; }
.cost-table td.num input { text-align: right; }
.cost-table .icon-btn { width: 32px; height: 32px; }
.cost-table .icon-btn .ic { width: 16px; height: 16px; }
@media (max-width: 599px) {
  .cost-table.editing thead { display: none; }
  .cost-table.editing tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
  .cost-table.editing td { border: 0; padding: 0; }
  .cost-table.editing td:first-child { grid-column: 1 / -1; }
  .cost-table.editing td.c-total { display: none; }
  .cost-table.editing tfoot tr { display: flex; justify-content: space-between; }
}

/* ---------- entry sheet ---------- */
.sheet .seg.two { margin: 0; }
fieldset.pick { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
fieldset.pick legend { padding: 0; margin-bottom: 6px; font-size: 0.86rem; color: var(--ink-2); font-weight: 500; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chips label { display: block; }
.chips input[type=radio], .chips input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; pointer-events: none; }
.chips label > span { display: inline-flex; align-items: center; gap: 6px; font: 600 0.88rem var(--font); color: var(--ink-2); background: var(--sheet); border: 1px solid var(--rule); border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.chips label > span:hover { border-color: var(--muted); }
.chips input:checked + span { background: var(--btn); color: var(--btn-fg); border-color: var(--btn); }
.chips input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.sheet:not(.is-pay) .pay-only { display: none; }
.sheet.is-pay .cost-only { display: none; }
.sheet:not(.is-main) .main-only { display: none; }
.sheet:not(.is-edit) .edit-only { display: none; }
.split-people { display: grid; gap: 2px; }
.sp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--r-s); font-size: 0.92rem; color: var(--ink); font-weight: 500; cursor: pointer; }
.sp-row:hover { background: var(--sunk); }
.sp-row input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--btn); }
.sp-row .sp-w { width: 7.5em; min-height: 36px; padding: 5px 8px; text-align: right; }
.sp-row .sp-amt { color: var(--muted); font-size: 0.86rem; min-width: 6.5em; text-align: right; }
.split.mode-equal .sp-w { display: none; }
.split:not(.mode-equal) .sp-amt { display: none; }
.split-sum { margin: 0; font-size: 0.88rem; color: var(--ink-2); min-height: 1.3em; }
.split-sum.bad { color: var(--owe); font-weight: 600; }
.add-person { display: flex; gap: 8px; }
.add-person input { min-height: 38px; }
.ask { max-width: 420px; }
.ask form { padding: 20px; }
.ask-text { margin: 0; color: var(--ink-2); }
.toast.bad { background: var(--owe); color: #fff; }

/* ---------- setup ---------- */
.person-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule-soft); }
.person-row:first-child { border-top: 0; }
.person-row input { min-height: 38px; }
.person-row .meta { grid-column: 1 / -1; margin-top: -4px; }

/* ---------- recurring bills ---------- */
.sheet.is-edit .new-only, .sheet.is-pay .new-only { display: none; }
.due-panel { box-shadow: inset 0 0 0 1.5px var(--brand); }
.due-bill { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--rule-soft); }
.due-bill:last-child { border-bottom: 0; }
.due-bill .who { min-width: 0; display: grid; gap: 1px; }
.due-bill .who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-bill .who small { color: var(--muted); font-size: 0.8rem; }
.due-bill .who small.late { color: var(--owe); font-weight: 600; }
.due-acts { display: flex; align-items: center; gap: 6px; }
.due-acts .unit-in { width: 9.5em; }
.due-acts input { min-height: 36px; padding-top: 5px; padding-bottom: 5px; text-align: right; }
@media (max-width: 599px) {
  .due-bill { grid-template-columns: 36px minmax(0, 1fr); }
  .due-acts { grid-column: 1 / -1; }
  .due-acts .unit-in { flex: 1; width: auto; }
}
.rec-row.paused { opacity: 0.6; }

/* from Passbook's garage styles: Rs inside a field, quick-choice chips */
.unit-in { position: relative; display: block; }
.unit-in > i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 0.84rem; color: var(--muted); pointer-events: none; }
.unit-in input { padding-right: 40px; }
.unit-in.pre > i { right: auto; left: 12px; }
.unit-in.pre input { padding-right: 12px; padding-left: 38px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.qk { font: 600 0.78rem var(--font); color: var(--ink-2); background: var(--rule-soft); border: 1px solid transparent; border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.qk:hover { border-color: var(--muted); }
.qk:disabled { opacity: 0.45; cursor: default; }
.qk.clear { background: none; color: var(--owe); }

.table-key { margin: 8px 0 0; }
@media (max-width: 599px) {
  .people-table { font-size: 0.86rem; }
  .people-table th, .people-table td { padding: 8px 5px; }
}
@media (max-width: 599px) {
  .hero-side .tile { padding: 12px 14px; }
  .hero-side .tile b { font-size: 1.05rem; }
  .hero-side .tile .t-lbl { font-size: 0.74rem; }
}

/* ---------- faces ---------- */
.av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; vertical-align: middle; background: var(--rule-soft); color: #fff; font: 700 0.8rem var(--font); }
.av.xs { width: 20px; height: 20px; font-size: 0.6rem; }
.av.sm { width: 24px; height: 24px; font-size: 0.68rem; }
.av.lg { width: 52px; height: 52px; font-size: 1.15rem; }
:root { --p0: #6366F1; --p1: #0EA5E9; --p2: #10B981; --p3: #F59E0B; --p4: #EC4899; --p5: #8B5CF6; }
.av-i.t0 { background: var(--p0); } .av-i.t1 { background: var(--p1); } .av-i.t2 { background: var(--p2); }
.av-i.t3 { background: var(--p3); } .av-i.t4 { background: var(--p4); } .av-i.t5 { background: var(--p5); }
.av-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.av-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faces { display: inline-flex; align-items: center; vertical-align: middle; }
.faces .av { box-shadow: 0 0 0 2px var(--sheet); }
.faces .av + .av { margin-left: -6px; }
.rowlink > .faces { justify-self: center; }
.transfer .faces .av { box-shadow: 0 0 0 2px var(--sunk); }
.hero-faces { display: flex; margin-bottom: 10px; }
.hero-faces .av { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cover) 80%, #fff); }
.hero-faces .av + .av { margin-left: -14px; }
.tile .t-lbl { display: inline-flex; align-items: center; gap: 6px; }
.tile .t-lbl .av { box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.5); }
.chips label > span .av { margin: -3px 0 -3px -8px; }
.chips input:checked + span .av { box-shadow: 0 0 0 1.5px #fff; }
.card-lines .av-name { gap: 6px; }
.side-foot .av-name { gap: 8px; color: rgb(255 255 255 / 0.85); }
.people-table td .av-name { gap: 8px; }
.sp-row .av-name { gap: 10px; }
.av-pick { position: relative; display: block; cursor: pointer; grid-row: span 2; }
.av-pick .av-edit { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--btn); color: #fff; box-shadow: 0 0 0 2px var(--sheet); }
.av-pick .av-edit .ic { width: 12px; height: 12px; }
.person-row { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; }
.person-row .meta { grid-column: 2 / -1; margin-top: -4px; }
#new-person-form { grid-template-columns: minmax(0, 1fr) auto; }

/* ---------- events: a ticket per party ----------
   The stub carries the date; a perforation (dashed line with two notches) separates it from the ticket.
   Settled events are torn off: greyed stub, quieter ticket. */
.list-h { font-size: 1rem; margin: 6px 2px -4px; }
.tickets { display: grid; gap: 12px; }
.ticket { --stub: 96px; position: relative; display: grid; grid-template-columns: var(--stub) minmax(0, 1fr) auto; background: var(--sheet); border-radius: var(--r-l); color: inherit; text-decoration: none; box-shadow: 0 0 0 1px transparent; }
.ticket:hover { box-shadow: 0 0 0 1px var(--rule); }
.ticket:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ticket::before, .ticket::after { content: ""; position: absolute; left: calc(var(--stub) - 9px); width: 18px; height: 18px; border-radius: 50%; background: var(--paper); }
.ticket::before { top: -9px; }
.ticket::after { bottom: -9px; }
.stub { display: grid; place-content: center; justify-items: center; gap: 4px; padding: 14px 6px; border-radius: var(--r-l) 0 0 var(--r-l); background: var(--brand-soft); color: var(--recv); border-right: 2px dashed color-mix(in srgb, var(--recv) 30%, transparent); }
.stub b { font: 700 2.3rem/0.9 var(--display); letter-spacing: -0.03em; }
.stub small { font-size: 0.74rem; font-weight: 650; white-space: nowrap; }
.tk-body { display: grid; gap: 8px; padding: 14px 18px; min-width: 0; align-content: center; }
.tk-name { font: 650 1.14rem/1.2 var(--display); letter-spacing: -0.01em; }
.tk-people { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.84rem; color: var(--muted); }
.tk-people > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-state { display: flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 600; color: var(--owe); }
.tk-state .ic { width: 16px; height: 16px; }
.torn .tk-state { color: var(--muted); font-weight: 500; }
.tk-total { display: grid; align-content: center; justify-items: end; gap: 2px; padding: 14px 20px 14px 4px; white-space: nowrap; }
.tk-total b { font: 700 1.3rem var(--display); letter-spacing: -0.01em; }
.tk-total small { color: var(--muted); font-size: 0.78rem; }
.ticket.torn { background: color-mix(in srgb, var(--sheet) 60%, transparent); }
.ticket.torn .stub { background: var(--rule-soft); color: var(--muted); border-right-color: var(--rule); }
.ticket.torn .tk-name, .ticket.torn .tk-total b { color: var(--ink-2); }
.ticket.torn .paidbar { opacity: 0.55; }
@media (max-width: 599px) {
  .ticket { --stub: 70px; grid-template-columns: var(--stub) minmax(0, 1fr); }
  .stub b { font-size: 1.8rem; }
  .stub small { font-size: 0.66rem; white-space: normal; text-align: center; }
  .tk-body { padding: 12px 14px 4px; }
  .tk-total { grid-column: 2; grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; padding: 0 14px 12px; }
}

/* one bar, split by who paid */
.paidbar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--rule-soft); }
.paidbar i { display: block; min-width: 4px; }

/* ---------- event page: who chipped in ----------
   Every bar uses one scale: the fill is what they paid, the dark tick is their fair share.
   Fill past the tick: they get money back. Short of it: they owe. */
.chipin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 10px; }
.chipin-head p { margin: 0; color: var(--ink-2); }
.chipin-head b { color: var(--ink); font-weight: 650; }
.chipin-rows { display: grid; gap: 2px; margin-inline: -8px; }
.chip-row { display: grid; grid-template-columns: 32px minmax(130px, 280px) minmax(0, 1fr) 140px; gap: 14px; align-items: center; width: 100%; padding: 10px 8px; border: 0; border-radius: var(--r-m); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chip-row:hover { background: var(--sunk); }
.chip-row.on { background: var(--brand-soft); }
.cr-name { display: grid; min-width: 0; }
.cr-name b { font-weight: 600; }
.cr-name small { color: var(--muted); font-size: 0.78rem; }
.cr-bar { position: relative; height: 14px; border-radius: 7px; background: var(--rule-soft); }
.cr-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 7px; background: var(--c); }
.cr-bar em { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--sheet); }
.chip-row:hover .cr-bar em { box-shadow: 0 0 0 2px var(--sunk); }
.chip-row.on .cr-bar em { box-shadow: 0 0 0 2px var(--brand-soft); }
.cr-bal { text-align: right; font-weight: 650; white-space: nowrap; font-size: 0.92rem; }
.chipin-key { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; }
.key-share { display: inline-block; width: 3px; height: 14px; border-radius: 2px; background: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .cr-bar i { animation: fill .7s cubic-bezier(.2, .7, .2, 1) both; transform-origin: left; }
}
@media (max-width: 599px) {
  .chip-row { grid-template-columns: 32px minmax(0, 1fr) auto; row-gap: 8px; }
  .cr-bar { grid-column: 2 / -1; grid-row: 2; }
}

/* settle up: from one face to the other */
.pay-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 14px; border-radius: var(--r-m); background: var(--sunk); }
.pay-line + .pay-line { margin-top: 8px; }
.pl-who { display: inline-flex; align-items: center; flex: none; }
.pl-arrow { position: relative; width: 30px; height: 2px; margin: 0 6px; background: var(--muted); }
.pl-arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--muted); border-right: 0; }
.pl-what { flex: 1 1 220px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-width: 0; }
.pl-what b { font-weight: 650; }
.pl-what strong { margin-left: auto; font: 700 1.2rem var(--display); letter-spacing: -0.01em; }
.pl-acts { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- projects ---------- */
.projects { display: grid; gap: 10px; }
.proj { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(0, 1.6fr) auto; gap: 10px 28px; align-items: center; padding: 16px 20px; border-radius: var(--r-l); background: var(--sheet); color: inherit; text-decoration: none; box-shadow: 0 0 0 1px transparent; }
.proj:hover { box-shadow: 0 0 0 1px var(--rule); }
.proj.torn { background: color-mix(in srgb, var(--sheet) 60%, transparent); }
.pj-name { display: grid; gap: 2px; min-width: 0; }
.pj-name b { font: 650 1.14rem var(--display); letter-spacing: -0.01em; }
.pj-name small { color: var(--muted); font-size: 0.8rem; }
.pj-split { display: grid; gap: 8px; min-width: 0; }
.pj-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.82rem; color: var(--ink-2); }
.pj-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.pj-total { display: grid; justify-items: end; gap: 2px; white-space: nowrap; }
.pj-total b { font: 700 1.35rem var(--display); letter-spacing: -0.01em; }
.pj-total small { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 699px) {
  .proj { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; }
  .pj-split { grid-column: 1 / -1; grid-row: 2; }
}

/* project page: what you've put in, and a receipt for one unit */
.proj-top { display: grid; gap: 14px; align-items: start; }
@media (min-width: 900px) { .proj-top { grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); } }
.proj-sum { display: grid; gap: 14px; }
.ps-total { margin: 0; font: 700 clamp(2.3rem, 9vw, 3.1rem)/1 var(--display); letter-spacing: -0.03em; }
.ps-total .fig-cur { font-family: var(--font); font-size: 0.34em; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-right: 0.2em; vertical-align: 0.55em; }
.proj-sum .paidbar { height: 12px; border-radius: 6px; }
.ps-people { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-person { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border: 1.5px solid transparent; border-radius: 999px; background: var(--sunk); color: inherit; text-decoration: none; }
.ps-person:hover { border-color: var(--rule); }
.ps-person.on { border-color: var(--c); background: var(--sheet); }
.ps-person > span { display: grid; line-height: 1.25; }
.ps-person b { font-weight: 650; }
.ps-person small { color: var(--muted); font-size: 0.78rem; }
.proj-sum > .meta { margin: 0; }

.receipt { position: relative; margin-bottom: 8px; padding: 18px 20px 22px; border-radius: var(--r-l) var(--r-l) 0 0; background: var(--sheet); }
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px;
  background: linear-gradient(135deg, var(--sheet) 50%, transparent 50%) 0 0 / 16px 16px, linear-gradient(-135deg, var(--sheet) 50%, transparent 50%) 0 0 / 16px 16px; }
.rc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1.5px dashed var(--rule); }
.rc-head h2 { font-size: 1.05rem; }
.rc-lines { list-style: none; margin: 0; padding: 0; display: grid; }
.rc-lines li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; }
.rc-item { display: grid; line-height: 1.25; }
.rc-item small { color: var(--muted); font-size: 0.74rem; }
.rc-item small:empty { display: none; }
.rc-dots { flex: 1; min-width: 16px; border-bottom: 2px dotted var(--rule); transform: translateY(-4px); }
.rc-amt { font-weight: 600; }
.rc-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 10px 0 0; padding-top: 12px; border-top: 1.5px dashed var(--rule); font-weight: 600; }
.rc-total b { font: 700 1.6rem var(--display); letter-spacing: -0.02em; color: var(--recv); }
.receipt .empty { margin: 8px 0 0; }

/* ---------- Home: latest entries ----------
   Grouped by day. Each row leads with the face of whoever paid; the right side says first what it
   did to your balance, then the amount. */
.feed-day { margin: 10px 0 2px; padding: 0 6px; font-size: 0.78rem; font-weight: 650; color: var(--muted); }
.feed-day:first-child { margin-top: 0; }
.feed-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 0 12px; align-items: center; width: 100%; padding: 8px 6px; border: 0; border-radius: var(--r-m); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.feed-row:hover { background: var(--sunk); }
.feed-face { position: relative; width: 36px; height: 36px; }
.feed-face .av { width: 36px; height: 36px; }
.feed-face .kind-ic { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 2px var(--sheet); background: var(--sheet); }
.feed-face .kind-ic .ic { width: 11px; height: 11px; }
.feed-row:hover .feed-face .kind-ic { box-shadow: 0 0 0 2px var(--sunk); }
.feed-what { display: grid; gap: 1px; min-width: 0; }
.feed-what b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-what small { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-amt { display: grid; justify-items: end; gap: 1px; white-space: nowrap; }
.feed-amt b { font-weight: 700; font-size: 0.98rem; }
.feed-amt small { color: var(--muted); font-size: 0.78rem; }
.feed-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 -4px; padding: 10px 6px 0; border-top: 1px solid var(--rule-soft); font-size: 0.84rem; color: var(--muted); }
.mini-stub { width: 36px; height: 36px; border-radius: 9px; display: grid; place-content: center; justify-items: center; background: var(--brand-soft); color: var(--recv); line-height: 1; border-right: 2px dashed color-mix(in srgb, var(--recv) 30%, transparent); }
.mini-stub b { font: 700 0.95rem var(--display); }
.mini-stub small { font-size: 0.58rem; font-weight: 650; }
.tickets, .projects { max-width: 1100px; }
.faces.toned > span { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px var(--c), 0 0 0 4px var(--sheet); }
.faces.toned > span + span { margin-left: -2px; }
.faces.toned .av { box-shadow: none; }
.cr-bar b { position: absolute; top: 0; bottom: 0; border-radius: 0 7px 7px 0; background: repeating-linear-gradient(-45deg, var(--c) 0 3px, color-mix(in srgb, var(--c) 35%, transparent) 3px 6px); }
.key-settled { display: inline-block; width: 18px; height: 10px; border-radius: 3px; background: repeating-linear-gradient(-45deg, var(--muted) 0 3px, transparent 3px 6px); }
.top:has(.crumbs > :nth-child(3)) .page-title { grid-row: 1; }
.proj-grid { display: grid; gap: 14px; grid-template-areas: "sum" "rc" "costs"; }
.proj-grid > .proj-sum { grid-area: sum; }
.proj-grid > .receipt { grid-area: rc; }
.proj-grid > .proj-costs { grid-area: costs; display: grid; gap: 12px; min-width: 0; }
@media (min-width: 1000px) {
  .proj-grid { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "sum rc" "costs rc"; align-items: start; }
  .proj-grid > .receipt { position: sticky; top: calc(var(--top-h) + 20px); }
  .proj-costs .tl-head, .proj-costs .tl-row { grid-template-columns: minmax(0, 1fr) 120px 110px 120px; }
  .proj-costs .h-run, .proj-costs .c-run { display: none !important; }
}
#view:has(> .tickets) > *, #view:has(> .projects) > * { max-width: 1100px; width: 100%; }
@media (max-width: 599px) { .ticket .stub { grid-row: 1 / span 2; } }
