/* =============================================================================
   Transactions tab + categorisation modals (M3)
   Scoped to .pf-tx (the Transactions tab) and .pf-modal (rule / confirm
   dialogs) so nothing else in the dashboard changes.

   The app loads Bootstrap 4, but some of this markup uses Bootstrap 5 class
   names (form-select, gap-2, g-2, fw-semibold, text-end ...). The shims below
   give those their intended look inside this tab only.
   ============================================================================= */

.pf-tx,
.pf-modal {
  --tx-ink: #111827;
  --tx-text: #374151;
  --tx-muted: #6b7280;
  --tx-faint: #9ca3af;
  --tx-line: #e5e7eb;
  --tx-line-soft: #f1f5f9;
  --tx-panel: #f9fafb;
  --tx-brand: var(--brand-primary, #047857);
  --tx-brand-soft: rgba(4, 120, 87, 0.08);
  --tx-radius: 10px;
  --tx-radius-lg: 14px;
  --tx-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---- Bootstrap 5 names used by this markup ------------------------------- */
.pf-tx .gap-2 { gap: .5rem; }
.pf-tx .fw-semibold { font-weight: 600; }
.pf-tx .rounded-3 { border-radius: var(--tx-radius-lg); }
.pf-tx .bg-light-subtle { background: var(--tx-panel); }
.pf-tx .text-end { text-align: right; }
.pf-tx .row.g-2 { margin-left: -.375rem; margin-right: -.375rem; }
.pf-tx .row.g-2 > [class*="col"] { padding: .375rem; }

/* ---- Form controls: the fix for clipped dropdown text ---------------------
   Bootstrap 4 gives .form-control a fixed height; the app's padding is larger,
   so selected text was cut off. Height follows the content instead. */
.pf-tx .form-control,
.pf-tx .form-select,
.pf-modal .form-control,
.pf-modal .form-select {
  display: block;
  width: 100%;
  height: auto;
  min-height: 2.5rem;
  padding: .5rem .8rem;
  font-size: .875rem;
  line-height: 1.4;
  color: var(--tx-ink);
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: var(--tx-radius);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.pf-tx select.form-control,
.pf-tx .form-select,
.pf-modal select.form-control,
.pf-modal .form-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.1rem;
  background-image: var(--tx-chevron);
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 12px 12px;
  text-overflow: ellipsis;
  cursor: pointer;
}

.pf-tx .form-control:focus,
.pf-tx .form-select:focus,
.pf-modal .form-control:focus,
.pf-modal .form-select:focus {
  outline: 0;
  border-color: var(--tx-brand);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, .15);
}

.pf-tx .form-control::placeholder,
.pf-modal .form-control::placeholder { color: var(--tx-faint); }

.pf-tx .btn,
.pf-modal .btn {
  border-radius: 8px;
  font-weight: 500;
  font-size: .85rem;
  padding: .45rem .95rem;
  line-height: 1.3;
}

.pf-tx .btn-sm { font-size: .8rem; padding: .35rem .75rem; }

.pf-tx .btn-outline-secondary,
.pf-modal .btn-light {
  color: var(--tx-text);
  background: #fff;
  border: 1px solid #d1d5db;
}

.pf-tx .btn-outline-secondary:hover,
.pf-modal .btn-light:hover {
  color: var(--tx-ink);
  background: var(--tx-panel);
  border-color: #c4c9d1;
}

.pf-tx .btn-outline-secondary:disabled { opacity: .5; }

/* ---- Sub-tabs: folder tabs from pf-ui.css ------------------------------- */

/* ---- Filters -------------------------------------------------------------- */
.pf-tx #transactions-filters > .rounded-3,
.pf-tx #transactions-advanced-filters > .rounded-3 {
  background: #F6FEF9;
  border: 1px solid #CDEFDB !important;
  border-radius: var(--tx-radius-lg);
  padding: 1rem 1.1rem !important;
}

.pf-tx #transactions-advanced-filters > .rounded-3 { margin-bottom: 1rem; }

.pf-tx #transactions-filters .form-label,
.pf-tx #transactions-filters .text-uppercase.small {
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none !important;
  color: var(--tx-muted) !important;
  margin-bottom: .35rem;
  line-height: 1.2;
}

.pf-tx #transactions-active-scope { color: var(--tx-muted); }

/* ---- Tables (ledger, rules, history) -------------------------------------- */
.pf-tx .transactions-fixed-wrapper,
.pf-tx .table-responsive {
  background: #fff;
  border: 1px solid #CDEFDB;
  border-radius: var(--tx-radius-lg);
}

.pf-tx .table { margin-bottom: 0; color: var(--tx-text); }

.pf-tx .table thead th,
.pf-tx .transactions-table__head th {
  background: #D1FAE5 !important;
  color: #064E3B !important;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none !important;
  white-space: nowrap;
  padding: .7rem .85rem;
  border: 0 !important;
  box-shadow: none !important;
}

.pf-tx .table thead th:first-child { border-top-left-radius: var(--tx-radius-lg); }
.pf-tx .table thead th:last-child { border-top-right-radius: var(--tx-radius-lg); }

