/* Mofeed budget — self-contained, RTL, iPhone first. */
:root{color-scheme:dark;--bg:#0B1220;--card:#141C2E;--line:#22304A;--text:#E8EEF8;--muted:#8A9BB8;--teal:#14B8A6;--blue:#0EA5E9;--gold:#F5B942;--danger:#EF4444;--success:#22C55E;--font:-apple-system,"SF Arabic",Tahoma,sans-serif}
*{box-sizing:border-box}html{background:var(--bg);-webkit-text-size-adjust:100%}body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:14px;line-height:1.55;-webkit-tap-highlight-color:transparent}button,input,select{font:inherit}button,a{touch-action:manipulation}button{cursor:pointer;color:inherit}button:disabled{opacity:.45;cursor:default}a{color:inherit;text-decoration:none}button:focus-visible,a:focus-visible{outline:2px solid var(--teal);outline-offset:3px}button{border:0;background:none}svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}h1,h2,h3,p{margin:0}h1{font-size:19px;letter-spacing:-.45px;font-weight:750}h2{font-size:18px}h3{font-size:15px}.app-shell{max-width:560px;margin:auto;padding-top:env(safe-area-inset-top,0px)}.topbar{display:flex;align-items:center;gap:6px;padding:18px 14px 8px}.brand{flex:1}.eyebrow{display:block;font-size:10px;color:var(--teal);margin-bottom:2px;letter-spacing:.5px}.icon-button{width:48px;height:48px;display:inline-flex;align-items:center;justify-content:center;border-radius:15px;flex-shrink:0}.icon-button:active{background:var(--line)}.back{background:var(--card);border:1px solid var(--line);margin-left:7px}.monthbar{display:flex;justify-content:center;align-items:center;gap:18px;margin:4px 0 14px}.monthbar .icon-button{color:var(--muted)}.month-label{font-weight:650;font-size:15px;min-width:142px;min-height:48px}.month-label small{font-size:10px;color:var(--teal);margin-right:6px}.loading{text-align:center;padding:70px;color:var(--muted)}main{padding:0 18px 120px;outline:none}.card{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:18px;margin-bottom:16px}.hero{position:relative;overflow:hidden;border-color:#25465A;background:radial-gradient(ellipse at 0% 0%,#123D4D 0%,transparent 64%),var(--card);padding:20px}.hero:before{content:"";position:absolute;width:130px;height:130px;border:1px solid #255065;border-radius:50%;left:-65px;top:-58px;pointer-events:none}.hero-top{display:flex;align-items:center;justify-content:space-between;color:#BDCBDD;font-size:12px}.hero-top .badge{display:flex;gap:5px;align-items:center;color:var(--teal);font-size:10px;border:1px solid #26606A;background:#11313C;padding:5px 9px;border-radius:20px}.hero-top .badge svg{width:12px;height:12px}.balance{font-size:42px;font-weight:750;letter-spacing:-1.4px;line-height:1.4;margin:9px 0 14px;font-variant-numeric:tabular-nums}.currency{font-size:12px;font-weight:400;letter-spacing:0;color:var(--muted);margin-right:5px}.balance .currency{font-size:15px;color:#BDCBDD}.hero-foot{padding-top:14px;border-top:1px solid #294051;display:flex;align-items:center;gap:11px}.hero-foot .icon-tile{background:#163D45;color:var(--teal);width:40px;height:40px;border-radius:12px}.hero-foot .details{flex:1}.hero-foot strong{font-size:16px}.small{font-size:11px;color:var(--muted)}.stat-row{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-bottom:17px}.stat{background:var(--card);border:1px solid var(--line);padding:12px 9px;border-radius:18px;min-width:0}.stat .stat-name{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--muted);margin-bottom:6px}.stat svg{width:16px;height:16px}.stat strong{font-size:18px;white-space:nowrap;font-variant-numeric:tabular-nums}.stat .currency{display:block;margin:0;font-size:10px}.teal{color:var(--teal)}.gold{color:var(--gold)}.red{color:var(--danger)}.green{color:var(--success)}.quick-actions{display:flex;gap:10px;margin-bottom:23px}.primary,.secondary,.danger-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;border-radius:14px;padding:11px 16px;font-weight:650;font-size:14px}.primary{background:linear-gradient(115deg,var(--teal),var(--blue));color:#061822}.secondary{background:var(--card);border:1px solid var(--line)}.danger-button{background:#EF444415;border:1px solid #EF444450;color:#FF8D8D}.quick-actions>*{flex:1}.section-heading{display:flex;align-items:center;justify-content:space-between;margin:20px 0 12px;gap:8px}.section-heading h2{font-size:16px}.text-button{font-size:12px;color:var(--teal);min-height:48px;padding:0 7px;display:inline-flex;align-items:center;gap:5px}.text-button svg{width:17px;height:17px}.section-heading .small{font-size:10px}.split-card{padding:15px 16px}.split-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.split-header .small{font-size:10px}.split-bar{display:flex;direction:rtl;gap:4px;height:7px;overflow:hidden;border-radius:6px;margin:10px 0 13px}.split-bar span:nth-child(1){width:50%;background:var(--teal)}.split-bar span:nth-child(2){width:30%;background:var(--blue)}.split-bar span:nth-child(3){width:20%;background:var(--gold)}.split-items{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.split-items span{display:block;font-size:10px;color:var(--muted)}.split-items b{display:block;font-size:13px;margin-top:3px}.split-items em{font-size:10px;font-style:normal;margin-right:3px}.chart-wrap{display:flex;align-items:center;gap:20px}.donut-wrap{width:138px;height:138px;position:relative;flex-shrink:0}.donut{width:138px;height:138px;transform:rotate(-90deg);stroke-width:14;stroke-linecap:butt}.donut-center{position:absolute;inset:0;display:flex;justify-content:center;align-items:center;flex-direction:column;pointer-events:none}.donut-center b{font-size:20px}.legend{flex:1;min-width:0}.legend-row{display:flex;align-items:center;gap:7px;font-size:11px;padding:5px 0}.legend-row .dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.legend-row span:nth-child(2){flex:1}.legend-row b{font-size:11px;white-space:nowrap}.warning{background:#F5B9420C;border:1px solid #F5B94245;color:var(--gold);border-radius:12px;padding:10px 12px;display:flex;gap:8px;font-size:11px;margin-top:12px}.warning svg{width:17px;height:17px}.row{display:flex;align-items:center;gap:12px;padding:14px 0;border-bottom:1px solid var(--line);min-width:0}.row:last-child{border-bottom:0;padding-bottom:0}.row:first-child{padding-top:0}.icon-tile{width:42px;height:42px;background:#1D2A42;color:#B4C8E6;border-radius:13px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.row-body{flex:1;min-width:0}.row-title{font-size:13px;font-weight:600;overflow-wrap:anywhere}.row-sub{font-size:10px;color:var(--muted);margin-top:3px}.row-amount{text-align:left;white-space:nowrap;font-size:14px}.row-amount small{display:block;font-size:9px;color:var(--muted)}.row .icon-button{width:48px;height:48px;color:var(--muted);margin-left:-10px}.empty{display:flex;align-items:center;gap:12px;padding:7px 0;color:var(--muted);font-size:12px}.empty .icon-tile{background:#1B2639;color:var(--muted)}.empty strong{color:var(--text);font-size:13px;display:block;margin-bottom:3px}.privacy-note{display:flex;justify-content:center;gap:6px;align-items:center;margin-top:24px;font-size:10px;color:var(--muted)}.privacy-note svg{width:12px;height:12px}.bottom-nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,560px);display:flex;padding:9px 12px calc(9px + env(safe-area-inset-bottom,0px));background:#10192A;border-top:1px solid var(--line);z-index:20}.bottom-nav button{flex:1;min-height:53px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:var(--muted);font-size:10px;border-radius:13px}.bottom-nav button.active{color:var(--teal);background:#14B8A60B}.bottom-nav button.active svg{stroke-width:2}.page-title{display:flex;justify-content:space-between;align-items:center;margin:4px 0 16px}.page-title h2{font-size:21px}.page-title .primary{padding:10px 14px;font-size:12px}.page-title .primary svg{width:17px;height:17px}.segmented{display:flex;gap:5px;background:#10192A;border:1px solid var(--line);padding:5px;border-radius:14px;margin-bottom:16px}.segmented button{flex:1;min-height:48px;font-size:12px;color:var(--muted);border-radius:10px}.segmented button.active{background:#23304A;color:var(--text)}.goal-card{padding:18px}.goal-top{display:flex;gap:11px;align-items:center}.goal-top .icon-tile{color:var(--gold);background:#F5B94213}.goal-top .row-body{flex:1}.goal-value{margin:17px 0 8px;display:flex;justify-content:space-between;align-items:end}.goal-value strong{font-size:22px}.progress{height:7px;background:#26334B;border-radius:7px;overflow:hidden}.progress span{display:block;height:100%;background:linear-gradient(90deg,var(--teal),var(--blue));border-radius:7px}.goal-foot{display:flex;justify-content:space-between;align-items:center;margin-top:8px}.goal-card .secondary{margin-top:15px;width:100%;font-size:12px}.shop-summary{display:flex;justify-content:space-between;align-items:center}.shop-summary b{font-size:25px}.check-button{height:48px;width:48px;flex-shrink:0;color:var(--teal);display:flex;justify-content:center;align-items:center;border:1px solid var(--line);border-radius:14px}.check-button svg{width:20px;height:20px}.checked .row-title{text-decoration:line-through;color:var(--muted)}.checked .check-button{background:#22C55E16;border-color:#22C55E40;color:var(--success)}.sheet-backdrop{position:fixed;inset:0;background:#020712BB;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);z-index:40}.sheet{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,560px);max-height:calc(100dvh - env(safe-area-inset-top,0px) - 20px);overflow:auto;overscroll-behavior:contain;background:#141C2E;border:1px solid #2A3A55;border-bottom:0;border-radius:25px 25px 0 0;padding:9px 20px calc(24px + env(safe-area-inset-bottom,0px));z-index:50;box-shadow:0 -15px 80px #0004;-webkit-overflow-scrolling:touch}.sheet[hidden],.sheet-backdrop[hidden],.toast[hidden]{display:none}.sheet-handle{width:36px;height:4px;background:#3F4F66;border-radius:8px;margin:2px auto 8px}.sheet-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.sheet-header h2{font-size:19px}.sheet-header .icon-button{background:#1D2940;width:48px;height:48px}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}.field{display:flex;flex-direction:column;gap:7px;margin-bottom:15px;min-width:0}.field>span{color:#AFBDD1;font-size:12px}.field input,.field select{width:100%;height:50px;min-width:0;background:#0F1728;border:1px solid #2A3A55;border-radius:12px;color:var(--text);padding:0 12px;font-size:16px;outline:none;-webkit-appearance:none;appearance:none}.field select{padding-left:26px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A9BB8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:12px center}.field input[type=date]{direction:ltr;text-align:right;padding:10px;display:block;min-height:50px}.field input:focus,.field select:focus{border-color:var(--teal);box-shadow:0 0 0 3px #14B8A615}.field input::placeholder{color:#586B88}.form-grid .field{margin-bottom:12px}.form-submit{width:100%;margin-top:8px;min-height:52px}.form-note{font-size:11px;color:var(--muted);margin:0 0 16px}.form-error{font-size:12px;color:#FF8D8D;margin-bottom:12px}.category-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-bottom:18px}.category-choice{border:1px solid var(--line);border-radius:13px;min-height:71px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;color:var(--muted);font-size:10px}.category-choice.active{background:#14B8A615;border-color:var(--teal);color:var(--teal)}.category-choice svg{width:22px;height:22px}.setting-row{display:flex;align-items:center;justify-content:space-between;min-height:64px;border-bottom:1px solid var(--line);gap:12px}.setting-row label{font-size:14px}.switch{width:52px;min-height:32px;background:#32415A;border-radius:20px;padding:4px;transition:background .2s;position:relative}.switch:after{content:"";display:block;width:24px;height:24px;border-radius:50%;background:white;transition:transform .2s}.switch[aria-checked=true]{background:var(--teal)}.switch[aria-checked=true]:after{transform:translateX(-20px)}.switch:before{content:"";position:absolute;inset:-8px 0}.settings-actions{display:grid;gap:10px;margin-top:20px}.storage-note{font-size:11px;color:var(--muted);background:#0F1728;padding:12px;border-radius:12px;margin-top:16px}.toast{position:fixed;bottom:calc(95px + env(safe-area-inset-bottom,0px));left:50%;transform:translateX(-50%);z-index:70;border:1px solid #31505C;background:#193342;color:var(--text);border-radius:14px;padding:13px 20px;max-width:calc(100% - 32px);width:max-content;box-shadow:0 7px 30px #0007;font-size:13px}.sheet-open{overflow:hidden}.confirm-text{font-size:14px;color:#C3CEE0;margin:8px 0 22px}.confirm-buttons{display:flex;gap:10px}.confirm-buttons button{flex:1}.budget-row{display:flex;gap:12px;align-items:center;margin-bottom:13px}.budget-row .field{flex:1;margin:0}.budget-row .icon-tile{align-self:end;margin-bottom:4px}.list-total{font-size:12px;color:var(--muted);margin-bottom:14px}.badge-paid{font-size:10px;color:var(--success)}.income-icon{background:#14B8A616;color:var(--teal)}.contrib-icon{background:#F5B94213;color:var(--gold)}.list-card{padding:16px}.row-meta-action{display:flex;flex-direction:column;align-items:flex-end}.row-meta-action .text-button{padding:0;min-height:48px}.full-empty{text-align:center;padding:30px 10px}.full-empty .icon-tile{margin:0 auto 14px;width:60px;height:60px;border-radius:18px}.full-empty h3{margin-bottom:5px}.full-empty p{font-size:12px;color:var(--muted)}.full-empty .primary{margin-top:20px}.screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(min-width:600px){.app-shell{padding-top:18px}main{padding-left:24px;padding-right:24px}.topbar{padding-left:20px;padding-right:20px}.hero{padding:24px}.bottom-nav{border-radius:20px 20px 0 0}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}@media(max-width:360px){main{padding-left:12px;padding-right:12px}h1{font-size:17px}.stat strong{font-size:16px}.chart-wrap{gap:12px}.donut-wrap,.donut{width:124px;height:124px}}
/* A 48px physical hit area around the iOS-style switch. */
.switch{width:56px;min-height:48px;background:transparent;padding:0}
.switch:before{content:"";position:absolute;inset:8px 2px;width:52px;height:32px;background:#32415A;border-radius:20px;transition:background .2s}
.switch:after{position:absolute;top:12px;right:6px}
.switch[aria-checked=true]{background:transparent}
.switch[aria-checked=true]:before{background:var(--teal)}
