/* 全站月份导航：个人会话独立选择，所有业务页面共享同一月份口径。 */

@media screen {
  .global-month-context {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #b7cdf8;
    border-radius: 9px;
    background: linear-gradient(135deg, #f8fbff 0%, #edf3ff 100%);
    box-shadow: 0 9px 24px rgba(35, 82, 164, 0.1);
  }

  .global-month-context[hidden] {
    display: none;
  }

  .global-month-context .result-gallery-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "month completion";
    align-items: center;
    gap: 18px;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .global-month-context .result-month-control {
    grid-area: month;
    min-width: 0;
  }

  .result-month-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
  }

  .global-month-context .result-month-caption {
    display: block;
    margin-bottom: 2px;
    color: #60708f;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: 0.08em;
  }

  #month-year-label {
    display: block;
    color: #153568;
    font-size: 18px;
    font-weight: 850;
    line-height: 1.2;
  }

  .result-month-button:focus-visible {
    outline: 3px solid rgba(47, 111, 228, 0.24);
    outline-offset: 2px;
  }

  .result-month-buttons {
    display: grid;
    grid-template-columns: repeat(12, minmax(48px, 1fr));
    gap: 6px;
    min-width: 0;
  }

  .result-month-button {
    min-width: 0;
    min-height: 42px;
    padding: 7px 4px;
    color: #405272;
    border: 1px solid #cfdbf2;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  }

  .result-month-button span {
    color: inherit;
    font-size: 16px;
    font-weight: 850;
  }

  .result-month-button:hover:not(:disabled):not(.is-selected) {
    color: #2058c1;
    border-color: #7fa5ef;
    background: #fff;
    transform: translateY(-1px);
  }

  .result-month-button.is-selected {
    color: #fff;
    border-color: #2058c1;
    background: linear-gradient(135deg, #2f6fe4 0%, #2058c1 100%);
    box-shadow: 0 7px 16px rgba(31, 88, 191, 0.24);
  }

  .result-month-button.is-complete:not(.is-selected) {
    color: #1f6048;
    border-color: #8bc7ae;
    background: #e7f5ee;
  }

  .result-month-button.is-selected.is-complete {
    color: #fff;
    border-color: #2058c1;
    background: linear-gradient(135deg, #2f6fe4 0%, #2058c1 100%);
    box-shadow: 0 7px 16px rgba(31, 88, 191, 0.24);
  }

  .result-month-button:disabled {
    cursor: default;
  }

  .result-month-button.is-future,
  .result-month-button.is-future:disabled {
    color: #626e84;
    border-color: #d8deea;
    background: #f2f4f8;
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
  }

  .global-month-context .result-completion {
    grid-area: completion;
    align-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    flex: 0 0 auto;
    min-width: 118px;
    min-height: 62px;
    padding: 12px 15px;
    color: #fff;
    border: 1px solid #1f58bf;
    border-radius: 7px;
    background: linear-gradient(135deg, #2f6fe4 0%, #2058c1 100%);
    box-shadow: 0 7px 16px rgba(31, 88, 191, 0.18);
  }

  .global-month-context #result-complete-count {
    grid-area: auto;
    margin: 0;
    color: #fff;
    font-family: inherit;
    font-size: 21px;
    font-weight: 850;
    line-height: 1.15;
  }

  .global-month-context .result-completion small {
    grid-area: auto;
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.3;
  }

  .global-month-scope {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(183, 205, 248, 0.74);
  }

  .global-month-scope-mark {
    display: grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    place-items: center;
    color: #2058c1;
    border: 1px solid #b7cdf8;
    border-radius: 5px;
    background: #fff;
    font-size: 10px;
    font-weight: 850;
  }

  .global-month-scope p {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 9px;
    min-width: 0;
    margin: 0;
    color: #60708f;
    font-size: 11px;
    line-height: 1.45;
  }

  .global-month-scope strong {
    color: #153568;
    font-weight: 800;
  }

  .result-month-control.is-readonly .result-month-heading::after {
    content: "只读";
    margin-left: auto;
    padding: 3px 7px;
    color: #60708f;
    border: 1px solid #cfdbf2;
    border-radius: 4px;
    background: #fff;
    font-size: 10px;
    font-weight: 750;
  }

  .result-gallery-heading.is-kpi-only {
    display: block;
  }

  .result-gallery-heading.is-kpi-only .department-kpi-overview {
    width: 100%;
  }

  @media (max-width: 820px) {
    .global-month-context {
      gap: 7px;
      margin-bottom: 12px;
      padding: 10px;
    }

    .global-month-context .result-gallery-meta {
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
    }

    .result-month-buttons {
      display: flex;
      gap: 6px;
      overflow-x: auto;
      overscroll-behavior-inline: contain;
      padding: 2px 2px 8px;
      scroll-snap-type: x proximity;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }

    .result-month-buttons::-webkit-scrollbar {
      display: none;
    }

    .result-month-button {
      flex: 0 0 62px;
      scroll-snap-align: center;
    }

    .global-month-context .result-completion {
      min-width: 100px;
      padding: 10px 12px;
    }
  }

  @media (max-width: 540px) {
    .global-month-context .result-gallery-meta {
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas:
        "month"
        "completion";
      gap: 8px;
    }

    .result-month-heading {
      margin-bottom: 8px;
    }

    #month-year-label {
      font-size: 17px;
    }

    .result-month-button {
      flex-basis: 60px;
      min-height: 44px;
    }

    .global-month-context .result-completion {
      display: flex;
      flex-direction: row;
      align-items: baseline;
      justify-content: flex-start;
      gap: 7px;
      min-width: 0;
      min-height: 0;
      padding: 8px 11px;
    }

    .global-month-context #result-complete-count {
      font-size: 18px;
    }

    .global-month-scope p span {
      flex-basis: 100%;
    }
  }
}
