/*
 * Shared "bk-*" design language of the Banking workspace — buttons, pills,
 * toolbar, tables, panels, modals. Loaded by BOTH /accounting/banking and
 * /accounting/bank-transactions (bank fetch) via <style src>, and relied on
 * by every component under components/accounting/banking/*.
 * Non-scoped on purpose: the modals are Bulma .modal overlays.
 */

.bk-btn {
  display: inline-flex; align-items: center; gap: 0.4rem; height: 34px; padding: 0 0.8rem; box-sizing: border-box;
  border: 1.5px solid var(--theme-border, #e0e0e0); border-radius: 8px; background: var(--theme-bg-primary, #fff);
  color: var(--theme-text-primary, #333); font-size: 0.8125rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all 0.15s; line-height: 1;
}
.bk-btn:hover:not(:disabled) { border-color: var(--theme-accent, #8b5cf6); color: var(--theme-accent, #8b5cf6); }
.bk-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bk-btn--primary { background: var(--theme-accent, #8b5cf6); border-color: var(--theme-accent, #8b5cf6); color: #fff; }
.bk-btn--primary:hover:not(:disabled) { background: var(--theme-accent-dark, #7c3aed); border-color: var(--theme-accent-dark, #7c3aed); color: #fff; }
.bk-btn--success { background: #059669; border-color: #059669; color: #fff; }
.bk-btn--success:hover:not(:disabled) { background: #047857; border-color: #047857; color: #fff; }
.bk-btn--danger { background: var(--theme-danger-bg, #fee2e2); border-color: transparent; color: var(--theme-danger-text, #dc2626); }
.bk-btn--danger:hover:not(:disabled) { border-color: var(--theme-danger-text, #dc2626); color: var(--theme-danger-text, #dc2626); }
.bk-btn--ghost { border-color: transparent; background: transparent; color: var(--theme-text-secondary, #535353); }
.bk-btn--small { height: 26px; padding: 0 0.55rem; font-size: 0.72rem; border-radius: 6px; }
.bk-btn__count { background: rgba(255, 255, 255, 0.25); border-radius: 999px; padding: 0 6px; font-size: 0.7rem; }

.bk-pill {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; line-height: 1.3;
  background: var(--theme-bg-tertiary, #f0f0f0); color: var(--theme-text-secondary, #535353);
}
.bk-pill--neutral { background: var(--theme-bg-tertiary, #f0f0f0); color: var(--theme-text-secondary, #535353); }
.bk-pill--info    { background: var(--theme-info-bg, #dbeafe); color: var(--theme-info-text, #1e40af); }
.bk-pill--success { background: var(--theme-success-bg, #dcfce7); color: var(--theme-success-text, #166534); }
.bk-pill--warning { background: var(--theme-warning-bg, #fef3c7); color: var(--theme-warning-text, #92400e); }
.bk-pill--danger  { background: var(--theme-danger-bg, #fee2e2); color: var(--theme-danger-text, #dc2626); }
.bk-pill--tiny { padding: 0 0.4rem; font-size: 0.66rem; margin-left: 0.3rem; }
.bk-pill--btn { cursor: pointer; }
.bk-pill--btn:hover { filter: brightness(0.95); border-color: currentColor; }

.bk-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem; border-radius: 12px;
  background: var(--theme-bg-secondary, #f7f7fb); border: 1px solid var(--theme-border, #ececf1);
}
.bk-toolbar__spacer { flex: 1; }
.bk-select {
  height: 34px; padding: 0 0.75rem; border: 1.5px solid var(--theme-border, #e0e0e0); border-radius: 8px;
  background: var(--theme-bg-primary, #fff); color: var(--theme-text-primary, #333); font-size: 0.8125rem; cursor: pointer; max-width: 240px;
}
.bk-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem; height: 34px; padding: 0 0.7rem; box-sizing: border-box;
  border: 1.5px solid var(--theme-border, #e0e0e0); border-radius: 8px; background: var(--theme-bg-primary, #fff);
  font-size: 0.8125rem; font-weight: 600; user-select: none; cursor: pointer; color: var(--theme-text-primary, #333);
}
.bk-toggle--plain { border: none; background: transparent; padding: 0; height: auto; font-weight: 500; color: var(--theme-text-secondary, #535353); }
.bk-toggle input[type="checkbox"] {
  accent-color: var(--theme-accent, #8b5cf6); width: 16px; height: 16px; margin: 0; flex-shrink: 0;
  transform: none;   /* global styles.css scales every checkbox ×2 — keep these compact */
}

.bk-seg { display: inline-flex; gap: 0.2rem; background: var(--theme-bg-primary, #fff); border: 1px solid var(--theme-border, #e4e4ea); border-radius: 8px; padding: 0.18rem; }
.bk-seg__btn {
  border: none; background: transparent; padding: 0.3rem 0.6rem; border-radius: 6px; cursor: pointer;
  font-size: 0.78rem; font-weight: 600; color: var(--theme-text-secondary, #6c757d); display: inline-flex; align-items: center; gap: 0.3rem;
  transition: background 0.15s, color 0.15s;
}
.bk-seg__btn:hover { color: var(--theme-text-primary, #333); }
.bk-seg__btn--active { background: var(--theme-accent, #8b5cf6); color: #fff; }
.bk-seg__count { font-size: 0.66rem; opacity: 0.8; background: rgba(127, 127, 127, 0.15); border-radius: 999px; padding: 0 5px; }
.bk-seg__btn--active .bk-seg__count { background: rgba(255, 255, 255, 0.25); opacity: 1; }

.bk-hint { margin: 0; font-size: 0.78rem; color: var(--theme-text-muted, #9b9b9b); display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }

.bk-panel { background: var(--theme-bg-primary, #fff); border: 1px solid var(--theme-border, #e6e8ec); border-radius: 12px; overflow: hidden; min-width: 0; }
.bk-panel__head { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--theme-border, #eef0f3); background: var(--theme-bg-secondary, #f8f8f8); }
.bk-panel__title { margin: 0; font-size: 0.85rem; font-weight: 700; color: var(--theme-text-primary, #0f172a); display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.bk-panel__count { font-size: 0.7rem; background: var(--theme-bg-tertiary, #f0f0f0); color: var(--theme-text-secondary, #535353); border-radius: 999px; padding: 0 7px; font-weight: 700; }

.bk-table-wrap { overflow-x: auto; }
.bk-scroll { max-height: calc(100vh - 390px); min-height: 160px; overflow-y: auto; }
.bk-scroll--tall { max-height: calc(100vh - 350px); }
.bk-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; color: var(--theme-text-primary, #1b1d1d); }
.bk-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: 0.5rem 0.7rem; white-space: nowrap;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700;
  color: var(--theme-text-muted, #94a3b8); background: var(--theme-table-header-bg, #f8f8f8);
  border-bottom: 1px solid var(--theme-table-border, #e4e3e6);
}
.bk-table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--theme-table-border, #eef0f3); vertical-align: top; }
.bk-table--compact td, .bk-table--compact th { padding: 0.35rem 0.55rem; font-size: 0.78rem; }
.bk-table--hover tbody tr:hover td { background: var(--theme-table-row-hover, #f5f5f5); }
.bk-row--click { cursor: pointer; }
.bk-row--active td { background: var(--theme-bg-selected, #ede9fe) !important; }
/* Exclusive CURRENT row (plain row click) — violet, exactly one per table.
   Declared BEFORE the marked rules so an (also) checkbox-marked row stays amber. */
.bk-row--current td { background: var(--theme-bg-selected, #ede9fe) !important; }
.bk-row--current td:first-child { box-shadow: inset 3px 0 0 var(--theme-accent, #8b5cf6); }
.bk-table--hover tbody tr.bk-row--current:hover td { background: #ddd6fe !important; }
.dark .bk-row--current td, [data-mode="dark"] .bk-row--current td { background: rgba(139, 92, 246, 0.22) !important; }
.dark .bk-table--hover tbody tr.bk-row--current:hover td, [data-mode="dark"] .bk-table--hover tbody tr.bk-row--current:hover td { background: rgba(139, 92, 246, 0.32) !important; }
/* Persistent user mark (checkbox) — amber, distinct from the purple selection */
.bk-row--marked td { background: #fef3c7 !important; }
.bk-row--marked td:first-child { box-shadow: inset 3px 0 0 #d97706; }
.bk-table--hover tbody tr.bk-row--marked:hover td { background: #fde68a !important; }
.dark .bk-row--marked td, [data-mode="dark"] .bk-row--marked td { background: rgba(217, 119, 6, 0.22) !important; }
.dark .bk-table--hover tbody tr.bk-row--marked:hover td, [data-mode="dark"] .bk-table--hover tbody tr.bk-row--marked:hover td { background: rgba(217, 119, 6, 0.32) !important; }
.bk-right { text-align: right !important; }
.bk-center { text-align: center !important; padding: 1.25rem 0.7rem !important; }
.bk-nowrap { white-space: nowrap; }
.bk-muted { color: var(--theme-text-muted, #9b9b9b); }
.bk-small { font-size: 0.76rem; }
.bk-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.bk-amt { font-variant-numeric: tabular-nums; }
/* Signed amounts: credit = green, debit = red (explicit colours, both themes) */
/* (Bulma's `strong { color }` would override inheritance — target it too) */
.bk-amt--neg, .bk-amt--neg strong { color: #dc2626; font-weight: 700; }
.bk-amt--pos, .bk-amt--pos strong { color: #15803d; font-weight: 700; }
.dark .bk-amt--neg, .dark .bk-amt--neg strong, [data-mode="dark"] .bk-amt--neg, [data-mode="dark"] .bk-amt--neg strong { color: #f87171; }
.dark .bk-amt--pos, .dark .bk-amt--pos strong, [data-mode="dark"] .bk-amt--pos, [data-mode="dark"] .bk-amt--pos strong { color: #4ade80; }
/* Counterparty (other party of a transaction) — always bold */
.bk-party { font-weight: 700; color: var(--theme-text-primary, #1b1d1d); }
.bk-radio {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--theme-border-dark, #535353); box-sizing: border-box; position: relative; top: 2px;
}
.bk-radio--on { border-color: var(--theme-accent, #8b5cf6); box-shadow: inset 0 0 0 3px var(--theme-bg-primary, #fff); background: var(--theme-accent, #8b5cf6); }

.bk-banner { border-radius: 12px; padding: 0.7rem 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.bk-banner--success { background: var(--theme-success-bg, #dcfce7); color: var(--theme-success-text, #166534); }
.bk-banner__head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.bk-banner__close { margin-left: auto; }
.bk-banner__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; }
.bk-banner__list li { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.bk-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3.5rem 1rem; color: var(--theme-text-secondary, #999); gap: 0.4rem; }
.bk-empty--soft { padding: 2.5rem 1rem; }
.bk-empty__icon { font-size: 3rem; opacity: 0.35; margin-bottom: 0.5rem; }
.bk-empty h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--theme-text-primary, #333); }
.bk-empty p { margin: 0 0 0.75rem; max-width: 48ch; }

.bk-spin { display: inline-block; animation: bk-spin 0.9s linear infinite; }
@keyframes bk-spin { to { transform: rotate(360deg); } }

/* Modals (Bulma .modal-card, themed) */
.bk-modal { width: 92%; max-width: 1100px; }
.bk-modal__head { background: var(--theme-modal-bg, #fff); border-bottom: 1px solid var(--theme-border, #e6e8ec); align-items: flex-start; }
.bk-modal__titles { flex: 1; min-width: 0; }
.bk-modal__title { color: var(--theme-text-primary, #0f172a); font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.bk-modal__sub { margin: 0.15rem 0 0; font-size: 0.8rem; color: var(--theme-text-secondary, #64748b); }
.bk-modal__body { background: var(--theme-modal-bg, #fff); color: var(--theme-text-primary, #1b1d1d); display: flex; flex-direction: column; gap: 0.75rem; }
.bk-modal__foot { background: var(--theme-modal-bg, #fff); border-top: 1px solid var(--theme-border, #e6e8ec); gap: 0.5rem; }
.bk-summary { display: flex; flex-wrap: wrap; gap: 0.75rem 1.75rem; padding: 0.6rem 0.9rem; border-radius: 10px; background: var(--theme-bg-secondary, #f8f8f8); }
.bk-summary__item { display: flex; flex-direction: column; }
.bk-summary__label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; color: var(--theme-text-muted, #94a3b8); }
.bk-summary__value { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bk-summary__value--accent { color: var(--theme-accent, #8b5cf6); }
.bk-summary__value--danger { color: var(--theme-danger-text, #dc2626); }
.bk-note { padding: 0.75rem 0.9rem; border-radius: 10px; background: var(--theme-bg-secondary, #f8f8f8); color: var(--theme-text-secondary, #535353); font-size: 0.85rem; }
.bk-box { border: 1px solid var(--theme-border, #e6e8ec); border-radius: 10px; padding: 0.7rem 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.bk-box--accent { border-color: var(--theme-accent-light, #a78bfa); background: var(--theme-accent-soft, #ede9fe); }
.bk-box__head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.85rem; }
.bk-box__sep { color: var(--theme-text-muted, #9b9b9b); }
.bk-box__balance { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--theme-text-secondary, #535353); font-size: 0.8rem; }
.bk-box__foot { margin: 0; }
