/* TaxMate Direction D — Income, Expenses, receipts, entry sheet, categories, lightbox, guided expense review.
   Owner: the money team. Loaded after src/ui/direction-d.css (do not change
   the <link> order in index.html). Use the shared tokens and components from
   direction-d.css / direction-d.js; prefix rules with :root[data-direction-d]
   (or the triple prefix where direction-d.css uses it). */

/* ── 1. Income / Expenses pages ─────────────────────────────────────────── */
/* desktop: two columns (card + breakdown | months) */
:root[data-direction-d] body:is([data-direction-page="income"],[data-direction-page="expenses"],[data-direction-page="receipts"]){--d-main-max:968px}
:root[data-direction-d] .d-money .chips{margin:0 -16px;padding:2px 16px 12px}
:root[data-direction-d] .d-money .chips+.chips{margin-top:-4px}
:root[data-direction-d] .d-money .chip svg.d-i{width:15px;height:15px;color:inherit;opacity:.7}
:root[data-direction-d] .d-money .d-wwrap{margin:4px 0 0}
:root[data-direction-d] .d-mwallet .d-wbig .d-in,:root[data-direction-d] .d-mwallet .d-wbig .d-out{display:inline-block}
:root[data-direction-d] .d-mwallet .d-wsubw{display:block;min-height:26px;line-height:1.45}
:root[data-direction-d] .d-mwallet .d-wsub{display:inline}
:root[data-direction-d] .d-mwallet .d-wsubend{white-space:nowrap}
:root[data-direction-d] .d-mwallet .d-wsubw .d-minfo{display:inline-grid;vertical-align:middle;margin-block:-3px 0;margin-inline:4px 0}
:root[data-direction-d][data-direction-d][data-direction-d] .d-money .direction-a-list-action{position:static;margin:14px 0 0;padding:0;background:none}
:root[data-direction-d] .d-money .d-rcneed{margin-top:12px}
:root[data-direction-d] .d-money .d-rcn{min-height:52px;padding:8px 16px;gap:12px;cursor:pointer}
:root[data-direction-d] .d-money .d-rcn .d-st{line-height:1.35}
:root[data-direction-d] .d-money .d-bycat .d-gh{margin-top:22px}
:root[data-direction-d] .d-money .d-mc{cursor:pointer}
/* month sections: big month name + muted year; subtotal only when 2+ entries */
:root[data-direction-d] .d-money .month.d-mgh{padding:28px 4px 8px;align-items:baseline}
:root[data-direction-d] .d-money .d-money-months>.month.d-mgh:first-child{padding-top:22px}
:root[data-direction-d] .d-money .d-mname{font-size:20px;font-weight:800;letter-spacing:-.3px;line-height:1.2;color:var(--ink);text-transform:capitalize}
:root[data-direction-d] .d-money .d-mname em{font-style:normal;font-size:14px;font-weight:600;letter-spacing:0;color:var(--muted);margin-inline-start:7px}
:root[data-direction-d] .d-money .month .num{font-size:14px;font-weight:700}
:root[data-direction-d] .d-money .elist{margin:0}
:root[data-direction-d] .d-money .d-money-months>.empty{margin-top:22px}
@media (min-width:1024px){
  :root[data-direction-d] .d-money.d-cols{gap:32px}
  :root[data-direction-d] .d-money .d-wwrap{margin-top:0}
  :root[data-direction-d] .d-money .d-wallet{padding:22px 24px 16px}
  :root[data-direction-d] .d-money .d-money-months>.month.d-mgh:first-child{padding-top:2px}
  :root[data-direction-d] .d-money .d-money-months>.empty:first-child{margin-top:0}
  :root[data-direction-d] .d-money .month.d-mgh{padding:22px 4px 8px}
  :root[data-direction-d] .d-money .chips{margin:0;padding:0 0 12px;flex-wrap:wrap}
}

