.favorite-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  margin-top: 22px;
  padding: 7px;
  border: 1px solid #d8e4ec;
  border-radius: 16px;
  background: linear-gradient(135deg, #f3f8fb 0%, #edf4f8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .85);
}

.patient-favorites .favorite-tabs button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 58px;
  padding: 0 14px 0 17px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #355266;
  font-weight: 760;
  text-align: left;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease,
    box-shadow .18s ease, transform .18s ease;
}

.patient-favorites .favorite-tabs button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #55d0ba;
  opacity: 0;
  transform: scaleY(.35);
  transition: opacity .18s ease, transform .18s ease;
}

.patient-favorites .favorite-tabs button:hover:not(.active) {
  border-color: #d2e0e9;
  background: rgba(255, 255, 255, .76);
  color: #123f5d;
  transform: translateY(-1px);
}

.patient-favorites .favorite-tabs button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-favorites .favorite-tabs button b {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #d0dee7;
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  color: #476679;
  font: 800 .72rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.patient-favorites .favorite-tabs button.active {
  border-color: #123f5d;
  background: linear-gradient(125deg, #123f5d 0%, #185d78 100%);
  box-shadow: 0 8px 18px rgba(18, 63, 93, .2);
  color: #fff;
}
.patient-favorites .favorite-tabs button.active::before { opacity: 1; transform: scaleY(1); }
.patient-favorites .favorite-tabs button.active b {
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
.patient-favorites .favorite-tabs button:focus-visible {
  outline: 3px solid rgba(17, 121, 162, .3);
  outline-offset: 2px;
}
.favorite-group.tab-panel { margin: 0; padding: 18px 0 0; }
.favorite-group[hidden] { display: none; }
.favorite-group .favorite-grid { margin-top: 0; }
.favorite-group .favorite-empty { padding: 30px 4px; }

/* 721–1279px：六等分列宽不足以完整显示三语标签，改自然宽度单行，
   容器放不下时才横向滚动（flex:0 0 auto 禁止收缩，避免省略号截断） */
@media (min-width: 721px) and (max-width: 1279px) {
  .favorite-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .favorite-tabs::-webkit-scrollbar { display: none; }
  .patient-favorites .favorite-tabs button { flex: 0 0 auto; }
}

@media (max-width: 720px) {
  .favorite-tabs {
    display: flex;
    gap: 6px;
    margin-right: -16px;
    padding: 6px 16px 6px 6px;
    overflow-x: auto;
    border-right: 0;
    border-radius: 14px 0 0 14px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .favorite-tabs::-webkit-scrollbar { display: none; }
  .patient-favorites .favorite-tabs button {
    flex: 0 0 auto;
    min-height: 54px;
    padding: 0 12px 0 15px;
    scroll-snap-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .patient-favorites .favorite-tabs button,
  .patient-favorites .favorite-tabs button::before { transition: none; }
}
