/* ============================================================
   User Management (desk/staff) page. Built from design-system components;
   this sheet only places them and carries the page's own cell emphasis.
   Structure in @layer layout, paint in @layer design.

   The user-management__intro family and the stat-figure rules further down
   still place the roster-import page, which has not moved yet. The bare
   .filter-bar / .filter-chip / .search-box / .status-badge rules are shared
   with other pages and stay until those pages move as well.
   ============================================================ */

@layer layout {
  /* Directory intro: the heading on the left, the add links on the right. */
  .user-management .intro { display: flex; flex-wrap: wrap; align-items: flex-start;
                            justify-content: space-between; gap: var(--t-space-3); }
  .user-management .add { display: flex; flex-wrap: wrap; gap: var(--t-space-2); }

  /* Controls: the role chips and the search beside or below them. The search
     takes the room the chips leave. */
  .user-management .controls { display: flex; flex-wrap: wrap; align-items: center;
                               gap: var(--t-space-3); }
  .user-management .controls .search-bar { flex: 1; }

  /* The directory's list card is flush, so the page pads what sits in it.
     The bulk form's fieldset is padded; the table below it runs to the edges. */
  .user-management .bulk > .field { padding: var(--t-space-4) var(--t-space-5) 0; }
  .user-management .roles .checks { list-style: none; margin: 0; padding: 0; display: grid;
                                    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
                                    gap: var(--t-space-1) var(--t-space-4); }
  .user-management .pager { padding: var(--t-space-4) var(--t-space-5); }

  /* Demo-account visibility: the standing statement of what this list shows
     versus withholds, followed by the link that reverses it. It is one line of
     text, not a box of its own. */
  .user-management__demo-visibility { display: flex; flex-wrap: wrap; align-items: baseline;
                                      gap: var(--t-space-3); margin-block: var(--t-space-3);
                                      font-size: var(--t-font-size-sm); }

  /* Cell emphasis and the actions column. */
  .user-management .created { white-space: nowrap; }
  .user-management .actions { white-space: nowrap; }
  .user-management .row-actions { display: flex; flex-wrap: wrap; gap: var(--t-space-2); }
  .user-management .email-note { display: block; }
  .user-management .managed-note { display: inline-block; max-inline-size: 18rem; }

  /* ── 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; }
  .status-badge { display: inline-flex; align-items: center;
                  padding: var(--mea-space-1) var(--mea-space-3);
                  border-radius: var(--mea-radius-pill); white-space: nowrap; }

  /* ── roster import (still on its own markup) ── */
  .user-management__intro { display: flex; flex-wrap: wrap; align-items: flex-start;
                            justify-content: space-between; gap: var(--mea-space-3); }
  .user-management__heading { display: grid; gap: var(--mea-space-1); min-inline-size: 0; }
  .user-management__title, .user-management__subtitle { margin: 0; }
  .user-management__add { flex-shrink: 0; white-space: nowrap; }
  @container (max-width: 36rem) {
    .user-management__add { display: flex; flex-wrap: wrap; gap: var(--mea-space-2);
                            max-inline-size: 100%; }
  }
  .stat-figure { display: grid; gap: var(--mea-space-1); align-content: start;
                 padding: var(--mea-space-4) var(--mea-space-5); border-radius: var(--mea-radius-xl); }
  .stat-figure__label, .stat-figure__value { margin: 0; }
}

@layer design {
  .user-management .name { font-weight: var(--t-font-weight-semibold); color: var(--c-surface-text-color-base); }
  .user-management .email-note { font-size: var(--t-font-size-xs); color: var(--c-surface-text-color-muted); }
  .user-management .created { color: var(--c-surface-text-color-muted); }
  .user-management .managed-note { font-size: var(--t-font-size-sm); color: var(--c-surface-text-color-muted); }

  /* The line sits on the page background, so it takes that surface's inks;
     the card inks (--t-text-*) are dark and vanish on it. */
  .user-management__demo-visibility { color: var(--c-surface-text-color-muted); }
  .user-management__demo-toggle { color: var(--c-surface-text-color-interactive); }

  /* ── shared with other pages (see the header) ── */
  .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); }

  .status-badge { font-size: var(--mea-text-xs); font-weight: var(--mea-w-semibold);
                  background: var(--t-bg-recessed); color: var(--t-text-secondary); }
  .status-badge--active { background: var(--t-success-bg); color: var(--t-success-text); }
  .status-badge--closed { background: var(--t-bg-active); color: var(--t-text-muted); }

  /* ── roster import (still on its own markup) ── */
  .user-management__title { font-family: var(--mea-font-citizen); font-size: var(--mea-text-2xl);
                            font-weight: var(--mea-w-bold); color: var(--t-text); }
  .user-management__subtitle { font-size: var(--mea-text-md); color: var(--t-text-secondary); }
  .stat-figure { background: var(--t-card-bg); border: 1px solid var(--t-card-border);
                 box-shadow: var(--mea-shadow-sm); }
  .stat-figure__label { font-size: var(--mea-text-sm); font-weight: var(--mea-w-semibold);
                        color: var(--t-text-muted); }
  .stat-figure__value { font-size: var(--mea-text-3xl); font-weight: var(--mea-w-extrabold);
                        line-height: var(--mea-lh-tight); color: var(--t-text); }
  .stat-figure__value--positive { color: var(--t-success-text); }
  .stat-figure__value--negative { color: var(--t-error-text); }
}
