:root {
  --ink: #1c2620; --ink-soft: #5b6659; --paper: #eff1ea; --card: #fbfbf8;
  --pine: #2b5545; --pine-dark: #1f3f33; --moss: #287947; --rust: #b34729;
  --line: #d9ded2; --radius: 8px;
}
* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; background: var(--paper); padding-top: env(safe-area-inset-top, 0px); }
/* Installed iPhone app: iOS starts the page just below the status bar but still draws overscrolled content above it. The body is the scroller, so content is clipped at the top of the page and never reaches the clock. */
body { font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif; background: var(--paper); color: var(--ink); margin: 0; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px calc(16px + env(safe-area-inset-right, 0px)) calc(48px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); line-height: 1.45; }
.hidden, [hidden] { display: none !important; }
.wordmark { display: flex; align-items: center; gap: 8px; font-family: "Fraunces", serif; font-weight: 600; font-size: 1.6rem; margin: 0; letter-spacing: -0.01em; }
.wordmark-icon { width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }
/* Any full-screen card view (login, confirm, ...) gets this class; never key centering to an id. */
.view-centered:not(.hidden) { min-height: calc(100% - 8vh); margin-bottom: 8vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; width: 100%; max-width: 360px; }
.tagline { color: var(--ink-soft); font-size: .95rem; margin: 8px 0 22px; }
.app-header { max-width: 560px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.app-header > div { min-width: 0; }
.group-name { font-size: .9rem; color: var(--ink-soft); overflow-wrap: anywhere; }
main { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.section-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.section-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; color: var(--pine); border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: .9rem; }
.section-nav a.active { background: var(--pine); color: white; border-color: var(--pine); }
.status-strip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 0; font-size: .9rem; color: var(--ink); overflow-wrap: anywhere; }
.status-strip:empty { display: none; }
.panel, .hero-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; scroll-margin-top: 16px; }
.hero-card { position: relative; }
.section-title { font-family: "Fraunces", serif; font-weight: 600; font-size: 1.2rem; margin: 0 0 12px; }
summary { cursor: pointer; min-height: 44px; padding: 10px 0; color: var(--pine); }
#people-panel > summary { font-family: "Fraunces", serif; font-size: 1.15rem; font-weight: 600; color: var(--ink); }
#people-panel:not([open]) { padding-top: 8px; padding-bottom: 8px; }
.stub-divider { position: relative; height: 1px; margin: 20px -20px 8px; border-top: 2px dashed var(--line); }
.stub-divider::before, .stub-divider::after { content: ""; position: absolute; top: -8px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); }
.stub-divider::before { left: -9px; } .stub-divider::after { right: -9px; }
.settlement-row, .balance-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; }
.settlement-row { border-bottom: 1px solid var(--line); }
.settlement-row:last-child { border-bottom: 0; }
.settlement-row > span:first-child, .balance-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.settle-amount, .receipt-amount, .share-list li > span:last-child { font-family: "IBM Plex Mono", monospace; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.settle-amount { font-size: 1.05rem; }
.balance-row { font-size: .9rem; padding: 8px 0; }
.balance-amount { text-align: right; }
.positive { color: var(--moss); } .negative { color: var(--rust); } .zero { color: var(--ink-soft); }
.field-label { display: block; font-size: .9rem; color: var(--ink-soft); margin: 14px 0 5px; }
.field-label:first-child { margin-top: 0; }
/* Every text-like input (email, tel, url, ...) gets the field style; only non-text controls are excluded. */
input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):not([type="button"]):not([type="submit"]), textarea, select { width: 100%; min-height: 44px; font-family: inherit; font-size: 1rem; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: white; color: var(--ink); vertical-align: top; }
select { appearance: none; -webkit-appearance: none; padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235b6659' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; cursor: pointer; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--pine); outline-offset: 1px; }
button, .section-nav a { touch-action: manipulation; }
button { font-family: inherit; font-weight: 600; font-size: .95rem; min-height: 44px; padding: 10px 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; background: var(--pine); color: white; width: 100%; margin-top: 14px; }
button:hover { background: var(--pine-dark); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--pine-dark); outline-offset: 3px; }
button:disabled { opacity: .65; cursor: not-allowed; }
.secondary-btn { background: transparent; color: var(--pine); border-color: var(--pine); width: auto; margin-top: 0; }
.secondary-btn:hover { background: var(--pine); color: white; }
.link-btn { width: auto; margin: 0; background: none; color: var(--pine); padding: 10px 8px; font-weight: 500; flex-shrink: 0; }
.link-btn:hover { text-decoration: underline; background: none; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form button { flex-shrink: 0; }
fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: .9rem; font-weight: 500; }
.legend-hint { color: var(--ink-soft); font-weight: 400; font-size: .8rem; margin-left: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.people-list { margin-top: 12px; }
.person-chip { display: inline-flex; align-items: center; padding-left: 12px; border: 1px solid var(--line); border-radius: 24px; background: white; max-width: 100%; }
.person-chip > span { min-width: 0; overflow-wrap: anywhere; }
.icon-btn { margin: 0; width: 44px; min-width: 44px; height: 44px; padding: 0; background: transparent; color: var(--ink-soft); font-size: 1.1rem; border-radius: 50%; }
.icon-btn:hover { background: #f3e5df; color: var(--rust); }
.choice { display: inline-flex; position: relative; cursor: pointer; max-width: 100%; }
.choice > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice > span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 24px; background: white; font-size: .9rem; overflow-wrap: anywhere; }
.choice > input:checked + span { color: white; background: var(--pine); border-color: var(--pine); }
.choice > input:focus-visible + span { outline: 2px solid var(--pine-dark); outline-offset: 3px; }
.check-mark { font-size: .85rem; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--pine); margin: 0; }
#included-hint { margin: -2px 0 10px; }
.participant-row { min-width: 0; max-width: 100%; }
.amount-list { display: flex; flex-direction: column; }
.amount-list .participant-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.amount-list .choice { min-width: 0; }
.amount-entry { display: flex; align-items: center; gap: 4px; flex: 0 0 112px; color: var(--ink-soft); }
.amount-entry input { width: 96px; text-align: right; font-family: "IBM Plex Mono", monospace; padding: 10px 8px; }
.amount-entry input:disabled { background: var(--paper); opacity: .6; }
.split-preview { font-size: .88rem; color: var(--ink-soft); padding-top: 14px; margin: 14px 0 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.hint { font-size: .85rem; color: var(--ink-soft); margin: 6px 0 0; }
.hint.balanced, .success { color: var(--moss); }
.hint.unbalanced, .error { color: var(--rust); }
.error, .success { font-size: .88rem; margin: 10px 0 0; overflow-wrap: anywhere; }
.error:empty, .success:empty { display: none; }
#page-error { margin: 0; }
.receipt-row { display: flex; align-items: start; gap: 4px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.receipt-row:last-child { border-bottom: 0; }
.receipt-details, .receipt-main { flex: 1; min-width: 0; }
.receipt-row:has(> .receipt-main) { align-items: center; }
.receipt-details > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; color: var(--ink); list-style: none; }
.receipt-details > summary::-webkit-details-marker { display: none; }
.receipt-desc { font-weight: 500; overflow-wrap: anywhere; }
.receipt-meta { display: block; font-size: .82rem; color: var(--ink-soft); margin-top: 4px; grid-column: 1 / -1; overflow-wrap: anywhere; }
.view-shares { display: block; color: var(--pine); text-decoration: underline; padding-top: 4px; }
.share-list { list-style: none; padding: 0; margin: 0 0 8px; font-size: .88rem; }
.share-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.share-list li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.empty-state { font-size: .92rem; color: var(--ink-soft); margin: 12px 0; }
.invitation { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.invitation textarea { min-height: 140px; resize: vertical; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 360px) { .panel, .hero-card { padding: 16px; } .stub-divider { margin-left: -16px; margin-right: -16px; } .section-nav { gap: 4px; } .section-nav a { padding: 8px 10px; } }

.record-payment { margin-top: 12px; border-top: 1px solid var(--line); }
.record-payment > summary { font-weight: 600; }
#payment-fields { margin-top: 14px; }
.settlement-item { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.settlement-item .settlement-row { border-bottom: 0; padding-bottom: 0; }
.settlement-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.settlement-actions .mark-paid { width: auto; margin: 0; }
.personal-payment-summary { margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--pine); overflow-wrap: anywhere; }
.payment-receipt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; min-width: 0; flex: 1; padding: 10px 0; }
.payment-undone .receipt-desc, .payment-undone .receipt-amount { color: var(--ink-soft); text-decoration: line-through; }
.undo-payment { flex-shrink: 0; }

.payment-history-entry { border-bottom: 1px solid var(--line); }
.payment-history-entry:last-child { border-bottom: 0; }
.payment-history-entry .receipt-row { border-bottom: 0; }
.undo-confirm { padding: 0 0 12px; }
.undo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.identity-status { font-size: .85rem; color: var(--ink-soft); }
.identity-status .link-btn { font-size: inherit; padding: 4px; }
#identity-dialog { width: min(440px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
#identity-dialog::backdrop { background: rgb(0 0 0 / .35); }
#identity-chips { margin-top: 20px; }
.identity-chip { border-radius: 24px; overflow-wrap: anywhere; max-width: 100%; }
.identity-chip[aria-pressed="true"] { background: var(--pine); color: white; }
.payment-confirm { padding-bottom: 12px; }

.group-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px; }
.group-meta .link-btn { font-size: .85rem; padding: 8px 0; }
.history-date { margin: 24px 0 4px; font-size: .8rem; font-weight: 500; color: var(--ink-soft); }
.history-date:first-child { margin-top: 4px; }

