/* Trail v9 · Траты. Scoped extensions of the frozen stage-1 primitives. */
/* Iteration 2 #3: Hide lime +Expense button in topbar when on transactions screen */
body:has(#page-transactions.active) .shell-expense {
  display: none;
}


#page-transactions .shell-section-nav {
  display: flex;
  gap: 8px;
  width: 100%;
}

#page-transactions .shell-section-nav a {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--well);
  color: var(--ink-2);
  font: 500 13px/1 var(--sans);
}

#page-transactions .shell-section-nav a[aria-current="page"] {
  background: var(--panel);
  color: var(--ink);
}

#page-transactions .shell-search-title {
  display: none;
  margin: 0;
  font: 500 26px/1.2 var(--sans);
  letter-spacing: -0.6px;
  color: var(--ink);
}

#page-transactions .page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#page-transactions .page-actions .cnt {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--panel);
  font: 500 11px/14px var(--sans);
  color: var(--ink);
}

#page-transactions .btn-dark,
#opPanel .btn-dark {
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--panel);
  font: 500 13px/1 var(--sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

#page-transactions .btn-dark.sm,
#opPanel .btn-dark.sm {
  padding: 0 14px;
  font-size: 12px;
}

#page-transactions .tx-sticky {
  display: contents;
}

#page-transactions .tx-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#page-transactions .ops-month-anchor {
  grid-column: 1 / -1;
  background: var(--lime);
  color: var(--lime-ink);
  border-radius: 24px;
  padding: 20px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#page-transactions .ops-total {
  display: block;
}

#page-transactions .ops-total b.num {
  font: 500 36px/1.2 var(--sans);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  color: var(--lime-ink);
}

#page-transactions .ops-total .minor {
  font-size: 26px;
  font-weight: 500;
  opacity: 0.85;
}

#page-transactions .ops-total .cur {
  font-size: 0.4em;
  margin-left: 6px;
  letter-spacing: 0;
}

#page-transactions .ops-total > span {
  display: block;
  margin-top: 4px;
  font: 400 12px/16px var(--sans);
  opacity: 0.8;
}

#page-transactions .ops-search {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#page-transactions .ops-search label.search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--panel);
  border-radius: 999px;
  font-size: 13px;
}

#page-transactions .ops-search label.search svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--ink-2);
}

#page-transactions #opSearch {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: 400 15px/20px var(--sans);
  min-height: 44px;
  width: 100%;
  color: var(--ink);
}

#page-transactions #opSearch::placeholder {
  color: var(--ink-2);
}

#page-transactions #opSearch:focus-visible {
  outline: none;
}

#page-transactions .ops-search label.search:focus-within {
  box-shadow: inset 0 0 0 2px var(--focus);
}

#page-transactions .ops-search .btn-ghost {
  background: var(--panel);
  flex: none;
}

#page-transactions .ops-active-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}
#page-transactions .ops-active-filters:not(:empty) { flex-basis: 100%; }

#page-transactions .chip {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: 500 12px/1 var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

#page-transactions #opChips {
  display: flex;
  gap: 8px;
}

#page-transactions .flt-btn {
  min-width: 48px;
}

#page-transactions .flt-btn svg {
  width: 16px;
  height: 16px;
}

#page-transactions .flt-btn.on {
  background: var(--lime);
  color: var(--lime-ink);
}

#page-transactions #opMoreBtn {
  min-width: 44px;
  padding: 0;
}

#opMoreMenu.op-more {
  z-index: 90;
  padding: 8px;
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(17, 17, 17, 0.16);
  display: flex;
  flex-direction: column;
}

#opMoreMenu.op-more .opt {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 400 14px/1 var(--sans);
  display: flex;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

#opMoreMenu.op-more .opt.danger {
  color: var(--danger);
}

#page-transactions .op-nudge {
  margin: 0 0 12px;
}

#page-transactions .op-nudge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 56px;
  padding: 12px 16px;
  background: var(--well);
  border-radius: 16px;
  font: 400 13px/18px var(--sans);
  color: var(--ink);
}

#page-transactions .op-nudge-row b {
  font-weight: 500;
}

#page-transactions .op-nudge-a {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

#page-transactions .op-nudge-row .btn-ghost {
  background: var(--panel);
}

