:root {
  --ink: #1c2522;
  --muted: #68716d;
  --line: #e3e1db;
  --paper: #f6f5f1;
  --card: #fffefa;
  --green: #315e55;
  --green-soft: #e7efeb;
  --orange: #d86b48;
  --red: #a1473f;
  --shadow: 0 18px 50px rgba(34, 43, 39, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(49, 94, 85, .25); outline-offset: 2px; }

.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 250px; padding: 32px 22px 24px; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fbfaf7; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 22px; font-weight: 700; letter-spacing: -.7px; }
.brand-mark { position: relative; width: 28px; height: 28px; display: inline-block; transform: rotate(-8deg); }
.brand-mark span { position: absolute; width: 16px; height: 16px; border: 2px solid var(--green); border-radius: 50%; }
.brand-mark span:first-child { top: 2px; left: 2px; }
.brand-mark span:last-child { right: 2px; bottom: 2px; border-color: var(--orange); }
.trip-switcher { width: calc(100% + 8px); display: grid; grid-template-columns: 36px 1fr 16px; align-items: center; gap: 10px; margin: 38px -4px 22px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; color: inherit; background: var(--card); text-align: left; cursor: pointer; }
.trip-switcher small, .trip-switcher strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-switcher small { margin-bottom: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .8px; }
.trip-switcher strong { font-size: 13px; }
.trip-switcher > svg { color: #9a9e9a; }
.trip-monogram { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--green); font-family: "DM Serif Display", serif; font-size: 20px; }
.main-nav { display: grid; gap: 5px; }
.nav-item { width: 100%; padding: 11px 13px; display: flex; align-items: center; gap: 13px; border: 0; border-radius: 9px; color: #6c7470; background: transparent; cursor: pointer; text-align: left; }
.nav-item:hover { color: var(--ink); background: #f0efea; }
.nav-item.active { color: var(--green); background: var(--green-soft); font-weight: 600; }
.sidebar-bottom { margin-top: auto; }
.sync-status { margin: 0 10px 10px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.sync-status > span { width: 7px; height: 7px; border-radius: 50%; background: #4f8b72; box-shadow: 0 0 0 3px #e4eee9; }
.trip-date { margin-bottom: 14px; padding: 0 10px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.profile-compact { width: 100%; display: grid; grid-template-columns: 38px 1fr 16px; align-items: center; gap: 10px; padding: 12px 10px; border: 0; border-top: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.profile-compact strong, .profile-compact small { display: block; }
.profile-compact strong { font-size: 13px; }
.profile-compact small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.profile-compact svg { color: #9a9e9a; }
.main { min-height: 100vh; margin-left: 250px; }
.view { width: min(1180px, calc(100% - 80px)); margin: 0 auto; padding: 54px 0 70px; }
.mobile-header, .mobile-nav { display: none; }

.page-header { margin-bottom: 34px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--orange); font-size: 10px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; }
.page-header h1 { margin: 0 0 8px; font-family: "DM Serif Display", serif; font-size: clamp(36px, 4vw, 52px); font-weight: 400; letter-spacing: -1.5px; line-height: 1; }
.page-header p { margin: 0; color: var(--muted); font-size: 15px; }
.button { min-height: 42px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; transition: transform .15s, background .15s, border .15s; }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--green); box-shadow: 0 8px 20px rgba(49, 94, 85, .15); }
.button-primary:hover { background: #264d45; }
.button-dark { color: #fff; background: var(--ink); }
.button-soft { color: var(--green); background: var(--green-soft); }
.button-quiet { border-color: var(--line); background: transparent; }
.button-danger { color: var(--red); border-color: #e8cac5; background: #f8ece9; }
.button-full { width: 100%; }

.summary-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; }
.summary-card { position: relative; min-height: 174px; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 8px 32px rgba(34, 43, 39, .035); }
.summary-card .summary-label { display: block; margin-bottom: 22px; color: var(--muted); font-size: 12px; font-weight: 600; }
.summary-card > strong { display: block; margin-bottom: 8px; font-family: "DM Serif Display", serif; font-size: 35px; font-weight: 400; letter-spacing: -.5px; }
.summary-card > small { color: var(--muted); font-size: 11px; }
.total-card { color: #f8f5ed; border-color: var(--green); background: var(--green); }
.total-card .summary-label, .total-card > small { color: rgba(255,255,255,.67); }
.mini-bars { position: absolute; inset: auto 18px 16px auto; height: 42px; display: flex; align-items: flex-end; gap: 5px; opacity: .35; }
.mini-bars i { width: 5px; border-radius: 5px; background: #fff; }
.mini-bars i:nth-child(1) { height: 15px }.mini-bars i:nth-child(2) { height: 28px }.mini-bars i:nth-child(3) { height: 21px }.mini-bars i:nth-child(4) { height: 38px }.mini-bars i:nth-child(5) { height: 24px }.mini-bars i:nth-child(6) { height: 32px }.mini-bars i:nth-child(7) { height: 19px }
.meter { position: absolute; inset: auto 24px 22px; height: 4px; overflow: hidden; border-radius: 4px; background: #ecebe6; }
.meter span { height: 100%; display: block; border-radius: inherit; background: var(--orange); }
.balance-card.positive > strong { color: var(--green); }
.balance-card.negative > strong { color: var(--red); }
.balance-dot { position: absolute; right: 22px; bottom: 22px; width: 43px; height: 43px; border: 11px solid var(--green-soft); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px #f3f7f5; }
.negative .balance-dot { border-color: #f3e7e4; background: var(--red); }

.overview-grid { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 10px 36px rgba(34, 43, 39, .035); }
.panel-heading { padding: 23px 24px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.panel-heading h2, .settle-preview h2, .balance-sheet h2 { margin: 0; font-family: "DM Serif Display", serif; font-size: 25px; font-weight: 400; }
.text-button { padding: 5px 0; display: inline-flex; align-items: center; gap: 2px; border: 0; color: var(--green); background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.expense-list { border-top: 1px solid var(--line); }
.expense-row { width: 100%; min-height: 76px; padding: 12px 20px; display: grid; grid-template-columns: 42px 1fr auto 17px; align-items: center; gap: 13px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.expense-row:last-child { border-bottom: 0; }
.expense-row:hover { background: #faf9f5; }
.expense-row > svg { color: #a1a49f; }
.expense-main strong, .expense-main small, .expense-amount strong, .expense-amount small { display: block; }
.expense-main strong, .expense-amount strong { font-size: 13px; }
.expense-main small, .expense-amount small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.expense-amount { text-align: right; }
.expense-amount small { white-space: nowrap; }
.category-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 11px; color: #725543; background: #f1e6dc; font-family: Georgia, serif; font-size: 20px; font-weight: 600; }
.category-stay { color: #536e65; background: #e3ece7; }
.category-transport { color: #536b83; background: #e6edf2; }
.category-groceries { color: #716346; background: #eeeadb; }
.category-activity { color: #6a5d82; background: #eae6f0; }
.right-stack { display: grid; gap: 20px; }
.settle-preview { padding: 24px; }
.smart-label { margin-bottom: 24px; display: flex; align-items: center; gap: 6px; color: var(--orange); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.settle-amount { display: block; margin: 8px 0 16px; font-family: "DM Serif Display", serif; font-size: 35px; font-weight: 400; }
.avatar-route { display: flex; align-items: center; }
.avatar-route span:not(.avatar) { width: 42px; height: 1px; position: relative; background: var(--line); }
.avatar-route span:not(.avatar)::after { content: ""; position: absolute; top: -2px; right: 0; width: 5px; height: 5px; border-top: 1px solid var(--muted); border-right: 1px solid var(--muted); transform: rotate(45deg); }
.settle-preview p { margin: 14px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.books-card { padding: 20px; display: flex; gap: 13px; }
.books-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: var(--green); background: var(--green-soft); }
.books-card .eyebrow { margin: 1px 0 4px; }
.books-card h3 { margin: 0 0 5px; font-size: 14px; }
.books-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.avatar { display: inline-grid; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--avatar); font-size: 10px; font-weight: 700; letter-spacing: .2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.07), 0 0 0 2px var(--card); }
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 40px; height: 40px; font-size: 12px; }
.avatar-lg { width: 54px; height: 54px; font-size: 15px; }
.avatar-xl { width: 72px; height: 72px; font-size: 20px; }

.toolbar { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.search-box { width: min(290px, 100%); height: 42px; padding: 0 13px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 10px; color: #9b9f9b; background: var(--card); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.filter-pills { display: flex; gap: 5px; overflow-x: auto; }
.filter-pill { padding: 8px 12px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.filter-pill.active { color: #fff; border-color: var(--green); background: var(--green); }
.table-title { padding: 17px 20px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.table-title strong { color: var(--ink); }
.expense-table-panel .expense-list { border-top: 1px solid var(--line); }
.expense-list.large .expense-row { min-height: 84px; }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 0 0 5px; color: var(--ink); }
.empty-state p { margin: 0; font-size: 12px; }

.settle-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 20px; align-items: start; }
.settle-plan .panel-heading { padding-bottom: 12px; }
.reconcile-badge { padding: 6px 9px; display: flex; align-items: center; gap: 5px; border-radius: 20px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 600; }
.settle-intro { margin: 0; padding: 0 24px 22px; color: var(--muted); font-size: 12px; }
.transfer-list { border-top: 1px solid var(--line); }
.transfer-row { min-height: 84px; padding: 14px 20px; display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.transfer-row:last-child { border-bottom: 0; }
.transfer-number { color: #a8aaa6; font-family: "DM Serif Display", serif; font-size: 12px; }
.transfer-people { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.transfer-line { width: 27px; display: flex; align-items: center; justify-content: center; color: #9b9f9b; }
.transfer-line::before { content: ""; width: 14px; height: 1px; background: var(--line); }
.transfer-line svg { margin-left: -5px; }
.transfer-amount { font-family: "DM Serif Display", serif; font-size: 19px; font-weight: 400; }
.balance-sheet { padding: 24px; }
.balance-sheet .eyebrow { margin-bottom: 5px; }
.balance-list { margin: 20px -8px; }
.balance-list button { width: 100%; padding: 8px; display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.balance-list button:hover { background: #f6f5f1; }
.balance-list strong, .balance-list small { display: block; }
.balance-list strong { font-size: 12px; }
.balance-list small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.balance-list b { font-size: 12px; }
.money-positive { color: var(--green) !important; }
.money-negative { color: var(--red) !important; }
.zero-sum { padding-top: 15px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.zero-sum strong { color: var(--green); }
.celebrate { padding: 55px 20px; text-align: center; }
.celebrate > span { width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); }
.celebrate h3 { margin: 0 0 6px; font-family: "DM Serif Display", serif; font-size: 23px; font-weight: 400; }
.celebrate p { margin: 0; color: var(--muted); font-size: 11px; }

.people-toolbar { margin: -10px 0 22px; display: flex; align-items: center; justify-content: space-between; }
.people-toolbar p { color: var(--muted); font-size: 12px; }
.people-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.person-card { padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); box-shadow: 0 8px 30px rgba(34, 43, 39, .03); text-align: left; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.person-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.person-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.person-card-top > span:last-child { color: #a1a49f; }
.person-card h2 { margin: 15px 0 3px; font-family: "DM Serif Display", serif; font-size: 23px; font-weight: 400; }
.person-card h2 small, .profile-hero h3 small { padding: 3px 6px; border-radius: 9px; color: var(--green); background: var(--green-soft); font-family: "DM Sans", sans-serif; font-size: 8px; text-transform: uppercase; vertical-align: middle; }
.person-card > p { margin: 0; color: var(--muted); font-size: 10px; }
.person-stats { margin-top: 20px; padding: 15px 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.person-stats span + span { padding-left: 16px; border-left: 1px solid var(--line); }
.person-stats small, .person-stats strong { display: block; }
.person-stats small { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.person-stats strong { font-size: 13px; }
.person-footer { padding-top: 13px; display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }
.person-footer span { display: flex; align-items: center; gap: 5px; }
.person-footer span:last-child { color: var(--green); font-weight: 600; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; padding: 24px; display: grid; place-items: center; overflow-y: auto; background: rgba(19, 25, 23, .44); backdrop-filter: blur(5px); opacity: 0; transition: opacity .18s; }
.modal-backdrop.open { opacity: 1; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 48px); padding: 26px; overflow-y: auto; border-radius: 18px; background: var(--card); box-shadow: 0 30px 80px rgba(19, 25, 23, .25); transform: translateY(10px) scale(.99); transition: transform .18s; }
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.detail-modal { width: min(490px, 100%); }
.profile-modal { width: min(540px, 100%); }
.modal-header { margin-bottom: 23px; display: flex; align-items: flex-start; justify-content: space-between; }
.modal-header .eyebrow { margin-bottom: 4px; }
.modal-header h2 { margin: 0; font-family: "DM Serif Display", serif; font-size: 30px; font-weight: 400; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.receipt-scan { margin-bottom: 19px; padding: 13px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; border: 1px solid #cedbd5; border-radius: 12px; background: #f0f5f2; }
.receipt-scan.not-configured { border-color: var(--line); background: #f5f3ed; }
.receipt-scan-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--green); background: #fff; }
.receipt-scan strong, .receipt-scan p { display: block; }
.receipt-scan strong { font-size: 11px; }
.receipt-scan p { margin: 3px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.receipt-result { margin: -7px 0 18px; padding: 10px; display: grid; grid-template-columns: 48px 1fr 20px; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 10px; }
.receipt-result img { width: 48px; height: 48px; border-radius: 7px; object-fit: cover; }
.receipt-result strong, .receipt-result p { display: block; }
.receipt-result strong { font-size: 11px; }
.receipt-result p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.receipt-result > svg { color: var(--green); }
.receipt-result.warning { border-color: #e5d5aa; background: #faf6e9; }
.receipt-result.warning > svg { color: #9a7429; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: grid; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field > span, .split-fieldset legend { color: var(--muted); font-size: 10px; font-weight: 600; }
.field > span i { font-style: normal; font-weight: 400; }
.field > small { margin-top: -2px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.field input, .field select, .amount-field > div { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #fbfaf7; font-size: 12px; }
.field input:focus, .field select:focus, .amount-field > div:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(49, 94, 85, .09); }
.amount-field > div { padding-left: 14px; display: flex; align-items: center; gap: 8px; }
.amount-field > div input { height: 100%; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: 17px; font-weight: 600; }
.amount-field > div input:focus { box-shadow: none; }
.amount-field b { color: var(--green); }
.amount-field > div select { width: 68px; height: 28px; padding: 0 22px 0 0; flex: 0 0 68px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; color: var(--green); background-color: transparent; font-size: 11px; font-weight: 700; }
.amount-field > div select:focus { box-shadow: none; }
.base-amount-field[hidden] { display: none; }
.split-fieldset { margin: 18px 0; padding: 0; border: 0; }
.split-fieldset legend { margin-bottom: 8px; }
.split-mode-tabs { margin-bottom: 13px; padding: 4px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; border-radius: 10px; background: #efeee9; }
.split-mode-tabs button { min-width: 0; padding: 7px 4px; overflow: hidden; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 600; text-overflow: ellipsis; cursor: pointer; }
.split-mode-tabs button.active { color: var(--ink); background: var(--card); box-shadow: 0 2px 7px rgba(34,43,39,.08); }
.split-actions { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }
.participant-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.participant { position: relative; min-width: 0; padding: 10px 5px 8px; display: grid; place-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.participant.selected { color: var(--ink); border-color: #9eb2aa; background: var(--green-soft); }
.participant input { position: absolute; opacity: 0; }
.participant-check { position: absolute; top: 5px; right: 5px; width: 15px; height: 15px; display: none; place-items: center; border-radius: 50%; color: #fff; background: var(--green); }
.participant.selected .participant-check { display: grid; }
.custom-split-list { border-top: 1px solid var(--line); }
.custom-split-row { min-height: 55px; display: grid; grid-template-columns: minmax(0, 1fr) 90px 48px; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.custom-split-row.selected { color: var(--ink); }
.custom-person-toggle { min-width: 0; padding: 6px 4px; display: grid; grid-template-columns: 19px 32px 1fr; align-items: center; gap: 8px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.custom-person-toggle .participant-check { position: static; width: 18px; height: 18px; display: grid; color: transparent; border: 1px solid var(--line); background: transparent; }
.custom-split-row.selected .custom-person-toggle .participant-check { color: #fff; border-color: var(--green); background: var(--green); }
.custom-split-row input { width: 90px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: #fbfaf7; text-align: right; font-size: 11px; }
.custom-split-row input:disabled { opacity: .45; }
.custom-split-row input:focus { border-color: var(--green); }
.custom-split-row b { color: var(--muted); font-size: 9px; font-weight: 500; }
.split-total { min-height: 34px; margin-top: 11px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 9px; }
.split-total span { display: flex; align-items: center; gap: 5px; }
.split-total.invalid { color: var(--red); background: #f8ece9; }
.item-split-list { display: grid; gap: 8px; }
.item-split-intro { margin-bottom: 10px; display: grid; gap: 2px; color: var(--ink); font-size: 10px; }
.item-split-intro small { color: var(--muted); font-size: 8px; }
.item-split-row { padding: 10px; display: grid; grid-template-columns: 1fr 100px 28px; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7; }
.item-split-row > input, .item-split-row > label { height: 34px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); }
.item-split-row > input { min-width: 0; padding: 0 9px; outline: 0; font-size: 10px; }
.item-split-row > label { padding: 0 8px; display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 10px; }
.item-split-row > label input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 10px; }
.item-remove { width: 28px; height: 28px; margin-top: 3px; display: grid; place-items: center; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.item-quick-actions { grid-column: 1 / -1; display: flex; gap: 6px; }
.item-quick-actions button { padding: 4px 7px; border: 0; border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 8px; cursor: pointer; }
.item-people { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.item-people button { position: relative; min-width: 0; padding: 6px; display: grid; grid-template-columns: 25px minmax(0, 1fr) 15px; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: transparent; font-size: 8px; text-align: left; cursor: pointer; }
.item-people button > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-people button .participant-check { position: static; width: 15px; height: 15px; display: none; }
.item-people button.active { color: var(--ink); border-color: #9eb2aa; background: var(--green-soft); }
.item-people button.active .participant-check { display: grid; }
.add-item-button { margin-top: 9px; gap: 5px; }
.split-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); text-align: center; font-size: 10px; }
.split-empty p { margin: 0; }
.form-accounting-note, .audit-stamp { margin-top: 15px; padding: 11px 12px; display: flex; align-items: center; gap: 9px; border-radius: 9px; color: var(--green); background: var(--green-soft); font-size: 10px; }
.modal-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.form-error { margin: 12px 0 -8px; color: var(--red); font-size: 11px; }
.form-help { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.invite-card { padding: 18px; border-radius: 13px; background: #f5f3ed; }
.invite-card > .books-icon { margin-bottom: 12px; }
.invite-card > p { margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.invite-card label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 600; }
.invite-card label > div { display: grid; grid-template-columns: 1fr 36px; gap: 7px; }
.invite-card input { min-width: 0; height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--card); font-size: 9px; }
.pending-invite { margin-top: 12px; padding: 8px 10px; border-radius: 8px; color: #826429; background: #f4edda; font-size: 9px; text-align: center; }
.account-access { margin-top: 24px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: 12px; background: #f5f3ed; }
.account-access strong { display: block; font-size: 11px; }
.account-access p { margin: 3px 0 0; max-width: 310px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.account-access-actions { display: flex; gap: 7px; }
.danger-zone { margin-top: 24px; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); }
.danger-zone strong { display: block; font-size: 11px; }
.danger-zone p { margin: 3px 0 0; max-width: 300px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.detail-hero { padding: 18px; display: flex; align-items: center; gap: 14px; border-radius: 13px; background: #f5f3ed; }
.detail-hero strong { display: block; font-family: "DM Serif Display", serif; font-size: 30px; font-weight: 400; }
.detail-hero p, .detail-note { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.detail-note { margin: 14px 2px; }
.detail-tags { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tags span { padding: 5px 8px; display: inline-flex; align-items: center; gap: 4px; border-radius: 12px; color: var(--muted); background: #f1f0eb; font-size: 8px; font-weight: 600; }
.detail-section { margin-top: 20px; }
.detail-section-title { padding: 0 3px 9px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.receipt-item-detail-list { border-top: 1px solid var(--line); }
.receipt-item-detail-list > div { padding: 9px 3px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.receipt-item-detail-list strong, .receipt-item-detail-list small { display: block; }
.receipt-item-detail-list strong { font-size: 10px; }
.receipt-item-detail-list small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.receipt-item-detail-list b { font-size: 10px; }
.split-row { width: 100%; padding: 8px 3px; display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; font-size: 11px; }
.audit-stamp span, .audit-stamp small { display: block; }
.audit-stamp small { margin-top: 2px; opacity: .72; }
.profile-hero { display: flex; align-items: center; gap: 16px; }
.profile-hero h3 { margin: 0 0 4px; font-family: "DM Serif Display", serif; font-size: 26px; font-weight: 400; }
.profile-hero p { margin: 0; color: var(--muted); font-size: 11px; }
.profile-stats { margin: 22px 0; padding: 17px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; background: #f5f3ed; }
.profile-stats span + span { padding-left: 18px; border-left: 1px solid var(--line); }
.profile-stats small, .profile-stats strong { display: block; }
.profile-stats small { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.profile-stats strong { font-size: 17px; }
.ledger-heading { display: flex; align-items: flex-end; justify-content: space-between; }
.ledger-heading .eyebrow { margin-bottom: 3px; }
.ledger-heading h3 { margin: 0; font-family: "DM Serif Display", serif; font-size: 23px; font-weight: 400; }
.ledger-heading > span { color: var(--muted); font-size: 10px; }
.ledger-list { margin-top: 11px; border-top: 1px solid var(--line); }
.ledger-row { padding: 11px 2px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.ledger-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--green); background: var(--green-soft); }
.ledger-mark .category-icon { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
.ledger-mark.settlement { color: #6a5d82; background: #eae6f0; }
.ledger-row strong, .ledger-row small { display: block; }
.ledger-row strong { font-size: 11px; }
.ledger-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.ledger-row b { font-size: 11px; }
.confirm-payment { padding: 12px 25px 5px; text-align: center; }
.avatar-route.large { justify-content: center; }
.avatar-route.large span:not(.avatar) { width: 75px; }
.confirm-payment > strong { display: block; margin: 18px 0 7px; font-family: "DM Serif Display", serif; font-size: 36px; font-weight: 400; }
.confirm-payment p { margin: 0 auto; max-width: 360px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.toast-region { position: fixed; z-index: 200; right: 24px; bottom: 24px; display: grid; gap: 8px; }
.toast { min-width: 310px; padding: 13px 15px; display: flex; gap: 11px; border: 1px solid #d3ded8; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: .22s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green); }
.toast strong { display: block; font-size: 12px; }
.toast p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.app-loading, .app-error { min-height: 100vh; padding: 30px; display: grid; place-items: center; place-content: center; gap: 14px; text-align: center; }
.app-loading p, .app-error p { margin: 0; color: var(--muted); font-size: 12px; }
.app-error h1 { margin: 16px 0 0; font-family: "DM Serif Display", serif; font-size: 34px; font-weight: 400; }

.welcome-shell { position: relative; min-height: 100vh; padding: 40px; display: grid; place-items: center; overflow: hidden; background: #f2f1eb; }
.welcome-card { position: relative; z-index: 2; width: min(480px, 100%); padding: 42px; border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: rgba(255,254,250,.94); box-shadow: 0 28px 90px rgba(24,43,37,.13); backdrop-filter: blur(16px); }
.welcome-card > .brand { margin-bottom: 54px; }
.welcome-card h1 { margin: 0 0 12px; font-family: "DM Serif Display", serif; font-size: clamp(40px, 7vw, 58px); font-weight: 400; letter-spacing: -1.5px; line-height: .98; }
.welcome-card > p { margin: 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.welcome-card form { display: grid; gap: 14px; }
.welcome-card form input { height: 50px; font-size: 16px; }
.welcome-card form .button { margin-top: 2px; min-height: 50px; }
.welcome-card > small { margin-top: 18px; display: block; color: #8b918d; font-size: 9px; text-align: center; }
.welcome-error { margin: -3px 0 0; color: var(--red); font-size: 10px; }
.welcome-art { position: absolute; inset: 0; pointer-events: none; }
.welcome-art span { position: absolute; border-radius: 50%; filter: blur(1px); }
.welcome-art span:nth-child(1) { width: 480px; height: 480px; top: -170px; right: -80px; background: #c9dcd3; }
.welcome-art span:nth-child(2) { width: 360px; height: 360px; bottom: -120px; left: -80px; background: #edcbbb; }
.welcome-art span:nth-child(3) { width: 180px; height: 180px; top: 45%; left: 12%; border: 36px solid rgba(49,94,85,.12); }
.profile-choice-card { width: min(560px, 100%); }
.profile-choice-card > .brand { margin-bottom: 38px; }
.profile-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.profile-choices button { min-width: 0; padding: 12px; display: grid; grid-template-columns: 42px 1fr 18px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fbfaf7; text-align: left; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.profile-choices button:hover { transform: translateY(-1px); border-color: #9eb2aa; background: var(--green-soft); }
.profile-choices button:disabled { opacity: .5; }
.profile-choices strong, .profile-choices small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-choices strong { font-size: 12px; }
.profile-choices small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.profile-choices button > svg { color: #9a9e9a; }
.welcome-code-again { margin: 18px auto 0; display: flex; }

@media (max-width: 1000px) {
  .sidebar { width: 220px; }
  .main { margin-left: 220px; }
  .view { width: min(100% - 48px, 980px); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card:first-child { grid-column: 1 / -1; }
  .overview-grid, .settle-layout { grid-template-columns: 1fr; }
  .right-stack { grid-template-columns: 1fr 1fr; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 72px; }
  .mobile-header { height: 68px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(251, 250, 247, .92); }
  .mobile-header .brand { font-size: 19px; }
  .mobile-header .brand-mark { transform: scale(.85) rotate(-8deg); }
  .avatar-button { padding: 0; border: 0; border-radius: 50%; background: transparent; }
  .view { width: calc(100% - 32px); padding: 31px 0 40px; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 30; height: 68px; padding: 7px 8px max(7px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(255, 254, 250, .96); backdrop-filter: blur(12px); }
  .mobile-nav-item { display: grid; place-items: center; align-content: center; gap: 3px; border: 0; color: #8a8f8b; background: transparent; font-size: 8px; }
  .mobile-nav-item.active { color: var(--green); }
  .mobile-add { width: 44px; height: 44px; margin: -15px auto 0; display: grid; place-items: center; border: 4px solid var(--paper); border-radius: 50%; color: #fff; background: var(--green); box-shadow: 0 4px 15px rgba(49, 94, 85, .25); }
  .page-header { align-items: flex-start; }
  .page-header h1 { font-size: 38px; }
  .page-header > .button { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { min-height: 150px; padding: 19px; }
  .summary-card:first-child { grid-column: 1 / -1; }
  .summary-card > strong { font-size: 29px; }
  .summary-card .summary-label { margin-bottom: 16px; }
  .overview-grid { grid-template-columns: 1fr; }
  .right-stack { grid-template-columns: 1fr; }
  .expense-row { padding: 11px 14px; grid-template-columns: 38px 1fr auto; }
  .expense-row > svg { display: none; }
  .expense-amount small { display: none; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .filter-pills { margin-right: -16px; padding-right: 16px; }
  .settle-layout { grid-template-columns: 1fr; }
  .transfer-row { grid-template-columns: 24px 1fr auto; }
  .transfer-row .button { grid-column: 2 / -1; }
  .transfer-people { flex-wrap: wrap; }
  .people-grid { grid-template-columns: 1fr; }
  .people-toolbar p { display: none; }
  .people-toolbar { justify-content: flex-end; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92vh; padding: 22px 18px max(22px, env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; }
  .participant-grid { grid-template-columns: repeat(3, 1fr); }
  .receipt-scan { grid-template-columns: 38px 1fr; }
  .receipt-scan .button { grid-column: 1 / -1; }
  .split-mode-tabs { overflow-x: auto; grid-template-columns: repeat(5, minmax(64px, 1fr)); }
  .custom-split-row { grid-template-columns: 32px 1fr 76px 38px; }
  .custom-split-row input { width: 76px; }
  .toast-region { right: 12px; bottom: 80px; left: 12px; }
  .toast { min-width: 0; width: 100%; }
  .welcome-shell { padding: 18px; }
  .welcome-card { padding: 28px 22px; border-radius: 20px; }
  .welcome-card > .brand { margin-bottom: 38px; }
  .profile-choices { grid-template-columns: 1fr; }
  .item-people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 410px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card:first-child { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .page-header { margin-bottom: 26px; }
  .panel-heading { padding: 19px 16px 15px; }
  .reconcile-badge { display: none; }
  .account-access, .danger-zone { align-items: stretch; flex-direction: column; }
  .account-access-actions { flex-direction: column; }
  .item-split-row { grid-template-columns: 1fr 90px 28px; }
  .item-people { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