.status-count { display: block; margin-top: 2px; font-size: .8rem; color: var(--ink-soft); }
.admin-identity { max-width: 560px; margin: -4px auto 16px; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.admin-identity .identity-name { font-family: "Fraunces", serif; font-weight: 500; font-size: 1.25rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Centered brand header + stacked card/link used by every full-screen card view. */
.login-stack { width: 100%; max-width: 360px; }
.login-stack .login-card { max-width: none; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; text-align: center; }
.brand-logo { width: 56px; height: 56px; border-radius: 12px; }
.brand .wordmark { font-size: 1.7rem; justify-content: center; }
.card-title { font-family: "Fraunces", serif; font-weight: 600; font-size: 1.2rem; text-align: center; margin: 0 0 4px; }
.login-card .tagline { text-align: center; margin: 6px 0 22px; }
.login-card .hint, .login-card .error, .login-card .success { text-align: center; }
.login-card .link-btn { display: block; margin: 8px auto 0; }
.alt-link { text-align: center; margin: 18px 0 0; font-size: .9rem; color: var(--ink-soft); }
.alt-link a { color: var(--pine); }

/* In-app confirmation modal (see dialog.js). */
.confirm-dialog { width: min(400px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
.confirm-dialog::backdrop { background: rgb(0 0 0 / .35); }
.confirm-dialog .section-title { margin-bottom: 8px; }
.confirm-message { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }
.confirm-actions button { width: auto; margin: 0; flex: 1; }
.danger-btn { background: var(--rust); }
.danger-btn:hover { background: #8f3a21; }
.receipt-link { color: var(--pine); text-decoration: none; }
.receipt-link:hover { text-decoration: underline; }
.back-link { font-size: .85rem; color: var(--pine); padding: 8px 0; }
.prompt-field { margin-top: 16px; }
.prompt-field[hidden] { display: none; }
.person-chip-static { padding-right: 12px; }
#identity-dialog form { margin-top: 20px; }
#onboarding-dialog { width: min(440px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
#onboarding-dialog::backdrop { background: rgb(0 0 0 / .35); }
.onboarding-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; padding: 6px 4px; max-height: 45vh; overflow-y: auto; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 0 4px; margin-top: 2px; margin-left: -8px; }
.receipt-actions .link-btn { font-size: .85rem; padding: 6px 8px; min-height: 36px; }
#onboarding-title:focus { outline: none; }
#onboarding-all { margin: 6px 0 4px -8px; }
.onboarding-choice { width: 100%; }
.onboarding-choice > span { position: relative; display: block; width: 100%; text-align: left; border-radius: var(--radius); padding: 12px 14px 12px 44px; }
.onboarding-choice > span::before { content: ""; position: absolute; left: 14px; top: 16px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink-soft); background: transparent; }
.onboarding-choice > input:checked + span::before { border-color: #fff; background: #fff; box-shadow: inset 0 0 0 4px var(--pine); }
.onboarding-desc { display: block; font-weight: 600; overflow-wrap: anywhere; }
.onboarding-choice small { display: block; margin-top: 2px; opacity: .8; }
.onboarding-choice .onboarding-owe { margin-top: 0; font-weight: 600; opacity: 1; }
.onboarding-choice > input:focus-visible + span { outline-offset: 2px; }

/* Install banner (see pwa.js): a solid dark card so it reads as a notification floating above the page. */
.install-banner { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--pine); color: #fff; border-radius: 12px; box-shadow: 0 14px 36px rgb(0 0 0 / .32), 0 2px 6px rgb(0 0 0 / .2); z-index: 50; animation: install-rise .28s ease-out; }
@keyframes install-rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .install-banner { animation: none; } }
.install-icon { width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; align-self: flex-start; }
.install-text { margin: 0; flex: 1; font-size: .92rem; line-height: 1.35; color: #fff; }
.install-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.install-actions button { width: auto; margin: 0; min-height: 40px; padding: 8px 16px; background: #fff; color: var(--pine); }
.install-actions button:hover { background: #e9eee6; }
.install-actions .link-btn { padding: 8px 10px; background: none; color: #fff; opacity: .9; }
.install-actions .link-btn:hover { background: none; text-decoration: underline; opacity: 1; }
.install-banner button:focus-visible { outline-color: #fff; }
body:has(.install-banner) { padding-bottom: 112px; }
@media (max-width: 420px) { .install-banner:not(.install-banner-tip) { flex-wrap: wrap; } .install-banner:not(.install-banner-tip) .install-text { flex-basis: calc(100% - 60px); } .install-banner:not(.install-banner-tip) .install-actions { width: 100%; justify-content: flex-end; } }
.install-banner-tip { padding: 12px 8px 12px 14px; }
.install-banner-tip .install-text { font-size: .85rem; }

/* Waiting for the emailed link to be approved (organizer login). */
.login-waiting { text-align: center; }
.waiting-title { font-family: "Fraunces", serif; font-weight: 600; font-size: 1.15rem; margin: 4px 0 8px; }
.waiting-text { margin: 0 0 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.waiting-dots { display: flex; justify-content: center; gap: 6px; margin: 0 0 6px; }
.waiting-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--pine); opacity: .25; animation: waiting-pulse 1.2s ease-in-out infinite; }
.waiting-dots span:nth-child(2) { animation-delay: .2s; }
.waiting-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes waiting-pulse { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .waiting-dots span { animation: none; opacity: .6; } }
.login-waiting .secondary-btn { margin-top: 10px; }
.confirm-note { text-align: center; margin: 0 0 4px; }
.login-card.is-waiting .tagline, .login-card.is-waiting .card-title { display: none; }

/* "You're approved" screen shown in the browser after confirming a link the app asked for. */
.approved-card { text-align: center; }
.approved-check { width: 56px; height: 56px; margin: 4px auto 12px; border-radius: 50%; background: var(--pine); color: #fff; font-size: 30px; line-height: 56px; }
.approved-how { margin: -10px 0 18px; }
.approved-card .secondary-btn { margin-top: 4px; }
.admin-identity .link-btn { font-size: .85rem; padding: 2px 0; min-height: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; background: transparent; border: 0; }
.name-hint { margin: 0 0 6px; }


