@scope (.list-page) {
  :scope {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  .toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-bottom: var(--space-xl);
    flex-shrink: 0;

    @media (width < 48rem) {
      flex-direction: column;
      align-items: stretch;
      gap: var(--space-md);

      .button {
        width: 100%;
        justify-content: center;
      }

      > .search-filter {
        display: flex;
        width: 100%;
      }

      .search-filter__input--expanded {
        flex: 1;
        width: auto;
        min-width: 0;
      }
    }
  }

  .filters {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }

  input[type="date"].form-input {
    appearance: none;
    border: none;
    background-color: var(--color-surface-muted);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    font-size: var(--text-body);
    font-weight: var(--font-medium);
    font-family: var(--font-body);
    line-height: var(--leading-tight);
    padding: var(--space-md) var(--space-xl);
    color-scheme: light dark;

    &:hover {
      background-color: var(--color-primary-muted);
    }

    &:focus-visible {
      outline: var(--focus-ring);
      outline-offset: 0;
    }
  }

  /* Flatten form children into the toolbar flex so New / search / submit / filters share one gap. */
  .toolbar > .search-filter {
    display: contents;
  }

  /* Global input[type="search"] is width: 100%; without this it crushes the New button. */
  .toolbar input[type="search"] {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  .search-filter {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: var(--space-md);
    align-items: center;
    flex-wrap: wrap;
  }

  .search-filter__input {
    height: 2.85rem; /* Matches button height */
    padding-inline: var(--space-lg);
    background: var(--color-surface-muted);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-body);
    font-family: var(--font-body);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .search-filter__input:focus-visible {
    border-color: var(--color-focus);
    outline: var(--focus-ring);
    outline-offset: -1px;
    background-color: var(--color-surface);
  }

  .search-filter__input--expanded {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  select.search-filter__input {
    min-width: 12rem;
    flex-shrink: 0;
    padding-inline-end: calc(var(--space-lg) + 1.5rem);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%2364748b'%3E%3Cpath d='m12 15.41 5.71-5.7-1.42-1.42-4.29 4.3-4.29-4.3-1.42 1.42z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-sm) center;
    background-size: 1.5rem;
  }

  input[type="date"].search-filter__input {
    flex-shrink: 0;
  }

  .list-page__summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
  }

  .summary-card {
    background: linear-gradient(145deg, var(--color-surface), var(--color-surface-muted));
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }

  .summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--color-primary), var(--color-info));
  }

  .summary-card__label {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
  }

  .summary-card__value {
    font-size: var(--text-heading-2);
    font-weight: var(--font-extrabold);
    color: var(--color-text-heading);
    font-family: var(--font-mono);
    letter-spacing: var(--tracking-tighter);
  }

  .list-page__content {
    flex: 1;
    position: relative; /* contains .visually-hidden empties so they don't grow the document */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  .list-page__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4xl) var(--space-lg);
    color: var(--color-text-muted);
    font-size: var(--text-body-sm);
  }

  .list-page__footer {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }

  .list-page__pagination {
    justify-content: space-between;
    flex-shrink: 0;
    padding-top: var(--space-lg);
  }

  .list-page__page-status {
    color: var(--color-text-secondary);
    font-size: var(--text-body-sm);
  }
}
