:root {
  --ink: #172420;
  --muted: #52635b;
  --line: #dce3d9;
  --paper: #f4f1ea;
  --card: #fffdf9;
  --green: #246b52;
  --mint: #d9eee0;
  --coral: #a04228;
  --shadow: 0 8px 26px #1724200d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html.pull-refresh-enabled { overscroll-behavior-y: contain; }
html.pull-refresh-enabled body { overscroll-behavior-y: contain; }
.cloud-sync-status { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 3; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 2px 10px; border-bottom: 1px solid var(--line); background: var(--paper); font-size: 12px; }
.sync-copy { display: grid; flex: 1; min-width: 0; }
.sync-copy small { color: var(--muted); font-size: 11px; }
.sync-copy small:empty { display: none; }
.sync-indicator { width: 14px; height: 14px; flex: none; border: 2px solid var(--green); border-radius: 50%; opacity: .6; }
.is-checking .sync-indicator { border-right-color: transparent; animation: sync-spin .8s linear infinite; }
.pull-refresh-hint { position: fixed; top: calc(138px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 5; padding: 10px 18px; border-radius: 24px; background: var(--mint); color: var(--green); box-shadow: var(--shadow); font-size: 13px; pointer-events: none; }
.remote-change-notice { padding: 12px; margin: 8px 0; border-left: 3px solid #bc7910; background: #fff6dd; color: #68520f; font-size: 13px; }
@keyframes sync-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .is-checking .sync-indicator { animation: none; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 11px 12px; color: var(--ink); }
input[type=checkbox] { accent-color: var(--green); width: 20px; height: 20px; flex: none; }
textarea { resize: vertical; }
:focus-visible { outline: 3px solid #bc7910; outline-offset: 3px; }
h1, h2, h3, strong { overflow-wrap: anywhere; }
h1, h2, h3 { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.15; }
h2 { margin: 0; font-size: 22px; }
h3 { margin: 10px 0 0; font-size: 17px; }
.app-shell { max-width: 1180px; margin: auto; padding: env(safe-area-inset-top) 24px calc(100px + env(safe-area-inset-bottom)); }
.topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; border: 0; padding: 8px 0; background: none; color: var(--ink); font: 700 20px 'Space Grotesk', system-ui, sans-serif; white-space: nowrap; }
.brand > span:last-child { color: var(--coral); }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 8px; background: var(--green); border-radius: 8px; color: #fff; font-size: 24px; }
.primary-button, .ghost-button, .icon-button, .share-button { min-height: 44px; border: 0; border-radius: 6px; padding: 11px 16px; font-weight: 700; font-size: 13px; }
.primary-button, .share-button { background: var(--green); color: #fff; }
.ghost-button { background: transparent; color: var(--green); }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 23px; }
.icon-button svg, .nav-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mini-action { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--coral); font-size: 22px; }
.full { width: 100%; margin-top: 12px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; }
.muted, .hint { color: var(--muted); font-size: 13px; }
.home-hero { padding: 54px 0 42px; }
.home-hero h1 { margin: 0; font-size: clamp(38px, 6vw, 66px); letter-spacing: -2px; }
.home-hero em { color: var(--green); font-style: normal; }
.home-hero p:last-child { max-width: 430px; color: var(--muted); font-size: 15px; margin-top: 24px; }
.home-heading, .section-heading, .summary-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.home-heading { margin-bottom: 20px; }
.group-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.group-card-large { display: flex; align-items: center; gap: 14px; min-height: 105px; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 18px; background: var(--card); box-shadow: var(--shadow); text-align: left; color: var(--ink); }
.group-card-large > span:nth-child(2) { display: grid; gap: 4px; min-width: 0; flex: 1; }
.group-card-large strong { font-size: 18px; }
.group-card-large small { color: var(--muted); font-size: 12px; }
.group-card-large b { font-size: 13px; color: var(--green); text-align: right; }
.group-card-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 8px; background: var(--mint); color: var(--green); font-size: 23px; }
.home-empty { padding: 28px; border: 1px dashed #246b5266; border-radius: 8px; background: #fffdf980; text-align: center; }
.home-empty p { color: var(--muted); }
.analytics-view, .activity-view { padding: 54px 0 28px; }
.activity-hero { padding-bottom: 28px; }
.activity-hero h1 { margin: 0; font-size: clamp(38px, 6vw, 62px); letter-spacing: -2px; }
.activity-hero em { color: var(--green); font-style: normal; }
.activity-hero p:last-child { max-width: 610px; color: var(--muted); }
.date-section { display: grid; gap: 8px; margin-top: 18px; }
.date-section:first-child { margin-top: 0; }
.date-heading { position: sticky; top: 0; z-index: 1; margin: 0; padding: 7px 2px; background: var(--card); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.activity-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; width: 100%; min-height: 62px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 7px; padding: 10px 12px; background: #fff; color: var(--ink); text-align: left; }
.activity-row > span { display: grid; gap: 3px; min-width: 0; }
.activity-row strong, .activity-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row small { color: var(--muted); }
.archived-badge { align-self: center; border-radius: 99px; padding: 4px 7px; background: #eee9df; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.pagination span { color: var(--muted); font-size: 12px; font-weight: 700; }
.analytics-hero { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 28px; }
.analytics-hero > div { min-width: 0; }
.analytics-hero h1 { margin: 0; font-size: clamp(38px, 6vw, 62px); letter-spacing: -2px; }
.analytics-hero em { color: var(--green); font-style: normal; }
.analytics-hero p:last-child { max-width: 610px; margin: 18px 0 0; color: var(--muted); }
.analytics-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); box-shadow: var(--shadow); font-size: 13px; font-weight: 700; }
.analytics-controls select { min-width: min(280px, 100%); }
.analytics-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.analytics-toggle input { width: 18px; height: 18px; }
.analytics-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.analytics-metric { display: grid; gap: 7px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); box-shadow: var(--shadow); }
.analytics-metric span, .analytics-group-row small, .analytics-transfer small { color: var(--muted); font-size: 12px; }
.analytics-metric strong { display: block; min-width: 0; color: var(--ink); font: 600 clamp(16px, 4vw, 24px) 'Space Grotesk', system-ui, sans-serif; white-space: normal; word-break: normal; overflow-wrap: anywhere; }
.analytics-metric.share { border-color: #246b5266; background: #eaf4ee; }
.analytics-metric.credit strong { color: var(--green); }
.analytics-metric.debt strong { color: var(--coral); }
.analytics-panel { margin-top: 16px; }
.analytics-transfer { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.analytics-transfer > span { display: grid; min-width: 0; }
.analytics-transfer > b { color: var(--green); white-space: nowrap; }
.analytics-transfer:last-child, .analytics-group-row:last-child { border-bottom: 0; }
.analytics-group-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.analytics-group-row > span { display: grid; min-width: 0; }
.analytics-group-row > span:nth-child(2) { text-align: right; }
.analytics-group-row > b { min-width: 110px; text-align: right; white-space: nowrap; color: var(--muted); }
.analytics-group-row > b.credit { color: var(--green); }
.analytics-group-row > b.debt { color: var(--coral); }
.analytics-empty { max-width: 620px; }
.analytics-empty p, .analytics-footnote { color: var(--muted); }
.analytics-notice { margin: 0 0 14px; padding: 12px; border-left: 3px solid #bc7910; border-radius: 6px; background: #fff6dd; color: #68520f; font-size: 13px; }
.text-button { min-height: auto; border: 0; padding: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; }
.profile-map { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .9fr); align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-map > span { display: grid; min-width: 0; }
.profile-map small { color: var(--muted); font-size: 12px; }
.detail-hero { padding: 0 0 20px; }
.back-button { min-height: 44px; border: 0; padding: 0 4px; margin-bottom: 16px; background: none; color: var(--green); font-weight: 700; }
.ledger-context { display: flex; align-items: center; gap: 6px; flex: none; padding: 4px 8px; margin: 0; border: 1px solid #246b5233; border-radius: 999px; background: var(--mint); color: #174c39; font-size: 10px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.active-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--green); }
.context-code { margin-left: auto; }
.detail-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.detail-heading { flex: 1; min-width: 0; }
.detail-name-row { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; min-width: 0; }
.detail-title-row h1 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: clamp(27px, 5vw, 36px); letter-spacing: -1px; overflow-wrap: anywhere; }
.member-summary { border: 0; background: none; min-height: 44px; padding: 6px 0; color: var(--muted); font-size: 13px; }
.detail-total-card { display: block; min-width: 0; padding: 20px; margin-top: 20px; border: 1px solid #246b5233; border-radius: 8px; background: #eaf4ee; }
.activity-currency-total { min-width: 0; width: 100%; }
.activity-currency-total + .activity-currency-total { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.activity-currency-total h3 { margin: 0 0 8px; color: var(--green); font-size: 15px; }
.activity-currency-total dl { display: grid; gap: 6px; min-width: 0; margin: 0; }
.activity-currency-total dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; min-width: 0; }
.activity-currency-total dt { color: var(--muted); }
.activity-currency-total dd { min-width: 0; max-width: 100%; margin: 0; color: var(--ink); font-family: var(--stitch-mono); font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.detail-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.detail-balance { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); text-align: left; }
.detail-balance > span { display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; min-width: 0; }
.detail-balance strong { color: var(--coral); font-size: 13px; white-space: nowrap; }
.detail-balance .credit { color: var(--green); }
.personal-balance { display: block; width: 100%; min-width: 0; margin: 14px 0 0; padding: 18px; overflow: hidden; border: 1px solid #246b5233; border-radius: 8px; background: #eaf4ee; }
.personal-balance-currency { display: grid; gap: 6px; min-width: 0; }
.personal-balance-currency + .personal-balance-currency { margin-top: 14px; padding-top: 14px; border-top: 1px solid #246b5222; }
.personal-balance-label { margin: 0; color: #345443; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.personal-balance-total { display: block; max-width: 100%; min-width: 0; font: 700 clamp(22px, 7vw, 32px) var(--stitch-mono); white-space: normal; overflow-wrap: anywhere; }
.personal-balance-total.debt { color: var(--coral); }
.personal-balance-total.credit { color: var(--green); }
.personal-balance ul { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 10px 0 0 20px; border-top: 1px solid #246b5222; color: var(--ink); }
.personal-balance li { min-width: 0; padding-left: 2px; overflow-wrap: anywhere; }
.personal-balance li b { margin-left: 4px; font-family: var(--stitch-mono); font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.personal-balance-message { margin: 0; color: var(--muted); }
.personal-balance > button { margin-top: 8px; }
.group-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 24px; }
.panel, .summary-panel { border: 1px solid var(--line); border-radius: 8px; padding: 22px; background: var(--card); box-shadow: var(--shadow); min-width: 0; }
.items-list { display: grid; gap: 7px; margin-top: 16px; }
.ledger-row { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; width: 100%; min-height: 58px; border: 1px solid var(--line); border-left: 3px solid var(--coral); border-radius: 6px; padding: 9px 11px; background: #fff; text-align: left; color: var(--ink); }
.ledger-copy { display: grid; gap: 2px; min-width: 0; }
.ledger-copy strong, .ledger-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ledger-copy strong { font-size: 13px; }
.ledger-copy small { color: var(--muted); font-size: 11px; }
.ledger-row b { text-align: right; flex-shrink: 0; font-size: 14px; white-space: nowrap; color: var(--coral); }
.ledger-type { justify-self: start; border-radius: 20px; padding: 4px 7px; background: #f8e6e0; color: var(--coral); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.payment-card { border-left-color: var(--green); }
.payment-card .ledger-type { background: var(--mint); color: var(--green); }
.payment-card b { color: var(--green); }
.archive-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.archive-row > span { display: grid; min-width: 0; }
.archive-row strong, .archive-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-row small { color: var(--muted); font-size: 11px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 34px 0 26px; }
.hero > div { min-width: 0; }
.bill-title-label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.bill-title { width: 100%; max-width: 520px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 4px 0; background: transparent; font: 600 clamp(30px, 4vw, 48px) 'Space Grotesk', system-ui, sans-serif; }
.bill-meta { margin: 8px 0; color: var(--muted); font-size: 12px; }
.date-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.date-label input { padding: 7px; }
.hero-total { display: grid; gap: 4px; text-align: right; flex-shrink: 0; }
.hero-total > span { color: var(--muted); font-size: 12px; }
.hero-total > strong { font: 600 30px 'Space Grotesk', system-ui, sans-serif; }
.bill-actions, .ledger-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bill-actions { justify-content: flex-end; margin-top: 8px; }
.layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.main-column { display: grid; gap: 20px; align-content: start; }
.summary-panel { position: sticky; top: 16px; }
.people-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 12px; }
.person-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 24px; padding: 7px 12px 7px 7px; min-height: 44px; max-width: 180px; background: #fff; color: var(--ink); }
.name-label { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--mint); color: #174c39; font-size: 11px; font-weight: 700; }
.item-card { padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.item-card-top { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.item-card-top > div { min-width: 0; }
.item-card h3 { margin: 0 0 6px; }
.item-card p { color: var(--muted); font-size: 12px; margin: 3px 0; overflow-wrap: anywhere; }
.item-card-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.item-card-foot button { border: 0; background: none; color: var(--green); font-size: 13px; font-weight: 700; min-height: 44px; padding: 8px; }
.danger-link { color: var(--coral) !important; }
.charge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.charge { display: grid; gap: 8px; }
.charge > label { font-size: 13px; font-weight: 700; }
.charge-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.charge-controls select, .charge-controls input { width: 100%; padding: 9px 7px; font-size: 13px; }
.charge-controls select:last-child { grid-column: span 2; }
.people-summary { display: grid; gap: 8px; margin: 18px 0; }
.summary-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 6px; padding: 12px; background: #fff; color: var(--ink); text-align: left; }
.summary-row span { overflow-wrap: anywhere; min-width: 0; }
.summary-row strong { font-size: 16px; white-space: nowrap; }
.totals { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.grand-total { padding: 16px; border-radius: 6px; margin-top: 6px; background: var(--green); color: #fff; }
.grand-total strong { font-size: 22px; }
.rounding-note { padding: 12px; border-radius: 6px; background: #e8f3ec; color: var(--muted); font-size: 12px; line-height: 1.6; }
.empty { padding: 24px 0; color: var(--muted); font-size: 14px; }
.empty strong, .empty span { display: block; }
.empty strong { color: var(--ink); margin-bottom: 6px; }
.error { padding: 12px; border-left: 3px solid var(--coral); background: #fff0eb; color: #873822; font-size: 13px; overflow-wrap: anywhere; }
.draft-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; margin-top: 16px; background: var(--mint); border-radius: 6px; font-size: 14px; }
.dialog-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; top: var(--visual-top, 0px); bottom: auto; height: var(--visual-height, 100dvh); z-index: 5; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); background: #17242088; }
.modal { display: grid; gap: 12px; width: min(500px, 100%); max-height: 90vh; max-height: 90dvh; overflow: auto; overscroll-behavior: contain; padding: 24px; border-radius: 10px; background: var(--card); box-shadow: 0 25px 70px #17242033; }
.modal { scroll-padding: 80px 0; align-content: start; }
.modal-header { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.modal > label { font-size: 13px; font-weight: 700; }
.modal-subheading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.modal-subheading span { color: var(--muted); font-size: 12px; }
.check-grid, .value-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check-person { display: flex; align-items: center; gap: 8px; min-height: 48px; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 14px; overflow-wrap: anywhere; }
.value-grid label { display: grid; gap: 6px; font-size: 13px; overflow-wrap: anywhere; }
.value-grid input { width: 100%; }
.split-feedback { margin: 4px 0; color: #174c39; background: var(--mint); border-radius: 6px; padding: 10px; font-size: 13px; }
.quick-add { display: flex; gap: 8px; }
.quick-add input { flex: 1; width: 0; }
.member-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; }
.member-editor span { min-width: 0; }
.action-choice { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); text-align: left; }
.action-choice span { color: var(--muted); font-size: 13px; }
.detail-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail-row > span { overflow-wrap: anywhere; min-width: 0; }
.detail-row strong { text-align: right; }
.settlement-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settlement-row span { min-width: 0; overflow-wrap: anywhere; }
.settlement-row strong { display: block; color: var(--green); }
.settlement-row button { flex: none; }
.undo-button { position: fixed; left: 18px; bottom: calc(94px + env(safe-area-inset-bottom)); z-index: 4; border: 0; border-radius: 6px; min-height: 48px; padding: 12px 18px; background: var(--ink); color: #fff; font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: calc(85px + env(safe-area-inset-bottom)); z-index: 7; transform: translateX(-50%); width: max-content; max-width: min(480px, 90vw); pointer-events: none; opacity: 0; padding: 12px 16px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 14px; }
.toast.show { opacity: 1; }
.bottom-nav { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4; display: grid; grid-template-columns: repeat(4, minmax(52px, 1fr)); align-items: center; gap: 6px; width: min(500px, calc(100% - 28px)); padding: 8px 12px; border: 1px solid #246b5244; border-radius: 24px; background: #fffdf9f5; box-shadow: 0 8px 32px #17242026; }
.nav-button, .nav-add { display: grid; place-items: center; gap: 1px; min-height: 48px; padding: 4px; border: 0; border-radius: 16px; background: none; color: var(--green); font-size: 12px; font-weight: 700; }
.nav-button { grid-template-rows: 24px 16px; align-content: center; width: 100%; line-height: 16px; }
.nav-icon { display: grid; place-items: center; width: 24px; height: 24px; }
.nav-label { display: block; line-height: 16px; }
.nav-button[aria-current=page] { background: var(--mint); }
.nav-add { background: var(--green); color: #fff; grid-template-columns: auto auto; justify-content: center; gap: 8px; padding: 8px 12px; }
.nav-add > span:first-child { font-size: 26px; }
.floating-add { position: fixed; right: max(22px, calc((100vw - 760px) / 2)); bottom: calc(94px + env(safe-area-inset-bottom)); z-index: 5; display: grid; place-items: center; width: 58px; height: 58px; border: 0; border-radius: 50%; background: var(--green); box-shadow: 0 10px 26px #123c2e55; color: #fff; font-size: 34px; font-weight: 400; line-height: 1; }
.floating-add:hover { background: #174d3a; transform: translateY(-1px); }
.floating-add[aria-disabled=true] { opacity: .45; transform: none; }
.dialog-open .floating-add { display: none; }
.account-panel { display: grid; gap: 10px; margin-bottom: 22px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--mint); }
.account-panel h3 { margin-top: 0; }
.google-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border: 1px solid #c9c9c9; border-radius: 6px; background: #fff; color: #242424; font-weight: 700; }
.google-button span { color: #4285f4; font-size: 20px; }
.field-label { font-size: 13px; font-weight: 700; }
.person-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.payer-option { position: relative; min-width: 0; cursor: pointer; }
.payer-option > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.payer-card { display: flex; align-items: center; gap: 7px; padding: 10px; min-height: 54px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 14px; }
.payer-option input:checked + .payer-card { background: #eaf4ee; border: 2px solid var(--green); padding: 9px; color: #174c39; }
.payer-option input:focus-visible + .payer-card { outline: 3px solid #bc7910; outline-offset: 2px; }
.payer-check { margin-left: auto; color: var(--green); opacity: 0; }
.payer-option input:checked + .payer-card .payer-check { opacity: 1; }
.member-list { display: grid; gap: 8px; }
.member-method-button { min-width: 0; border: 0; background: transparent; color: var(--ink); text-align: left; padding: 12px; }
.member-method-button small { display: block; color: var(--green); font-size: 11px; margin-top: 4px; }
.member-suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion { padding: 10px 14px; min-height: 44px; border: 1px solid #246b5244; border-radius: 20px; background: var(--mint); color: #174c39; font-size: 13px; }
.share-modal { width: min(600px, 100%); }
.share-preview { padding: 18px; border-radius: 10px; border: 1px solid var(--line); background: #f4f1ea; }
.share-preview h3 { font-size: 24px; }
.share-total { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: var(--green); color: #fff; padding: 16px; border-radius: 8px; }
.share-total strong { font-size: 24px; }
.share-people { margin: 16px 0; }
.share-person { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; border-bottom: 1px solid var(--line); padding: 12px 0; font-size: 13px; }
.share-person strong { white-space: nowrap; color: var(--green); }
.share-transfer { border-left: 3px solid var(--coral); padding-left: 12px; font-size: 14px; }
.share-transfer strong { white-space: nowrap; }
.share-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#summaryText { width: 100%; margin-top: 10px; }
.summary-image { width: 100%; border-radius: 8px; }
.payment-qr { width: min(280px, 100%); max-height: 320px; object-fit: contain; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 10px; justify-self: center; }
.receiving-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.receiving-card summary { cursor: pointer; color: var(--green); font-weight: 700; min-height: 32px; }
.receiving-card .payment-qr { display: block; margin: 12px auto; }
.receiving-link { display: block; border: 0; background: none; color: var(--green); padding: 10px 0; font-size: 13px; text-decoration: underline; }
.method-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
.method-row > button:first-child { display: grid; text-align: left; min-width: 0; }
.method-row span { overflow-wrap: anywhere; font-weight: 400; font-size: 13px; }
@media (hover: hover) {
  .group-card-large:hover, .ledger-row:hover, .action-choice:hover { border-color: var(--green); background: #f5faf6; }
  .ghost-button:hover, .item-card-foot button:hover { background: var(--mint); }
}
@media (max-width: 900px) {
  .layout-grid { grid-template-columns: 1fr; }
  .summary-panel { position: static; }
  .detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-wrap: wrap; padding: 16px 0; gap: 8px; }
}
@media (max-width: 600px) {
  .app-shell { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .topbar { align-items: start; }
  .top-actions { width: auto; }
  .top-actions .ghost-button { padding: 8px; font-size: 12px; }
  .home-hero { padding: 34px 0 26px; }
  .home-hero h1 { font-size: 38px; }
  .home-heading { align-items: start; flex-wrap: wrap; }
  .analytics-view, .activity-view { padding-top: 34px; }
  .analytics-hero { flex-direction: column; gap: 10px; }
  .analytics-hero h1 { font-size: 38px; }
  .analytics-hero .ghost-button { align-self: start; }
  .analytics-controls { align-items: stretch; }
  .analytics-controls select { width: 100%; }
  .analytics-transfer { grid-template-columns: minmax(0, 1fr) auto; }
  .analytics-transfer > .ghost-button { grid-column: 1 / -1; width: 100%; }
  .analytics-group-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .analytics-group-row > span:nth-child(2) { text-align: left; }
  .analytics-group-row > b { grid-column: 1 / -1; min-width: 0; text-align: left; }
  .profile-map { grid-template-columns: 1fr; gap: 6px; }
  .bottom-nav { grid-template-columns: repeat(4, minmax(48px, 1fr)); gap: 3px; padding-inline: 7px; }
  .nav-button, .nav-add { font-size: 10px; }
  .nav-button { grid-template-rows: 28px 16px; }
  .nav-icon { width: 28px; height: 28px; font-size: 24px; line-height: 1; }
  .nav-add { gap: 5px; padding-inline: 8px; }
  .nav-add > span:first-child { font-size: 22px; }
  .floating-add { right: 18px; width: 54px; height: 54px; }
  .group-cards, .detail-summary { grid-template-columns: 1fr; }
  .group-card-large { padding: 14px; gap: 10px; }
  .hero { align-items: stretch; flex-direction: column; padding-top: 22px; }
  .hero-total { text-align: left; }
  .bill-actions { justify-content: flex-start; }
  .panel, .summary-panel { padding: 16px; }
  .section-heading { align-items: start; flex-wrap: wrap; }
  .section-heading h2, .summary-heading h2 { font-size: 20px; }
  .hint { display: none; }
  .charge-grid { grid-template-columns: 1fr; }
  .modal-backdrop { top: var(--visual-top, 0px); bottom: auto; height: var(--visual-height, 100dvh); padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); place-items: center; }
  .modal { width: 100%; max-height: 100%; padding: 16px; border-radius: 14px; }
  .modal { height: auto; }
  .modal-header { position: sticky; top: -16px; z-index: 2; background: var(--card); margin: -16px -16px 4px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
  .modal input:not([type=radio]):not([type=checkbox]), .modal select, .modal textarea { font-size: 16px; }
  .app-shell { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  .ledger-row { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 8px; padding: 8px; }
  .ledger-row b { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .archive-row { grid-template-columns: minmax(0, 1fr) auto; }
  .archive-row > .danger-link { grid-column: 2; }
  .settlement-row { flex-wrap: wrap; }
}

.qr-expand { display: grid; justify-items: center; width: 100%; background: white; color: var(--green); border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: zoom-in; }
.qr-viewer { width: min(760px, 100%); background: white; }
.qr-controls { display: flex; justify-content: center; gap: 8px; }
#qrViewport { overflow: auto; max-height: 65dvh; background: white; padding: 12px; }
#qrLargeImage { display: block; max-width: none; height: auto; }
.detail-row strong { overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; }
/* Private notification prompts and foreground alerts follow the existing theme. */
.push-offer, .push-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; margin: 12px 0; border: 1px solid #ccd8cb; border-radius: 14px; background: #edf3e9; }
.push-offer p, .push-banner span { flex: 1 1 190px; margin: 0; font-size: 14px; line-height: 1.5; }
.push-offer[hidden], .push-banner[hidden] { display: none; }
.push-banner { position: fixed; left: 50%; bottom: calc(94px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; width: min(540px, calc(100% - 32px)); margin: 0; box-shadow: 0 8px 28px #17242026; }

/* Compact 2026 application shell */
:root { --green: #176b54; --radius: 16px; }
body { font-size: 16px; }
.app-shell { max-width: 960px; padding-left: 16px; padding-right: 16px; }
.topbar { min-height: 64px; border: 0; }
.screen { padding: 20px 0 28px; }
.screen-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.screen-heading h1, .detail-title-row h1, .bill-editor-header h1 { margin: 0; font-size: 24px; letter-spacing: -.5px; }
.panel, .summary-panel, .balance-card, .profile-card { border-radius: var(--radius); padding: 16px; box-shadow: 0 4px 18px #1724200a; }
.primary-button, .ghost-button, input, select, textarea { border-radius: 12px; }
.balance-card { display: grid; gap: 14px; margin-bottom: 24px; border: 1px solid #eccfc5; background: #fff2ed; }
.balance-card > span, .balance-card small { color: var(--muted); font-size: 13px; }
.balance-card > div { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.balance-card p { display: grid; gap: 2px; margin: 0; }
.balance-card strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.credit { color: var(--green) !important; }
.debt { color: var(--coral) !important; }
.compact-section { margin: 24px 0; }
.compact-section .section-heading { margin-bottom: 10px; }
.compact-section h2 { font-size: 18px; }
.compact-list { display: grid; gap: 8px; }
.home-add { width: 100%; }
.group-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto 14px; align-items: center; gap: 10px; min-height: 70px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); text-align: left; }
.group-row > span:nth-child(2) { display: grid; min-width: 0; }
.group-row small { color: var(--muted); font-size: 12px; }
.group-row b { max-width: 190px; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.group-row i { color: var(--muted); font-size: 22px; font-style: normal; }
.search-field { display: block; margin-bottom: 12px; }
.search-field input, .activity-controls > input { width: 100%; }
.filter-pills, .view-switch { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; }
.filter-pills { margin-bottom: 14px; }
.filter-pills button, .view-switch button { min-height: 44px; padding: 8px 16px; border: 0; border-radius: 22px; background: #eaece7; color: var(--muted); white-space: nowrap; }
.filter-pills button[aria-pressed=true], .view-switch button[aria-pressed=true] { background: var(--green); color: white; }
.view-switch { margin-bottom: 16px; }
.view-switch button { flex: 1; }
.activity-controls { display: grid; gap: 12px; margin-bottom: 14px; }
.activity-view, .analytics-view { padding-top: 20px; }
.activity-row { grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; border-left: 1px solid var(--line); border-radius: 14px; }
.activity-row .activity-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--mint); color: var(--green); font-weight: 800; }
.activity-row > b { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.activity-row .archived-badge { grid-column: 2 / -1; justify-self: start; }
.profile-card { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); background: var(--card); }
.profile-avatar { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 20px; }
.profile-card > span:last-child { display: grid; }
.settings-links { display: grid; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.settings-links button { display: flex; justify-content: space-between; min-height: 54px; border: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; background: var(--card); color: var(--ink); text-align: left; }
.settings-links button:last-child { border-bottom: 0; }
.detail-nav { display: flex; align-items: center; justify-content: space-between; }
.detail-title-row { align-items: center; }
.detail-title-row .ledger-context { margin: 0; white-space: nowrap; }
.detail-total-card { border-radius: var(--radius); }
.group-tabs { margin-top: 8px; }
.bill-editor { max-width: 760px; margin: auto; padding: 8px 0 calc(92px + env(safe-area-inset-bottom)); }
.bill-editor-header { display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; margin-bottom: 16px; }
.bill-editor-header h1 { text-align: center; }
.bill-editor-header .back-button { margin: 0; }
.bill-fields { display: grid; grid-template-columns: 1fr 180px 220px; gap: 12px; margin-bottom: 18px; }
.bill-fields label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.bill-fields > p, .bill-fields > button { grid-column: 1 / -1; justify-self: start; margin: 0; }
.item-table-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.item-table-head, .item-table-row { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(70px,.7fr) minmax(88px,1fr); gap: 8px; }
.item-table-head { padding: 12px; color: var(--muted); font-size: 12px; font-weight: 800; }
.item-table-head small { font-weight: 500; }
.item-table-row { align-items: start; padding: 10px 12px; border-top: 1px solid var(--line); }
.item-table-row input { width: 100%; min-height: 44px; padding: 9px 8px; font-size: 16px; }
.item-table-row > div { display: grid; gap: 2px; }
.shared-by-button { min-height: 44px; width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--mint); color: var(--green); text-overflow: ellipsis; white-space: nowrap; }
.item-table-row small { color: var(--muted); font-size: 11px; }
.row-menu { grid-column: 1 / -1; justify-self: end; position: relative; }
.row-menu summary { display: grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; color: var(--green); list-style: none; }
.row-menu[open] { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; width: 100%; }
.row-menu button { min-height: 44px; border: 0; border-radius: 10px; padding: 8px 12px; background: var(--mint); color: var(--green); }
.row-error { grid-column: 1 / -1; margin: -8px 0 0; color: var(--coral); font-size: 12px; }
.row-error:empty { display: none; }
.item-table-actions { display: flex; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--line); }
.charges-panel { margin-top: 16px; }
.charges-panel > details > summary, .bill-summary > details > summary { display: flex; justify-content: space-between; min-height: 44px; cursor: pointer; font-weight: 800; }
.bill-summary { margin-top: 16px; }
.bill-summary .share-button { margin-top: 12px; }
.bill-footer { position: fixed; left: 50%; bottom: 0; z-index: 4; transform: translateX(-50%); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(760px, 100%); padding: 10px max(16px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right)); border-top: 1px solid var(--line); background: #fffdf9f2; backdrop-filter: blur(12px); }
.bottom-nav { grid-template-columns: repeat(5, minmax(48px,1fr)); width: min(560px, calc(100% - 24px)); border-radius: 22px; }
.nav-center { display: grid; place-items: center; align-self: center; justify-self: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--green); color: white; font-size: 28px; }
.picker-tools { display: flex; justify-content: space-between; }
@media (max-width: 600px) {
  .screen { padding-top: 12px; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { max-height: calc(var(--visual-height, 100dvh) - 12px); border-radius: 18px 18px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .bill-fields { grid-template-columns: 1fr 1fr; }
  .bill-fields label:first-child { grid-column: 1 / -1; }
  .bill-fields label:last-of-type { grid-column: 1 / -1; }
  .detail-title-row { align-items: flex-start; flex-direction: row; gap: 10px; }
  .group-row b { max-width: 108px; }
  .activity-row { grid-template-columns: 32px minmax(0,1fr) auto; }
  .activity-row > b { max-width: 105px; overflow: hidden; text-overflow: ellipsis; }
  .item-table-head, .item-table-row { grid-template-columns: minmax(0,1.2fr) minmax(62px,.68fr) minmax(82px,1fr); gap: 5px; }
  .item-table-head, .item-table-row { padding-left: 8px; padding-right: 8px; }
  .shared-by-button { padding-inline: 5px; font-size: 13px; }
  .charge-controls { grid-template-columns: 1fr; }
  .charge-controls select:last-child { grid-column: auto; }
}
@media (max-width: 350px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .item-table-head, .item-table-row { grid-template-columns: minmax(0,1.12fr) 64px minmax(76px,.9fr); }
  .item-table-row input { padding-inline: 5px; }
  .bottom-nav { width: calc(100% - 12px); padding-inline: 4px; }
}
/* Explicit web updates never interrupt an editor or an unfinished bill. */
.web-update-notice { position: fixed; inset: auto 12px 90px; z-index: 4; margin: auto; max-width: 460px; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 18px #0002; }
.web-update-notice[hidden] { display: none; }
