:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  color: #1c1c1e;
  background: #f2f2f7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1c1c1e;
  --muted: #8e8e93;
  --line: #e5e5ea;
  --blue: #007aff;
  --green: #16845b;
  --white: #fff;
  --surface: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f2f2f7; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }
.app-shell { max-width: 760px; min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) 20px calc(100px + env(safe-area-inset-bottom)); }
.topbar { height: 58px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 19px; font-weight: 700; }
.brand strong { display: block; font-size: 14px; letter-spacing: -.25px; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 8px; letter-spacing: 1px; font-weight: 700; }
.icon-button, .close-button { border: 0; background: #e5e5ea; color: var(--blue); width: 36px; height: 36px; border-radius: 50%; font-size: 19px; cursor: pointer; }
.view { display: none; animation: appear .18s ease; }
.view.active { display: block; }
@keyframes appear { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.welcome-row { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 19px 0 18px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 9px; letter-spacing: 1.2px; font-weight: 700; }
.welcome-row h1, .section-heading h2, .dialog-head h2 { margin: 0; font-size: 28px; line-height: 1.12; letter-spacing: -.7px; font-weight: 750; }
.primary-button { border: 0; border-radius: 12px; padding: 13px 17px; background: var(--blue); color: #fff; font-size: 14px; font-weight: 650; cursor: pointer; }
.primary-button span { margin-left: 8px; }
.primary-button.compact { padding: 10px 13px; border-radius: 11px; font-size: 12px; white-space: nowrap; }
.balance-card { min-height: 184px; position: relative; overflow: hidden; padding: 22px; border-radius: 22px; background: linear-gradient(140deg, #1586ff, #0063db); color: #fff; box-shadow: 0 8px 20px #007aff2b; }
.balance-top, .balance-bottom { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.balance-top { font-size: 12px; color: #eaf4ff; }
.privacy-dot { font-size: 9px; color: #e5f3ff; }
.privacy-dot:first-letter { color: #b7f2c0; }
.balance-amount { position: relative; z-index: 1; display: block; margin: 20px 0 19px; font-size: 38px; letter-spacing: -1.4px; font-weight: 750; }
.balance-bottom { font-size: 11px; color: #eaf4ff; }
.balance-arrow { width: 27px; height: 27px; border-radius: 50%; background: #ffffff25; display: grid; place-items: center; }
.card-orb { position: absolute; border: 1px solid #ffffff25; border-radius: 50%; }
.orb-one { width: 175px; height: 175px; right: -44px; top: -99px; box-shadow: 0 0 0 27px #ffffff12, 0 0 0 54px #ffffff0b; }
.orb-two { width: 96px; height: 96px; right: 58px; bottom: -83px; box-shadow: 0 0 0 18px #ffffff0c; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 13px 0 30px; }
.stat-card { min-height: 76px; padding: 12px; display: flex; align-items: center; gap: 10px; border: 1px solid #ebebf0; border-radius: 16px; background: var(--surface); }
.stat-icon { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; font-size: 17px; font-weight: 700; }
.mint { background: #e8f7ed; color: #27814f; }
.peach { background: #fff1e7; color: #c97848; }
.stat-card small, .stat-card strong { display: block; }
.stat-card small { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.stat-card strong { font-size: 15px; letter-spacing: -.25px; font-weight: 700; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin: 0 1px 12px; }
.section-heading h2 { font-size: 19px; letter-spacing: -.35px; }
.section-heading .eyebrow { font-size: 8px; }
.text-button { padding: 7px 0; border: 0; background: none; color: var(--blue); font-size: 11px; font-weight: 600; cursor: pointer; }
.text-button span { margin-left: 3px; font-size: 15px; }
.people-list, .activity-list { display: grid; gap: 9px; }
.person-row { width: 100%; padding: 12px; display: flex; align-items: center; gap: 11px; border: 1px solid #ebebf0; border-radius: 15px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.avatar { width: 41px; height: 41px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e7f1ff; color: var(--blue); font-size: 14px; font-weight: 700; text-transform: uppercase; }
.person-copy { min-width: 0; flex: 1; }
.person-copy strong, .person-copy small { display: block; }
.person-copy strong { overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.person-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.person-balance { text-align: right; }
.person-balance strong { display: block; font-size: 13px; font-weight: 650; }
.person-balance small { color: var(--muted); font-size: 9px; }
.chevron { color: #c7c7cc; font-size: 21px; }
.empty-state { padding: 23px 17px; border: 1px dashed #d4d4d9; border-radius: 16px; background: #fff; color: #7c7c82; text-align: center; }
.empty-icon { width: 40px; height: 40px; margin: 0 auto 9px; display: grid; place-items: center; border-radius: 50%; background: #edf5ff; color: var(--blue); font-size: 20px; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 13px; }
.empty-state p { margin: 0; font-size: 11px; line-height: 1.5; }
.recent-heading { margin-top: 28px; }
.activity-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #ebebf0; border-radius: 15px; background: #fff; }
.activity-icon { width: 35px; height: 35px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e8f2ff; color: var(--blue); font-size: 16px; }
.activity-icon.repayment { background: #fff1e7; color: #bd6e3c; }
.activity-icon.loan { background: #f0edff; color: #7560c9; }
.activity-copy { min-width: 0; flex: 1; }
.activity-copy strong, .activity-copy small { display: block; }
.activity-copy strong { overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.activity-amount { text-align: right; white-space: nowrap; }
.activity-amount strong { display: block; font-size: 12px; font-weight: 650; }
.activity-amount small { color: var(--muted); font-size: 9px; }
.activity-amount.positive strong { color: #20804f; }
.activity-amount.negative strong { color: #b76e43; }
.tabbar { position: fixed; z-index: 5; bottom: 0; left: 50%; width: min(100%, 760px); padding: 9px 20px calc(8px + env(safe-area-inset-bottom)); display: flex; justify-content: space-around; transform: translateX(-50%); border-top: 1px solid #d8d8dc; background: #f8f8f8eF; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.tab { width: 74px; padding: 3px; display: grid; justify-items: center; gap: 2px; border: 0; background: none; color: #8e8e93; cursor: pointer; }
.tab span { height: 24px; display: grid; place-items: center; }
.tab span svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab small { font-size: 9px; font-weight: 550; }
.tab.active { color: var(--blue); }
.page-intro { margin: 0 0 19px; color: #73737a; font-size: 12px; line-height: 1.55; }
.spacious { gap: 9px; }
.back-button { margin-top: 6px; padding: 5px 0; border: 0; background: none; color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.person-hero { padding: 20px 0 17px; display: flex; align-items: center; gap: 13px; }
.person-hero .avatar { width: 54px; height: 54px; font-size: 18px; }
.person-hero h1 { margin: 0; font-size: 24px; letter-spacing: -.5px; }
.person-hero p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.person-total { margin: 0 0 15px; padding: 19px; border-radius: 19px; background: linear-gradient(140deg, #1586ff, #0063db); color: #fff; }
.person-total small, .person-total span { color: #eaf4ff; font-size: 10px; }
.person-total strong { display: block; margin: 7px 0 3px; font-size: 29px; font-weight: 750; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 23px; }
.secondary-button { padding: 12px; border: 1px solid #c6ddfb; border-radius: 12px; background: #fff; color: var(--blue); font-size: 11px; font-weight: 650; cursor: pointer; }
.person-detail-heading { margin: 5px 0 12px; font-size: 14px; font-weight: 650; }
.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 17px 0; }
.type-choice { padding: 10px 5px; border: 1px solid #e5e5ea; border-radius: 12px; background: #fff; color: #6e6e73; font-size: 9px; font-weight: 600; cursor: pointer; }
.type-choice span { display: block; margin-bottom: 5px; font-size: 17px; }
.type-choice.selected { border-color: #91c3ff; background: #edf5ff; color: var(--blue); }
.sheet-dialog { width: min(100% - 24px, 460px); max-height: min(92dvh, 760px); overflow: auto; padding: 26px 21px 21px; border: 0; border-radius: 24px; background: #f7f7fa; color: var(--ink); box-shadow: 0 20px 70px #0003; }
.sheet-dialog::backdrop { background: #0005; backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 17px; }
.dialog-head h2 { font-size: 22px; }
.dialog-head .eyebrow { font-size: 8px; }
.close-button { width: 31px; height: 31px; background: #e5e5ea; font-size: 21px; }
.field-label { display: block; margin: 14px 0 7px; color: #55555b; font-size: 10px; font-weight: 650; }
.optional { margin-left: 4px; color: var(--muted); font-size: 9px; font-weight: 400; }
.sheet-dialog input, .sheet-dialog select { width: 100%; height: 45px; padding: 0 13px; outline: none; border: 1px solid #dedee3; border-radius: 11px; background: #fff; color: var(--ink); font-size: 13px; }
.sheet-dialog input:focus, .sheet-dialog select:focus { border-color: #68aaff; box-shadow: 0 0 0 3px #007aff20; }
.amount-field { height: 49px; padding: 0 13px; display: flex; align-items: center; border: 1px solid #dedee3; border-radius: 11px; background: #fff; color: var(--blue); font-size: 18px; font-weight: 700; }
.amount-field input { height: 46px; padding-left: 9px; border: 0; box-shadow: none !important; font-size: 19px; font-weight: 700; }
.form-hint { margin: 8px 1px 0; color: #73737a; font-size: 10px; }
.hidden { display: none; }
.primary-button.full { width: 100%; margin-top: 24px; padding: 15px; }
.backup-action { width: 100%; margin: 9px 0; padding: 12px; display: flex; align-items: center; gap: 12px; border: 1px solid #e5e5ea; border-radius: 14px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.backup-action > span:nth-child(2) { flex: 1; }
.backup-action strong, .backup-action small { display: block; }
.backup-action strong { font-size: 12px; font-weight: 650; }
.backup-action small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.backup-action b { color: #c7c7cc; }
.backup-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e8f2ff; color: var(--blue); font-size: 18px; }
.file-action { cursor: pointer; }
.privacy-note { margin: 15px 2px 0; color: #7d7d83; font-size: 9px; line-height: 1.55; }
.small-dialog { max-width: 390px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.confirm-actions button { padding: 11px 16px; border-radius: 11px; font-size: 11px; }
.danger-button { border: 0; background: #ff3b30; color: #fff; font-weight: 650; cursor: pointer; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(79px + env(safe-area-inset-bottom)); padding: 11px 16px; transform: translate(-50%, 16px); border-radius: 12px; background: #2c2c2e; color: #fff; font-size: 11px; box-shadow: 0 8px 20px #0003; opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (min-width: 600px) { .app-shell { padding-left: 34px; padding-right: 34px; } .welcome-row { margin-top: 25px; } .balance-card { padding: 26px 27px; } .balance-amount { font-size: 43px; } }
@media (max-width: 380px) { .app-shell { padding-right: 15px; padding-left: 15px; } .welcome-row h1 { font-size: 25px; } .primary-button.compact { padding: 10px; font-size: 11px; } .stat-card { gap: 8px; padding: 10px 8px; } .stat-card strong { font-size: 13px; } .type-choice { font-size: 8px; } }