.pf-tx .table td,
.pf-tx #transactions .table-compact td {
  padding: .7rem .85rem;
  font-size: .85rem;
  vertical-align: middle;
  border-top: 1px solid var(--tx-line-soft);
}

.pf-tx .table tbody tr:first-child td { border-top: 0; }
.pf-tx .table-striped tbody tr:nth-of-type(odd) { background: transparent; }
.pf-tx .table tbody tr:hover,
.pf-tx .transactions-table tbody tr:hover { background: #f8fafc !important; }
.pf-tx .table tbody tr.table-active,
.pf-tx .table tbody tr.table-active:hover { background: var(--tx-brand-soft) !important; }

/* Ledger columns */
.pf-tx .transactions-table td:nth-child(1) { white-space: nowrap; color: var(--tx-muted); }
.pf-tx .transactions-table td:nth-child(2) { color: var(--tx-ink); font-weight: 500; min-width: 12rem; }
.pf-tx .transactions-table td:nth-child(3),
.pf-tx .transactions-table td:nth-child(4) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pf-tx .transactions-table td:nth-child(3) span { font-weight: 600; }
.pf-tx .transactions-table td:nth-child(4) { color: var(--tx-muted); }
.pf-tx .transactions-table td:nth-child(6) { color: var(--tx-muted); }
.pf-tx .transactions-table td:nth-child(7) { color: var(--tx-ink); font-weight: 500; }
.pf-tx .transactions-table td .text-danger { color: #b42318 !important; }
.pf-tx .transactions-table td .text-success { color: #047857 !important; }

.pf-tx .transactions-table__action-btn {
  font-size: .75rem;
  font-weight: 500;
  padding: .3rem .7rem;
  line-height: 1.2;
  border-radius: 999px;
  color: var(--tx-brand);
  background: #fff;
  border: 1px solid rgba(4, 120, 87, .35);
}

.pf-tx .transactions-table__action-btn:hover:not(:disabled) {
  color: #fff;
  background: var(--tx-brand);
  border-color: var(--tx-brand);
}

.pf-tx .badge {
  font-size: .68rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 999px;
  vertical-align: 1px;
}

.pf-tx .badge-warning { background: #fef0c7; color: #93370d; }
.pf-tx .badge-success { background: #dcfae6; color: #047857; }
.pf-tx .badge-primary { background: #e0eaff; color: #3538cd; }
.pf-tx .badge-info { background: #e0f2fe; color: #026aa2; }
.pf-tx .badge-light { background: #f2f4f7; color: #475467; }

.pf-tx #transactions-pagination-info { color: var(--tx-muted); }
.pf-tx .btn-group-sm > .btn { font-size: .8rem; padding: .35rem .8rem; }
.pf-tx .btn-group > .btn:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.pf-tx .btn-group > .btn:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

/* Rules / history / CSV panels */
.pf-tx .tab-pane > .card > .card-body h5 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--tx-ink);
}

.pf-tx .tab-pane > .card > .card-body > p.text-muted,
.pf-tx .tab-pane > .card > .card-body .text-muted.small { color: var(--tx-muted) !important; }

/* Status banner */
.pf-tx #categorisation-banner,
.pf-tx #transactions-status {
  border: 0;
  border-radius: var(--tx-radius);
  font-size: .85rem;
}

@media (max-width: 991.98px) {
  /* Wide table scrolls inside its card instead of stretching the page. */
  .pf-tx .transactions-fixed-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pf-tx .transactions-table { min-width: 860px; }
  .pf-tx .transactions-table__head th { position: static; }
}

/* Phones (2026-10-21): one transaction per row in two short lines, so the amount and category are on screen.
   Line 1: description, amount. Line 2: date, category. Balance, account and group stay on wider screens. */
@media (max-width: 575.98px) {
  .pf-tx .transactions-fixed-wrapper { overflow: visible; }
  .pf-tx .transactions-table { min-width: 0; width: 100%; }
  .pf-tx .transactions-table, .pf-tx .transactions-table thead, .pf-tx .transactions-table tbody { display: block; }
  .pf-tx .transactions-table thead tr { display: block; }
  .pf-tx .transactions-table thead th { display: none; }
  .pf-tx .transactions-table thead th:first-child { display: flex; align-items: center; gap: .5rem; padding: .6rem .5rem; }
  /* three columns (2026-10-30 UI review: a long category squeezed the description and ran into the date): the
     description over the first two, the amount; then the date, and the category over the last two */
  .pf-tx .transactions-table tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: .75rem; row-gap: .15rem;
    padding: .65rem .5rem; border-bottom: 1px solid var(--tx-line, #E5E7EB); }
  .pf-tx .transactions-table tbody td { display: block; border: 0 !important; padding: 0 !important; min-width: 0; background: none; }
  .pf-tx .transactions-table tbody td:nth-child(2) { grid-row: 1; grid-column: 1 / 3; min-width: 0; overflow-wrap: anywhere; }
  .pf-tx .transactions-table tbody td:nth-child(3) { grid-row: 1; grid-column: 3; text-align: right; }
  .pf-tx .transactions-table tbody td:nth-child(1) { grid-row: 2; grid-column: 1; display: flex; align-items: center; font-size: .85rem; white-space: nowrap; }
  .pf-tx .transactions-table tbody td:nth-child(7) { grid-row: 2; grid-column: 2 / 4; text-align: right; font-size: .85rem; color: var(--tx-muted); font-weight: 500;
    min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .pf-tx .transactions-table tbody td:nth-child(2) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  .pf-tx .transactions-table tbody td:nth-child(4), .pf-tx .transactions-table tbody td:nth-child(5),
  .pf-tx .transactions-table tbody td:nth-child(6) { display: none; }
  .pf-tx .transactions-table .pf-tx-pick { width: 20px; height: 20px; margin-right: .6rem !important; flex: none; }
  /* the edit panel under a row, and the empty message, take the full width */
  .pf-tx .transactions-table tbody tr.transaction-editor-row,
  .pf-tx .transactions-table tbody tr:has(> td[colspan]) { display: block; }
  .pf-tx .transactions-table tbody tr.transaction-editor-row > td, .pf-tx .transactions-table tbody td[colspan] { display: block; grid-row: auto; padding: .5rem 0 !important; }
}

/* ---- Modals --------------------------------------------------------------- */
.pf-modal .modal-content {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 24px 48px -12px rgba(16, 24, 40, .25);
  overflow: hidden;
}

.pf-modal .modal-header {
  align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--tx-line-soft);
}

.pf-modal .modal-title {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--tx-ink);
}

.pf-modal .modal-header .close {
  padding: .25rem .5rem;
  margin: -.25rem -.5rem -.25rem auto;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--tx-muted);
  opacity: 1;
  text-shadow: none;
}

.pf-modal .modal-header .close:hover { color: var(--tx-ink); }
.pf-modal .modal-body { padding: 1.25rem 1.5rem; color: var(--tx-text); font-size: .9rem; }
.pf-modal .modal-footer {
  padding: .85rem 1.5rem;
  background: var(--tx-panel);
  border-top: 1px solid var(--tx-line-soft);
  gap: .5rem;
}

.pf-modal .modal-footer > * { margin: 0; }

/* Rule form */
.pf-rule-form .pf-section + .pf-section {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--tx-line-soft);
}

.pf-rule-form .pf-section__head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .6rem; }
.pf-rule-form .pf-section__title {
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--tx-ink);
}

.pf-rule-form .pf-section__hint {
  font-size: .75rem;
  color: var(--tx-faint);
}

.pf-rule-form .pf-grid { display: grid; gap: .75rem; }
.pf-rule-form .pf-grid--match { grid-template-columns: 1.1fr .8fr 1.6fr; }
.pf-rule-form .pf-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pf-rule-form .pf-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pf-rule-form .pf-grid--1 { grid-template-columns: 1fr; }
.pf-rule-form .pf-grid.d-none { display: none; }
.pf-rule-form .pf-grid + .pf-grid { margin-top: .75rem; }

.pf-rule-form .pf-field { min-width: 0; }
.pf-rule-form .pf-field > label {
  display: block;
  margin-bottom: .3rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--tx-text);
}

