/* Activity register. Scoped so the shell's table rules stay intact. */

.activity-page {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.activity-toolbar {
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: 0;
}

.activity-search {
  flex: 1 1 16rem;
  min-width: 0;
  max-width: 100%;
}

.activity-search-all {
  flex: 0 0 auto;
}

/*
 * Desktop shows both chip rows in the toolbar. On a phone they collapse
 * behind one Filter button (see the media query at the end) so the list
 * itself is what the person sees first.
 */
.activity-filter-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
}

.activity-filter-toggle {
  display: none;
}

/* The date presets and period picker are not shown while All months results are. */
.activity-toolbar > [hidden] {
  display: none !important;
}

.activity-search-summary {
  margin: 0 0 var(--space-3);
  color: var(--muted);
  font-size: var(--text-sm);
}

.search-scope {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.search-scope-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

/* `.toolbar label` stacks fields; a two-choice control stays on one line. */
.toolbar .search-scope-option {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.search-scope-option:has(input:checked) {
  background: var(--navy);
  color: var(--card);
}

.toolbar .search-scope-option:has(input:checked) {
  background: var(--navy);
  color: var(--card);
}

.search-scope-option input {
  accent-color: var(--gold);
  margin: 0;
}

.search-scope-option:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.activity-count {
  margin: 0 0 var(--space-3);
  color: var(--muted);
}

.activity-desc-text,
.activity-subline,
.activity-mobile-meta,
.activity-search-summary {
  overflow-wrap: anywhere;
}

.activity-subline,
.activity-mobile-meta {
  display: block;
  color: var(--muted);
  font-size: var(--text-sm);
}

.activity-mobile-meta {
  display: none;
}

.activity-cell-amount,
.activity-cell-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.activity-cell-date,
.activity-cell-month {
  color: var(--muted);
}

.activity-cell-booked {
  color: var(--ink);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.activity-booked-label {
  font-weight: var(--weight-medium);
}

.activity-booked-by {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
}

.activity-booking h3 {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-md);
}

.activity-booking-list {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-4);
}

.activity-booked-when {
  margin: var(--space-2) 0;
  color: var(--muted);
}

.activity-in {
  color: var(--ok);
}

.activity-out {
  /* A text colour, not a background token: navy is only for backgrounds. */
  color: var(--ink);
}

.activity-page .data-table .activity-cell-date {
  width: 7rem;
}

.activity-page .data-table .activity-cell-source {
  width: 5.5rem;
}

.activity-page .data-table .activity-cell-status {
  width: 10rem;
}

.activity-page .data-table .activity-cell-booked {
  width: 13rem;
}

.activity-page .data-table .activity-cell-amount {
  width: 8rem;
}

.activity-table--search .activity-cell-month {
  width: 6rem;
}

.activity-status-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.activity-fact {
  margin: 0 0 var(--space-2);
}

.activity-fact-label {
  color: var(--muted);
}

.activity-page .data-table {
  width: 100%;
  table-layout: fixed;
}

@media (max-width: 720px) {
  .activity-page {
    overflow-x: hidden;
  }

  .activity-page .table-scroll {
    overflow-x: hidden;
  }

  .activity-page .table-scroll table {
    display: block;
    width: 100%;
  }

  .activity-page .table-scroll thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
  }

  .activity-page .table-scroll tr.activity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--space-3);
    align-items: start;
    width: 100%;
  }

  .activity-page .table-scroll td {
    display: block;
    width: auto;
    min-width: 0;
    text-align: left;
  }

  .activity-page .table-scroll td.activity-cell-date,
  .activity-page .table-scroll td.activity-cell-month,
  .activity-page .table-scroll td.activity-cell-source,
  .activity-page .table-scroll td.activity-cell-status,
  .activity-page .table-scroll td.activity-cell-booked {
    display: none;
  }

  .activity-page .activity-mobile-meta {
    display: block;
  }

  .activity-page .activity-cell-desc {
    grid-column: 1;
    grid-row: 1;
  }

  .activity-page .activity-cell-amount {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  /* The desktop column width (8rem) would otherwise squeeze the description. */
  .activity-page .table-scroll td.activity-cell-amount {
    width: auto;
  }

  /*
   * Phone: one Filter button, two chip rows behind it. The count on the button
   * is the number of filters doing something, so a collapsed panel never
   * hides an active filter without saying so.
   */
  .activity-filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    flex: 0 0 auto;
  }

  .activity-filter-panel {
    display: none;
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
  }

  .activity-toolbar.filters-open .activity-filter-panel {
    display: flex;
  }

  .activity-filter-panel .report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  /* Keep the list, not the page furniture, above the fold on a phone. */
  .activity-page .lede {
    display: none;
  }

  .activity-page .page-title {
    margin-bottom: var(--space-2);
  }

  .activity-toolbar {
    gap: var(--space-2);
    margin-bottom: 0;
  }

  .activity-count {
    margin: var(--space-2) 0;
  }
}
