/* money-banking-edit.css - Banking's Categorized tab and the Edit sheet (Richard approved the mockups 2026-11-22):
   the category button and its picker (a popover, a bottom sheet on a phone), the change toast, the Receipt block, the wide
   Edit sheet from the right (full screen on a phone), and the Categorized table as cards on a phone.
   Builds on money-books.css (mw-* tables, chips, drawer). Tokens only, so both themes follow. Borders separate at rest;
   only what floats (the picker, the toast, the sheet) has a shadow. Prefixes: bk- (the list), bkp- (picker), bke- (sheet). */

/* A filter chip the tab does not use (Changed, outside Categorized). */
.mw-fc[hidden] { display: none; }

/* ─── the Categorized table ─── */
.bk-t-cat td { height: 48px; }
.bk-t-cat td.ds { max-width: 240px; }
.bk-c-paid { font-size: var(--text-xs); white-space: nowrap; max-width: 210px; }
.bk-paid { display: block; color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.bk-c-act { white-space: nowrap; font-size: var(--text-xs); }
.bk-sep { display: inline-block; width: 1px; height: 12px; background: var(--border); margin: 0 var(--s-2); vertical-align: middle; }
.bk-ph { display: none; }
.bk-cb { display: inline-flex; align-items: center; gap: 6px; max-width: 250px; height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--ink); font: inherit; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; cursor: pointer; }
.bk-cb .nm { overflow: hidden; text-overflow: ellipsis; }
.bk-cb .pe { display: inline-flex; color: var(--ink-3); opacity: .45; }
.bk-cb:hover, .bk-cb[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.bk-cb:hover .pe { opacity: 1; color: var(--accent-ink); }
.bk-cb:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.bk-cb.split { border-style: dashed; }
.bk-cb.split .pe { opacity: .9; color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.bk-cb.vo { cursor: default; border-color: transparent; background: transparent; padding-left: 0; color: var(--ink); }
.bk-rc { gap: 3px; }

/* ─── the category picker ─── */
.bkp { position: fixed; z-index: var(--z-dropdown); width: 390px; max-width: calc(100vw - 16px); max-height: min(440px, calc(100vh - 24px)); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-lg); padding: var(--s-2); }
.bkp-q { display: flex; align-items: center; gap: var(--s-2); height: 40px; border: 2px solid var(--accent); border-radius: 9px; padding: 0 10px; color: var(--ink-3); margin-bottom: 6px; flex: none; }
.bkp-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.bkp-q input:focus-visible { box-shadow: none; }
.bkp-n { font-size: var(--text-xs); color: var(--ink-3); white-space: nowrap; }
.bkp-list { overflow-y: auto; min-height: 0; flex: 1; }
.bkp-g { font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: var(--s-2) var(--s-2) var(--s-1); }
.bkp-i { display: flex; align-items: center; gap: var(--s-2); min-height: 36px; padding: 6px var(--s-2); border-radius: 7px; font-size: var(--text-sm); cursor: pointer; }
.bkp-i .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bkp-t { font-size: var(--text-xs); color: var(--ink-3); white-space: nowrap; }
.bkp-on { display: inline-flex; color: var(--success); }
.bkp-i:hover { background: var(--surface-2); }
.bkp-i.hi { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.bkp-i.hi .bkp-t { color: var(--accent-ink); }
.bkp-none { margin: 0; padding: var(--s-2); font-size: var(--text-sm); color: var(--ink-3); }
.bkp-f { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; border-top: 1px solid var(--border-subtle); margin-top: 6px; padding: var(--s-2) var(--s-2) 2px; font-size: var(--text-xs); color: var(--ink-3); flex: none; }
.bkp-f .mw-link { margin-left: auto; font-size: var(--text-xs); }
.bkp-scrim { position: fixed; inset: 0; z-index: calc(var(--z-dialog) - 1); background: var(--scrim); }
.bkp.is-sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 82vh; z-index: var(--z-dialog); border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; box-shadow: var(--sh-xl); padding: 10px var(--s-4) var(--s-5); }
.bkp-grip { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 10px; flex: none; }
.bkp-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); flex: none; }
.bkp-h b { font-size: var(--text-md); }
.bkp-x { width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink-2); border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; }
.bkp.is-sheet .bkp-q { height: 48px; border-width: 1px; border-color: var(--border); }
.bkp.is-sheet .bkp-q:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.bkp.is-sheet .bkp-i { min-height: 44px; font-size: var(--text-md); }
.bkp.is-sheet .bkp-t { display: none; }
.bkp-sf { padding-top: var(--s-3); flex: none; }
.bkp-sf .ds-btn { min-height: 44px; }