.pf-rule-form .pf-help { display: block; margin-top: .35rem; font-size: .75rem; color: var(--tx-muted); }

.pf-rule-form .pf-preview {
  padding: .85rem 1rem;
  background: var(--tx-panel);
  border: 1px solid var(--tx-line);
  border-radius: 12px;
  font-size: .85rem;
  color: var(--tx-text);
}

.pf-rule-form .pf-preview__summary { font-weight: 600; color: var(--tx-ink); margin-bottom: .2rem; }
.pf-rule-form .pf-preview__line { color: var(--tx-text); }
.pf-rule-form .pf-preview__note { color: var(--tx-muted); margin-top: .2rem; }
.pf-rule-form .pf-preview__warn { margin: .5rem 0; padding: .55rem .75rem; border-radius: 10px; background: #FFFBEB; border: 1px solid #FCD34D; color: #78350F; font-size: .88rem; }
.pf-rule-form .pf-preview__warn strong { display: block; color: #78350F; margin-bottom: .15rem; }
html[data-theme="dark"] .pf-rule-form .pf-preview__warn, html[data-theme="dark"] .pf-rule-form .pf-preview__warn strong { background: #2A2210; border-color: #7C5E10; color: #FCD34D; }

.pf-modal .pf-mini-table { background: #fff; border: 1px solid var(--tx-line); border-radius: 10px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.pf-modal .pf-mini-table th {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--tx-muted);
  background: #fff;
  border-top: 0;
  border-bottom: 1px solid var(--tx-line);
  padding: .5rem .65rem;
}

.pf-modal .pf-mini-table td { font-size: .8rem; padding: .5rem .65rem; border-top: 1px solid var(--tx-line-soft); vertical-align: middle; }
.pf-modal .pf-mini-table td:nth-child(3) { font-variant-numeric: tabular-nums; }
.pf-modal .pf-change { white-space: nowrap; color: var(--tx-faint); }
.pf-modal .pf-chip { display: inline-block; padding: .1rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 500; }
.pf-modal .pf-chip--from { background: #f2f4f7; color: #475467; }
.pf-modal .pf-chip--to { background: #dcfae6; color: #047857; }

@media (max-width: 767.98px) {
  .pf-rule-form .pf-grid--match,
  .pf-rule-form .pf-grid--3,
  .pf-rule-form .pf-grid--2 { grid-template-columns: 1fr; }
  .pf-modal .modal-header,
  .pf-modal .modal-body,
  .pf-modal .modal-footer { padding-left: 1rem; padding-right: 1rem; }
}

/* ---- Panels sit flat on the tab card ------------------------------------- */
.pf-tx .card { background: transparent; border: 0; box-shadow: none; }
.pf-tx .card > .card-body { padding-left: 0; padding-right: 0; }

/* Keyboard focus only (no ring after a mouse click) */
.pf-tx #transactionsSubTabs .nav-link:focus:not(:focus-visible) { outline: 0; }
.pf-tx #transactionsSubTabs .nav-link:focus-visible,
.pf-tx .btn:focus-visible,
.pf-modal .btn:focus-visible { outline: 2px solid var(--tx-brand); outline-offset: 2px; }
.pf-tx .btn:focus,
.pf-modal .btn:focus { box-shadow: none; }

/* The sub-tab content is inside the dashboard's tab card already; don't draw
   a second card around it. */
/* #transactionsSubTabContent is the white panel under the folder tabs (pf-ui.css) */

/* CSV panel */
.pf-tx [data-csv-root] h6 { font-size: .9rem; font-weight: 600; color: var(--tx-ink); margin-top: 1.25rem; }
.pf-tx [data-csv-root] .form-control-file {
  font-size: .85rem;
  padding: .75rem;
  width: 100%;
  max-width: 32rem;
  background: var(--tx-panel);
  border: 1px dashed #cbd5e1;
  border-radius: var(--tx-radius);
}
.pf-tx [data-csv-root] .form-control-file::file-selector-button {
  margin-right: .75rem;
  padding: .4rem .85rem;
  font: inherit;
  font-weight: 500;
  color: var(--tx-brand);
  background: #fff;
  border: 1px solid rgba(4, 120, 87, .35);
  border-radius: 8px;
  cursor: pointer;
}

/* Inline recategorise editor */
.pf-tx .transaction-editor-row > td { background: #fff; padding: .75rem .85rem 1rem !important; }
.pf-tx .transaction-editor-row > td > * { border-radius: 12px; }
.pf-tx .searchable-combobox__input { height: auto !important; min-height: 2.5rem; font-size: .875rem !important; padding: .5rem .8rem !important; }
.pf-tx .searchable-combobox__list { border-radius: 10px; border-color: var(--tx-line); box-shadow: 0 12px 24px -6px rgba(16, 24, 40, .18); }
.pf-tx .btn-success,
.pf-modal .btn-success { background: var(--tx-brand); border-color: var(--tx-brand); color: #fff; }
.pf-tx .btn-success:hover:not(:disabled),
.pf-modal .btn-success:hover:not(:disabled) { background: var(--brand-primary-dark, #064E3B); border-color: var(--brand-primary-dark, #064E3B); }

/* ---- Tidy up (2026-10-08) -------------------------------------------------- */
.pf-tx .pf-tidy__section { background: #fff; border: 1px solid #CDEFDB; border-radius: var(--tx-radius-lg); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.pf-tx .pf-tidy__section h6 { font-weight: 600; color: var(--tx-ink); }
.pf-tx .pf-tidy__notice { background: #FFFBEB; border-color: #FCD34D; }
.pf-tx .pf-tidy__pill { font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .1rem .55rem; }
.pf-tx .pf-tidy__pill--good { background: #D1FAE5; color: #065F46; }
.pf-tx .pf-tidy__pill--check { background: #FEF3C7; color: #92400E; }
.pf-tx .pf-tidy__pill--bad { background: #FEE2E2; color: #991B1B; }
.pf-tx .pf-tidy__flag { color: #92400E; }
.pf-tx .pf-tidy__flag + .pf-tidy__flag { margin-top: .25rem; }
/* tick several words, one category (2026-10-24) */
.pf-tx .pf-tidy__tick { width: 2rem; text-align: center; }
.pf-tx .pf-tidy__tick input { width: 1rem; height: 1rem; cursor: pointer; }
.pf-tx .pf-tidy__bulk { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem .75rem; margin-bottom: .5rem;
  border: 1px solid var(--tx-line, #d1e7dd); border-radius: 10px; background: var(--tx-panel, #f0faf5); position: sticky; top: 0; z-index: 2; }
.pf-tx .pf-tidy__bulk[hidden] { display: none; }
.pf-tx .pf-tidy__bulk-n { font-weight: 600; font-size: .9rem; }
.pf-tx .pf-tidy__bulk select { width: auto; max-width: 16rem; }
@media (max-width: 575px) { .pf-tx .pf-tidy__bulk select, .pf-tx .pf-tidy__bulk label { width: 100%; max-width: 100%; } }
html[data-theme="dark"] .pf-tx .pf-tidy__bulk { background: #0B1612; border-color: #1f3a2f; }
.pf-tx .pf-tidy__kw { font-size: .85rem; color: var(--tx-ink); background: var(--tx-panel); padding: .1rem .35rem; border-radius: 6px; }
.pf-tx .pf-tidy__ex div { max-width: 26rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-tx .pf-seg--sm .btn { padding: .25rem .7rem; font-size: .8rem; }
html[data-theme="dark"] .pf-tx .pf-tidy__section { background: #12201B; border-color: #1F3A30; }
html[data-theme="dark"] .pf-tx .pf-tidy__notice { background: #2A2410; border-color: #6B5A1E; }
html[data-theme="dark"] .pf-tx .pf-tidy__kw { background: #0B1612; color: #E5E7EB; }
html[data-theme="dark"] .pf-tx .pf-tidy__flag { color: #FCD34D; }
.pf-tx .pf-tidy__section ul { font-size: .88rem; }
.pf-tx .pf-tidy__view { color: #047857; font-weight: 600; font-size: .8rem; vertical-align: baseline; }
html[data-theme="dark"] .pf-tx .pf-tidy__view { color: #6EE7B7; }
/* Tidy up in four steps (2026-10-09) */
.pf-tx .pf-tidy__top { background: #fff; border: 1px solid #CDEFDB; border-radius: var(--tx-radius-lg); padding: .9rem 1.1rem; margin-bottom: 1rem; }
.pf-tx .pf-tidy__bar { height: .5rem; border-radius: 999px; background: #E5E7EB; overflow: hidden; margin: .45rem 0 .35rem; }
.pf-tx .pf-tidy__bar > span { display: block; height: 100%; background: #10B981; border-radius: 999px; }
.pf-tx .pf-tidy__bar--target { position: relative; overflow: visible; }
.pf-tx .pf-tidy__target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #0B3B2E; border-radius: 2px; transform: translateX(-1px); }
.pf-tx .pf-tidy__step { background: #fff; border: 1px solid #CDEFDB; border-radius: var(--tx-radius-lg); margin-bottom: .75rem; }
.pf-tx .pf-tidy__step-head { display: flex; align-items: center; gap: .65rem; padding: .8rem 1.1rem; cursor: pointer; list-style: none; }
.pf-tx .pf-tidy__step-head::-webkit-details-marker { display: none; }
.pf-tx .pf-tidy__step-head::after { content: "▾"; margin-left: .25rem; color: #6B7280; transition: transform .15s; }
.pf-tx .pf-tidy__step:not([open]) .pf-tidy__step-head::after { transform: rotate(-90deg); }
.pf-tx .pf-tidy__step-n { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; background: #ECFDF5; color: #047857; }
.pf-tx .pf-tidy__step--done .pf-tidy__step-n { background: #10B981; color: #fff; }
.pf-tx .pf-tidy__step-title { font-weight: 600; color: var(--tx-ink); }
.pf-tx .pf-tidy__step-status { margin-left: auto; text-align: right; }
.pf-tx .pf-tidy__step-body { padding: 0 1.1rem 1rem; }
.pf-tx .pf-tidy__step-body .pf-tidy__section { border: 0; padding: 0; margin: 0 0 1rem; background: transparent; }
.pf-tx .pf-tidy__step-body .pf-tidy__section:last-child { margin-bottom: 0; }
.pf-tx .pf-tidy__step--done .pf-tidy__step-head { padding-top: .6rem; padding-bottom: .6rem; }
.pf-tx .pf-tidy__hint { color: #1D4ED8; }
.pf-tx .pf-tidy__months { font-size: .88rem; }
html[data-theme="dark"] .pf-tx .pf-tidy__top, html[data-theme="dark"] .pf-tx .pf-tidy__step { background: #12201B; border-color: #1F3A30; }
html[data-theme="dark"] .pf-tx .pf-tidy__bar { background: #1F2937; }
html[data-theme="dark"] .pf-tx .pf-tidy__step-n { background: #0B1612; color: #6EE7B7; }
html[data-theme="dark"] .pf-tx .pf-tidy__step--done .pf-tidy__step-n { background: #059669; color: #fff; }
html[data-theme="dark"] .pf-tx .pf-tidy__hint { color: #93C5FD; }
@media (max-width: 575.98px) {
  .pf-tx .pf-tidy__step-head { flex-wrap: wrap; }
  .pf-tx .pf-tidy__step-title { flex: 1 1 0; }
  .pf-tx .pf-tidy__step-head::after { order: 2; }   /* the arrow stays beside the title */
  .pf-tx .pf-tidy__step-status { order: 3; margin-left: 2.25rem; width: 100%; text-align: left; }
}

/* People (2026-10-09) */
.pf-tx .pf-people__chip { display: inline-block; font-size: .72rem; border-radius: 999px; padding: .05rem .5rem; margin: 0 .25rem .2rem 0; background: var(--tx-panel); color: var(--tx-ink); white-space: nowrap; }
.pf-tx .pf-people__chip--needs { background: #FEF3C7; color: #92400E; }
.pf-tx .pf-people__chip--internal { background: #E0E7FF; color: #3730A3; }
.pf-tx .pf-people__need { color: #92400E; }
.pf-tx .pf-people__form { background: var(--tx-panel); border-radius: var(--tx-radius-lg); padding: .85rem 1rem; }
.pf-tx .pf-people__form select { min-width: 13rem; max-width: 20rem; margin-top: .2rem; }
.pf-tx .pf-people__cats { margin-left: 1.25rem; }
.pf-tx .pf-people__off { opacity: .45; }
.pf-tx .pf-people__warn { color: #92400E; margin: .2rem 0 .2rem 1.25rem; }
.pf-tx .pf-people__ask { display: inline-block; width: auto; min-width: 9.5rem; vertical-align: middle; }
.pf-tx .pf-people__pick .pf-people__ask { min-width: 0; }
.pf-tx .pf-people__you { background: #DCFCE7; color: #166534; }
.pf-tx .pf-people__role-tag { background: #E0F2FE; color: #075985; font-weight: 600; }
.pf-tx .pf-people__roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.pf-tx .pf-people__role { display: flex; gap: .55rem; align-items: flex-start; border: 1px solid var(--tx-border, #DCE5E0); border-radius: 12px;
  padding: .55rem .7rem; background: #fff; cursor: pointer; margin: 0; }
.pf-tx .pf-people__role:has(input:checked) { border-color: #047857; box-shadow: 0 0 0 2px rgba(4, 120, 87, .15); }
.pf-tx .pf-people__role .form-check-input { position: static; margin: .2rem 0 0; flex: none; }
.pf-tx .pf-people__role-t { display: flex; flex-direction: column; gap: .1rem; font-size: .85rem; }
.pf-tx .pf-people__role-h { color: var(--tx-muted, #667085); font-size: .78rem; }
.pf-tx .pf-people__role-c { font-size: .72rem; color: #047857; font-weight: 600; }
.pf-tx .pf-notes { border: 1px solid #DCE9E2; border-radius: 14px; padding: .7rem .9rem; margin-bottom: .9rem; background: #F7FBF9; }
.pf-tx .pf-notes summary { cursor: pointer; }
.pf-tx .pf-notes__list { display: grid; gap: .35rem; }
.pf-tx .pf-notes__row { display: grid; grid-template-columns: auto 7rem minmax(9rem, 14rem) 1fr; gap: .5rem; align-items: center; }
.pf-tx .pf-notes__row[hidden] { display: none; }
.pf-tx .pf-notes__word { font-weight: 700; color: #0B3B2E; }
.pf-tx .pf-notes__n { font-size: .8rem; color: var(--tx-muted, #667085); }
.pf-tx .pf-notes__pick { display: flex; gap: .4rem; flex-wrap: wrap; }
.pf-tx .pf-notes__pick select { max-width: 14rem; width: auto; display: inline-block; }
.pf-tx .pf-notes__io { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-size: .78rem; color: var(--tx-muted, #667085); }
@media (max-width: 767.98px) {
  .pf-tx .pf-notes__row { grid-template-columns: auto minmax(0, 1fr); }
  .pf-tx .pf-notes__n { grid-column: 2; }
  .pf-tx .pf-notes__pick { grid-column: 1 / -1; min-width: 0; }
  .pf-tx .pf-notes__io { display: flex; width: 100%; }
  .pf-tx .pf-notes__io select, .pf-tx .pf-notes__pick > select { flex: 1; min-width: 0; max-width: none; width: 100%; }
}
html[data-theme="dark"] .pf-tx .pf-people__role { background: #0F1A16; border-color: #23493B; }
html[data-theme="dark"] .pf-tx .pf-notes { background: #0F1A16; border-color: #23493B; }
html[data-theme="dark"] .pf-tx .pf-notes__word { color: #DCEFE7; }
html[data-theme="dark"] .pf-tx .pf-people__chip { background: #0B1612; color: #E5E7EB; }
html[data-theme="dark"] .pf-tx .pf-people__chip--needs { background: #2A2410; color: #FCD34D; }
html[data-theme="dark"] .pf-tx .pf-people__chip--internal { background: #1E1B4B; color: #C7D2FE; }
html[data-theme="dark"] .pf-tx .pf-people__need, html[data-theme="dark"] .pf-tx .pf-people__warn { color: #FCD34D; }
html[data-theme="dark"] .pf-tx .pf-people__form { background: #0B1612; }

/* Others like this (2026-10-09) */
.pf-tx .pf-similar { background: #ECFDF5; border: 1px solid #A7F3D0; border-radius: var(--tx-radius-lg); padding: .7rem .9rem; margin-bottom: 1rem; font-size: .88rem; }
.pf-tx .pf-similar code { color: var(--tx-ink); background: #fff; padding: .05rem .3rem; border-radius: 5px; }
.pf-tx .pf-similar__alt { font-size: .8rem; }
html[data-theme="dark"] .pf-tx .pf-similar { background: #0F2A20; border-color: #1F5A43; }
html[data-theme="dark"] .pf-tx .pf-similar code { background: #0B1612; color: #E5E7EB; }
@media (max-width: 767.98px) {
  .pf-tx .pf-people__table thead { display: none; }
  .pf-tx .pf-people__table, .pf-tx .pf-people__table tbody, .pf-tx .pf-people__table tr, .pf-tx .pf-people__table td { display: block; width: 100%; }
  .pf-tx .pf-people__table tr { border-bottom: 1px solid var(--tx-border, #E5E7EB); padding: .5rem 0; }
  .pf-tx .pf-people__table td { border: 0; text-align: left !important; padding: .15rem .5rem; white-space: normal; }
  .pf-tx .pf-people__table td[data-label]::before { content: attr(data-label) ": "; color: #6B7280; font-size: .8rem; }
  .pf-tx .pf-people__table td[data-label] > div { display: inline; }
  .pf-tx .pf-people__table td[data-label] > div + div::before { content: " · "; }
  .pf-tx .pf-people__form select { min-width: 0; width: 100%; }
}

/* Tick several and change together (2026-10-09) */
.pf-tx .pf-bulk { position: sticky; top: 0; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; background: #ECFDF5; border: 1px solid #A7F3D0; border-radius: var(--tx-radius-lg); padding: .5rem .75rem; margin-bottom: .75rem; }
.pf-tx .pf-bulk.d-none { display: none !important; }
.pf-tx .pf-bulk__picker select { min-width: 14rem; max-width: 20rem; }
.pf-tx .pf-tx-pick { vertical-align: middle; cursor: pointer; }
html[data-theme="dark"] .pf-tx .pf-bulk { background: #0F2A20; border-color: #1F5A43; }

/* Tidy up step 3, lighter (2026-10-19, founder: "visually it's a bit weird") */
.pf-tx .pf-tidy__quick-row + .pf-tidy__quick-row { border-top: 1px solid var(--tx-line, #E2E8F0); }
.pf-tx .pf-tidy__quick-who { display: flex; flex-direction: column; min-width: 0; }
.pf-tx .pf-tidy__quick-name { font-weight: 600; color: var(--tx-ink); }
.pf-tx .pf-tidy__kwtable thead th { background: transparent; color: #64748B; font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--tx-line, #E2E8F0); border-radius: 0; }
html[data-theme="dark"] .pf-tx .pf-tidy__kwtable thead th { color: #94A3B8; border-bottom-color: #23493B; }
html[data-theme="dark"] .pf-tx .pf-tidy__quick-row + .pf-tidy__quick-row { border-top-color: #23493B; }

/* "Back to Tidy up" over transactions opened from Tidy up (2026-10-22) */
.pf-tx .pf-tidy-back { position: sticky; top: 72px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem;
  margin: 0 0 .75rem; padding: .55rem .75rem; background: #ECFDF5; border: 1px solid #A7F3D0; border-radius: 12px; }
.pf-tx .pf-tidy-back[hidden] { display: none; }
html[data-theme="dark"] .pf-tx .pf-tidy-back { background: #12201B; border-color: #23493B; }

/* Tidy up, simpler (2026-10-25): two questions first, steps fold when sorted enough, small people in one line */
.pf-tx [data-tidy-questions] { border: 1px solid #A7F3D0; background: #F0FDF4; border-radius: 12px; padding: 1rem 1.1rem; margin: 1rem 0; }
.pf-tx .pf-q { position: relative; padding-left: 2.2rem; margin-bottom: 1rem; }
.pf-tx .pf-q:last-child { margin-bottom: 0; }
.pf-tx .pf-q__n { position: absolute; left: 0; top: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; background: #10B981; color: #fff; }
.pf-tx .pf-q__t { font-weight: 600; margin: 0 0 .15rem; color: var(--tx-ink); }
.pf-tx .pf-q__list { display: flex; flex-direction: column; gap: .35rem; }
.pf-tx .pf-q__item { display: flex; align-items: center; margin: 0; cursor: pointer; }
.pf-tx .pf-tidy__more { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1.1rem; margin: 1rem 0; border: 1px dashed #CBD5E1; border-radius: 12px; }
.pf-tx .pf-tidy__more[hidden], .pf-tx [data-tidy-questions][hidden] { display: none; }
.pf-tx .pf-people__small td { background: #F8FAFC; }
html[data-theme="dark"] .pf-tx [data-tidy-questions] { background: #0B1612; border-color: #065F46; }
html[data-theme="dark"] .pf-tx .pf-people__small td { background: #0F172A; }
html[data-theme="dark"] .pf-tx .pf-tidy__more { border-color: #334155; }

/* the "sorted enough" meter, pinned under the site header while scrolling Tidy up (2026-10-26) */
.pf-tx .pf-tidy__meter { position: sticky; top: var(--pf-tidy-top, 0px); z-index: 15; background: var(--tx-card, #fff); border: 1px solid #DCE5E0; border-radius: 12px; padding: .65rem 1rem .5rem; margin-bottom: .75rem; box-shadow: 0 4px 12px rgba(15, 23, 42, .06); }
.pf-tx .pf-tidy__meter[hidden] { display: none; }
.pf-tx .pf-tidy__meter-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pf-tx .pf-tidy__meter .pf-tidy__bar { margin: .45rem 0 .2rem; }
html[data-theme="dark"] .pf-tx .pf-tidy__meter { background: #0F1A16; border-color: #1F3A30; }

/* missing accounts: one row each, one question (2026-10-26) */
.pf-tx .pf-miss { display: flex; flex-direction: column; border: 1px solid #E2E8F0; border-radius: 10px; }
.pf-tx .pf-miss__row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem .8rem; }
.pf-tx .pf-miss__row + .pf-miss__row { border-top: 1px solid #EEF2F6; }
.pf-tx .pf-miss__who { flex: 1 1 16rem; min-width: 0; }
.pf-tx .pf-miss__act { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.pf-tx .pf-miss__ask { width: auto; min-width: 13rem; }
.pf-tx .pf-miss__act .pf-tidy__view { margin-left: 0 !important; }
html[data-theme="dark"] .pf-tx .pf-miss { border-color: #1F3A30; }
html[data-theme="dark"] .pf-tx .pf-miss__row + .pf-miss__row { border-color: #1F3A30; }
@media (max-width: 575.98px) {
  .pf-tx .pf-miss__act { width: 100%; margin-left: 0; }
  .pf-tx .pf-miss__ask { flex: 1; min-width: 0; }
}
.pf-tx .pf-tidy__meter-need { color: #92400E; margin-top: .2rem; }
.pf-tx .pf-tidy__meter-need .pf-tidy__view { color: #92400E; text-decoration: underline; }
html[data-theme="dark"] .pf-tx .pf-tidy__meter-need, html[data-theme="dark"] .pf-tx .pf-tidy__meter-need .pf-tidy__view { color: #FCD34D; }
.pf-tx .pf-people__fam { background: #EDE9FE; color: #5B21B6; font-weight: 600; }

/* Tidy up, Sort your transfers (2026-11-07, founder: line by line, one click, "not even level") */
.pf-tx .pf-people__bulk-cats { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pf-tx .pf-people__bulk-cats[hidden] { display: none; }
.pf-tx .pf-tidy__bulk .form-control-sm { height: calc(1.5em + .5rem + 2px); }
.pf-tx .pf-people__acts { width: 15rem; white-space: normal !important; }
.pf-tx .pf-people__pick { display: grid; grid-template-columns: 3.4rem 1fr; gap: .3rem .35rem; align-items: center; }
.pf-tx .pf-people__pick > .btn { justify-self: end; }
.pf-tx .pf-people__pick > span { justify-self: end; }
.pf-tx .pf-people__pick select { width: 100%; min-width: 0; max-width: none; }
.pf-tx .pf-people__pick .pf-people__cat + .pf-people__cat { grid-column: 2; }
.pf-tx .pf-people__status { text-align: right; margin-top: .3rem; white-space: normal; }
.pf-tx .pf-people__status:empty { display: none; }
.pf-tx .pf-people__row--done td { background: #F0FDF4; }
.pf-tx .pf-people__row--done .pf-people__chip--needs { opacity: .45; }
.pf-tx .pf-people__legend { line-height: 1.55; }
.pf-tx .pf-people__partner { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .35rem .25rem; }
html[data-theme="dark"] .pf-tx .pf-people__row--done td { background: #0F2A1F; }
@media (max-width: 767px) { .pf-tx .pf-people__acts { min-width: 0; } .pf-tx .pf-people__pick { justify-content: flex-start; } .pf-tx .pf-people__status { text-align: left; } }
/* Tidy up meter while a new upload is still being sorted (2026-11-07) */
.pf-tx .pf-tidy__loading { margin-top: .55rem; }
.pf-tx .pf-tidy__loading .pf-csv-progress { display: flex; gap: .5rem; align-items: center; color: #065F46; font-weight: 600; }
.pf-tx .pf-spin { display: inline-block; flex: none; width: 1rem; height: 1rem; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: pf-spin .8s linear infinite; }
.pf-tx .pf-spin--inline { width: .85rem; height: .85rem; margin-right: .45rem; vertical-align: -1px; color: #047857; }
.pf-tx .pf-tidy__bar--loading span { background: repeating-linear-gradient(45deg, #10B981 0 10px, #34D399 10px 20px); transition: width .6s ease; }
.pf-tx .pf-tidy__meter--loading .pf-tidy__bar--target { opacity: .55; }
@keyframes pf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pf-tx .pf-spin { animation-duration: 2.4s; } }
html[data-theme="dark"] .pf-tx .pf-tidy__loading .pf-csv-progress { color: #A7F3D0; }
/* Check nothing's missing: one row per thing to fix (2026-11-07) */
.pf-tx [data-tidy-accounts] .pf-miss, .pf-tx [data-tidy-balances] .pf-miss, .pf-tx [data-tidy-months].pf-miss { margin-bottom: .5rem; }
.pf-tx .pf-miss__act { margin-left: auto; display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
