/* ── Account statements (period + balances + evidence document) ───────── */

.bank-row-link {
  color: inherit;
  text-decoration: none;
}

.bank-row-link:hover { color: var(--teal); }

.account-balance-note {
  font-size: 0.7rem;
  color: var(--gray-mid);
  margin-top: 0.15rem;
}

/* ---------- Statement show / new header ---------- */
.statement-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.statement-header-main { min-width: 0; }
.statement-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.statement-title-row h1 { margin: 0; }
.statement-period-chip {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-mid);
  background: var(--gray-light);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.statement-header-meta {
  margin-top: 0.4rem;
  font-size: 0.88rem;
  color: var(--gray-mid);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.statement-header-meta strong { color: var(--gray-dark); font-weight: 600; }
.statement-header-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  min-width: 14rem;
}
.statement-header-actions form { margin: 0; }
.statement-header-actions .btn { white-space: nowrap; }

/* Reconciliation lifecycle — badge palettes for the two states badges.css
   doesn't already cover (approved reuses the shared .status-approved), and
   the transition buttons tinted with the state they move the statement TO. */
.status-not_reconciled { background: var(--pending-bg); color: var(--pending); }
.status-in_review      { background: var(--review-bg); color: var(--review); }

.btn-state-not_reconciled { background: var(--pending-bg); color: var(--pending); border-color: var(--pending); }
.btn-state-not_reconciled:hover { background: var(--pending-bg); color: var(--pending); }
.btn-state-in_review { background: var(--review-bg); color: var(--review); border-color: var(--review-border); }
.btn-state-in_review:hover { background: var(--review-bg-hover); color: var(--review); }
.btn-state-approved { background: var(--approved-bg); color: var(--approved); border-color: var(--success-border); }
.btn-state-approved:hover { background: var(--approved-bg-hover); color: var(--approved); }

/* Footer action bar (see .entry-action-bar, cashbook.css): forward right,
   revert left; an empty left side still pushes the forward button right. */
.statement-transition-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.statement-transition-actions-left,
.statement-transition-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.statement-transition-actions form { margin: 0; }

.statement-status-history,
.change-history {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--gray-mid);
}
.statement-status-history strong,
.change-history strong { color: var(--gray-dark); }

/* Balance bar — full-width strip below the title */
.statement-balance-bar-wrap { margin-top: 1rem; }
.statement-balance-bar {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.balance-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.balance-cell--file { margin-left: auto; align-self: center; }
.balance-label {
  font-size: 0.72rem;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.balance-value { font-weight: 600; color: var(--gray-dark); }

.statement-field-hint {
  font-size: 0.72rem;
  color: var(--gray-mid);
}

/* ---------- Reconciliation (statement show page) ---------- */
.reconciliation-banner {
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.reconciliation-banner--ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.reconciliation-banner--off {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.reconciliation-banner--info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--border);
}
.reconciliation-banner--info a { color: inherit; }

.reconciliation-summary {
  width: auto;
  min-width: 24rem;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.reconciliation-summary td {
  padding: 0.35rem 0;
  color: var(--gray-mid);
}
.reconciliation-summary .reconciliation-amount {
  text-align: right;
  padding-left: 2.5rem;
  font-variant-numeric: tabular-nums;
  color: var(--gray-dark);
  font-weight: 500;
}
.reconciliation-count { font-size: 0.78rem; color: var(--text-faint); }
.reconciliation-subtotal td {
  border-top: 1px solid var(--divider);
  font-weight: 600;
  color: var(--gray-dark);
}
.reconciliation-difference td {
  border-top: 1px solid var(--divider);
  font-weight: 700;
}
.reconciliation-difference.is-balanced td,
.snapshot-balanced { color: var(--success); }
.reconciliation-difference.is-off td,
.snapshot-off { color: var(--danger); }

.reconciliation-warning {
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--warning-bg);
  border: 1px solid var(--border);
  color: var(--gray-dark);
  margin-bottom: 0.75rem;
}
.reconciliation-warning ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}
/* Red variant, matching .reconciliation-banner--off above. */
.reconciliation-warning--critical {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-dark);
}

.reconciliation-list-heading {
  font-size: 0.95rem;
  margin: 1.25rem 0 0.5rem;
}

/* The account-correction picker (cashbook_entries/_account_assign). Compact
   inline row: it renders both in a reconciliation warning list item and in the
   cashbook entry page's narrow account detail cell. */