/* ─── the change toast (mockup 03) ─── */
.bk-toast { position: fixed; left: 50%; bottom: var(--s-6); transform: translateX(-50%); z-index: var(--z-toast); display: flex; align-items: center; gap: var(--s-3); max-width: min(720px, calc(100vw - 32px)); background: var(--ink); color: var(--surface); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); box-shadow: var(--sh-lg); font-size: var(--text-sm); }
.bk-toast-i { display: inline-flex; color: var(--success); flex: none; }
.bk-toast-tx { display: grid; gap: 2px; min-width: 0; }
.bk-toast-tx span { font-size: var(--text-xs); opacity: .85; }
.bk-toast-acts { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.bk-toast-a { background: none; border: 0; padding: var(--s-1) 0; font: inherit; font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; white-space: nowrap; }
.bk-toast-x { width: 32px; height: 32px; border: 0; background: transparent; color: inherit; opacity: .7; border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; flex: none; }
.bk-toast-a:focus-visible, .bk-toast-x:focus-visible { outline: none; box-shadow: var(--ring); }

/* ─── a receipt (drawer and sheet) ─── */
.bk-rcpt { display: flex; gap: var(--s-3); align-items: flex-start; }
.bk-rthumb { width: 72px; height: 96px; flex: none; border: 1px solid var(--border-subtle); border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); }
.bk-rthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-rcpt-tx { display: grid; gap: 2px; font-size: var(--text-xs); color: var(--ink-2); min-width: 0; }
.bk-rcpt-tx b { font-size: var(--text-sm); color: var(--ink); }
.bk-rcpt-tx b + span, .bk-rcpt-tx span b { color: var(--ink); }
.bk-rcpt-tx .mw-chip { justify-self: start; }

