/* Reference-inspired dark palette. Layout and controls remain real HTML. */
body.dark {
 --bg:#181220;--p:#251b30;--ink:#faf3ff;--muted:#d1c2df;--line:#604574;
 --b:#d8b2ff;--g:#9ee2b7;--income:#9ee2b7;--r:#ffafbd;
 --tile-fill:linear-gradient(145deg,#392747,#2c2038);--tile-inner:#3e2c4d;
 --tile-line:#6b4b81;--tile-summary:#3d294c;
 --popup-panel:#251b30;--popup-ink:#faf3ff;--popup-muted:#d1c2df;
 --popup-header:#3e2453;--popup-footer:#30213d;--popup-line:#67477e;
 --depth-raised:0 8px 24px #08040f38,inset 0 1px 0 #b58bc22b;
 --depth-button:0 3px 9px #0b041b35,inset 0 1px 0 #c69ae32b;
 background:radial-gradient(ellipse at 100% 0%,#4d266b35,transparent 60%),var(--bg);
}
body.dark.clean-dashboard-on {--bg:#181220;--p:#251b30;--ink:#faf3ff;--muted:#d1c2df;--line:#604574;--b:#d8b2ff;--g:#9ee2b7;--income:#9ee2b7;--r:#ffafbd;}
body.dark :is(.main .panel,.main .card,.main .goal-card,.main .subscription-card,.main .more-menu-list,.main .settings-pane) {background:var(--tile-fill);border-color:var(--tile-line);box-shadow:var(--depth-raised)}
body.dark :is(.modal .dialog,.host-modal-card,dialog,.overview-day-preview) {background:#251b30;color:var(--ink);border-color:#74508b;box-shadow:0 24px 80px #07030d80,inset 0 1px 0 #b88bd33b}
body.dark :is(.modal .dialog,.host-modal-card,dialog) :is(.head,header,.dialog-header) {background:linear-gradient(120deg,#30203e,#573071);border-color:#704584}
body.dark :is(input,select,textarea) {background:#30223c;color:#faf3ff;border-color:#75538d;box-shadow:inset 0 2px 5px #0d061a2b;color-scheme:dark}
body.dark :is(input,textarea)::placeholder {color:#bba8cc;opacity:1}
body.dark :is(.btn,.scope-chip,.category-filter-chip) {background-color:#34243f;color:#faf3ff;border-color:#75538d}
body.dark :is(.main,.modal,.host-modal,dialog) .btn.primary,body.dark #pocketDesktopQuickAdd {background:linear-gradient(135deg,#a24ce3,#6522ad)!important;border-color:#bc76ee!important;color:#fff!important;box-shadow:0 4px 14px #1c072e55,inset 0 1px 0 #e3aeff50}
body.dark .side #nav #mobileQuickAdd .quick-add-disc {background:linear-gradient(135deg,#a24ce3,#6522ad)!important;box-shadow:0 0 0 5px var(--p),0 5px 14px #13072180,inset 0 1px 0 #e3aeff50}
body.dark :is(.btn,input,select,textarea,a,summary):focus-visible {outline:3px solid #edcaff;outline-offset:3px}
body.dark :is(.btn,button):disabled {opacity:.5;box-shadow:none!important;cursor:not-allowed}
body.dark #compactAppBar {background:linear-gradient(115deg,#281932,#4a265e);border-bottom:1px solid #78528b;color:#fff}
body.dark #desktopMorePanel,body.dark.compact-shell .side {background:#251b30;border-color:#604574}
body.dark #defaultDashboard .clean-balance .clean-totals>div {background:#3d294c;--summary-income:#a6efc2;--summary-expense:#ffb1bd;}
body.dark #defaultDashboard .clean-balance select {background:#34233f;color:#faf3ff;border-color:#8a60a5}
body.dark #hostAuth {background:linear-gradient(135deg,#181220,#34203f)!important}
body.dark #hostAuth .host-auth-shell,body.dark #hostAuth .host-auth-form {background:#251b30;color:#faf3ff}
body.dark #hostAuth .host-auth-hero {background:linear-gradient(135deg,#352041,#573071)!important}
body.dark #hostAuth .host-auth-hero :is(h1,p,li) {color:#faf3ff!important}

/* Two amount tiles share existing label/input pairs. No DOM reparenting. */
#form.currency-purchase {--currency-tile:#efe3fa;--currency-line:#caa9e4;--currency-muted:#685275;--currency-icon:#e3cef4;}
body.dark #form.currency-purchase {--currency-tile:linear-gradient(135deg,#392749,#2c2039);--currency-line:#79538e;--currency-muted:#d7c6e5;--currency-icon:#543468;}
#form .currency-dialog-subtitle {font-size:14px;line-height:1.5;color:var(--muted);margin:0;padding:0 24px 18px;}
#form .currency-dialog-subtitle[hidden] {display:none!important}
body #form.currency-purchase #modalTitle {font-size:clamp(20px,2vw,27px);line-height:1.35;letter-spacing:-.4px;padding-bottom:8px;}
body.dark #form.currency-purchase #modalTitle {background:linear-gradient(110deg,#30203e,#623582);color:#fff}
#form.currency-purchase #modalTitle::before {content:'⇄';display:inline-grid;place-items:center;width:42px;height:42px;margin-inline-end:12px;border-radius:12px;background:var(--currency-icon);color:var(--b);font-size:24px;vertical-align:middle;box-shadow:inset 0 1px 0 #ffffff25}
#form.currency-purchase .dual-currency-card {background:transparent;border:0;padding:0;box-shadow:none;}
#form.currency-purchase .dual-toggle {padding:0 2px 12px;min-height:44px;font-size:13px;}
body #form.currency-purchase #dualCurrencyFields {display:grid;grid-template-columns:minmax(0,1fr) 105px;gap:0;align-items:stretch;}
body #form.currency-purchase #dualCurrencyFields>.currency-price-field,
body #form.currency-purchase #dualCurrencyFields>.currency-deducted-field {grid-column:1;min-width:0;margin:0 0 14px;padding:14px 16px;background:var(--currency-tile);border:1px solid var(--currency-line);border-inline-end:0;border-radius:16px 0 0 16px;gap:8px;color:var(--ink);font-size:13px;font-weight:650;line-height:1.5;}
body #form.currency-purchase #dualCurrencyFields>.currency-paid-code,
body #form.currency-purchase #dualCurrencyFields>.currency-account-code {grid-column:2;min-width:0;margin:0 0 14px;padding:14px 12px;background:var(--currency-tile);border:1px solid var(--currency-line);border-inline-start:0;border-radius:0 16px 16px 0;color:var(--currency-muted);font-size:11px;gap:8px;}
body #form.currency-purchase .currency-price-field,body #form.currency-purchase .currency-paid-code {grid-row:1;}
body #form.currency-purchase .currency-deducted-field,body #form.currency-purchase .currency-account-code {grid-row:2;}
body #form.currency-purchase :is(#amount,#purchaseAmount) {width:100%;min-width:0;padding:6px 0;border:0;border-radius:0;background:transparent;box-shadow:none;color:var(--ink);font-size:clamp(20px,3vw,30px);font-weight:750;text-align:right;font-variant-numeric:tabular-nums;min-height:44px;}
body #form.currency-purchase :is(#purchaseCurrency,#txCurrency) {width:100%;min-width:0;min-height:44px;border:1px solid var(--currency-line);border-radius:11px;background:color-mix(in srgb,var(--p) 70%,transparent);color:var(--ink);font-weight:750;font-size:14px;padding:6px;box-shadow:inset 0 1px 0 #ffffff1a;}
body #form.currency-purchase #txCurrency {cursor:default;text-align:center;}
body #form.currency-purchase #dualConversionTools {grid-row:3;grid-column:1/-1;display:flex;gap:12px;align-items:center;margin:0 0 14px;}
body #form.currency-purchase #dualConversionTools .dual-auto-switch {flex:1 1 140px;min-height:44px;justify-content:space-between;padding-inline:4px;}
body #form.currency-purchase #dualConversionTools #fetchRate {min-height:46px;padding:10px 14px;background:linear-gradient(135deg,#8544cc,#61259d);border-color:#a668d8;color:#fff;border-radius:13px;box-shadow:inset 0 1px 0 #ffffff35;font-weight:700;}
body #form.currency-purchase #dualConversionTools #rateStatus {flex:1 1 100%;padding:12px 14px;border:1px solid var(--currency-line);border-radius:12px;background:var(--currency-tile);color:var(--currency-muted)!important;font-size:12px;line-height:1.6;}
body #form.currency-purchase #dualConversionTools #rateStatus:empty {display:none;}
body #form.currency-purchase .dual-rate-result {grid-row:4;grid-column:1/-1;margin:0;padding:18px;border:1px solid #a66bd0;border-radius:16px;background:linear-gradient(135deg,#e7d1f7,#f4e8fd);box-shadow:inset 0 1px 0 #ffffff50;gap:7px;}
body.dark #form.currency-purchase .dual-rate-result {background:linear-gradient(130deg,#3c284c,#51276b);border-color:#b376d8;box-shadow:inset 0 1px 0 #e7bbff35,0 4px 12px #16072130;}
body #form.currency-purchase #effectiveRateText {font-size:clamp(17px,2vw,22px);line-height:1.5;overflow-wrap:anywhere;color:var(--ink);font-variant-numeric:tabular-nums;}
body #form.currency-purchase .dual-rate-result small {color:var(--currency-muted);line-height:1.6;}
body #form.currency-purchase .currency-account-field {padding:14px;border:1px solid var(--currency-line);border-radius:14px;background:var(--currency-tile);}
body #form.currency-purchase .currency-account-field small {color:var(--currency-muted);line-height:1.5;}
body.dark #form.currency-purchase .pocket-picker-button {background:#3a2947;border-color:#79538e;color:#faf3ff;}
@media(max-width:420px){body #form.currency-purchase #dualCurrencyFields{grid-template-columns:minmax(0,1fr) 88px}body #form.currency-purchase #dualCurrencyFields>.currency-price-field,body #form.currency-purchase #dualCurrencyFields>.currency-deducted-field{padding:12px 10px}body #form.currency-purchase #dualCurrencyFields>.currency-paid-code,body #form.currency-purchase #dualCurrencyFields>.currency-account-code{padding:12px 8px}body #form.currency-purchase :is(#amount,#purchaseAmount){font-size:22px}body #form.currency-purchase #dualConversionTools{flex-wrap:wrap}body #form.currency-purchase #dualConversionTools #fetchRate{flex:1 1 100%;}#form .currency-dialog-subtitle{padding-inline:20px;font-size:13px}}
@media(forced-colors:active){body #form.currency-purchase :is(.currency-price-field,.currency-deducted-field,.currency-paid-code,.currency-account-code,.dual-rate-result){background:Canvas;border-color:CanvasText;box-shadow:none}body #form.currency-purchase :is(#amount,#purchaseAmount,#effectiveRateText){color:CanvasText}}
/* Existing currency pickers already live inside the amount labels. Use their
   real positions instead of reserving a second, hidden native-select column. */
body #modal #form.currency-purchase #dualCurrencyFields {grid-template-columns:minmax(0,1fr);}
body #modal #form.currency-purchase #dualCurrencyFields>.currency-price-field,
body #modal #form.currency-purchase #dualCurrencyFields>.currency-deducted-field {grid-column:1/-1;position:relative;border:1px solid var(--currency-line);border-radius:16px;padding:14px 16px;}
body #modal #form.currency-purchase :is(#amount,#purchaseAmount) {box-sizing:border-box;padding:6px 100px 6px 0;min-height:48px;}
body #modal #form.currency-purchase .pocket-amount-currency {right:14px;bottom:14px;width:82px;height:46px;min-height:46px;border:1px solid #9064b0;border-radius:11px;background:var(--p);color:var(--ink);box-shadow:inset 0 1px 0 #ffffff20;}
body.dark #modal #form.currency-purchase .pocket-amount-currency {background:#432c52;color:#faf3ff;border-color:#af80d5;}
body #modal #form.currency-purchase #autoConvertCurrency {width:42px;height:26px;min-width:42px;min-height:26px!important;padding:0!important;flex:0 0 42px;border:0;box-shadow:inset 0 1px 3px #0003;}
body #modal #form.currency-purchase #autoConvertCurrency:before {width:20px;height:20px;top:3px;left:3px;}
body #modal #form.currency-purchase #autoConvertCurrency:checked:before {transform:translateX(16px);}
body #form.currency-purchase :is(.currency-account-field,.currency-category-field) {grid-column:1/-1;}
body #form.currency-purchase .currency-account-field .pocket-picker {width:100%;min-height:56px;text-align:left;}
@media(max-width:420px){body #modal #form.currency-purchase #dualCurrencyFields>.currency-price-field,body #modal #form.currency-purchase #dualCurrencyFields>.currency-deducted-field{padding:12px}body #modal #form.currency-purchase .pocket-amount-currency{right:12px;bottom:12px;width:76px}body #modal #form.currency-purchase :is(#amount,#purchaseAmount){padding-right:90px}}
/* Keep the heading and actions visible while the form body scrolls. */
body #form > #modalTitle,body #form > .currency-dialog-subtitle {flex:0 0 auto;}
body #form.currency-purchase > #modalTitle {margin:0;padding:18px 58px 8px 20px;}
body.dark #form.currency-purchase > .currency-dialog-subtitle {background:#30203e;color:#e4d3f0;border-bottom:1px solid #67477e;}
body #form.currency-purchase > .dialog-content {min-height:0;overflow:auto;}

/* Keep the signed-in canvas, cards and currency sheet in the same plum family. */
body.dark.dark {--bg:#17111e;--p:#291d32;--tile-fill:linear-gradient(125deg,#392641,#291d32);--tile-line:#60426d;background:var(--bg)!important}
body.dark .main {background:transparent!important}
body.dark #defaultDashboard :is(.clean-balance,.overview-calendar),body.dark #compactAppBar {background:linear-gradient(115deg,#2e2038 18%,#472655 75%,#65317c)!important;color:#faf5ff!important}
body.dark #modal #form.currency-purchase {background:linear-gradient(160deg,#211728,#2b1e34)!important;border:1px solid #62416e}
body.dark #modal #form.currency-purchase > #modalTitle,body.dark #modal #form.currency-purchase > .currency-dialog-subtitle {background:linear-gradient(110deg,#302038 45%,#59306c)!important;color:#fff!important}
body.dark #modal #dualCurrencyFields>:is(.currency-price-field,.currency-deducted-field){background:linear-gradient(110deg,#3d2a49,#2d2036)!important;border-color:#735584!important}
body.dark #modal #form.currency-purchase :is(#purchaseAmount,#amount){background:transparent!important;color:white!important;font-variant-numeric:tabular-nums;font-weight:700}