/* ── 2. Shared bits ─────────────────────────────────────────────────────── */
:root[data-direction-d] .d-vh{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
:root[data-direction-d][data-direction-d][data-direction-d]{--d-on-tint:#fff}
:root[data-direction-d][data-direction-d][data-direction-d][data-theme="dark"]{--d-on-tint:#0F1620}
@media (prefers-color-scheme:dark){:root[data-direction-d][data-direction-d][data-direction-d]:not([data-theme]){--d-on-tint:#0F1620}}
@keyframes d-money-spin{to{transform:rotate(360deg)}}

/* ── 3. Add / edit income and expense sheet (iOS form) ──────────────────── */
/* phone: full-height iOS form sheet */
@media (max-width:899px){:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry>.sheet{min-height:calc(100dvh - 54px - env(safe-area-inset-top,0px))}}
/* big amount card */
:root[data-direction-d] #sb-entry .d-en-amt{margin:10px 0 0;padding:18px 16px 14px;border-radius:14px;background:var(--d-field);text-align:center;font-size:36px}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .entry-amount{display:flex;align-items:baseline;justify-content:center;gap:4px;font-size:1em;direction:ltr}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .entry-amount .cur{position:static;transform:none;display:block;min-width:0;flex:0 0 auto;font-size:.78em;font-weight:800;color:var(--muted);line-height:1}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .entry-amount input[type=number]{
  flex:0 1 auto;min-width:0;max-width:100%;width:5.6ch;min-height:0;height:auto;padding:0;margin:0;border:0;border-radius:6px;background:transparent;box-shadow:none;
  font-size:1.5em;font-weight:800;letter-spacing:-.04em;line-height:1.1;color:var(--ink);text-align:start;font-variant-numeric:tabular-nums;-moz-appearance:textfield;appearance:textfield
}
:root[data-direction-d] #sb-entry .entry-amount input::-webkit-outer-spin-button,:root[data-direction-d] #sb-entry .entry-amount input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
:root[data-direction-d] #sb-entry .entry-amount input::placeholder{color:var(--muted);opacity:.55}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .entry-amount input[type=number]:focus{box-shadow:none}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .entry-amount input.err{box-shadow:none;background:transparent;color:var(--d-danger)}
:root[data-direction-d][data-direction-d] #sb-entry .d-en-amt .fhint{margin:8px 4px 0;font-size:12.5px;line-height:1.45}
:root[data-direction-d][data-direction-d] #sb-entry .d-en-amt .ferr{margin:8px 4px 0;font-size:13px}
/* category cards: line icon in a --sys circle, horizontal scroller (wraps on desktop) */
:root[data-direction-d] #sb-entry .d-en-cats{margin:12px 0 0}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-cats.catgrid{display:flex;gap:8px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scroll-padding-inline:16px;scrollbar-width:none;margin:0 -16px;padding:2px 16px 4px}
:root[data-direction-d] #sb-entry #en-cats::-webkit-scrollbar{display:none}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-cats .catbtn{
  flex:0 0 78px;width:78px;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:6px;padding:10px 4px 9px;margin:0;
  border:0;border-radius:14px;background:var(--d-field);color:var(--ink);box-shadow:none;font-size:11.5px;font-weight:600;line-height:1.2;text-align:center;scroll-snap-align:start;white-space:normal
}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-cats .catbtn.on{box-shadow:var(--fm-selected-shadow,none);font-weight:700}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-cats .catbtn .d-ic{width:38px;height:38px;flex:0 0 38px;margin:0;font-size:0;line-height:0;display:grid;place-items:center;border-radius:50%;background:var(--sys);color:var(--ink);vertical-align:baseline}
:root[data-direction-d] #sb-entry #en-cats .catbtn .d-ic svg.d-i{width:18px;height:18px}
:root[data-direction-d] #sb-entry #en-cats .d-catn{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere;max-width:100%;line-height:1.32}
:root[data-direction-d] #sb-entry #en-cats .d-catnew{color:var(--muted)}
@media (hover:hover) and (pointer:fine){
  :root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-cats.catgrid{flex-wrap:wrap;overflow:visible;margin:0;padding:2px 0 4px}
}
/* grouped rows: Date / Note / Business, then Details */
:root[data-direction-d] #sb-entry .d-en-grp{margin:12px 0 0;border-radius:14px;background:var(--d-field);overflow:hidden}
:root[data-direction-d] #sb-entry .d-en-grp[hidden],:root[data-direction-d] #sb-entry .d-en-dh[hidden]{display:none}
:root[data-direction-d] #sb-entry .d-en-dh{margin:22px 16px 6px}
:root[data-direction-d] #sb-entry .d-en-grp>*{position:relative}
:root[data-direction-d] #sb-entry .d-en-grp>*+*:not(.d-en-note)::before{content:"";position:absolute;top:0;inset-inline-start:16px;inset-inline-end:0;height:1px;background:var(--line);z-index:1}
:root[data-direction-d] #sb-entry .d-en-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:50px;padding:0 16px;margin:0;font:inherit;font-size:16px;color:var(--ink);background:none;border:0;text-align:start;position:relative}
:root[data-direction-d] #sb-entry .d-en-row>label,:root[data-direction-d] #sb-entry .d-en-row>span:first-child{flex:0 0 auto;font-size:16px;font-weight:400;color:var(--ink);margin:0;line-height:1.3}
:root[data-direction-d] #sb-entry .d-en-btn{cursor:pointer}
:root[data-direction-d] #sb-entry .d-en-btn:disabled{cursor:default;opacity:1}
:root[data-direction-d] #sb-entry .d-en-val{display:flex;align-items:center;gap:6px;margin-inline-start:auto;color:var(--muted);font-size:16px;min-width:0}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-row :is(input[type=text],input[type=date],select){
  flex:1 1 auto;min-width:0;width:auto;min-height:48px;height:48px;padding:0;margin:0;border:0;border-radius:0;background:transparent;box-shadow:none;
  font:inherit;font-size:16px;font-weight:400;color:var(--muted);text-align:end;text-align-last:end
}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-row :is(input,select):focus{box-shadow:none;color:var(--ink)}
:root[data-direction-d] #sb-entry .d-en-row:has(select:focus-visible,input[type=date]:focus-visible){box-shadow:inset 0 0 0 2px var(--muted, #777);border-radius:14px}
:root[data-direction-d] #sb-entry .d-en-row input::placeholder{color:var(--muted);opacity:.7}
:root[data-direction-d] #sb-entry .d-en-row input[type=date]{display:flex;justify-content:flex-end}
:root[data-direction-d] #sb-entry .d-en-row input[type=date]::-webkit-date-and-time-value{text-align:end}
:root[data-direction-d] #sb-entry .d-en-row input[type=date]::-webkit-calendar-picker-indicator{opacity:.55;margin-inline-start:8px;cursor:pointer}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-row select[id]{appearance:none;-webkit-appearance:none;padding-inline-end:18px;cursor:pointer}
:root[data-direction-d] #sb-entry .d-en-row:has(>select)::after{content:"";position:absolute;inset-inline-end:20px;top:50%;width:7px;height:7px;margin-top:-5px;border:solid var(--muted);border-width:0 2px 2px 0;transform:rotate(45deg);opacity:.6;pointer-events:none}
:root[data-direction-d] #sb-entry #en-folder-group .d-en-row:has(>select)::after{inset-inline-end:64px}
:root[data-direction-d] #sb-entry #en-folder-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-folder-open{transition:box-shadow 180ms ease}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-folder-open:is(:active,.d-pr){transform:none;opacity:1;box-shadow:inset 0 0 0 100vmax var(--sys);transition-duration:70ms}
:root[data-direction-d] #sb-entry .d-en-note{margin:0;padding:0 16px 12px;font-size:12.5px;line-height:1.45;color:var(--muted)}
:root[data-direction-d] #sb-entry #en-date-hint.d-en-note{padding-top:2px}
:root[data-direction-d] #sb-entry .d-en-plus{flex:0 0 32px;width:32px;height:32px;display:grid;place-items:center;margin:0;padding:0;border:0;border-radius:50%;background:var(--sys);color:var(--ink);cursor:pointer}
:root[data-direction-d] #sb-entry .d-en-plus svg.d-i{width:16px;height:16px}
/* business use: one row; expanded = iOS segmented choices */
:root[data-direction-d] #sb-entry .d-en-rowtop{min-height:44px}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-pcts.pctrow.seg{display:flex;flex-wrap:nowrap;gap:0;margin:0 16px 10px}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-pcts.seg button{min-height:34px;font-size:14px}
/* receipt row: label, value (Plus tag / Add photo / thumbnail with upload ring) */
:root[data-direction-d] #sb-entry #en-receipt-group{position:relative}
:root[data-direction-d] #sb-entry .d-en-rc{min-height:58px}
:root[data-direction-d] #sb-entry .d-en-rcl{flex:0 0 auto;font-size:16px;color:var(--ink)}
:root[data-direction-d] #sb-entry .d-en-rc .d-tg{margin-inline-end:2px}
:root[data-direction-d] #sb-entry .d-en-slot{position:relative;display:block;width:40px;height:40px;flex:0 0 40px;border-radius:8px;overflow:hidden;box-shadow:0 0 0 .5px var(--line);background:var(--sys)}
:root[data-direction-d][data-direction-d] #sb-entry .d-en-slot .receipt-thumb{display:block;width:100%;height:100%;border:0;border-radius:0;object-fit:cover;cursor:zoom-in}
:root[data-direction-d] #sb-entry .d-en-ring{position:absolute;inset:0;display:grid;place-items:center;background:rgba(10,14,20,.48)}
:root[data-direction-d] #sb-entry .d-en-ring::before{content:"";width:22px;height:22px;border-radius:50%;border:2.5px solid rgba(255,255,255,.3);border-top-color:#fff;animation:d-money-spin 900ms linear infinite}
:root[data-direction-d] #sb-entry #en-receipt-status:empty{display:none}
:root[data-direction-d][data-direction-d] #sb-entry #en-receipt-status{position:absolute;inset-inline-start:16px;bottom:9px;margin:0;padding:0;font-size:12.5px;line-height:1.2;pointer-events:none}
:root[data-direction-d] #sb-entry #en-receipt-group:has(#en-receipt-status:not(:empty)) .d-en-rc{padding-bottom:20px}
/* Save dims while a receipt is uploading (pressing it saves when the upload ends) */
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-save.d-busy{opacity:.35}
/* repeat monthly: the two existing controls drawn as one iOS switch */
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .seg.d-en-sw{position:relative;display:block;flex:0 0 51px;width:51px;height:31px;padding:0;margin:0;border-radius:999px;background:none}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-sw button{position:absolute;inset:0;width:51px;height:31px;min-height:0;padding:0;border-radius:999px;font-size:0;color:transparent;background:var(--sys);box-shadow:none;overflow:hidden;cursor:pointer;transition:background-color 220ms ease}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-sw button.on{display:none}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-sw #en-repeat-off{background:var(--tint)}
:root[data-direction-d] #sb-entry .d-en-sw button::before{content:"";position:absolute;top:2px;inset-inline-start:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 2px 5px rgba(0,0,0,.22)}
:root[data-direction-d] #sb-entry .d-en-sw #en-repeat-off::before{inset-inline-start:22px}
@keyframes d-knob-on{from{transform:translateX(-20px)}}
@keyframes d-knob-off{from{transform:translateX(20px)}}
@keyframes d-knob-on-rtl{from{transform:translateX(20px)}}
@keyframes d-knob-off-rtl{from{transform:translateX(-20px)}}
:root[data-direction-d] #sb-entry .d-sw-flip #en-repeat-off::before{animation:d-knob-on 260ms var(--d-eo)}
:root[data-direction-d] #sb-entry .d-sw-flip #en-repeat-on::before{animation:d-knob-off 260ms var(--d-eo)}
[dir=rtl]:root[data-direction-d] #sb-entry .d-sw-flip #en-repeat-off::before{animation-name:d-knob-on-rtl}
[dir=rtl]:root[data-direction-d] #sb-entry .d-sw-flip #en-repeat-on::before{animation-name:d-knob-off-rtl}
:root[data-direction-d] #sb-entry #en-repeat-from{padding:0 16px 14px}
:root[data-direction-d] #sb-entry #en-repeat-hint.d-en-note{padding-top:0}
:root[data-direction-d] #sb-entry .d-en-q{font-size:13px;font-weight:600;color:var(--muted);margin:2px 0 8px}
:root[data-direction-d] #sb-entry #en-repeat-from .d-en-note{padding:8px 0 0}
:root[data-direction-d] #sb-entry .d-en-sum{font-weight:700;color:var(--ink)}
/* months: a grid of multi-select cells; a checked month is tinted and carries a checkmark (not a radio dot) */
:root[data-direction-d][data-direction-d] #sb-entry .rmgrid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:0}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months label{position:relative;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:0;min-height:50px;margin:0;padding:6px 10px;border:0;border-radius:10px;background:var(--sys);color:var(--ink);font-size:14px;font-weight:600;line-height:1.2;cursor:pointer;transition:background-color 180ms ease,color 180ms ease}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months label:has(input:checked){background:var(--tint);color:var(--d-on-tint);border:0}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months label:has(input:disabled){opacity:.4;cursor:default}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months label:focus-within{outline:2px solid var(--muted, #777);outline-offset:1px}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months input{appearance:none;-webkit-appearance:none;position:absolute;top:7px;inset-inline-end:8px;width:14px;height:14px;min-height:0;margin:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;opacity:1;outline:none}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months input:checked::after{content:"";position:absolute;left:4px;top:0;width:5px;height:10px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg)}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months label>span{display:block;padding-inline-end:14px}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months small{display:block;font-size:11px;font-weight:500;opacity:.72;margin-top:1px}
/* delete link + Assistant context */
:root[data-direction-d] #sb-entry .d-en-del{margin:22px 0 0;text-align:center}
:root[data-direction-d] #sb-entry .d-en-del .link{font-size:16px;font-weight:500}
:root[data-direction-d] #sb-entry #en-task-context:has(.review01-details,.d-task-opts){margin:10px 0 0}
:root[data-direction-d][data-direction-d] #sb-entry #en-task-context .d-task-opts{margin:0;background:var(--d-field)}
:root[data-direction-d] #sb-entry #en-task-context .review01-details{margin:0;padding:2px 16px;border-radius:14px;background:var(--d-field)}
:root[data-direction-d] #sb-entry .assistant-highlight{outline:2px solid var(--muted, #777)!important;outline-offset:-2px;border-radius:14px}

/* ── 4. Category actions, rename and new category; folder sheet ────────── */
/* actions: iOS action sheet */
:root[data-direction-d][data-direction-d][data-direction-d] #sb-catact:not(.d-renaming)>.sheet{display:flex;flex-direction:column;gap:8px;max-width:520px;padding:0 8px calc(8px + env(safe-area-inset-bottom,0px));background:transparent;overflow:visible;box-shadow:none;border-radius:0}
:root[data-direction-d][data-direction-d] #sb-catact:not(.d-renaming)>.sheet>.grab{display:none}
:root[data-direction-d] #sb-catact #cat-action-btns{display:flex;flex-direction:column;gap:8px}
:root[data-direction-d] #sb-catact #cat-action-btns[style*="none"]{display:none!important}
:root[data-direction-d][data-direction-d] #sb-catact .d-ast .stitle{display:block;margin:0;font-size:13px;font-weight:600;color:var(--muted);letter-spacing:0}
:root[data-direction-d] #sb-catact .d-asb-btn{font-weight:400}
:root[data-direction-d] #sb-catact .d-asb-btn.cn{font-weight:700}
/* rename: form sheet with Cancel | Rename | Save */
:root[data-direction-d] .d-sheet-bar{position:sticky;top:0;z-index:3;display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;min-height:52px;margin:0 -16px;padding:0 16px;background:var(--sheet)}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-catact .d-sheet-bar>.btn{width:auto;min-height:44px;padding:0;margin:0;background:none;box-shadow:none;font-size:16px;border-radius:0}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-catact .d-sheet-bar>.btn:first-child{justify-self:start;color:var(--muted);font-weight:500}
:root[data-direction-d][data-direction-d][data-direction-d] #sb-catact .d-sheet-bar>.btn:last-child{justify-self:end;color:var(--d-save);font-weight:700}
:root[data-direction-d] .d-sheet-bar-t{font-size:16px;font-weight:700;text-align:center;padding:0 8px}
:root[data-direction-d] #sb-catact #cat-rename-row .fg{margin:10px 0 0}
:root[data-direction-d] #sb-catact #cat-rename-row .d-gh,:root[data-direction-d] #sb-cat .d-gh{margin:22px 16px 8px}
/* line-icon picker */
:root[data-direction-d][data-direction-d][data-direction-d] :is(#cc-emojis,#cat-rename-icons).d-icgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(50px,1fr));gap:8px;margin:0}
:root[data-direction-d][data-direction-d][data-direction-d] .d-icgrid .emojibtn.d-icbtn{aspect-ratio:1;min-height:0;width:100%;display:grid;place-items:center;padding:0;border:0;border-radius:12px;background:var(--d-field);color:var(--ink);box-shadow:none;font-size:0;cursor:pointer}
:root[data-direction-d][data-direction-d][data-direction-d] .d-icgrid .emojibtn.d-icbtn.on{background:var(--d-field);box-shadow:var(--fm-selected-shadow,none)}
:root[data-direction-d] .d-icgrid .d-icbtn svg.d-i{width:22px;height:22px}
:root[data-direction-d] #sb-cat .fg,:root[data-direction-d] #sb-folder .fg{margin-bottom:0}
:root[data-direction-d] #sb-cat .ferr,:root[data-direction-d] #sb-folder .ferr{margin:8px 16px 0}
@media (min-width:900px){
  :root[data-direction-d][data-direction-d][data-direction-d] #sb-catact:not(.d-renaming)>.sheet{max-width:360px;padding:0}
  :root[data-direction-d][data-direction-d][data-direction-d] #sb-catact:not(.d-renaming) .d-asg{background-color:var(--d-asg-solid)}
  :root[data-direction-d] .d-sheet-bar{margin:0 -22px;padding:0 22px}
}

/* ── 5. Add receipts page (missing list, done, locked) ─────────────────── */
/* Back to Expenses: the standard drill-in back control (.link.d-back, see d-settings.css) */
:root[data-direction-d] .review01-receipts-page-back{width:auto}
@media (max-width:1023px){
  :root[data-direction-d][data-direction-d] body[data-direction-page="receipts"]:not(.ltd-active)>#page{position:relative;padding-top:42px}
  :root[data-direction-d][data-direction-d] body[data-direction-page="receipts"]>#page>.review01-receipts-page-back{position:absolute;top:0;inset-inline-start:16px;margin:0 -6px}
}
:root[data-direction-d] .d-rcpage .review01-task-context{margin:0 0 12px}
:root[data-direction-d] .d-rcsum{padding:16px 16px 14px}
:root[data-direction-d] .d-rcn2{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;font-size:15px;font-weight:600;color:var(--muted)}
:root[data-direction-d] .d-rcn2 b{font-size:40px;font-weight:800;letter-spacing:-1.2px;line-height:1;color:var(--ink);font-variant-numeric:tabular-nums}
:root[data-direction-d] .d-rcbar{height:6px;border-radius:3px;background:var(--sys);margin-top:14px;overflow:hidden}
:root[data-direction-d] .d-rcbar i{display:block;height:100%;border-radius:3px;background:var(--ink);transition:width 520ms var(--d-eo)}
:root[data-direction-d] .d-rcn2-of{font-size:13px;font-weight:500}
:root[data-direction-d] .d-rcof{font-size:13px;color:var(--muted);margin-top:8px}
:root[data-direction-d] .d-rcflt{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 0}
:root[data-direction-d] .d-rcf{position:relative;display:inline-block;max-width:100%}
:root[data-direction-d][data-direction-d][data-direction-d] .d-rcf select{appearance:none;-webkit-appearance:none;width:auto;max-width:100%;min-height:38px;padding:8px 32px 8px 14px;border:0;border-radius:999px;background:var(--card);box-shadow:0 0 0 .5px var(--line);font:inherit;font-size:14px;font-weight:600;color:var(--ink);cursor:pointer}
[dir=rtl]:root[data-direction-d][data-direction-d][data-direction-d] .d-rcf select{padding:8px 14px 8px 32px}
:root[data-direction-d] .d-rcf::after{content:"";position:absolute;inset-inline-end:14px;top:50%;width:6px;height:6px;margin-top:-5px;border:solid var(--muted);border-width:0 2px 2px 0;transform:rotate(45deg);pointer-events:none}
:root[data-direction-d] .d-rclist{margin-top:14px}
:root[data-direction-d] .d-rcrow{position:relative;display:flex;align-items:center;gap:12px;min-height:58px;padding:10px 16px}
:root[data-direction-d] .d-rcrow+.d-rcrow::before{content:"";position:absolute;top:0;inset-inline-start:62px;inset-inline-end:0;height:1px;background:var(--line)}
:root[data-direction-d] .d-rcrow .grow{flex:1;min-width:0}
:root[data-direction-d] .d-rcrow .t{font-size:15px;font-weight:600;line-height:1.3;overflow-wrap:anywhere}
:root[data-direction-d] .d-rcrow .s{font-size:13px;color:var(--muted);margin-top:1px}
:root[data-direction-d] .d-rcrow .s .neg{color:var(--out)}
:root[data-direction-d][data-direction-d][data-direction-d] .d-rcget{position:relative;flex:0 0 auto;width:auto;min-height:34px;margin:0;padding:6px 16px;border-radius:999px;background:var(--sys);color:var(--ink);font-size:15px;font-weight:700;cursor:pointer}
:root[data-direction-d][data-direction-d][data-direction-d] .d-rcget.d-busy{opacity:1!important;padding-inline-start:36px;pointer-events:none}
:root[data-direction-d] .d-rcget.d-busy::before{content:"";position:absolute;inset-inline-start:13px;top:50%;width:14px;height:14px;margin-top:-9px;border-radius:50%;border:2px solid var(--line);border-top-color:var(--ink);animation:d-money-spin 900ms linear infinite}
:root[data-direction-d] .d-rctip{margin:12px 16px 0}
:root[data-direction-d] .d-rcdone{display:flex;flex-direction:column;align-items:center;gap:8px;padding:28px 16px;text-align:center}
:root[data-direction-d] .d-rcdone svg{width:52px;height:52px;fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
:root[data-direction-d] .d-rcdone circle{stroke:#FFBE0A}
:root[data-direction-d] .d-rcdone path{stroke:var(--ink)}
:root[data-direction-d] .d-rcdone .s,:root[data-direction-d] .d-rcnone .s{font-size:15px;color:var(--muted);line-height:1.45}
:root[data-direction-d] .d-rcdone .s{color:var(--ink);font-weight:600}
:root[data-direction-d] .d-rcnone{padding:20px 16px;text-align:center}
/* locked (Free): real receipt photos + See Plus */
:root[data-direction-d] .d-rclock{display:flex;flex-direction:column;align-items:center;gap:6px;padding:24px 20px 20px;text-align:center}
:root[data-direction-d] .d-rlpics{position:relative;width:150px;height:120px;margin-bottom:10px}
:root[data-direction-d] .d-rlpics img{position:absolute;top:0;width:78px;height:104px;object-fit:cover;border-radius:8px;box-shadow:0 8px 18px -8px rgba(0,0,0,.45)}
:root[data-direction-d] .d-rlpics img:first-child{left:14px;transform:rotate(-8deg)}
:root[data-direction-d] .d-rlpics img:last-child{right:14px;top:8px;transform:rotate(6deg)}
:root[data-direction-d] .d-rclock .t{font-size:18px;font-weight:700;color:var(--ink)}
:root[data-direction-d] .d-rclock .s{font-size:14px;color:var(--muted);line-height:1.45;margin-bottom:12px}
@media (min-width:1024px){
  :root[data-direction-d] .d-rcpage.d-cols{gap:32px}
  :root[data-direction-d] .d-rcpage .d-rclist{margin-top:0}
  :root[data-direction-d] .review01-receipts-page-back{margin:0 0 8px -8px}
}

/* ── 6. Receipt viewer (full screen) ────────────────────────────────────── */
:root[data-direction-d][data-direction-d] #taxmate-lightbox.lightbox{z-index:300;gap:0;justify-content:center;padding:calc(64px + env(safe-area-inset-top,0px)) 12px 120px;background:rgba(0,0,0,.94)}
:root[data-direction-d] body:has(>#taxmate-lightbox[style*="flex"]) #sb-confirm{z-index:310}
:root[data-direction-d] body:has(#sb-confirm.open) #taxmate-lightbox .lightbox-bar{opacity:0;transition:opacity 200ms linear}
:root[data-direction-d][data-direction-d] #taxmate-lightbox.lightbox img{max-width:100%;max-height:100%;border-radius:4px;object-fit:contain}
:root[data-direction-d][data-direction-d] #taxmate-lightbox .lightbox-bar{position:absolute;left:0;right:0;bottom:0;height:calc(110px + env(safe-area-inset-bottom,0px));display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding:22px 24px 0}
:root[data-direction-d][data-direction-d] #taxmate-lightbox .lightbox-bar button{min-height:44px;padding:8px 2px;border:0;border-radius:8px;background:none;color:#fff;font:inherit;font-size:17px;font-weight:600;cursor:pointer}
:root[data-direction-d][data-direction-d] #taxmate-lightbox .lightbox-bar button.danger{background:none;color:#FF6B70;font-weight:500}
:root[data-direction-d][data-direction-d] #taxmate-lightbox .lightbox-bar button[hidden]{display:none}
:root[data-direction-d] #taxmate-lightbox .lightbox-bar button:focus-visible{outline:2px solid var(--muted, #777);outline-offset:2px}
@media (min-width:1024px){
  :root[data-direction-d][data-direction-d] #taxmate-lightbox.lightbox{padding:40px 80px 90px}
  :root[data-direction-d][data-direction-d] #taxmate-lightbox .lightbox-bar{height:80px;padding:22px 80px 0}
}

/* ── 7. "Change this or future repeats?" (iOS action sheet) ─────────────── */
@keyframes d-money-sheet-in{from{transform:translateY(110%)}}
:root[data-direction-d] .d-recask{position:fixed;inset:0;z-index:10040;display:flex;align-items:flex-end;justify-content:center;background:var(--veil);animation:d-veil-in 260ms ease}
:root[data-direction-d] .d-recask-sheet{display:flex;flex-direction:column;gap:8px;width:100%;max-width:520px;padding:0 8px calc(8px + env(safe-area-inset-bottom,0px));animation:d-money-sheet-in 340ms var(--d-ios)}
:root[data-direction-d] .d-recask .d-asb-btn{font-weight:400}
:root[data-direction-d] .d-recask .d-asb-btn.cn{font-weight:700}
@media (min-width:900px){
  :root[data-direction-d] .d-recask{align-items:center}
  :root[data-direction-d] .d-recask-sheet{max-width:360px;padding:0;animation:d-pop-in 250ms var(--d-eo)}
  :root[data-direction-d] .d-recask .d-asg{background-color:var(--d-asg-solid)}
}

/* ── 8. Guided expense review (TaxMate assistant) ──────────────────────── */
/* chrome (Back / close) is shared with the share + loss flows: d-tax.css §11 */
:root[data-direction-d] .guided-review[data-kind="expense"]{background:var(--bg);color:var(--ink)}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-shell{padding:12px 16px 24px}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-context{font-size:13px;font-weight:600;line-height:1.4;color:var(--muted);margin:4px 4px 6px}
:root[data-direction-d] .guided-review[data-kind="expense"] h1{font-size:30px;font-weight:800;letter-spacing:-.02em;line-height:1.2;margin:0 4px 12px}
:root[data-direction-d] .guided-review[data-kind="expense"] main>p,:root[data-direction-d] .guided-review[data-kind="expense"] .guided-panel p{font-size:15px;line-height:1.5;color:var(--muted);margin:0 4px 16px}
/* choices = one grouped list of rows */
:root[data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice{
  display:block;width:100%;min-height:52px;margin:0;padding:13px 16px;border:0;border-radius:0;background:var(--card);color:var(--ink);box-shadow:none;
  font-size:16px;font-weight:600;text-align:start;position:relative;line-height:1.35
}
:root[data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice:not(.btn.guided-choice+.btn.guided-choice){border-top-left-radius:14px;border-top-right-radius:14px;margin-top:4px}
:root[data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice:not(:has(+.btn.guided-choice)){border-bottom-left-radius:14px;border-bottom-right-radius:14px}
:root[data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice+.btn.guided-choice::before{content:"";position:absolute;top:0;inset-inline-start:16px;inset-inline-end:0;height:1px;background:var(--line)}
:root[data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice::after{content:"";position:absolute;inset-inline-end:18px;top:50%;width:7px;height:7px;margin-top:-4px;border:solid var(--muted);border-width:2px 2px 0 0;transform:rotate(45deg);opacity:.6}
[dir=rtl]:root[data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice::after{transform:rotate(-135deg)}
:root[data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice{padding-inline-end:40px}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-choice small{font-size:13px;font-weight:500;color:var(--muted);margin-top:2px}
/* expense list + the chosen expense: the D entry row (icon circle, name, date, red amount, chevron) */
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-choices.d-grp,
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-expense-summary{margin:4px 0 16px;background:var(--card)}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-expense-choice{font:inherit;cursor:pointer}
:root[data-direction-d] .guided-review[data-kind="expense"] div.guided-expense-choice{cursor:default}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-expense-choice .v{margin-inline-start:8px}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-expense-choice .d-chev{margin-inline-start:2px}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-expense-choice:focus-visible{outline:2px solid var(--muted, #777);outline-offset:-2px;border-radius:14px}
:root[data-direction-d][data-direction-d] .guided-review[data-kind="expense"] .guided-out{color:var(--out)}
:root[data-direction-d][data-direction-d] .guided-review[data-kind="expense"] h1:focus-visible{outline:none}
:root[data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"] .btn:not(.guided-choice){margin-top:12px;min-height:50px;border-radius:14px}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-link{min-height:46px;margin:8px 0 0;font-size:16px;font-weight:600;color:var(--d-link)}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-panel{margin:4px 0 18px;padding:2px 16px;border:0;border-radius:14px;background:var(--card)}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-panel>strong{display:block;font-size:16px;font-weight:700;color:var(--ink)}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-panel p{margin:2px 0 0}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-row{padding:12px 0;font-size:15px}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-row+.guided-row{border-top:1px solid var(--line)}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-row strong{display:inline;font-weight:600}
:root[data-direction-d] .guided-review[data-kind="expense"] label{font-size:13px;font-weight:600;color:var(--muted);margin:18px 16px 6px}
:root[data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"] input{min-height:50px;padding:12px 16px;border:0;border-radius:12px;background:var(--card);font-size:17px;color:var(--ink);box-shadow:none}
:root[data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"] input:focus{box-shadow:0 0 0 2px var(--muted, #777)}
:root[data-direction-d] .guided-review[data-kind="expense"] .guided-footer{padding-top:24px;font-size:12.5px;color:var(--muted);text-align:center}
/* D field error (every guided kind): red, directly under the field; the field gets a red ring */
:root[data-direction-d][data-direction-d][data-direction-d] .guided-review main>p.guided-error{color:var(--d-danger);font-size:13px;font-weight:600;line-height:1.4;margin:8px 16px 0}
:root[data-direction-d][data-direction-d][data-direction-d] .guided-review input[aria-invalid="true"]{box-shadow:0 0 0 2px var(--d-danger)}

/* date row: shown value + calendar icon, aligned with the other row values; the native input sits on top, invisible, so a tap opens the phone's own picker */
:root[data-direction-d] #sb-entry .d-en-row.d-en-date{cursor:pointer}
:root[data-direction-d] #sb-entry .d-en-date>.d-date-show{display:flex;align-items:center;gap:8px;margin-inline-start:auto;color:var(--muted);font-size:16px;line-height:1.3;pointer-events:none;white-space:nowrap}
:root[data-direction-d] #sb-entry .d-en-date .d-date-ic{width:20px;height:20px;flex:0 0 20px;opacity:.8}
:root[data-direction-d][data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-date>input[type=date]{position:absolute;top:0;bottom:0;inset-inline-end:0;width:62%;height:100%;min-height:0;opacity:0;cursor:pointer;z-index:1}
:root[data-direction-d] #sb-entry .d-en-date>input[type=date]::-webkit-calendar-picker-indicator{position:absolute;inset:0;width:auto;height:auto;margin:0;opacity:0;cursor:pointer}

/* Personal material screen boundary */
@media screen{
/* Original Glass 01: entry-specific composites, choices and receipt controls.
   The native date input and the dark receipt-photo viewer retain their behaviour. */
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-task-context :is(.d-task-opts,.review01-details){
  background-color:var(--fm-panel);background-image:var(--fm-light),var(--fm-grain);background-size:350% 170%,256px 256px;background-position:110% 50%,0 0;background-repeat:no-repeat,repeat;box-shadow:var(--fm-shadow);-webkit-backdrop-filter:var(--fm-frost);backdrop-filter:var(--fm-frost);animation:var(--fm-surface-animation);
}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] :is(#sb-entry #en-cats .catbtn,.d-icgrid .emojibtn.d-icbtn,.d-rcget,.d-rcf select){
  background-color:var(--fm-secondary);background-image:var(--fm-light),var(--fm-grain);background-size:330% 150%,256px 256px;background-position:110% 50%,0 0;background-repeat:no-repeat,repeat;box-shadow:var(--fm-control-shadow);animation:var(--fm-control-animation);
}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] :is(#sb-entry #en-cats .catbtn,.d-icgrid .emojibtn.d-icbtn).on{background-color:var(--fm-inset,var(--fm-stage));background-image:var(--fm-grain);background-size:256px 256px;background-repeat:repeat;box-shadow:var(--fm-selected-shadow);animation:none}
/* User-selected brand cue: yellow icon disc with dark ink in both themes. */
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-cats .catbtn.on .d-ic{background-color:var(--y);color:var(--y-ink)}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] :is(#sb-entry #en-cats .catbtn,.d-icgrid .emojibtn.d-icbtn).on.d-icbtn{color:var(--y-ink);background-image:radial-gradient(circle at center,var(--y) 0 18px,transparent 18.5px),var(--fm-grain);background-size:100% 100%,256px 256px;background-repeat:no-repeat,repeat}
/* One direct press/release; selection changes colour at the same time.
   No independent icon animation, pulse, glow, overshoot or delayed stage. */
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] :is(#sb-entry #en-cats .catbtn,.d-icgrid .emojibtn.d-icbtn){transform-origin:center;transition:transform 180ms var(--d-eo)}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] :is(#sb-entry #en-cats .catbtn,.d-icgrid .emojibtn.d-icbtn):is(:active,.d-pr):not(:disabled):not([aria-disabled="true"]){transform:translateY(1px) scale(.98);opacity:1;transition-duration:70ms}
/* Selected repeat months retain their original yellow and on-tint text. */
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry #en-repeat-months label{
  background-image:var(--fm-light),var(--fm-grain);background-size:330% 150%,256px 256px;background-position:110% 50%,0 0;background-repeat:no-repeat,repeat;box-shadow:var(--fm-control-shadow);animation:var(--fm-control-animation);
}
/* These inputs belong to one grouped surface; a second field finish hides it. */
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry :is(.entry-amount input,.d-en-row input,.d-en-row select){background-color:transparent;background-image:none;box-shadow:none}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-row input.err{animation:none;box-shadow:0 0 0 2px var(--d-danger)}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"]{background-color:var(--fm-stage);background-image:var(--fm-stage-light),var(--fm-grain);background-size:300% 100%,256px 256px;background-repeat:no-repeat,repeat;animation:var(--fm-stage-animation)}
/* Standalone choice rows form one visual list; preserve the existing dividers. */
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice{
  background-color:var(--fm-panel);background-image:var(--fm-light),var(--fm-grain);background-size:350% 170%,256px 256px;background-position:110% 50%,0 0;background-repeat:no-repeat,repeat;box-shadow:none;animation:var(--fm-control-animation);
}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice:is(:hover,:active,.d-pr){background-color:var(--fm-panel);box-shadow:none}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] .guided-review[data-kind="expense"] .btn.guided-choice:focus-visible{animation:none;box-shadow:inset 0 0 0 2px var(--muted, #777)}
@media (prefers-reduced-motion:reduce){
  :root[data-material="soft-frosted"][data-direction-d] :is(#sb-entry #en-task-context .d-task-opts,#sb-entry #en-task-context .review01-details,#sb-entry #en-cats .catbtn,.d-icgrid .emojibtn.d-icbtn,.d-rcget,.d-rcf select,#sb-entry #en-repeat-months label,.guided-review[data-kind="expense"] .btn.guided-choice){animation:none!important}
  :root[data-material="soft-frosted"][data-direction-d] :is(#sb-entry #en-cats .catbtn,.d-icgrid .d-icbtn){transition:none!important;transform:none!important}
}
/* ID-specific category action groups and inline add controls keep the finish. */
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-catact:not(.d-renaming) .d-asg{background-color:var(--fm-panel)}
:root[data-material="soft-frosted"][data-direction-d][data-direction-d][data-direction-d] #sb-entry .d-en-plus{background-color:var(--fm-secondary);background-image:var(--fm-light),var(--fm-grain);background-size:330% 150%,256px 256px;background-position:110% 50%,0 0;background-repeat:no-repeat,repeat;box-shadow:var(--fm-control-shadow);animation:var(--fm-control-animation)}
}
