/* The agenda of the day (dashboard/show): one card per band, one row per
   practice. Header, filters, cards and badges are the shared components of
   the other lists; only the band title and the two-level row live here.
   The action columns share one template so that badges, dates and
   competences line up across the rows of a band. */
@layer components {
  .agenda-band {
    margin-block-end: var(--space-6);
  }

  .agenda-band__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-block-end: var(--space-2);
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
  }

  .agenda-band__icon {
    color: var(--color-ink-subtle);
  }

  .agenda-band--overdue .agenda-band__icon {
    color: var(--color-negative);
  }

  .agenda-band__count {
    font-size: var(--text-xs);
    font-weight: var(--weight-normal);
    color: var(--color-ink-muted);
  }

  .agenda-list {
    --agenda-practice-col: 16rem;
    --agenda-action-cols: minmax(0, 1fr) 9rem 9rem;
  }

  .agenda-row {
    display: grid;
    grid-template-columns: var(--agenda-practice-col) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-4);
    padding: var(--row-pad-y) var(--space-4);
    font-size: var(--table-text);
    color: var(--color-ink);
  }

  .agenda-row__practice {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    min-width: 0;
    color: inherit;
    text-decoration: none;

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

  .agenda-row__client {
    min-width: 0;
  }

  .agenda-row__actions {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .agenda-action {
    display: grid;
    grid-template-columns: var(--agenda-action-cols);
    align-items: baseline;
    gap: var(--space-3);
  }

  .agenda-action__what {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-2);
    min-width: 0;
  }

  .agenda-action__label {
    min-width: 0;
    color: inherit;
    font-weight: var(--weight-medium);
    text-decoration: none;

    &:hover {
      color: var(--color-primary);
      text-decoration: underline;
    }
  }

  .agenda-action__when,
  .agenda-action__competence {
    font-size: var(--text-xs);
    color: var(--color-ink-muted);
    white-space: nowrap;
  }

  /* A term already past: red, and the words say it too ("scaduto da"). */
  .agenda-action__when .is-overdue {
    color: var(--color-negative);
  }

  /* Narrow screens: the practice above its actions, and each action on two
     lines (what to do, then date and competence). */
  @media (max-width: 52rem) {
    .agenda-row {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-2);
    }

    .agenda-action {
      grid-template-columns: auto minmax(0, 1fr);
      row-gap: 0;
    }

    .agenda-action__what {
      grid-column: 1 / -1;
    }
  }
}
