/* =========================================================
   健康 · 药箱  （与首页同一套暖黄语言）
   ========================================================= */

:root {
  --cabinet-yellow: var(--home-bg, #E8D478);
  --cabinet-pink: #F3BBC4;
  --cabinet-white: #FFFDF8;
  --cabinet-black: #151515;
  --cabinet-text: #151515;
  --cabinet-muted: rgba(21, 21, 21, .55);
  --cabinet-green: #557F39;
  --cabinet-green-soft: rgba(110, 150, 80, .12);
  --cabinet-warning: #C78A24;
  --cabinet-danger: #C95448;
  --radius-small: 14px;
  --radius-card: 24px;
  --radius-large: 28px;
  --radius-pill: 999px;
}

html:has(body.is-warm) { background: var(--cabinet-yellow); }

body.is-warm {
  --topbar-height: 52px;
  color: var(--cabinet-text);
  background: var(--cabinet-yellow);
}

body.is-warm .app-shell,
body.is-warm .main-view,
body.is-warm .page-content,
body.is-warm .topbar,
body.is-warm #page-health,
body.is-warm #page-finance,
body.is-warm #page-life,
body.is-warm #page-settings {
  background: var(--cabinet-yellow);
}

body.is-warm.is-settings .profile {
  pointer-events: auto;
}

body.is-warm .page-content {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 0 20px calc(130px + env(safe-area-inset-bottom, 0px));
}

body.is-warm .topbar {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
  width: min(480px, 100%);
  height: calc(52px + env(safe-area-inset-top, 0px));
  margin: 0 auto;
  padding: env(safe-area-inset-top, 0px) 20px 0;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

body.is-warm .topbar-profile { display: block; }
body.is-warm .topbar__greeting,
body.is-warm .profile-text { display: none; }

body.is-warm .profile {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: none;
}

body.is-warm .avatar {
  width: 40px;
  height: 40px;
  font-size: 22px;
  line-height: 1;
}

body.is-warm .topbar-settings {
  width: 40px;
  height: 40px;
}

body.is-warm .topbar-settings__icon,
body.is-warm .topbar-settings .icon {
  width: 27px;
  height: 27px;
}

/* ---------- 二级 Tab：药箱 / 体重 / 档案 ---------- */

.health-subnav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0 0 4px;
}

.health-subnav__item {
  position: relative;
  padding: 0 0 6px;
  border: 0;
  background: none;
  color: var(--cabinet-text);
  opacity: .48;
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
}

.health-subnav__item.is-on {
  opacity: 1;
  font-weight: 650;
}

.health-subnav__item.is-on::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 18px;
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--cabinet-black);
  transform: translateX(-50%);
}

body:not(.is-warm) .health-subnav {
  padding: 0 2px;
}

/* ---------- Hero ---------- */

.cabinet-page {
  display: flex;
  flex-direction: column;
}

.cabinet-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px 16px;
  margin: 18px 0 12px;
}

.cabinet-hero__title {
  margin: 0;
  font-size: clamp(42px, 12vw, 58px);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -0.04em;
  color: var(--cabinet-text);
}

.cabinet-hero__desc {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.35;
  opacity: .72;
}

.cabinet-hero__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.cabinet-hero__count {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}

.cabinet-hero__count strong {
  font-size: 58px;
  font-weight: 700;
  line-height: .9;
  letter-spacing: -0.04em;
}

.cabinet-hero__count span {
  margin-top: 6px;
  font-size: 16px;
  opacity: .72;
}

.cabinet-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 20px rgba(70, 55, 10, .06);
  color: var(--cabinet-text);
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.cabinet-add .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* ---------- 药箱问诊 ---------- */

.cabinet-consult {
  display: grid;
  gap: 18px;
  margin: 0 0 18px;
  padding: 24px;
  border: 0;
  border-radius: var(--radius-large);
  background: linear-gradient(120deg, #F6C2CB, #F3B7C0);
  box-shadow: none;
}

.cabinet-consult__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--cabinet-text);
}

.cabinet-consult__title .icon {
  width: 20px;
  height: 20px;
}

.cabinet-consult__hint {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.4;
  opacity: .58;
}

.cabinet-consult__who {
  margin-top: 8px;
}

.cabinet-consult__person {
  margin: 0;
  font-size: 12px;
  opacity: .42;
}

.cabinet-consult .person-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
}

.cabinet-consult .person-switch__item {
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .42);
  box-shadow: none;
  font-size: 11px;
  font-weight: 550;
}

.cabinet-consult .person-switch__item.is-active {
  background: rgba(21, 21, 21, .86);
  color: #fff;
}