#page-transactions .tx-layout {
  display: block;
}

#page-transactions .tx-list {
  background: var(--panel);
  border-radius: 24px;
  padding: 20px;
  margin-bottom: 12px;
  color: var(--ink);
}

#page-transactions .tx-list .btn-ghost {
  background: var(--well);
}

#page-transactions .tx-list .btn-ghost.sm {
  min-height: 44px;
  padding: 0 16px;
}

#page-transactions .sum-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 12px;
}

#page-transactions #opTotals {
  display: contents;
}

#page-transactions .ops-review-link {
  justify-self: start;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--well);
  color: var(--ink-2);
  font: 500 13px/1 var(--sans);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

#page-transactions #selStart {
  grid-column: 2;
  grid-row: 1;
}

#page-transactions .selall {
  grid-column: 1 / -1;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: 400 12px/16px var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  cursor: pointer;
  text-align: left;
}

#page-transactions .selall .check {
  display: none;
}

#page-transactions .op-budget-status {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font: 400 11px/16px var(--sans);
}
#page-transactions .ops-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--well);
  color: var(--positive);
  font: 500 12px/24px var(--sans);
}
#page-transactions .ops-over-chip { color: var(--danger); }
#page-transactions .tx-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: currentColor;
}
#page-transactions .ops-cover {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--panel);
  font: 500 13px/1 var(--sans);
  white-space: nowrap;
}

#page-transactions table.txt {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  table-layout: fixed;
}

#page-transactions .txt td {
  background: transparent;
  padding: 0;
  vertical-align: middle;
}

#page-transactions #opBody tr.r {
  background: var(--well);
  border-radius: 16px;
}
#page-transactions #opBody tr.r td:first-child { border-radius: 16px 0 0 16px; }
#page-transactions #opBody tr.r td:last-child { border-radius: 0 16px 16px 0; }

#page-transactions #opBody tr.r:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

#page-transactions .txt .mcell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 4px 8px 16px;
  min-width: 0;
}

#page-transactions .txt tr:has(.c0) .mcell {
  padding-left: 8px;
}

#page-transactions .txt .k0 { width: 44px; }
#page-transactions .txt .k3 { width: 116px; }
#page-transactions .txt .selz { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
#page-transactions .txt .check { width: 22px; height: 22px; }

#page-transactions .txt .ops-merchant,
#opPanel .ops-merchant {
  --tx-pal: var(--category-fallback);
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font: 600 12px/1 var(--sans);
  letter-spacing: -0.02em;
  font-style: normal;
  background: color-mix(in srgb, var(--tx-pal) var(--tint), var(--panel));
  color: var(--tx-pal);
}

#page-transactions .ops-palette-1, #opPanel .ops-palette-1 { --tx-pal: var(--c1); }
#page-transactions .ops-palette-2, #opPanel .ops-palette-2 { --tx-pal: var(--c2); }
#page-transactions .ops-palette-3, #opPanel .ops-palette-3 { --tx-pal: var(--category-fallback); }
#page-transactions .ops-palette-4, #opPanel .ops-palette-4 { --tx-pal: var(--c4); }
#page-transactions .ops-palette-5, #opPanel .ops-palette-5 { --tx-pal: var(--c5); }
#page-transactions .ops-palette-6, #opPanel .ops-palette-6 { --tx-pal: var(--c6); }

#page-transactions .ops-merchant:has(> svg[data-trail-icon="food"]),
#opPanel .ops-merchant:has(> svg[data-trail-icon="food"]) { --tx-pal: var(--c1); }
#page-transactions .ops-merchant:has(> svg[data-trail-icon="coffee"]),
#opPanel .ops-merchant:has(> svg[data-trail-icon="coffee"]) { --tx-pal: var(--c2); }
#page-transactions .ops-merchant:has(> svg[data-trail-icon="transport"]),
#opPanel .ops-merchant:has(> svg[data-trail-icon="transport"]) { --tx-pal: var(--category-fallback); }
#page-transactions .ops-merchant:has(> svg[data-trail-icon="shopping"]),
#opPanel .ops-merchant:has(> svg[data-trail-icon="shopping"]) { --tx-pal: var(--c4); }
#page-transactions .ops-merchant:has(> svg[data-trail-icon="travel"]),
#opPanel .ops-merchant:has(> svg[data-trail-icon="travel"]) { --tx-pal: var(--c5); }
#page-transactions .ops-merchant:has(> svg[data-trail-icon="health"]),
#opPanel .ops-merchant:has(> svg[data-trail-icon="health"]) { --tx-pal: var(--c6); }

