/* Caster Ledger · airy banking surfaces with glass controls. */
:root {
  --ink: #c3ac79;
  --muted: #837e77;
  --paper: #c3ac79;
  --panel: #ffffff;
  --line: #c3ac79;
  --teal: #a8956a;
  --teal-deep: #534437;
  --lime: #b3a27a;
  --red: #cb4d58;
  --shadow: 0 7px 25px rgba(195, 172, 121, .025);
  --glass: rgba(255, 255, 255, .79);
  --spring: cubic-bezier(.22, 1, .36, 1);
}
html { background: var(--paper); scroll-padding-bottom: 180px; }
body { color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 15px; line-height: 1.5; }
body.ui-modal-open { overflow: hidden; overscroll-behavior: contain; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
.form-field[hidden], .data-row.header[hidden] { display: none; }
button, a, input, select { outline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(168, 149, 106, .55); }
button, .entity-card { transition: background-color .2s, color .2s, border-color .2s, box-shadow .25s, transform .35s var(--spring); }
button:active { transform: scale(.96); }
svg { display: block; width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
strong, .net-worth-value, .data-amount, .account-balance, .plan-remaining { font-variant-numeric: tabular-nums; }
.sidebar { width: 224px; padding: 32px 18px 22px; border-color: var(--line); }
.brand-mark { width: 44px; height: 44px; border-radius: 15px; margin-left: 12px; box-shadow: none; }
.brand-copy { padding: 0 12px 26px; }
.brand-copy strong { font-size: 18px; font-weight: 700; }
.brand-copy span { font-size: 12px; }
.nav-list { gap: 7px; }
.nav-item { min-height: 47px; border-radius: 16px; font-size: 14px; font-weight: 500; padding: 11px 14px; }
.nav-item.active { color: var(--teal-deep); background: #f4f1eb; box-shadow: none; font-weight: 650; }
.nav-icon { font-size: 21px; color: inherit; }
.sync-card { background: #f9f8f7; border: 0; border-radius: 16px; padding: 15px 12px; }
.sync-dot, .status-dot { background: var(--teal); }
.main-content { margin-left: 224px; width: calc(100% - 224px); max-width: 1540px; padding: 30px 42px 65px; }
.topbar { align-items: center; gap: 18px; margin-bottom: 32px; }
.header-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.header-heading { display: flex; flex-direction: column; gap: 4px; }
.eyebrow { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: none; }
.topbar h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 720; }
.section-kicker { font-size: 11px; font-weight: 550; color: var(--muted); }
h2 { font-size: 21px; font-weight: 650; line-height: 1.35; }
.primary-button, .secondary-button, .icon-button, .detail-back { min-height: 44px; border-radius: 24px; padding: 10px 17px; font-weight: 600; }
.primary-button { background: var(--teal); border-color: transparent; color: #ffffff; }
.primary-button:hover { background: #9f895a; box-shadow: 0 5px 16px rgba(149, 130, 88, .15); }
.secondary-button { background: #f6f5f3; border-color: transparent; color: #383734; }
.secondary-button:hover { background: #f3f0ea; border-color: transparent; }
.icon-button { width: 46px; height: 46px; padding: 12px; display: grid; place-items: center; border-color: #ffffff; background: var(--glass); box-shadow: 0 5px 19px rgba(195, 172, 121, .05); }
.ghost-button { min-height: 36px; color: #706c66; font-size: 12px; }
.hero-row { gap: 20px; align-items: stretch; }
.net-worth-panel, .insight-panel, .metric-card, .table-panel, .settings-panel, .receivable-summary, .plan-card, .analysis-summary, .analysis-list, .transfer-panel, .profile-onboarding, .profile-card, .entity-detail-card, .transaction-detail-card { border: 0; border-radius: 26px; box-shadow: var(--shadow); }
.net-worth-panel { text-align: center; padding: 32px 30px 16px; min-height: 330px; background: #ffffff; }
.net-worth-panel > .section-kicker { font-size: 14px; color: #4d4a46; font-weight: 500; }
.net-worth-main { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 20px; margin-top: 12px; }
.net-worth-value { font-size: clamp(38px, 4.5vw, 66px); line-height: 1.12; font-weight: 700; letter-spacing: -2px; margin: 0; }
.snapshot-button { margin: 0; font-size: 11px; min-height: 36px; padding: 8px 13px; background: #f5f2ed; color: #655344; }
.change-row { justify-content: center; flex-wrap: wrap; margin-top: 15px; gap: 7px 10px; font-size: 12px; }
.change-row > span:last-child { color: #9b9791; }
.change-pill { padding: 3px 8px; border-radius: 20px; font-weight: 650; }
.change-rate { font-weight: 650; }
.positive { background: #f5f2ed; color: #5e4d3f; }
.negative { background: #cb4d58; }
.chart-wrap { height: 145px; margin-top: 25px; }
.side-insights { gap: 16px; }
.insight-panel { min-height: 150px; padding: 24px; }
.insight-panel strong { font-size: 29px; font-weight: 650; margin-top: 13px; }
.insight-panel .muted { font-size: 12px; }
.allocation-bar { height: 8px; margin-top: 19px; border-radius: 20px; }
.legend-list { gap: 10px 12px; }
.legend-item { font-size: 11px; }
.section-head { margin-top: 32px; margin-bottom: 17px; align-items: center; }
.section-head .muted { font-size: 13px; font-weight: 400; }
.metric-grid { gap: 14px; }
.metric-card { min-height: 122px; padding: 21px; background: #f4f3f1; box-shadow: none; }
.metric-card.accent { background: #fdf6e6; border-color: rgba(200,164,92,.5); }
.metric-label { font-size: 12px; color: #6a6660; }
.metric-card strong { margin: 9px 0 8px; font-weight: 650; font-size: 24px; }
.metric-foot { font-size: 11px; }
.table-panel { padding: 24px; }
.activity-row { width: 100%; padding: 17px 0; border: 0; border-top: 1px solid #f4f4f4; gap: 12px; background: transparent; color: var(--ink); text-align: left; border-radius: 0; }
.activity-row:hover { background: #fdfcfb; }
.activity-main { gap: 13px; }
.activity-main > div:last-child { min-width: 0; }
.activity-icon, .transaction-row-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; background: #f3f0ea; color: #958257; font-size: 22px; }
.activity-name { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.activity-date { margin-top: 4px; font-size: 12px; color: #9b9892; }
.activity-amount { font-size: 16px; font-weight: 600; }
.breakdown-row { padding: 17px 0; }
.breakdown-name { font-weight: 500; }
.amount-income { color: #857249; }
.amount-expense { color: #b95760; }
.amount-transfer { color: #c3ac79; }
.filter-row { gap: 18px; margin-bottom: 22px; }
.segmented { padding: 5px; border-radius: 22px; background: #c3ac79; gap: 4px; }
.segmented button { min-height: 40px; border-radius: 18px; padding: 9px 17px; font-size: 13px; color: #88847d; }
.segmented button.selected { color: var(--ink); box-shadow: 0 3px 10px rgba(195, 172, 121, .04); font-weight: 600; }
.search-box { width: 250px; border: 0; background: #f2f1f0; border-radius: 24px; padding: 11px 15px; min-height: 44px; }
.search-box input { font-size: 13px; }
.account-grid, .plan-grid { gap: 17px; }
.account-card, .plan-card { padding: 23px; border: 0; border-radius: 24px; background: #ffffff; box-shadow: var(--shadow); }
.entity-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(44, 36, 30, .065); }
.account-name, .plan-name { font-size: 17px; font-weight: 600; }
.account-category, .account-currency, .plan-caption { font-size: 12px; }
.account-balance, .plan-remaining { margin-top: 25px; font-size: 29px; font-weight: 650; }
.account-actions { margin-top: 20px; padding-top: 10px; gap: 16px; }
.account-actions button { min-height: 36px; font-size: 12px; }
.plan-status { border-radius: 15px; font-size: 10px; }
.plan-progress { height: 6px; margin-top: 20px; }
.plan-toolbar { border: 0; border-radius: 22px; padding: 15px 19px; }
.plan-toolbar input, .settings-panel label input, .settings-panel label select { border-radius: 14px; min-height: 46px; }
.data-row { border-top-color: #c3ac79; min-height: 78px; }
.data-title { font-size: 14px; font-weight: 500; }
.data-sub { font-size: 12px; color: #9a9690; }
.data-row.transaction-row { grid-template-columns: 75px minmax(130px, 1.2fr) minmax(80px, .8fr) 120px 75px 80px; gap: 10px; }
.transaction-row .data-main { display: flex; align-items: center; gap: 11px; }
.transaction-copy { min-width: 0; }
.transaction-month { display: flex; align-items: center; gap: 14px; padding: 22px 0 12px; font-size: 12px; font-weight: 500; color: var(--muted); }
.transaction-month::after { content: ""; height: 1px; flex: 1; background: #f0f0ef; }
.transaction-row-icon { width: 35px; height: 35px; flex-basis: 35px; font-size: 18px; }
.data-amount { font-size: 15px; font-weight: 650; }
.transaction-delete { border-color: transparent; background: #cb4d58; border-radius: 18px; font-size: 11px; }
.entity-detail-hero h2 { font-weight: 600; }
.entity-detail-hero > strong, .detail-amount { font-weight: 650; letter-spacing: -1px; }
.detail-toolbar { max-width: 860px; margin-bottom: 20px; }
.detail-back { width: 44px; padding: 0; border: 0; }
.entity-detail-card, .transaction-detail-card { padding: 30px; }
.entity-detail-metrics { border: 0; border-radius: 20px; background: #f1f0ee; }
.entity-detail-metrics > div { padding: 20px; background: #f8f7f6; }
.detail-list dd { font-weight: 500; }
.detail-actions { gap: 12px; }
.related-transaction-row { padding: 20px 2px; gap: 12px; }
.related-transaction-main strong { font-size: 14px; font-weight: 500; }
.related-transaction-amount { font-size: 15px; font-weight: 600; }
.settings-panel { padding: 26px; }
.recovery-box, .restore-undo-row, .restore-warning { border-radius: 18px; }
.receivable-summary { padding: 24px; }
.receivable-summary strong, .analysis-summary strong { font-size: 26px; font-weight: 650; }
.analysis-date strong, .analysis-value strong { font-weight: 550; }
.profile-avatar { border-radius: 50%; }
.profile-local-badge, .detail-type { border-radius: 15px; }
.profile-onboarding-mark, .transfer-icon { border-radius: 50%; background: #f4f1eb; }
.transfer-panel { padding: 25px; }
.transfer-panel .muted { font-size: 13px; }
.modal-backdrop { background: rgba(195, 172, 121, .23); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.modal { border-radius: 28px; background: #ffffff; box-shadow: 0 25px 90px rgba(27, 22, 18, .2), inset 0 1px rgba(255, 255, 255, .9); }
.modal-toolbar { padding: 12px 16px; min-height: 70px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(25px) saturate(1.4); -webkit-backdrop-filter: blur(25px) saturate(1.4); }
.modal-close { min-width: 44px; min-height: 44px; background: #f2f2f1; }
.modal-confirm { min-height: 44px; padding: 10px 20px; }
.modal h2 { font-size: 24px; font-weight: 650; }
#modalContent { padding: 25px 28px 30px; }
.modal-subtitle { line-height: 1.65; font-size: 13px; margin-top: 9px; margin-bottom: 25px; }
.form-field { font-size: 13px; gap: 9px; color: #6b6862; }
.form-field input, .form-field select { min-height: 48px; border: 1px solid #ecebea; border-radius: 15px; padding: 12px 14px; background: #faf9f8; }
.form-field input:focus, .form-field select:focus { border-color: #cbbfa4; background: white; }
.form-grid { gap: 19px; }
.toast { border-radius: 22px; box-shadow: 0 7px 25px rgba(21, 17, 14, .12); }
.view.active { animation: ledger-arrive .38s var(--spring) both; }
.lending-pane.active { animation: ledger-arrive .3s var(--spring) both; }
@keyframes ledger-arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glass-surface-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 1100px) and (min-width: 701px) {
  .main-content { padding: 28px 24px 55px; }
  .sidebar { width: 200px; }
  .main-content { margin-left: 200px; width: calc(100% - 200px); }
  .transaction-panel { overflow-x: auto; }
  .transaction-panel .data-table { min-width: 680px; }
}

@media (max-width: 700px) {
  body { background: #ffffff; font-size: 15px; --host-footer-offset: 0px; }
  html { background: #ffffff; }
  .sidebar { display: none; }
  .main-content { margin: 0; width: 100%; padding: calc(17px + env(safe-area-inset-top)) 20px calc(196px + env(safe-area-inset-bottom)); }
  .topbar { position: relative; display: flex; align-items: center; justify-content: space-between; margin: 0 0 22px; padding: 22px 0 0; background: transparent; gap: 10px; }
  .topbar > div.header-identity { display: flex; gap: 12px; }
  .header-heading { gap: 5px; }
  .topbar h1 { font-size: 27px; font-weight: 700; line-height: 1.12; }
  .eyebrow { position: absolute; top: 0; right: 0; font-size: 11px; line-height: 1.3; color: #96928c; text-align: right; white-space: normal; }
  .topbar-actions { display: flex; }
  .topbar-actions #quickAction { display: none; }
  .topbar-actions .icon-button { width: 44px; height: 44px; min-height: 44px; box-shadow: 0 7px 26px rgba(46, 37, 30, .07); background: #faf9f7; }
  .mobile-top-nav.glass-dock { position: fixed; inset: auto auto max(14px, env(safe-area-inset-bottom)) 16px; z-index: 2147483002; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: calc(100% - 136px); max-width: 420px; height: 76px; margin: 0; padding: 6px; border: 1px solid rgba(255, 255, 255, .97); border-radius: 38px; background: rgba(249, 248, 246, .82); box-shadow: 0 8px 34px rgba(49, 40, 33, .14), inset 0 1px 2px #ffffff; backdrop-filter: blur(25px) saturate(1.6); -webkit-backdrop-filter: blur(25px) saturate(1.6); isolation: isolate; }
  .glass-dock .mobile-tab { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 60px; padding: 3px 0; border-radius: 30px; font-size: 10px; line-height: 1.2; color: #908c85; font-weight: 550; }
  .glass-dock .mobile-tab.active { color: #655344; font-weight: 650; }
  .glass-dock .mobile-tab.active::after { display: none; }
  .dock-icon { display: grid; place-items: center; height: 25px; }
  .dock-icon svg { width: 23px; height: 23px; stroke-width: 1.9; }
  .dock-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dock-indicator { position: absolute; z-index: 0; pointer-events: none; left: 6px; top: 6px; bottom: 6px; width: calc((100% - 12px) / 4); border-radius: 32px; background: rgba(255, 255, 255, .87); border: 1px solid rgba(255, 255, 255, .95); box-shadow: 0 3px 12px rgba(63, 52, 42, .055), inset 0 0 9px #ffffff; transition: transform .5s cubic-bezier(.22, 1.25, .36, 1), width .35s var(--spring); }
  .mobile-more-panel { position: fixed; inset: auto 20px calc(108px + env(safe-area-inset-bottom)) 20px; z-index: 2147483002; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 15px; border: 1px solid #ffffff; border-radius: 30px; background: rgba(252, 250, 249, .93); box-shadow: 0 15px 50px rgba(50, 41, 33, .14); backdrop-filter: blur(28px) saturate(1.3); -webkit-backdrop-filter: blur(28px) saturate(1.3); }
  .mobile-more-panel[hidden] { display: none; }
  .mobile-more-panel button { min-width: 0; min-height: 88px; background: rgba(255, 255, 255, .77); border-radius: 20px; padding: 12px 4px; }
  .mobile-more-panel span { color: #948157; margin: 0 auto 7px; display: grid; place-items: center; }
  .mobile-more-panel strong { font-size: 11px; font-weight: 550; overflow-wrap: anywhere; }
  .mobile-fab { left: 18px; right: auto; bottom: calc(104px + env(safe-area-inset-bottom)); min-height: 45px; padding: 0 17px; border-radius: 25px; color: #ffffff; background: #a28f65; box-shadow: 0 6px 20px rgba(109, 89, 73, .17), inset 0 1px rgba(255, 255, 255, .4); font-size: 13px; font-weight: 600; z-index: 2147483001; }
  .mobile-fab.detail-hidden { display: none; }
  .mobile-fab span { font-size: 22px; }
  #overviewView.active { display: flex; flex-direction: column; }
  #overviewView .hero-row { display: contents; }
  #overviewView > .section-head { order: 3; }
  #overviewView > .metric-grid { order: 4; }
  #overviewView > .lower-grid { order: 5; }
  .net-worth-panel { order: 0; border-radius: 0; box-shadow: none; background: transparent; min-height: 0; padding: 20px 0 0; text-align: center; }
  .net-worth-panel > .section-kicker { font-size: 14px; color: #3f3d3a; font-weight: 450; }
  .net-worth-main { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
  .net-worth-value { font-size: clamp(39px, 11.8vw, 56px); font-weight: 680; line-height: 1.16; letter-spacing: -1.6px; overflow-wrap: anywhere; }
  .snapshot-button { min-height: 34px; padding: 7px 14px; background: #f7f5f1; color: #8c7a52; font-size: 11px; font-weight: 550; }
  .change-row { margin: 13px auto 0; justify-content: center; gap: 5px 7px; row-gap: 7px; font-size: 11px; }
  .change-row > span:last-child { flex-basis: 100%; font-size: 11px; }
  .change-pill { font-size: 12px; padding: 2px 6px; background: transparent; }
  .change-rate { font-size: 12px; }
  .chart-wrap { display: none; }
  .side-insights { order: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .insight-panel { padding: 17px 15px; border-radius: 22px; min-height: 138px; background: #f8f7f6; box-shadow: none; }
  .insight-panel .section-kicker { font-size: 11px; font-weight: 500; color: #76726b; }
  .insight-panel strong { font-size: 24px; font-weight: 650; overflow-wrap: anywhere; margin: 13px 0 6px; }
  .insight-panel .muted { font-size: 10px; }
  .allocation-bar { height: 6px; margin: 15px 0 12px; }
  .legend-list { display: flex; flex-wrap: wrap; gap: 5px 9px; }
  .legend-item { font-size: 9px; gap: 4px; }
  .legend-item i { width: 5px; height: 5px; }
  .section-head { align-items: center; margin: 28px 0 16px; gap: 12px; }
  .section-head h2 { font-size: 20px; font-weight: 650; }
  .section-head .section-kicker { display: none; }
  .section-head .muted { max-width: none; font-size: 12px; line-height: 1.65; margin-top: 7px; }
  .section-head > .primary-button { min-height: 42px; font-size: 11px; padding: 9px 14px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { padding: 17px 15px; min-height: 112px; border-radius: 20px; }
  .metric-label { font-size: 11px; font-weight: 500; }
  .metric-card strong { margin: 8px 0 6px; font-size: 23px; font-weight: 650; }
  .metric-foot { font-size: 10px; }
  .lower-grid { display: flex; flex-direction: column; gap: 24px; margin-top: 29px; }
  .lower-grid > .table-panel { padding: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .activity-row { padding: 17px 0; min-height: 77px; border-top: 0; }
  .activity-name { font-size: 14px; font-weight: 500; line-height: 1.4; }
  .activity-amount { font-size: 15px; font-weight: 600; }
  .activity-date { font-size: 11px; margin-top: 5px; }
  .activity-main { gap: 12px; }
  .activity-icon { width: 39px; height: 39px; flex-basis: 39px; }
  .breakdown-row { border-top: 0; }
  .filter-row { gap: 13px; margin: 22px -3px 18px; }
  .segmented { width: 100%; padding: 4px; border-radius: 24px; }
  .segmented button { min-height: 41px; font-size: 12px; padding: 9px 14px; font-weight: 500; }
  .search-box { width: 100%; min-height: 46px; padding: 11px 15px; }
  .account-grid, .plan-grid { gap: 13px; }
  .account-card, .plan-card { padding: 21px; background: #f8f7f5; box-shadow: none; border-radius: 24px; }
  .account-name, .plan-name { font-size: 17px; font-weight: 600; }
  .account-category, .account-currency, .plan-caption { font-size: 11px; }
  .account-balance, .plan-remaining { font-size: 30px; font-weight: 650; }
  .account-actions { border-color: #ece9e5; }
  .account-actions button { min-height: 40px; font-size: 11px; }
  .plan-toolbar { padding: 14px; background: #f8f7f6; gap: 9px; border-radius: 19px; }
  .plan-month-summary { gap: 6px; }
  .plan-month-summary strong { font-size: 15px; }
  .table-panel.transaction-panel { padding: 0; border-radius: 0; background: transparent; }
  .data-row.transaction-row.header { display: none; }
  .data-row.transaction-row:not(.header) { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main amount" "date date" "meta actions"; min-height: 96px; gap: 5px 8px; margin: 0; padding: 19px 0; border: 0; border-bottom: 1px solid #c3ac79; border-radius: 0; box-shadow: none; background: transparent; }
  .transaction-row .data-main { display: flex; gap: 11px; grid-area: main; min-width: 0; align-self: start; }
  .transaction-row-icon { width: 34px; height: 34px; flex-basis: 34px; font-size: 18px; }
  .transaction-copy { min-width: 0; }
  .transaction-row .data-title { font-size: 14px; font-weight: 500; white-space: normal; overflow-wrap: anywhere; }
  .transaction-row .data-sub { font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
  .transaction-row .data-date { font-size: 11px; }
  .transaction-row .data-account { font-size: 10px; max-width: 100%; }
  .transaction-row .data-amount { align-self: start; font-size: 15px; padding-top: 1px; font-weight: 600; }
  .transaction-row .data-actions { gap: 8px; }
  .transaction-delete { min-width: 44px; height: 44px; min-height: 44px; font-size: 10px; padding: 0 9px; }
  .transaction-chevron { font-size: 20px; }
  .table-panel { padding: 17px; border-radius: 23px; background: #faf9f8; box-shadow: none; }
  .detail-toolbar { margin: 3px 0 22px; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; }
  .detail-toolbar h2 { font-size: 18px; font-weight: 600; }
  .detail-toolbar .primary-button { padding-inline: 13px; font-size: 11px; }
  .entity-detail-card, .transaction-detail-card { padding: 24px 18px; border-radius: 25px; background: #f9f8f6; box-shadow: none; }
  .entity-detail-hero { text-align: center; }
  .entity-detail-hero > strong { font-size: 32px; overflow-wrap: anywhere; }
  .entity-detail-hero h2 { font-size: 21px; font-weight: 600; }
  .entity-detail-metrics { grid-template-columns: 1fr; border-radius: 19px; }
  .entity-detail-metrics > div { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; background: #ffffff; }
  .entity-detail-metrics strong { margin: 0; font-size: 15px; }
  .related-section-head h2 { font-size: 17px; }
  .related-transaction-row { padding: 18px 0; }
  .related-transaction-amount { font-size: 14px; }
  .related-transaction-main strong { font-size: 14px; font-weight: 500; }
  .related-transaction-main small { font-size: 10px; }
  .detail-amount { font-size: 36px; }
  .detail-list > div { grid-template-columns: 86px minmax(0, 1fr); gap: 12px; }
  .detail-list dd { font-size: 13px; font-weight: 500; }
  .detail-actions button { font-size: 11px; }
  .receivable-summary, .analysis-summary { border-radius: 23px; background: #f8f6f4; box-shadow: none; }
  .receivable-summary { padding: 20px; }
  .receivable-summary strong { font-size: 26px; font-weight: 650; }
  #receivableTable .data-row:not(.header), #debtTable .data-row:not(.header) { padding: 18px 0; background: transparent; border: 0; border-bottom: 1px solid #eeedea; border-radius: 0; box-shadow: none; }
  .analysis-summary { grid-template-columns: 1fr; }
  .analysis-summary > div { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 17px 19px; border-color: #eeebe7; }
  .analysis-summary strong { margin: 0; font-size: 19px; font-weight: 600; }
  .analysis-list { padding: 0; background: transparent; border-radius: 0; box-shadow: none; }
  .analysis-row { padding: 20px 0; }
  .analysis-date strong, .analysis-value strong { font-size: 13px; font-weight: 550; }
  .analysis-date span, .analysis-value span { font-size: 10px; }
  .section-actions { gap: 9px; }
  #analysisView > .section-head { flex-wrap: wrap; }
  .section-actions button { min-height: 43px; font-size: 11px; }
  .settings-panel, .transfer-panel, .profile-onboarding, .profile-card { padding: 22px 18px; border-radius: 25px; background: #f9f8f6; box-shadow: none; }
  .settings-panel .section-head { margin-top: 0; }
  .transfer-panel h2 { font-size: 20px; }
  .transfer-panel .muted { font-size: 12px; }
  .transfer-panel > button { justify-self: stretch; }
  .profile-avatar { width: 65px; height: 65px; flex-basis: 65px; }
  .profile-identity h2 { font-size: 22px; font-weight: 650; }
  .restore-undo-row { background: #f8f7f5; border: 0; padding: 19px; border-radius: 23px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal, .modal.bill-import-modal { width: 100%; max-height: calc(92dvh - env(safe-area-inset-top)); border-radius: 32px 32px 0 0; padding: 0; box-shadow: 0 -15px 75px rgba(41, 34, 27, .15); }
  .modal-toolbar { padding: 13px 16px; min-height: 72px; border-radius: 32px 32px 0 0; }
  .modal-confirm { min-height: 44px; }
  #modalContent { padding: 25px 22px calc(28px + env(safe-area-inset-bottom)); }
  .modal h2 { font-size: 24px; }
  .modal-subtitle { font-size: 12px; }
  .form-grid { gap: 19px; }
  .form-field { font-size: 12px; }
  .form-field input, .form-field select { min-height: 50px; font-size: 16px; border-radius: 16px; }
  .form-actions { margin-top: 23px; }
  .bill-import-table-wrap { border-radius: 17px; }
  .toast { left: 20px; right: 20px; bottom: calc(169px + env(safe-area-inset-bottom)); text-align: left; padding: 14px 18px; border-radius: 24px; z-index: 2147483004; }
}

@media (max-width: 360px) {
  .main-content { padding-inline: 16px; }
  .topbar { margin-inline: 0; padding-inline: 0; }
  .topbar h1 { font-size: 25px; }
  .header-identity { gap: 9px; }
  .net-worth-value { font-size: 39px; }
  .insight-panel { padding: 16px 12px; }
  .metric-card strong { font-size: 20px; }
  .glass-dock .mobile-tab { font-size: 9px; }
  .mobile-more-panel { left: 16px; right: 16px; padding: 11px; gap: 7px; }
  .data-row.transaction-row:not(.header) { column-gap: 6px; }
  .transaction-row .data-amount { font-size: 13px; }
  .transaction-row .data-title { font-size: 13px; }
  .transaction-row-icon { width: 28px; height: 28px; flex-basis: 28px; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mobile-top-nav.glass-dock, .mobile-more-panel, .modal-toolbar { background: #fcfbf9; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Center navigation, card amounts and circular controls. */
.icon-button { padding: 0; flex-shrink: 0; }
.icon-button svg { width: 24px; height: 24px; }
.modal-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; line-height: 1; flex-shrink: 0; }
.insight-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.insight-panel strong { width: 100%; }
.overview-plan-balances { width: 100%; }
.allocation-panel .section-head { margin-top: 0; }
.allocation-chart { position: relative; width: min(220px, 100%); margin: 8px auto 24px; }
.allocation-chart svg { width: 100%; height: auto; fill: none; stroke: none; }
.allocation-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.allocation-legend { display: grid; gap: 15px; }
.allocation-legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 9px; align-items: center; font-size: 12px; }
.allocation-swatch { width: 9px; height: 9px; border-radius: 50%; }
.allocation-name { overflow-wrap: anywhere; }
.allocation-percent { color: var(--muted); font-variant-numeric: tabular-nums; }
.allocation-legend-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.allocation-note { margin: 16px 0 0; font-size: 11px; }
@media (max-width: 700px) {
  .mobile-top-nav.glass-dock { left: 50%; right: auto; transform: translateX(-50%); }
  .mobile-fab { left: 50%; right: auto; transform: translateX(-50%); }
  .mobile-fab:active { transform: translateX(-50%) scale(.96); }
  .insight-panel { min-width: 0; }
}

/* Improve label readability and group the two net worth comparisons. */
:root { --muted: #6f6b65; }
body { font-weight: 500; }
h2, .section-head h2 { font-weight: 700; }
.section-kicker { font-size: 13px; font-weight: 650; }
.net-worth-panel > .section-kicker { font-size: 20px; font-weight: 750; color: #383633; }
.net-worth-value { font-weight: 750; }
.insight-panel .section-kicker, .metric-label { font-size: 14px; font-weight: 650; color: #5c5955; }
.insight-panel strong, .metric-card strong { font-weight: 750; }
.snapshot-button { font-size: 12px; font-weight: 650; }
.nav-item { font-weight: 600; }
.nav-item.active { font-weight: 700; }
.primary-button, .secondary-button, .ghost-button { font-weight: 650; }
.account-name, .plan-name, .activity-name, .data-title { font-weight: 650; }
.form-field { font-size: 14px; font-weight: 600; }
.metric-foot, .activity-date, .account-category, .account-currency, .plan-caption { font-size: 12px; font-weight: 550; }
.allocation-legend-row { font-size: 13px; font-weight: 600; }
.allocation-legend-row strong { font-weight: 700; }
.change-comparison { display: grid; grid-template-rows: 1fr 1fr; align-items: stretch; justify-content: stretch; padding: 0 24px; min-height: 270px; }
.comparison-block { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; padding: 20px 0; gap: 8px; }
.comparison-block + .comparison-block { border-top: 1px solid #e7e6e4; }
.comparison-block .section-kicker { line-height: 1.45; }
.change-comparison .comparison-value { display: block; margin: 0; padding: 0; background: transparent; line-height: 1.25; }
.change-comparison .comparison-value.amount-placeholder { font-size: 18px; line-height: 1.4; }
.comparison-block .change-rate { font-size: 13px; font-weight: 650; }
.comparison-block .change-rate[hidden] { display: none; }
.screen-reader-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .net-worth-panel > .section-kicker { font-size: 18px; font-weight: 750; }
  .insight-panel .section-kicker, .metric-label { font-size: 13px; font-weight: 650; }
  .glass-dock .mobile-tab { font-weight: 650; }
  .glass-dock .mobile-tab.active { font-weight: 750; }
  .change-comparison { min-height: 250px; padding: 0 12px; }
  .comparison-block { padding: 17px 0; gap: 8px; }
  .comparison-block .section-kicker { max-width: 100%; text-wrap: balance; }
  .change-comparison .comparison-value { font-size: 24px; }
  .change-comparison .comparison-value.amount-placeholder { font-size: 17px; }
  .overview-plan-balances button { font-size: 12px; font-weight: 600; }
}
