/*
 * Banking pane (banking/bank_accounts/show) — the account-picker heading
 * dropdown, the reconciliation card, and the Transactions section header.
 */

@layer components {
  /* Account picker — the account name IS the page heading; clicking the whole
     <summary> opens a dropdown of the tenant's other accounts. Native <details>. */
  .bank-picker {
    display: inline-block;
  }

  .bank-picker__trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
  }

  .bank-picker__chevron {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-icon-quiet);
    transition: transform var(--duration-base) var(--ease-out);
  }

  .bank-picker[open] .bank-picker__chevron {
    transform: rotate(180deg);
  }

  /* Stacked + left-aligned: name on top, number beneath. Scoped to `.bank-picker`
     so it outranks `.dropdown__item`'s row/center defaults (dropdown.css loads
     after banking.css alphabetically, so equal specificity would lose). */
  .bank-picker .dropdown__item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-0-5);
  }

  .bank-picker__num {
    color: var(--color-text-body);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
  }

  /* Reconciliation card — bank vs books, the difference, the auto-update line. */
  .reconciliation__eyebrow {
    margin: 0 0 var(--space-4);
    font-size: var(--text-11);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-body);
  }

  .reconciliation__balances {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
    max-width: 32rem;
  }

  .reconciliation__label {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--color-text-body);
  }

  .reconciliation__amount {
    margin: var(--space-1) 0 0;
    font-size: var(--text-xl);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-heading);
  }

  .reconciliation__amount--muted {
    color: var(--color-text-body);
    font-weight: 500;
  }

  .reconciliation__meta {
    margin: var(--space-1) 0 0;
    font-size: var(--text-xs);
    color: var(--color-text-body);
  }

  .reconciliation__summary {
    margin: var(--space-4) 0 0;
    color: var(--color-text-body);
  }

  .reconciliation__rule {
    margin: var(--space-4) 0;
    border: 0;
    border-top: 1px solid var(--color-border);
  }

  .reconciliation__update {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--color-text-body);
  }

  .reconciliation__update-form {
    margin: var(--space-1) 0 0;
  }

  /* Section header — a small uppercase title with a trailing control (Filter). */
  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: var(--space-8) 0 var(--space-3);
  }

  .section-header__title {
    margin: 0;
    font-size: var(--text-11);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-body);
  }

  /* The Filter dropdown's panel hugs the right edge (it sits at the row's end). */
  .section-header__filter .dropdown__panel {
    left: auto;
    right: 0;
  }

  /* A button that reads as a text link — low-emphasis inline actions like
     "Update now" inside a card. */
  .btn--link {
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: underline;
  }

  .btn--link:hover {
    background: transparent;
    color: var(--color-primary-hover);
    text-decoration: none;
  }

  /* Row actions (slice 82): the ⋯ menu on an unmatched transaction. The shared panel
     stretches to its trigger (`left: 0; right: 0`), which overflows a one-glyph button —
     anchor it to the button's right edge and open leftwards instead. The transactions card
     releases its overflow so the panel isn't clipped on the last row. */
  .bank-tx__actions {
    display: inline-block;
    vertical-align: middle;
  }

  .bank-tx__actions .dropdown__panel {
    left: auto;
    right: 0;
    min-width: 14rem;
  }

  .card--flush.bank-tx__card { /* out-specifies .card--flush, which loads later */
    overflow: visible;
  }
}

/* The matching workbench (slice 84): the two sides of the mirror, side by side. */
.matching-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: start;
  margin-block-end: var(--space-4);
}

.matching-columns__title {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-3) var(--space-4) 0;
}

.matching-columns__empty {
  padding: var(--space-4);
}

@media (max-width: 900px) {
  .matching-columns {
    grid-template-columns: 1fr; /* the columns stack; the pairing still works */
  }
}

/* The judgment clusters (slice 84): amount links that filter both columns. */
.matching-clusters__item {
  display: inline-block;
  margin-inline-end: var(--space-2);
}