#page-transactions .txt .ops-merchant svg,
#opPanel .ops-merchant svg {
  width: 20px;
  height: 20px;
}

#page-transactions .ops-merchant:has(> svg) .ops-monogram,
#opPanel .ops-merchant:has(> svg) .ops-monogram {
  display: none;
}

#page-transactions .ops-merchant img[data-ops-logo],
#opPanel .ops-merchant img[data-ops-logo] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--panel);
}

#page-transactions .txt .op-m {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#page-transactions .txt .op-m b {
  font: 500 13px/18px var(--sans);
  color: var(--ink);
  overflow-wrap: anywhere;
}

#page-transactions .txt .op-meta {
  display: block;
  font: 400 11px/16px var(--sans);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

#page-transactions .txt .op-meta > :is(.sub-date, .op-time, .sub-cat, .sub-src, .account-note, .excluded-note, i, .op-pend) {
  display: inline;
}

#page-transactions .txt .op-meta .op-time::after {
  content: ' ';
}

#page-transactions .txt td.c3 {
  text-align: right;
  padding: 8px 12px 8px 4px;
  font: 500 14px/20px var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}

#page-transactions .txt td.c3 > .op-money {
  display: inline-block;
  white-space: nowrap;
}

#page-transactions .txt td.c3 > small {
  display: block;
  font: 400 11px/16px var(--sans);
  color: var(--ink-2);
}

#page-transactions .txt .pending-clock {
  color: var(--ink-2);
}

#page-transactions .txt .ops-review-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: #b35a00;
  vertical-align: middle;
}

#page-transactions .txt tr.day td {
  background: transparent;
}

#page-transactions .txt .day-content {
  padding: 12px 4px 4px;
}

#page-transactions .txt .day-band {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font: 400 12px/16px var(--sans);
  color: var(--ink-2);
}

#page-transactions .txt .day-meta {
  margin-left: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#page-transactions .txt .day-meta .dh-n {
  display: none;
}

#page-transactions .txt .day-l {
  font-weight: 500;
  color: var(--ink);
}

#page-transactions .txt .empty td {
  padding: 24px 8px;
  text-align: center;
  font: 400 13px/18px var(--sans);
  color: var(--ink-2);
}

#page-transactions .txt .cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 500 13px/16px var(--sans);
  cursor: pointer;
}

#page-transactions .txt .cat-btn span:not(.cat-dot):not(.cat-chevron) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-transactions .txt .cat-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

#page-transactions .txt .cat-btn.none {
  color: var(--ink-3);
}

#page-transactions .txt .cat-chevron svg {
  width: 14px;
  height: 14px;
}

#page-transactions .txt .chev {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0 4px 0 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#page-transactions .txt .chev svg {
  width: 16px;
  height: 16px;
}

#page-transactions .ops-ledger-scroll {
  display: block;
  overflow: visible;
}

#page-transactions .pending-legend {
  margin: 12px 0 0;
}

#page-transactions .pl-btn {
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: 400 13px/20px var(--sans);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

#page-transactions .op-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font: 400 12px/16px var(--sans);
  color: var(--ink-2);
}

#page-transactions .op-footer .btn-ghost {
  padding: 0 20px;
}

#page-transactions .selbar,
#selbar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(max(20px, env(safe-area-inset-bottom, 20px)) + 76px);
  z-index: 82;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 8px 6px 12px;
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 6px 20px rgba(17, 17, 17, 0.12);
}

#selbar .sel-n {
  font: 500 13px/18px var(--sans);
  color: var(--ink);
  white-space: nowrap;
}

#selbar .sel-a {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  justify-content: flex-end;
}

#selbar .btn-ghost {
  background: var(--panel);
  padding: 0 14px;
}

#selbar .btn-ghost .mb {
  display: none;
}

