:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  color: #18221c;
  background: #f3f6f3;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f3f6f3; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
  justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(243,246,243,.94); backdrop-filter: blur(16px); border-bottom: 1px solid #dce5dd;
}
.eyebrow { margin: 0 0 3px; font-size: .68rem; letter-spacing: .13em; font-weight: 800; color: #4f6656; }
h1, h2, h3, p { margin-top: 0; }
.topbar h1 { margin: 0; font-size: 1.3rem; }
.icon-button { border: 0; background: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 1.3rem; box-shadow: 0 2px 9px rgba(0,0,0,.08); }
.app-shell { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(34px + env(safe-area-inset-bottom)); }
.balance-hero { padding: 23px; border-radius: 24px; color: white; background: linear-gradient(145deg,#146a38,#238c4f); box-shadow: 0 12px 30px rgba(20,106,56,.22); }
.balance-hero p { margin: 0; opacity: .8; }
.balance-hero > strong { display: block; margin: 4px 0 20px; font-size: 2.75rem; letter-spacing: -.04em; }
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.balance-grid div { padding: 12px 14px; border-radius: 15px; background: rgba(255,255,255,.14); }
.balance-grid span, .summary-strip span { display: block; font-size: .76rem; opacity: .8; }
.balance-grid b { font-size: 1.15rem; }
.quick-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px 0; }
.quick-actions button { min-height: 82px; padding: 10px 6px; border: 1px solid #d9e4da; border-radius: 18px; background: white; font-weight: 700; color: #1b4128; }
.quick-actions span { display: block; font-size: 1.7rem; line-height: 1.1; color: #17713d; }
.summary-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-strip div { padding: 14px 16px; background: white; border-radius: 16px; border: 1px solid #dfe7df; }
.summary-strip span { color: #607066; }
.summary-strip strong { font-size: 1.05rem; }
.activity-section { margin-top: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; }
.section-heading h2 { margin: 0; }
.text-button { border: 0; background: none; color: #17713d; font-weight: 700; }
.activity-list { display: grid; gap: 9px; margin-top: 12px; }
.activity-row { width: 100%; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 13px; border: 1px solid #e0e7e0; border-radius: 16px; background: white; color: inherit; }
.activity-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: #e8f4eb; font-size: 1.2rem; }
.activity-copy { min-width: 0; }
.activity-copy strong, .activity-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.activity-copy small { margin-top: 3px; color: #68756c; }
.activity-amount { font-weight: 800; }
.amount-negative { color: #a33131; }
.amount-transfer { color: #496258; }
.empty-state { padding: 30px; text-align: center; color: #718078; }
.setup-card { max-width: 560px; margin: 30px auto; padding: 26px 20px; }
.setup-card form, dialog form { display: grid; gap: 15px; }
label { display: grid; gap: 6px; font-size: .86rem; font-weight: 700; color: #3f5045; }
input, select, textarea { width: 100%; border: 1px solid #cfdacf; border-radius: 12px; padding: 12px; background: white; color: #17231b; }
textarea { resize: vertical; }
.primary, .secondary, .danger, .file-button { border-radius: 12px; padding: 12px 15px; font-weight: 800; text-align: center; }
.primary { border: 0; background: #17713d; color: white; }
.secondary, .file-button { border: 1px solid #ccd8ce; background: white; color: #264332; }
.danger { border: 1px solid #e7bcbc; background: #fff5f5; color: #a12a2a; }
.wide { width: 100%; }
dialog { width: min(640px, calc(100% - 20px)); max-height: calc(100vh - 20px); overflow: auto; border: 0; border-radius: 22px; padding: 20px; box-shadow: 0 25px 80px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(15,24,18,.45); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }
.receipt-upload input, .file-button input { position: absolute; opacity: 0; pointer-events: none; }
.receipt-upload span { display: block; padding: 13px; border: 1px dashed #9eb5a3; border-radius: 12px; background: #f5faf6; text-align: center; }
.receipt-preview { width: 100%; max-height: 300px; object-fit: contain; border-radius: 12px; background: #eef2ee; }
.help-text { margin: -8px 0 0; color: #6b786f; font-size: .78rem; }
.settings-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.install-help { padding: 14px; border-radius: 14px; background: #eef7f0; }
.install-help h3 { margin-bottom: 5px; }
.install-help p { margin: 0; font-size: .86rem; line-height: 1.45; }
@media (max-width: 430px) {
  .balance-hero > strong { font-size: 2.3rem; }
  .quick-actions button { font-size: .78rem; }
  .dialog-actions { display: grid; grid-template-columns: repeat(3,1fr); }
  .settings-buttons { grid-template-columns: 1fr; }
}
