@layer page {
  /* Year + month navigation */
  .history-nav {
    padding: 12px var(--content-padding) 0;
    position: sticky;
    top: 0;
    background: var(--color-bg-primary);
    z-index: var(--z-popup);
  }

  .history-year-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }

  .history-go-to-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-white);
    color: var(--color-text);
    font-size: var(--text-caption);
    font-weight: var(--font-weight-medium);
    cursor: pointer;

    svg {
      width: 16px;
      height: 16px;
      color: var(--color-muted);
    }

    &:active {
      background: var(--color-bg-secondary);
    }
  }

  .history-year-select {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-white);
    color: var(--color-text);
    cursor: pointer;
  }

  .history-month-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  .history-month-tab {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--text-caption);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    color: var(--color-muted);
    text-transform: capitalize;

    &.active {
      background: var(--color-primary-selected);
      color: #fff;
      font-weight: var(--font-weight-semibold);
    }

    &:active {
      opacity: 0.7;
    }
  }

  /* Content list — day groups of shared .agenda-schedule-item rows. */
  .history-list {
    padding: 8px 0 24px;
  }

  /* The label's built-in top padding is neutralized so group spacing is driven
     entirely by explicit values: 8px from the tabs to the first group (list
     padding), 20px between groups. */
  .history-list .page-section-label {
    padding-top: 0;
  }

  .history-date-group + .history-date-group {
    margin-top: 20px;
  }

  .history-day-link {
    color: inherit;
    text-decoration: none;

    &:active { opacity: 0.7; }
  }

  /* The time treatment (small/muted/tabular) now lives on the shared
     .agenda-schedule-item-time base rule (agenda.css); history just keeps the
     name at normal weight for its quieter, lower-bold browsable voice. */
  .history-list .agenda-schedule-item-name {
    font-weight: var(--font-weight-normal);
  }

  /* Cancelled / rejected rows recede — the name goes muted and the cue is a
     plain gray "cancelado" label, not a colored action. */
  .history-list .agenda-schedule-item--cancelled .agenda-schedule-item-name {
    color: var(--color-muted);
  }

  .agenda-schedule-item-action--muted {
    color: var(--color-muted);
  }

  .history-empty {
    padding: 40px var(--content-padding);
    text-align: center;
    color: var(--color-muted);
  }
}