.account-assign-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
/* The select carries .filter-select for the shared control look (border,
   white background, teal focus ring); only the compact sizing is local. */
.account-assign-form .filter-select {
  width: auto;
  min-width: 0;
  max-width: 100%;
  font-size: 0.82rem;
  padding: 0.3rem 0.45rem;
}

/* ---------- Transfers ---------- */
/* A transfer side with no project account — money from or to the outside
   world (e.g. INT HQ). */
.transfer-external {
  color: var(--gray-mid);
  font-style: italic;
}

/* ---------- Inline edit (click-to-edit field) ---------- */
.inline-edit { display: inline-block; }
/* Without it an editable balance looks identical to a static one. */
.inline-edit-display {
  cursor: pointer;
  padding: 0.05rem 0.3rem;
  margin: -0.05rem -0.3rem;
  border-radius: 4px;
  border-bottom: 1px dashed var(--border-input);
  transition: background 0.15s;
}
.inline-edit-display:hover {
  border-bottom-color: var(--teal);
  background: var(--warning-bg);
}
.inline-edit-display:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}
.inline-edit-placeholder {
  color: var(--text-faint);
  font-style: italic;
}
.inline-edit-input {
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--text-strong);
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--teal);
  border-radius: 4px;
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(0, 154, 149, 0.15);
  max-width: 9rem;
}
.inline-edit-input:focus { outline: none; }

.balance-bar-hint,
.balance-bar-error {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}
.balance-bar-hint { color: var(--gray-mid); }
.balance-bar-error { color: var(--danger); font-weight: 500; }

/* ---------- Change history (account + statement audit trails) ----------
   The list itself rides the .statement-status-history rule above. */
.change-history strong { margin-right: 0.35rem; }
.change-from { text-decoration: line-through; }
.change-arrow { margin: 0 0.15rem; }
.change-to { color: var(--gray-dark); font-weight: 600; }

/* ---------- Expert bank account: outstanding advance ---------- */
.advance-lead {
  margin: 0 0 1.25rem;
  font-size: 0.88rem;
  color: var(--gray-mid);
  max-width: 60rem;
}
.advance-note {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--gray-mid);
  max-width: 60rem;
}
/* Its own name, not .status-closed: that palette is the ToR's (badges.css),
   and this file loads later, so reusing it would recolour ToR badges too.
   Dark enough to read: a faint grey here is ~2.5:1, under AA for 0.75rem. */
.status-badge.status-account-closed {
  color: var(--gray-dark);
  background: var(--surface-muted);
}
/* Colour, not opacity — opacity compounds with the badge inside the cell.
   Must out-specify `.data-table tbody td`, which sets its own colour. */
.data-table tbody tr.account-row--closed td { color: var(--gray-mid); }
.advance-closed-note {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--gray-mid);
  font-size: 0.88rem;
}
.account-close-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.9rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--divider);
}
/* Why the Close beside it is disabled. Visible text, not a title tooltip:
   a tooltip never reaches a touch or keyboard reader. */
.close-blocked-reason {
  margin: 0;
  font-size: 0.82rem;
  color: var(--gray-mid);
  text-align: right;
  max-width: 46rem;
}
/* The control is an <a> on one page and a <button> on another, and a bare
   button does not inherit the page font. */
.account-close-bar .btn {
  font-family: inherit;
  line-height: 1.2;
}

/* Width floors: a narrow viewport must scroll the wrap, not crush the
   columns. Auto layout starves a freely-breakable cell without them. */
.accounts-table  { min-width: 46rem; }
.transfers-table { min-width: 62rem; }
.reconciliation-entries-table { min-width: 44rem; }
.accounts-table th:first-child,
.accounts-table td:first-child { min-width: 11rem; }
.transfers-table th:nth-child(5),
.transfers-table td:nth-child(5) { min-width: 12rem; }
.accounts-table td:first-child,
.transfers-table td:nth-child(5) {
  white-space: normal;
  overflow-wrap: break-word;
}

/* Long free-text descriptions must wrap inside the column, not push the
   table past its container. */
.advance-spend-table td:nth-child(2) {
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 14rem;
}
.advance-spend-table td:first-child { white-space: nowrap; }
.advance-converted { color: var(--gray-mid); font-style: italic; }
.advance-unconverted { color: var(--danger); font-size: 0.8rem; }
