/* ============================================================
   Encounters: the referral queue (/encounters) and one encounter
   (/encounters/{id}). Both pages are built from design-system components;
   this sheet only places them. Structure in @layer layout, paint in
   @layer design.

   The shared rules further down (.filter-bar, .filter-chip, .search-box,
   .pagination) are bare selectors that other pages (deals, audit,
   compliance, user management, deal detail...) still lean on. They stay
   here until those pages move to components.
   ============================================================ */

@layer layout {
  /* Page intro: the heading on the left, the officer's New Referral on the right. */
  .encounters .intro { display: flex; flex-wrap: wrap; align-items: flex-start;
                       justify-content: space-between; gap: var(--t-space-3); }

  /* The queue pane is flush, so the page pads what sits in it beside the table. */
  .encounters .pane .controls { display: flex; flex-wrap: wrap; align-items: center;
                                gap: var(--t-space-3); padding: var(--t-space-4) var(--t-space-5) 0; }
  .encounters .search { flex: 1; min-inline-size: 12rem; display: flex; align-items: end;
                        gap: var(--t-space-2); margin: 0; }
  .encounters .search .field { flex: 1; }
  .encounters .bulk-update { display: flex; flex-wrap: wrap; align-items: end;
                             gap: var(--t-space-3); padding-inline: var(--t-space-5); }
  .encounters .bulk-update .field { min-inline-size: 12rem; }
  .encounters .pager { padding: 0 var(--t-space-5) var(--t-space-4); }
  /* The queue pane is flush, so its empty message spaces itself off the edge. */
  .encounters .empty-note { margin: var(--t-space-4) var(--t-space-5); }
  .encounters tr.encounter .date { white-space: nowrap; }

  .encounter-detail > .button { justify-self: start; }
  .encounter-detail .statement { margin: 0; white-space: pre-wrap; }

  /* ── shared with other pages (see the header) ── */
  .filter-bar { display: flex; flex-wrap: wrap; gap: var(--mea-space-2); margin: 0; padding: 0; }
  .filter-chip { display: inline-flex; align-items: center; min-height: var(--t-target-min, 44px);
                 padding: var(--mea-space-2) var(--mea-space-4); border: 0;
                 border-radius: var(--mea-radius-pill); cursor: pointer; white-space: nowrap; }
  .search-box { flex: 1; min-inline-size: 12rem; display: flex; align-items: center; gap: var(--mea-space-2);
                margin: 0; padding: var(--mea-space-2) var(--mea-space-3);
                border-radius: var(--mea-radius-md); }
  .search-box__input { flex: 1; min-height: var(--t-target-min, 44px);
                       border: 0; background: transparent; padding: 0; }
  .pagination { display: flex; flex-wrap: wrap; align-items: center;
                justify-content: center; gap: var(--mea-space-4);
                padding: var(--mea-space-3) var(--mea-space-4); }
  .pagination__info { margin: 0; }
}

@layer design {
  .encounters tr.encounter th { color: var(--c-surface-text-color-base); }

  /* ── shared with other pages (see the header) ── */
  /* Filter chips. .is-active marks the chip for the current filter. */
  .filter-chip { background: var(--t-bg-recessed); color: var(--t-text-secondary);
                 font-size: var(--mea-text-sm); font-weight: var(--mea-w-semibold);
                 transition: background var(--mea-dur-fast), color var(--mea-dur-fast); }
  .filter-chip:hover { background: var(--t-bg-active); }
  .filter-chip.is-active { background: var(--t-accent); color: var(--t-accent-text); }

  .search-box { background: var(--t-bg-elevated); color: var(--t-text); border: 1px solid var(--t-border); }
  .search-box__icon { color: var(--t-text-muted); }
  .search-box__input { color: var(--t-text); font-size: var(--mea-text-md); }
  .search-box__input::placeholder { color: var(--t-text-muted); }
  .search-box:focus-within { border-color: var(--t-border-focus); }

  .pagination { border-block-start: 1px solid var(--t-border); }
  .pagination__info { font-size: var(--mea-text-sm); color: var(--t-text-muted); }
}
