/* ============================================================================
   V4 page additions: Transaktionen (W14)
   ----------------------------------------------------------------------------
   Source: webapp-v4/seiten/18-transaktionen.html (prefix transaktionen-, here
   bl-tx-). Used by business/transactions/v4/*, only inside the V4 shell
   (.bl-v4, FeatureSwitch v4_design).
   ========================================================================= */

/* Head: pills above the two buttons on the right */
.bl-v4 .bl-tx-head-text { min-width: 0; }
.bl-v4 .bl-tx-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; flex: none; }
.bl-v4 .bl-tx-hpill { cursor: default; }

/* Numbers and filters in one card (the legacy .bl-card is a flex column) */
.bl-v4 .bl-tx-overview { display: block; padding: 20px; overflow: visible; }
.bl-v4 .bl-tx-overview > * { min-width: 0; }
.bl-v4 .bl-tx-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bl-v4 .bl-tx-metrics dd { font-size: 24px; }
.bl-v4 .bl-tx-metrics .bl-metric-meta { margin-top: 2px; }
.bl-v4 .bl-tx-num--accent { color: var(--accent-ink); }
.bl-v4 .bl-tx-num--good { color: var(--good); }
.bl-v4 .bl-tx-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-width: 0; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.bl-v4 .bl-tx-filters > * { min-width: 0; }
.bl-v4 .bl-tx-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.bl-v4 .bl-tx-range { margin-left: auto; flex: none; }

/* List frame: v4-refresh fades the content, so the global turbo-frame[busy]
   fade (loading_states.css) would only make it fainter twice. */
.bl-v4 .bl-tx-frame { display: block; margin-top: 24px; }
.bl-v4 turbo-frame.bl-tx-frame.bl-tx-frame[busy] { opacity: 1; }