/* ─── the Edit sheet (mockup 04) ─── */
.bke-scrim { position: fixed; left: 0; right: 0; bottom: 0; top: var(--appbar-h, 56px); z-index: calc(var(--z-dialog) - 1); background: var(--scrim); }
.bke { position: fixed; top: var(--appbar-h, 56px); right: 0; bottom: 0; width: min(820px, 100vw); z-index: var(--z-dialog); background: var(--surface); color: var(--ink); display: flex; flex-direction: column; border-left: 1px solid var(--border); box-shadow: var(--sh-xl); }
.bke[hidden], .bke-scrim[hidden] { display: none; }
body.bke-open { overflow: hidden; }
.bke-h { padding: 14px var(--s-6) var(--s-3); border-bottom: 1px solid var(--border-subtle); flex: none; }
.bke-crumb { display: inline-flex; align-items: center; gap: 6px; }
.bke-pos { margin-left: 6px; }
.bke-hrow { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); }
.bke-ht { min-width: 0; }
.bke-eye { font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; }
.bke-h h3 { margin: 2px 0 6px; font-size: var(--text-lg); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.bke-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.bke-amt { font-size: var(--text-2xl); font-weight: 750; letter-spacing: var(--tracking-tight); white-space: nowrap; }
.bke-b { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-4) var(--s-6); display: grid; gap: 14px; align-content: start; }
.bke-note { display: flex; align-items: center; gap: var(--s-3); border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); font-size: var(--text-sm); line-height: 1.45; margin-bottom: var(--s-2); }
.bke-note > span { flex: 1; min-width: 0; }
.bke-note b { color: inherit; }
.bke-note.ok { border-color: var(--success); background: var(--success-soft); color: var(--success-ink); }
.bke-note.info { border-color: var(--info); background: var(--info-soft); color: var(--ink); }
.bke-note.warn { border-color: var(--warn); background: var(--warn-soft); color: var(--warn-ink); }
.bke-quiet { margin: 0 0 var(--s-2); display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-3); }
.bke-lock { position: relative; border: 1px solid var(--border-subtle); background: var(--surface-2); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); display: grid; gap: var(--s-2); }
.bke-lock > .mw-i { position: absolute; right: var(--s-3); top: var(--s-3); color: var(--ink-3); }
.bke-lg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2) 14px; padding-right: var(--s-6); }
.bke-lg > div { display: grid; gap: 1px; font-size: var(--text-sm); min-width: 0; }
.bke-lg b { overflow-wrap: anywhere; }
.bke-lg .w { grid-column: 1 / -1; }
.bke-lg .sb { font-size: var(--text-xs); color: var(--ink-3); }
.bke .lbl { font-size: var(--text-xs); font-weight: 650; color: var(--ink-3); }
.bke-lnote { margin: 0; font-size: var(--text-xs); color: var(--ink-3); }
.bke-fg { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.bke-fl { display: grid; gap: var(--s-1); min-width: 0; }
.bke-fl .lbl { color: var(--ink-2); }
.bke-memo textarea { resize: vertical; min-height: 60px; }
.bke-eh { margin: var(--s-1) 0 0; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.bke-t { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.bke-t th { text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 0 6px 6px; }
.bke-t th.r, .bke-t td.r { text-align: right; }
.bke-t td { padding: var(--s-1) 6px; vertical-align: middle; border-top: 1px solid var(--border-subtle); }
.bke-t td.n, .bke-t th.n { width: 24px; color: var(--ink-3); }
.bke-t td.x, .bke-t th.x { width: 40px; text-align: center; }
.bke-t td[data-l="Category"] { width: 32%; }
.bke-t td[data-l="Amount"] { width: 120px; }
.bke-t.ro td { height: 40px; }
.bke-t .ds-input, .bke-t .ds-select { width: 100%; min-height: 36px; }
.bke-amt-in { text-align: right; font-weight: 650; }
.bke-other td { color: var(--ink-3); }
.bke-rm { width: 36px; height: 36px; border: 0; background: transparent; color: var(--ink-3); border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; }
.bke-rm:hover:not(:disabled) { background: var(--surface-2); color: var(--danger-ink); }
.bke-rm:disabled { opacity: .35; cursor: default; }
.bke-rm:focus-visible { outline: none; box-shadow: var(--ring); }
.bke-cust { position: relative; }
.bke-cl { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 2; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--sh-md); padding: var(--s-1); max-height: 220px; overflow-y: auto; }
.bke-cl[hidden] { display: none; }
.bke-co { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px var(--s-2); border-radius: var(--r-xs); font: inherit; font-size: var(--text-sm); color: var(--ink); cursor: pointer; min-height: 36px; }
.bke-co:hover, .bke-co:focus-visible { background: var(--accent-soft); color: var(--accent-ink); outline: none; }
.bke-co .sb { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.bke-lact { display: flex; align-items: center; gap: var(--s-4); }
.bke-tot { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); font-size: var(--text-sm); flex-wrap: wrap; }
.bke-tot b { font-size: var(--text-md); }
.bke-att { display: grid; gap: var(--s-3); }
.bke-rcpts { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.bke-files { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.bke-file { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--text-sm); }
.bke-file .sb { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.bke-none { margin: 0; font-size: var(--text-xs); color: var(--ink-3); }
.bke-hh { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.bke-hist { margin: 0; padding-left: var(--s-4); display: grid; gap: var(--s-2); font-size: var(--text-sm); }
.bke-hist .sb { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.bke-f { flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: var(--s-3) var(--s-6); border-top: 1px solid var(--border-subtle); background: var(--surface-2); }
.bke-why { font-size: var(--text-xs); color: var(--ink-3); max-width: 340px; }
.bke-why:empty { display: none; }
.bke-err { margin: 0; flex-basis: 100%; order: -1; color: var(--danger-ink); font-size: var(--text-sm); font-weight: 600; }
.bke-err[hidden] { display: none; }
.bke-kbd { margin-left: 6px; background: transparent; color: inherit; border-color: currentColor; opacity: .8; }

/* ─── a phone: cards, a bottom sheet, the Edit sheet full screen (mockup 06) ─── */
@media (max-width: 640px) {
  .bk-t-cat thead { display: none; }
  .bk-t-cat, .bk-t-cat tbody { display: block; }
  .bk-t-cat tbody tr.bk-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-1) var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border-subtle); }
  .bk-t-cat tbody tr.bk-row td { display: block; height: auto; padding: 0; border: 0; max-width: none; min-width: 0; }
  .bk-t-cat tbody tr.bk-row:hover td { background: transparent; }
  .bk-t-cat .mw-ck, .bk-t-cat .bk-c-date, .bk-t-cat .bk-c-paid, .bk-t-cat .bk-c-src, .bk-t-cat .bk-c-act, .bk-t-cat .bk-c-payee { display: none; }
  .bk-t-cat .bk-c-ds { grid-column: 1; grid-row: 1; }
  .bk-t-cat .bk-c-amt { grid-column: 2; grid-row: 1; font-size: var(--text-md); font-weight: 750; }
  .bk-t-cat .bk-c-cat { grid-column: 1 / -1; grid-row: 2; }
  .bk-t-cat .bk-ph { display: block; }
  .bk-t-cat .mw-catcell { flex-wrap: wrap; }
  .bk-t-cat .bk-cb { height: 40px; font-size: var(--text-sm); max-width: 100%; }
  .bk-toast { flex-wrap: wrap; bottom: var(--s-4); }
  .bk-toast-a { white-space: normal; text-align: left; }
  .bke, .bke-scrim { top: 0; }
  .bke { width: 100vw; border-left: 0; }
  .bke-h, .bke-b, .bke-f { padding-left: var(--s-4); padding-right: var(--s-4); }
  .bke-lg { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bke-fg { grid-template-columns: minmax(0, 1fr); }
  .bke-amt { font-size: var(--text-xl); }
  .bke-t thead { display: none; }
  .bke-t, .bke-t tbody { display: block; }
  .bke-t tr { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: var(--s-2); padding: var(--s-3) 0; border-top: 1px solid var(--border-subtle); }
  .bke-t td { display: grid; gap: 2px; border: 0; padding: 0; grid-column: 1; width: auto; }
  .bke-t td[data-l="Category"], .bke-t td[data-l="Amount"] { width: auto; }
  .bke-t td[data-l]::before { content: attr(data-l); font-size: var(--text-xs); font-weight: 650; color: var(--ink-3); }
  .bke-t td.r { text-align: left; }
  .bke-t td.n { display: none; }
  .bke-t td.x { grid-column: 2; grid-row: 1; align-self: start; width: auto; }
  .bke-t .ds-input, .bke-t .ds-select, .bke-fl .ds-input { min-height: 44px; }
  .bke-rm { width: 44px; height: 44px; }
  .bke-f .ds-btn { min-height: 44px; }
  .bke-f .mw-grow { display: none; }
  .bke-why { max-width: none; flex-basis: 100%; }
}