#fltSheet .fs-grab {
  display: none;
}

#fltSheet .fs-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

#fltSheet .fs-h > span {
  font: 500 22px/28px var(--sans);
  letter-spacing: -0.4px;
  color: var(--ink);
}

#fltSheet .fac-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#fltSheet fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#fltSheet legend {
  padding: 0 0 6px;
  font: 500 12px/16px var(--sans);
  color: var(--ink-2);
}

#fltSheet .fac-fields > label,
#fltSheet fieldset label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font: 400 14px/18px var(--sans);
  color: var(--ink);
  cursor: pointer;
}

#fltSheet label.muted {
  color: var(--ink-2);
}

#fltSheet input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: none;
}

#fltSheet .fs-n {
  margin-left: auto;
  font: 400 12px/16px var(--sans);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

#fltSheet input:not([type="checkbox"]) {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--well);
  font: 400 14px/20px var(--sans);
  color: var(--ink);
}

#fltSheet input:not([type="checkbox"])::placeholder {
  color: var(--ink-2);
}

#fltSheet .fac-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#fltSheet .fs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 400 15px/20px var(--sans);
  text-align: left;
  cursor: pointer;
}

#fltSheet .fs-row[aria-pressed="true"] {
  background: var(--well);
  padding: 0 12px;
  font-weight: 500;
}

#fltSheet .seg {
  display: flex;
  padding: 3px;
  gap: 2px;
  background: var(--well-deep);
  border-radius: 999px;
}

#fltSheet .seg button {
  flex: 1;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
}

#fltSheet .seg button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--ink);
}

#fltSheet .r6-seg-pill {
  display: none;
}

#fltSheet .fac-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#fltSheet .fac-footer .btn-dark {
  background: var(--ink);
  color: var(--panel);
  padding: 12px 16px;
  white-space: nowrap;
  flex: 1 1 100%;
  min-height: 48px;
  border-radius: 16px;
  font-size: 14px;
  order: 1;
}

#fltSheet #facErr {
  flex: 1 1 100%;
  font: 400 12px/16px var(--sans);
  color: var(--danger);
}

#fltSheet #facErr:empty {
  display: none;
}

#fltSheet #facSummary {
  flex: 1 1 100%;
  order: 2;
  font: 400 12px/16px var(--sans);
  color: var(--ink-2);
}

#opPanel .panel-h {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 44px;
}

#opPanel .panel-h .page-actions {
  display: flex;
  gap: 8px;
}

#opPanel .dr-grab {
  display: none;
}

#opPanel .p-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#opPanel .p-merch {
  font: 500 22px/28px var(--sans);
  letter-spacing: -0.4px;
  color: var(--ink);
}

#opPanel .p-sub {
  font: 400 12px/16px var(--sans);
  color: var(--ink-2);
}

#opPanel .r4-money-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
}

#opPanel .p-amt {
  font: 500 26px/32px var(--sans);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

#opPanel .p-fx {
  font: 400 12px/16px var(--sans);
  color: var(--ink-2);
}

#opPanel .r4-facts {
  display: grid;
  gap: 8px;
}

#opPanel .r4-fact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  background: var(--well);
  border-radius: 16px;
  font: 400 13px/18px var(--sans);
  color: var(--ink);
}

#opPanel .r4-label {
  font: 400 12px/16px var(--sans);
  color: var(--ink-2);
}

#opPanel .ops-type {
  font-weight: 500;
}

#opPanel .op-exclude {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#opPanel .op-exclude input,
#opPanel .op-exclude .check {
  width: 22px;
  height: 22px;
}

#opPanel .field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#opPanel .field > label {
  font: 500 12px/16px var(--sans);
  color: var(--ink-2);
}

#opPanel textarea::placeholder { color: var(--ink-2); opacity: 1; }

#opPanel textarea {
  min-height: 88px;
  padding: 12px 14px;
  border: 0;
  border-radius: 16px;
  background: var(--well);
  font: 400 14px/20px var(--sans);
  color: var(--ink);
  resize: vertical;
}

#opPanel .r4-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#opPanel .r4-secondary summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font: 500 13px/1 var(--sans);
  color: var(--ink-2);
  list-style: none;
}