/* Table */
.bl-v4 .bl-tx-list { display: block; overflow: hidden; }
.bl-v4 .bl-tx-table th:nth-child(1) { width: 112px; }
.bl-v4 .bl-tx-table th:nth-child(2) { width: 220px; }
.bl-v4 .bl-tx-table td { vertical-align: top; }
.bl-v4 .bl-tx-table tbody tr.bl-tx-month:hover { background: none; }
.bl-v4 .bl-tx-month td { padding: 10px 16px; background: var(--surface-2); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bl-v4 .bl-tx-month-sum { margin-left: 6px; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.bl-v4 .bl-tx-month-sum b { font-weight: 700; font-variant-numeric: tabular-nums; }
.bl-v4 .bl-tx-plus { color: var(--accent-ink); }
.bl-v4 .bl-tx-minus { color: var(--ink-2); }
.bl-v4 .bl-tx-date { font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.bl-v4 .bl-tx-date time { cursor: help; }
.bl-v4 .bl-tx-time { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.bl-v4 .bl-tx-type { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.bl-v4 .bl-tx-type-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); flex: none; }
.bl-v4 .bl-tx-type-label { font-weight: 700; color: var(--ink); }
.bl-v4 .bl-tx-desc { line-height: 1.45; }
/* Second line from TransactionsHelper#transaction_description (company, referral) */
.bl-v4 .bl-tx-desc > span.block { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.bl-v4 .bl-tx-price { color: var(--muted); cursor: help; }
.bl-v4 .bl-tx-expiry { margin-left: 4px; vertical-align: 1px; }
.bl-v4 .bl-tx-report { display: block; margin-top: 4px; }
.bl-v4 .bl-tx-desc .bl-link,
.bl-v4 .bl-tx-c-receipt .bl-link { font-size: 12.5px; gap: 4px; }
.bl-v4 .bl-tx-amount { font-size: 15px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bl-v4 .bl-tx-amount--plus { color: var(--accent-ink); }
.bl-v4 .bl-tx-amount--minus { color: var(--ink); }
.bl-v4 .bl-tx-balance { color: var(--muted); }
.bl-v4 .bl-tx-none { color: var(--muted-2); }
.bl-v4 .bl-tx-mob { display: none; }

/* Pages (Kaminari) */
.bl-v4 .bl-tx-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.bl-v4 .bl-tx-pages-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.bl-v4 .bl-tx-pages-nav a { color: var(--accent-ink); font-weight: 600; }
.bl-v4 .bl-tx-pages-nav .current { color: var(--ink); font-weight: 700; }

/* Empty states */
.bl-v4 .bl-tx-empty { display: block; }
.bl-v4 .bl-tx-empty .bl-empty { margin-top: 0; padding: 56px 24px 48px; }
.bl-v4 .bl-tx-empty .bl-empty-ic { width: 32px; height: 32px; stroke-width: 1.4; }
.bl-v4 .bl-tx-empty .bl-empty-title { font-size: 18px; letter-spacing: -.01em; }
.bl-v4 .bl-tx-empty .bl-empty-sub { max-width: 46ch; line-height: 1.55; }
.bl-v4 .bl-tx-empty-btns { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.bl-v4 .bl-tx-empty-btns .bl-btn { margin-top: 0; }
.bl-v4 .bl-tx-or { font-size: 13px; color: var(--muted); }

@media (max-width: 1023.98px) {
  .bl-v4 .bl-tx-head-side { align-items: stretch; width: 100%; }
  .bl-v4 .bl-tx-head-side .bl-head-pills { justify-content: flex-start; }
  .bl-v4 .bl-tx-overview { padding: 16px; }
  .bl-v4 .bl-tx-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bl-v4 .bl-tx-metrics > div { padding: 12px 14px; }
  .bl-v4 .bl-tx-metrics dd { font-size: 20px; }
  .bl-v4 .bl-tx-filters { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
  .bl-v4 .bl-tx-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .bl-v4 .bl-tx-chips::-webkit-scrollbar { display: none; }
  .bl-v4 .bl-tx-chips .bl-chip { flex: none; }
  .bl-v4 .bl-tx-range { display: flex; margin-left: 0; }
  .bl-v4 .bl-tx-range .bl-seg-item { flex: 1 1 0; }
  .bl-v4 .bl-tx-csv { height: 44px; justify-content: center; }

  .bl-v4 .bl-tx-frame { margin-top: 16px; }
  .bl-v4 .bl-tx-mob { display: inline; }
  /* Phone: each booking as one row (old _transaction_card) */
  .bl-v4 .bl-tx-table.bl-table-stack tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "type amount" "desc desc"; gap: 8px 12px; }
  .bl-v4 .bl-tx-table.bl-table-stack tr.bl-tx-month { display: block; padding: 0; }
  .bl-v4 .bl-tx-table.bl-table-stack tr.bl-tx-month td { display: block; padding: 10px 16px; }
  .bl-v4 .bl-tx-table.bl-table-stack td.bl-tx-c-date,
  .bl-v4 .bl-tx-table.bl-table-stack td.bl-tx-c-balance,
  .bl-v4 .bl-tx-table.bl-table-stack td.bl-tx-c-receipt { display: none; }
  .bl-v4 .bl-tx-c-type { grid-area: type; min-width: 0; }
  .bl-v4 .bl-tx-c-amount { grid-area: amount; text-align: right; }
  .bl-v4 .bl-tx-table.bl-table-stack td.bl-tx-c-desc { grid-area: desc; padding-left: 40px; font-size: 13.5px; }
  .bl-v4 .bl-tx-type { white-space: normal; align-items: flex-start; }
  .bl-v4 .bl-tx-type-ic { margin-top: 1px; }
  .bl-v4 .bl-tx-type-sub { display: block; margin-top: 1px; font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
  .bl-v4 .bl-tx-amount-sub { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
  .bl-v4 .bl-tx-amount { font-size: 16px; }
  .bl-v4 .bl-tx-mob-receipt { display: block; }
  .bl-v4 .bl-tx-desc .bl-link { display: flex; width: max-content; min-height: 28px; margin-top: 4px; }
  .bl-v4 .bl-tx-pages { padding: 14px 16px; }
  .bl-v4 .bl-tx-pages-nav a { display: inline-flex; align-items: center; min-height: 40px; }

  .bl-v4 .bl-tx-empty .bl-empty { padding: 40px 20px 32px; }
  .bl-v4 .bl-tx-empty-btns { align-self: stretch; flex-direction: column; gap: 4px; }
  .bl-v4 .bl-tx-empty-btns .bl-btn { height: 44px; width: 100%; justify-content: center; }
  .bl-v4 .bl-tx-empty-btns .bl-link { min-height: 40px; text-align: center; justify-content: center; }
}