.cabinet-consult__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cabinet-consult__chips {
  display: flex;
  flex-wrap: nowrap;
  flex: 1;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.cabinet-consult__chips::-webkit-scrollbar { display: none; }

.cabinet-consult__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .55);
  color: var(--cabinet-text);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
}

.cabinet-consult__chip .icon {
  width: 16px;
  height: 16px;
  color: #C45B6A;
}

.cabinet-consult__go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-shrink: 0;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--cabinet-black);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.cabinet-consult__go .icon {
  width: 16px;
  height: 16px;
}

.cabinet-consult__go .icon--next {
  width: 14px;
  height: 14px;
}

/* ---------- 搜索 ---------- */

.cabinet-search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 62px;
  margin: 0 0 14px;
  padding: 0 20px;
  border-radius: var(--radius-large);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 22px rgba(70, 55, 10, .05);
  color: var(--cabinet-muted);
}

.cabinet-search .icon {
  width: 22px;
  height: 22px;
}

.cabinet-search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--cabinet-text);
  font-size: 17px;
  outline: none;
}

.cabinet-search__input::placeholder {
  color: var(--cabinet-text);
  opacity: .48;
}

/* ---------- 筛选 ---------- */

.cabinet-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cabinet-filter + .cabinet-filter { margin-top: 10px; }

.cabinet-filter__label {
  flex: 0 0 auto;
  width: 32px;
  color: var(--cabinet-text);
  font-size: 14px;
  font-weight: 650;
}

.cabinet-filter__scroll {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.cabinet-filter__scroll::-webkit-scrollbar { display: none; }

.cabinet-filter__more {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  color: rgba(21, 21, 21, .38);
}

.cabinet-filter__more .icon {
  width: 16px;
  height: 16px;
}

.cabinet-chip {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .74);
  color: rgba(20, 20, 20, .62);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
}

.cabinet-chip.is-on {
  background: var(--cabinet-yellow);
  box-shadow:
    inset 0 0 0 1px rgba(170, 120, 10, .25),
    0 4px 12px rgba(130, 90, 10, .08);
  color: var(--cabinet-black);
  font-weight: 650;
}

/* ---------- 家里的药 ---------- */

.cabinet-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 12px;
}

.cabinet-section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.cabinet-section-head span {
  font-size: 15px;
  opacity: .52;
}

.cabinet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cabinet-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 140px;
  max-height: 165px;
  padding: 16px;
  border: 0;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 18px rgba(70, 55, 10, .04);
  cursor: pointer;
}

.cabinet-card__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: var(--radius-small);
  color: rgba(21, 21, 21, .72);
}

.cabinet-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cabinet-card__icon .icon {
  width: 24px;
  height: 24px;
}

.cabinet-card__icon.is-mint { background: #E4EED8; }
.cabinet-card__icon.is-sky { background: #DCE8F6; }
.cabinet-card__icon.is-sand { background: #F3E6C4; }
.cabinet-card__icon.is-blush { background: #F6DDE3; }
.cabinet-card__icon.is-lilac { background: #E6DFF3; }

.cabinet-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.cabinet-card__name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
}

.cabinet-card__meta {
  margin-top: 4px;
  overflow: hidden;
  color: rgba(20, 20, 20, .48);
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cabinet-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin-top: auto;
  padding: 0 8px 0 0;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 550;
}

.cabinet-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.cabinet-status.is-ok {
  background: var(--cabinet-green-soft);
  color: var(--cabinet-green);
}

.cabinet-status.is-warn {
  background: rgba(199, 138, 36, .12);
  color: var(--cabinet-warning);
}

.cabinet-status.is-danger {
  background: rgba(201, 84, 72, .12);
  color: var(--cabinet-danger);
}

.cabinet-status.is-muted {
  background: rgba(21, 21, 21, .06);
  color: rgba(21, 21, 21, .48);
}

.cabinet-page .medicine-empty {
  grid-column: 1 / -1;
  padding: 28px 12px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, .72);
}

.cabinet-page .medicine-pagination {
  margin-top: 16px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, .72);
}

@media (max-width: 349px) {
  body.is-warm .page-content { padding-inline: 14px; }
  body.is-warm .topbar { padding-inline: 14px; }
  .cabinet-grid { gap: 8px; }
  .cabinet-hero__count strong { font-size: 48px; }
  .cabinet-add { height: 48px; padding: 0 16px; font-size: 15px; }
}

@media (max-width: 280px) {
  .cabinet-grid { grid-template-columns: 1fr; }
}

@media (max-width: 320px) {
  .cabinet-consult__row {
    flex-wrap: wrap;
  }

  .cabinet-consult__go {
    margin-left: auto;
  }
}
