:root{
  --bg:#f4f6f8;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --ink:#101828;
  --muted:#667085;
  --line:#e4e7ec;
  --primary:#111827;
  --primary-2:#20293a;
  --green:#087f5b;
  --green-soft:#e9f8f1;
  --red:#d64545;
  --red-soft:#fff0f0;
  --amber:#b86b08;
  --amber-soft:#fff5e5;
  --blue:#3157d5;
  --blue-soft:#eef2ff;
  --shadow-sm:0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.06);
  --shadow-md:0 14px 34px rgba(16,24,40,.10);
  --safe-bottom:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{background:var(--bg);scroll-behavior:smooth}
body{margin:0;min-height:100%;background:var(--bg);color:var(--ink);font-family:"Noto Sans Arabic","Segoe UI",Tahoma,Arial,sans-serif;font-size:14px}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
button,select{-webkit-appearance:none;appearance:none}
svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.app-shell{position:relative;max-width:640px;min-height:100dvh;margin:0 auto;background:var(--bg)}
.app-header{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;padding:calc(14px + env(safe-area-inset-top,0px)) 18px 12px;background:rgba(244,246,248,.92);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
.brand-row{display:flex;align-items:center;gap:10px}
.brand-mark{width:42px;height:42px;border-radius:14px;background:var(--primary);color:#fff;display:grid;place-items:center;box-shadow:0 8px 18px rgba(17,24,39,.18)}
.brand-mark svg{width:23px;height:23px}
.brand-copy{display:grid;gap:1px}
.brand-copy span{font-weight:900;font-size:16px;letter-spacing:-.2px}
.brand-copy small{color:var(--muted);font-size:10.5px}
.header-action,.page-add,.close-circle{border:1px solid var(--line);background:var(--surface);color:var(--ink);display:grid;place-items:center}
.header-action{width:42px;height:42px;border-radius:14px;box-shadow:var(--shadow-sm)}
.header-action svg{width:21px}
.content{padding:4px 16px calc(110px + var(--safe-bottom))}
.screen{display:none}
.screen.active{display:block;animation:screenIn .2s ease}
@keyframes screenIn{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
.home-heading,.page-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin:7px 2px 16px}
.home-heading p,.page-heading p{margin:0 0 3px;color:var(--muted);font-size:12px}
.home-heading h1,.page-heading h1{margin:0;font-size:25px;line-height:1.3;letter-spacing:-.6px}
.save-pill{display:flex;align-items:center;gap:6px;border:1px solid #d8e9e2;background:#f3fbf7;color:#17684f;border-radius:999px;padding:7px 9px;font-size:10px;font-weight:800;white-space:nowrap}
.save-pill i{display:block;width:7px;height:7px;border-radius:50%;background:#1a9b70;box-shadow:0 0 0 3px rgba(26,155,112,.10)}
.save-pill.saving i{animation:pulse .75s ease infinite}
@keyframes pulse{50%{opacity:.35;transform:scale(.8)}}
.today-card{overflow:hidden;border-radius:24px;background:var(--primary);color:#fff;box-shadow:0 18px 40px rgba(17,24,39,.18)}
.today-card__top{padding:22px 20px 20px;display:flex;align-items:center;justify-content:space-between;gap:14px}
.today-card__top span{display:block;color:#bfc7d5;font-size:12px;margin-bottom:7px}
.today-card__top strong{display:block;font-size:28px;line-height:1.2;letter-spacing:-.4px;max-width:230px;overflow-wrap:anywhere}
.compact-add{border:0;background:#fff;color:var(--ink);border-radius:14px;padding:11px 13px;font-size:11px;font-weight:900;display:flex;align-items:center;gap:6px;white-space:nowrap}
.compact-add svg{width:17px;height:17px;stroke-width:2.2}
.today-card__bottom{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:9px;padding:13px 20px;background:rgba(255,255,255,.07);border-top:1px solid rgba(255,255,255,.08)}
.today-card__bottom span{font-size:11px;color:#cdd3dd}
.today-card__bottom b{text-align:left;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.today-card__bottom small{font-size:9px;color:#aeb7c6;border-right:1px solid rgba(255,255,255,.14);padding-right:9px}
.section-title{display:flex;align-items:center;justify-content:space-between;margin:24px 2px 11px}
.section-title div{display:grid;gap:2px}
.section-title span{font-size:16px;font-weight:900}
.section-title small{font-size:10px;color:var(--muted)}
.recent-title{margin-top:26px}
.account-list{display:grid;gap:10px}
.account-card{position:relative;width:100%;border:1px solid var(--line);background:var(--surface);border-radius:19px;padding:14px;display:grid;grid-template-columns:46px minmax(0,1fr) auto 18px;align-items:center;gap:11px;text-align:right;color:var(--ink);box-shadow:var(--shadow-sm)}
.account-icon{width:46px;height:46px;border-radius:15px;display:grid;place-items:center}
.account-icon svg{width:22px;height:22px}
.account-card.debt .account-icon{background:var(--amber-soft);color:var(--amber)}
.account-card.receive .account-icon{background:var(--green-soft);color:var(--green)}
.account-copy{min-width:0;display:grid;gap:3px}
.account-copy b{font-size:13px}
.account-copy small{color:var(--muted);font-size:10px}
.account-card>strong{font-size:14px;white-space:nowrap;max-width:140px;overflow:hidden;text-overflow:ellipsis}
.chevron{width:17px;height:17px;color:#98a2b3}
.page-heading{align-items:center;margin-top:9px}
.page-add{width:44px;height:44px;border-radius:14px;background:var(--primary);color:#fff;border-color:var(--primary);box-shadow:0 9px 18px rgba(17,24,39,.15)}
.page-add svg{width:20px;height:20px;stroke-width:2.2}
.screen-summary{position:relative;overflow:hidden;border-radius:22px;padding:20px;margin-bottom:12px;border:1px solid transparent}
.screen-summary::after{content:"";position:absolute;left:-24px;bottom:-36px;width:110px;height:110px;border-radius:50%;background:currentColor;opacity:.055}
.screen-summary span{display:block;font-size:11px;opacity:.8;margin-bottom:7px}
.screen-summary strong{display:block;font-size:27px;line-height:1.25;letter-spacing:-.4px;overflow-wrap:anywhere}
.screen-summary small{display:block;font-size:10px;margin-top:7px;opacity:.7}
.expense-tone{background:#fff1f1;color:#9d2f2f;border-color:#f9dcdc}
.debt-tone{background:#fff7e9;color:#8e570f;border-color:#f5e5c8}
.receive-tone{background:#ebf9f3;color:#096b4d;border-color:#d4eee4}
.search-box{height:50px;border:1px solid var(--line);background:var(--surface);border-radius:15px;display:flex;align-items:center;gap:10px;padding:0 14px;margin:12px 0 10px;box-shadow:var(--shadow-sm)}
.search-box svg{width:19px;height:19px;color:#98a2b3}
.search-box input{width:100%;border:0;outline:0;background:transparent;color:var(--ink);min-width:0}
.search-box input::placeholder{color:#98a2b3}
.filter-row{display:flex;gap:6px;margin-bottom:12px;padding:4px;border-radius:13px;background:#eaecf0}
.filter-row button{flex:1;border:0;border-radius:10px;background:transparent;color:#667085;padding:8px 7px;font-size:10.5px;font-weight:800}
.filter-row button.active{background:#fff;color:var(--ink);box-shadow:0 1px 3px rgba(16,24,40,.10)}
.list{display:grid;gap:10px}
.entry-card{border:1px solid var(--line);background:var(--surface);border-radius:19px;padding:14px;box-shadow:var(--shadow-sm)}
.entry-top{display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:11px;align-items:start}
.entry-icon{width:42px;height:42px;border-radius:13px;display:grid;place-items:center}
.entry-icon svg{width:20px;height:20px}
.entry-main{min-width:0}
.entry-main h3{font-size:13px;margin:1px 0 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.entry-main p{margin:0;color:var(--muted);font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.entry-amount{text-align:left;white-space:nowrap;min-width:86px}
.entry-amount strong{display:block;font-size:13px}
.entry-amount small{display:block;color:var(--muted);font-size:9px;margin-top:4px}
.expense-card .entry-icon{background:var(--red-soft);color:var(--red)}
.debt-card .entry-icon{background:var(--amber-soft);color:var(--amber)}
.receive-card .entry-icon{background:var(--green-soft);color:var(--green)}
.progress{height:5px;background:#eef0f3;border-radius:99px;overflow:hidden;margin-top:12px}
.progress span{display:block;height:100%;background:var(--green);border-radius:99px;transition:width .2s ease}
.entry-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid #f0f1f3;margin-top:12px;padding-top:10px}
.status{font-size:9.5px;font-weight:900;padding:6px 8px;border-radius:999px;white-space:nowrap}
.status.open{background:var(--red-soft);color:var(--red)}
.status.partial{background:var(--amber-soft);color:#94590b}
.status.paid{background:var(--green-soft);color:var(--green)}
.status.neutral{background:#f2f4f7;color:#667085}
.card-actions{display:flex;align-items:center;gap:5px;overflow:auto;scrollbar-width:none}
.card-actions::-webkit-scrollbar{display:none}
.card-actions button{border:0;background:#f2f4f7;color:#475467;padding:7px 9px;border-radius:9px;font-size:9.5px;font-weight:800;white-space:nowrap}
.card-actions .done{background:var(--green-soft);color:var(--green)}
.card-actions .whatsapp{background:#eafaf0;color:#0b874a}
.card-actions .delete{width:30px;padding:7px;color:#b42318;background:#fff1f0}
.card-actions .delete svg{width:15px;height:15px}
.empty-card{background:var(--surface);border:1px dashed #cfd4dc;border-radius:19px;padding:34px 18px;text-align:center;color:var(--muted);font-size:11px}
.empty-icon{width:48px;height:48px;margin:0 auto 10px;border-radius:15px;background:#f2f4f7;color:#98a2b3;display:grid;place-items:center}
.empty-icon svg{width:22px;height:22px}
.empty-card b{display:block;color:var(--ink);font-size:13px;margin-bottom:5px}
.fab{position:fixed;z-index:30;left:50%;transform:translateX(-50%);bottom:calc(34px + var(--safe-bottom));width:60px;height:60px;border-radius:20px;border:6px solid var(--bg);background:var(--primary);color:#fff;display:grid;place-items:center;box-shadow:0 13px 25px rgba(17,24,39,.30)}
.fab svg{width:25px;height:25px;stroke-width:2.2}
.bottom-nav{position:fixed;z-index:25;left:50%;bottom:0;transform:translateX(-50%);width:min(640px,100%);height:calc(72px + var(--safe-bottom));padding:7px 8px var(--safe-bottom);display:grid;grid-template-columns:1fr 1fr 66px 1fr 1fr;align-items:center;background:rgba(255,255,255,.97);border-top:1px solid var(--line);box-shadow:0 -10px 30px rgba(16,24,40,.06);backdrop-filter:blur(18px)}
.bottom-nav button{border:0;background:transparent;color:#98a2b3;border-radius:13px;padding:4px 2px;display:grid;justify-items:center;gap:2px}
.bottom-nav svg{width:20px;height:20px}
.bottom-nav b{font-size:9px;font-weight:800}
.bottom-nav button.active{color:var(--ink)}
.bottom-nav button.active::after{content:"";width:16px;height:3px;border-radius:999px;background:var(--ink);margin-top:1px}
.nav-spacer{display:block}
.sheet{border:0;padding:0;margin:auto 0 0;width:100%;max-width:640px;border-radius:28px 28px 0 0;background:var(--surface);color:var(--ink);max-height:94dvh;overflow:auto;box-shadow:0 -22px 60px rgba(16,24,40,.20)}
.sheet::backdrop{background:rgba(16,24,40,.58);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
.sheet[open]{animation:sheetUp .24s cubic-bezier(.22,.8,.3,1)}
@keyframes sheetUp{from{transform:translateY(30%);opacity:.4}to{transform:none;opacity:1}}
.sheet-handle{width:46px;height:5px;border-radius:99px;background:#d0d5dd;margin:9px auto 4px}
.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 18px 11px}
.sheet-head small{display:block;color:var(--muted);font-size:10px;margin-bottom:2px}
.sheet-head h2{margin:0;font-size:20px;line-height:1.35;letter-spacing:-.3px}
.close-circle{width:39px;height:39px;border-radius:13px;background:#f2f4f7}
.close-circle svg{width:19px;height:19px}
.entry-title-wrap{display:flex;align-items:center;gap:11px}
.form-icon{width:42px;height:42px;border-radius:14px;display:grid;place-items:center}
.form-icon svg{width:21px;height:21px}
.form-icon.expense{background:var(--red-soft);color:var(--red)}
.form-icon.debt{background:var(--amber-soft);color:var(--amber)}
.form-icon.receive{background:var(--green-soft);color:var(--green)}
.form-fields{padding:5px 18px 15px;display:grid;gap:14px}
.field{display:grid;gap:7px}
.field>span,.field-label{font-size:11px;font-weight:800;color:#344054}
.field-note{font-size:9.5px;color:#98a2b3;font-weight:500;margin-right:4px}
.field input,.field select,.field textarea{width:100%;border:1px solid #dfe3e8;border-radius:14px;padding:13px 14px;background:#f9fafb;color:var(--ink);outline:0;transition:.16s}
.field input,.field select{height:50px}
.field textarea{min-height:82px;resize:none;line-height:1.7}
.field input:focus,.field select:focus,.field textarea:focus{border-color:#77839a;background:#fff;box-shadow:0 0 0 3px rgba(71,84,103,.08)}
.field input::placeholder,.field textarea::placeholder{color:#98a2b3}
.amount-control{display:grid;grid-template-columns:minmax(0,1fr) 118px;border:1px solid #dfe3e8;border-radius:15px;overflow:hidden;background:#f9fafb;transition:.16s}
.amount-control:focus-within{border-color:#77839a;background:#fff;box-shadow:0 0 0 3px rgba(71,84,103,.08)}
.amount-control input,.amount-control select{border:0;border-radius:0;background:transparent;box-shadow:none!important}
.amount-control select{border-right:1px solid #e4e7ec;padding-left:30px;background-image:linear-gradient(45deg,transparent 50%,#667085 50%),linear-gradient(135deg,#667085 50%,transparent 50%);background-position:16px 21px,11px 21px;background-size:5px 5px,5px 5px;background-repeat:no-repeat}
.date-choice{border:0;padding:0;margin:0;display:grid;gap:8px}
.date-choice legend{padding:0;margin-bottom:7px;font-size:11px;font-weight:800;color:#344054}
.choice-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.choice-card{position:relative;cursor:pointer}
.choice-card input{position:absolute;opacity:0;pointer-events:none}
.choice-card span{height:48px;border:1px solid #dfe3e8;border-radius:14px;background:#f9fafb;display:flex;align-items:center;justify-content:center;gap:7px;color:#667085;font-size:11px;font-weight:800;transition:.16s}
.choice-card span::before{content:"";width:9px;height:9px;border-radius:50%;border:2px solid #c4c9d1;box-shadow:inset 0 0 0 2px #f9fafb}
.choice-card input:checked+span{border-color:#1d2939;background:#f2f4f7;color:#1d2939}
.choice-card input:checked+span::before{border-color:#1d2939;background:#1d2939}
.due-date-wrap{display:none;margin-top:2px}
.due-date-wrap.visible{display:block;animation:fieldIn .15s ease}
@keyframes fieldIn{from{opacity:.3;transform:translateY(-3px)}}
.optional-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.sheet-actions{position:sticky;bottom:0;z-index:3;background:rgba(255,255,255,.97);border-top:1px solid var(--line);padding:12px 18px calc(12px + var(--safe-bottom));display:grid;grid-template-columns:.72fr 1.5fr;gap:9px;backdrop-filter:blur(14px)}
.primary-btn,.secondary-btn{height:50px;border:0;border-radius:14px;font-weight:900}
.primary-btn{background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;gap:8px;box-shadow:0 8px 18px rgba(17,24,39,.16)}
.primary-btn svg{width:18px;height:18px;stroke-width:2.2}
.secondary-btn{background:#f2f4f7;color:#475467}
.compact-sheet,.settings-sheet{padding-bottom:calc(14px + var(--safe-bottom))}
.quick-actions{padding:4px 16px 10px;display:grid;gap:9px}
.quick-actions>button{width:100%;border:1px solid var(--line);background:#fff;border-radius:17px;padding:12px;display:grid;grid-template-columns:44px minmax(0,1fr) 18px;align-items:center;gap:11px;text-align:right;color:var(--ink);box-shadow:var(--shadow-sm)}
.quick-actions>button>span{width:44px;height:44px;border-radius:14px;display:grid;place-items:center}
.quick-actions>button>span svg{width:20px;height:20px}
.quick-actions .quick-expense>span{background:var(--red-soft);color:var(--red)}
.quick-actions .quick-debt>span{background:var(--amber-soft);color:var(--amber)}
.quick-actions .quick-receive>span{background:var(--green-soft);color:var(--green)}
.quick-actions div{display:grid;gap:3px}
.quick-actions b{font-size:12.5px}
.quick-actions small{font-size:9.5px;color:var(--muted)}
.quick-arrow{width:17px;height:17px;color:#98a2b3}
.storage-card{margin:4px 16px 12px;padding:14px;border:1px solid #d7ebe3;background:#f3fbf7;border-radius:18px;display:flex;gap:11px;align-items:flex-start}
.storage-card__icon{width:42px;height:42px;flex:0 0 auto;border-radius:13px;background:#dff4ea;color:#087f5b;display:grid;place-items:center}
.storage-card__icon svg{width:21px;height:21px}
.storage-card b{display:block;font-size:12px;margin-bottom:4px}
.storage-card p{margin:0;color:#547166;font-size:9.8px;line-height:1.7}
.storage-card span{display:inline-block;margin-top:7px;color:#17684f;background:#e4f5ed;border-radius:999px;padding:4px 7px;font-size:8.5px;direction:ltr}
.settings-list{padding:0 16px;display:grid;gap:8px}
.settings-list button{width:100%;border:1px solid var(--line);background:#fff;border-radius:16px;padding:11px;display:grid;grid-template-columns:42px minmax(0,1fr) 18px;align-items:center;gap:11px;text-align:right;color:var(--ink);box-shadow:var(--shadow-sm)}
.settings-icon{width:42px;height:42px;border-radius:13px;background:#f2f4f7;color:#475467;display:grid;place-items:center}
.settings-icon svg{width:20px;height:20px}
.settings-list div{display:grid;gap:3px}
.settings-list b{font-size:12px}
.settings-list small{font-size:9.5px;color:var(--muted)}
.settings-arrow{width:17px;height:17px;color:#98a2b3}
.settings-list .danger-item{color:#b42318}
.settings-list .danger-item .settings-icon{background:#fff1f0;color:#b42318}
.connection-note{text-align:center;color:var(--muted);font-size:9.5px;margin:12px 18px 2px}
.toast{position:fixed;z-index:100;left:50%;bottom:calc(96px + var(--safe-bottom));transform:translate(-50%,18px);background:#111827;color:#fff;border-radius:13px;padding:11px 15px;font-size:11px;font-weight:700;opacity:0;pointer-events:none;transition:.2s;white-space:nowrap;box-shadow:var(--shadow-md)}
.toast.show{opacity:1;transform:translate(-50%,0)}
@media(max-width:390px){
  .content{padding-left:13px;padding-right:13px}
  .app-header{padding-left:15px;padding-right:15px}
  .home-heading h1,.page-heading h1{font-size:23px}
  .save-pill span{display:none}
  .save-pill{padding:8px}
  .today-card__top{padding:20px 16px 18px}
  .today-card__bottom{padding:12px 16px}
  .today-card__top strong{font-size:24px}
  .account-card{grid-template-columns:43px minmax(0,1fr) auto 15px;padding:12px;gap:9px}
  .account-icon{width:43px;height:43px}
  .account-card>strong{max-width:105px;font-size:12px}
  .optional-row{grid-template-columns:1fr}
}
@media(min-width:641px){
  body{padding:20px 0}
  .app-shell{min-height:calc(100dvh - 40px);border-radius:28px;overflow:hidden;box-shadow:0 24px 70px rgba(16,24,40,.12)}
  .bottom-nav{bottom:20px;border-radius:0 0 28px 28px}
  .fab{bottom:54px}
  .sheet{left:50%;bottom:20px;width:560px;margin:auto;border-radius:28px;max-height:90dvh;transform:translateX(-50%)}
  .sheet[open]{animation:desktopSheet .2s ease}
  @keyframes desktopSheet{from{opacity:0;transform:translate(-50%,18px) scale(.98)}to{opacity:1;transform:translate(-50%,0) scale(1)}}
  .entry-sheet{width:540px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}

/* v4 — dark mode, app lock, and mobile polish */
html{color-scheme:light}
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#070b12;
  --surface:#101722;
  --surface-2:#151e2b;
  --ink:#f3f6fb;
  --muted:#94a3b8;
  --line:#243041;
  --primary:#e9eef7;
  --primary-2:#d8e0ec;
  --green:#49d5a3;
  --green-soft:#102d27;
  --red:#ff8585;
  --red-soft:#321c22;
  --amber:#f2b95f;
  --amber-soft:#302719;
  --blue:#8ba6ff;
  --blue-soft:#17213a;
  --shadow-sm:0 1px 2px rgba(0,0,0,.24),0 7px 18px rgba(0,0,0,.14);
  --shadow-md:0 18px 45px rgba(0,0,0,.38);
}
.header-actions{display:flex;align-items:center;gap:8px}
#themeBtn svg{width:20px;height:20px}
html[data-theme="dark"] .app-header{background:rgba(7,11,18,.88)}
html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .page-add,
html[data-theme="dark"] .fab,
html[data-theme="dark"] .primary-btn{background:#e9eef7;color:#0a0f18;border-color:#e9eef7}
html[data-theme="dark"] .today-card{background:linear-gradient(145deg,#172131,#0c121c);box-shadow:0 22px 55px rgba(0,0,0,.38);border:1px solid #263448}
html[data-theme="dark"] .compact-add{background:#e9eef7;color:#0a0f18}
html[data-theme="dark"] .today-card__top span,
html[data-theme="dark"] .today-card__bottom span{color:#aebbd0}
html[data-theme="dark"] .today-card__bottom small{color:#8492a8}
html[data-theme="dark"] .save-pill{background:#102d27;border-color:#1d4d42;color:#78e0bc}
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .entry-card,
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .quick-actions>button,
html[data-theme="dark"] .settings-list button,
html[data-theme="dark"] .empty-card{background:var(--surface)}
html[data-theme="dark"] .filter-row{background:#121a26}
html[data-theme="dark"] .filter-row button{color:#8492a8}
html[data-theme="dark"] .filter-row button.active{background:#253044;color:#f5f7fb;box-shadow:none}
html[data-theme="dark"] .expense-tone{background:#2a171c;color:#ff9b9b;border-color:#4a252c}
html[data-theme="dark"] .debt-tone{background:#2b2316;color:#f7c978;border-color:#4a3a20}
html[data-theme="dark"] .receive-tone{background:#112922;color:#6ee1b7;border-color:#1e473b}
html[data-theme="dark"] .progress{background:#202a38}
html[data-theme="dark"] .entry-footer{border-top-color:#202a38}
html[data-theme="dark"] .status.neutral,
html[data-theme="dark"] .card-actions button,
html[data-theme="dark"] .secondary-btn,
html[data-theme="dark"] .close-circle,
html[data-theme="dark"] .settings-icon,
html[data-theme="dark"] .empty-icon{background:#1a2432;color:#a8b4c6}
html[data-theme="dark"] .card-actions .delete{background:#321c22;color:#ff8585}
html[data-theme="dark"] .card-actions .done{background:var(--green-soft);color:var(--green)}
html[data-theme="dark"] .card-actions .whatsapp{background:#123024;color:#68dfa6}
html[data-theme="dark"] .bottom-nav{background:rgba(13,19,29,.96);border-top-color:#263244;box-shadow:0 -12px 30px rgba(0,0,0,.25)}
html[data-theme="dark"] .bottom-nav button{color:#6f7f94}
html[data-theme="dark"] .bottom-nav button.active{color:#f1f5fb}
html[data-theme="dark"] .bottom-nav button.active::after{background:#f1f5fb}
html[data-theme="dark"] .sheet{background:#0e1520;box-shadow:0 -24px 65px rgba(0,0,0,.55)}
html[data-theme="dark"] .sheet::backdrop{background:rgba(0,0,0,.72)}
html[data-theme="dark"] .sheet-handle{background:#3b4758}
html[data-theme="dark"] .field>span,
html[data-theme="dark"] .field-label,
html[data-theme="dark"] .date-choice legend{color:#d9e1ec}
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .amount-control,
html[data-theme="dark"] .choice-card span{background:#141d29;border-color:#2b3748;color:#edf2f8}
html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .field select:focus,
html[data-theme="dark"] .field textarea:focus,
html[data-theme="dark"] .amount-control:focus-within{background:#182331;border-color:#63748c;box-shadow:0 0 0 3px rgba(143,164,194,.09)}
html[data-theme="dark"] .amount-control select{border-right-color:#2b3748}
html[data-theme="dark"] .choice-card span::before{box-shadow:inset 0 0 0 2px #141d29;border-color:#5a687b}
html[data-theme="dark"] .choice-card input:checked+span{background:#202c3c;border-color:#9dacc0;color:#f3f6fb}
html[data-theme="dark"] .choice-card input:checked+span::before{background:#e9eef7;border-color:#e9eef7}
html[data-theme="dark"] .sheet-actions{background:rgba(14,21,32,.96)}
html[data-theme="dark"] .storage-card{background:#112922;border-color:#205043}
html[data-theme="dark"] .storage-card__icon{background:#183a31;color:#65dfb3}
html[data-theme="dark"] .storage-card p{color:#9ac0b2}
html[data-theme="dark"] .storage-card span{background:#193d33;color:#86e5c2}
html[data-theme="dark"] .toast{background:#eef3fa;color:#0b1018}
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator{filter:invert(1);opacity:.8}

.toggle-switch{direction:ltr;width:44px;height:25px;border-radius:99px;background:#d0d5dd;padding:3px;display:flex;align-items:center;transition:.2s}
.toggle-switch i{display:block;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 2px 5px rgba(16,24,40,.18);transition:.2s}
.toggle-switch.active{background:#1d2939}
.toggle-switch.active i{transform:translateX(19px)}
html[data-theme="dark"] .toggle-switch{background:#344154}
html[data-theme="dark"] .toggle-switch.active{background:#e9eef7}
html[data-theme="dark"] .toggle-switch.active i{background:#0d1420}

.auth-pending{overflow:hidden}
.auth-pending .app-shell{visibility:hidden;pointer-events:none}
.auth-gate{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:22px;background:
  radial-gradient(circle at 85% 8%,rgba(49,87,213,.13),transparent 28%),
  radial-gradient(circle at 12% 88%,rgba(8,127,91,.11),transparent 30%),var(--bg)}
.auth-gate[hidden]{display:none}
.auth-card{width:min(100%,430px);border:1px solid var(--line);border-radius:30px;background:color-mix(in srgb,var(--surface) 96%,transparent);padding:28px 22px 22px;box-shadow:0 28px 80px rgba(16,24,40,.15);backdrop-filter:blur(20px)}
.auth-logo{width:60px;height:60px;border-radius:20px;background:var(--primary);color:#fff;display:grid;place-items:center;margin-bottom:22px;box-shadow:0 14px 28px rgba(17,24,39,.19)}
.auth-logo svg{width:30px;height:30px}
.auth-copy{margin-bottom:22px}
.auth-kicker{display:block;color:var(--blue);font-size:11px;font-weight:900;margin-bottom:6px}
.auth-copy h1{margin:0 0 7px;font-size:27px;letter-spacing:-.7px}
.auth-copy p{margin:0;color:var(--muted);font-size:11px;line-height:1.8}
.auth-form{display:grid;gap:13px}
.auth-field{display:grid;gap:7px}
.auth-field>span{font-size:11px;font-weight:800;color:var(--ink)}
.password-control{height:54px;border:1px solid var(--line);border-radius:16px;background:var(--surface-2);display:grid;grid-template-columns:minmax(0,1fr) 48px;align-items:center;overflow:hidden;transition:.16s}
.password-control:focus-within{border-color:#7b879a;box-shadow:0 0 0 3px rgba(71,84,103,.08)}
.password-control input{height:100%;min-width:0;border:0;outline:0;background:transparent;color:var(--ink);padding:0 14px}
.password-control input::placeholder{color:#98a2b3;font-size:11px}
.password-toggle{height:100%;border:0;background:transparent;color:var(--muted);display:grid;place-items:center}
.password-toggle svg{width:19px;height:19px}
.auth-error{min-height:18px;margin:0;color:var(--red);font-size:10px;font-weight:700;line-height:1.5}
.auth-submit{height:54px;border:0;border-radius:16px;background:var(--primary);color:#fff;font-weight:900;box-shadow:0 12px 25px rgba(17,24,39,.17)}
.auth-submit:disabled{opacity:.65;cursor:wait}
.auth-note{display:flex;align-items:flex-start;gap:8px;margin:18px 0 0;padding-top:16px;border-top:1px solid var(--line);color:var(--muted);font-size:9.5px;line-height:1.7}
.auth-note svg{width:18px;height:18px;flex:0 0 auto;color:var(--green)}
html[data-theme="dark"] .auth-card{box-shadow:0 30px 90px rgba(0,0,0,.45)}
html[data-theme="dark"] .auth-logo{background:#e9eef7;color:#0a0f18}
html[data-theme="dark"] .auth-submit{background:#e9eef7;color:#0a0f18}
.password-sheet{max-width:540px}

@media(max-width:390px){
  .header-actions{gap:6px}
  .header-action{width:39px;height:39px;border-radius:13px}
  .auth-card{border-radius:25px;padding:24px 18px 20px}
  .auth-copy h1{font-size:24px}
}


/* v5 - monthly PDF reports */
.report-settings-icon{background:#eef4ff!important;color:#3157d5!important}
.report-sheet{padding-bottom:calc(14px + var(--safe-bottom))}
.report-controls{padding:0 16px;display:grid;gap:12px}
.report-controls .field input,.report-controls .field select{height:52px}
.report-toggle{position:relative;border:1px solid var(--line);background:var(--surface);border-radius:17px;padding:13px 14px;display:grid;grid-template-columns:minmax(0,1fr) 48px;align-items:center;gap:12px;box-shadow:var(--shadow-sm)}
.report-toggle>span{display:grid;gap:4px}
.report-toggle b{font-size:12px}
.report-toggle small{font-size:9.5px;color:var(--muted);line-height:1.6}
.report-toggle input{position:absolute;opacity:0;pointer-events:none}
.report-toggle i{direction:ltr;width:46px;height:27px;border-radius:99px;background:#d0d5dd;padding:3px;display:flex;align-items:center;transition:.2s}
.report-toggle i::after{content:"";display:block;width:21px;height:21px;border-radius:50%;background:#fff;box-shadow:0 2px 5px rgba(16,24,40,.18);transition:.2s}
.report-toggle input:checked+i{background:#111827}
.report-toggle input:checked+i::after{transform:translateX(19px)}
.report-preview-card{margin:14px 16px 2px;border:1px solid #dbe4ff;background:#f7f9ff;border-radius:20px;padding:15px;display:grid;gap:13px}
.report-preview-head{display:flex;align-items:center;gap:11px}
.report-preview-icon{width:43px;height:43px;border-radius:14px;background:#e7edff;color:#3157d5;display:grid;place-items:center;flex:0 0 auto}
.report-preview-icon svg{width:21px;height:21px}
.report-preview-head div{display:grid;gap:3px}
.report-preview-head small{font-size:9px;color:#667085}
.report-preview-head b{font-size:12px;color:#101828}
.report-preview-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}
.report-preview-stats span{min-width:0;border:1px solid #e2e8f8;background:#fff;border-radius:13px;padding:10px 6px;display:grid;gap:3px;text-align:center}
.report-preview-stats b{font-size:17px;color:#101828}
.report-preview-stats small{font-size:8.5px;color:#667085;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.report-preview-card p{margin:0;font-size:9px;line-height:1.8;color:#667085}
#generateReportBtn:disabled{opacity:.65;cursor:wait}
html[data-theme="dark"] .report-settings-icon{background:#17213a!important;color:#8ba6ff!important}
html[data-theme="dark"] .report-toggle{background:#101722;border-color:#243041}
html[data-theme="dark"] .report-toggle i{background:#344154}
html[data-theme="dark"] .report-toggle input:checked+i{background:#e9eef7}
html[data-theme="dark"] .report-toggle input:checked+i::after{background:#0d1420}
html[data-theme="dark"] .report-preview-card{background:#111a2a;border-color:#263553}
html[data-theme="dark"] .report-preview-icon{background:#17213a;color:#8ba6ff}
html[data-theme="dark"] .report-preview-head small,
html[data-theme="dark"] .report-preview-card p{color:#94a3b8}
html[data-theme="dark"] .report-preview-head b,
html[data-theme="dark"] .report-preview-stats b{color:#f3f6fb}
html[data-theme="dark"] .report-preview-stats span{background:#151e2b;border-color:#28364b}
html[data-theme="dark"] .report-preview-stats small{color:#94a3b8}
@media(min-width:700px){.report-sheet{width:520px}}