#opPanel .r4-secondary summary::-webkit-details-marker {
  display: none;
}

#opPanel .r4-secondary-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

html.zt-search-mode #page-transactions .page-header-title > h1,
html.zt-search-mode #page-transactions .page-head .page-actions,
html.zt-search-mode #page-transactions #opMonthAnchor {
  display: none;
}

html.zt-search-mode #page-transactions .page-header-title > .shell-search-title {
  display: block;
}

html.zt-search-mode #page-transactions .sum-row .op-budget-status {
  display: none;
}

html.zt-search-mode #page-transactions .tx-top {
  grid-template-columns: minmax(0, 1fr) auto;
}

@media (max-width: 839px) {
  #page-transactions .page-head .page-actions {
    display: none;
  }
}

@media (min-width: 840px) {
  #page-transactions table.txt {
    table-layout: fixed;
  }

  #page-transactions .tx-sticky {
    display: block;
    position: sticky;
    top: 8px;
    z-index: 6;
    background: var(--canvas);
    margin: 0 -8px;
    padding: 4px 8px 0;
  }

  #page-transactions .tx-layout {
    max-width: 1100px;
  }
}

@media (min-width: 1200px) {
  #page-transactions .txt .k2 { width: 220px; }
  #page-transactions .txt td.c2 {
    text-align: left;
  }
}

/* Iteration 2 #4: Page scrolls natively via document window scroll without nested microscroll */

#page-transactions .ops-search .search { flex-basis: 0; }
#page-transactions .ops-search > [data-receipt-scan] { width: 44px; height: 44px; padding: 0; }
#page-transactions .txt .empty { padding: 20px 0; text-align: center; }
#page-transactions .txt .empty p { color: var(--ink-2); }
#page-transactions .txt tr.sel { background: color-mix(in srgb, var(--lime) 24%, var(--panel)); }
#page-transactions .txt .op-meta-sep { padding-inline: 4px; }
#page-transactions .txt .tag-p { display: inline-flex; gap: 4px; color: var(--danger); font: 400 11px/16px var(--sans); }
#page-transactions .txt .tag-p::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; align-self: center; }
#page-transactions .txt .op-a .pos { color: var(--positive); }
#page-transactions .txt .minor { font-size: inherit; }
#page-transactions .txt .cur { font-size: inherit; }
#selbar .sel-n { white-space: normal; min-width: 0; }
#selbar .sel-n > span { display: block; color: var(--ink-2); }

/* These sheets are body siblings of their backdrops, unlike the expense sheet. */
#opsFilterScrim:not([hidden]) { position: fixed; inset: 0; z-index: 100; background: var(--scrim); }
#fltSheet:not([hidden]), #opPanel {
  position: fixed; z-index: 101; inset: auto 12px 12px; margin: 0 auto;
  width: calc(100% - 24px); max-width: 560px; max-height: calc(100dvh - 24px);
  padding: 20px; border-radius: 24px; background: var(--panel); color: var(--ink);
  display: flex; flex-direction: column; gap: 16px;
}
#fltSheet .fac-fields { flex: 1; }
#fltSheet .fac-amounts > label { min-width: 0; display: grid; gap: 8px; color: var(--ink-2); }
#fltSheet .fac-footer { flex: none; }
#opPanel:not(.on) { visibility: hidden; pointer-events: none; position: fixed; }
#opPanel { overflow-y: auto; overscroll-behavior: contain; }
#opPanel .panel-h { flex: none; }
#opPanel .r6-sheet-identity { display: flex; gap: 12px; align-items: center; }
#opPanel .r6-sheet-identity > svg { width: 32px; height: 32px; flex: none; }
#opPanel .r4-fact p { margin: 0; }
#opPanel .op-exclude { min-height: 44px; min-width: 44px; justify-content: center; }
#opPanel .cat-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; background: var(--panel); border-radius: 999px; font-size: 13px; }
#opPanel .cat-dot { width: 8px; height: 8px; border-radius: 50%; }
#opPanel .cat-chevron svg { width: 16px; height: 16px; }
#opPanel .r4-secondary-body :is(h3,p) { margin: 0 0 8px; }
#opPanel .r4-secondary-body h3 { font-size: 14px; font-weight: 500; }
#opPanel .r4-secondary-body .p-sec { padding: 12px; border-radius: 16px; background: var(--well); }
#opPanel .row2 { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
#opPanel .row2 .k { color: var(--ink-2); }
#opPanel .hold-chain { display: flex; flex-wrap: wrap; gap: 12px; }
#opPanel .hold-step { display: grid; gap: 4px; }
#opPanel .r4-note { flex: none; }
#opPanel textarea { min-height: 44px; }
#opMoreMenu.op-more { position: fixed; max-width: calc(100vw - 32px); }
#opMoreMenu .opt { white-space: nowrap; }
@media (min-width: 840px) {
  #fltSheet:not([hidden]),
  #opPanel {
    inset: 0;
    margin: auto;
    height: fit-content;
  }
  #page-transactions .tx-top { grid-template-columns: 300px minmax(0,1fr) auto; }
  #page-transactions .ops-month-anchor { grid-column: auto; }
  #page-transactions .page-actions { width: 100%; }
}
@media (max-width: 430px) {
  #page-transactions .tx-list { padding: 16px; }
  #selbar { flex-wrap: wrap; }
  #selbar .sel-a { width: 100%; justify-content: start; }
}

