/* Layout: one phone-sized column. Home answers "who owes whom" in a sentence, then people, then nights out.
   The one loud object is the itemized receipt in "Add a bill", printed on thermal paper. */
:root {
  --bg: #E9E4F0;          /* desk behind the phone */
  --frame: #1E1430;
  --paper: #F7F5FA;       /* app ground */
  --card: #FFFFFF;
  --ink: #1E1430;         /* aubergine ink */
  --muted: #6B6280;
  --line: #E3DDEA;
  --owed: #0A8A75;        /* money coming to you */
  --owe: #C92B63;         /* money you owe */
  --owed-soft: #DDF3EE;
  --owe-soft: #FBE3EC;
  --accent: #1E1430;
  --accent-ink: #FFFFFF;
  --receipt: #FFFDF5;
  --receipt-ink: #2B2633;
  --receipt-rule: #CFC8BC;
  --scrim: rgba(30, 20, 48, .42);
  --c-you: #1E1430;
  --c-maya: #D9822B;
  --c-jordan: #2F6FD6;
  --c-priya: #8B4FD9;
  --c-leo: #1F9A5A;
  --c-sam: #B5487F;
  /* avatar colors for everyone else, handed out in group order */
  --c-p0: #D9822B; --c-p1: #2F6FD6; --c-p2: #8B4FD9; --c-p3: #1F9A5A; --c-p4: #B5487F;
  --c-p5: #8A6A12; --c-p6: #4F5BB8; --c-p7: #A0522D;
  --font-ui: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-receipt: "Courier Prime", "Courier New", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0812; --frame: #2E2340; --paper: #16101F; --card: #211A2D; --ink: #F1ECF7; --muted: #A69CB6;
    --line: #342A42; --owed: #45D2B6; --owe: #FF7AA8; --owed-soft: #143A33; --owe-soft: #42182B;
    --accent: #F1ECF7; --accent-ink: #16101F; --receipt: #F3EFE4; --receipt-ink: #2B2633; --receipt-rule: #C9C1B3;
    --scrim: rgba(0, 0, 0, .6); --c-you: #F1ECF7;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0812; --frame: #2E2340; --paper: #16101F; --card: #211A2D; --ink: #F1ECF7; --muted: #A69CB6;
  --line: #342A42; --owed: #45D2B6; --owe: #FF7AA8; --owed-soft: #143A33; --owe-soft: #42182B;
  --accent: #F1ECF7; --accent-ink: #16101F; --receipt: #F3EFE4; --receipt-ink: #2B2633; --receipt-rule: #C9C1B3;
  --scrim: rgba(0, 0, 0, .6); --c-you: #F1ECF7;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.45;
  overflow: hidden;
  font-optical-sizing: auto;
}
/* The app fills the screen at every size: phones, a folded or unfolded Fold, tablets, computers.
   On wide screens the content stays a comfortable reading width in the middle, while the background,
   scrolling and sheets use the whole screen. */
:root { --col: 680px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--owed); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }

.device {
  position: relative; width: 100%; height: 100%;
  background: var(--paper); overflow: hidden;
  display: flex; flex-direction: column;
}
.screen {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding-left: max(20px, env(safe-area-inset-left, 0px), calc((100% - var(--col)) / 2));
  padding-right: max(20px, env(safe-area-inset-right, 0px), calc((100% - var(--col)) / 2));
  padding-block: 0 120px;
}

/* top bar */
.top { position: sticky; top: 0; z-index: 3; background: var(--paper); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px 10px; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: -.02em; font-variation-settings: "opsz" 96; display: flex; align-items: center; gap: 8px; }
.brand svg { width: 26px; height: 26px; }
.pill-btn { border: 1.5px solid var(--ink); background: transparent; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; color: var(--ink); }
.group-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.group-row:last-of-type { border-bottom: 0; }
.group-row .grow { flex: 1; min-width: 0; }
.group-row .meta { font-size: 14px; color: var(--muted); }
.group-h { margin: 18px 0 4px; font-size: 16px; font-weight: 700; }
.group-h:first-child { margin-top: 4px; }
.hh { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); margin-bottom: 10px; }
.hh-top { display: flex; align-items: center; gap: 10px; }
.hh-top .grow { flex: 1; min-width: 0; font-weight: 600; }
.hh .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.hh-new { border-style: dashed; }
.hh .secondary { margin-top: 2px; }
.secondary:disabled { opacity: .5; cursor: not-allowed; }
.back { border: 0; background: none; padding: 6px 0; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }

/* home summary sentence */
.lede { font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; font-variation-settings: "opsz" 96; margin: 14px 0 6px; text-wrap: balance; }
.lede .amt-owed { color: var(--owed); }
.lede .amt-owe { color: var(--owe); }
.sub { color: var(--muted); margin: 0; font-size: 15px; max-width: 34ch; }

h2 { font-size: 17px; font-weight: 700; margin: 30px 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
h2 .link { font-size: 14px; font-weight: 600; border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .meta { font-size: 14px; color: var(--muted); }
.owed { color: var(--owed); }
.owe { color: var(--owe); }
.small-btn { border: 0; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; background: var(--owed-soft); color: var(--owed); }
.small-btn.owe { background: var(--owe-soft); color: var(--owe); }

.av { --c: var(--muted); flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--c); color: #fff; font-weight: 700; font-size: 15px; }
.av.you { color: var(--accent-ink); font-size: 12px; }
.av.sm { width: 28px; height: 28px; font-size: 12px; }
.av.sm.you { font-size: 10px; }
.stack { display: flex; }
.stack .av { border: 2px solid var(--paper); margin-left: -8px; }
.stack .av:first-child { margin-left: 0; }

/* nights */
.night { width: 100%; text-align: left; border: 0; background: none; display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cal { flex: none; width: 46px; border-radius: 10px; overflow: hidden; text-align: center; background: var(--card); border: 1px solid var(--line); }
.cal b { display: block; font-size: 11px; font-weight: 700; background: var(--ink); color: var(--paper); padding: 2px 0; letter-spacing: .06em; }
.cal span { display: block; font-size: 19px; font-weight: 700; padding: 2px 0 4px; }
.night .right { text-align: right; font-size: 14px; }

.note { margin-top: 28px; font-size: 13px; color: var(--muted); }
.note button { border: 0; background: none; padding: 0; text-decoration: underline; color: inherit; font-size: 13px; }

/* fab */
.fab-wrap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px max(20px, env(safe-area-inset-right, 0px), calc((100% - var(--col)) / 2)) calc(18px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px), calc((100% - var(--col)) / 2)); background: linear-gradient(to top, var(--paper) 60%, transparent); z-index: 4; }
.fab { width: 100%; border: 0; border-radius: 18px; padding: 16px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.fab:disabled { opacity: .35; cursor: not-allowed; }

/* tab detail */
.night-title { font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -.025em; margin: 6px 0 4px; text-wrap: balance; }
.night-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.stats { display: flex; gap: 24px; margin-top: 18px; }
.stats div { display: flex; flex-direction: column; }
.stats small { font-size: 13px; color: var(--muted); }
.stats strong { font-size: 22px; font-weight: 700; }
details.bill { border-bottom: 1px solid var(--line); }
details.bill summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 13px 0; cursor: pointer; }
details.bill summary::-webkit-details-marker { display: none; }
.bill .right { text-align: right; font-size: 14px; }
.bill .right .meta { font-size: 13px; color: var(--muted); }
.breakdown { padding: 0 0 14px 50px; display: grid; gap: 6px; font-size: 14px; }
.breakdown .line { display: flex; justify-content: space-between; }
.breakdown .hh-line { font-weight: 700; margin-top: 2px; }
.breakdown .sub-line { padding-left: 14px; color: var(--muted); font-size: 13px; }
.del { justify-self: start; margin-top: 6px; border: 0; background: none; padding: 0; color: var(--owe); font-weight: 600; font-size: 14px; }
.empty { padding: 28px 0; color: var(--muted); }

/* sheets */
.scrim { position: absolute; inset: 0; background: var(--scrim); z-index: 10; opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: calc(var(--col) + 40px); max-height: 94%; z-index: 11; background: var(--paper); border-radius: 26px 26px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.open .scrim { opacity: 1; }
.open .sheet { transform: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 6px; }
.sheet-head h3 { margin: 0; font-size: 20px; font-weight: 700; }
.x { border: 0; background: var(--line); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; }
.sheet-body { overflow-y: auto; padding: 4px max(20px, env(safe-area-inset-left, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)); }

.amount { display: flex; align-items: baseline; gap: 4px; border-bottom: 2px solid var(--ink); padding: 8px 0 4px; }
.amount span { font-size: 30px; font-weight: 700; color: var(--muted); }
.amount input { flex: 1; min-width: 0; border: 0; background: none; font-size: 44px; font-weight: 800; letter-spacing: -.03em; padding: 0; outline: none; }
.amount input[readonly] { color: var(--ink); }
.amount-hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; min-height: 1.2em; }
.field { display: grid; gap: 6px; margin-top: 18px; }
.field > label, .field > .label { font-size: 14px; font-weight: 600; color: var(--muted); }
.text { width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 12px; font-size: 16px; }
.text:focus { border-color: var(--ink); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px 4px 4px; font-weight: 600; font-size: 14px; }
.chip .av { width: 26px; height: 26px; font-size: 11px; }
.chip .av.you { font-size: 9px; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.chip[aria-pressed="false"] .av { opacity: .45; }
.chips.quick { margin-bottom: 4px; }
.chips.quick .chip { padding-left: 12px; }
.chips.quick .chip:has(.stack) { padding-left: 4px; }
.chip .stack .av { width: 22px; height: 22px; font-size: 10px; border-color: var(--card); margin-left: -6px; }
.chip .stack .av:first-child { margin-left: 0; }
.chip .stack .av.you { font-size: 8px; }
.chip[aria-pressed="true"] .stack .av { border-color: var(--ink); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 9px 4px; font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 2px rgba(30, 20, 48, .18); }
.helper { font-size: 14px; color: var(--muted); margin: 8px 0 0; }

/* the receipt */
.receipt { position: relative; margin: 22px 2px 14px; background: var(--receipt); color: var(--receipt-ink); font-family: var(--font-receipt); font-size: 14px; padding: 16px 14px 18px; box-shadow: 0 6px 18px -10px rgba(30, 20, 48, .5); }
.receipt::before, .receipt::after { content: ""; position: absolute; left: 0; right: 0; height: 7px; }
.receipt::before { top: -7px; background: radial-gradient(circle at 50% 0, transparent 5px, var(--receipt) 5.5px) 0 0 / 12px 7px repeat-x; }
.receipt::after { bottom: -7px; background: radial-gradient(circle at 50% 100%, transparent 5px, var(--receipt) 5.5px) 0 0 / 12px 7px repeat-x; }
.r-head { text-align: center; font-weight: 700; font-size: 15px; }
.r-sub { text-align: center; font-size: 12px; opacity: .7; margin-bottom: 10px; }
.r-rule { border: 0; border-top: 1.5px dashed var(--receipt-rule); margin: 10px 0; }
.r-item { padding: 8px 0; border-bottom: 1px dotted var(--receipt-rule); }
.r-item:last-of-type { border-bottom: 0; }
.r-line { display: flex; gap: 8px; align-items: center; }
.r-line input { font-family: var(--font-receipt); font-size: 14px; border: 0; border-bottom: 1px solid transparent; background: none; color: var(--receipt-ink); padding: 2px 0; outline: none; }
.r-line input:focus { border-bottom-color: var(--receipt-ink); }
.r-line .r-name { flex: 1; min-width: 0; }
.r-line .r-price { width: 74px; text-align: right; }
.r-line .r-remove { border: 0; background: none; color: var(--receipt-ink); opacity: .5; font-size: 16px; padding: 0 2px; }
.r-who { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.r-who button { width: 30px; height: 30px; border-radius: 50%; border: 1.5px dashed var(--receipt-rule); background: transparent; color: var(--receipt-ink); font-family: var(--font-ui); font-weight: 700; font-size: 12px; padding: 0; }
.r-who button[aria-pressed="true"] { border: 0; background: var(--c); color: #fff; }
.r-who button.you[aria-pressed="true"] { background: #1E1430; color: #fff; }
.r-who .each { font-size: 12px; align-self: center; margin-left: 4px; opacity: .75; }
.r-item.unclaimed .r-name { text-decoration: underline wavy var(--owe); text-underline-offset: 4px; }
.r-add { border: 0; background: none; color: var(--receipt-ink); font-family: var(--font-receipt); font-weight: 700; padding: 8px 0 0; font-size: 14px; }
.r-total { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.r-total input, .r-total select { font-family: var(--font-receipt); font-size: 14px; width: 74px; text-align: right; border: 0; border-bottom: 1px solid var(--receipt-rule); background: none; color: var(--receipt-ink); padding: 1px 0; }
.r-total select { width: auto; }
.r-total.grand { font-weight: 700; font-size: 16px; padding-top: 6px; }

/* receipts */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.attach { display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--muted); border-radius: 14px; padding: 12px 14px; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--ink); }
.attach svg { flex: none; width: 20px; height: 20px; }
.attach small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.attach:has(+ input:focus-visible) { outline: 3px solid var(--owed); outline-offset: 2px; }
.breakdown .attach { padding: 9px 12px; font-size: 14px; margin-top: 4px; }
.attached { display: flex; align-items: center; gap: 12px; }
.attached .grow { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; }
.attached small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.thumb { flex: none; width: 52px; height: 64px; padding: 0; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--receipt); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.link-btn { border: 0; background: none; padding: 4px 0; font-weight: 600; font-size: 14px; color: var(--owe); }
.link-btn.plain { justify-self: start; text-align: left; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.receipt-full { display: block; width: 100%; max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); margin-top: 6px; }
.clip { display: inline-flex; color: var(--muted); }

/* reading receipts, currencies */
.amount .cur { flex: none; border: 0; background: var(--line); border-radius: 8px; padding: 4px 6px; font-weight: 700; font-size: 15px; align-self: center; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg.kind { margin: 4px 0 10px; }
.rate-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 15px; font-weight: 600; }
.rate-row label { flex: 1; }
.rate-row input { width: 110px; text-align: right; }
.read-btn { margin-top: 10px; width: 100%; text-align: left; border: 0; border-radius: 14px; padding: 12px 14px; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 15px; }
.read-btn small { display: block; font-weight: 400; font-size: 13px; opacity: .8; }
.reader { margin-top: 10px; display: grid; gap: 8px; }
.reader.working { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); }
.reader.working .grow { flex: 1; font-weight: 600; font-size: 15px; }
.reader.working small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.dots { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--owed); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dots { animation: none; border-top-color: var(--owed); } }
.checks { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks .mark { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--owed-soft); color: var(--owed); margin-top: 1px; }
.checks .warn .mark { background: var(--owe-soft); color: var(--owe); }
.pending-tag { display: block; font-size: 12px; color: var(--muted); }
.fx-box { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1.5px dashed var(--muted); margin-bottom: 4px; }
.fx-box p { margin: 0; font-size: 14px; }
.fx-box label { font-weight: 600; font-size: 13px; color: var(--muted); }
.fx-row { display: flex; gap: 8px; }
.fx-row input { flex: 1; min-width: 0; }
.fx-done { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.pending-note { display: block; width: 100%; text-align: left; margin-top: 16px; padding: 10px 12px; border-radius: 12px; border: 1.5px dashed var(--muted); background: transparent; font-size: 14px; color: var(--ink); }

/* guests */
.guests { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); display: grid; gap: 8px; }
.guests-head b { display: block; font-size: 15px; }
.guests-head small { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; }
.guest-add { display: grid; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.guest-add .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.guest-chip { font-size: 13px; }

/* kids */
.kids { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); display: grid; gap: 8px; }
.switch { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 0; background: none; padding: 0; }
.switch b { display: block; font-size: 15px; }
.switch small { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; }
.track { flex: none; width: 42px; height: 26px; border-radius: 999px; background: var(--line); position: relative; margin-top: 1px; transition: background .15s; }
.knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgba(30, 20, 48, .3); transition: transform .15s; }
.switch[aria-checked="true"] .track { background: var(--owed); }
.switch[aria-checked="true"] .knob { transform: translateX(16px); }
.kid-hint { margin: 0; font-size: 14px; color: var(--ink); }
.kid-hint button { border: 0; background: none; padding: 0; font-weight: 700; color: var(--owed); text-decoration: underline; text-underline-offset: 3px; }
.kid-row { display: flex; align-items: center; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.kid-row .grow { flex: 1; font-weight: 600; font-size: 15px; }
.step { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); font-size: 18px; line-height: 1; font-weight: 600; }
.step:disabled { opacity: .35; cursor: not-allowed; }
.kid-n { min-width: 1.5ch; text-align: center; font-weight: 700; }
.kid-tag { display: block; font-size: 12px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .track, .knob { transition: none; } }

.exact-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.exact-row .grow { flex: 1; font-weight: 600; }
.exact-row input { width: 110px; text-align: right; }

.summary-box { margin-top: 22px; border-top: 1.5px solid var(--ink); padding-top: 12px; }
.summary-box .line { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: 15px; }
.summary-box .who { display: flex; align-items: center; gap: 8px; }
.problem { color: var(--owe); font-weight: 600; font-size: 14px; margin: 8px 0 0; }
.save { margin-top: 16px; }

/* settle */
.transfer { display: flex; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.transfer .arrow { color: var(--muted); font-size: 18px; }
.transfer .grow { flex: 1; min-width: 0; font-size: 15px; }
.transfer .grow b { display: block; font-size: 17px; }
.big-settle { text-align: center; padding: 18px 0 6px; }
.big-settle .pair { display: flex; justify-content: center; align-items: center; gap: 14px; }
.big-settle .pair .av { width: 54px; height: 54px; font-size: 20px; }
.big-settle .pair .av.you { font-size: 15px; }
.big-settle p { font-size: 22px; font-weight: 700; margin: 14px 0 2px; }
.secondary { width: 100%; margin-top: 10px; border: 1.5px solid var(--line); background: var(--card); border-radius: 16px; padding: 13px; font-weight: 600; }

.toast { position: absolute; left: 50%; bottom: 100px; transform: translate(-50%, 12px); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; width: max-content; max-width: calc(100% - 40px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .sheet, .scrim, .toast { transition: none; }
}
/* sign-in */
.auth { display: grid; gap: 10px; margin-top: 28px; }
.auth .secondary { margin-top: 0; }
.auth-form { display: grid; gap: 6px; padding: 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); }
.auth-form label { font-size: 14px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* passcodes */
.code-input { font-family: var(--font-receipt); font-size: 18px; letter-spacing: .02em; }
.auth-form .fab { margin-top: 8px; }
.code-box { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--receipt); color: var(--receipt-ink); border: 1.5px dashed var(--receipt-rule); margin-bottom: 10px; }
.code-box .label { font-size: 13px; font-weight: 600; opacity: .75; }
.code-box small { font-size: 12px; opacity: .75; }
.code-text { font-family: var(--font-receipt); font-size: 22px; font-weight: 700; user-select: all; overflow-wrap: anywhere; }
.code-box .secondary { background: transparent; color: var(--receipt-ink); border-color: var(--receipt-rule); margin-top: 0; }
.add-person { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.add-person .text { flex: 1; min-width: 0; }
.person-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* editing and gestures */
.bill-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.bill-actions .del { margin-top: 0; }
.sheet-head { position: relative; padding-top: 22px; touch-action: none; }
.grabber { position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line); }

/* notifications and code forms */
.push-banner { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--owed-soft); color: var(--ink); display: grid; gap: 8px; }
.push-banner p { margin: 0; font-size: 14px; }
.push-banner .auth-row { display: flex; align-items: center; gap: 14px; margin-top: 0; }
.add-person-form { display: grid; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); margin-bottom: 8px; }
.add-person-form label { font-size: 13px; font-weight: 600; color: var(--muted); }
.add-person-form .small-btn { justify-self: start; margin-top: 4px; }
.new-code-form { margin: 0 0 8px; }
.new-code-form .auth-row { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.night-meta .link-btn.plain { font-size: 14px; padding: 0; }
.night-edit { margin-top: 6px; }
.night-edit .auth-row { display: flex; align-items: center; gap: 14px; margin-top: 4px; }

/* An app, not a page: tapping or long-pressing text doesn't select it or start a Google search.
   Fields you type in, and codes you might copy, still allow it. */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select, [contenteditable], .code-text, .selectable { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* categories, history and reports */
.cat-chips .chip { padding: 6px 12px; }
.top-actions { gap: 2px; }
.top-actions .icon-btn { width: 34px; }
.hist-night { margin: 10px 0 -6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pay-row .arrow { color: var(--muted); }
.pay-row .right { text-align: right; display: grid; justify-items: end; }
.rep-controls { display: grid; gap: 8px; margin-top: 14px; }
.rep-total { margin-top: 18px; }
.rep-total .num { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.rep-total p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.bars { display: grid; gap: 2px; }
.bar-row summary { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; cursor: pointer; }
.bar-row summary::-webkit-details-marker { display: none; }
.bar-label { font-weight: 600; font-size: 15px; min-width: 0; }
.bar-label small, .bar-detail small { font-weight: 400; color: var(--muted); }
.bar-value { font-weight: 700; font-size: 15px; text-align: right; }
.bar-value small { font-weight: 500; color: var(--muted); margin-left: 6px; font-size: 13px; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--ink); }
.bar-detail { display: grid; gap: 4px; padding: 0 0 10px; font-size: 14px; }
.bar-detail .line { display: flex; justify-content: space-between; gap: 10px; }
.greeting { margin: 14px 0 -8px; font-size: 15px; font-weight: 600; color: var(--muted); }

/* open and closed nights */
.open-tag { display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--owed-soft); color: var(--owed); }
.night-status { margin-top: 18px; padding: 12px 14px; border-radius: 14px; display: grid; gap: 10px; }
.night-status p { margin: 0; font-size: 14px; }
.night-status.open { background: var(--owed-soft); }
.night-status.closed { background: var(--card); border: 1.5px solid var(--line); }
.night-status .link-btn.plain { justify-self: start; padding: 0; }
.night-status .close-btn { justify-self: start; }
.night-status .close-btn.fab { justify-self: stretch; }
.close-preview { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--card); font-size: 14px; }
.close-preview .label { font-size: 12px; font-weight: 600; color: var(--muted); }
.close-preview .line { display: flex; justify-content: space-between; gap: 10px; }
.next-bill { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.past-nights { display: block; margin-top: 6px; padding: 0; font-size: 14px; }

/* ---------- Account ---------- */
.acct-card { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 14px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line); }
.acct-card .av { width: 48px; height: 48px; font-size: 18px; }
.acct-card .name { display: block; font-weight: 700; font-size: 18px; }
.acct-card .meta { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.acct-rows { display: grid; gap: 12px; }
.acct-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; }
.acct-row .meta { color: var(--muted); font-size: 14px; text-align: right; }
.acct-rows .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.lang-seg button { font-size: 15px; }
.lang-links { display: flex; justify-content: center; gap: 18px; margin-top: 22px; }
.lang-links .link-btn.plain { text-decoration: none; color: var(--muted); }
.lang-links .link-btn.plain[aria-pressed="true"] { color: var(--ink); text-decoration: underline; }
.secondary.danger-text { color: var(--owe); }
.top-actions .icon-btn { width: 32px; }

/* Chinese: a CJK font after the Latin one, and "你" sized like the other one-letter avatars */
html[lang^="zh"] { --font-ui: "Bricolage Grotesque", "PingFang SC", "PingFang TC", "Noto Sans SC", "Noto Sans TC", "Microsoft YaHei", "Microsoft JhengHei", system-ui, sans-serif; }
html[lang="zh-Hant"] { --font-ui: "Bricolage Grotesque", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "PingFang SC", system-ui, sans-serif; }
html[lang^="zh"] .av.you { font-size: 15px; }
html[lang^="zh"] .av.sm.you { font-size: 12px; }
html[lang^="zh"] .chip .av.you { font-size: 11px; }
html[lang^="zh"] .chip .stack .av.you { font-size: 10px; }
html[lang^="zh"] .big-settle .pair .av.you { font-size: 20px; }
