:root {
    --ink: #20233a;
    --muted: #85899c;
    --line: #eceef4;
    --purple: #6959e8;
    --purple-dark: #5545d2;
    --green: #2a9d72;
    --orange: #e48c45;
    --bg: #f7f8fc;
    font-family: "DM Sans", sans-serif;
    color: var(--ink);
    font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); font-size: 14px; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; }
.sidebar { width: 238px; background: #fff; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 28px 17px 18px; border-right: 1px solid #eef0f5; z-index: 3; }
.brand { display: flex; gap: 10px; align-items: center; padding: 1px 12px 40px; font: 800 24px "Manrope", sans-serif; letter-spacing: -1.2px; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 11px; background: var(--purple); color: #fff; font: 800 22px "Manrope", sans-serif; }
.brand-dot { color: var(--purple); }
.side-label { color: #a4a7b5; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; padding: 0 12px 11px; }
.nav-link { display: flex; align-items: center; gap: 12px; height: 43px; padding: 0 12px; border-radius: 10px; color: #777b8e; font-weight: 600; margin-bottom: 5px; transition: .18s ease; }
.nav-link:hover, .nav-link.active { background: #f2f0ff; color: var(--purple); }
.nav-icon { font-size: 18px; line-height: 1; width: 19px; text-align: center; }
.sidebar-bottom { margin-top: auto; display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 19px 5px 3px; }
.group-avatar { width: 36px; height: 36px; background: #eeeaff; color: var(--purple); border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: 0 0 auto; }
.sidebar-bottom strong, .sidebar-bottom span:not(.more-dots) { display: block; }
.sidebar-bottom strong { font-size: 12px; margin-bottom: 3px; }
.sidebar-bottom div:nth-child(2) span { color: var(--muted); font-size: 11px; }
.more-dots { color: #a0a3b0; margin-left: auto; font-size: 21px; letter-spacing: 1px; }
.main-content { margin-left: 238px; min-height: 100vh; }
.topbar { height: 70px; background: rgba(255,255,255,.82); border-bottom: 1px solid #eceef4; display: flex; align-items: center; justify-content: space-between; padding: 0 5.2%; }
.breadcrumb { color: #999cac; font-size: 12px; }
.breadcrumb span { padding: 0 10px; color: #c3c4ce; }
.breadcrumb strong { color: #55596d; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; color: #8c90a1; font-size: 11px; }
.online-dot { width: 7px; height: 7px; background: #52bd8c; border-radius: 50%; }
.profile-avatar { margin-left: 10px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #6554d8; background: #eeeaff; font-weight: 700; }
.page-wrap { max-width: 1240px; padding: 40px 5.2% 25px; margin: auto; }
.heading-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.eyebrow { color: #9c9fb0; display: flex; align-items: center; gap: 8px; font-size: 9px; font-weight: 700; letter-spacing: 1.1px; margin-bottom: 10px; }
.group-avatar.small { width: 22px; height: 22px; border-radius: 7px; font-size: 12px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: "Manrope", sans-serif; letter-spacing: -.55px; }
h1 { font-size: 29px; line-height: 1.25; }
.subtitle { margin-top: 7px; color: var(--muted); font-size: 12px; }
.button { height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; padding: 0 17px; border-radius: 10px; font: 600 12px "DM Sans", sans-serif; cursor: pointer; transition: .18s ease; }
.button-primary { background: var(--purple); color: #fff; box-shadow: 0 5px 13px #6959e82b; }
.button-primary:hover { background: var(--purple-dark); transform: translateY(-1px); }
.add-expense-top span { font-size: 17px; font-weight: 400; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 22px; }
.stat-card { min-height: 132px; background: #fff; border: 1px solid #eff0f5; border-radius: 14px; padding: 18px 19px; position: relative; overflow: hidden; box-shadow: 0 3px 13px #272a3b04; }
.stat-heading { display: flex; gap: 8px; align-items: center; color: #777b8c; font-size: 11px; font-weight: 600; position: relative; z-index: 1; }
.stat-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; font-weight: 700; font-size: 14px; }
.stat-icon.purple { background: #f0edff; color: #7667e7; }
.stat-icon.green { background: #e8f7ef; color: #36a979; }
.stat-icon.orange { background: #fff3e8; color: #e29554; }
.stat-value { font: 700 25px "Manrope", sans-serif; letter-spacing: -.7px; margin: 12px 0 2px 2px; position: relative; z-index: 1; }
.stat-caption { color: #a0a3b0; font-size: 10px; margin-left: 2px; position: relative; z-index: 1; }
.stat-decoration { width: 92px; height: 92px; border-radius: 50%; position: absolute; right: -24px; bottom: -44px; opacity: .46; }
.deco-purple { background: #f0edff; }.deco-green { background: #e6f7ee; }.deco-orange { background: #fff0e3; }
.content-grid { display: grid; grid-template-columns: 1.02fr .98fr; gap: 17px; align-items: start; }
.panel { background: #fff; border: 1px solid #eceef4; border-radius: 14px; box-shadow: 0 3px 14px #272a3b04; }
.balances-panel, .add-panel { min-width: 0; }
.panel-header { padding: 19px 20px 15px; border-bottom: 1px solid #f0f1f5; display: flex; align-items: center; justify-content: space-between; }
.panel-header h2 { font-size: 15px; font-weight: 700; }
.panel-header p { color: #9a9dac; font-size: 10px; margin-top: 5px; }
.member-count { color: #8c90a1; background: #f6f7fa; border: 1px solid #f0f1f4; border-radius: 20px; padding: 6px 9px; font-size: 9px; font-weight: 600; }
.balance-list { padding: 1px 19px; }
.balance-row { display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 59px; border-bottom: 1px solid #f3f4f7; position: relative; }
.person-avatar { background: var(--avatar-bg, #eeeaff); color: #5f60a0; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.person-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.person-info strong { font-size: 11px; font-weight: 600; }
.person-info > span { color: #9b9ead; font-size: 9px; }
.you-tag { color: #a6a8b5; font-size: 8px; background: #f3f4f7; border-radius: 5px; padding: 2px 5px; font-weight: 500; vertical-align: 1px; }
.balance-amount { color: #848798; font: 600 11px "Manrope", sans-serif; }
.balance-amount.positive { color: var(--green); }.balance-amount.negative { color: #dc795f; }
.balance-person { border-bottom: 1px solid #f3f4f7; }
.balance-person:last-child { border-bottom: 0; }
.balance-row { width: 100%; grid-template-columns: 35px minmax(0, 1fr) auto 12px; border: 0; border-bottom: 0; padding: 0; background: #fff; color: inherit; text-align: left; font: inherit; text-decoration: none; cursor: pointer; }
.balance-row:hover { background: #fcfbff; }
.balance-row:focus-visible { outline: 2px solid #a69cf4; outline-offset: -2px; border-radius: 7px; }
.balance-chevron { color: #a6a8b5; font-size: 19px; transition: color .18s ease, transform .18s ease; }
.balance-row:hover .balance-chevron { color: var(--purple); transform: translateX(2px); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: #777b8d; font-size: 10px; font-weight: 600; margin-bottom: 20px; }
.back-link:hover { color: var(--purple); }
.personal-heading { margin-bottom: 25px; }
.personal-heading .eyebrow { gap: 8px; }
.personal-avatar { width: 25px; height: 25px; font-size: 9px; }
.personal-content-grid { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(0, 1.4fr); gap: 17px; align-items: start; }
.settlement-panel, .personal-history { min-width: 0; }
.personal-settlement-list { display: grid; gap: 9px; padding: 15px; }
.personal-settlement { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid #eceef4; border-radius: 10px; background: #fff; }
.personal-settlement.pay { background: #fffaf7; border-color: #f4e8df; }
.personal-settlement.receive { background: #f8fcf9; border-color: #e4f0e9; }
.settlement-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #eeeaff; color: #6656d8; font-size: 10px; font-weight: 700; }
.personal-settlement > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.personal-settlement > div strong { color: #4d5164; font-size: 10px; }
.personal-settlement > div span { color: #9b9ead; font-size: 8px; }
.personal-settlement > b { color: #dc795f; font: 700 12px "Manrope", sans-serif; white-space: nowrap; }
.personal-settlement.receive > b { color: var(--green); }
.settlement-empty { min-height: 175px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; padding: 20px; text-align: center; }
.settlement-empty .empty-icon { background: #e8f7ef; color: var(--green); }
.settlement-empty strong { font: 700 12px "Manrope", sans-serif; }
.settlement-empty > span:last-child { color: #999cac; font-size: 9px; }
.personal-transaction-list { padding: 1px 18px 10px; }
.personal-transaction { padding: 13px 0; border-bottom: 1px solid #f0f1f5; }
.personal-transaction:last-child { border-bottom: 0; }
.personal-transaction-header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.personal-transaction-header > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.personal-transaction-header > div strong { color: #494d60; font-size: 11px; overflow-wrap: anywhere; }
.personal-transaction-header > div span { color: #9b9ead; font-size: 8px; }
.transaction-total { color: #414559; font: 700 12px "Manrope", sans-serif; white-space: nowrap; }
.personal-transaction-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.personal-transaction-meta > span { border: 1px solid #efeff5; border-radius: 6px; padding: 5px 7px; color: #797d8d; background: #fff; font-size: 8px; }
.personal-transaction-meta strong { color: #5e6274; }
.split-breakdown { margin-top: 9px; }
.split-breakdown summary { color: #7162dc; font-size: 9px; cursor: pointer; }
.split-breakdown-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.split-breakdown-list > span { display: flex; justify-content: space-between; gap: 6px; padding: 7px; background: #fafaff; border: 1px solid #efedff; border-radius: 6px; color: #777b8b; font-size: 8px; }
.split-breakdown-list > span strong { font-weight: 500; overflow-wrap: anywhere; }
.split-breakdown-list > span b { color: #55596b; white-space: nowrap; }
.split-breakdown-list > span.current-person-share { background: #f0edff; border-color: #dcd7ff; color: #5b4acb; }
.footer a { color: #7669d9; }
.balance-footnote { border-top: 1px solid #f0f1f5; padding: 13px 20px; color: #999cac; font-size: 9px; }
.balance-footnote span { color: var(--purple); margin-right: 5px; font-weight: 700; }
.form-sparkle { color: var(--purple); background: #f1efff; border-radius: 8px; width: 29px; height: 29px; display: grid; place-items: center; }
#expense-form { padding: 17px 20px 19px; }
.field-label { display: block; color: #626679; font-size: 10px; font-weight: 600; margin-bottom: 7px; }
.text-input { width: 100%; height: 39px; background: #fff; border: 1px solid #e8eaf0; border-radius: 8px; padding: 0 11px; outline: none; color: #44485c; font: 11px "DM Sans", sans-serif; }
.text-input:disabled { background: #f6f7fa; color: #777b8c; cursor: not-allowed; opacity: 1; }
.payer-lock-note { color: #9699a8; font-size: 8px; line-height: 1.4; margin-top: 5px; }
.text-input::placeholder, input::placeholder { color: #b7bac5; }
.text-input:focus, .amount-input:focus-within, .custom-amount:focus-within { border-color: #9d93f1; box-shadow: 0 0 0 3px #6959e814; }
.form-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.amount-input { height: 39px; display: flex; gap: 5px; align-items: center; padding: 0 10px; border: 1px solid #e8eaf0; border-radius: 8px; color: #a1a4b2; font-size: 11px; }
.amount-input input, .custom-amount input { border: 0; outline: 0; min-width: 0; width: 100%; font: 11px "DM Sans", sans-serif; color: #44485c; background: transparent; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.split-label { display: flex; justify-content: space-between; align-items: center; margin-top: 17px; margin-bottom: 8px; }
.split-label > span { color: #a0a3b1; font-size: 9px; font-weight: 400; }
.member-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip { min-height: 32px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid #eceef3; border-radius: 8px; padding: 3px 7px 3px 4px; color: #74788a; font-size: 9px; cursor: pointer; transition: .15s ease; }
.member-chip:has(input:checked) { border-color: #dcd7ff; background: #f7f6ff; color: #5b4acb; }
.member-chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip-avatar { width: 23px; height: 23px; font-size: 8px; }
.check-mark { display: none; font-size: 9px; color: var(--purple); }
.member-chip:has(input:checked) .check-mark { display: inline; }
.member-chip:focus-within { outline: 2px solid #a69cf4; outline-offset: 2px; }
.split-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.split-option { height: 52px; border: 1px solid #eceef3; border-radius: 9px; padding: 6px 9px; display: flex; align-items: center; gap: 7px; cursor: pointer; position: relative; transition: .15s ease; }
.split-option.selected { background: #f8f7ff; border-color: #cfc8ff; }
.split-option input { position: absolute; opacity: 0; }
.radio-dot { width: 13px; height: 13px; border: 1.5px solid #d5d7e0; border-radius: 50%; flex: 0 0 auto; }
.split-option.selected .radio-dot { border: 4px solid var(--purple); }
.split-option strong, .split-option small { display: block; }
.split-option strong { color: #55596b; font-size: 9px; }
.split-option small { color: #a1a4b2; font-size: 8px; margin-top: 2px; }
.split-symbol { color: #a19aed; font-size: 15px; margin-left: auto; padding: 0 3px; }
.custom-shares { background: #fafaff; border: 1px solid #efedff; border-radius: 9px; padding: 9px 10px; margin-top: 9px; max-height: 170px; overflow-y: auto; }
.custom-hint { color: #898d9f; font-size: 9px; margin: 0 0 7px; }
.custom-share-row { display: flex; justify-content: space-between; align-items: center; min-height: 34px; color: #676b7d; font-size: 10px; }
.custom-amount { width: 92px; height: 27px; padding: 0 7px; background: #fff; border: 1px solid #e8eaf0; border-radius: 6px; display: flex; align-items: center; color: #a1a4b2; }
.custom-amount input { font-size: 10px; }
.submit-button { width: 100%; height: 39px; margin-top: 17px; font-size: 11px; }
.submit-button span { margin-left: auto; font-size: 16px; }
.secure-note { color: #a4a7b4; font-size: 8px; text-align: center; margin-top: 10px; }
.secure-note span { color: var(--green); margin-right: 4px; }
.expenses-panel { margin-top: 18px; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 16px; background: #fbfbfd; color: #a1a4b2; font-size: 8px; letter-spacing: .55px; font-weight: 700; white-space: nowrap; }
td { padding: 12px 16px; border-top: 1px solid #f1f2f6; color: #75798b; font-size: 10px; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 20px; }
.expense-name { display: flex; gap: 9px; align-items: center; }
.expense-name strong { font-weight: 600; color: #494d60; }
.expense-icon { width: 27px; height: 27px; display: grid; place-items: center; background: #f2f0ff; color: var(--purple); border-radius: 8px; font-size: 14px; }
.paid-person { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #eceef3; border-radius: 20px; padding: 3px 8px 3px 4px; background: #fff; color: #696d7e; font-size: 9px; }
.paid-person-avatar { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #eeeaff; color: #6656d8; font-size: 8px; font-weight: 700; }
.type-pill { display: inline-block; border-radius: 20px; padding: 5px 8px; background: #f3f1ff; color: #7162dc; font-size: 8px; font-weight: 600; }
.type-pill.custom { background: #fff4e8; color: #cb8848; }
.date-cell { color: #979baa; }
.amount-cell { text-align: right; }
td.amount-cell strong { display: block; color: #43475a; font: 600 11px "Manrope", sans-serif; }
.share-note { display: block; color: #a1a4b2; font-size: 8px; margin-top: 3px; }
.expense-actions { text-align: right; white-space: nowrap; }
.delete-form { display: inline; }
.row-action { background: transparent; border: 0; padding: 5px 4px; color: #777b8d; font: 500 9px "DM Sans", sans-serif; cursor: pointer; }
.row-action:hover { color: var(--purple); }
.delete-action { color: #c8786d; margin-left: 4px; }
.delete-action:hover { color: #a84538; }
.edit-dialog { width: min(540px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 28px); padding: 0; overflow-y: auto; border: 1px solid #eceef4; border-radius: 15px; color: var(--ink); box-shadow: 0 20px 70px #20233a33; }
.edit-dialog::backdrop { background: #20233a66; backdrop-filter: blur(2px); }
.dialog-heading { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; background: #fff; padding: 19px 21px 14px; border-bottom: 1px solid #f0f1f5; }
.dialog-heading h2 { font-size: 15px; }
.dialog-heading p { color: #9a9dac; font-size: 10px; margin-top: 5px; }
.dialog-close { width: 29px; height: 29px; border: 0; border-radius: 8px; background: #f5f5f9; color: #777b8c; font-size: 20px; line-height: 1; cursor: pointer; }
.dialog-close:hover { background: #efedff; color: var(--purple); }
.dialog-form { padding: 16px 21px 20px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.expense-detail-row td { padding-top: 0; border-top: 0; color: #a0a3b0; font-size: 9px; white-space: normal; }
.expense-detail-row td > span:first-child { margin-right: 6px; }
.share-detail { display: inline-block; border: 1px solid #f0f1f5; border-radius: 5px; padding: 3px 6px; margin: 2px 3px 2px 0; color: #767a8a; }
.empty-state { min-height: 190px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 9px; text-align: center; padding: 25px; }
.empty-icon { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: #f0edff; color: var(--purple); font-size: 20px; }
.empty-state strong { font: 700 13px "Manrope", sans-serif; }
.empty-state > span:not(.empty-icon) { color: #999cac; font-size: 10px; }
.button-soft { margin-top: 5px; height: 34px; background: #f1efff; color: var(--purple); font-size: 10px; }
.footer { display: flex; justify-content: space-between; color: #a2a5b1; font-size: 9px; padding: 20px 2px 2px; }
.footer span:last-child { color: #8b81e3; }
.flash { border-radius: 9px; padding: 11px 14px; margin: 0 0 19px; font-size: 11px; }
.flash.success { background: #e9f7ef; color: #267c5b; border: 1px solid #d5efe0; }
.flash.error { background: #fff0ed; color: #b75446; border: 1px solid #f8ddd7; }
[hidden] { display: none !important; }
@media (min-width: 1450px) { .page-wrap { padding-left: 0; padding-right: 0; } }
@media (max-width: 1050px) {
    .sidebar { width: 205px; }.main-content { margin-left: 205px; }
    .page-wrap { padding-left: 3.5%; padding-right: 3.5%; }
    .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .sidebar { width: 100%; height: 59px; inset: auto 0 0; flex-direction: row; align-items: center; padding: 0 10px; border-right: 0; border-top: 1px solid #eceef4; }
    .brand { padding: 0 5px; font-size: 19px; gap: 7px; }.brand-mark { width: 29px; height: 29px; }
    .side-label, .sidebar-bottom { display: none; }
    .nav-link { flex: 1; justify-content: center; gap: 6px; height: 39px; padding: 0 5px; margin: 0 2px; font-size: 10px; }
    .nav-icon { font-size: 15px; width: auto; }
    .main-content { margin: 0 0 59px; }
    .topbar { height: 57px; padding: 0 18px; }.topbar-right { font-size: 0; gap: 0; }.topbar-right .online-dot { display: none; }.profile-avatar { margin: 0; }
    .page-wrap { padding: 26px 15px 20px; }
    .heading-row { align-items: flex-start; gap: 10px; margin-bottom: 20px; }.heading-row h1 { font-size: 24px; }
    .subtitle { max-width: 225px; line-height: 1.5; }
    .add-expense-top { width: 41px; height: 41px; overflow: hidden; padding: 0; flex: 0 0 41px; font-size: 0; gap: 0; }.add-expense-top span { font-size: 22px; }
    .stat-grid { grid-template-columns: 1fr; gap: 9px; margin-bottom: 15px; }
    .stat-card { min-height: 100px; padding: 13px 15px; }.stat-value { font-size: 22px; margin-top: 8px; }
    .stat-decoration { width: 78px; height: 78px; right: -20px; bottom: -42px; }
    .content-grid { gap: 13px; }.panel-header { padding: 15px 15px 12px; }.balance-list { padding: 1px 14px; }
    .personal-content-grid { grid-template-columns: 1fr; gap: 13px; }.personal-heading { align-items: flex-start; gap: 10px; }.personal-heading .button { padding: 0 11px; font-size: 10px; }
    .split-breakdown-list { grid-template-columns: 1fr; }
    #expense-form { padding: 15px; }.form-two-col { gap: 8px; }
    .expenses-panel { margin-top: 13px; } th { padding: 11px 12px; } td { padding: 11px 12px; }
    th:first-child, td:first-child { padding-left: 15px; }
    .edit-dialog { border-radius: 13px; }.dialog-heading { padding: 16px 15px 12px; }.dialog-form { padding: 14px 15px 17px; }
    .footer { padding-bottom: 8px; }
}
@media (max-width: 370px) {
    .page-wrap { padding-left: 10px; padding-right: 10px; }
    .member-picker { gap: 4px; }.member-chip { padding-right: 5px; gap: 4px; }
    .split-option { padding-left: 6px; gap: 5px; }
}