/* Both calendar renderers use neutral tones: every digit retains --ink. */
#page-transactions :is(.hg-cal, .r5e-calendar) { min-width: 0; }
#page-transactions :is(.hg-cal-days, .hg-cal-wd) { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
#page-transactions .hg-cal-wd { padding-block: 8px; text-align: center; font-size: 11px; color: var(--ink-2); }
#page-transactions :is(.hg-cal, .r5e-calendar) .day {
  min-width: 0; min-height: 44px; padding: 4px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--well); color: var(--ink); font: 400 12px/16px var(--sans);
}
#page-transactions :is(.hg-cal, .r5e-calendar) .day.has,
#page-transactions .r5e-calendar .day[data-r5e-load="2"] { background: var(--well-deep); }
#page-transactions .r5e-calendar .day:is([data-r5e-load="3"], [data-r5e-load="4"]) { background: var(--ink); color: var(--panel); }
#page-transactions :is(.hg-cal, .r5e-calendar) .day.today { outline: 2px solid var(--focus); outline-offset: -2px; }
#page-transactions :is(.hg-cal, .r5e-calendar) .day :is(span,small,b,u) { color: inherit; font-size: inherit; text-decoration: none; }
#page-transactions .hg-cal svg { width: 16px; height: 16px; }
#page-transactions .hg-cal-extra { font-size: 10px; }
#page-transactions .cp-calendar .hg-sub { color: var(--ink-2); font-size: 12px; }
#page-transactions .op-meta i { font-style: normal; }

/* Stage 2 Transactions: receipt scanner integration (scanner-owned append). */
/* Iteration 2: Hide bottom nav when receipt scanner is active so fixed nav does not overlap viewfinder/controls */
header.app-topbar nav.nav-pill-container.zt-chrome-back {
  transition: opacity var(--scrim-out) var(--ease), visibility 0s;
}
body:has(#receiptScanHost:not([hidden])) header.app-topbar nav.nav-pill-container,
body:has(.zt-receipt-scan:not([hidden])) header.app-topbar nav.nav-pill-container,
header.app-topbar nav.nav-pill-container.nav-away {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--scrim-in) var(--ease), visibility 0s linear var(--scrim-in);
}

