@layer components {
  .year-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0;
  }

  .year-header__title h1 {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.1;
  }

  .year-header__subtitle {
    color: var(--text-muted);
  }

  .year-header__nav,
  .year-header__actions {
    display: flex;
    gap: 0.5rem;
  }

  .tracker-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0.25rem 0 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
  }

  .tracker-pager__link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-cell);
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.1s ease, color 0.1s ease;
  }

  .tracker-pager__link:hover {
    background: var(--surface);
    color: var(--text);
  }

  .tracker-pager__arrow {
    font-size: 1rem;
    line-height: 1;
  }

  .tracker-pager__name {
    font-weight: 500;
  }

  .year-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.25rem;
    margin-top: 0.5rem;
  }

  .year-grid__month {
    min-width: 0;
    font-size: 0.5rem;
    font-weight: 500;
    text-align: center;
    color: var(--text-muted);
    padding-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  /* Override .cell defaults for the year grid: anchors are inline by default,
   * so set display: block and ensure the aspect-ratio constraint holds. */
  .year-grid .cell {
    width: auto;
  }

  /* Days that don't exist (Feb 30) — leave space, no fill, no border. */
  .cell--invalid {
    background: none;
    aspect-ratio: 1;
    border-radius: var(--radius-cell);
  }

  .year-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-cell);
  }

  .year-summary__stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    text-align: left;
  }

  .year-summary__value {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.1;
  }

  .year-summary__label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  /*
   * All-trackers-per-year table. Horizontal scroll inside a single container;
   * the date column sticks to the left, the tracker-name header row sticks to
   * the top. DESIGN.md §4.3.
   */
  .all-year {
    width: 100%;
    overflow: auto;
    max-height: 80vh;
    border: 1px solid var(--border);
    border-radius: var(--radius-cell);
    background: var(--surface);
  }

  .all-year__table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
  }

  .all-year__sticky-row {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface);
  }

  .all-year__sticky-col {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
  }

  .all-year__corner {
    z-index: 3;
  }

  .all-year__head {
    width: 1.75rem;
    padding: 0.5rem 0.125rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-weight: 500;
  }

  .all-year__abbr {
    display: inline-block;
    color: inherit;
    text-decoration: none;
  }

  .all-year__abbr:hover {
    color: var(--text);
  }

  .all-year__date {
    padding: 0 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    text-align: right;
    white-space: nowrap;
    border-right: 1px solid var(--border);
  }

  .all-year__cell-wrap {
    padding: 1px;
    width: 1.75rem;
  }

  .all-year__cell-wrap .cell {
    width: 100%;
  }
}