.zt-receipt-scan { min-width: 0; color: var(--ink); font: 400 14px/20px var(--sans); }
.zt-receipt-scan[hidden], .r8-scanwin[hidden] { display: none; }
.zt-receipt-scan *, .r8-scanwin * { box-sizing: border-box; }
.zt-receipt-scan :is(h2,h3,p) { margin: 0; }
.zt-receipt-scan h2 { font: 500 24px/32px var(--sans); }
.zt-receipt-scan h3 { font: 500 16px/24px var(--sans); }
.zt-receipt-scan :is(button,input,select), .r8-sw-x { font: inherit; color: var(--ink); }
.zt-receipt-scan button, .r8-sw-x { min-width: 44px; min-height: 44px; padding: 12px 16px; border: 0; border-radius: 16px; background: var(--well); cursor: pointer; }
.zt-receipt-scan button:disabled { cursor: default; }
.zt-receipt-scan :is(button,input):focus-visible, .r8-sw-x:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.zt-receipt-scan .primary { background: var(--lime); color: var(--on-lime); font-weight: 500; }
.zt-receipt-scan .full { width: 100%; }
.zt-receipt-scan :is(.expense-pocket,.ready-card,.web-upload,.error-card,.camera-view) { padding: 20px; border-radius: 24px; background: var(--panel); }
.zt-receipt-scan :is(.review-sheet,.inline-detail,.web-upload,.ready-card,.camera-view,.scan-card-copy,.camera-bottom) { display: flex; flex-direction: column; gap: 16px; }
.zt-receipt-scan .scan-card { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 16px; background: var(--well); margin-bottom: 20px; }
.zt-receipt-scan .scan-card-copy { min-width: 0; gap: 8px; }
.zt-receipt-scan .receipt-photo { display: block; object-fit: contain; background: var(--well); border-radius: 16px; }
.zt-receipt-scan .scan-card > .receipt-photo { width: 80px; height: 112px; flex: none; }
.zt-receipt-scan :is(.review-sheet > header,.camera-view > header,.detail-heading,.item-heading,.sum-helper,.receipt-lines > div) { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.zt-receipt-scan .review-sheet { position: relative; min-width: 0; }
.zt-receipt-scan :is(.eyebrow,.privacy,.detail-note,.review-photo p,.scan-card p,.web-upload p,.camera-bottom p,.item-heading small,.r8-lab,.expense-row small,.detail-photo p,.receipt-lines small) { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.zt-receipt-scan :is(.circle,.camera-close) { width: 44px; height: 44px; padding: 0; font-size: 24px; flex: none; }
.zt-receipt-scan :is(.review-photo,.detail-photo) { display: flex; align-items: center; gap: 16px; }
.zt-receipt-scan :is(.review-photo,.detail-photo) .receipt-photo { width: 96px; height: 128px; }
.zt-receipt-scan label { display: flex; flex-direction: column; min-width: 0; gap: 8px; color: var(--ink-2); font-size: 12px; line-height: 16px; }
.zt-receipt-scan input:not([hidden]):not([type=file]) { width: 100%; min-width: 0; min-height: 48px; padding: 12px; border: 0; border-radius: 16px; background: var(--well); color: var(--ink); font-size: 14px; line-height: 20px; }
.zt-receipt-scan :is(.form-pair,.editable-items) { display: grid; gap: 12px; }
.zt-receipt-scan .form-pair { grid-template-columns: repeat(2,minmax(0,1fr)); }
.zt-receipt-scan .editable-item { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); gap: 12px; padding: 16px; border-radius: 16px; background: var(--frame); }
.zt-receipt-scan .item-title { grid-column: 1 / -1; }
.zt-receipt-scan .sum-helper { flex-wrap: wrap; }
.zt-receipt-scan :is(.sum-warning,.form-error,.scene-message) { color: var(--danger); }
.zt-receipt-scan :is(.form-error,.scene-message):empty { display: none; }
.zt-receipt-scan .scan-jobs { display: grid; gap: 8px; margin-top: 16px; }
.zt-receipt-scan > .privacy { margin-top: 12px; }
.zt-receipt-scan .expense-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0; background: transparent; text-align: left; }
.zt-receipt-scan .merchant-glyph { display: grid; place-items: center; width: 44px; height: 44px; flex: none; background: var(--well); border-radius: 16px; }
.zt-receipt-scan svg, .r8-sw-x svg { width: 24px; height: 24px; flex: none; }
.zt-receipt-scan .expense-name { min-width: 0; flex: 1; }
.zt-receipt-scan :is(.expense-name,.expense-price) { display: grid; gap: 8px; overflow-wrap: anywhere; }
.zt-receipt-scan .expense-price { text-align: right; }
.zt-receipt-scan .inline-detail { margin-top: 20px; }
.zt-receipt-scan .receipt-lines { display: grid; gap: 16px; }
.zt-receipt-scan .receipt-lines > div { align-items: start; }
.zt-receipt-scan .receipt-lines > div > span { min-width: 0; overflow-wrap: anywhere; }
.zt-receipt-scan .receipt-lines strong { flex: none; }
.zt-receipt-scan .receipt-lines small { display: block; margin-top: 8px; }
.zt-receipt-scan .camera-paper { min-height: 160px; display: grid; place-items: center; padding: 16px; background: var(--well); border-radius: 16px; }
.zt-receipt-scan .camera-paper .receipt-photo { width: 100%; height: min(32dvh,300px); }
.zt-receipt-scan .camera-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.zt-receipt-scan .shutter { width: 64px; height: 64px; padding: 8px; border-radius: 50%; background: var(--ink); flex: none; }
.zt-receipt-scan .shutter span { display: block; width: 100%; height: 100%; border: 2px solid var(--panel); border-radius: 50%; }
.zt-receipt-scan .camera-file { padding: 8px; flex: 1; }
.zt-receipt-scan .scan-status { display: flex; align-items: center; gap: 8px; }
.zt-receipt-scan .spinner { width: 20px; height: 20px; border: 2px solid var(--ink-2); border-top-color: transparent; border-radius: 50%; }
.zt-receipt-scan .r8-f { min-width: 0; display: grid; gap: 8px; }
.zt-receipt-scan .r8-pill { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; }
.zt-receipt-scan .r8-pill svg { width: 16px; height: 16px; }
:is(.zt-receipt-scan,.r8-sw-win) .r8-pop { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 24px; background: var(--panel); color: var(--ink); box-shadow: 0 8px 32px var(--scrim); font: 400 14px/20px var(--sans); }
:is(.zt-receipt-scan,.r8-sw-win) .r8-pop :is(button,input) { min-width: 44px; min-height: 44px; border: 0; border-radius: 16px; background: var(--well); color: var(--ink); font: inherit; padding: 8px; }
:is(.zt-receipt-scan,.r8-sw-win) .r8-pop :is(button,input):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:is(.zt-receipt-scan,.r8-sw-win) .r8-pop button[aria-pressed=true], :is(.zt-receipt-scan,.r8-sw-win) .r8-opt[aria-selected=true] { background: var(--lime); color: var(--on-lime); }
:is(.zt-receipt-scan,.r8-sw-win) .r8-opt { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; }
:is(.zt-receipt-scan,.r8-sw-win) .r8-optlist { display: grid; gap: 8px; }
:is(.zt-receipt-scan,.r8-sw-win) :is(.r8-calhead,.r8-calquick) { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
:is(.zt-receipt-scan,.r8-sw-win) :is(.r8-dow,.r8-days) { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 0; text-align: center; }
:is(.zt-receipt-scan,.r8-sw-win) .r8-pop svg { width: 20px; height: 20px; }
:is(.zt-receipt-scan,.r8-sw-win) .r8-pop :is(.r8-grp,.r8-none) { margin: 8px 0; color: var(--ink-2); font-size: 12px; }
:is(.zt-receipt-scan,.r8-sw-win) .r8-pop .r8-psearch input { width: 100%; }
.r8-scanwin { position: fixed; inset: 0; z-index: 110; padding: 24px; overflow-y: auto; overscroll-behavior: contain; background: var(--scrim); }
.r8-sw-win { position: relative; width: 100%; max-width: 560px; margin: 24px auto; padding: 24px; border-radius: 24px; background: var(--panel); color: var(--ink); }
.r8-sw-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.r8-sw-head h2 { margin: 0; font: 500 24px/32px var(--sans); }
.r8-sw-x { padding: 8px; display: grid; place-items: center; }
.r8-sw-win .expense-pocket { padding: 0; }
.zt-receipt-scan .morph-bridge { position: fixed; z-index: 115; overflow: hidden; background: var(--panel); pointer-events: none; }
.zt-receipt-scan .morph-photo { object-fit: contain; position: absolute; }
.zt-receipt-scan .morph-text { display: flex; justify-content: space-between; gap: 12px; padding: 20px; }
@media (max-width: 380px) {
  .zt-receipt-scan :is(.expense-pocket,.camera-view) { padding: 16px; }
  :is(.zt-receipt-scan,.r8-sw-win) .r8-pop { padding: 8px; }
}
/* End Stage 2 Transactions receipt scanner integration. */
